Skip to content

Commit 0bae73c

Browse files
committed
The topic name for the OTA input and output topic will be stored as member variables and is created using the syntax '/a/d//ota/i' and '/a/d//ota/o' respectively
1 parent 84c81f8 commit 0bae73c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/ArduinoIoTCloudTCP.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ ArduinoIoTCloudTCP::ArduinoIoTCloudTCP():
7575
_shadowTopicOut(""),
7676
_shadowTopicIn(""),
7777
_dataTopicOut(""),
78-
_dataTopicIn("")
78+
_dataTopicIn(""),
79+
_ota_topic_in{""},
80+
_ota_topic_out{""}
7981
{
8082

8183
}
@@ -132,6 +134,8 @@ int ArduinoIoTCloudTCP::begin(String brokerAddress, uint16_t brokerPort)
132134
_shadowTopicIn = getTopic_shadowin();
133135
_dataTopicOut = getTopic_dataout();
134136
_dataTopicIn = getTopic_datain();
137+
_ota_topic_in = getTopic_ota_in();
138+
_ota_topic_out = getTopic_ota_out();
135139

136140
_thing.begin();
137141
_thing.registerGetTimeCallbackFunc(getTime);

src/ArduinoIoTCloudTCP.h

+4
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,17 @@ class ArduinoIoTCloudTCP: public ArduinoIoTCloudClass
114114
String _shadowTopicIn;
115115
String _dataTopicOut;
116116
String _dataTopicIn;
117+
String _ota_topic_in;
118+
String _ota_topic_out;
117119

118120
inline String getTopic_stdin () { return String("/a/d/" + getDeviceId() + "/s/i"); }
119121
inline String getTopic_stdout () { return String("/a/d/" + getDeviceId() + "/s/o"); }
120122
inline String getTopic_shadowout() { return ( getThingId().length() == 0) ? String("") : String("/a/t/" + getThingId() + "/shadow/o"); }
121123
inline String getTopic_shadowin () { return ( getThingId().length() == 0) ? String("") : String("/a/t/" + getThingId() + "/shadow/i"); }
122124
inline String getTopic_dataout () { return ( getThingId().length() == 0) ? String("/a/d/" + getDeviceId() + "/e/o") : String("/a/t/" + getThingId() + "/e/o"); }
123125
inline String getTopic_datain () { return ( getThingId().length() == 0) ? String("/a/d/" + getDeviceId() + "/e/i") : String("/a/t/" + getThingId() + "/e/i"); }
126+
inline String getTopic_ota_in () { return String("/a/d/" + getDeviceId() + "/ota/i"); }
127+
inline String getTopic_ota_out () { return String("/a/d/" + getDeviceId() + "/ota/o"); }
124128

125129
static void onMessage(int length);
126130
void handleMessage(int length);

0 commit comments

Comments
 (0)