@@ -97,9 +97,9 @@ int ArduinoIoTCloudTCP::begin(String brokerAddress, uint16_t brokerPort) {
97
97
_brokerPort = brokerPort;
98
98
99
99
#ifdef BOARD_HAS_ECCX08
100
- if (!ECCX08.begin ()) { Debug.print (DBG_ERROR, " Cryptography processor failure. Make sure you have a compatible board." ); return 0 ; }
101
- if (!CryptoUtil::readDeviceId (ECCX08, _device_id , ECCX08Slot::DeviceId)) { Debug.print (DBG_ERROR, " Cryptography processor read failure." ); return 0 ; }
102
- if (!CryptoUtil::reconstructCertificate (_eccx08_cert, _device_id , ECCX08Slot::Key, ECCX08Slot::CompressedCertificate, ECCX08Slot::SerialNumberAndAuthorityKeyIdentifier)) { Debug.print (DBG_ERROR, " Cryptography certificate reconstruction failure." ); return 0 ; }
100
+ if (!ECCX08.begin ()) { Debug.print (DBG_ERROR, " Cryptography processor failure. Make sure you have a compatible board." ); return 0 ; }
101
+ if (!CryptoUtil::readDeviceId (ECCX08, getDeviceId () , ECCX08Slot::DeviceId)) { Debug.print (DBG_ERROR, " Cryptography processor read failure." ); return 0 ; }
102
+ if (!CryptoUtil::reconstructCertificate (_eccx08_cert, getDeviceId () , ECCX08Slot::Key, ECCX08Slot::CompressedCertificate, ECCX08Slot::SerialNumberAndAuthorityKeyIdentifier)) { Debug.print (DBG_ERROR, " Cryptography certificate reconstruction failure." ); return 0 ; }
103
103
ArduinoBearSSL.onGetTime (getTime);
104
104
_sslClient = new BearSSLClient (_connection->getClient (), ArduinoIoTCloudTrustAnchor, ArduinoIoTCloudTrustAnchor_NUM);
105
105
_sslClient->setEccSlot (static_cast <int >(ECCX08Slot::Key), _eccx08_cert.bytes (), _eccx08_cert.length ());
@@ -110,12 +110,12 @@ int ArduinoIoTCloudTCP::begin(String brokerAddress, uint16_t brokerPort) {
110
110
111
111
_mqttClient = new MqttClient (*_sslClient);
112
112
#ifdef BOARD_ESP
113
- _mqttClient->setUsernamePassword (_device_id , _password);
113
+ _mqttClient->setUsernamePassword (getDeviceId () , _password);
114
114
#endif
115
115
_mqttClient->onMessage (ArduinoIoTCloudTCP::onMessage);
116
116
_mqttClient->setKeepAliveInterval (30 * 1000 );
117
117
_mqttClient->setConnectionTimeout (1500 );
118
- _mqttClient->setId (_device_id .c_str ());
118
+ _mqttClient->setId (getDeviceId () .c_str ());
119
119
120
120
_stdinTopic = getTopic_stdin ();
121
121
_stdoutTopic = getTopic_stdout ();
0 commit comments