File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 1
1
#include < ArduinoECCX08.h>
2
-
3
2
#include " utility/ECCX08Cert.h"
4
3
#include " CloudSerial.h"
5
-
6
4
#include " ArduinoIoTCloud.h"
7
5
8
- const static char server[] = " mqtts-sa.iot.oniudra.cc" ;
9
-
10
6
const static int keySlot = 0 ;
11
7
const static int compressedCertSlot = 10 ;
12
8
const static int serialNumberAndAuthorityKeyIdentifierSlot = 11 ;
@@ -26,8 +22,11 @@ ArduinoIoTCloudClass::~ArduinoIoTCloudClass()
26
22
}
27
23
}
28
24
29
- int ArduinoIoTCloudClass::begin (Client& net)
25
+ int ArduinoIoTCloudClass::begin (Client& net, String brokerAddress )
30
26
{
27
+ // store the broker address as class member
28
+ _brokerAddress = brokerAddress;
29
+
31
30
byte thingIdBytes[72 ];
32
31
33
32
if (!ECCX08.begin ()) {
@@ -78,7 +77,7 @@ void ArduinoIoTCloudClass::mqttClientBegin(Client& net)
78
77
79
78
// use onMessage as callback for received mqtt messages
80
79
_mqttClient.onMessageAdvanced (ArduinoIoTCloudClass::onMessage);
81
- _mqttClient.begin (server , 8883 , net);
80
+ _mqttClient.begin (_brokerAddress. c_str () , 8883 , net);
82
81
83
82
// Set MQTT connection options
84
83
_mqttClient.setOptions (mqttOpt.keepAlive , mqttOpt.cleanSession , mqttOpt.timeout );
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ class ArduinoIoTCloudClass {
20
20
ArduinoIoTCloudClass ();
21
21
~ArduinoIoTCloudClass ();
22
22
23
- int begin (Client& net);
23
+ int begin (Client& net, String brokerAddress );
24
24
25
25
// Class constant declaration
26
26
static const int MQTT_BUFFER_SIZE = 256 ;
@@ -62,6 +62,7 @@ class ArduinoIoTCloudClass {
62
62
void handleMessage (char topic[], char bytes[], int length);
63
63
64
64
String _id;
65
+ String _brokerAddress = " mqtts-sa.iot.oniudra.cc" ;
65
66
ArduinoCloudThing Thing;
66
67
BearSSLClient* _bearSslClient;
67
68
MQTTClient _mqttClient;
You can’t perform that action at this time.
0 commit comments