CHENGQI YANG / SmartLab_MuRata
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SoftAPConfig.h Source File

SoftAPConfig.h

00001 #ifndef SmartLab_MuRata_Config_SoftAPConfig
00002 #define SmartLab_MuRata_Config_SoftAPConfig
00003 
00004 #include "WIFINetwork.h"
00005 
00006 namespace SmartLabMuRata
00007 {
00008 /*
00009 * OnOff = 0 indicates AP is to be turned off. The rest of the parameters are ignored.
00010 * BSSID is not required
00011 * !!! cannot be WEP and WIFI_SECURITY_WPA_AES_PSK !!!
00012 */
00013 class SoftAPConfig : public WIFINetwork
00014 {
00015 public :
00016     enum State {
00017         /**
00018         * indicates AP is to be turned off. The rest of the parameters are ignored.
00019         */
00020         OFF = 0x00,
00021 
00022         /**
00023         * indicates turning on soft AP using existing NVM parameters.
00024         */
00025         ON_NVM = 0x01,
00026 
00027         /**
00028         * indicates turning on AP with the parameters provided. If the soft AP is already on, it is first turned off.
00029         */
00030         ON_PARAMETERS = 0x02,
00031     };
00032 
00033     SoftAPConfig(State state, const char * SSID = NULL, const SecurityMode securityMode = WIFI_SECURITY_OPEN, const char * securityKey = NULL);
00034 
00035     State GetOnOffStatus();
00036 
00037     char GetPersistency();
00038 
00039     /**
00040     * OFF
00041     * ON_NVM
00042     * ON_PARAMETERS
00043     */
00044     SoftAPConfig * SetOnOffState(const State onOff);
00045 
00046     SoftAPConfig * SetPersistency(const bool persistency);
00047 
00048     virtual SoftAPConfig * SetSecurityKey(const char * SecurityKey);
00049 
00050     virtual SoftAPConfig * SetBSSID(const char * BSSID);
00051 
00052     virtual SoftAPConfig * SetSSID(const char * SSID);
00053 
00054     /**
00055     * Supported values :
00056     * WIFI_SECURITY_OPEN
00057     * WIFI_SECURITY_WPA_TKIP_PSK
00058     * WIFI_SECURITY_WPA2_AES_PSK
00059     * WIFI_SECURITY_WPA2_MIXED_PSK
00060     */
00061     virtual SoftAPConfig * SetSecurityMode(const SecurityMode securityMode);
00062 
00063     virtual SoftAPConfig * SetChannel(const char channel);
00064 
00065 private :
00066     State state;
00067 
00068     /**
00069     * Persistency=1 indicates the soft AP’s on/off state and parameters (if OnOff = 2) will be saved in NVM.
00070     * For example, if OnOff =0 and Persistency=1, the soft AP will not be turned on after a reset.
00071     */
00072     bool persistency;
00073 };
00074 }
00075 
00076 #endif