mbedConnectorInterface back port from mbedOS v3 using mbed-client C++ call interface
Embed:
(wiki syntax)
Show/hide line numbers
Options.h
Go to the documentation of this file.
00001 /** 00002 * @file Options.h 00003 * @brief mbed CoAP Options (immutable OptionsBuilder instance) 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_H__ 00024 #define __OPTIONS_H__ 00025 00026 // Device Resources 00027 #include "mbed-connector-interface/DeviceResource.h" 00028 00029 // Static Resources 00030 #include "mbed-connector-interface/StaticResource.h" 00031 00032 // Dynamic Resources 00033 #include "mbed-connector-interface/DynamicResource.h" 00034 00035 // include the mbed connector resource list 00036 #include "mbed-connector-interface/mbedConnectorInterface.h" 00037 00038 // include the resource observer includes here so that they are not required in main.cpp 00039 #include "mbed-connector-interface/ThreadedResourceObserver.h" 00040 #include "mbed-connector-interface/TickerResourceObserver.h" 00041 00042 // Vector support 00043 #include <vector> 00044 00045 // Resources list 00046 typedef vector<DeviceResource *> DeviceResourcesList; 00047 typedef vector<StaticResource *> StaticResourcesList; 00048 typedef vector<DynamicResource *> DynamicResourcesList; 00049 typedef vector<ResourceObserver *> ResourceObserversList; 00050 00051 // Default CoAP URL 00052 #define DEF_COAP_PORT 5683 00053 00054 // WiFi Security types (maps to wifi_security_t) 00055 typedef enum { 00056 WIFI_NONE = 0, 00057 WIFI_WEP, 00058 WIFI_WPA_PERSONAL, 00059 WIFI_WPA2_PERSONAL 00060 } WiFiAuthTypes; 00061 00062 // Mesh Types 00063 typedef enum { 00064 MESH_THREAD, 00065 MESH_6LOWPAN_ND, 00066 MESH_NUM_TYPES 00067 } MeshTypes; 00068 00069 // Connection Types for CoAP 00070 typedef enum { 00071 COAP_TCP, 00072 COAP_UDP, 00073 COAP_NUM_TYPES 00074 } CoAPConnectionTypes; 00075 00076 // IP Address Types 00077 typedef enum { 00078 IP_ADDRESS_TYPE_IPV4, 00079 IP_ADDRESS_TYPE_IPV6, 00080 IP_ADDRESS_TYPE_NUM_TYPES 00081 } IPAddressTypes; 00082 00083 namespace Connector { 00084 00085 /** Options class 00086 */ 00087 class Options 00088 { 00089 public: 00090 /** 00091 Default constructor 00092 */ 00093 Options(); 00094 00095 /** 00096 Copy constructor 00097 */ 00098 Options(const Options &opt); 00099 00100 /** 00101 Destructor 00102 */ 00103 virtual ~Options(); 00104 00105 /** 00106 Get the node lifetime 00107 */ 00108 int getLifetime(); 00109 00110 /** 00111 Get the NSP domain 00112 */ 00113 string getDomain(); 00114 00115 /** 00116 Get the node name 00117 */ 00118 string getEndpointNodename(); 00119 00120 /** 00121 Get the node type 00122 */ 00123 string getEndpointType(); 00124 00125 /** 00126 Get the mbed registration update period 00127 */ 00128 int getRegUpdatePeriod(); 00129 00130 /** 00131 Get the endpoint Connector URL 00132 */ 00133 char *getConnectorURL(); 00134 00135 /** 00136 Get the connector connection port from the URL 00137 */ 00138 uint16_t getConnectorPort(); 00139 00140 /** 00141 Get the list of device resources 00142 */ 00143 DeviceResourcesList *getDeviceResourceList(); 00144 00145 /** 00146 Get the list of static resources 00147 */ 00148 StaticResourcesList *getStaticResourceList(); 00149 00150 /** 00151 Get the list of dynamic resources 00152 */ 00153 DynamicResourcesList *getDynamicResourceList(); 00154 00155 /** 00156 Get the WiFi SSID 00157 */ 00158 string getWiFiSSID(); 00159 00160 /** 00161 Get the WiFi Auth Type 00162 */ 00163 WiFiAuthTypes getWiFiAuthType(); 00164 00165 /** 00166 Get the WiFi Auth Key 00167 */ 00168 string getWiFiAuthKey(); 00169 00170 /** 00171 Get the 802.15.4 Pre Shared Key 00172 */ 00173 unsigned char *getPreSharedKey(); 00174 00175 /** 00176 Get the 802.15.4 Pre Shared Key Identity 00177 */ 00178 unsigned char *getPreSharedKeyIdentity(); 00179 00180 /** 00181 Get the 802.15.14 Mesh Type 00182 */ 00183 MeshTypes getMeshType(); 00184 00185 /** 00186 Get the CoAP Connection Type 00187 */ 00188 CoAPConnectionTypes getCoAPConnectionType(); 00189 00190 /** 00191 Get the IP Address Type 00192 */ 00193 IPAddressTypes getIPAddressType(); 00194 00195 /** 00196 Enable/Disable Immediate Observationing 00197 */ 00198 bool immedateObservationEnabled(); 00199 00200 /** 00201 Enable/Disable Observation control via GET 00202 */ 00203 bool enableGETObservationControl(); 00204 00205 /** 00206 Get the Server Certificate 00207 */ 00208 uint8_t *getServerCertificate(); 00209 00210 /** 00211 Get the Server Certificate Size (bytes) 00212 */ 00213 int getServerCertificateSize(); 00214 00215 /** 00216 Get the Client Certificate 00217 */ 00218 uint8_t *getClientCertificate(); 00219 00220 /** 00221 Get the Client Certificate Size (bytes) 00222 */ 00223 int getClientCertificateSize(); 00224 00225 /** 00226 Get the Client Key 00227 */ 00228 uint8_t *getClientKey(); 00229 00230 /** 00231 Get the Client Key Size (bytes) 00232 */ 00233 int getClientKeySize(); 00234 00235 /** 00236 Get Our Endpoint 00237 */ 00238 void *getEndpoint(); 00239 00240 protected: 00241 // mDS Resources 00242 int m_lifetime; 00243 string m_domain; 00244 string m_node_name; 00245 string m_endpoint_type; 00246 int m_reg_update_period; 00247 string m_connector_url; 00248 00249 // WiFi Resources 00250 string m_wifi_ssid; 00251 string m_wifi_auth_key; 00252 WiFiAuthTypes m_wifi_auth_type; 00253 00254 // CoAP Connection Types 00255 CoAPConnectionTypes m_coap_connection_type; 00256 00257 // IP Address Types 00258 IPAddressTypes m_ip_address_type; 00259 00260 // 802.15.4 Resources 00261 unsigned char m_psk[16]; 00262 unsigned char m_psk_identity[2]; 00263 MeshTypes m_mesh_type; 00264 00265 // DTLS/TLS Resources 00266 uint8_t m_server_cert[MAX_SERVER_CERT_LENGTH]; 00267 int m_server_cert_length; 00268 uint8_t m_client_cert[MAX_CLIENT_CERT_LENGTH]; 00269 int m_client_cert_length; 00270 uint8_t m_client_key[MAX_CLIENT_KEY_LENGTH]; 00271 int m_client_key_length; 00272 00273 // CoAP behavior adjustments 00274 bool m_enable_immediate_observation; 00275 bool m_enable_get_obs_control; 00276 00277 // Endpoint Resources 00278 DeviceResourcesList m_device_resources; 00279 StaticResourcesList m_static_resources; 00280 DynamicResourcesList m_dynamic_resources; 00281 ResourceObserversList m_resource_observers; 00282 00283 // Our Endpoint 00284 void *m_endpoint; 00285 }; 00286 00287 } // namespace Connector 00288 00289 #endif // __OPTIONS_H__
Generated on Wed Jul 13 2022 21:59:32 by
1.7.2