added max-age and content-format
Fork of mbedConnectorInterface by
api/Options.h@42:20c375e74e8e, 2015-04-11 (annotated)
- Committer:
- ansond
- Date:
- Sat Apr 11 21:14:28 2015 +0000
- Revision:
- 42:20c375e74e8e
- Parent:
- 19:e2cbaeeea509
- Child:
- 48:4b9ee3e32f93
internalized resource observers
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ansond | 0:b438482ebbfc | 1 | /** |
ansond | 0:b438482ebbfc | 2 | * @file Options.h |
ansond | 0:b438482ebbfc | 3 | * @brief mbed CoAP Options (immutable OptionsBuilder instance) class header |
ansond | 0:b438482ebbfc | 4 | * @author Doug Anson/Chris Paola |
ansond | 0:b438482ebbfc | 5 | * @version 1.0 |
sam_grove | 2:853f9ecc12df | 6 | * @see |
ansond | 0:b438482ebbfc | 7 | * |
ansond | 0:b438482ebbfc | 8 | * Copyright (c) 2014 |
ansond | 0:b438482ebbfc | 9 | * |
ansond | 0:b438482ebbfc | 10 | * Licensed under the Apache License, Version 2.0 (the "License"); |
ansond | 0:b438482ebbfc | 11 | * you may not use this file except in compliance with the License. |
ansond | 0:b438482ebbfc | 12 | * You may obtain a copy of the License at |
ansond | 0:b438482ebbfc | 13 | * |
ansond | 0:b438482ebbfc | 14 | * http://www.apache.org/licenses/LICENSE-2.0 |
ansond | 0:b438482ebbfc | 15 | * |
ansond | 0:b438482ebbfc | 16 | * Unless required by applicable law or agreed to in writing, software |
ansond | 0:b438482ebbfc | 17 | * distributed under the License is distributed on an "AS IS" BASIS, |
ansond | 0:b438482ebbfc | 18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
ansond | 0:b438482ebbfc | 19 | * See the License for the specific language governing permissions and |
ansond | 0:b438482ebbfc | 20 | * limitations under the License. |
ansond | 0:b438482ebbfc | 21 | */ |
sam_grove | 2:853f9ecc12df | 22 | |
sam_grove | 2:853f9ecc12df | 23 | #ifndef __OPTIONS_H__ |
sam_grove | 2:853f9ecc12df | 24 | #define __OPTIONS_H__ |
sam_grove | 2:853f9ecc12df | 25 | |
sam_grove | 2:853f9ecc12df | 26 | // Static Resources |
sam_grove | 2:853f9ecc12df | 27 | #include "StaticResource.h" |
sam_grove | 2:853f9ecc12df | 28 | |
sam_grove | 2:853f9ecc12df | 29 | // Dynamic Resources |
sam_grove | 2:853f9ecc12df | 30 | #include "DynamicResource.h" |
sam_grove | 2:853f9ecc12df | 31 | |
sam_grove | 2:853f9ecc12df | 32 | // include the mbed connector resource list |
sam_grove | 2:853f9ecc12df | 33 | #include "mbedConnectorInterface.h" |
sam_grove | 2:853f9ecc12df | 34 | |
ansond | 42:20c375e74e8e | 35 | // determine if we have seen rtos.h yet or not... |
ansond | 42:20c375e74e8e | 36 | #ifdef RTOS_H |
ansond | 42:20c375e74e8e | 37 | // we will use the ThreadedResourceObserver if needed |
ansond | 42:20c375e74e8e | 38 | #define CONNECTOR_USING_THREADS 1 |
ansond | 42:20c375e74e8e | 39 | #endif |
ansond | 42:20c375e74e8e | 40 | |
ansond | 42:20c375e74e8e | 41 | // include the resource observer includes here so that they are not required in main.cpp |
ansond | 42:20c375e74e8e | 42 | #include "ThreadedResourceObserver.h" |
ansond | 42:20c375e74e8e | 43 | #include "TickerResourceObserver.h" |
ansond | 42:20c375e74e8e | 44 | |
sam_grove | 2:853f9ecc12df | 45 | // Vector support |
sam_grove | 2:853f9ecc12df | 46 | #include <vector> |
sam_grove | 2:853f9ecc12df | 47 | |
sam_grove | 2:853f9ecc12df | 48 | // Resources list |
sam_grove | 2:853f9ecc12df | 49 | typedef vector<StaticResource *> StaticResourcesList; |
sam_grove | 2:853f9ecc12df | 50 | typedef vector<DynamicResource *> DynamicResourcesList; |
ansond | 42:20c375e74e8e | 51 | typedef vector<ResourceObserver *> ResourceObserversList; |
sam_grove | 2:853f9ecc12df | 52 | |
ansond | 15:8ada80242804 | 53 | // WiFi Security types |
ansond | 15:8ada80242804 | 54 | typedef enum { |
ansond | 15:8ada80242804 | 55 | WIFI_WPA_PERSONAL, |
ansond | 15:8ada80242804 | 56 | WIFI_WPA2_PERSONAL, |
ansond | 15:8ada80242804 | 57 | WIFI_WEP, |
ansond | 15:8ada80242804 | 58 | WIFI_NUM_TYPES |
ansond | 15:8ada80242804 | 59 | } WiFiAuthTypes; |
ansond | 15:8ada80242804 | 60 | |
sam_grove | 2:853f9ecc12df | 61 | namespace Connector { |
sam_grove | 2:853f9ecc12df | 62 | |
sam_grove | 2:853f9ecc12df | 63 | /** Options class |
sam_grove | 2:853f9ecc12df | 64 | */ |
sam_grove | 2:853f9ecc12df | 65 | class Options |
sam_grove | 2:853f9ecc12df | 66 | { |
sam_grove | 2:853f9ecc12df | 67 | public: |
sam_grove | 2:853f9ecc12df | 68 | /** |
sam_grove | 2:853f9ecc12df | 69 | Default constructor |
sam_grove | 2:853f9ecc12df | 70 | */ |
sam_grove | 2:853f9ecc12df | 71 | Options(); |
sam_grove | 2:853f9ecc12df | 72 | |
sam_grove | 2:853f9ecc12df | 73 | /** |
sam_grove | 2:853f9ecc12df | 74 | Copy constructor |
sam_grove | 2:853f9ecc12df | 75 | */ |
sam_grove | 2:853f9ecc12df | 76 | Options(const Options &opt); |
sam_grove | 2:853f9ecc12df | 77 | |
sam_grove | 2:853f9ecc12df | 78 | /** |
sam_grove | 2:853f9ecc12df | 79 | Destructor |
sam_grove | 2:853f9ecc12df | 80 | */ |
sam_grove | 2:853f9ecc12df | 81 | virtual ~Options(); |
sam_grove | 2:853f9ecc12df | 82 | |
sam_grove | 2:853f9ecc12df | 83 | /** |
sam_grove | 2:853f9ecc12df | 84 | Get the node lifetime |
sam_grove | 2:853f9ecc12df | 85 | */ |
sam_grove | 2:853f9ecc12df | 86 | char *getLifetime(); |
sam_grove | 2:853f9ecc12df | 87 | |
sam_grove | 2:853f9ecc12df | 88 | /** |
sam_grove | 2:853f9ecc12df | 89 | Get the NSP domain |
sam_grove | 2:853f9ecc12df | 90 | */ |
sam_grove | 2:853f9ecc12df | 91 | string getDomain(); |
sam_grove | 2:853f9ecc12df | 92 | |
sam_grove | 2:853f9ecc12df | 93 | /** |
sam_grove | 2:853f9ecc12df | 94 | Get the node name |
sam_grove | 2:853f9ecc12df | 95 | */ |
sam_grove | 2:853f9ecc12df | 96 | string getEndpointNodename(); |
sam_grove | 2:853f9ecc12df | 97 | |
sam_grove | 2:853f9ecc12df | 98 | /** |
sam_grove | 2:853f9ecc12df | 99 | Get the node type |
sam_grove | 2:853f9ecc12df | 100 | */ |
sam_grove | 2:853f9ecc12df | 101 | string getEndpointType(); |
sam_grove | 2:853f9ecc12df | 102 | |
sam_grove | 2:853f9ecc12df | 103 | /** |
sam_grove | 2:853f9ecc12df | 104 | Get the NSP port number |
sam_grove | 2:853f9ecc12df | 105 | */ |
sam_grove | 2:853f9ecc12df | 106 | int getNSPPortNumber(); |
sam_grove | 2:853f9ecc12df | 107 | |
sam_grove | 2:853f9ecc12df | 108 | /** |
sam_grove | 2:853f9ecc12df | 109 | Get the node radio channel list |
sam_grove | 2:853f9ecc12df | 110 | */ |
ansond | 4:84159d67d32d | 111 | uint32_t getRadioChannelList(); |
sam_grove | 2:853f9ecc12df | 112 | |
sam_grove | 2:853f9ecc12df | 113 | /** |
sam_grove | 2:853f9ecc12df | 114 | Get the NSP read update period |
sam_grove | 2:853f9ecc12df | 115 | */ |
sam_grove | 2:853f9ecc12df | 116 | int getReadUpdatePeriod(); |
sam_grove | 2:853f9ecc12df | 117 | |
sam_grove | 2:853f9ecc12df | 118 | /** |
sam_grove | 2:853f9ecc12df | 119 | Get the NSP address |
sam_grove | 2:853f9ecc12df | 120 | */ |
sam_grove | 2:853f9ecc12df | 121 | uint8_t *getNSPAddress(); |
sam_grove | 2:853f9ecc12df | 122 | |
sam_grove | 2:853f9ecc12df | 123 | /** |
sam_grove | 2:853f9ecc12df | 124 | Get the node MAC address |
sam_grove | 2:853f9ecc12df | 125 | */ |
ansond | 4:84159d67d32d | 126 | uint8_t *getMACAddress(); |
sam_grove | 2:853f9ecc12df | 127 | |
sam_grove | 2:853f9ecc12df | 128 | /** |
sam_grove | 2:853f9ecc12df | 129 | Get the list of static resources |
sam_grove | 2:853f9ecc12df | 130 | */ |
sam_grove | 2:853f9ecc12df | 131 | StaticResourcesList *getStaticResourceList(); |
sam_grove | 2:853f9ecc12df | 132 | |
sam_grove | 2:853f9ecc12df | 133 | /** |
sam_grove | 2:853f9ecc12df | 134 | Get the list of dynamic resources |
sam_grove | 2:853f9ecc12df | 135 | */ |
sam_grove | 2:853f9ecc12df | 136 | DynamicResourcesList *getDynamicResourceList(); |
ansond | 15:8ada80242804 | 137 | |
ansond | 15:8ada80242804 | 138 | /** |
ansond | 15:8ada80242804 | 139 | Get the WiFi SSID |
ansond | 15:8ada80242804 | 140 | */ |
ansond | 15:8ada80242804 | 141 | string getWiFiSSID(); |
ansond | 15:8ada80242804 | 142 | |
ansond | 15:8ada80242804 | 143 | /** |
ansond | 15:8ada80242804 | 144 | Get the WiFi Auth Type |
ansond | 15:8ada80242804 | 145 | */ |
ansond | 15:8ada80242804 | 146 | WiFiAuthTypes getWiFiAuthType(); |
ansond | 15:8ada80242804 | 147 | |
ansond | 15:8ada80242804 | 148 | /** |
ansond | 15:8ada80242804 | 149 | Get the WiFi Auth Key |
ansond | 15:8ada80242804 | 150 | */ |
ansond | 15:8ada80242804 | 151 | string getWiFiAuthKey(); |
ansond | 19:e2cbaeeea509 | 152 | |
ansond | 19:e2cbaeeea509 | 153 | /** |
ansond | 19:e2cbaeeea509 | 154 | Get the 802.15.4 Network ID |
ansond | 19:e2cbaeeea509 | 155 | */ |
ansond | 19:e2cbaeeea509 | 156 | string getNetworkID(); |
ansond | 19:e2cbaeeea509 | 157 | |
ansond | 19:e2cbaeeea509 | 158 | /** |
ansond | 19:e2cbaeeea509 | 159 | Get the 802.15.4 Radio channel |
ansond | 19:e2cbaeeea509 | 160 | */ |
ansond | 19:e2cbaeeea509 | 161 | uint8_t getRadioChannel(); |
sam_grove | 2:853f9ecc12df | 162 | |
sam_grove | 2:853f9ecc12df | 163 | protected: |
ansond | 19:e2cbaeeea509 | 164 | // mDS Resources |
sam_grove | 2:853f9ecc12df | 165 | char *m_lifetime; |
sam_grove | 2:853f9ecc12df | 166 | string m_domain; |
sam_grove | 2:853f9ecc12df | 167 | string m_node_name; |
sam_grove | 2:853f9ecc12df | 168 | string m_endpoint_type; |
sam_grove | 2:853f9ecc12df | 169 | int m_rd_update_period; |
sam_grove | 2:853f9ecc12df | 170 | int m_nsp_port; |
sam_grove | 2:853f9ecc12df | 171 | uint8_t m_nsp_address[NSP_IP_ADDRESS_LENGTH]; |
ansond | 15:8ada80242804 | 172 | |
ansond | 15:8ada80242804 | 173 | // WiFi Resources |
ansond | 15:8ada80242804 | 174 | string m_wifi_ssid; |
ansond | 15:8ada80242804 | 175 | string m_wifi_auth_key; |
ansond | 15:8ada80242804 | 176 | WiFiAuthTypes m_wifi_auth_type; |
ansond | 19:e2cbaeeea509 | 177 | |
ansond | 19:e2cbaeeea509 | 178 | // 802.15.4 Resources |
ansond | 19:e2cbaeeea509 | 179 | string m_network_id; |
ansond | 19:e2cbaeeea509 | 180 | uint32_t m_channel_list; |
ansond | 19:e2cbaeeea509 | 181 | uint8_t m_mac_address[NODE_MAC_ADDRESS_LENGTH]; |
ansond | 19:e2cbaeeea509 | 182 | uint8_t m_channel; |
ansond | 19:e2cbaeeea509 | 183 | |
ansond | 19:e2cbaeeea509 | 184 | // Endpoint Resources |
ansond | 42:20c375e74e8e | 185 | StaticResourcesList m_static_resources; |
ansond | 42:20c375e74e8e | 186 | DynamicResourcesList m_dynamic_resources; |
ansond | 42:20c375e74e8e | 187 | ResourceObserversList m_resource_observers; |
sam_grove | 2:853f9ecc12df | 188 | }; |
sam_grove | 2:853f9ecc12df | 189 | |
sam_grove | 2:853f9ecc12df | 190 | } // namespace Connector |
sam_grove | 2:853f9ecc12df | 191 | |
sam_grove | 2:853f9ecc12df | 192 | #endif // __OPTIONS_H__ |