mbed Connector Interface simplification API on top of mbed-client
Fork of mbedConnectorInterfaceV3 by
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!
mbed-connector-interface/Options.h@127:b4a661ff6fb9, 2017-09-26 (annotated)
- Committer:
- ansond
- Date:
- Tue Sep 26 16:01:31 2017 +0000
- Revision:
- 127:b4a661ff6fb9
- Parent:
- 125:4bf229bf14a3
minor re-ordering of FCC init
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ansond | 0:1f1f55e73248 | 1 | /** |
ansond | 0:1f1f55e73248 | 2 | * @file Options.h |
ansond | 0:1f1f55e73248 | 3 | * @brief mbed CoAP Options (immutable OptionsBuilder instance) class header |
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 | 0:1f1f55e73248 | 23 | #ifndef __OPTIONS_H__ |
ansond | 0:1f1f55e73248 | 24 | #define __OPTIONS_H__ |
ansond | 0:1f1f55e73248 | 25 | |
ansond | 0:1f1f55e73248 | 26 | // Static Resources |
ansond | 0:1f1f55e73248 | 27 | #include "mbed-connector-interface/StaticResource.h" |
ansond | 0:1f1f55e73248 | 28 | |
ansond | 0:1f1f55e73248 | 29 | // Dynamic Resources |
ansond | 0:1f1f55e73248 | 30 | #include "mbed-connector-interface/DynamicResource.h" |
ansond | 0:1f1f55e73248 | 31 | |
ansond | 0:1f1f55e73248 | 32 | // include the mbed connector resource list |
ansond | 0:1f1f55e73248 | 33 | #include "mbed-connector-interface/mbedConnectorInterface.h" |
ansond | 0:1f1f55e73248 | 34 | |
ansond | 0:1f1f55e73248 | 35 | // include the resource observer includes here so that they are not required in main.cpp |
ansond | 125:4bf229bf14a3 | 36 | #include "mbed-connector-interface/EventQueueResourceObserver.h" |
ansond | 0:1f1f55e73248 | 37 | #include "mbed-connector-interface/ThreadedResourceObserver.h" |
ansond | 0:1f1f55e73248 | 38 | #include "mbed-connector-interface/TickerResourceObserver.h" |
ansond | 36:5ec1fdffe40e | 39 | #include "mbed-connector-interface/MinarResourceObserver.h" |
ansond | 0:1f1f55e73248 | 40 | |
ansond | 0:1f1f55e73248 | 41 | // Vector support |
ansond | 0:1f1f55e73248 | 42 | #include <vector> |
ansond | 0:1f1f55e73248 | 43 | |
ansond | 0:1f1f55e73248 | 44 | // Resources list |
ansond | 0:1f1f55e73248 | 45 | typedef vector<StaticResource *> StaticResourcesList; |
ansond | 0:1f1f55e73248 | 46 | typedef vector<DynamicResource *> DynamicResourcesList; |
ansond | 0:1f1f55e73248 | 47 | typedef vector<ResourceObserver *> ResourceObserversList; |
ansond | 0:1f1f55e73248 | 48 | |
ansond | 57:b017388f1aa3 | 49 | // Default CoAP Port for mbed Cloud/Connector |
ansond | 57:b017388f1aa3 | 50 | #define DEF_COAP_PORT 5684 |
ansond | 10:3f79b5e67c22 | 51 | |
ansond | 12:d0e61bac8c27 | 52 | // WiFi Security types (maps to wifi_security_t) |
ansond | 0:1f1f55e73248 | 53 | typedef enum { |
ansond | 12:d0e61bac8c27 | 54 | WIFI_NONE = 0, |
ansond | 12:d0e61bac8c27 | 55 | WIFI_WEP, |
ansond | 0:1f1f55e73248 | 56 | WIFI_WPA_PERSONAL, |
ansond | 12:d0e61bac8c27 | 57 | WIFI_WPA2_PERSONAL |
ansond | 0:1f1f55e73248 | 58 | } WiFiAuthTypes; |
ansond | 0:1f1f55e73248 | 59 | |
ansond | 10:3f79b5e67c22 | 60 | // Connection Types for CoAP |
ansond | 10:3f79b5e67c22 | 61 | typedef enum { |
ansond | 10:3f79b5e67c22 | 62 | COAP_TCP, |
ansond | 10:3f79b5e67c22 | 63 | COAP_UDP, |
ansond | 10:3f79b5e67c22 | 64 | COAP_NUM_TYPES |
ansond | 10:3f79b5e67c22 | 65 | } CoAPConnectionTypes; |
ansond | 10:3f79b5e67c22 | 66 | |
ansond | 10:3f79b5e67c22 | 67 | // IP Address Types |
ansond | 10:3f79b5e67c22 | 68 | typedef enum { |
ansond | 10:3f79b5e67c22 | 69 | IP_ADDRESS_TYPE_IPV4, |
ansond | 10:3f79b5e67c22 | 70 | IP_ADDRESS_TYPE_IPV6, |
ansond | 10:3f79b5e67c22 | 71 | IP_ADDRESS_TYPE_NUM_TYPES |
ansond | 10:3f79b5e67c22 | 72 | } IPAddressTypes; |
ansond | 10:3f79b5e67c22 | 73 | |
ansond | 0:1f1f55e73248 | 74 | namespace Connector { |
ansond | 0:1f1f55e73248 | 75 | |
ansond | 0:1f1f55e73248 | 76 | /** Options class |
ansond | 0:1f1f55e73248 | 77 | */ |
ansond | 0:1f1f55e73248 | 78 | class Options |
ansond | 0:1f1f55e73248 | 79 | { |
ansond | 0:1f1f55e73248 | 80 | public: |
ansond | 0:1f1f55e73248 | 81 | /** |
ansond | 0:1f1f55e73248 | 82 | Default constructor |
ansond | 0:1f1f55e73248 | 83 | */ |
ansond | 0:1f1f55e73248 | 84 | Options(); |
ansond | 0:1f1f55e73248 | 85 | |
ansond | 0:1f1f55e73248 | 86 | /** |
ansond | 0:1f1f55e73248 | 87 | Copy constructor |
ansond | 0:1f1f55e73248 | 88 | */ |
ansond | 0:1f1f55e73248 | 89 | Options(const Options &opt); |
ansond | 0:1f1f55e73248 | 90 | |
ansond | 0:1f1f55e73248 | 91 | /** |
ansond | 0:1f1f55e73248 | 92 | Destructor |
ansond | 0:1f1f55e73248 | 93 | */ |
ansond | 0:1f1f55e73248 | 94 | virtual ~Options(); |
ansond | 0:1f1f55e73248 | 95 | |
ansond | 0:1f1f55e73248 | 96 | /** |
ansond | 0:1f1f55e73248 | 97 | Get the node lifetime |
ansond | 0:1f1f55e73248 | 98 | */ |
ansond | 10:3f79b5e67c22 | 99 | int getLifetime(); |
ansond | 0:1f1f55e73248 | 100 | |
ansond | 0:1f1f55e73248 | 101 | /** |
ansond | 0:1f1f55e73248 | 102 | Get the NSP domain |
ansond | 0:1f1f55e73248 | 103 | */ |
ansond | 0:1f1f55e73248 | 104 | string getDomain(); |
ansond | 0:1f1f55e73248 | 105 | |
ansond | 0:1f1f55e73248 | 106 | /** |
ansond | 0:1f1f55e73248 | 107 | Get the node name |
ansond | 0:1f1f55e73248 | 108 | */ |
ansond | 0:1f1f55e73248 | 109 | string getEndpointNodename(); |
ansond | 0:1f1f55e73248 | 110 | |
ansond | 0:1f1f55e73248 | 111 | /** |
ansond | 0:1f1f55e73248 | 112 | Get the node type |
ansond | 0:1f1f55e73248 | 113 | */ |
ansond | 0:1f1f55e73248 | 114 | string getEndpointType(); |
ansond | 0:1f1f55e73248 | 115 | |
ansond | 0:1f1f55e73248 | 116 | /** |
ansond | 0:1f1f55e73248 | 117 | Get the endpoint Connector URL |
ansond | 0:1f1f55e73248 | 118 | */ |
ansond | 0:1f1f55e73248 | 119 | char *getConnectorURL(); |
ansond | 0:1f1f55e73248 | 120 | |
ansond | 10:3f79b5e67c22 | 121 | /** |
ansond | 10:3f79b5e67c22 | 122 | Get the connector connection port from the URL |
ansond | 10:3f79b5e67c22 | 123 | */ |
ansond | 10:3f79b5e67c22 | 124 | uint16_t getConnectorPort(); |
ansond | 10:3f79b5e67c22 | 125 | |
ansond | 0:1f1f55e73248 | 126 | /** |
ansond | 27:b8aaf7dc7023 | 127 | Get the Device Resources Object Instance |
ansond | 0:1f1f55e73248 | 128 | */ |
ansond | 27:b8aaf7dc7023 | 129 | void *getDeviceResourcesObject(); |
ansond | 27:b8aaf7dc7023 | 130 | |
ansond | 27:b8aaf7dc7023 | 131 | /** |
ansond | 27:b8aaf7dc7023 | 132 | Get the Firmware Resources Object Instance |
ansond | 27:b8aaf7dc7023 | 133 | */ |
ansond | 27:b8aaf7dc7023 | 134 | void *getFirmwareResourcesObject(); |
ansond | 0:1f1f55e73248 | 135 | |
ansond | 0:1f1f55e73248 | 136 | /** |
ansond | 0:1f1f55e73248 | 137 | Get the list of static resources |
ansond | 0:1f1f55e73248 | 138 | */ |
ansond | 0:1f1f55e73248 | 139 | StaticResourcesList *getStaticResourceList(); |
ansond | 0:1f1f55e73248 | 140 | |
ansond | 0:1f1f55e73248 | 141 | /** |
ansond | 0:1f1f55e73248 | 142 | Get the list of dynamic resources |
ansond | 0:1f1f55e73248 | 143 | */ |
ansond | 0:1f1f55e73248 | 144 | DynamicResourcesList *getDynamicResourceList(); |
ansond | 0:1f1f55e73248 | 145 | |
ansond | 0:1f1f55e73248 | 146 | /** |
ansond | 0:1f1f55e73248 | 147 | Get the WiFi SSID |
ansond | 0:1f1f55e73248 | 148 | */ |
ansond | 0:1f1f55e73248 | 149 | string getWiFiSSID(); |
ansond | 0:1f1f55e73248 | 150 | |
ansond | 0:1f1f55e73248 | 151 | /** |
ansond | 0:1f1f55e73248 | 152 | Get the WiFi Auth Type |
ansond | 0:1f1f55e73248 | 153 | */ |
ansond | 0:1f1f55e73248 | 154 | WiFiAuthTypes getWiFiAuthType(); |
ansond | 0:1f1f55e73248 | 155 | |
ansond | 0:1f1f55e73248 | 156 | /** |
ansond | 0:1f1f55e73248 | 157 | Get the WiFi Auth Key |
ansond | 0:1f1f55e73248 | 158 | */ |
ansond | 0:1f1f55e73248 | 159 | string getWiFiAuthKey(); |
ansond | 10:3f79b5e67c22 | 160 | |
ansond | 10:3f79b5e67c22 | 161 | /** |
ansond | 10:3f79b5e67c22 | 162 | Get the CoAP Connection Type |
ansond | 10:3f79b5e67c22 | 163 | */ |
ansond | 10:3f79b5e67c22 | 164 | CoAPConnectionTypes getCoAPConnectionType(); |
ansond | 10:3f79b5e67c22 | 165 | |
ansond | 10:3f79b5e67c22 | 166 | /** |
ansond | 10:3f79b5e67c22 | 167 | Get the IP Address Type |
ansond | 10:3f79b5e67c22 | 168 | */ |
ansond | 10:3f79b5e67c22 | 169 | IPAddressTypes getIPAddressType(); |
ansond | 0:1f1f55e73248 | 170 | |
ansond | 0:1f1f55e73248 | 171 | /** |
ansond | 0:1f1f55e73248 | 172 | Enable/Disable Immediate Observationing |
ansond | 0:1f1f55e73248 | 173 | */ |
ansond | 0:1f1f55e73248 | 174 | bool immedateObservationEnabled(); |
ansond | 0:1f1f55e73248 | 175 | |
ansond | 0:1f1f55e73248 | 176 | /** |
ansond | 0:1f1f55e73248 | 177 | Enable/Disable Observation control via GET |
ansond | 0:1f1f55e73248 | 178 | */ |
ansond | 0:1f1f55e73248 | 179 | bool enableGETObservationControl(); |
ansond | 0:1f1f55e73248 | 180 | |
ansond | 0:1f1f55e73248 | 181 | /** |
ansond | 0:1f1f55e73248 | 182 | Get the Server Certificate |
ansond | 0:1f1f55e73248 | 183 | */ |
ansond | 0:1f1f55e73248 | 184 | uint8_t *getServerCertificate(); |
ansond | 0:1f1f55e73248 | 185 | |
ansond | 0:1f1f55e73248 | 186 | /** |
ansond | 0:1f1f55e73248 | 187 | Get the Server Certificate Size (bytes) |
ansond | 0:1f1f55e73248 | 188 | */ |
ansond | 0:1f1f55e73248 | 189 | int getServerCertificateSize(); |
ansond | 0:1f1f55e73248 | 190 | |
ansond | 0:1f1f55e73248 | 191 | /** |
ansond | 0:1f1f55e73248 | 192 | Get the Client Certificate |
ansond | 0:1f1f55e73248 | 193 | */ |
ansond | 0:1f1f55e73248 | 194 | uint8_t *getClientCertificate(); |
ansond | 0:1f1f55e73248 | 195 | |
ansond | 0:1f1f55e73248 | 196 | /** |
ansond | 0:1f1f55e73248 | 197 | Get the Client Certificate Size (bytes) |
ansond | 0:1f1f55e73248 | 198 | */ |
ansond | 0:1f1f55e73248 | 199 | int getClientCertificateSize(); |
ansond | 0:1f1f55e73248 | 200 | |
ansond | 0:1f1f55e73248 | 201 | /** |
ansond | 0:1f1f55e73248 | 202 | Get the Client Key |
ansond | 0:1f1f55e73248 | 203 | */ |
ansond | 0:1f1f55e73248 | 204 | uint8_t *getClientKey(); |
ansond | 0:1f1f55e73248 | 205 | |
ansond | 0:1f1f55e73248 | 206 | /** |
ansond | 0:1f1f55e73248 | 207 | Get the Client Key Size (bytes) |
ansond | 0:1f1f55e73248 | 208 | */ |
ansond | 0:1f1f55e73248 | 209 | int getClientKeySize(); |
ansond | 0:1f1f55e73248 | 210 | |
ansond | 19:56f958475694 | 211 | /** |
ansond | 19:56f958475694 | 212 | Get Our Endpoint |
ansond | 19:56f958475694 | 213 | */ |
ansond | 19:56f958475694 | 214 | void *getEndpoint(); |
ansond | 19:56f958475694 | 215 | |
ansond | 0:1f1f55e73248 | 216 | protected: |
ansond | 0:1f1f55e73248 | 217 | // mDS Resources |
ansond | 0:1f1f55e73248 | 218 | int m_lifetime; |
ansond | 0:1f1f55e73248 | 219 | string m_domain; |
ansond | 0:1f1f55e73248 | 220 | string m_node_name; |
ansond | 0:1f1f55e73248 | 221 | string m_endpoint_type; |
ansond | 9:faa43faea4ca | 222 | string m_connector_url; |
ansond | 0:1f1f55e73248 | 223 | |
ansond | 0:1f1f55e73248 | 224 | // WiFi Resources |
ansond | 0:1f1f55e73248 | 225 | string m_wifi_ssid; |
ansond | 0:1f1f55e73248 | 226 | string m_wifi_auth_key; |
ansond | 9:faa43faea4ca | 227 | WiFiAuthTypes m_wifi_auth_type; |
ansond | 10:3f79b5e67c22 | 228 | |
ansond | 10:3f79b5e67c22 | 229 | // CoAP Connection Types |
ansond | 10:3f79b5e67c22 | 230 | CoAPConnectionTypes m_coap_connection_type; |
ansond | 10:3f79b5e67c22 | 231 | |
ansond | 10:3f79b5e67c22 | 232 | // IP Address Types |
ansond | 10:3f79b5e67c22 | 233 | IPAddressTypes m_ip_address_type; |
ansond | 0:1f1f55e73248 | 234 | |
ansond | 0:1f1f55e73248 | 235 | // DTLS/TLS Resources |
ansond | 49:c603a22495bb | 236 | uint8_t *m_server_cert; |
ansond | 0:1f1f55e73248 | 237 | int m_server_cert_length; |
ansond | 49:c603a22495bb | 238 | uint8_t *m_client_cert; |
ansond | 0:1f1f55e73248 | 239 | int m_client_cert_length; |
ansond | 49:c603a22495bb | 240 | uint8_t *m_client_key; |
ansond | 0:1f1f55e73248 | 241 | int m_client_key_length; |
ansond | 0:1f1f55e73248 | 242 | |
ansond | 0:1f1f55e73248 | 243 | // CoAP behavior adjustments |
ansond | 0:1f1f55e73248 | 244 | bool m_enable_immediate_observation; |
ansond | 0:1f1f55e73248 | 245 | bool m_enable_get_obs_control; |
ansond | 0:1f1f55e73248 | 246 | |
ansond | 0:1f1f55e73248 | 247 | // Endpoint Resources |
ansond | 27:b8aaf7dc7023 | 248 | void *m_device_resources_object; |
ansond | 27:b8aaf7dc7023 | 249 | void *m_firmware_resources_object; |
ansond | 15:c11dbe4d354c | 250 | StaticResourcesList m_static_resources; |
ansond | 15:c11dbe4d354c | 251 | DynamicResourcesList m_dynamic_resources; |
ansond | 15:c11dbe4d354c | 252 | ResourceObserversList m_resource_observers; |
ansond | 20:90964c5070e1 | 253 | |
ansond | 20:90964c5070e1 | 254 | // Our Endpoint |
ansond | 20:90964c5070e1 | 255 | void *m_endpoint; |
ansond | 0:1f1f55e73248 | 256 | }; |
ansond | 0:1f1f55e73248 | 257 | |
ansond | 0:1f1f55e73248 | 258 | } // namespace Connector |
ansond | 0:1f1f55e73248 | 259 | |
ansond | 10:3f79b5e67c22 | 260 | #endif // __OPTIONS_H__ |