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

Revision:
8:f950fb1b78c0
Parent:
0:1f1f55e73248
Child:
9:faa43faea4ca
--- a/source/OptionsBuilder.cpp	Sun Feb 21 19:05:14 2016 +0000
+++ b/source/OptionsBuilder.cpp	Wed Feb 24 05:52:00 2016 +0000
@@ -45,11 +45,9 @@
     this->m_domain           		 = NSP_DOMAIN;
     this->m_endpoint_type    	 = NSP_ENDPOINT_TYPE;
     this->m_node_name        	 = NODE_NAME;
-    this->m_channel_list    		 = NODE_CHANNEL_LIST;
     this->m_reg_update_period = REG_UPDATE_PERIOD_MS;
     this->m_lifetime  					 = REG_LIFETIME_SEC;
     this->m_connector_url  		 = string(CONNECTOR_URL);
-    memset(this->m_mac_address,0,NODE_MAC_ADDRESS_LENGTH);
     this->m_device_resources.clear();
     this->m_static_resources.clear();
     this->m_dynamic_resources.clear();
@@ -59,9 +57,12 @@
 // Copy Constructor
 OptionsBuilder::OptionsBuilder(const OptionsBuilder &ob)  : Options(ob)
 {
-    this->m_lifetime = ob.m_lifetime;
-    this->m_domain = ob.m_domain;
+	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_device_resources = ob.m_device_resources;
     this->m_static_resources = ob.m_static_resources;
     this->m_dynamic_resources = ob.m_dynamic_resources;
@@ -105,13 +106,6 @@
     return *this;
 }
 
-// set low level radio channel list
-OptionsBuilder &OptionsBuilder::setRadioChannelList(const uint32_t channel_list)
-{
-    this->m_channel_list = channel_list;
-    return *this;
-}
-
 // set mbed registration update period
 OptionsBuilder &OptionsBuilder::setRegUpdatePeriod(const int reg_update_period)
 {
@@ -128,17 +122,6 @@
     return *this;
 }
 
-// set MAC address
-OptionsBuilder &OptionsBuilder::setMACAddress(const uint8_t *mac_address,const int mac_address_length)
-{
-    if (mac_address != NULL && mac_address_length > 0) {
-        int length = mac_address_length;
-        if (length > NODE_MAC_ADDRESS_LENGTH) length = NODE_MAC_ADDRESS_LENGTH;
-        for(int i=0; i<length; ++i) this->m_mac_address[i] = mac_address[i];
-    }
-    return *this;
-}
-
 // add a device resource
 OptionsBuilder &OptionsBuilder::addResource(const DeviceResource *resource) {
 	if (resource != NULL) {
@@ -223,17 +206,23 @@
     return *this;
 }
 
-// set 802.15.4 Network ID
-OptionsBuilder &OptionsBuilder::setNetworkID(char *network_id)
+// set 802.15.4 Pre Shared Key
+OptionsBuilder &OptionsBuilder::setPreSharedKey(unsigned char psk[16])
 {
-    this->m_network_id = string(network_id);
+	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 Radio Channel
-OptionsBuilder &OptionsBuilder::setRadioChannel(int channel)
+// set 802.15.4 Pre Shared Key Identity
+OptionsBuilder &OptionsBuilder::setPreSharedKeyIdentity(unsigned char psk_identity[2])
 {
-    this->m_channel = (uint8_t)channel;
+    memset(this->m_psk_identity,0,2);
+	for(int i=0;i<2;++i) {
+		this->m_psk_identity[i] = psk_identity[i];
+	}
     return *this;
 }