mbed Connector Interface simplification API on top of mbed-client

Fork of mbedConnectorInterfaceV3 by Doug Anson

NOTE:

This repo has been replaced with https://github.com/ARMmbed/mbedConnectorInterface. No further updates will occur with this repo. Please use the github repo instead. Thanks!

Revision:
54:dfee8691c83a
Parent:
52:8abdfa69b511
Child:
71:5069a202e892
--- a/source/OptionsBuilder.cpp	Mon Aug 08 19:02:00 2016 +0000
+++ b/source/OptionsBuilder.cpp	Tue Aug 09 17:18:49 2016 +0000
@@ -23,21 +23,11 @@
 // Class support
 #include "mbed-connector-interface/OptionsBuilder.h"
 
-// external included configuration file for the endpoint...
-#include "mbed-connector-interface/configuration.h"
-
-// ResourceObserver support (enabled in configuration.h)
+// ResourceObserver support
 #include "mbed-connector-interface/ThreadedResourceObserver.h"
 #include "mbed-connector-interface/TickerResourceObserver.h"
 #include "mbed-connector-interface/MinarResourceObserver.h"
 
-// DEBUG
-#ifndef NDEBUG
-#define DEBUG_OUT(...) { printf(__VA_ARGS__); }
-#else
-#define DEBUG_OUT(...) /* nothing */
-#endif
-
 // Connector namespace
 namespace Connector {
 
@@ -45,10 +35,9 @@
 OptionsBuilder::OptionsBuilder()
 {
     this->m_endpoint 				= NULL;
-    this->m_domain           		= NSP_DOMAIN;
-    this->m_endpoint_type    	 	= NSP_ENDPOINT_TYPE;
+    this->m_domain           		= DEFAULT_DOMAIN;
+    this->m_endpoint_type    	 	= DEFAULT_ENDPOINT_TYPE;
     this->m_node_name        	 	= NODE_NAME;
-    this->m_reg_update_period 		= REG_UPDATE_PERIOD_MS;
     this->m_lifetime  				= REG_LIFETIME_SEC;
     this->m_connector_url  		 	= string(CONNECTOR_URL);
     this->m_server_cert				= NULL;
@@ -67,10 +56,10 @@
 // Copy Constructor
 OptionsBuilder::OptionsBuilder(const OptionsBuilder &ob)  : Options(ob)
 {
+	this->m_endpoint = ob.m_endpoint;
 	this->m_domain = ob.m_domain;
     this->m_endpoint_type = ob.m_endpoint_type;
     this->m_node_name = ob.m_node_name;
-    this->m_reg_update_period = ob.m_reg_update_period;
 	this->m_lifetime = ob.m_lifetime; 
 	this->m_connector_url  = ob.m_connector_url;  
 	this->m_server_cert	= ob.m_server_cert;
@@ -89,9 +78,6 @@
     this->m_wifi_auth_type = ob.m_wifi_auth_type;
     this->m_coap_connection_type = ob.m_coap_connection_type;
     this->m_ip_address_type = ob.m_ip_address_type;
-    for(int i=0;i<16;++i) this->m_psk[i] = ob.m_psk[i];
-    for(int i=0;i<2;++i) this->m_psk_identity[i] = ob.m_psk_identity[i];
-    this->m_mesh_type = ob.m_mesh_type;
     this->m_enable_immediate_observation = ob.m_enable_immediate_observation;
     this->m_enable_get_obs_control = ob.m_enable_get_obs_control;
     this->m_endpoint = ob.m_endpoint;
@@ -135,13 +121,6 @@
     return *this;
 }
 
-// set mbed registration update period
-OptionsBuilder &OptionsBuilder::setRegUpdatePeriod(const int reg_update_period)
-{
-    this->m_reg_update_period = reg_update_period;
-    return *this;
-}
-
 // set Connector URL
 OptionsBuilder &OptionsBuilder::setConnectorURL(const char *connector_url)
 {
@@ -183,7 +162,7 @@
 OptionsBuilder &OptionsBuilder::addResource(const DynamicResource *resource)
 {
     // ensure that the boolean isn't mistaken by the compiler for the obs period...
-    return this->addResource(resource,OBS_PERIOD_MS,!(((DynamicResource *)resource)->implementsObservation()));
+    return this->addResource(resource,DEFAULT_OBS_PERIOD,!(((DynamicResource *)resource)->implementsObservation()));
 }
 
 // add dynamic resource
@@ -197,7 +176,7 @@
 OptionsBuilder &OptionsBuilder::addResource(const DynamicResource *resource,const bool use_observer)
 {
     // ensure that the boolean isn't mistaken by the compiler for the obs period...
-    return this->addResource(resource,OBS_PERIOD_MS,use_observer);
+    return this->addResource(resource,DEFAULT_OBS_PERIOD,use_observer);
 }
 
 // add dynamic resource
@@ -255,33 +234,6 @@
     return *this;
 }
 
-// set 802.15.4 Pre Shared Key
-OptionsBuilder &OptionsBuilder::setPreSharedKey(unsigned char psk[16])
-{
-	memset(this->m_psk,0,16);
-	for(int i=0;i<16;++i) {
-		this->m_psk[i] = psk[i];
-	}
-    return *this;
-}
-
-// set 802.15.4 Pre Shared Key Identity
-OptionsBuilder &OptionsBuilder::setPreSharedKeyIdentity(unsigned char psk_identity[2])
-{
-    memset(this->m_psk_identity,0,2);
-	for(int i=0;i<2;++i) {
-		this->m_psk_identity[i] = psk_identity[i];
-	}
-    return *this;
-}
-
-// set 802.15.4 Mesh Type
-OptionsBuilder &OptionsBuilder::setMeshType(MeshTypes mesh_type)
-{
-    this->m_mesh_type = mesh_type;
-    return *this;
-}
-
 // set the CoAP Connection Type
 OptionsBuilder &OptionsBuilder::setCoAPConnectionType(CoAPConnectionTypes coap_connection_type)
 {