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@9:faa43faea4ca, 2016-02-24 (annotated)
- Committer:
- ansond
- Date:
- Wed Feb 24 14:50:03 2016 +0000
- Revision:
- 9:faa43faea4ca
- Parent:
- 8:f950fb1b78c0
- Child:
- 10:3f79b5e67c22
updates
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ansond | 8:f950fb1b78c0 | 1 | /** |
ansond | 8:f950fb1b78c0 | 2 | * @file OptionsBuilder.h |
ansond | 8:f950fb1b78c0 | 3 | * @brief mbed CoAP OptionsBuilder class header |
ansond | 8:f950fb1b78c0 | 4 | * @author Doug Anson/Chris Paola |
ansond | 8:f950fb1b78c0 | 5 | * @version 1.0 |
ansond | 8:f950fb1b78c0 | 6 | * @see |
ansond | 8:f950fb1b78c0 | 7 | * |
ansond | 8:f950fb1b78c0 | 8 | * Copyright (c) 2014 |
ansond | 8:f950fb1b78c0 | 9 | * |
ansond | 8:f950fb1b78c0 | 10 | * Licensed under the Apache License, Version 2.0 (the "License"); |
ansond | 8:f950fb1b78c0 | 11 | * you may not use this file except in compliance with the License. |
ansond | 8:f950fb1b78c0 | 12 | * You may obtain a copy of the License at |
ansond | 8:f950fb1b78c0 | 13 | * |
ansond | 8:f950fb1b78c0 | 14 | * http://www.apache.org/licenses/LICENSE-2.0 |
ansond | 8:f950fb1b78c0 | 15 | * |
ansond | 8:f950fb1b78c0 | 16 | * Unless required by applicable law or agreed to in writing, software |
ansond | 8:f950fb1b78c0 | 17 | * distributed under the License is distributed on an "AS IS" BASIS, |
ansond | 8:f950fb1b78c0 | 18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
ansond | 8:f950fb1b78c0 | 19 | * See the License for the specific language governing permissions and |
ansond | 8:f950fb1b78c0 | 20 | * limitations under the License. |
ansond | 8:f950fb1b78c0 | 21 | */ |
ansond | 8:f950fb1b78c0 | 22 | |
ansond | 8:f950fb1b78c0 | 23 | #ifndef __OPTIONS_BUILDER_H__ |
ansond | 8:f950fb1b78c0 | 24 | #define __OPTIONS_BUILDER_H__ |
ansond | 8:f950fb1b78c0 | 25 | |
ansond | 8:f950fb1b78c0 | 26 | // base class support |
ansond | 8:f950fb1b78c0 | 27 | #include "mbed-connector-interface/Options.h" |
ansond | 8:f950fb1b78c0 | 28 | |
ansond | 8:f950fb1b78c0 | 29 | // Connector namespace |
ansond | 8:f950fb1b78c0 | 30 | namespace Connector { |
ansond | 8:f950fb1b78c0 | 31 | |
ansond | 8:f950fb1b78c0 | 32 | /** OptionsBuilder class |
ansond | 8:f950fb1b78c0 | 33 | */ |
ansond | 8:f950fb1b78c0 | 34 | class OptionsBuilder : Options |
ansond | 8:f950fb1b78c0 | 35 | { |
ansond | 8:f950fb1b78c0 | 36 | public: |
ansond | 8:f950fb1b78c0 | 37 | /** |
ansond | 8:f950fb1b78c0 | 38 | Default Constructor |
ansond | 8:f950fb1b78c0 | 39 | */ |
ansond | 8:f950fb1b78c0 | 40 | OptionsBuilder(); |
ansond | 8:f950fb1b78c0 | 41 | |
ansond | 8:f950fb1b78c0 | 42 | /** |
ansond | 8:f950fb1b78c0 | 43 | Copy Constructor |
ansond | 8:f950fb1b78c0 | 44 | @param ob input options builder instance to deep copy |
ansond | 8:f950fb1b78c0 | 45 | */ |
ansond | 8:f950fb1b78c0 | 46 | OptionsBuilder(const OptionsBuilder &ob); |
ansond | 8:f950fb1b78c0 | 47 | |
ansond | 8:f950fb1b78c0 | 48 | /** |
ansond | 8:f950fb1b78c0 | 49 | Destructor |
ansond | 8:f950fb1b78c0 | 50 | */ |
ansond | 8:f950fb1b78c0 | 51 | virtual ~OptionsBuilder(); |
ansond | 8:f950fb1b78c0 | 52 | |
ansond | 8:f950fb1b78c0 | 53 | /** |
ansond | 8:f950fb1b78c0 | 54 | Set the NSDL Endpoint Lifetime |
ansond | 8:f950fb1b78c0 | 55 | @param lifetime input the NSDL endpoint lifetime (seconds) |
ansond | 8:f950fb1b78c0 | 56 | @return instance to ourself |
ansond | 8:f950fb1b78c0 | 57 | */ |
ansond | 8:f950fb1b78c0 | 58 | OptionsBuilder &setLifetime(int lifetime); |
ansond | 8:f950fb1b78c0 | 59 | |
ansond | 8:f950fb1b78c0 | 60 | /** |
ansond | 8:f950fb1b78c0 | 61 | Set the NSDL Domain |
ansond | 8:f950fb1b78c0 | 62 | @param domain input the NSDL domain to set |
ansond | 8:f950fb1b78c0 | 63 | @return instance to ourself |
ansond | 8:f950fb1b78c0 | 64 | */ |
ansond | 8:f950fb1b78c0 | 65 | OptionsBuilder &setDomain(const char *domain); |
ansond | 8:f950fb1b78c0 | 66 | |
ansond | 8:f950fb1b78c0 | 67 | /** |
ansond | 8:f950fb1b78c0 | 68 | Set the Endpoint Node Name |
ansond | 8:f950fb1b78c0 | 69 | @param node_name input the node endpoint name |
ansond | 8:f950fb1b78c0 | 70 | @return instance to ourself |
ansond | 8:f950fb1b78c0 | 71 | */ |
ansond | 8:f950fb1b78c0 | 72 | OptionsBuilder &setEndpointNodename(const char *node_name); |
ansond | 8:f950fb1b78c0 | 73 | |
ansond | 8:f950fb1b78c0 | 74 | /** |
ansond | 8:f950fb1b78c0 | 75 | Set the NSDL Endpoint Type |
ansond | 8:f950fb1b78c0 | 76 | @param endpoint_type input the NSDL endpoint type |
ansond | 8:f950fb1b78c0 | 77 | @return instance to ourself |
ansond | 8:f950fb1b78c0 | 78 | */ |
ansond | 8:f950fb1b78c0 | 79 | OptionsBuilder &setEndpointType(const char *endpoint_type); |
ansond | 8:f950fb1b78c0 | 80 | |
ansond | 8:f950fb1b78c0 | 81 | /** |
ansond | 8:f950fb1b78c0 | 82 | Set the mbed Registration Update Period |
ansond | 8:f950fb1b78c0 | 83 | @param rd_update_period_ms input the NSDL read update period (in ms) |
ansond | 8:f950fb1b78c0 | 84 | @return instance to ourself |
ansond | 8:f950fb1b78c0 | 85 | */ |
ansond | 8:f950fb1b78c0 | 86 | OptionsBuilder &setRegUpdatePeriod(const int reg_update_period_ms); |
ansond | 8:f950fb1b78c0 | 87 | |
ansond | 8:f950fb1b78c0 | 88 | /** |
ansond | 8:f950fb1b78c0 | 89 | Set the Connector URL |
ansond | 8:f950fb1b78c0 | 90 | @param url input the Connector URL |
ansond | 8:f950fb1b78c0 | 91 | @return instance to ourself |
ansond | 8:f950fb1b78c0 | 92 | */ |
ansond | 8:f950fb1b78c0 | 93 | OptionsBuilder &setConnectorURL(const char *connector_url); |
ansond | 0:1f1f55e73248 | 94 | |
ansond | 8:f950fb1b78c0 | 95 | /** |
ansond | 8:f950fb1b78c0 | 96 | Add a NSDL device resource (static) |
ansond | 8:f950fb1b78c0 | 97 | @param device_resource input the NSDL device resource |
ansond | 8:f950fb1b78c0 | 98 | @return instance to ourself |
ansond | 8:f950fb1b78c0 | 99 | */ |
ansond | 8:f950fb1b78c0 | 100 | OptionsBuilder &addResource(const DeviceResource *device_resource); |
ansond | 8:f950fb1b78c0 | 101 | |
ansond | 8:f950fb1b78c0 | 102 | /** |
ansond | 8:f950fb1b78c0 | 103 | Add a NSDL endpoint resource (static) |
ansond | 8:f950fb1b78c0 | 104 | @param static_resource input the NSDL static resource |
ansond | 8:f950fb1b78c0 | 105 | @return instance to ourself |
ansond | 8:f950fb1b78c0 | 106 | */ |
ansond | 8:f950fb1b78c0 | 107 | OptionsBuilder &addResource(const StaticResource *static_resource); |
ansond | 8:f950fb1b78c0 | 108 | |
ansond | 8:f950fb1b78c0 | 109 | /** |
ansond | 8:f950fb1b78c0 | 110 | Add a NSDL endpoint resource (dynamic) |
ansond | 8:f950fb1b78c0 | 111 | @param dynamic_resource input the NSDL dynamic resource |
ansond | 8:f950fb1b78c0 | 112 | */ |
ansond | 8:f950fb1b78c0 | 113 | OptionsBuilder &addResource(const DynamicResource *dynamic_resource); |
ansond | 8:f950fb1b78c0 | 114 | |
ansond | 8:f950fb1b78c0 | 115 | /** |
ansond | 8:f950fb1b78c0 | 116 | Add a NSDL endpoint resource (dynamic) |
ansond | 8:f950fb1b78c0 | 117 | @param dynamic_resource input the NSDL dynamic resource |
ansond | 8:f950fb1b78c0 | 118 | @param use_observer input if true, use an appropriate ResourceObserver to observer. if false, the underlying resource will handle it |
ansond | 8:f950fb1b78c0 | 119 | @return instance to ourself |
ansond | 8:f950fb1b78c0 | 120 | */ |
ansond | 8:f950fb1b78c0 | 121 | OptionsBuilder &addResource(const DynamicResource *dynamic_resource,const bool use_observer); |
ansond | 8:f950fb1b78c0 | 122 | |
ansond | 8:f950fb1b78c0 | 123 | /** |
ansond | 8:f950fb1b78c0 | 124 | Add a NSDL endpoint resource (dynamic) |
ansond | 8:f950fb1b78c0 | 125 | @param dynamic_resource input the NSDL dynamic resource |
ansond | 8:f950fb1b78c0 | 126 | @param sleep_time input the observation sleep time in milliseconds (for observable resource only) |
ansond | 8:f950fb1b78c0 | 127 | @return instance to ourself |
ansond | 8:f950fb1b78c0 | 128 | */ |
ansond | 8:f950fb1b78c0 | 129 | OptionsBuilder &addResource(const DynamicResource *dynamic_resource,const int sleep_time); |
ansond | 8:f950fb1b78c0 | 130 | |
ansond | 8:f950fb1b78c0 | 131 | /** |
ansond | 8:f950fb1b78c0 | 132 | Add a NSDL endpoint resource (dynamic) |
ansond | 8:f950fb1b78c0 | 133 | @param dynamic_resource input the NSDL dynamic resource |
ansond | 8:f950fb1b78c0 | 134 | @param sleep_time input the observation sleep time in milliseconds (for observable resource only) |
ansond | 8:f950fb1b78c0 | 135 | @param use_observer input if true, use an appropriate ResourceObserver to observer. if false, the underlying resource will handle it |
ansond | 8:f950fb1b78c0 | 136 | @return instance to ourself |
ansond | 8:f950fb1b78c0 | 137 | */ |
ansond | 8:f950fb1b78c0 | 138 | OptionsBuilder &addResource(const DynamicResource *dynamic_resource,const int sleep_time,const bool use_observer); |
ansond | 8:f950fb1b78c0 | 139 | |
ansond | 8:f950fb1b78c0 | 140 | /** |
ansond | 8:f950fb1b78c0 | 141 | Set the WiFi SSID |
ansond | 8:f950fb1b78c0 | 142 | @param ssid input the WiFi SSID |
ansond | 8:f950fb1b78c0 | 143 | */ |
ansond | 8:f950fb1b78c0 | 144 | OptionsBuilder &setWiFiSSID(char *ssid); |
ansond | 8:f950fb1b78c0 | 145 | |
ansond | 8:f950fb1b78c0 | 146 | /** |
ansond | 8:f950fb1b78c0 | 147 | Set the WiFi AuthType |
ansond | 8:f950fb1b78c0 | 148 | @param auth_type input the WiFi AuthType |
ansond | 8:f950fb1b78c0 | 149 | */ |
ansond | 8:f950fb1b78c0 | 150 | OptionsBuilder &setWiFiAuthType(WiFiAuthTypes auth_type); |
ansond | 8:f950fb1b78c0 | 151 | |
ansond | 8:f950fb1b78c0 | 152 | /** |
ansond | 8:f950fb1b78c0 | 153 | Set the WiFi AuthKey |
ansond | 8:f950fb1b78c0 | 154 | @param auth_key input the WiFi AuthKey |
ansond | 8:f950fb1b78c0 | 155 | */ |
ansond | 8:f950fb1b78c0 | 156 | OptionsBuilder &setWiFiAuthKey(char *auth_key); |
ansond | 8:f950fb1b78c0 | 157 | |
ansond | 8:f950fb1b78c0 | 158 | /** |
ansond | 8:f950fb1b78c0 | 159 | Set the 802.15.4 Pre Shared Key |
ansond | 8:f950fb1b78c0 | 160 | @param network_id input the 802.15.4 mesh pre shared key |
ansond | 8:f950fb1b78c0 | 161 | */ |
ansond | 8:f950fb1b78c0 | 162 | OptionsBuilder &setPreSharedKey(unsigned char psk[16]); |
ansond | 8:f950fb1b78c0 | 163 | |
ansond | 9:faa43faea4ca | 164 | /** |
ansond | 8:f950fb1b78c0 | 165 | Set the 802.15.4 Pre Shared Key Identity |
ansond | 8:f950fb1b78c0 | 166 | @param network_id input the 802.15.4 mesh pre shared key Identity |
ansond | 8:f950fb1b78c0 | 167 | */ |
ansond | 8:f950fb1b78c0 | 168 | OptionsBuilder &setPreSharedKeyIdentity(unsigned char psk_identity[2]); |
ansond | 8:f950fb1b78c0 | 169 | |
ansond | 9:faa43faea4ca | 170 | /** |
ansond | 9:faa43faea4ca | 171 | Set the 802.15.4 Mesh Type |
ansond | 9:faa43faea4ca | 172 | @param mesh_type input the 802.15.4 mesh type |
ansond | 9:faa43faea4ca | 173 | */ |
ansond | 9:faa43faea4ca | 174 | OptionsBuilder &setMeshType(MeshTypes mesh_type); |
ansond | 9:faa43faea4ca | 175 | |
ansond | 8:f950fb1b78c0 | 176 | /** |
ansond | 8:f950fb1b78c0 | 177 | Enable/Disable immediate observationing |
ansond | 8:f950fb1b78c0 | 178 | @param enable input enable immediate observationing without GET |
ansond | 8:f950fb1b78c0 | 179 | */ |
ansond | 8:f950fb1b78c0 | 180 | OptionsBuilder &setImmedateObservationEnabled(bool enable); |
ansond | 8:f950fb1b78c0 | 181 | |
ansond | 8:f950fb1b78c0 | 182 | /** |
ansond | 8:f950fb1b78c0 | 183 | Enable/Disable GET-based control of observations |
ansond | 8:f950fb1b78c0 | 184 | @param enable input enable GET-based observation enable/disable control |
ansond | 8:f950fb1b78c0 | 185 | */ |
ansond | 8:f950fb1b78c0 | 186 | OptionsBuilder &setEnableGETObservationControl(bool enable); |
ansond | 8:f950fb1b78c0 | 187 | |
ansond | 8:f950fb1b78c0 | 188 | /** |
ansond | 8:f950fb1b78c0 | 189 | Set the Server Certificate |
ansond | 8:f950fb1b78c0 | 190 | @param cert input the server certificate |
ansond | 8:f950fb1b78c0 | 191 | @param cert_size input the length of the server certificate |
ansond | 8:f950fb1b78c0 | 192 | */ |
ansond | 8:f950fb1b78c0 | 193 | OptionsBuilder &setServerCertificate(uint8_t cert[],int cert_size); |
ansond | 8:f950fb1b78c0 | 194 | |
ansond | 8:f950fb1b78c0 | 195 | /** |
ansond | 8:f950fb1b78c0 | 196 | Set the Client Certificate |
ansond | 8:f950fb1b78c0 | 197 | @param cert input the client certificate |
ansond | 8:f950fb1b78c0 | 198 | @param cert_size input the length of the client certificate |
ansond | 8:f950fb1b78c0 | 199 | */ |
ansond | 8:f950fb1b78c0 | 200 | OptionsBuilder &setClientCertificate(uint8_t cert[],int cert_size); |
ansond | 8:f950fb1b78c0 | 201 | |
ansond | 8:f950fb1b78c0 | 202 | /** |
ansond | 8:f950fb1b78c0 | 203 | Set the Client Key |
ansond | 8:f950fb1b78c0 | 204 | @param key input the client key |
ansond | 8:f950fb1b78c0 | 205 | @param key_size input the length of the client key |
ansond | 8:f950fb1b78c0 | 206 | */ |
ansond | 8:f950fb1b78c0 | 207 | OptionsBuilder &setClientKey(uint8_t key[],int key_size); |
ansond | 8:f950fb1b78c0 | 208 | |
ansond | 8:f950fb1b78c0 | 209 | /** |
ansond | 8:f950fb1b78c0 | 210 | Build our our immutable self |
ansond | 8:f950fb1b78c0 | 211 | */ |
ansond | 8:f950fb1b78c0 | 212 | Options *build(); |
ansond | 8:f950fb1b78c0 | 213 | |
ansond | 8:f950fb1b78c0 | 214 | }; |
ansond | 8:f950fb1b78c0 | 215 | |
ansond | 8:f950fb1b78c0 | 216 | } // namespace Connector |
ansond | 8:f950fb1b78c0 | 217 | |
ansond | 8:f950fb1b78c0 | 218 | #endif // __OPTIONS_BUILDER_H__ |