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