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/OptionsBuilder.h@0:1f1f55e73248, 2016-02-19 (annotated)
- Committer:
- ansond
- Date:
- Fri Feb 19 17:32:14 2016 +0000
- Revision:
- 0:1f1f55e73248
- Child:
- 8:f950fb1b78c0
initial checkin
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ansond | 0:1f1f55e73248 | 1 | /** |
ansond | 0:1f1f55e73248 | 2 | * @file OptionsBuilder.h |
ansond | 0:1f1f55e73248 | 3 | * @brief mbed CoAP OptionsBuilder 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_BUILDER_H__ |
ansond | 0:1f1f55e73248 | 24 | #define __OPTIONS_BUILDER_H__ |
ansond | 0:1f1f55e73248 | 25 | |
ansond | 0:1f1f55e73248 | 26 | // base class support |
ansond | 0:1f1f55e73248 | 27 | #include "mbed-connector-interface/Options.h" |
ansond | 0:1f1f55e73248 | 28 | |
ansond | 0:1f1f55e73248 | 29 | // Connector namespace |
ansond | 0:1f1f55e73248 | 30 | namespace Connector { |
ansond | 0:1f1f55e73248 | 31 | |
ansond | 0:1f1f55e73248 | 32 | /** OptionsBuilder class |
ansond | 0:1f1f55e73248 | 33 | */ |
ansond | 0:1f1f55e73248 | 34 | class OptionsBuilder : Options |
ansond | 0:1f1f55e73248 | 35 | { |
ansond | 0:1f1f55e73248 | 36 | public: |
ansond | 0:1f1f55e73248 | 37 | /** |
ansond | 0:1f1f55e73248 | 38 | Default Constructor |
ansond | 0:1f1f55e73248 | 39 | */ |
ansond | 0:1f1f55e73248 | 40 | OptionsBuilder(); |
ansond | 0:1f1f55e73248 | 41 | |
ansond | 0:1f1f55e73248 | 42 | /** |
ansond | 0:1f1f55e73248 | 43 | Copy Constructor |
ansond | 0:1f1f55e73248 | 44 | @param ob input options builder instance to deep copy |
ansond | 0:1f1f55e73248 | 45 | */ |
ansond | 0:1f1f55e73248 | 46 | OptionsBuilder(const OptionsBuilder &ob); |
ansond | 0:1f1f55e73248 | 47 | |
ansond | 0:1f1f55e73248 | 48 | /** |
ansond | 0:1f1f55e73248 | 49 | Destructor |
ansond | 0:1f1f55e73248 | 50 | */ |
ansond | 0:1f1f55e73248 | 51 | virtual ~OptionsBuilder(); |
ansond | 0:1f1f55e73248 | 52 | |
ansond | 0:1f1f55e73248 | 53 | /** |
ansond | 0:1f1f55e73248 | 54 | Set the NSDL Endpoint Lifetime |
ansond | 0:1f1f55e73248 | 55 | @param lifetime input the NSDL endpoint lifetime (seconds) |
ansond | 0:1f1f55e73248 | 56 | @return instance to ourself |
ansond | 0:1f1f55e73248 | 57 | */ |
ansond | 0:1f1f55e73248 | 58 | OptionsBuilder &setLifetime(int lifetime); |
ansond | 0:1f1f55e73248 | 59 | |
ansond | 0:1f1f55e73248 | 60 | /** |
ansond | 0:1f1f55e73248 | 61 | Set the NSDL Domain |
ansond | 0:1f1f55e73248 | 62 | @param domain input the NSDL domain to set |
ansond | 0:1f1f55e73248 | 63 | @return instance to ourself |
ansond | 0:1f1f55e73248 | 64 | */ |
ansond | 0:1f1f55e73248 | 65 | OptionsBuilder &setDomain(const char *domain); |
ansond | 0:1f1f55e73248 | 66 | |
ansond | 0:1f1f55e73248 | 67 | /** |
ansond | 0:1f1f55e73248 | 68 | Set the Endpoint Node Name |
ansond | 0:1f1f55e73248 | 69 | @param node_name input the node endpoint name |
ansond | 0:1f1f55e73248 | 70 | @return instance to ourself |
ansond | 0:1f1f55e73248 | 71 | */ |
ansond | 0:1f1f55e73248 | 72 | OptionsBuilder &setEndpointNodename(const char *node_name); |
ansond | 0:1f1f55e73248 | 73 | |
ansond | 0:1f1f55e73248 | 74 | /** |
ansond | 0:1f1f55e73248 | 75 | Set the NSDL Endpoint Type |
ansond | 0:1f1f55e73248 | 76 | @param endpoint_type input the NSDL endpoint type |
ansond | 0:1f1f55e73248 | 77 | @return instance to ourself |
ansond | 0:1f1f55e73248 | 78 | */ |
ansond | 0:1f1f55e73248 | 79 | OptionsBuilder &setEndpointType(const char *endpoint_type); |
ansond | 0:1f1f55e73248 | 80 | |
ansond | 0:1f1f55e73248 | 81 | /** |
ansond | 0:1f1f55e73248 | 82 | Set the underlying radio stack channel list |
ansond | 0:1f1f55e73248 | 83 | @param channel_list input the radio channel list |
ansond | 0:1f1f55e73248 | 84 | @return instance to ourself |
ansond | 0:1f1f55e73248 | 85 | */ |
ansond | 0:1f1f55e73248 | 86 | OptionsBuilder &setRadioChannelList(const uint32_t channel_list); |
ansond | 0:1f1f55e73248 | 87 | |
ansond | 0:1f1f55e73248 | 88 | /** |
ansond | 0:1f1f55e73248 | 89 | Set the mbed Registration Update Period |
ansond | 0:1f1f55e73248 | 90 | @param rd_update_period_ms input the NSDL read update period (in ms) |
ansond | 0:1f1f55e73248 | 91 | @return instance to ourself |
ansond | 0:1f1f55e73248 | 92 | */ |
ansond | 0:1f1f55e73248 | 93 | OptionsBuilder &setRegUpdatePeriod(const int reg_update_period_ms); |
ansond | 0:1f1f55e73248 | 94 | |
ansond | 0:1f1f55e73248 | 95 | /** |
ansond | 0:1f1f55e73248 | 96 | Set the Connector URL |
ansond | 0:1f1f55e73248 | 97 | @param url input the Connector URL |
ansond | 0:1f1f55e73248 | 98 | @return instance to ourself |
ansond | 0:1f1f55e73248 | 99 | */ |
ansond | 0:1f1f55e73248 | 100 | OptionsBuilder &setConnectorURL(const char *connector_url); |
ansond | 0:1f1f55e73248 | 101 | |
ansond | 0:1f1f55e73248 | 102 | /** |
ansond | 0:1f1f55e73248 | 103 | Set the MAC address |
ansond | 0:1f1f55e73248 | 104 | @param mac_address input the MAC address buffer |
ansond | 0:1f1f55e73248 | 105 | @param mac_address_length input the MAC address buffer length |
ansond | 0:1f1f55e73248 | 106 | @return instance to ourself |
ansond | 0:1f1f55e73248 | 107 | */ |
ansond | 0:1f1f55e73248 | 108 | OptionsBuilder &setMACAddress(const uint8_t *mac_address,const int mac_address_length = NODE_MAC_ADDRESS_LENGTH); |
ansond | 0:1f1f55e73248 | 109 | |
ansond | 0:1f1f55e73248 | 110 | /** |
ansond | 0:1f1f55e73248 | 111 | Add a NSDL device resource (static) |
ansond | 0:1f1f55e73248 | 112 | @param device_resource input the NSDL device resource |
ansond | 0:1f1f55e73248 | 113 | @return instance to ourself |
ansond | 0:1f1f55e73248 | 114 | */ |
ansond | 0:1f1f55e73248 | 115 | OptionsBuilder &addResource(const DeviceResource *device_resource); |
ansond | 0:1f1f55e73248 | 116 | |
ansond | 0:1f1f55e73248 | 117 | /** |
ansond | 0:1f1f55e73248 | 118 | Add a NSDL endpoint resource (static) |
ansond | 0:1f1f55e73248 | 119 | @param static_resource input the NSDL static resource |
ansond | 0:1f1f55e73248 | 120 | @return instance to ourself |
ansond | 0:1f1f55e73248 | 121 | */ |
ansond | 0:1f1f55e73248 | 122 | OptionsBuilder &addResource(const StaticResource *static_resource); |
ansond | 0:1f1f55e73248 | 123 | |
ansond | 0:1f1f55e73248 | 124 | /** |
ansond | 0:1f1f55e73248 | 125 | Add a NSDL endpoint resource (dynamic) |
ansond | 0:1f1f55e73248 | 126 | @param dynamic_resource input the NSDL dynamic resource |
ansond | 0:1f1f55e73248 | 127 | */ |
ansond | 0:1f1f55e73248 | 128 | OptionsBuilder &addResource(const DynamicResource *dynamic_resource); |
ansond | 0:1f1f55e73248 | 129 | |
ansond | 0:1f1f55e73248 | 130 | /** |
ansond | 0:1f1f55e73248 | 131 | Add a NSDL endpoint resource (dynamic) |
ansond | 0:1f1f55e73248 | 132 | @param dynamic_resource input the NSDL dynamic resource |
ansond | 0:1f1f55e73248 | 133 | @param use_observer input if true, use an appropriate ResourceObserver to observer. if false, the underlying resource will handle it |
ansond | 0:1f1f55e73248 | 134 | @return instance to ourself |
ansond | 0:1f1f55e73248 | 135 | */ |
ansond | 0:1f1f55e73248 | 136 | OptionsBuilder &addResource(const DynamicResource *dynamic_resource,const bool use_observer); |
ansond | 0:1f1f55e73248 | 137 | |
ansond | 0:1f1f55e73248 | 138 | /** |
ansond | 0:1f1f55e73248 | 139 | Add a NSDL endpoint resource (dynamic) |
ansond | 0:1f1f55e73248 | 140 | @param dynamic_resource input the NSDL dynamic resource |
ansond | 0:1f1f55e73248 | 141 | @param sleep_time input the observation sleep time in milliseconds (for observable resource only) |
ansond | 0:1f1f55e73248 | 142 | @return instance to ourself |
ansond | 0:1f1f55e73248 | 143 | */ |
ansond | 0:1f1f55e73248 | 144 | OptionsBuilder &addResource(const DynamicResource *dynamic_resource,const int sleep_time); |
ansond | 0:1f1f55e73248 | 145 | |
ansond | 0:1f1f55e73248 | 146 | /** |
ansond | 0:1f1f55e73248 | 147 | Add a NSDL endpoint resource (dynamic) |
ansond | 0:1f1f55e73248 | 148 | @param dynamic_resource input the NSDL dynamic resource |
ansond | 0:1f1f55e73248 | 149 | @param sleep_time input the observation sleep time in milliseconds (for observable resource only) |
ansond | 0:1f1f55e73248 | 150 | @param use_observer input if true, use an appropriate ResourceObserver to observer. if false, the underlying resource will handle it |
ansond | 0:1f1f55e73248 | 151 | @return instance to ourself |
ansond | 0:1f1f55e73248 | 152 | */ |
ansond | 0:1f1f55e73248 | 153 | OptionsBuilder &addResource(const DynamicResource *dynamic_resource,const int sleep_time,const bool use_observer); |
ansond | 0:1f1f55e73248 | 154 | |
ansond | 0:1f1f55e73248 | 155 | /** |
ansond | 0:1f1f55e73248 | 156 | Set the WiFi SSID |
ansond | 0:1f1f55e73248 | 157 | @param ssid input the WiFi SSID |
ansond | 0:1f1f55e73248 | 158 | */ |
ansond | 0:1f1f55e73248 | 159 | OptionsBuilder &setWiFiSSID(char *ssid); |
ansond | 0:1f1f55e73248 | 160 | |
ansond | 0:1f1f55e73248 | 161 | /** |
ansond | 0:1f1f55e73248 | 162 | Set the WiFi AuthType |
ansond | 0:1f1f55e73248 | 163 | @param auth_type input the WiFi AuthType |
ansond | 0:1f1f55e73248 | 164 | */ |
ansond | 0:1f1f55e73248 | 165 | OptionsBuilder &setWiFiAuthType(WiFiAuthTypes auth_type); |
ansond | 0:1f1f55e73248 | 166 | |
ansond | 0:1f1f55e73248 | 167 | /** |
ansond | 0:1f1f55e73248 | 168 | Set the WiFi AuthKey |
ansond | 0:1f1f55e73248 | 169 | @param auth_key input the WiFi AuthKey |
ansond | 0:1f1f55e73248 | 170 | */ |
ansond | 0:1f1f55e73248 | 171 | OptionsBuilder &setWiFiAuthKey(char *auth_key); |
ansond | 0:1f1f55e73248 | 172 | |
ansond | 0:1f1f55e73248 | 173 | /** |
ansond | 0:1f1f55e73248 | 174 | Set the 802.15.4 Network ID |
ansond | 0:1f1f55e73248 | 175 | @param network_id input the 802.15.4 mesh Network ID |
ansond | 0:1f1f55e73248 | 176 | */ |
ansond | 0:1f1f55e73248 | 177 | OptionsBuilder &setNetworkID(char *network_id); |
ansond | 0:1f1f55e73248 | 178 | |
ansond | 0:1f1f55e73248 | 179 | /** |
ansond | 0:1f1f55e73248 | 180 | Set the 802.15.4 Radio Channel |
ansond | 0:1f1f55e73248 | 181 | @param channel input the 802.15.4 radio channel |
ansond | 0:1f1f55e73248 | 182 | */ |
ansond | 0:1f1f55e73248 | 183 | OptionsBuilder &setRadioChannel(int channel); |
ansond | 0:1f1f55e73248 | 184 | |
ansond | 0:1f1f55e73248 | 185 | /** |
ansond | 0:1f1f55e73248 | 186 | Enable/Disable immediate observationing |
ansond | 0:1f1f55e73248 | 187 | @param enable input enable immediate observationing without GET |
ansond | 0:1f1f55e73248 | 188 | */ |
ansond | 0:1f1f55e73248 | 189 | OptionsBuilder &setImmedateObservationEnabled(bool enable); |
ansond | 0:1f1f55e73248 | 190 | |
ansond | 0:1f1f55e73248 | 191 | /** |
ansond | 0:1f1f55e73248 | 192 | Enable/Disable GET-based control of observations |
ansond | 0:1f1f55e73248 | 193 | @param enable input enable GET-based observation enable/disable control |
ansond | 0:1f1f55e73248 | 194 | */ |
ansond | 0:1f1f55e73248 | 195 | OptionsBuilder &setEnableGETObservationControl(bool enable); |
ansond | 0:1f1f55e73248 | 196 | |
ansond | 0:1f1f55e73248 | 197 | /** |
ansond | 0:1f1f55e73248 | 198 | Set the Server Certificate |
ansond | 0:1f1f55e73248 | 199 | @param cert input the server certificate |
ansond | 0:1f1f55e73248 | 200 | @param cert_size input the length of the server certificate |
ansond | 0:1f1f55e73248 | 201 | */ |
ansond | 0:1f1f55e73248 | 202 | OptionsBuilder &setServerCertificate(uint8_t cert[],int cert_size); |
ansond | 0:1f1f55e73248 | 203 | |
ansond | 0:1f1f55e73248 | 204 | /** |
ansond | 0:1f1f55e73248 | 205 | Set the Client Certificate |
ansond | 0:1f1f55e73248 | 206 | @param cert input the client certificate |
ansond | 0:1f1f55e73248 | 207 | @param cert_size input the length of the client certificate |
ansond | 0:1f1f55e73248 | 208 | */ |
ansond | 0:1f1f55e73248 | 209 | OptionsBuilder &setClientCertificate(uint8_t cert[],int cert_size); |
ansond | 0:1f1f55e73248 | 210 | |
ansond | 0:1f1f55e73248 | 211 | /** |
ansond | 0:1f1f55e73248 | 212 | Set the Client Key |
ansond | 0:1f1f55e73248 | 213 | @param key input the client key |
ansond | 0:1f1f55e73248 | 214 | @param key_size input the length of the client key |
ansond | 0:1f1f55e73248 | 215 | */ |
ansond | 0:1f1f55e73248 | 216 | OptionsBuilder &setClientKey(uint8_t key[],int key_size); |
ansond | 0:1f1f55e73248 | 217 | |
ansond | 0:1f1f55e73248 | 218 | /** |
ansond | 0:1f1f55e73248 | 219 | Build our our immutable self |
ansond | 0:1f1f55e73248 | 220 | */ |
ansond | 0:1f1f55e73248 | 221 | Options *build(); |
ansond | 0:1f1f55e73248 | 222 | |
ansond | 0:1f1f55e73248 | 223 | }; |
ansond | 0:1f1f55e73248 | 224 | |
ansond | 0:1f1f55e73248 | 225 | } // namespace Connector |
ansond | 0:1f1f55e73248 | 226 | |
ansond | 0:1f1f55e73248 | 227 | #endif // __OPTIONS_BUILDER_H__ |
ansond | 0:1f1f55e73248 | 228 |