observe updates

Fork of mbedConnectorInterface by Doug Anson

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Options.h Source File

Options.h

Go to the documentation of this file.
00001 /**
00002  * @file    Options.h
00003  * @brief   mbed CoAP Options (immutable OptionsBuilder instance) 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_H__
00024 #define __OPTIONS_H__
00025 
00026 // Static Resources
00027 #include "StaticResource.h"
00028 
00029 // Dynamic Resources
00030 #include "DynamicResource.h"
00031 
00032 // include the mbed connector resource list
00033 #include "mbedConnectorInterface.h"
00034 
00035 // determine if we have seen rtos.h yet or not...
00036 #ifdef RTOS_H
00037     // we will use the ThreadedResourceObserver if needed
00038     #define CONNECTOR_USING_THREADS   1
00039 #endif
00040 
00041 // include the resource observer includes here so that they are not required in main.cpp
00042 #include "ThreadedResourceObserver.h"
00043 #include "TickerResourceObserver.h"
00044 
00045 // Vector support
00046 #include <vector>
00047 
00048 // Resources list
00049 typedef vector<StaticResource *> StaticResourcesList;
00050 typedef vector<DynamicResource *> DynamicResourcesList;
00051 typedef vector<ResourceObserver *> ResourceObserversList;
00052 
00053 // WiFi Security types
00054 typedef enum {
00055     WIFI_WPA_PERSONAL,
00056     WIFI_WPA2_PERSONAL,
00057     WIFI_WEP,
00058     WIFI_NUM_TYPES
00059 } WiFiAuthTypes;
00060 
00061 namespace Connector {
00062 
00063 /** Options class
00064  */
00065 class Options
00066 {
00067 public:
00068     /**
00069     Default constructor
00070     */
00071     Options();
00072 
00073     /**
00074     Copy constructor
00075     */
00076     Options(const Options &opt);
00077 
00078     /**
00079     Destructor
00080     */
00081     virtual ~Options();
00082 
00083     /**
00084     Get the node lifetime
00085     */
00086     char *getLifetime();
00087 
00088     /**
00089     Get the NSP domain
00090     */
00091     string getDomain();
00092 
00093     /**
00094     Get the node name
00095     */
00096     string getEndpointNodename();
00097 
00098     /**
00099     Get the node type
00100     */
00101     string getEndpointType();
00102 
00103     /**
00104     Get the NSP port number
00105     */
00106     int getNSPPortNumber();
00107 
00108     /**
00109     Get the node radio channel list
00110     */
00111     uint32_t getRadioChannelList();
00112 
00113     /**
00114     Get the NSP read update period
00115     */
00116     int getReadUpdatePeriod();
00117 
00118     /**
00119     Get the NSP address
00120     */
00121     uint8_t *getNSPAddress();
00122 
00123     /**
00124     Get the node MAC address
00125     */
00126     uint8_t *getMACAddress();
00127 
00128     /**
00129     Get the list of static resources
00130     */
00131     StaticResourcesList *getStaticResourceList();
00132 
00133     /**
00134     Get the list of dynamic resources
00135     */
00136     DynamicResourcesList *getDynamicResourceList();
00137     
00138     /**
00139     Get the WiFi SSID
00140     */
00141     string getWiFiSSID();
00142     
00143     /**
00144     Get the WiFi Auth Type
00145     */
00146     WiFiAuthTypes getWiFiAuthType();
00147     
00148     /**
00149     Get the WiFi Auth Key
00150     */
00151     string getWiFiAuthKey();
00152     
00153     /**
00154     Get the 802.15.4 Network ID
00155     */
00156     string getNetworkID();
00157     
00158     /**
00159     Get the 802.15.4 Radio channel
00160     */
00161     uint8_t getRadioChannel();
00162 
00163 protected:
00164     // mDS Resources
00165     char                *m_lifetime;
00166     string               m_domain;
00167     string               m_node_name;
00168     string               m_endpoint_type;
00169     int                  m_rd_update_period;
00170     int                  m_nsp_port;
00171     uint8_t              m_nsp_address[NSP_IP_ADDRESS_LENGTH];
00172     
00173     // WiFi Resources
00174     string               m_wifi_ssid;
00175     string               m_wifi_auth_key;
00176     WiFiAuthTypes        m_wifi_auth_type;
00177     
00178     // 802.15.4 Resources
00179     string               m_network_id;
00180     uint32_t             m_channel_list;
00181     uint8_t              m_mac_address[NODE_MAC_ADDRESS_LENGTH];
00182     uint8_t              m_channel;
00183     
00184     // Endpoint Resources
00185     StaticResourcesList   m_static_resources;
00186     DynamicResourcesList  m_dynamic_resources;
00187     ResourceObserversList m_resource_observers;
00188 };
00189 
00190 } // namespace Connector
00191 
00192 #endif // __OPTIONS_H__