Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: 5_Dragonfly_Cayenne_Sprint_IKS01A1
Fork of Cayenne-MQTT-mbed-MTSAS by
Diff: src/CayenneMQTTClient/CayenneMQTTClient.h
- Revision:
- 6:82e142a864ad
- Parent:
- 4:421366004b5d
- Child:
- 8:aec9cfdd4c8e
diff -r 421366004b5d -r 82e142a864ad src/CayenneMQTTClient/CayenneMQTTClient.h
--- a/src/CayenneMQTTClient/CayenneMQTTClient.h	Fri Oct 07 22:44:16 2016 +0000
+++ b/src/CayenneMQTTClient/CayenneMQTTClient.h	Tue Oct 25 16:19:29 2016 -0600
@@ -81,12 +81,14 @@
 		* @param[in] password Password
 		* @return success code
 		*/
-		int connect(char* username, char* clientID, char* password) {
+		int connect(const char* username, const char* clientID, const char* password) {
 			MQTTPacket_connectData data = MQTTPacket_connectData_initializer;
 			data.MQTTVersion = 3;
-			data.clientID.cstring = _clientID = clientID;
-			data.username.cstring = _username = username;
-			data.password.cstring = password;
+			_clientID = clientID;
+			_username = username;
+			data.clientID.cstring = const_cast<char*>(_clientID);
+			data.username.cstring = const_cast<char*>(_username);
+			data.password.cstring = const_cast<char*>(password);
 			return Base::connect(data);
 		};
 
@@ -393,8 +395,8 @@
 		}
 
 	private:
-		char* _username;
-		char* _clientID;
+		const char* _username;
+		const char* _clientID;
 		struct CayenneMessageHandlers
 		{
 			const char* clientID;
    