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.
Dependents: IoT_LED_demo ServoTest uWater_Project hackathon ... more
api/OptionsBuilder.h@46:cc6076ac5026, 2015-04-12 (annotated)
- Committer:
- ansond
- Date:
- Sun Apr 12 03:48:37 2015 +0000
- Revision:
- 46:cc6076ac5026
- Parent:
- 45:65351ebb7c42
- Child:
- 47:e75750ddc413
updates for observationing
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| ansond | 0:b438482ebbfc | 1 | /** | 
| ansond | 0:b438482ebbfc | 2 | * @file OptionsBuilder.h | 
| ansond | 0:b438482ebbfc | 3 | * @brief mbed CoAP OptionsBuilder 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_BUILDER_H__ | 
| sam_grove | 2:853f9ecc12df | 24 | #define __OPTIONS_BUILDER_H__ | 
| sam_grove | 2:853f9ecc12df | 25 | |
| sam_grove | 2:853f9ecc12df | 26 | // base class support | 
| sam_grove | 2:853f9ecc12df | 27 | #include "Options.h" | 
| sam_grove | 2:853f9ecc12df | 28 | |
| sam_grove | 2:853f9ecc12df | 29 | // Connector namespace | 
| sam_grove | 2:853f9ecc12df | 30 | namespace Connector { | 
| sam_grove | 2:853f9ecc12df | 31 | |
| sam_grove | 2:853f9ecc12df | 32 | /** OptionsBuilder class | 
| sam_grove | 2:853f9ecc12df | 33 | */ | 
| sam_grove | 2:853f9ecc12df | 34 | class OptionsBuilder : Options | 
| sam_grove | 2:853f9ecc12df | 35 | { | 
| sam_grove | 2:853f9ecc12df | 36 | public: | 
| sam_grove | 2:853f9ecc12df | 37 | /** | 
| sam_grove | 2:853f9ecc12df | 38 | Default Constructor | 
| sam_grove | 2:853f9ecc12df | 39 | */ | 
| sam_grove | 2:853f9ecc12df | 40 | OptionsBuilder(); | 
| sam_grove | 2:853f9ecc12df | 41 | |
| sam_grove | 2:853f9ecc12df | 42 | /** | 
| sam_grove | 2:853f9ecc12df | 43 | Copy Constructor | 
| sam_grove | 2:853f9ecc12df | 44 | @param ob input options builder instance to deep copy | 
| sam_grove | 2:853f9ecc12df | 45 | */ | 
| sam_grove | 2:853f9ecc12df | 46 | OptionsBuilder(const OptionsBuilder &ob); | 
| sam_grove | 2:853f9ecc12df | 47 | |
| sam_grove | 2:853f9ecc12df | 48 | /** | 
| sam_grove | 2:853f9ecc12df | 49 | Destructor | 
| sam_grove | 2:853f9ecc12df | 50 | */ | 
| sam_grove | 2:853f9ecc12df | 51 | virtual ~OptionsBuilder(); | 
| sam_grove | 2:853f9ecc12df | 52 | |
| sam_grove | 2:853f9ecc12df | 53 | /** | 
| sam_grove | 2:853f9ecc12df | 54 | Set the NSDL Endpoint Lifetime | 
| sam_grove | 2:853f9ecc12df | 55 | @param lifetime input the NSDL endpoint lifetime (seconds) | 
| sam_grove | 2:853f9ecc12df | 56 | @return instance to ourself | 
| sam_grove | 2:853f9ecc12df | 57 | */ | 
| sam_grove | 2:853f9ecc12df | 58 | OptionsBuilder &setLifetime(const char *lifetime); | 
| sam_grove | 2:853f9ecc12df | 59 | |
| sam_grove | 2:853f9ecc12df | 60 | /** | 
| sam_grove | 2:853f9ecc12df | 61 | Set the NSDL Domain | 
| sam_grove | 2:853f9ecc12df | 62 | @param domain input the NSDL domain to set | 
| sam_grove | 2:853f9ecc12df | 63 | @return instance to ourself | 
| sam_grove | 2:853f9ecc12df | 64 | */ | 
| sam_grove | 2:853f9ecc12df | 65 | OptionsBuilder &setDomain(const char *domain); | 
| sam_grove | 2:853f9ecc12df | 66 | |
| sam_grove | 2:853f9ecc12df | 67 | /** | 
| sam_grove | 2:853f9ecc12df | 68 | Set the Endpoint Node Name | 
| sam_grove | 2:853f9ecc12df | 69 | @param node_name input the node endpoint name | 
| sam_grove | 2:853f9ecc12df | 70 | @return instance to ourself | 
| sam_grove | 2:853f9ecc12df | 71 | */ | 
| sam_grove | 2:853f9ecc12df | 72 | OptionsBuilder &setEndpointNodename(const char *node_name); | 
| sam_grove | 2:853f9ecc12df | 73 | |
| sam_grove | 2:853f9ecc12df | 74 | /** | 
| sam_grove | 2:853f9ecc12df | 75 | Set the NSDL Endpoint Type | 
| sam_grove | 2:853f9ecc12df | 76 | @param endpoint_type input the NSDL endpoint type | 
| sam_grove | 2:853f9ecc12df | 77 | @return instance to ourself | 
| sam_grove | 2:853f9ecc12df | 78 | */ | 
| sam_grove | 2:853f9ecc12df | 79 | OptionsBuilder &setEndpointType(const char *endpoint_type); | 
| sam_grove | 2:853f9ecc12df | 80 | |
| sam_grove | 2:853f9ecc12df | 81 | /** | 
| sam_grove | 2:853f9ecc12df | 82 | Set the NSDL Port Number | 
| sam_grove | 2:853f9ecc12df | 83 | @param port_num input the NSDL port number | 
| sam_grove | 2:853f9ecc12df | 84 | @return instance to ourself | 
| sam_grove | 2:853f9ecc12df | 85 | */ | 
| sam_grove | 2:853f9ecc12df | 86 | OptionsBuilder &setNSPPortNumber(const int port_num); | 
| sam_grove | 2:853f9ecc12df | 87 | |
| sam_grove | 2:853f9ecc12df | 88 | /** | 
| sam_grove | 2:853f9ecc12df | 89 | Set the underlying radio stack channel list | 
| sam_grove | 2:853f9ecc12df | 90 | @param channel_list input the radio channel list | 
| sam_grove | 2:853f9ecc12df | 91 | @return instance to ourself | 
| sam_grove | 2:853f9ecc12df | 92 | */ | 
| sam_grove | 2:853f9ecc12df | 93 | OptionsBuilder &setRadioChannelList(const uint32_t channel_list); | 
| sam_grove | 2:853f9ecc12df | 94 | |
| sam_grove | 2:853f9ecc12df | 95 | /** | 
| sam_grove | 2:853f9ecc12df | 96 | Set the NSDL Read Update Period | 
| sam_grove | 2:853f9ecc12df | 97 | @param rd_update_period_ms input the NSDL read update period (in ms) | 
| sam_grove | 2:853f9ecc12df | 98 | @return instance to ourself | 
| sam_grove | 2:853f9ecc12df | 99 | */ | 
| sam_grove | 2:853f9ecc12df | 100 | OptionsBuilder &setReadUpdatePeriod(const int rd_update_period_ms); | 
| sam_grove | 2:853f9ecc12df | 101 | |
| sam_grove | 2:853f9ecc12df | 102 | /** | 
| sam_grove | 2:853f9ecc12df | 103 | Set the NSP IPv6 Address | 
| sam_grove | 2:853f9ecc12df | 104 | @param nsp_address input the NSP IPv6 address | 
| sam_grove | 2:853f9ecc12df | 105 | @param nsp_address_length input the length of the NSP IPv6 address buffer | 
| sam_grove | 2:853f9ecc12df | 106 | @return instance to ourself | 
| sam_grove | 2:853f9ecc12df | 107 | */ | 
| ansond | 3:11b2f4e58378 | 108 | OptionsBuilder &setNSPAddress(const uint8_t *nsp_address,const int nsp_address_length = NSP_IP_ADDRESS_LENGTH); | 
| sam_grove | 2:853f9ecc12df | 109 | |
| sam_grove | 2:853f9ecc12df | 110 | /** | 
| sam_grove | 2:853f9ecc12df | 111 | Set the MAC address | 
| sam_grove | 2:853f9ecc12df | 112 | @param mac_address input the MAC address buffer | 
| sam_grove | 2:853f9ecc12df | 113 | @param mac_address_length input the MAC address buffer length | 
| sam_grove | 2:853f9ecc12df | 114 | @return instance to ourself | 
| sam_grove | 2:853f9ecc12df | 115 | */ | 
| ansond | 3:11b2f4e58378 | 116 | OptionsBuilder &setMACAddress(const uint8_t *mac_address,const int mac_address_length = NODE_MAC_ADDRESS_LENGTH); | 
| sam_grove | 2:853f9ecc12df | 117 | |
| sam_grove | 2:853f9ecc12df | 118 | /** | 
| sam_grove | 2:853f9ecc12df | 119 | Add a NSDL endpoint resource (static) | 
| sam_grove | 2:853f9ecc12df | 120 | @param static_resource input the NSDL static resource | 
| sam_grove | 2:853f9ecc12df | 121 | @return instance to ourself | 
| sam_grove | 2:853f9ecc12df | 122 | */ | 
| sam_grove | 2:853f9ecc12df | 123 | OptionsBuilder &addResource(const StaticResource *static_resource); | 
| ansond | 46:cc6076ac5026 | 124 | |
| ansond | 46:cc6076ac5026 | 125 | /** | 
| ansond | 46:cc6076ac5026 | 126 | Add a NSDL endpoint resource (dynamic) | 
| ansond | 46:cc6076ac5026 | 127 | @param dynamic_resource input the NSDL dynamic resource | 
| ansond | 46:cc6076ac5026 | 128 | */ | 
| ansond | 46:cc6076ac5026 | 129 | OptionsBuilder &addResource(const DynamicResource *dynamic_resource); | 
| ansond | 46:cc6076ac5026 | 130 | |
| sam_grove | 2:853f9ecc12df | 131 | /** | 
| sam_grove | 2:853f9ecc12df | 132 | Add a NSDL endpoint resource (dynamic) | 
| sam_grove | 2:853f9ecc12df | 133 | @param dynamic_resource input the NSDL dynamic resource | 
| ansond | 45:65351ebb7c42 | 134 | @param use_observer input if true, use an appropriate ResourceObserver to observer. if false, the underlying resource will handle it | 
| ansond | 45:65351ebb7c42 | 135 | @return instance to ourself | 
| ansond | 45:65351ebb7c42 | 136 | */ | 
| ansond | 46:cc6076ac5026 | 137 | OptionsBuilder &addResource(const DynamicResource *dynamic_resource,const bool use_observer); | 
| ansond | 45:65351ebb7c42 | 138 | |
| ansond | 45:65351ebb7c42 | 139 | /** | 
| ansond | 45:65351ebb7c42 | 140 | Add a NSDL endpoint resource (dynamic) | 
| ansond | 45:65351ebb7c42 | 141 | @param dynamic_resource input the NSDL dynamic resource | 
| ansond | 42:20c375e74e8e | 142 | @param sleep_time input the observation sleep time in milliseconds (for observable resource only) | 
| ansond | 42:20c375e74e8e | 143 | @param use_observer input if true, use an appropriate ResourceObserver to observer. if false, the underlying resource will handle it | 
| sam_grove | 2:853f9ecc12df | 144 | @return instance to ourself | 
| sam_grove | 2:853f9ecc12df | 145 | */ | 
| ansond | 46:cc6076ac5026 | 146 | OptionsBuilder &addResource(const DynamicResource *dynamic_resource,const int sleep_time,const bool use_observer); | 
| sam_grove | 2:853f9ecc12df | 147 | |
| sam_grove | 2:853f9ecc12df | 148 | /** | 
| ansond | 15:8ada80242804 | 149 | Set the WiFi SSID | 
| ansond | 15:8ada80242804 | 150 | @param ssid input the WiFi SSID | 
| ansond | 15:8ada80242804 | 151 | */ | 
| ansond | 15:8ada80242804 | 152 | OptionsBuilder &setWiFiSSID(char *ssid); | 
| ansond | 15:8ada80242804 | 153 | |
| ansond | 15:8ada80242804 | 154 | /** | 
| ansond | 15:8ada80242804 | 155 | Set the WiFi AuthType | 
| ansond | 15:8ada80242804 | 156 | @param auth_type input the WiFi AuthType | 
| ansond | 15:8ada80242804 | 157 | */ | 
| ansond | 15:8ada80242804 | 158 | OptionsBuilder &setWiFiAuthType(WiFiAuthTypes auth_type); | 
| ansond | 15:8ada80242804 | 159 | |
| ansond | 15:8ada80242804 | 160 | /** | 
| ansond | 15:8ada80242804 | 161 | Set the WiFi AuthKey | 
| ansond | 15:8ada80242804 | 162 | @param auth_key input the WiFi AuthKey | 
| ansond | 15:8ada80242804 | 163 | */ | 
| ansond | 15:8ada80242804 | 164 | OptionsBuilder &setWiFiAuthKey(char *auth_key); | 
| ansond | 15:8ada80242804 | 165 | |
| ansond | 15:8ada80242804 | 166 | /** | 
| ansond | 19:e2cbaeeea509 | 167 | Set the 802.15.4 Network ID | 
| ansond | 19:e2cbaeeea509 | 168 | @param network_id input the 802.15.4 mesh Network ID | 
| ansond | 19:e2cbaeeea509 | 169 | */ | 
| ansond | 19:e2cbaeeea509 | 170 | OptionsBuilder &setNetworkID(char *network_id); | 
| ansond | 19:e2cbaeeea509 | 171 | |
| ansond | 19:e2cbaeeea509 | 172 | /** | 
| ansond | 19:e2cbaeeea509 | 173 | Set the 802.15.4 Radio Channel | 
| ansond | 19:e2cbaeeea509 | 174 | @param channel input the 802.15.4 radio channel | 
| ansond | 19:e2cbaeeea509 | 175 | */ | 
| ansond | 19:e2cbaeeea509 | 176 | OptionsBuilder &setRadioChannel(int channel); | 
| ansond | 19:e2cbaeeea509 | 177 | |
| ansond | 19:e2cbaeeea509 | 178 | /** | 
| sam_grove | 2:853f9ecc12df | 179 | Build our our immutable self | 
| sam_grove | 2:853f9ecc12df | 180 | */ | 
| sam_grove | 2:853f9ecc12df | 181 | Options *build(); | 
| sam_grove | 2:853f9ecc12df | 182 | |
| sam_grove | 2:853f9ecc12df | 183 | }; | 
| sam_grove | 2:853f9ecc12df | 184 | |
| sam_grove | 2:853f9ecc12df | 185 | } // namespace Connector | 
| sam_grove | 2:853f9ecc12df | 186 | |
| sam_grove | 2:853f9ecc12df | 187 | #endif // __OPTIONS_BUILDER_H__ | 
