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@127:b4a661ff6fb9, 2017-09-26 (annotated)
- Committer:
- ansond
- Date:
- Tue Sep 26 16:01:31 2017 +0000
- Revision:
- 127:b4a661ff6fb9
- Parent:
- 55:fdb11bfada5f
minor re-ordering of FCC init
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 Connector URL |
ansond | 8:f950fb1b78c0 | 83 | @param url input the Connector URL |
ansond | 8:f950fb1b78c0 | 84 | @return instance to ourself |
ansond | 8:f950fb1b78c0 | 85 | */ |
ansond | 8:f950fb1b78c0 | 86 | OptionsBuilder &setConnectorURL(const char *connector_url); |
ansond | 0:1f1f55e73248 | 87 | |
ansond | 8:f950fb1b78c0 | 88 | /** |
ansond | 27:b8aaf7dc7023 | 89 | Set the LWM2M Device Resource Object Instance |
ansond | 27:b8aaf7dc7023 | 90 | @param device_resources_object input the LWM2M device resource object instance |
ansond | 8:f950fb1b78c0 | 91 | @return instance to ourself |
ansond | 8:f950fb1b78c0 | 92 | */ |
ansond | 27:b8aaf7dc7023 | 93 | OptionsBuilder &setDeviceResourcesObject(const void *device_resources_object); |
ansond | 27:b8aaf7dc7023 | 94 | |
ansond | 27:b8aaf7dc7023 | 95 | /** |
ansond | 27:b8aaf7dc7023 | 96 | Set the LWM2M Firmware Resource Object Instance |
ansond | 27:b8aaf7dc7023 | 97 | @param firmware_resources_object input the LWM2M firmware resource object instance |
ansond | 27:b8aaf7dc7023 | 98 | @return instance to ourself |
ansond | 27:b8aaf7dc7023 | 99 | */ |
ansond | 27:b8aaf7dc7023 | 100 | OptionsBuilder &setFirmwareResourcesObject(const void *firmware_resources_object); |
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 | 27:b8aaf7dc7023 | 112 | @return instance to ourself |
ansond | 8:f950fb1b78c0 | 113 | */ |
ansond | 8:f950fb1b78c0 | 114 | OptionsBuilder &addResource(const DynamicResource *dynamic_resource); |
ansond | 8:f950fb1b78c0 | 115 | |
ansond | 8:f950fb1b78c0 | 116 | /** |
ansond | 8:f950fb1b78c0 | 117 | Add a NSDL endpoint resource (dynamic) |
ansond | 8:f950fb1b78c0 | 118 | @param dynamic_resource input the NSDL dynamic resource |
ansond | 8:f950fb1b78c0 | 119 | @param use_observer input if true, use an appropriate ResourceObserver to observer. if false, the underlying resource will handle it |
ansond | 8:f950fb1b78c0 | 120 | @return instance to ourself |
ansond | 8:f950fb1b78c0 | 121 | */ |
ansond | 8:f950fb1b78c0 | 122 | OptionsBuilder &addResource(const DynamicResource *dynamic_resource,const bool use_observer); |
ansond | 8:f950fb1b78c0 | 123 | |
ansond | 8:f950fb1b78c0 | 124 | /** |
ansond | 8:f950fb1b78c0 | 125 | Add a NSDL endpoint resource (dynamic) |
ansond | 8:f950fb1b78c0 | 126 | @param dynamic_resource input the NSDL dynamic resource |
ansond | 8:f950fb1b78c0 | 127 | @param sleep_time input the observation sleep time in milliseconds (for observable resource only) |
ansond | 8:f950fb1b78c0 | 128 | @return instance to ourself |
ansond | 8:f950fb1b78c0 | 129 | */ |
ansond | 8:f950fb1b78c0 | 130 | OptionsBuilder &addResource(const DynamicResource *dynamic_resource,const int sleep_time); |
ansond | 8:f950fb1b78c0 | 131 | |
ansond | 8:f950fb1b78c0 | 132 | /** |
ansond | 8:f950fb1b78c0 | 133 | Add a NSDL endpoint resource (dynamic) |
ansond | 8:f950fb1b78c0 | 134 | @param dynamic_resource input the NSDL dynamic resource |
ansond | 8:f950fb1b78c0 | 135 | @param sleep_time input the observation sleep time in milliseconds (for observable resource only) |
ansond | 8:f950fb1b78c0 | 136 | @param use_observer input if true, use an appropriate ResourceObserver to observer. if false, the underlying resource will handle it |
ansond | 8:f950fb1b78c0 | 137 | @return instance to ourself |
ansond | 8:f950fb1b78c0 | 138 | */ |
ansond | 8:f950fb1b78c0 | 139 | OptionsBuilder &addResource(const DynamicResource *dynamic_resource,const int sleep_time,const bool use_observer); |
ansond | 8:f950fb1b78c0 | 140 | |
ansond | 8:f950fb1b78c0 | 141 | /** |
ansond | 8:f950fb1b78c0 | 142 | Set the WiFi SSID |
ansond | 8:f950fb1b78c0 | 143 | @param ssid input the WiFi SSID |
ansond | 8:f950fb1b78c0 | 144 | */ |
ansond | 8:f950fb1b78c0 | 145 | OptionsBuilder &setWiFiSSID(char *ssid); |
ansond | 8:f950fb1b78c0 | 146 | |
ansond | 8:f950fb1b78c0 | 147 | /** |
ansond | 8:f950fb1b78c0 | 148 | Set the WiFi AuthType |
ansond | 8:f950fb1b78c0 | 149 | @param auth_type input the WiFi AuthType |
ansond | 8:f950fb1b78c0 | 150 | */ |
ansond | 8:f950fb1b78c0 | 151 | OptionsBuilder &setWiFiAuthType(WiFiAuthTypes auth_type); |
ansond | 8:f950fb1b78c0 | 152 | |
ansond | 8:f950fb1b78c0 | 153 | /** |
ansond | 8:f950fb1b78c0 | 154 | Set the WiFi AuthKey |
ansond | 8:f950fb1b78c0 | 155 | @param auth_key input the WiFi AuthKey |
ansond | 8:f950fb1b78c0 | 156 | */ |
ansond | 8:f950fb1b78c0 | 157 | OptionsBuilder &setWiFiAuthKey(char *auth_key); |
ansond | 10:3f79b5e67c22 | 158 | |
ansond | 10:3f79b5e67c22 | 159 | /** |
ansond | 10:3f79b5e67c22 | 160 | Set the CoAP Connection Type |
ansond | 10:3f79b5e67c22 | 161 | @param coap_connection_type input the CoAP Connection type |
ansond | 10:3f79b5e67c22 | 162 | */ |
ansond | 10:3f79b5e67c22 | 163 | OptionsBuilder &setCoAPConnectionType(CoAPConnectionTypes coap_connection_type); |
ansond | 10:3f79b5e67c22 | 164 | |
ansond | 10:3f79b5e67c22 | 165 | /** |
ansond | 10:3f79b5e67c22 | 166 | Set the IP Address Type |
ansond | 10:3f79b5e67c22 | 167 | @param ip_address_type input the IP Address type |
ansond | 10:3f79b5e67c22 | 168 | */ |
ansond | 10:3f79b5e67c22 | 169 | OptionsBuilder &setIPAddressType(IPAddressTypes ip_address_type); |
ansond | 9:faa43faea4ca | 170 | |
ansond | 8:f950fb1b78c0 | 171 | /** |
ansond | 8:f950fb1b78c0 | 172 | Enable/Disable immediate observationing |
ansond | 8:f950fb1b78c0 | 173 | @param enable input enable immediate observationing without GET |
ansond | 8:f950fb1b78c0 | 174 | */ |
ansond | 8:f950fb1b78c0 | 175 | OptionsBuilder &setImmedateObservationEnabled(bool enable); |
ansond | 8:f950fb1b78c0 | 176 | |
ansond | 8:f950fb1b78c0 | 177 | /** |
ansond | 8:f950fb1b78c0 | 178 | Enable/Disable GET-based control of observations |
ansond | 8:f950fb1b78c0 | 179 | @param enable input enable GET-based observation enable/disable control |
ansond | 8:f950fb1b78c0 | 180 | */ |
ansond | 8:f950fb1b78c0 | 181 | OptionsBuilder &setEnableGETObservationControl(bool enable); |
ansond | 8:f950fb1b78c0 | 182 | |
ansond | 8:f950fb1b78c0 | 183 | /** |
ansond | 8:f950fb1b78c0 | 184 | Set the Server Certificate |
ansond | 8:f950fb1b78c0 | 185 | @param cert input the server certificate |
ansond | 8:f950fb1b78c0 | 186 | @param cert_size input the length of the server certificate |
ansond | 8:f950fb1b78c0 | 187 | */ |
ansond | 49:c603a22495bb | 188 | OptionsBuilder &setServerCertificate(uint8_t *cert,int cert_size); |
ansond | 8:f950fb1b78c0 | 189 | |
ansond | 8:f950fb1b78c0 | 190 | /** |
ansond | 8:f950fb1b78c0 | 191 | Set the Client Certificate |
ansond | 8:f950fb1b78c0 | 192 | @param cert input the client certificate |
ansond | 8:f950fb1b78c0 | 193 | @param cert_size input the length of the client certificate |
ansond | 8:f950fb1b78c0 | 194 | */ |
ansond | 49:c603a22495bb | 195 | OptionsBuilder &setClientCertificate(uint8_t *cert,int cert_size); |
ansond | 8:f950fb1b78c0 | 196 | |
ansond | 8:f950fb1b78c0 | 197 | /** |
ansond | 8:f950fb1b78c0 | 198 | Set the Client Key |
ansond | 8:f950fb1b78c0 | 199 | @param key input the client key |
ansond | 8:f950fb1b78c0 | 200 | @param key_size input the length of the client key |
ansond | 8:f950fb1b78c0 | 201 | */ |
ansond | 49:c603a22495bb | 202 | OptionsBuilder &setClientKey(uint8_t *key,int key_size); |
ansond | 8:f950fb1b78c0 | 203 | |
ansond | 8:f950fb1b78c0 | 204 | /** |
ansond | 8:f950fb1b78c0 | 205 | Build our our immutable self |
ansond | 8:f950fb1b78c0 | 206 | */ |
ansond | 8:f950fb1b78c0 | 207 | Options *build(); |
ansond | 22:68fcdc40b397 | 208 | |
ansond | 22:68fcdc40b397 | 209 | /** |
ansond | 22:68fcdc40b397 | 210 | Set our Endpoint instance |
ansond | 22:68fcdc40b397 | 211 | */ |
ansond | 22:68fcdc40b397 | 212 | void setEndpoint(void *endpoint); |
ansond | 8:f950fb1b78c0 | 213 | }; |
ansond | 8:f950fb1b78c0 | 214 | |
ansond | 8:f950fb1b78c0 | 215 | } // namespace Connector |
ansond | 8:f950fb1b78c0 | 216 | |
ansond | 8:f950fb1b78c0 | 217 | #endif // __OPTIONS_BUILDER_H__ |