Skip to content

Commit 8701e53

Browse files
committed
Turning _thing_id into a private member variable
1 parent e7840da commit 8701e53

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/ArduinoIoTCloud.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ class ArduinoIoTCloudClass
131131
inline ArduinoIoTConnectionStatus getIoTStatus() { return _iotStatus; }
132132

133133
String _device_id = "";
134-
String _thing_id = "";
135134

136135
ArduinoIoTConnectionStatus _iotStatus = ArduinoIoTConnectionStatus::IDLE;
137136
ArduinoIoTSynchronizationStatus _syncStatus = ArduinoIoTSynchronizationStatus::SYNC_STATUS_SYNCHRONIZED;
@@ -146,6 +145,10 @@ class ArduinoIoTCloudClass
146145

147146
static void execCloudEventCallback(OnCloudEventCallback & callback, void * callback_arg);
148147
static void printConnectionStatus(ArduinoIoTConnectionStatus status);
148+
149+
private:
150+
151+
String _thing_id = "";
149152
};
150153

151154
#ifdef HAS_TCP

src/ArduinoIoTCloudTCP.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ class ArduinoIoTCloudTCP: public ArduinoIoTCloudClass {
121121

122122
inline String getTopic_stdin () const { return String("/a/d/" + _device_id + "/s/i"); }
123123
inline String getTopic_stdout () const { return String("/a/d/" + _device_id + "/s/o"); }
124-
inline String getTopic_shadowout() const { return (_thing_id.length() == 0) ? String("") : String("/a/t/" + _thing_id + "/shadow/o"); }
125-
inline String getTopic_shadowin () const { return (_thing_id.length() == 0) ? String("") : String("/a/t/" + _thing_id + "/shadow/i"); }
126-
inline String getTopic_dataout () const { return (_thing_id.length() == 0) ? String("/a/d/" + _device_id + "/e/o") : String("/a/t/" + _thing_id + "/e/o"); }
127-
inline String getTopic_datain () const { return (_thing_id.length() == 0) ? String("/a/d/" + _device_id + "/e/i") : String("/a/t/" + _thing_id + "/e/i"); }
124+
inline String getTopic_shadowout() const { return ( getThingId().length() == 0) ? String("") : String("/a/t/" + getThingId() + "/shadow/o"); }
125+
inline String getTopic_shadowin () const { return ( getThingId().length() == 0) ? String("") : String("/a/t/" + getThingId() + "/shadow/i"); }
126+
inline String getTopic_dataout () const { return ( getThingId().length() == 0) ? String("/a/d/" + _device_id + "/e/o") : String("/a/t/" + getThingId() + "/e/o"); }
127+
inline String getTopic_datain () const { return ( getThingId().length() == 0) ? String("/a/d/" + _device_id + "/e/i") : String("/a/t/" + getThingId() + "/e/i"); }
128128

129129
static void onMessage(int length);
130130
void handleMessage(int length);

0 commit comments

Comments
 (0)