mbedConnectorInterface back port from mbedOS v3 using mbed-client C++ call interface

Revision:
6:d4d1105a1777
Parent:
4:d9603064630c
Child:
7:e94f0bd92545
--- a/source/Utils.cpp	Sun Feb 21 16:31:36 2016 +0000
+++ b/source/Utils.cpp	Sun Feb 21 18:48:07 2016 +0000
@@ -23,6 +23,7 @@
 // mbed Endpoint includes
 #include "mbed-connector-interface/ConnectorEndpoint.h"
 #include "mbed-connector-interface/OptionsBuilder.h"
+#include "mbed-connector-interface/mbedEndpointNetwork.h"
 
 // External references (defined in main.cpp)
 Connector::Options *configure_endpoint(Connector::OptionsBuilder &builder);
@@ -32,11 +33,6 @@
 Connector::OptionsBuilder config;
 Connector::Options *options = NULL;
 
-// Shutdown button (K64F only...)
-#if defined(TARGET_K64F)
-InterruptIn shutdown_button(SW3);
-#endif
-
 // ************************* NSDL Linkage - MDS CONFIGURATION (defaulted) *********************************
 
 uint8_t app_MAC_address[NODE_MAC_ADDRESS_LENGTH] = NODE_MAC_ADDRESS;   // Node MAC address
@@ -86,17 +82,6 @@
     logger.log("Endpoint: endpoint configuration completed.");
 }
 
-// setup shutdown button (K64F only...)
-#if defined(TARGET_K64F)
-void utils_setup_deregistration_button(void *p) {
-	if (p != NULL) {
-		Connector::Endpoint *ep = (Connector::Endpoint *)p;
-		logger.log("Endpoint: setting up shutdown button (SW2) for K64F...");
-		shutdown_button.rise(ep,&Connector::Endpoint::closedown_endpoint);
-	}
-}	
-#endif
-
 // initialize the Connector::Endpoint instance
 void *utils_init_endpoint(bool canActAsRouterNode) {
 	// alloc Endpoint
@@ -120,11 +105,9 @@
 	    // complete the registration
 	    logger.log("Completing Endpoint Registration");
    		ep->complete_endpoint_registration(ep->getServer(),ep->getObjectList());
-	    
-	    // setup the shutdown button (K64F only...)
-#if defined(TARGET_K64F)
-    	utils_setup_deregistration_button(p);
-#endif
+   		
+   		// setup the shutdown button (if enabled for a given platform...)
+    	net_setup_deregistration_button(p);
 	}
 }