semilimes mcu sdk 1.1.3 semilimes Software Development Kit for microcontrollers

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