mbed Connector Endpoint interface. This interface permits a mbed endpoint to easily setup MDS resources and emit those resources to an MDS server.

Dependents:   IoT_LED_demo ServoTest uWater_Project hackathon ... more

Committer:
ansond
Date:
Mon Apr 13 23:41:34 2015 +0000
Revision:
48:4b9ee3e32f93
Parent:
47:e75750ddc413
added configuration options for GET based observation control and the ability to have immediate observationing if desired

Who changed what in which revision?

UserRevisionLine numberNew 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 47:e75750ddc413 143 @return instance to ourself
ansond 47:e75750ddc413 144 */
ansond 47:e75750ddc413 145 OptionsBuilder &addResource(const DynamicResource *dynamic_resource,const int sleep_time);
ansond 47:e75750ddc413 146
ansond 47:e75750ddc413 147 /**
ansond 47:e75750ddc413 148 Add a NSDL endpoint resource (dynamic)
ansond 47:e75750ddc413 149 @param dynamic_resource input the NSDL dynamic resource
ansond 47:e75750ddc413 150 @param sleep_time input the observation sleep time in milliseconds (for observable resource only)
ansond 42:20c375e74e8e 151 @param use_observer input if true, use an appropriate ResourceObserver to observer. if false, the underlying resource will handle it
sam_grove 2:853f9ecc12df 152 @return instance to ourself
sam_grove 2:853f9ecc12df 153 */
ansond 46:cc6076ac5026 154 OptionsBuilder &addResource(const DynamicResource *dynamic_resource,const int sleep_time,const bool use_observer);
sam_grove 2:853f9ecc12df 155
sam_grove 2:853f9ecc12df 156 /**
ansond 15:8ada80242804 157 Set the WiFi SSID
ansond 15:8ada80242804 158 @param ssid input the WiFi SSID
ansond 15:8ada80242804 159 */
ansond 15:8ada80242804 160 OptionsBuilder &setWiFiSSID(char *ssid);
ansond 15:8ada80242804 161
ansond 15:8ada80242804 162 /**
ansond 15:8ada80242804 163 Set the WiFi AuthType
ansond 15:8ada80242804 164 @param auth_type input the WiFi AuthType
ansond 15:8ada80242804 165 */
ansond 15:8ada80242804 166 OptionsBuilder &setWiFiAuthType(WiFiAuthTypes auth_type);
ansond 15:8ada80242804 167
ansond 15:8ada80242804 168 /**
ansond 15:8ada80242804 169 Set the WiFi AuthKey
ansond 15:8ada80242804 170 @param auth_key input the WiFi AuthKey
ansond 15:8ada80242804 171 */
ansond 15:8ada80242804 172 OptionsBuilder &setWiFiAuthKey(char *auth_key);
ansond 15:8ada80242804 173
ansond 15:8ada80242804 174 /**
ansond 19:e2cbaeeea509 175 Set the 802.15.4 Network ID
ansond 19:e2cbaeeea509 176 @param network_id input the 802.15.4 mesh Network ID
ansond 19:e2cbaeeea509 177 */
ansond 19:e2cbaeeea509 178 OptionsBuilder &setNetworkID(char *network_id);
ansond 19:e2cbaeeea509 179
ansond 19:e2cbaeeea509 180 /**
ansond 19:e2cbaeeea509 181 Set the 802.15.4 Radio Channel
ansond 19:e2cbaeeea509 182 @param channel input the 802.15.4 radio channel
ansond 19:e2cbaeeea509 183 */
ansond 19:e2cbaeeea509 184 OptionsBuilder &setRadioChannel(int channel);
ansond 19:e2cbaeeea509 185
ansond 48:4b9ee3e32f93 186 /**
ansond 48:4b9ee3e32f93 187 Enable/Disable immediate observationing
ansond 48:4b9ee3e32f93 188 @param enable input enable immediate observationing without GET
ansond 48:4b9ee3e32f93 189 */
ansond 48:4b9ee3e32f93 190 OptionsBuilder &setImmedateObservationEnabled(bool enable);
ansond 48:4b9ee3e32f93 191
ansond 48:4b9ee3e32f93 192 /**
ansond 48:4b9ee3e32f93 193 Enable/Disable GET-based control of observations
ansond 48:4b9ee3e32f93 194 @param enable input enable GET-based observation enable/disable control
ansond 48:4b9ee3e32f93 195 */
ansond 48:4b9ee3e32f93 196 OptionsBuilder &setEnableGETObservationControl(bool enable);
ansond 48:4b9ee3e32f93 197
ansond 19:e2cbaeeea509 198 /**
sam_grove 2:853f9ecc12df 199 Build our our immutable self
sam_grove 2:853f9ecc12df 200 */
sam_grove 2:853f9ecc12df 201 Options *build();
sam_grove 2:853f9ecc12df 202
sam_grove 2:853f9ecc12df 203 };
sam_grove 2:853f9ecc12df 204
sam_grove 2:853f9ecc12df 205 } // namespace Connector
sam_grove 2:853f9ecc12df 206
sam_grove 2:853f9ecc12df 207 #endif // __OPTIONS_BUILDER_H__