custom for >5 resources
Fork of mbedConnectorInterface by
api/OptionsBuilder.h@19:e2cbaeeea509, 2015-02-24 (annotated)
- Committer:
- ansond
- Date:
- Tue Feb 24 02:05:06 2015 +0000
- Revision:
- 19:e2cbaeeea509
- Parent:
- 15:8ada80242804
- Child:
- 42:20c375e74e8e
added additional 802.15.4 configuration support
Who changed what in which revision?
User | Revision | Line number | New 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 |
sam_grove | 2:853f9ecc12df | 128 | @return instance to ourself |
sam_grove | 2:853f9ecc12df | 129 | */ |
sam_grove | 2:853f9ecc12df | 130 | OptionsBuilder &addResource(const DynamicResource *static_resource); |
sam_grove | 2:853f9ecc12df | 131 | |
sam_grove | 2:853f9ecc12df | 132 | /** |
ansond | 15:8ada80242804 | 133 | Set the WiFi SSID |
ansond | 15:8ada80242804 | 134 | @param ssid input the WiFi SSID |
ansond | 15:8ada80242804 | 135 | */ |
ansond | 15:8ada80242804 | 136 | OptionsBuilder &setWiFiSSID(char *ssid); |
ansond | 15:8ada80242804 | 137 | |
ansond | 15:8ada80242804 | 138 | /** |
ansond | 15:8ada80242804 | 139 | Set the WiFi AuthType |
ansond | 15:8ada80242804 | 140 | @param auth_type input the WiFi AuthType |
ansond | 15:8ada80242804 | 141 | */ |
ansond | 15:8ada80242804 | 142 | OptionsBuilder &setWiFiAuthType(WiFiAuthTypes auth_type); |
ansond | 15:8ada80242804 | 143 | |
ansond | 15:8ada80242804 | 144 | /** |
ansond | 15:8ada80242804 | 145 | Set the WiFi AuthKey |
ansond | 15:8ada80242804 | 146 | @param auth_key input the WiFi AuthKey |
ansond | 15:8ada80242804 | 147 | */ |
ansond | 15:8ada80242804 | 148 | OptionsBuilder &setWiFiAuthKey(char *auth_key); |
ansond | 15:8ada80242804 | 149 | |
ansond | 15:8ada80242804 | 150 | /** |
ansond | 19:e2cbaeeea509 | 151 | Set the 802.15.4 Network ID |
ansond | 19:e2cbaeeea509 | 152 | @param network_id input the 802.15.4 mesh Network ID |
ansond | 19:e2cbaeeea509 | 153 | */ |
ansond | 19:e2cbaeeea509 | 154 | OptionsBuilder &setNetworkID(char *network_id); |
ansond | 19:e2cbaeeea509 | 155 | |
ansond | 19:e2cbaeeea509 | 156 | /** |
ansond | 19:e2cbaeeea509 | 157 | Set the 802.15.4 Radio Channel |
ansond | 19:e2cbaeeea509 | 158 | @param channel input the 802.15.4 radio channel |
ansond | 19:e2cbaeeea509 | 159 | */ |
ansond | 19:e2cbaeeea509 | 160 | OptionsBuilder &setRadioChannel(int channel); |
ansond | 19:e2cbaeeea509 | 161 | |
ansond | 19:e2cbaeeea509 | 162 | /** |
sam_grove | 2:853f9ecc12df | 163 | Build our our immutable self |
sam_grove | 2:853f9ecc12df | 164 | */ |
sam_grove | 2:853f9ecc12df | 165 | Options *build(); |
sam_grove | 2:853f9ecc12df | 166 | |
sam_grove | 2:853f9ecc12df | 167 | }; |
sam_grove | 2:853f9ecc12df | 168 | |
sam_grove | 2:853f9ecc12df | 169 | } // namespace Connector |
sam_grove | 2:853f9ecc12df | 170 | |
sam_grove | 2:853f9ecc12df | 171 | #endif // __OPTIONS_BUILDER_H__ |