use TCP to connect to mbed connector

Fork of mbedConnectorInterfaceWithDM by Doug Anson

Revision:
87:00b3837986c7
Parent:
86:89977e288213
Child:
88:e78093f6334f
--- a/source/ConnectorEndpoint.cpp	Fri Nov 04 23:37:11 2016 +0000
+++ b/source/ConnectorEndpoint.cpp	Fri Nov 04 23:54:24 2016 +0000
@@ -95,7 +95,11 @@
 }
 
 // Constructor
+#ifdef ENABLE_MBED_CLOUD_SUPPORT
+Endpoint::Endpoint(const Logger *logger, const Options *options)  : MbedCloudClientCallback(), M2MInterfaceObserver() 
+#else
 Endpoint::Endpoint(const Logger *logger, const Options *options)  : M2MInterfaceObserver() 
+#endif
 {
     this->m_logger = (Logger *)logger;
     this->m_options = (Options *)options;
@@ -465,47 +469,50 @@
 // object registered
 void Endpoint::on_registered()  {
 	if (__endpoint != NULL) {
-		__endpoint->object_registered(NULL,(const M2MServer &)NULL);
+		printf("Connector::Endpoint(Cloud): on_registered()\r\n");
+		__endpoint->object_registered();
 	}
 }
 
 // registration updated
 void Endpoint::on_registration_updated()  {
 	if (__endpoint != NULL) {
-		__endpoint->registration_updated(NULL,(const M2MServer &)NULL);
+		printf("Connector::Endpoint(Cloud): on_registration_updated()\r\n");
+		__endpoint->registration_updated();
 	}
 }
 
 // object unregistered
 void Endpoint::on_unregistered()  {
 	if (__endpoint != NULL) {
-		__endpoint->object_unregistered(NULL,(const M2MServer &)NULL);
+		printf("Connector::Endpoint(Cloud): on_unregistered()\r\n");
+		__endpoint->object_unregistered(this->getSecurityInstance());
 	}
 }
 #endif
 
 // object registered
-void Endpoint::object_registered(M2MSecurity *security, const M2MServer &)  {	    	           
+void Endpoint::object_registered(M2MSecurity *security, const M2MServer &server)  {	    	           
 	this->logger()->log("Connector::Endpoint: endpoint registered.");
 	this->m_connected = true;
 	this->m_registered = true;
 	if (this->m_csi != NULL) {
-		this->m_csi->object_registered((void *)this,(void *)security,(void *)NULL);
+		this->m_csi->object_registered((void *)this,(void *)security,(void *)&server);
 	}
 }
 
 // registration updated
-void Endpoint::registration_updated(M2MSecurity *security, const M2MServer &)  {
+void Endpoint::registration_updated(M2MSecurity *security, const M2MServer &server)  {
 	this->logger()->log("Connector::Endpoint: endpoint re-registered.");
 	this->m_connected = true;
 	this->m_registered = true;
 	if (this->m_csi != NULL) {
-		this->m_csi->registration_updated((void *)this,(void *)security,(void *)NULL);
+		this->m_csi->registration_updated((void *)this,(void *)security,(void *)&server);
 	}
 }
 
 // object unregistered
-void Endpoint::object_unregistered(M2MSecurity *server)  {
+void Endpoint::object_unregistered(M2MSecurity *security)  {
 	// DEBUG
 	this->logger()->log("Connector::Endpoint: endpoint de-registered.");
 	
@@ -518,7 +525,7 @@
 	
 	// invoke ConnectionHandler if we have one...
 	if (this->m_csi != NULL) {
-		this->m_csi->object_unregistered((void *)this,(void *)server);
+		this->m_csi->object_unregistered((void *)this,(void *)security);
 	}
 	
 	// halt the main event loop... we are done. 
@@ -526,10 +533,30 @@
 }
 
 // bootstrap done
-void Endpoint::bootstrap_done(M2MSecurity *server) {
+void Endpoint::bootstrap_done(M2MSecurity *security) {
 	this->logger()->log("Connector::Endpoint: endpoint bootstrapped.");
 	if (this->m_csi != NULL) {
-		this->m_csi->bootstrapped((void *)this,(void *)server);
+		this->m_csi->bootstrapped((void *)this,(void *)security);
+	}
+}
+
+// object registered
+void Endpoint::object_registered(void *security,void *server)  {	    	           
+	this->logger()->log("Connector::Endpoint: endpoint registered.");
+	this->m_connected = true;
+	this->m_registered = true;
+	if (this->m_csi != NULL) {
+		this->m_csi->object_registered((void *)this,security,server);
+	}
+}
+
+// registration updated
+void Endpoint::registration_updated(void *security,void *server)  {
+	this->logger()->log("Connector::Endpoint: endpoint re-registered.");
+	this->m_connected = true;
+	this->m_registered = true;
+	if (this->m_csi != NULL) {
+		this->m_csi->registration_updated((void *)this,security,server);
 	}
 }