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!

Committer:
ansond
Date:
Sat Jul 16 05:53:42 2016 +0000
Revision:
52:8abdfa69b511
Parent:
50:4f04727cbf91
Child:
54:dfee8691c83a
updated options builder

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ansond 0:1f1f55e73248 1 /**
ansond 0:1f1f55e73248 2 * @file OptionsBuilder.cpp
ansond 0:1f1f55e73248 3 * @brief mbed CoAP OptionsBuilder class implementation
ansond 0:1f1f55e73248 4 * @author Doug Anson/Chris Paola
ansond 0:1f1f55e73248 5 * @version 1.0
ansond 0:1f1f55e73248 6 * @see
ansond 0:1f1f55e73248 7 *
ansond 0:1f1f55e73248 8 * Copyright (c) 2014
ansond 0:1f1f55e73248 9 *
ansond 0:1f1f55e73248 10 * Licensed under the Apache License, Version 2.0 (the "License");
ansond 0:1f1f55e73248 11 * you may not use this file except in compliance with the License.
ansond 0:1f1f55e73248 12 * You may obtain a copy of the License at
ansond 0:1f1f55e73248 13 *
ansond 0:1f1f55e73248 14 * http://www.apache.org/licenses/LICENSE-2.0
ansond 0:1f1f55e73248 15 *
ansond 0:1f1f55e73248 16 * Unless required by applicable law or agreed to in writing, software
ansond 0:1f1f55e73248 17 * distributed under the License is distributed on an "AS IS" BASIS,
ansond 0:1f1f55e73248 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
ansond 0:1f1f55e73248 19 * See the License for the specific language governing permissions and
ansond 0:1f1f55e73248 20 * limitations under the License.
ansond 0:1f1f55e73248 21 */
ansond 0:1f1f55e73248 22
ansond 33:1d0b855df5a5 23 // Class support
ansond 0:1f1f55e73248 24 #include "mbed-connector-interface/OptionsBuilder.h"
ansond 0:1f1f55e73248 25
ansond 0:1f1f55e73248 26 // external included configuration file for the endpoint...
ansond 0:1f1f55e73248 27 #include "mbed-connector-interface/configuration.h"
ansond 0:1f1f55e73248 28
ansond 33:1d0b855df5a5 29 // ResourceObserver support (enabled in configuration.h)
ansond 0:1f1f55e73248 30 #include "mbed-connector-interface/ThreadedResourceObserver.h"
ansond 0:1f1f55e73248 31 #include "mbed-connector-interface/TickerResourceObserver.h"
ansond 27:b8aaf7dc7023 32 #include "mbed-connector-interface/MinarResourceObserver.h"
ansond 0:1f1f55e73248 33
ansond 0:1f1f55e73248 34 // DEBUG
ansond 0:1f1f55e73248 35 #ifndef NDEBUG
ansond 0:1f1f55e73248 36 #define DEBUG_OUT(...) { printf(__VA_ARGS__); }
ansond 0:1f1f55e73248 37 #else
ansond 0:1f1f55e73248 38 #define DEBUG_OUT(...) /* nothing */
ansond 0:1f1f55e73248 39 #endif
ansond 0:1f1f55e73248 40
ansond 0:1f1f55e73248 41 // Connector namespace
ansond 0:1f1f55e73248 42 namespace Connector {
ansond 0:1f1f55e73248 43
ansond 0:1f1f55e73248 44 // Constructor
ansond 0:1f1f55e73248 45 OptionsBuilder::OptionsBuilder()
ansond 0:1f1f55e73248 46 {
ansond 52:8abdfa69b511 47 this->m_endpoint = NULL;
ansond 27:b8aaf7dc7023 48 this->m_domain = NSP_DOMAIN;
ansond 27:b8aaf7dc7023 49 this->m_endpoint_type = NSP_ENDPOINT_TYPE;
ansond 27:b8aaf7dc7023 50 this->m_node_name = NODE_NAME;
ansond 27:b8aaf7dc7023 51 this->m_reg_update_period = REG_UPDATE_PERIOD_MS;
ansond 27:b8aaf7dc7023 52 this->m_lifetime = REG_LIFETIME_SEC;
ansond 27:b8aaf7dc7023 53 this->m_connector_url = string(CONNECTOR_URL);
ansond 50:4f04727cbf91 54 this->m_server_cert = NULL;
ansond 49:c603a22495bb 55 this->m_server_cert_length = 0;
ansond 49:c603a22495bb 56 this->m_client_cert = NULL;
ansond 49:c603a22495bb 57 this->m_client_cert_length = 0;
ansond 49:c603a22495bb 58 this->m_client_key = NULL;
ansond 49:c603a22495bb 59 this->m_client_key_length = 0;
ansond 27:b8aaf7dc7023 60 this->m_device_resources_object = NULL;
ansond 27:b8aaf7dc7023 61 this->m_firmware_resources_object = NULL;
ansond 0:1f1f55e73248 62 this->m_static_resources.clear();
ansond 0:1f1f55e73248 63 this->m_dynamic_resources.clear();
ansond 0:1f1f55e73248 64 this->m_resource_observers.clear();
ansond 0:1f1f55e73248 65 }
ansond 0:1f1f55e73248 66
ansond 0:1f1f55e73248 67 // Copy Constructor
ansond 0:1f1f55e73248 68 OptionsBuilder::OptionsBuilder(const OptionsBuilder &ob) : Options(ob)
ansond 0:1f1f55e73248 69 {
ansond 8:f950fb1b78c0 70 this->m_domain = ob.m_domain;
ansond 0:1f1f55e73248 71 this->m_endpoint_type = ob.m_endpoint_type;
ansond 8:f950fb1b78c0 72 this->m_node_name = ob.m_node_name;
ansond 8:f950fb1b78c0 73 this->m_reg_update_period = ob.m_reg_update_period;
ansond 8:f950fb1b78c0 74 this->m_lifetime = ob.m_lifetime;
ansond 8:f950fb1b78c0 75 this->m_connector_url = ob.m_connector_url;
ansond 50:4f04727cbf91 76 this->m_server_cert = ob.m_server_cert;
ansond 49:c603a22495bb 77 this->m_server_cert_length = ob.m_server_cert_length;
ansond 49:c603a22495bb 78 this->m_client_cert = ob.m_client_cert;
ansond 49:c603a22495bb 79 this->m_client_cert_length = ob.m_client_cert_length;
ansond 49:c603a22495bb 80 this->m_client_key = ob.m_client_key;
ansond 49:c603a22495bb 81 this->m_client_key_length= ob.m_client_key_length;
ansond 27:b8aaf7dc7023 82 this->m_device_resources_object = ob.m_device_resources_object;
ansond 27:b8aaf7dc7023 83 this->m_firmware_resources_object = ob.m_firmware_resources_object;
ansond 0:1f1f55e73248 84 this->m_static_resources = ob.m_static_resources;
ansond 0:1f1f55e73248 85 this->m_dynamic_resources = ob.m_dynamic_resources;
ansond 0:1f1f55e73248 86 this->m_resource_observers = ob.m_resource_observers;
ansond 52:8abdfa69b511 87 this->m_wifi_ssid = ob.m_wifi_ssid;
ansond 52:8abdfa69b511 88 this->m_wifi_auth_key = ob.m_wifi_auth_key;
ansond 52:8abdfa69b511 89 this->m_wifi_auth_type = ob.m_wifi_auth_type;
ansond 52:8abdfa69b511 90 this->m_coap_connection_type = ob.m_coap_connection_type;
ansond 52:8abdfa69b511 91 this->m_ip_address_type = ob.m_ip_address_type;
ansond 52:8abdfa69b511 92 for(int i=0;i<16;++i) this->m_psk[i] = ob.m_psk[i];
ansond 52:8abdfa69b511 93 for(int i=0;i<2;++i) this->m_psk_identity[i] = ob.m_psk_identity[i];
ansond 52:8abdfa69b511 94 this->m_mesh_type = ob.m_mesh_type;
ansond 52:8abdfa69b511 95 this->m_enable_immediate_observation = ob.m_enable_immediate_observation;
ansond 52:8abdfa69b511 96 this->m_enable_get_obs_control = ob.m_enable_get_obs_control;
ansond 52:8abdfa69b511 97 this->m_endpoint = ob.m_endpoint;
ansond 0:1f1f55e73248 98 }
ansond 0:1f1f55e73248 99
ansond 0:1f1f55e73248 100 // Destructor
ansond 0:1f1f55e73248 101 OptionsBuilder::~OptionsBuilder()
ansond 0:1f1f55e73248 102 {
ansond 38:bb6d2be4d54c 103 this->m_device_resources_object = NULL;
ansond 38:bb6d2be4d54c 104 this->m_firmware_resources_object = NULL;
ansond 0:1f1f55e73248 105 this->m_static_resources.clear();
ansond 0:1f1f55e73248 106 this->m_dynamic_resources.clear();
ansond 0:1f1f55e73248 107 this->m_resource_observers.clear();
ansond 0:1f1f55e73248 108 }
ansond 0:1f1f55e73248 109
ansond 0:1f1f55e73248 110 // set lifetime
ansond 0:1f1f55e73248 111 OptionsBuilder &OptionsBuilder::setLifetime(int lifetime)
ansond 0:1f1f55e73248 112 {
ansond 0:1f1f55e73248 113 this->m_lifetime = lifetime;
ansond 0:1f1f55e73248 114 return *this;
ansond 0:1f1f55e73248 115 }
ansond 0:1f1f55e73248 116
ansond 0:1f1f55e73248 117 // set domain
ansond 0:1f1f55e73248 118 OptionsBuilder &OptionsBuilder::setDomain(const char *domain)
ansond 0:1f1f55e73248 119 {
ansond 0:1f1f55e73248 120 this->m_domain = string(domain);
ansond 0:1f1f55e73248 121 return *this;
ansond 0:1f1f55e73248 122 }
ansond 0:1f1f55e73248 123
ansond 0:1f1f55e73248 124 // set endpoint nodename
ansond 0:1f1f55e73248 125 OptionsBuilder &OptionsBuilder::setEndpointNodename(const char *node_name)
ansond 0:1f1f55e73248 126 {
ansond 0:1f1f55e73248 127 this->m_node_name = string(node_name);
ansond 0:1f1f55e73248 128 return *this;
ansond 0:1f1f55e73248 129 }
ansond 0:1f1f55e73248 130
ansond 0:1f1f55e73248 131 // set lifetime
ansond 0:1f1f55e73248 132 OptionsBuilder &OptionsBuilder::setEndpointType(const char *endpoint_type)
ansond 0:1f1f55e73248 133 {
ansond 0:1f1f55e73248 134 this->m_endpoint_type = string(endpoint_type);
ansond 0:1f1f55e73248 135 return *this;
ansond 0:1f1f55e73248 136 }
ansond 0:1f1f55e73248 137
ansond 0:1f1f55e73248 138 // set mbed registration update period
ansond 0:1f1f55e73248 139 OptionsBuilder &OptionsBuilder::setRegUpdatePeriod(const int reg_update_period)
ansond 0:1f1f55e73248 140 {
ansond 0:1f1f55e73248 141 this->m_reg_update_period = reg_update_period;
ansond 0:1f1f55e73248 142 return *this;
ansond 0:1f1f55e73248 143 }
ansond 0:1f1f55e73248 144
ansond 0:1f1f55e73248 145 // set Connector URL
ansond 0:1f1f55e73248 146 OptionsBuilder &OptionsBuilder::setConnectorURL(const char *connector_url)
ansond 0:1f1f55e73248 147 {
ansond 0:1f1f55e73248 148 if (connector_url != NULL) {
ansond 0:1f1f55e73248 149 this->m_connector_url = string(connector_url);
ansond 0:1f1f55e73248 150 }
ansond 0:1f1f55e73248 151 return *this;
ansond 0:1f1f55e73248 152 }
ansond 0:1f1f55e73248 153
ansond 27:b8aaf7dc7023 154 // add the device resources object
ansond 27:b8aaf7dc7023 155 OptionsBuilder &OptionsBuilder::setDeviceResourcesObject(const void *device_resources_object)
ansond 27:b8aaf7dc7023 156 {
ansond 27:b8aaf7dc7023 157 if (device_resources_object != NULL) {
ansond 27:b8aaf7dc7023 158 this->m_device_resources_object = (void *)device_resources_object;
ansond 27:b8aaf7dc7023 159 }
ansond 27:b8aaf7dc7023 160 return *this;
ansond 27:b8aaf7dc7023 161 }
ansond 27:b8aaf7dc7023 162
ansond 27:b8aaf7dc7023 163 // add the firmware resources object
ansond 27:b8aaf7dc7023 164 OptionsBuilder &OptionsBuilder::setFirmwareResourcesObject(const void *firmware_resources_object)
ansond 27:b8aaf7dc7023 165 {
ansond 27:b8aaf7dc7023 166 if (firmware_resources_object != NULL) {
ansond 27:b8aaf7dc7023 167 this->m_firmware_resources_object = (void *)firmware_resources_object;
ansond 0:1f1f55e73248 168 }
ansond 0:1f1f55e73248 169 return *this;
ansond 0:1f1f55e73248 170 }
ansond 0:1f1f55e73248 171
ansond 0:1f1f55e73248 172 // add static resource
ansond 0:1f1f55e73248 173 OptionsBuilder &OptionsBuilder::addResource(const StaticResource *resource)
ansond 0:1f1f55e73248 174 {
ansond 0:1f1f55e73248 175 if (resource != NULL) {
ansond 0:1f1f55e73248 176 ((StaticResource *)resource)->setOptions(this);
ansond 0:1f1f55e73248 177 this->m_static_resources.push_back((StaticResource *)resource);
ansond 0:1f1f55e73248 178 }
ansond 0:1f1f55e73248 179 return *this;
ansond 0:1f1f55e73248 180 }
ansond 0:1f1f55e73248 181
ansond 0:1f1f55e73248 182 // add dynamic resource
ansond 0:1f1f55e73248 183 OptionsBuilder &OptionsBuilder::addResource(const DynamicResource *resource)
ansond 0:1f1f55e73248 184 {
ansond 0:1f1f55e73248 185 // ensure that the boolean isn't mistaken by the compiler for the obs period...
ansond 0:1f1f55e73248 186 return this->addResource(resource,OBS_PERIOD_MS,!(((DynamicResource *)resource)->implementsObservation()));
ansond 0:1f1f55e73248 187 }
ansond 0:1f1f55e73248 188
ansond 0:1f1f55e73248 189 // add dynamic resource
ansond 0:1f1f55e73248 190 OptionsBuilder &OptionsBuilder::addResource(const DynamicResource *resource,const int sleep_time)
ansond 0:1f1f55e73248 191 {
ansond 0:1f1f55e73248 192 // ensure that the boolean isn't mistaken by the compiler for the obs period...
ansond 0:1f1f55e73248 193 return this->addResource(resource,sleep_time,!(((DynamicResource *)resource)->implementsObservation()));
ansond 0:1f1f55e73248 194 }
ansond 0:1f1f55e73248 195
ansond 0:1f1f55e73248 196 // add dynamic resource
ansond 0:1f1f55e73248 197 OptionsBuilder &OptionsBuilder::addResource(const DynamicResource *resource,const bool use_observer)
ansond 0:1f1f55e73248 198 {
ansond 0:1f1f55e73248 199 // ensure that the boolean isn't mistaken by the compiler for the obs period...
ansond 0:1f1f55e73248 200 return this->addResource(resource,OBS_PERIOD_MS,use_observer);
ansond 0:1f1f55e73248 201 }
ansond 0:1f1f55e73248 202
ansond 0:1f1f55e73248 203 // add dynamic resource
ansond 0:1f1f55e73248 204 OptionsBuilder &OptionsBuilder::addResource(const DynamicResource *resource,const int sleep_time,const bool use_observer)
ansond 0:1f1f55e73248 205 {
ansond 0:1f1f55e73248 206 if (resource != NULL) {
ansond 0:1f1f55e73248 207 this->m_dynamic_resources.push_back((DynamicResource *)resource);
ansond 0:1f1f55e73248 208 ((DynamicResource *)resource)->setOptions(this);
ansond 17:defb680f8fce 209 ((DynamicResource *)resource)->setEndpoint((const void *)this->getEndpoint());
ansond 0:1f1f55e73248 210 if (((DynamicResource *)resource)->isObservable() == true && use_observer == true) {
ansond 34:a10d65907549 211 // Establish the appropriate ResourceObserver
ansond 27:b8aaf7dc7023 212 #if defined (MCI_MINAR_SCHEDULER)
ansond 34:a10d65907549 213 // Minar-based Scheduler ResourceObserver
ansond 27:b8aaf7dc7023 214 MinarResourceObserver *observer = new MinarResourceObserver((DynamicResource *)resource,(int)sleep_time);
ansond 27:b8aaf7dc7023 215 #else
ansond 27:b8aaf7dc7023 216 #ifdef CONNECTOR_USING_THREADS
ansond 34:a10d65907549 217 // mbedOS RTOS Thread ResourceObserver
ansond 0:1f1f55e73248 218 ThreadedResourceObserver *observer = new ThreadedResourceObserver((DynamicResource *)resource,(int)sleep_time);
ansond 34:a10d65907549 219 #endif
ansond 34:a10d65907549 220 #ifdef CONNECTOR_USING_TICKER
ansond 34:a10d65907549 221 // mbed Ticker ResourceObserver
ansond 0:1f1f55e73248 222 TickerResourceObserver *observer = new TickerResourceObserver((DynamicResource *)resource,(int)sleep_time);
ansond 27:b8aaf7dc7023 223 #endif
ansond 0:1f1f55e73248 224 #endif
ansond 34:a10d65907549 225 // If no observer type is set in mbed-connector-interface/configuration.h (EndpointNetwork lib), then "observer" will be unresolved
ansond 0:1f1f55e73248 226 this->m_resource_observers.push_back(observer);
ansond 0:1f1f55e73248 227
ansond 0:1f1f55e73248 228 // immedate observation enablement option
ansond 0:1f1f55e73248 229 if (this->immedateObservationEnabled()) {
ansond 0:1f1f55e73248 230 observer->beginObservation();
ansond 0:1f1f55e73248 231 }
ansond 0:1f1f55e73248 232 }
ansond 0:1f1f55e73248 233 }
ansond 0:1f1f55e73248 234 return *this;
ansond 0:1f1f55e73248 235 }
ansond 0:1f1f55e73248 236
ansond 0:1f1f55e73248 237 // set WiFi SSID
ansond 0:1f1f55e73248 238 OptionsBuilder &OptionsBuilder::setWiFiSSID(char *ssid)
ansond 0:1f1f55e73248 239 {
ansond 0:1f1f55e73248 240 this->m_wifi_ssid = string(ssid);
ansond 0:1f1f55e73248 241 return *this;
ansond 0:1f1f55e73248 242 }
ansond 0:1f1f55e73248 243
ansond 0:1f1f55e73248 244 // set WiFi AuthType
ansond 0:1f1f55e73248 245 OptionsBuilder &OptionsBuilder::setWiFiAuthType(WiFiAuthTypes auth_type)
ansond 0:1f1f55e73248 246 {
ansond 0:1f1f55e73248 247 this->m_wifi_auth_type = auth_type;
ansond 0:1f1f55e73248 248 return *this;
ansond 0:1f1f55e73248 249 }
ansond 0:1f1f55e73248 250
ansond 0:1f1f55e73248 251 // set WiFi AuthKey
ansond 0:1f1f55e73248 252 OptionsBuilder &OptionsBuilder::setWiFiAuthKey(char *auth_key)
ansond 0:1f1f55e73248 253 {
ansond 0:1f1f55e73248 254 this->m_wifi_auth_key = string(auth_key);
ansond 0:1f1f55e73248 255 return *this;
ansond 0:1f1f55e73248 256 }
ansond 0:1f1f55e73248 257
ansond 8:f950fb1b78c0 258 // set 802.15.4 Pre Shared Key
ansond 8:f950fb1b78c0 259 OptionsBuilder &OptionsBuilder::setPreSharedKey(unsigned char psk[16])
ansond 0:1f1f55e73248 260 {
ansond 8:f950fb1b78c0 261 memset(this->m_psk,0,16);
ansond 8:f950fb1b78c0 262 for(int i=0;i<16;++i) {
ansond 8:f950fb1b78c0 263 this->m_psk[i] = psk[i];
ansond 8:f950fb1b78c0 264 }
ansond 0:1f1f55e73248 265 return *this;
ansond 0:1f1f55e73248 266 }
ansond 0:1f1f55e73248 267
ansond 8:f950fb1b78c0 268 // set 802.15.4 Pre Shared Key Identity
ansond 8:f950fb1b78c0 269 OptionsBuilder &OptionsBuilder::setPreSharedKeyIdentity(unsigned char psk_identity[2])
ansond 0:1f1f55e73248 270 {
ansond 8:f950fb1b78c0 271 memset(this->m_psk_identity,0,2);
ansond 8:f950fb1b78c0 272 for(int i=0;i<2;++i) {
ansond 8:f950fb1b78c0 273 this->m_psk_identity[i] = psk_identity[i];
ansond 8:f950fb1b78c0 274 }
ansond 0:1f1f55e73248 275 return *this;
ansond 0:1f1f55e73248 276 }
ansond 0:1f1f55e73248 277
ansond 9:faa43faea4ca 278 // set 802.15.4 Mesh Type
ansond 9:faa43faea4ca 279 OptionsBuilder &OptionsBuilder::setMeshType(MeshTypes mesh_type)
ansond 9:faa43faea4ca 280 {
ansond 9:faa43faea4ca 281 this->m_mesh_type = mesh_type;
ansond 9:faa43faea4ca 282 return *this;
ansond 9:faa43faea4ca 283 }
ansond 9:faa43faea4ca 284
ansond 10:3f79b5e67c22 285 // set the CoAP Connection Type
ansond 10:3f79b5e67c22 286 OptionsBuilder &OptionsBuilder::setCoAPConnectionType(CoAPConnectionTypes coap_connection_type)
ansond 10:3f79b5e67c22 287 {
ansond 10:3f79b5e67c22 288 this->m_coap_connection_type = coap_connection_type;
ansond 10:3f79b5e67c22 289 return *this;
ansond 10:3f79b5e67c22 290 }
ansond 10:3f79b5e67c22 291
ansond 10:3f79b5e67c22 292 // set the IP Address Type
ansond 10:3f79b5e67c22 293 OptionsBuilder &OptionsBuilder::setIPAddressType(IPAddressTypes ip_address_type)
ansond 10:3f79b5e67c22 294 {
ansond 10:3f79b5e67c22 295 this->m_ip_address_type = ip_address_type;
ansond 10:3f79b5e67c22 296 return *this;
ansond 10:3f79b5e67c22 297 }
ansond 10:3f79b5e67c22 298
ansond 0:1f1f55e73248 299 // build out our immutable self
ansond 0:1f1f55e73248 300 Options *OptionsBuilder::build()
ansond 0:1f1f55e73248 301 {
ansond 0:1f1f55e73248 302 return (Options *)this;
ansond 0:1f1f55e73248 303 }
ansond 0:1f1f55e73248 304
ansond 0:1f1f55e73248 305 // Enable/Disable immediate observationing
ansond 0:1f1f55e73248 306 OptionsBuilder &OptionsBuilder::setImmedateObservationEnabled(bool enable) {
ansond 0:1f1f55e73248 307 this->m_enable_immediate_observation = enable;
ansond 0:1f1f55e73248 308 return *this;
ansond 0:1f1f55e73248 309 }
ansond 0:1f1f55e73248 310
ansond 0:1f1f55e73248 311 // Enable/Disable GET-based control of observations
ansond 0:1f1f55e73248 312 OptionsBuilder &OptionsBuilder::setEnableGETObservationControl(bool enable) {
ansond 0:1f1f55e73248 313 this->m_enable_get_obs_control = enable;
ansond 0:1f1f55e73248 314 return *this;
ansond 0:1f1f55e73248 315 }
ansond 0:1f1f55e73248 316
ansond 0:1f1f55e73248 317 // set the server certificate
ansond 49:c603a22495bb 318 OptionsBuilder &OptionsBuilder::setServerCertificate(uint8_t *cert,int cert_size) {
ansond 49:c603a22495bb 319 this->m_server_cert = cert;
ansond 49:c603a22495bb 320 this->m_server_cert_length = cert_size;
ansond 0:1f1f55e73248 321 return *this;
ansond 0:1f1f55e73248 322 }
ansond 0:1f1f55e73248 323
ansond 0:1f1f55e73248 324 // set the client certificate
ansond 49:c603a22495bb 325 OptionsBuilder &OptionsBuilder::setClientCertificate(uint8_t *cert,int cert_size) {
ansond 49:c603a22495bb 326 this->m_client_cert = cert;
ansond 49:c603a22495bb 327 this->m_client_cert_length = cert_size;
ansond 0:1f1f55e73248 328 return *this;
ansond 0:1f1f55e73248 329 }
ansond 0:1f1f55e73248 330
ansond 0:1f1f55e73248 331 // set the client key
ansond 49:c603a22495bb 332 OptionsBuilder &OptionsBuilder::setClientKey(uint8_t *key,int key_size) {
ansond 49:c603a22495bb 333 this->m_client_key = key;
ansond 49:c603a22495bb 334 this->m_client_key_length = key_size;
ansond 0:1f1f55e73248 335 return *this;
ansond 0:1f1f55e73248 336 }
ansond 0:1f1f55e73248 337
ansond 22:68fcdc40b397 338 // set our endpoint
ansond 22:68fcdc40b397 339 void OptionsBuilder::setEndpoint(void *endpoint) {
ansond 22:68fcdc40b397 340 this->m_endpoint = endpoint;
ansond 22:68fcdc40b397 341 }
ansond 22:68fcdc40b397 342
ansond 0:1f1f55e73248 343 } // namespace Connector