4
4
#include < utility/ECCX08Cert.h>
5
5
6
6
#include " CloudSerial.h"
7
- #include " SerialFlashStorage.h"
8
- #include " SFU.h"
9
7
10
8
const static char server[] = " a19g5nbe27wn47.iot.us-east-1.amazonaws.com" ; // "xxxxxxxxxxxxxx.iot.xx-xxxx-x.amazonaws.com";
11
9
@@ -16,7 +14,6 @@ const static int thingIdSlot = 12;
16
14
17
15
ArduinoCloudClass::ArduinoCloudClass () :
18
16
_bearSslClient(NULL ),
19
- _otaClient(NULL ),
20
17
_mqttClient(256 )
21
18
{
22
19
}
@@ -26,9 +23,6 @@ ArduinoCloudClass::~ArduinoCloudClass()
26
23
if (_bearSslClient) {
27
24
delete _bearSslClient;
28
25
}
29
- if (_otaClient) {
30
- delete _otaClient;
31
- }
32
26
}
33
27
34
28
int ArduinoCloudClass::begin (Client& net)
@@ -69,12 +63,9 @@ int ArduinoCloudClass::begin(Client& net)
69
63
70
64
Thing.begin ();
71
65
72
- _otaClient = new HttpClient (net, server, 80 );
73
-
74
66
_stdoutTopic = " $aws/things/" + _id + " /stdout" ;
75
67
_stdinTopic = " $aws/things/" + _id + " /stdin" ;
76
68
_dataTopic = " $aws/things/" + _id + " /data" ;
77
- _otaTopic = " $aws/things/" + _id + " /upload" ;
78
69
79
70
return 1 ;
80
71
}
@@ -87,7 +78,6 @@ int ArduinoCloudClass::connect()
87
78
88
79
_mqttClient.subscribe (_stdinTopic);
89
80
_mqttClient.subscribe (_dataTopic);
90
- _mqttClient.subscribe (_otaTopic);
91
81
92
82
return 1 ;
93
83
}
@@ -135,22 +125,6 @@ void ArduinoCloudClass::handleMessage(char topic[], char bytes[], int length)
135
125
if (_dataTopic == topic) {
136
126
Thing.decode ((uint8_t *)bytes, length);
137
127
}
138
- if (_otaTopic == topic) {
139
-
140
- String url = String (bytes);
141
-
142
- _otaClient->get (url);
143
-
144
- SerialFlashStorage.open (_otaClient->contentLength ());
145
- uint8_t buf[1024 ];
146
- while (_otaClient->available ()) {
147
- int size = _otaClient->available () >= 1024 ? 1024 : _otaClient->available ();
148
- _otaClient->read (buf, size);
149
- SerialFlashStorage.write ((uint8_t *)buf, size);
150
- }
151
- SerialFlashStorage.close ();
152
- SerialFlashStorage.apply ();
153
- }
154
128
}
155
129
156
130
ArduinoCloudClass ArduinoCloud;
0 commit comments