| semilimes mcu sdk 1.1.2 semilimes Software Development Kit for microcontrollers

Loading...
Searching...
No Matches
dc_contact.h
1#ifndef _dc_contact_
2#define _dc_contact_
3
4#include "../defines.h"
5
6 class DcContact
7{
8 private:
9 SmeJson json_data;
10 char* json = nullptr;
11 char* jsonArray = nullptr;
12
13 public:
14/* Function: DcContact
15
16 A message that references one or more account Ids to be added as contacts
17
18 Prototype:
19 void DcContact::set();
20
21 Parameters:
22
23 Returns:
24 void
25*/
26 DcContact()
27 {
28 int size = strlen("{\"dataComponentType\":\"contact\"}")+1;//add '\0' for null-termination
29 json = new char[size];
30
31 json_data.initJson(json);
32 json_data.addPair2JsonStr(json,"dataComponentType","contact");
33 }
34
35// Function: ~DcContact
36
37// distructor of the class, frees up the memory occupied by the array/s
38
39// Prototype:
40// ~DcContact()
41
42// Parameters:
43
44// Returns:
46 ~DcContact()
47 {
48 delete[] json;
49 delete[] jsonArray;
50 json = nullptr;
51 jsonArray = nullptr;
52 }
53
54// Function: DcContact.addContactIds
55
56// Add a contact Id to the array
57
58// Prototype:
59// void DcContact::addContactIds(const char* contactIds);
60
61// Parameters:
63
64// Returns:
66 void addContactIds(const char* data);
67
68// Function: DcContact.appendContactIds
69
70// Append the contact Id array to the json message
71
72// Prototype:
73// void DcContact::appendContactIds();
74
75// Parameters:
76
77// Returns:
79 void appendContactIds();
80
81// Function: DcContact.get
82
83// return the json script
84
85// Prototype:
86// void DcContact::get();
87
88// Parameters:
89
90// Returns:
92 char* get();
93};
94
95#endif
DcContact
Definition dc_contact.h:7
DcContact::get
char * get()
Definition dc_contact.cpp:67
DcContact::~DcContact
~DcContact()
Definition dc_contact.h:46
DcContact::appendContactIds
void appendContactIds()
Definition dc_contact.cpp:45
DcContact::addContactIds
void addContactIds(const char *data)
Definition dc_contact.cpp:16