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:
Sat Apr 11 22:10:02 2015 +0000
Revision:
45:65351ebb7c42
Parent:
42:20c375e74e8e
Child:
46:cc6076ac5026
minor fix

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);
sam_grove 2:853f9ecc12df 124
sam_grove 2:853f9ecc12df 125 /**
sam_grove 2:853f9ecc12df 126 Add a NSDL endpoint resource (dynamic)
sam_grove 2:853f9ecc12df 127 @param dynamic_resource input the NSDL dynamic resource
ansond 45:65351ebb7c42 128 @param use_observer input if true, use an appropriate ResourceObserver to observer. if false, the underlying resource will handle it
ansond 45:65351ebb7c42 129 @return instance to ourself
ansond 45:65351ebb7c42 130 */
ansond 45:65351ebb7c42 131 OptionsBuilder &addResource(const DynamicResource *dynamic_resource,const bool use_observer = true);
ansond 45:65351ebb7c42 132
ansond 45:65351ebb7c42 133 /**
ansond 45:65351ebb7c42 134 Add a NSDL endpoint resource (dynamic)
ansond 45:65351ebb7c42 135 @param dynamic_resource input the NSDL dynamic resource
ansond 42:20c375e74e8e 136 @param sleep_time input the observation sleep time in milliseconds (for observable resource only)
ansond 42:20c375e74e8e 137 @param use_observer input if true, use an appropriate ResourceObserver to observer. if false, the underlying resource will handle it
sam_grove 2:853f9ecc12df 138 @return instance to ourself
sam_grove 2:853f9ecc12df 139 */
ansond 45:65351ebb7c42 140 OptionsBuilder &addResource(const DynamicResource *dynamic_resource,const int sleep_time = NSP_DEFAULT_OBS_PERIOD,const bool use_observer = true);
sam_grove 2:853f9ecc12df 141
sam_grove 2:853f9ecc12df 142 /**
ansond 15:8ada80242804 143 Set the WiFi SSID
ansond 15:8ada80242804 144 @param ssid input the WiFi SSID
ansond 15:8ada80242804 145 */
ansond 15:8ada80242804 146 OptionsBuilder &setWiFiSSID(char *ssid);
ansond 15:8ada80242804 147
ansond 15:8ada80242804 148 /**
ansond 15:8ada80242804 149 Set the WiFi AuthType
ansond 15:8ada80242804 150 @param auth_type input the WiFi AuthType
ansond 15:8ada80242804 151 */
ansond 15:8ada80242804 152 OptionsBuilder &setWiFiAuthType(WiFiAuthTypes auth_type);
ansond 15:8ada80242804 153
ansond 15:8ada80242804 154 /**
ansond 15:8ada80242804 155 Set the WiFi AuthKey
ansond 15:8ada80242804 156 @param auth_key input the WiFi AuthKey
ansond 15:8ada80242804 157 */
ansond 15:8ada80242804 158 OptionsBuilder &setWiFiAuthKey(char *auth_key);
ansond 15:8ada80242804 159
ansond 15:8ada80242804 160 /**
ansond 19:e2cbaeeea509 161 Set the 802.15.4 Network ID
ansond 19:e2cbaeeea509 162 @param network_id input the 802.15.4 mesh Network ID
ansond 19:e2cbaeeea509 163 */
ansond 19:e2cbaeeea509 164 OptionsBuilder &setNetworkID(char *network_id);
ansond 19:e2cbaeeea509 165
ansond 19:e2cbaeeea509 166 /**
ansond 19:e2cbaeeea509 167 Set the 802.15.4 Radio Channel
ansond 19:e2cbaeeea509 168 @param channel input the 802.15.4 radio channel
ansond 19:e2cbaeeea509 169 */
ansond 19:e2cbaeeea509 170 OptionsBuilder &setRadioChannel(int channel);
ansond 19:e2cbaeeea509 171
ansond 19:e2cbaeeea509 172 /**
sam_grove 2:853f9ecc12df 173 Build our our immutable self
sam_grove 2:853f9ecc12df 174 */
sam_grove 2:853f9ecc12df 175 Options *build();
sam_grove 2:853f9ecc12df 176
sam_grove 2:853f9ecc12df 177 };
sam_grove 2:853f9ecc12df 178
sam_grove 2:853f9ecc12df 179 } // namespace Connector
sam_grove 2:853f9ecc12df 180
sam_grove 2:853f9ecc12df 181 #endif // __OPTIONS_BUILDER_H__