custom for >5 resources
Fork of mbedConnectorInterface by
Diff: api/OptionsBuilder.h
- Revision:
- 2:853f9ecc12df
- Parent:
- 0:b438482ebbfc
- Child:
- 3:11b2f4e58378
diff -r cabdd0350707 -r 853f9ecc12df api/OptionsBuilder.h --- a/api/OptionsBuilder.h Tue Jan 27 22:52:25 2015 +0000 +++ b/api/OptionsBuilder.h Tue Jan 27 23:41:34 2015 +0000 @@ -3,7 +3,7 @@ * @brief mbed CoAP OptionsBuilder class header * @author Doug Anson/Chris Paola * @version 1.0 - * @see + * @see * * Copyright (c) 2014 * @@ -19,118 +19,123 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - #ifndef __OPTIONS_BUILDER_H__ - #define __OPTIONS_BUILDER_H__ - - // base class support - #include "Options.h" - - // Connector namespace - namespace Connector { - class OptionsBuilder : Options { - public: - /** - Default Constructor - */ - OptionsBuilder(); - - /** - Copy Constructor - @param ob input options builder instance to deep copy - */ - OptionsBuilder(const OptionsBuilder &ob); - - /** - Destructor - */ - virtual ~OptionsBuilder(); - - /** - Set the NSDL Endpoint Lifetime - @param lifetime input the NSDL endpoint lifetime (seconds) - @return instance to ourself - */ - OptionsBuilder &setLifetime(const char *lifetime); - - /** - Set the NSDL Domain - @param domain input the NSDL domain to set - @return instance to ourself - */ - OptionsBuilder &setDomain(const char *domain); - - /** - Set the Endpoint Node Name - @param node_name input the node endpoint name - @return instance to ourself - */ - OptionsBuilder &setEndpointNodename(const char *node_name); - - /** - Set the NSDL Endpoint Type - @param endpoint_type input the NSDL endpoint type - @return instance to ourself - */ - OptionsBuilder &setEndpointType(const char *endpoint_type); - - /** - Set the NSDL Port Number - @param port_num input the NSDL port number - @return instance to ourself - */ - OptionsBuilder &setNSPPortNumber(const int port_num); - - /** - Set the underlying radio stack channel list - @param channel_list input the radio channel list - @return instance to ourself - */ - OptionsBuilder &setRadioChannelList(const uint32_t channel_list); - - /** - Set the NSDL Read Update Period - @param rd_update_period_ms input the NSDL read update period (in ms) - @return instance to ourself - */ - OptionsBuilder &setReadUpdatePeriod(const int rd_update_period_ms); - - /** - Set the NSP IPv6 Address - @param nsp_address input the NSP IPv6 address - @param nsp_address_length input the length of the NSP IPv6 address buffer - @return instance to ourself - */ - OptionsBuilder &setNSPAddress(const uint8_t *nsp_address,const int nsp_address_length); - - /** - Set the MAC address - @param mac_address input the MAC address buffer - @param mac_address_length input the MAC address buffer length - @return instance to ourself - */ - OptionsBuilder &setMACAddress(const uint8_t *mac_address,const int mac_address_length); - - /** - Add a NSDL endpoint resource (static) - @param static_resource input the NSDL static resource - @return instance to ourself - */ - OptionsBuilder &addResource(const StaticResource *static_resource); - - /** - Add a NSDL endpoint resource (dynamic) - @param dynamic_resource input the NSDL dynamic resource - @return instance to ourself - */ - OptionsBuilder &addResource(const DynamicResource *static_resource); - - /** - Build our our immutable self - */ - Options *build(); - - }; - } - - #endif // __OPTIONS_BUILDER_H__ \ No newline at end of file + +#ifndef __OPTIONS_BUILDER_H__ +#define __OPTIONS_BUILDER_H__ + +// base class support +#include "Options.h" + +// Connector namespace +namespace Connector { + +/** OptionsBuilder class + */ +class OptionsBuilder : Options +{ +public: + /** + Default Constructor + */ + OptionsBuilder(); + + /** + Copy Constructor + @param ob input options builder instance to deep copy + */ + OptionsBuilder(const OptionsBuilder &ob); + + /** + Destructor + */ + virtual ~OptionsBuilder(); + + /** + Set the NSDL Endpoint Lifetime + @param lifetime input the NSDL endpoint lifetime (seconds) + @return instance to ourself + */ + OptionsBuilder &setLifetime(const char *lifetime); + + /** + Set the NSDL Domain + @param domain input the NSDL domain to set + @return instance to ourself + */ + OptionsBuilder &setDomain(const char *domain); + + /** + Set the Endpoint Node Name + @param node_name input the node endpoint name + @return instance to ourself + */ + OptionsBuilder &setEndpointNodename(const char *node_name); + + /** + Set the NSDL Endpoint Type + @param endpoint_type input the NSDL endpoint type + @return instance to ourself + */ + OptionsBuilder &setEndpointType(const char *endpoint_type); + + /** + Set the NSDL Port Number + @param port_num input the NSDL port number + @return instance to ourself + */ + OptionsBuilder &setNSPPortNumber(const int port_num); + + /** + Set the underlying radio stack channel list + @param channel_list input the radio channel list + @return instance to ourself + */ + OptionsBuilder &setRadioChannelList(const uint32_t channel_list); + + /** + Set the NSDL Read Update Period + @param rd_update_period_ms input the NSDL read update period (in ms) + @return instance to ourself + */ + OptionsBuilder &setReadUpdatePeriod(const int rd_update_period_ms); + + /** + Set the NSP IPv6 Address + @param nsp_address input the NSP IPv6 address + @param nsp_address_length input the length of the NSP IPv6 address buffer + @return instance to ourself + */ + OptionsBuilder &setNSPAddress(const uint8_t *nsp_address,const int nsp_address_length); + + /** + Set the MAC address + @param mac_address input the MAC address buffer + @param mac_address_length input the MAC address buffer length + @return instance to ourself + */ + OptionsBuilder &setMACAddress(const uint8_t *mac_address,const int mac_address_length); + + /** + Add a NSDL endpoint resource (static) + @param static_resource input the NSDL static resource + @return instance to ourself + */ + OptionsBuilder &addResource(const StaticResource *static_resource); + + /** + Add a NSDL endpoint resource (dynamic) + @param dynamic_resource input the NSDL dynamic resource + @return instance to ourself + */ + OptionsBuilder &addResource(const DynamicResource *static_resource); + + /** + Build our our immutable self + */ + Options *build(); + +}; + +} // namespace Connector + +#endif // __OPTIONS_BUILDER_H__