Doug Anson / mbedConnectorInterface

Dependents:   IoT_LED_demo ServoTest uWater_Project hackathon ... more

Files at this revision

API Documentation at this revision

Comitter:
ansond
Date:
Thu Feb 05 14:49:04 2015 +0000
Parent:
14:5cfaeee144bc
Child:
16:383ad1356963
Commit message:
added WiFi configuration parameters to Options and OptionsBuilder

Changed in this revision

api/Options.cpp Show annotated file Show diff for this revision Revisions of this file
api/Options.h Show annotated file Show diff for this revision Revisions of this file
api/OptionsBuilder.cpp Show annotated file Show diff for this revision Revisions of this file
api/OptionsBuilder.h Show annotated file Show diff for this revision Revisions of this file
--- a/api/Options.cpp	Tue Feb 03 06:51:34 2015 +0000
+++ b/api/Options.cpp	Thu Feb 05 14:49:04 2015 +0000
@@ -105,4 +105,19 @@
     return &this->m_dynamic_resources;
 }
 
+// WiFi SSID
+string Options::getWiFiSSID() {
+    return this->m_wifi_ssid;
+}
+
+// WiFi AuthType
+WiFiAuthTypes Options::getWiFiAuthType() {
+    return this->m_wifi_auth_type;
+}
+
+// WiFi AuthKey
+string Options::getWiFiAuthKey() {
+    return this->m_wifi_auth_key;
+}
+
 } // namespace Connector
--- a/api/Options.h	Tue Feb 03 06:51:34 2015 +0000
+++ b/api/Options.h	Thu Feb 05 14:49:04 2015 +0000
@@ -39,6 +39,14 @@
 typedef vector<StaticResource *> StaticResourcesList;
 typedef vector<DynamicResource *> DynamicResourcesList;
 
+// WiFi Security types
+typedef enum {
+    WIFI_WPA_PERSONAL,
+    WIFI_WPA2_PERSONAL,
+    WIFI_WEP,
+    WIFI_NUM_TYPES
+} WiFiAuthTypes;
+
 namespace Connector {
 
 /** Options class
@@ -115,6 +123,21 @@
     Get the list of dynamic resources
     */
     DynamicResourcesList *getDynamicResourceList();
+    
+    /**
+    Get the WiFi SSID
+    */
+    string getWiFiSSID();
+    
+    /**
+    Get the WiFi Auth Type
+    */
+    WiFiAuthTypes getWiFiAuthType();
+    
+    /**
+    Get the WiFi Auth Key
+    */
+    string getWiFiAuthKey();
 
 protected:
     char                *m_lifetime;
@@ -128,6 +151,11 @@
     uint8_t              m_mac_address[NODE_MAC_ADDRESS_LENGTH];
     StaticResourcesList  m_static_resources;
     DynamicResourcesList m_dynamic_resources;
+    
+    // WiFi Resources
+    string               m_wifi_ssid;
+    string               m_wifi_auth_key;
+    WiFiAuthTypes        m_wifi_auth_type;
 };
 
 } // namespace Connector
--- a/api/OptionsBuilder.cpp	Tue Feb 03 06:51:34 2015 +0000
+++ b/api/OptionsBuilder.cpp	Thu Feb 05 14:49:04 2015 +0000
@@ -147,6 +147,27 @@
     return *this;
 }
 
+// set WiFi SSID
+OptionsBuilder &OptionsBuilder::setWiFiSSID(char *ssid)
+{
+    this->m_wifi_ssid = string(ssid);
+    return *this;
+}
+    
+// set WiFi AuthType
+OptionsBuilder &OptionsBuilder::setWiFiAuthType(WiFiAuthTypes auth_type)
+{
+    this->m_wifi_auth_type = auth_type;
+    return *this;
+}
+
+// set WiFi AuthKey
+OptionsBuilder &OptionsBuilder::setWiFiAuthKey(char *auth_key)
+{
+    this->m_wifi_auth_key = string(auth_key);
+    return *this;
+}
+
 // build out our immutable self
 Options *OptionsBuilder::build()
 {
--- a/api/OptionsBuilder.h	Tue Feb 03 06:51:34 2015 +0000
+++ b/api/OptionsBuilder.h	Thu Feb 05 14:49:04 2015 +0000
@@ -130,6 +130,24 @@
     OptionsBuilder &addResource(const DynamicResource *static_resource);
 
     /**
+    Set the WiFi SSID
+    @param ssid input the WiFi SSID
+    */
+    OptionsBuilder &setWiFiSSID(char *ssid);
+    
+    /**
+    Set the WiFi AuthType
+    @param auth_type input the WiFi AuthType
+    */
+    OptionsBuilder &setWiFiAuthType(WiFiAuthTypes auth_type);
+    
+    /**
+    Set the WiFi AuthKey
+    @param auth_key input the WiFi AuthKey
+    */
+    OptionsBuilder &setWiFiAuthKey(char *auth_key);
+    
+    /**
     Build our our immutable self
     */
     Options *build();