File tree Expand file tree Collapse file tree 2 files changed +8
-11
lines changed Expand file tree Collapse file tree 2 files changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -41,19 +41,14 @@ ArduinoCloudThing::ArduinoCloudThing() {
41
41
}
42
42
43
43
44
- bool ArduinoCloudThing::begin () {
45
-
46
- #ifdef TESTING_PROTOCOL
47
- return true ;
48
- #endif
44
+ void ArduinoCloudThing::begin () {
49
45
50
46
status = ON;
51
47
addProperty (status, READ);
52
48
}
53
49
54
- void ArduinoCloudThing::publish (CborArray& object) {
50
+ int ArduinoCloudThing::publish (CborArray& object, uint8_t * data ) {
55
51
56
- uint8_t data[1024 ];
57
52
size_t size = object.encode (data, sizeof (data));
58
53
59
54
#ifdef TESTING_PROTOCOL
@@ -64,9 +59,11 @@ void ArduinoCloudThing::publish(CborArray& object) {
64
59
ArduinoCloudPropertyGeneric *p = list.get (i);
65
60
p->updateShadow ();
66
61
}
62
+
63
+ return size;
67
64
}
68
65
69
- int ArduinoCloudThing::poll () {
66
+ int ArduinoCloudThing::poll (uint8_t * data ) {
70
67
71
68
// check if backing storage and cloud has diverged
72
69
int diff = 0 ;
@@ -76,7 +73,7 @@ int ArduinoCloudThing::poll() {
76
73
CborBuffer buffer (1024 );
77
74
CborArray object = CborArray (buffer);
78
75
compress (object, buffer);
79
- publish (object);
76
+ diff = publish (object, data );
80
77
}
81
78
82
79
#if defined(DEBUG_MEMORY) && defined(ARDUINO_ARCH_SAMD)
Original file line number Diff line number Diff line change @@ -185,10 +185,10 @@ class ArduinoCloudThing {
185
185
ArduinoCloudPropertyGeneric& addPropertyReal (void * property, String name, permissionType permission);
186
186
ArduinoCloudPropertyGeneric& addPropertyReal (String property, String name, permissionType permission);
187
187
// poll should return > 0 if something has changed
188
- int poll ();
188
+ int poll (uint8_t * data );
189
189
190
190
private:
191
- void publish (CborArray& object);
191
+ int publish (CborArray& object, uint8_t * data );
192
192
193
193
void update ();
194
194
int checkNewData ();
You can’t perform that action at this time.
0 commit comments