forked from argandas/ardubson
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ardubsonObject.h
44 lines (34 loc) · 963 Bytes
/
ardubsonObject.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
ardubson.h - Library for the BSON (Binary-JSON) format.
Created by Hugo Arganda (argandas), April 6, 2016.
Released into the public domain.
*/
/*
Check BSON specification at:
http://bsonspec.org/spec.html
*/
#ifndef ardubson_object_h
#define ardubson_object_h
#include "Arduino.h"
#include "ardubsonTypes.h"
#include "ardubsonConfig.h"
#include "ardubsonElement.h"
class BSONObject
{
public:
/* Build BSON Object from binary data */
BSONObject(char* data);
/* API to BSON Object buffer */
char* rawData(void);
/* Total number of bytes comprising the document */
int32_t len(void);
/* Get BSON Element by name */
BSONElement getField(const char *key);
/* Print BSON document in JSON format */
char* jsonString(void);
private:
bool appendJSON(const char* data);
char _objData[BSON_BUFF_SIZE];
char _jsonStr[JSON_MAX_SIZE];
};
#endif