Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbedConnectorInterfaceWithDM by
Options.h
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 // Static Resources 00027 #include "mbed-connector-interface/StaticResource.h" 00028 00029 // Dynamic Resources 00030 #include "mbed-connector-interface/DynamicResource.h" 00031 00032 // include the mbed connector resource list 00033 #include "mbed-connector-interface/mbedConnectorInterface.h" 00034 00035 // include the resource observer includes here so that they are not required in main.cpp 00036 #include "mbed-connector-interface/ThreadedResourceObserver.h" 00037 #include "mbed-connector-interface/TickerResourceObserver.h" 00038 #include "mbed-connector-interface/MinarResourceObserver.h" 00039 00040 // Vector support 00041 #include <vector> 00042 00043 // Resources list 00044 typedef vector<StaticResource *> StaticResourcesList; 00045 typedef vector<DynamicResource *> DynamicResourcesList; 00046 typedef vector<ResourceObserver *> ResourceObserversList; 00047 00048 // Default CoAP Port for mbed Cloud/Connector 00049 #define DEF_COAP_PORT 5684 00050 00051 // WiFi Security types (maps to wifi_security_t) 00052 typedef enum { 00053 WIFI_NONE = 0, 00054 WIFI_WEP, 00055 WIFI_WPA_PERSONAL, 00056 WIFI_WPA2_PERSONAL 00057 } WiFiAuthTypes; 00058 00059 // Connection Types for CoAP 00060 typedef enum { 00061 COAP_TCP, 00062 COAP_UDP, 00063 COAP_NUM_TYPES 00064 } CoAPConnectionTypes; 00065 00066 // IP Address Types 00067 typedef enum { 00068 IP_ADDRESS_TYPE_IPV4, 00069 IP_ADDRESS_TYPE_IPV6, 00070 IP_ADDRESS_TYPE_NUM_TYPES 00071 } IPAddressTypes; 00072 00073 namespace Connector { 00074 00075 /** Options class 00076 */ 00077 class Options 00078 { 00079 public: 00080 /** 00081 Default constructor 00082 */ 00083 Options(); 00084 00085 /** 00086 Copy constructor 00087 */ 00088 Options(const Options &opt); 00089 00090 /** 00091 Destructor 00092 */ 00093 virtual ~Options(); 00094 00095 /** 00096 Get the node lifetime 00097 */ 00098 int getLifetime(); 00099 00100 /** 00101 Get the NSP domain 00102 */ 00103 string getDomain(); 00104 00105 /** 00106 Get the node name 00107 */ 00108 string getEndpointNodename(); 00109 00110 /** 00111 Get the node type 00112 */ 00113 string getEndpointType(); 00114 00115 /** 00116 Get the endpoint Connector URL 00117 */ 00118 char *getConnectorURL(); 00119 00120 /** 00121 Get the connector connection port from the URL 00122 */ 00123 uint16_t getConnectorPort(); 00124 00125 /** 00126 Get the Device Resources Object Instance 00127 */ 00128 void *getDeviceResourcesObject(); 00129 00130 /** 00131 Get the Firmware Resources Object Instance 00132 */ 00133 void *getFirmwareResourcesObject(); 00134 00135 /** 00136 Get the list of static resources 00137 */ 00138 StaticResourcesList *getStaticResourceList(); 00139 00140 /** 00141 Get the list of dynamic resources 00142 */ 00143 DynamicResourcesList *getDynamicResourceList(); 00144 00145 /** 00146 Get the WiFi SSID 00147 */ 00148 string getWiFiSSID(); 00149 00150 /** 00151 Get the WiFi Auth Type 00152 */ 00153 WiFiAuthTypes getWiFiAuthType(); 00154 00155 /** 00156 Get the WiFi Auth Key 00157 */ 00158 string getWiFiAuthKey(); 00159 00160 /** 00161 Get the CoAP Connection Type 00162 */ 00163 CoAPConnectionTypes getCoAPConnectionType(); 00164 00165 /** 00166 Get the IP Address Type 00167 */ 00168 IPAddressTypes getIPAddressType(); 00169 00170 /** 00171 Enable/Disable Immediate Observationing 00172 */ 00173 bool immedateObservationEnabled(); 00174 00175 /** 00176 Enable/Disable Observation control via GET 00177 */ 00178 bool enableGETObservationControl(); 00179 00180 /** 00181 Get the Server Certificate 00182 */ 00183 uint8_t *getServerCertificate(); 00184 00185 /** 00186 Get the Server Certificate Size (bytes) 00187 */ 00188 int getServerCertificateSize(); 00189 00190 /** 00191 Get the Client Certificate 00192 */ 00193 uint8_t *getClientCertificate(); 00194 00195 /** 00196 Get the Client Certificate Size (bytes) 00197 */ 00198 int getClientCertificateSize(); 00199 00200 /** 00201 Get the Client Key 00202 */ 00203 uint8_t *getClientKey(); 00204 00205 /** 00206 Get the Client Key Size (bytes) 00207 */ 00208 int getClientKeySize(); 00209 00210 /** 00211 Get Our Endpoint 00212 */ 00213 void *getEndpoint(); 00214 00215 protected: 00216 // mDS Resources 00217 int m_lifetime; 00218 string m_domain; 00219 string m_node_name; 00220 string m_endpoint_type; 00221 string m_connector_url; 00222 00223 // WiFi Resources 00224 string m_wifi_ssid; 00225 string m_wifi_auth_key; 00226 WiFiAuthTypes m_wifi_auth_type; 00227 00228 // CoAP Connection Types 00229 CoAPConnectionTypes m_coap_connection_type; 00230 00231 // IP Address Types 00232 IPAddressTypes m_ip_address_type; 00233 00234 // DTLS/TLS Resources 00235 uint8_t *m_server_cert; 00236 int m_server_cert_length; 00237 uint8_t *m_client_cert; 00238 int m_client_cert_length; 00239 uint8_t *m_client_key; 00240 int m_client_key_length; 00241 00242 // CoAP behavior adjustments 00243 bool m_enable_immediate_observation; 00244 bool m_enable_get_obs_control; 00245 00246 // Endpoint Resources 00247 void *m_device_resources_object; 00248 void *m_firmware_resources_object; 00249 StaticResourcesList m_static_resources; 00250 DynamicResourcesList m_dynamic_resources; 00251 ResourceObserversList m_resource_observers; 00252 00253 // Our Endpoint 00254 void *m_endpoint; 00255 }; 00256 00257 } // namespace Connector 00258 00259 #endif // __OPTIONS_H__
Generated on Wed Jul 13 2022 01:24:02 by
