mbedConnectorInterface back port from mbedOS v3 using mbed-client C++ call interface
Embed:
(wiki syntax)
Show/hide line numbers
OptionsBuilder.h
Go to the documentation of this file.
00001 /** 00002 * @file OptionsBuilder.h 00003 * @brief mbed CoAP OptionsBuilder class header 00004 * @author Doug Anson/Chris Paola 00005 * @version 1.0 00006 * @see 00007 * 00008 * Copyright (c) 2014 00009 * 00010 * Licensed under the Apache License, Version 2.0 (the "License"); 00011 * you may not use this file except in compliance with the License. 00012 * You may obtain a copy of the License at 00013 * 00014 * http://www.apache.org/licenses/LICENSE-2.0 00015 * 00016 * Unless required by applicable law or agreed to in writing, software 00017 * distributed under the License is distributed on an "AS IS" BASIS, 00018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00019 * See the License for the specific language governing permissions and 00020 * limitations under the License. 00021 */ 00022 00023 #ifndef __OPTIONS_BUILDER_H__ 00024 #define __OPTIONS_BUILDER_H__ 00025 00026 // base class support 00027 #include "mbed-connector-interface/Options.h" 00028 00029 // Connector namespace 00030 namespace Connector { 00031 00032 /** OptionsBuilder class 00033 */ 00034 class OptionsBuilder : Options 00035 { 00036 public: 00037 /** 00038 Default Constructor 00039 */ 00040 OptionsBuilder(); 00041 00042 /** 00043 Copy Constructor 00044 @param ob input options builder instance to deep copy 00045 */ 00046 OptionsBuilder(const OptionsBuilder &ob); 00047 00048 /** 00049 Destructor 00050 */ 00051 virtual ~OptionsBuilder(); 00052 00053 /** 00054 Set the NSDL Endpoint Lifetime 00055 @param lifetime input the NSDL endpoint lifetime (seconds) 00056 @return instance to ourself 00057 */ 00058 OptionsBuilder &setLifetime(int lifetime); 00059 00060 /** 00061 Set the NSDL Domain 00062 @param domain input the NSDL domain to set 00063 @return instance to ourself 00064 */ 00065 OptionsBuilder &setDomain(const char *domain); 00066 00067 /** 00068 Set the Endpoint Node Name 00069 @param node_name input the node endpoint name 00070 @return instance to ourself 00071 */ 00072 OptionsBuilder &setEndpointNodename(const char *node_name); 00073 00074 /** 00075 Set the NSDL Endpoint Type 00076 @param endpoint_type input the NSDL endpoint type 00077 @return instance to ourself 00078 */ 00079 OptionsBuilder &setEndpointType(const char *endpoint_type); 00080 00081 /** 00082 Set the mbed Registration Update Period 00083 @param rd_update_period_ms input the NSDL read update period (in ms) 00084 @return instance to ourself 00085 */ 00086 OptionsBuilder &setRegUpdatePeriod(const int reg_update_period_ms); 00087 00088 /** 00089 Set the Connector URL 00090 @param url input the Connector URL 00091 @return instance to ourself 00092 */ 00093 OptionsBuilder &setConnectorURL(const char *connector_url); 00094 00095 /** 00096 Add a NSDL device resource (static) 00097 @param device_resource input the NSDL device resource 00098 @return instance to ourself 00099 */ 00100 OptionsBuilder &addResource(const DeviceResource *device_resource); 00101 00102 /** 00103 Add a NSDL endpoint resource (static) 00104 @param static_resource input the NSDL static resource 00105 @return instance to ourself 00106 */ 00107 OptionsBuilder &addResource(const StaticResource *static_resource); 00108 00109 /** 00110 Add a NSDL endpoint resource (dynamic) 00111 @param dynamic_resource input the NSDL dynamic resource 00112 */ 00113 OptionsBuilder &addResource(const DynamicResource *dynamic_resource); 00114 00115 /** 00116 Add a NSDL endpoint resource (dynamic) 00117 @param dynamic_resource input the NSDL dynamic resource 00118 @param use_observer input if true, use an appropriate ResourceObserver to observer. if false, the underlying resource will handle it 00119 @return instance to ourself 00120 */ 00121 OptionsBuilder &addResource(const DynamicResource *dynamic_resource,const bool use_observer); 00122 00123 /** 00124 Add a NSDL endpoint resource (dynamic) 00125 @param dynamic_resource input the NSDL dynamic resource 00126 @param sleep_time input the observation sleep time in milliseconds (for observable resource only) 00127 @return instance to ourself 00128 */ 00129 OptionsBuilder &addResource(const DynamicResource *dynamic_resource,const int sleep_time); 00130 00131 /** 00132 Add a NSDL endpoint resource (dynamic) 00133 @param dynamic_resource input the NSDL dynamic resource 00134 @param sleep_time input the observation sleep time in milliseconds (for observable resource only) 00135 @param use_observer input if true, use an appropriate ResourceObserver to observer. if false, the underlying resource will handle it 00136 @return instance to ourself 00137 */ 00138 OptionsBuilder &addResource(const DynamicResource *dynamic_resource,const int sleep_time,const bool use_observer); 00139 00140 /** 00141 Set the WiFi SSID 00142 @param ssid input the WiFi SSID 00143 */ 00144 OptionsBuilder &setWiFiSSID(char *ssid); 00145 00146 /** 00147 Set the WiFi AuthType 00148 @param auth_type input the WiFi AuthType 00149 */ 00150 OptionsBuilder &setWiFiAuthType(WiFiAuthTypes auth_type); 00151 00152 /** 00153 Set the WiFi AuthKey 00154 @param auth_key input the WiFi AuthKey 00155 */ 00156 OptionsBuilder &setWiFiAuthKey(char *auth_key); 00157 00158 /** 00159 Set the 802.15.4 Pre Shared Key 00160 @param psk input the 802.15.4 mesh pre shared key 00161 */ 00162 OptionsBuilder &setPreSharedKey(unsigned char psk[16]); 00163 00164 /** 00165 Set the 802.15.4 Pre Shared Key Identity 00166 @param psk_identity input the 802.15.4 mesh pre shared key Identity 00167 */ 00168 OptionsBuilder &setPreSharedKeyIdentity(unsigned char psk_identity[2]); 00169 00170 /** 00171 Set the 802.15.4 Mesh Type 00172 @param mesh_type input the 802.15.4 mesh type 00173 */ 00174 OptionsBuilder &setMeshType(MeshTypes mesh_type); 00175 00176 /** 00177 Set the CoAP Connection Type 00178 @param coap_connection_type input the CoAP Connection type 00179 */ 00180 OptionsBuilder &setCoAPConnectionType(CoAPConnectionTypes coap_connection_type); 00181 00182 /** 00183 Set the IP Address Type 00184 @param ip_address_type input the IP Address type 00185 */ 00186 OptionsBuilder &setIPAddressType(IPAddressTypes ip_address_type); 00187 00188 /** 00189 Enable/Disable immediate observationing 00190 @param enable input enable immediate observationing without GET 00191 */ 00192 OptionsBuilder &setImmedateObservationEnabled(bool enable); 00193 00194 /** 00195 Enable/Disable GET-based control of observations 00196 @param enable input enable GET-based observation enable/disable control 00197 */ 00198 OptionsBuilder &setEnableGETObservationControl(bool enable); 00199 00200 /** 00201 Set the Server Certificate 00202 @param cert input the server certificate 00203 @param cert_size input the length of the server certificate 00204 */ 00205 OptionsBuilder &setServerCertificate(uint8_t cert[],int cert_size); 00206 00207 /** 00208 Set the Client Certificate 00209 @param cert input the client certificate 00210 @param cert_size input the length of the client certificate 00211 */ 00212 OptionsBuilder &setClientCertificate(uint8_t cert[],int cert_size); 00213 00214 /** 00215 Set the Client Key 00216 @param key input the client key 00217 @param key_size input the length of the client key 00218 */ 00219 OptionsBuilder &setClientKey(uint8_t key[],int key_size); 00220 00221 /** 00222 Build our our immutable self 00223 */ 00224 Options *build(); 00225 00226 /** 00227 Set our Endpoint instance 00228 */ 00229 void setEndpoint(void *endpoint); 00230 }; 00231 00232 } // namespace Connector 00233 00234 #endif // __OPTIONS_BUILDER_H__
Generated on Wed Jul 13 2022 21:59:32 by
1.7.2