custom for >5 resources
Fork of mbedConnectorInterface by
api/OptionsBuilder.h@3:11b2f4e58378, 2015-01-28 (annotated)
- Committer:
- ansond
- Date:
- Wed Jan 28 11:52:09 2015 +0000
- Revision:
- 3:11b2f4e58378
- Parent:
- 2:853f9ecc12df
- Child:
- 15:8ada80242804
updates to enable global modification of low level NSDL configuration
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 | /** |
sam_grove | 2:853f9ecc12df | 133 | Build our our immutable self |
sam_grove | 2:853f9ecc12df | 134 | */ |
sam_grove | 2:853f9ecc12df | 135 | Options *build(); |
sam_grove | 2:853f9ecc12df | 136 | |
sam_grove | 2:853f9ecc12df | 137 | }; |
sam_grove | 2:853f9ecc12df | 138 | |
sam_grove | 2:853f9ecc12df | 139 | } // namespace Connector |
sam_grove | 2:853f9ecc12df | 140 | |
sam_grove | 2:853f9ecc12df | 141 | #endif // __OPTIONS_BUILDER_H__ |