observe updates
Fork of mbedConnectorInterface by
Embed:
(wiki syntax)
Show/hide line numbers
OptionsBuilder.h
Go to the documentation of this file.
00001 /** 00002 * @file OptionsBuilder.h 00003 * @brief mbed CoAP OptionsBuilder class header 00004 * @author Doug Anson/Chris Paola 00005 * @version 1.0 00006 * @see 00007 * 00008 * Copyright (c) 2014 00009 * 00010 * Licensed under the Apache License, Version 2.0 (the "License"); 00011 * you may not use this file except in compliance with the License. 00012 * You may obtain a copy of the License at 00013 * 00014 * http://www.apache.org/licenses/LICENSE-2.0 00015 * 00016 * Unless required by applicable law or agreed to in writing, software 00017 * distributed under the License is distributed on an "AS IS" BASIS, 00018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00019 * See the License for the specific language governing permissions and 00020 * limitations under the License. 00021 */ 00022 00023 #ifndef __OPTIONS_BUILDER_H__ 00024 #define __OPTIONS_BUILDER_H__ 00025 00026 // base class support 00027 #include "Options.h" 00028 00029 // Connector namespace 00030 namespace Connector { 00031 00032 /** OptionsBuilder class 00033 */ 00034 class OptionsBuilder : Options 00035 { 00036 public: 00037 /** 00038 Default Constructor 00039 */ 00040 OptionsBuilder(); 00041 00042 /** 00043 Copy Constructor 00044 @param ob input options builder instance to deep copy 00045 */ 00046 OptionsBuilder(const OptionsBuilder &ob); 00047 00048 /** 00049 Destructor 00050 */ 00051 virtual ~OptionsBuilder(); 00052 00053 /** 00054 Set the NSDL Endpoint Lifetime 00055 @param lifetime input the NSDL endpoint lifetime (seconds) 00056 @return instance to ourself 00057 */ 00058 OptionsBuilder &setLifetime(const char *lifetime); 00059 00060 /** 00061 Set the NSDL Domain 00062 @param domain input the NSDL domain to set 00063 @return instance to ourself 00064 */ 00065 OptionsBuilder &setDomain(const char *domain); 00066 00067 /** 00068 Set the Endpoint Node Name 00069 @param node_name input the node endpoint name 00070 @return instance to ourself 00071 */ 00072 OptionsBuilder &setEndpointNodename(const char *node_name); 00073 00074 /** 00075 Set the NSDL Endpoint Type 00076 @param endpoint_type input the NSDL endpoint type 00077 @return instance to ourself 00078 */ 00079 OptionsBuilder &setEndpointType(const char *endpoint_type); 00080 00081 /** 00082 Set the NSDL Port Number 00083 @param port_num input the NSDL port number 00084 @return instance to ourself 00085 */ 00086 OptionsBuilder &setNSPPortNumber(const int port_num); 00087 00088 /** 00089 Set the underlying radio stack channel list 00090 @param channel_list input the radio channel list 00091 @return instance to ourself 00092 */ 00093 OptionsBuilder &setRadioChannelList(const uint32_t channel_list); 00094 00095 /** 00096 Set the NSDL Read Update Period 00097 @param rd_update_period_ms input the NSDL read update period (in ms) 00098 @return instance to ourself 00099 */ 00100 OptionsBuilder &setReadUpdatePeriod(const int rd_update_period_ms); 00101 00102 /** 00103 Set the NSP IPv6 Address 00104 @param nsp_address input the NSP IPv6 address 00105 @param nsp_address_length input the length of the NSP IPv6 address buffer 00106 @return instance to ourself 00107 */ 00108 OptionsBuilder &setNSPAddress(const uint8_t *nsp_address,const int nsp_address_length = NSP_IP_ADDRESS_LENGTH); 00109 00110 /** 00111 Set the MAC address 00112 @param mac_address input the MAC address buffer 00113 @param mac_address_length input the MAC address buffer length 00114 @return instance to ourself 00115 */ 00116 OptionsBuilder &setMACAddress(const uint8_t *mac_address,const int mac_address_length = NODE_MAC_ADDRESS_LENGTH); 00117 00118 /** 00119 Add a NSDL endpoint resource (static) 00120 @param static_resource input the NSDL static resource 00121 @return instance to ourself 00122 */ 00123 OptionsBuilder &addResource(const StaticResource *static_resource); 00124 00125 /** 00126 Add a NSDL endpoint resource (dynamic) 00127 @param dynamic_resource input the NSDL dynamic resource 00128 */ 00129 OptionsBuilder &addResource(const DynamicResource *dynamic_resource); 00130 00131 /** 00132 Add a NSDL endpoint resource (dynamic) 00133 @param dynamic_resource input the NSDL dynamic resource 00134 @param use_observer input if true, use an appropriate ResourceObserver to observer. if false, the underlying resource will handle it 00135 @return instance to ourself 00136 */ 00137 OptionsBuilder &addResource(const DynamicResource *dynamic_resource,const bool use_observer); 00138 00139 /** 00140 Add a NSDL endpoint resource (dynamic) 00141 @param dynamic_resource input the NSDL dynamic resource 00142 @param sleep_time input the observation sleep time in milliseconds (for observable resource only) 00143 @return instance to ourself 00144 */ 00145 OptionsBuilder &addResource(const DynamicResource *dynamic_resource,const int sleep_time); 00146 00147 /** 00148 Add a NSDL endpoint resource (dynamic) 00149 @param dynamic_resource input the NSDL dynamic resource 00150 @param sleep_time input the observation sleep time in milliseconds (for observable resource only) 00151 @param use_observer input if true, use an appropriate ResourceObserver to observer. if false, the underlying resource will handle it 00152 @return instance to ourself 00153 */ 00154 OptionsBuilder &addResource(const DynamicResource *dynamic_resource,const int sleep_time,const bool use_observer); 00155 00156 /** 00157 Set the WiFi SSID 00158 @param ssid input the WiFi SSID 00159 */ 00160 OptionsBuilder &setWiFiSSID(char *ssid); 00161 00162 /** 00163 Set the WiFi AuthType 00164 @param auth_type input the WiFi AuthType 00165 */ 00166 OptionsBuilder &setWiFiAuthType(WiFiAuthTypes auth_type); 00167 00168 /** 00169 Set the WiFi AuthKey 00170 @param auth_key input the WiFi AuthKey 00171 */ 00172 OptionsBuilder &setWiFiAuthKey(char *auth_key); 00173 00174 /** 00175 Set the 802.15.4 Network ID 00176 @param network_id input the 802.15.4 mesh Network ID 00177 */ 00178 OptionsBuilder &setNetworkID(char *network_id); 00179 00180 /** 00181 Set the 802.15.4 Radio Channel 00182 @param channel input the 802.15.4 radio channel 00183 */ 00184 OptionsBuilder &setRadioChannel(int channel); 00185 00186 /** 00187 Build our our immutable self 00188 */ 00189 Options *build(); 00190 00191 }; 00192 00193 } // namespace Connector 00194 00195 #endif // __OPTIONS_BUILDER_H__
Generated on Wed Jul 13 2022 02:11:49 by 1.7.2