Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
CC32xxWiFi Class Reference

Provides the startup and mantainance methods for configuring and using the CC32xx Wi-Fi stack. More...

#include <CC32xxWiFi.hxx>

Inheritance diagram for CC32xxWiFi:
CC32xxWiFiInterface Singleton< CC32xxWiFi > CC32xxWiFiInterface Singleton< CC32xxWiFi >

Classes

struct  FatalErrorEvent
 CC32xx forward declaration Helper. More...
 
struct  HttpServerEvent
 CC32xx forward declaration Helper. More...
 
struct  HttpServerResponse
 CC32xx forward declaration Helper. More...
 
struct  NetAppEvent
 CC32xx forward declaration Helper. More...
 
struct  NetAppRequest
 CC32xx forward declaration Helper. More...
 
struct  NetAppResponse
 CC32xx forward declaration Helper. More...
 
struct  SockEvent
 CC32xx forward declaration Helper. More...
 
struct  SockTriggerEvent
 CC32xx forward declaration Helper. More...
 
struct  WlanEvent
 CC32xx forward declaration Helper. More...
 
struct  WlanNetworkEntry
 metadata for a WLAN netowrk entry. More...
 

Public Types

enum  WlanConnectionPolicy {
  WLAN_CONNECTION_NO_CHANGE , WLAN_CONNECTION_SCAN , WLAN_CONNECTION_FAST_RECONNECT , WLAN_CONNECTION_NO_CHANGE ,
  WLAN_CONNECTION_SCAN , WLAN_CONNECTION_FAST_RECONNECT
}
 The Wlan reconnect policy. More...
 
enum  WlanPowerPolicy {
  WLAN_NORMAL_POLICY , WLAN_LOW_LATENCY_POLICY , WLAN_LOW_POWER_POLICY , WLAN_ALWAYS_ON_POLICY ,
  WLAN_NO_CHANGE_POLICY , WLAN_NORMAL_POLICY , WLAN_LOW_LATENCY_POLICY , WLAN_LOW_POWER_POLICY ,
  WLAN_ALWAYS_ON_POLICY , WLAN_NO_CHANGE_POLICY
}
 The WLAN power policy. More...
 
enum  WlanConnectionPolicy {
  WLAN_CONNECTION_NO_CHANGE , WLAN_CONNECTION_SCAN , WLAN_CONNECTION_FAST_RECONNECT , WLAN_CONNECTION_NO_CHANGE ,
  WLAN_CONNECTION_SCAN , WLAN_CONNECTION_FAST_RECONNECT
}
 The Wlan reconnect policy. More...
 
enum  WlanPowerPolicy {
  WLAN_NORMAL_POLICY , WLAN_LOW_LATENCY_POLICY , WLAN_LOW_POWER_POLICY , WLAN_ALWAYS_ON_POLICY ,
  WLAN_NO_CHANGE_POLICY , WLAN_NORMAL_POLICY , WLAN_LOW_LATENCY_POLICY , WLAN_LOW_POWER_POLICY ,
  WLAN_ALWAYS_ON_POLICY , WLAN_NO_CHANGE_POLICY
}
 The WLAN power policy. More...
 
using PostFunction = std::function< void(uint16_t handle, uint32_t content_length, const uint8_t *md, size_t md_len, const uint8_t *payload, size_t payload_len, bool has_more)>
 This function type is used for POST callback operations to the application.
 
using PostFunction = std::function< void(uint16_t handle, uint32_t content_length, const uint8_t *md, size_t md_len, const uint8_t *payload, size_t payload_len, bool has_more)>
 This function type is used for POST callback operations to the application.
 
- Public Types inherited from CC32xxWiFiInterface
enum  SecurityType {
  SEC_OPEN , SEC_WEP , SEC_WPA2 , SEC_OPEN ,
  SEC_WEP , SEC_WPA2
}
 Security types. More...
 
enum  SecurityType {
  SEC_OPEN , SEC_WEP , SEC_WPA2 , SEC_OPEN ,
  SEC_WEP , SEC_WPA2
}
 Security types. More...
 

Public Member Functions

 CC32xxWiFi ()
 Constructor.
 
 ~CC32xxWiFi ()
 Destructor.
 
void test_mode_start ()
 Startup the Wi-Fi in test mode.
 
void start (WlanRole role=WlanRole::STA, WlanPowerPolicy power_policy=WLAN_NO_CHANGE_POLICY, WlanConnectionPolicy connection_policy=WLAN_CONNECTION_NO_CHANGE)
 Startup the Wi-Fi.
 
void stop ()
 Stops the Wi-Fi in preparation for a reboot.
 
bool is_started ()
 Get the started state of the network processor.
 
WlanConnectResult wlan_connect (const char *ssid, const char *security_key, SecurityType security_type)
 Connect to access point.
 
void wlan_disconnect ()
 Disconnects from the current AP.
 
void wlan_wps_pbc_initiate ()
 Initiate a WPS Push Button Control connection.
 
void wlan_setup_ap (const char *ssid, const char *security_key, SecurityType security_type) override
 Setup access point role credentials.
 
void wlan_get_ap_config (string *ssid, SecurityType *security_type)
 Retrieve current AP config.
 
int wlan_get_ap_station_count ()
 Retrieves how many stations are connected to the wifi in AP mode.
 
bool wlan_ready ()
 
WlanRole wlan_role ()
 Get the current Wi-Fi role.
 
void wlan_set_role (WlanRole new_role)
 Change the default Wlan Role.
 
WlanState wlan_startup_state ()
 
void connecting_update_blinker ()
 Updates the blinker based on connection state.
 
CountryCode wlan_country_code_get ()
 Get the current country code.
 
int wlan_country_code_set (CountryCode cc, bool restart=false)
 Set the current country code.
 
void wlan_set_scan_params (int mask, int min_rssi)
 Sets the scan parameters.
 
int wlan_profile_add (const char *ssid, SecurityType sec_type, const char *key, unsigned priority)
 Add a saved WLAN profile.
 
int wlan_profile_del (const char *ssid)
 Delete a saved WLAN profile.
 
int wlan_profile_del (int index) override
 Delete a saved WLAN profile.
 
int wlan_profile_get (int index, char ssid[], SecurityType *sec_type, uint32_t *priority)
 Get a saved WLAN profile by index.
 
bool wlan_profile_test_none ()
 Test if there are any saved profiles.
 
int wlan_power_policy_set (WlanPowerPolicy wpp)
 Set the power policy.
 
int wlan_power_policy_get (WlanPowerPolicy *wpp)
 Get the power policy.
 
void wlan_connection_policy_set (WlanConnectionPolicy policy)
 Sets connection policy to auto connect.
 
int wlan_network_list_get (WlanNetworkEntry *entries, size_t count)
 Get a list of available networks.
 
void wlan_rescan ()
 Initiate rescanning available networks.
 
void wlan_mac (uint8_t mac[6])
 Get the device MAC address.
 
void wlan_set_mac (uint8_t mac[6])
 Sets the device MAC address.
 
uint32_t wlan_ip ()
 Get the assigned IP address.
 
const char * wlan_ssid ()
 Get the SSID of the access point we are connected to.
 
int wlan_rssi ()
 Get the receive signal strength indicator.
 
void set_ip_acquired_callback (std::function< void(bool)> callback)
 
void run_on_network_thread (std::function< void()> callback)
 Executes the given function on the network thread.
 
void add_http_get_token_callback (const char *token_name, std::function< std::string()> callback)
 Add an HTTP get token callback.
 
void add_http_post_callback (const char *uri, PostFunction callback)
 Registers a handler for an HTTP POST operation.
 
bool get_post_data (uint16_t handle, void *buf, size_t *len)
 Retrieves additional payload for http POST operations.
 
void send_post_respose (uint16_t handle, uint16_t http_status=204, const string &redirect="")
 Sends a POST response.
 
void wlan_event_handler (WlanEvent *event)
 This function handles WLAN events.
 
void net_app_event_handler (NetAppEvent *event)
 This function handles network events such as IP acquisition, IP leased, IP released etc.
 
void sock_event_handler (SockEvent *event)
 This function handles socket events indication.
 
void trigger_event_handler (SockTriggerEvent *event)
 Notifies the service about a wifi asynchronous socket event callback.
 
void http_server_callback (HttpServerEvent *event, HttpServerResponse *response)
 This function handles http server callback indication.
 
void netapp_request_callback (NetAppRequest *request, NetAppResponse *response)
 This function handles netapp request callbacks.
 
void fatal_error_callback (FatalErrorEvent *event)
 This Function Handles the Fatal errors.
 
 CC32xxWiFi ()
 Constructor.
 
 ~CC32xxWiFi ()
 Destructor.
 
void test_mode_start ()
 Startup the Wi-Fi in test mode.
 
void start (WlanRole role=WlanRole::STA, WlanPowerPolicy power_policy=WLAN_NO_CHANGE_POLICY, WlanConnectionPolicy connection_policy=WLAN_CONNECTION_NO_CHANGE)
 Startup the Wi-Fi.
 
void stop ()
 Stops the Wi-Fi in preparation for a reboot.
 
bool is_started ()
 Get the started state of the network processor.
 
WlanConnectResult wlan_connect (const char *ssid, const char *security_key, SecurityType security_type)
 Connect to access point.
 
void wlan_disconnect ()
 Disconnects from the current AP.
 
void wlan_wps_pbc_initiate ()
 Initiate a WPS Push Button Control connection.
 
void wlan_setup_ap (const char *ssid, const char *security_key, SecurityType security_type) override
 Setup access point role credentials.
 
void wlan_get_ap_config (string *ssid, SecurityType *security_type)
 Retrieve current AP config.
 
int wlan_get_ap_station_count ()
 Retrieves how many stations are connected to the wifi in AP mode.
 
bool wlan_ready ()
 
WlanRole wlan_role ()
 Get the current Wi-Fi role.
 
void wlan_set_role (WlanRole new_role)
 Change the default Wlan Role.
 
WlanState wlan_startup_state ()
 
void connecting_update_blinker ()
 Updates the blinker based on connection state.
 
CountryCode wlan_country_code_get ()
 Get the current country code.
 
int wlan_country_code_set (CountryCode cc, bool restart=false)
 Set the current country code.
 
void wlan_set_scan_params (int mask, int min_rssi)
 Sets the scan parameters.
 
int wlan_profile_add (const char *ssid, SecurityType sec_type, const char *key, unsigned priority)
 Add a saved WLAN profile.
 
int wlan_profile_del (const char *ssid)
 Delete a saved WLAN profile.
 
int wlan_profile_del (int index) override
 Delete a saved WLAN profile.
 
int wlan_profile_get (int index, char ssid[], SecurityType *sec_type, uint32_t *priority)
 Get a saved WLAN profile by index.
 
bool wlan_profile_test_none ()
 Test if there are any saved profiles.
 
int wlan_power_policy_set (WlanPowerPolicy wpp)
 Set the power policy.
 
int wlan_power_policy_get (WlanPowerPolicy *wpp)
 Get the power policy.
 
void wlan_connection_policy_set (WlanConnectionPolicy policy)
 Sets connection policy to auto connect.
 
int wlan_network_list_get (WlanNetworkEntry *entries, size_t count)
 Get a list of available networks.
 
void wlan_rescan ()
 Initiate rescanning available networks.
 
void wlan_mac (uint8_t mac[6])
 Get the device MAC address.
 
void wlan_set_mac (uint8_t mac[6])
 Sets the device MAC address.
 
uint32_t wlan_ip ()
 Get the assigned IP address.
 
const char * wlan_ssid ()
 Get the SSID of the access point we are connected to.
 
int wlan_rssi ()
 Get the receive signal strength indicator.
 
void set_ip_acquired_callback (std::function< void(bool)> callback)
 
void run_on_network_thread (std::function< void()> callback)
 Executes the given function on the network thread.
 
void add_http_get_token_callback (const char *token_name, std::function< std::string()> callback)
 Add an HTTP get token callback.
 
void add_http_post_callback (const char *uri, PostFunction callback)
 Registers a handler for an HTTP POST operation.
 
bool get_post_data (uint16_t handle, void *buf, size_t *len)
 Retrieves additional payload for http POST operations.
 
void send_post_respose (uint16_t handle, uint16_t http_status=204, const string &redirect="")
 Sends a POST response.
 
void wlan_event_handler (WlanEvent *event)
 This function handles WLAN events.
 
void net_app_event_handler (NetAppEvent *event)
 This function handles network events such as IP acquisition, IP leased, IP released etc.
 
void sock_event_handler (SockEvent *event)
 This function handles socket events indication.
 
void trigger_event_handler (SockTriggerEvent *event)
 Notifies the service about a wifi asynchronous socket event callback.
 
void http_server_callback (HttpServerEvent *event, HttpServerResponse *response)
 This function handles http server callback indication.
 
void netapp_request_callback (NetAppRequest *request, NetAppResponse *response)
 This function handles netapp request callbacks.
 
void fatal_error_callback (FatalErrorEvent *event)
 This Function Handles the Fatal errors.
 

Static Public Member Functions

static std::string get_version ()
 Returns a string contianing the version numbers of the network interface.
 
static std::string get_version ()
 Returns a string contianing the version numbers of the network interface.
 
- Static Public Member Functions inherited from Singleton< CC32xxWiFi >
static CC32xxWiFiinstance ()
 
static bool exists ()
 

Static Public Attributes

static constexpr int PROFILE_DELETE_ALL = 0xFF
 the value passed to wlan_profile_del() to remove all profiles
 
static constexpr int NUM_PROFILES = 7
 What is the maximum number of profiles in the CC32xx.
 
static constexpr unsigned IPPROTO_TCP_TLS = 254
 Pass this option as protocol to socket to create a secure socket.
 
static constexpr unsigned SO_SIMPLELINK_SD = 65537
 Retrieves the socket descriptor for setting TLS parameters.
 

Private Member Functions

void set_default_state ()
 Set the CC32xx to its default state, including station mode.
 
void wlan_task ()
 Thread that will manage the WLAN connection inside object context.
 
void select_wakeup ()
 Asynchronously wakeup the select call.
 
void fd_remove (int16_t sd)
 Remove a socket from the known sockets that might be part of the sl_Select fdset.
 
void fd_set_read (int16_t sd)
 Add socket to the read fd set.
 
void fd_set_write (int16_t sd)
 Add socket to the write fd set.
 
string http_get_ip_address ()
 Get the IP address for a http request.
 
 DISALLOW_COPY_AND_ASSIGN (CC32xxWiFi)
 
void set_default_state ()
 Set the CC32xx to its default state, including station mode.
 
void wlan_task ()
 Thread that will manage the WLAN connection inside object context.
 
void select_wakeup ()
 Asynchronously wakeup the select call.
 
void fd_remove (int16_t sd)
 Remove a socket from the known sockets that might be part of the sl_Select fdset.
 
void fd_set_read (int16_t sd)
 Add socket to the read fd set.
 
void fd_set_write (int16_t sd)
 Add socket to the write fd set.
 
string http_get_ip_address ()
 Get the IP address for a http request.
 
 DISALLOW_COPY_AND_ASSIGN (CC32xxWiFi)
 

Static Private Member Functions

static uint8_t security_type_to_simplelink (SecurityType sec_type)
 Translates the SecurityType enum to the internal SimpleLink code.
 
static SecurityType security_type_from_simplelink (uint8_t sec_type)
 Translates the SimpleLink code to SecurityType enum.
 
static SecurityType security_type_from_scan (unsigned sec_type)
 Translates the SimpleLink code from the network scan to SecurityType enum.
 
static void * wlan_task_entry (void *context)
 Thread that will manage the WLAN connection.
 
static uint8_t security_type_to_simplelink (SecurityType sec_type)
 Translates the SecurityType enum to the internal SimpleLink code.
 
static SecurityType security_type_from_simplelink (uint8_t sec_type)
 Translates the SimpleLink code to SecurityType enum.
 
static SecurityType security_type_from_scan (unsigned sec_type)
 Translates the SimpleLink code from the network scan to SecurityType enum.
 
static void * wlan_task_entry (void *context)
 Thread that will manage the WLAN connection.
 

Private Attributes

uint32_t ipAddress
 assigned IP adress
 
char ssid [33]
 SSID of AP, or AP we are connected to.
 
std::function< void(bool)> ipAcquiredCallback_
 Callback for when IP is acquired.
 
std::vector< std::function< void()> > callbacks_
 List of callbacks to execute on the network thread.
 
std::vector< std::pair< const char *, std::function< std::string()> > > httpGetTokenCallbacks_
 List of callbacks for http get tokens.
 
std::vector< std::pair< const char *, PostFunction > > httpPostCallbacks_
 List of callbacks for http post handlers.
 
OSMutex lock_
 Protects callbacks_ vector.
 
int wakeup
 loopback socket to wakeup select()
 
int16_t rssi
 receive signal strength indicator
 
WlanRole wlanRole
 the Wi-Fi role we are in
 
WlanPowerPolicy wlanPowerPolicy
 the desired power policy
 
WlanConnectionPolicy connectionPolicy
 scan or reconnect to last AP
 
unsigned started: 1
 network processor started
 
unsigned connected: 1
 AP connected state.
 
unsigned connectionFailed: 1
 Connection attempt failed status.
 
unsigned ipAcquired: 1
 IP address aquired state.
 
unsigned ipLeased: 1
 IP address leased to a client(AP mode)
 
unsigned smartConfigStart: 1
 Smart config in progress.
 
unsigned securityFailure: 1
 Disconnected due to wrong password.
 

Friends

class ::NetworkSpace
 
class CC32xxSocket
 allow access to private members from CC32xxSocket
 

Additional Inherited Members

- Protected Member Functions inherited from CC32xxWiFiInterface
virtual ~CC32xxWiFiInterface ()
 Destructor.
 
virtual ~CC32xxWiFiInterface ()
 Destructor.
 

Detailed Description

Provides the startup and mantainance methods for configuring and using the CC32xx Wi-Fi stack.

This is designed to be a singleton. It should only be instantiated once.

Definition at line 91 of file net_cc3220/CC32xxWiFi.hxx.

Member Typedef Documentation

◆ PostFunction [1/2]

using CC32xxWiFi::PostFunction = std::function<void(uint16_t handle, uint32_t content_length, const uint8_t *md, size_t md_len, const uint8_t *payload, size_t payload_len, bool has_more)>

This function type is used for POST callback operations to the application.

Parameters
handlethe operation handle, needs to be provided to the future operations to fetch followup data and send response.
content_lengthvalue of the Content-Length header, or -1 if such a header is not found.
mdencoded metadata. See the CC32xx documentation on how metadata is encoded. The lifetime is restricted to this call inline.
md_lennumber of bytes in the metadata array
payloadthe content (or beginning of the content). The lifetime is restricted to this call inline.
payload_lenhow many bytes are in this chunk of the content
has_moretrue if there is a continuation of the payload, which needs to be fetched with get_post_data.

Definition at line 179 of file net_cc3220/CC32xxWiFi.hxx.

◆ PostFunction [2/2]

using CC32xxWiFi::PostFunction = std::function<void(uint16_t handle, uint32_t content_length, const uint8_t *md, size_t md_len, const uint8_t *payload, size_t payload_len, bool has_more)>

This function type is used for POST callback operations to the application.

Parameters
handlethe operation handle, needs to be provided to the future operations to fetch followup data and send response.
content_lengthvalue of the Content-Length header, or -1 if such a header is not found.
mdencoded metadata. See the CC32xx documentation on how metadata is encoded. The lifetime is restricted to this call inline.
md_lennumber of bytes in the metadata array
payloadthe content (or beginning of the content). The lifetime is restricted to this call inline.
payload_lenhow many bytes are in this chunk of the content
has_moretrue if there is a continuation of the payload, which needs to be fetched with get_post_data.

Definition at line 179 of file net_cc32xx/CC32xxWiFi.hxx.

Member Enumeration Documentation

◆ WlanConnectionPolicy [1/2]

The Wlan reconnect policy.

Enumerator
WLAN_CONNECTION_SCAN 

Scan for wifi networks and connect to the nearest that is stored in the profiles (by profile priority and security settings).

WLAN_CONNECTION_FAST_RECONNECT 

Reconnect to the last connected AP.

WLAN_CONNECTION_SCAN 

Scan for wifi networks and connect to the nearest that is stored in the profiles (by profile priority and security settings).

WLAN_CONNECTION_FAST_RECONNECT 

Reconnect to the last connected AP.

Definition at line 136 of file net_cc3220/CC32xxWiFi.hxx.

◆ WlanConnectionPolicy [2/2]

The Wlan reconnect policy.

Enumerator
WLAN_CONNECTION_SCAN 

Scan for wifi networks and connect to the nearest that is stored in the profiles (by profile priority and security settings).

WLAN_CONNECTION_FAST_RECONNECT 

Reconnect to the last connected AP.

WLAN_CONNECTION_SCAN 

Scan for wifi networks and connect to the nearest that is stored in the profiles (by profile priority and security settings).

WLAN_CONNECTION_FAST_RECONNECT 

Reconnect to the last connected AP.

Definition at line 136 of file net_cc32xx/CC32xxWiFi.hxx.

◆ WlanPowerPolicy [1/2]

The WLAN power policy.

Enumerator
WLAN_NORMAL_POLICY 

WLAN power policy normal.

WLAN_LOW_LATENCY_POLICY 

WLAN power policy low latency.

WLAN_LOW_POWER_POLICY 

WLAN power policy low power.

WLAN_ALWAYS_ON_POLICY 

WLAN power policy always on.

WLAN_NO_CHANGE_POLICY 

WLAN power policy to be left alone.

WLAN_NORMAL_POLICY 

WLAN power policy normal.

WLAN_LOW_LATENCY_POLICY 

WLAN power policy low latency.

WLAN_LOW_POWER_POLICY 

WLAN power policy low power.

WLAN_ALWAYS_ON_POLICY 

WLAN power policy always on.

WLAN_NO_CHANGE_POLICY 

WLAN power policy to be left alone.

Definition at line 147 of file net_cc3220/CC32xxWiFi.hxx.

◆ WlanPowerPolicy [2/2]

The WLAN power policy.

Enumerator
WLAN_NORMAL_POLICY 

WLAN power policy normal.

WLAN_LOW_LATENCY_POLICY 

WLAN power policy low latency.

WLAN_LOW_POWER_POLICY 

WLAN power policy low power.

WLAN_ALWAYS_ON_POLICY 

WLAN power policy always on.

WLAN_NO_CHANGE_POLICY 

WLAN power policy to be left alone.

WLAN_NORMAL_POLICY 

WLAN power policy normal.

WLAN_LOW_LATENCY_POLICY 

WLAN power policy low latency.

WLAN_LOW_POWER_POLICY 

WLAN power policy low power.

WLAN_ALWAYS_ON_POLICY 

WLAN power policy always on.

WLAN_NO_CHANGE_POLICY 

WLAN power policy to be left alone.

Definition at line 147 of file net_cc32xx/CC32xxWiFi.hxx.

Constructor & Destructor Documentation

◆ CC32xxWiFi()

CC32xxWiFi::CC32xxWiFi ( )

Constructor.

Definition at line 181 of file net_cc3220/CC32xxWiFi.cxx.

◆ ~CC32xxWiFi() [1/2]

CC32xxWiFi::~CC32xxWiFi ( )
inline

Destructor.

Definition at line 189 of file net_cc3220/CC32xxWiFi.hxx.

◆ ~CC32xxWiFi() [2/2]

CC32xxWiFi::~CC32xxWiFi ( )
inline

Destructor.

Definition at line 189 of file net_cc32xx/CC32xxWiFi.hxx.

Member Function Documentation

◆ add_http_get_token_callback() [1/2]

void CC32xxWiFi::add_http_get_token_callback ( const char *  token_name,
std::function< std::string()>  callback 
)
inline

Add an HTTP get token callback.

A get token is a simple macro substitution that is applied to all files (e.g. HTML, JS) served by the builtin webserver of the CC32xx. The token has a fixed form "__SL_G_*". The form "__SL_G_U*" is the form that is reserved for user defined tokens. The * can be any two characters that uniquely identify the token. When the token is found in an HTML file, the network processor will call the supplied callback in order for the user to return the substitution string. The result returned will be clipped at (MAX_TOKEN_VALUE_LEN - 1), which is (64 - 1) bytes. All tokens must be an exact match.

Use Case Example:

class SomeClass
{
public:
SomeClass()
{
add_http_get_token_callback("__SL_G_U.A", std::bind(&SomeClass::http_get, this));
}
private:
string http_get()
{
return "some_string";
}
}

In the example above, the string "__SL_G_U.A" when used in an HTML file will be recognized by the HTTP server replaced with result of the server calling SomeClass::http_get().

Additional documentation on the CC32xx HTTP Web Server can be found in the CC3100/CC3200 SimpleLink Wi-Fi Internet-on-a-Chip User's Guide

Parameters
token_nameThe token name to match. Must live for the entire lifetime of the binary. Must be of the form __SL_G_U??
callbackthe function to execute to give the replacement.

Definition at line 505 of file net_cc3220/CC32xxWiFi.hxx.

◆ add_http_get_token_callback() [2/2]

void CC32xxWiFi::add_http_get_token_callback ( const char *  token_name,
std::function< std::string()>  callback 
)
inline

Add an HTTP get token callback.

A get token is a simple macro substitution that is applied to all files (e.g. HTML, JS) served by the builtin webserver of the CC32xx. The token has a fixed form "__SL_G_*". The form "__SL_G_U*" is the form that is reserved for user defined tokens. The * can be any two characters that uniquely identify the token. When the token is found in an HTML file, the network processor will call the supplied callback in order for the user to return the substitution string. The result returned will be clipped at (MAX_TOKEN_VALUE_LEN - 1), which is (64 - 1) bytes. All tokens must be an exact match.

Use Case Example:

class SomeClass
{
public:
SomeClass()
{
add_http_get_token_callback("__SL_G_U.A", std::bind(&SomeClass::http_get, this));
}
private:
string http_get()
{
return "some_string";
}
}

In the example above, the string "__SL_G_U.A" when used in an HTML file will be recognized by the HTTP server replaced with result of the server calling SomeClass::http_get().

Additional documentation on the CC32xx HTTP Web Server can be found in the CC3100/CC3200 SimpleLink Wi-Fi Internet-on-a-Chip User's Guide

Parameters
token_nameThe token name to match. Must live for the entire lifetime of the binary. Must be of the form __SL_G_U??
callbackthe function to execute to give the replacement.

Definition at line 505 of file net_cc32xx/CC32xxWiFi.hxx.

◆ add_http_post_callback() [1/2]

void CC32xxWiFi::add_http_post_callback ( const char *  uri,
PostFunction  callback 
)
inline

Registers a handler for an HTTP POST operation.

Parameters
urithe target of the form submit, of the format "/foo/bar"
callbackthis function will be called from the network processor context when a POST happens to the given URI.

Definition at line 517 of file net_cc3220/CC32xxWiFi.hxx.

◆ add_http_post_callback() [2/2]

void CC32xxWiFi::add_http_post_callback ( const char *  uri,
PostFunction  callback 
)
inline

Registers a handler for an HTTP POST operation.

Parameters
urithe target of the form submit, of the format "/foo/bar"
callbackthis function will be called from the network processor context when a POST happens to the given URI.

Definition at line 517 of file net_cc32xx/CC32xxWiFi.hxx.

◆ connecting_update_blinker() [1/2]

void CC32xxWiFi::connecting_update_blinker ( )

Updates the blinker based on connection state.

Noop if wlan_ready() returns true.

Definition at line 876 of file net_cc3220/CC32xxWiFi.cxx.

◆ connecting_update_blinker() [2/2]

void CC32xxWiFi::connecting_update_blinker ( )

Updates the blinker based on connection state.

Noop if wlan_ready() returns true.

◆ fatal_error_callback() [1/2]

void CC32xxWiFi::fatal_error_callback ( CC32xxWiFi::FatalErrorEvent event)

This Function Handles the Fatal errors.

Parameters
event- Contains the fatal error data
Returns
None

Definition at line 1583 of file net_cc3220/CC32xxWiFi.cxx.

◆ fatal_error_callback() [2/2]

void CC32xxWiFi::fatal_error_callback ( FatalErrorEvent event)

This Function Handles the Fatal errors.

Parameters
event- Contains the fatal error data
Returns
None

◆ fd_remove() [1/2]

void CC32xxWiFi::fd_remove ( int16_t  sd)
private

Remove a socket from the known sockets that might be part of the sl_Select fdset.

Parameters
sdsocket descriptor to remove

Definition at line 1127 of file net_cc3220/CC32xxWiFi.cxx.

◆ fd_remove() [2/2]

void CC32xxWiFi::fd_remove ( int16_t  sd)
private

Remove a socket from the known sockets that might be part of the sl_Select fdset.

Parameters
sdsocket descriptor to remove

◆ fd_set_read() [1/2]

void CC32xxWiFi::fd_set_read ( int16_t  sd)
private

Add socket to the read fd set.

Parameters
sdsocket descriptor to add

Definition at line 1140 of file net_cc3220/CC32xxWiFi.cxx.

◆ fd_set_read() [2/2]

void CC32xxWiFi::fd_set_read ( int16_t  sd)
private

Add socket to the read fd set.

Parameters
sdsocket descriptor to add

◆ fd_set_write() [1/2]

void CC32xxWiFi::fd_set_write ( int16_t  sd)
private

Add socket to the write fd set.

Parameters
sdsocket descriptor to add

Definition at line 1158 of file net_cc3220/CC32xxWiFi.cxx.

◆ fd_set_write() [2/2]

void CC32xxWiFi::fd_set_write ( int16_t  sd)
private

Add socket to the write fd set.

Parameters
sdsocket descriptor to add

◆ get_post_data() [1/2]

bool CC32xxWiFi::get_post_data ( uint16_t  handle,
void *  buf,
size_t *  len 
)

Retrieves additional payload for http POST operations.

This function blocks the calling thread. After the lat chunk is retrieved, the caller must invoke the post response function.

Parameters
handlethe POST operation handle, given by the POST callback.
bufwhere to deposit additional data.
lenat input, set to the max number of bytes to store. Will be overwritten by the number of actual bytes that arrived.
Returns
true if there is additional data that needs to be fetched, false if this was the last chunk.

Definition at line 1533 of file net_cc3220/CC32xxWiFi.cxx.

◆ get_post_data() [2/2]

bool CC32xxWiFi::get_post_data ( uint16_t  handle,
void *  buf,
size_t *  len 
)

Retrieves additional payload for http POST operations.

This function blocks the calling thread. After the lat chunk is retrieved, the caller must invoke the post response function.

Parameters
handlethe POST operation handle, given by the POST callback.
bufwhere to deposit additional data.
lenat input, set to the max number of bytes to store. Will be overwritten by the number of actual bytes that arrived.
Returns
true if there is additional data that needs to be fetched, false if this was the last chunk.

◆ get_version()

std::string CC32xxWiFi::get_version ( )
static

Returns a string contianing the version numbers of the network interface.

Definition at line 1604 of file net_cc3220/CC32xxWiFi.cxx.

◆ http_get_ip_address() [1/2]

string CC32xxWiFi::http_get_ip_address ( )
inlineprivate

Get the IP address for a http request.

Returns
string representation of the IP address

Definition at line 656 of file net_cc3220/CC32xxWiFi.hxx.

◆ http_get_ip_address() [2/2]

string CC32xxWiFi::http_get_ip_address ( )
inlineprivate

Get the IP address for a http request.

Returns
string representation of the IP address

Definition at line 656 of file net_cc32xx/CC32xxWiFi.hxx.

◆ http_server_callback() [1/2]

void CC32xxWiFi::http_server_callback ( HttpServerEvent event,
HttpServerResponse response 
)

This function handles http server callback indication.

This is public only so that an extern "C" method can call it. DO NOT use directly.

Parameters
eventpointer to HTTP Server Event info
responsepointer to HTTP Server Response info

Definition at line 1403 of file net_cc3220/CC32xxWiFi.cxx.

◆ http_server_callback() [2/2]

void CC32xxWiFi::http_server_callback ( HttpServerEvent event,
HttpServerResponse response 
)

This function handles http server callback indication.

This is public only so that an extern "C" method can call it. DO NOT use directly.

Parameters
eventpointer to HTTP Server Event info
responsepointer to HTTP Server Response info

◆ is_started() [1/2]

bool CC32xxWiFi::is_started ( )
inline

Get the started state of the network processor.

Returns
true if started, else false

Definition at line 215 of file net_cc3220/CC32xxWiFi.hxx.

◆ is_started() [2/2]

bool CC32xxWiFi::is_started ( )
inline

Get the started state of the network processor.

Returns
true if started, else false

Definition at line 215 of file net_cc32xx/CC32xxWiFi.hxx.

◆ net_app_event_handler() [1/2]

void CC32xxWiFi::net_app_event_handler ( NetAppEvent event)

This function handles network events such as IP acquisition, IP leased, IP released etc.

This is public only so that an extern "C" method can call it. DO NOT use directly.

Parameters
eventPointer indicating device acquired IP

Definition at line 1255 of file net_cc3220/CC32xxWiFi.cxx.

◆ net_app_event_handler() [2/2]

void CC32xxWiFi::net_app_event_handler ( NetAppEvent event)

This function handles network events such as IP acquisition, IP leased, IP released etc.

This is public only so that an extern "C" method can call it. DO NOT use directly.

Parameters
eventPointer indicating device acquired IP

◆ netapp_request_callback() [1/2]

void CC32xxWiFi::netapp_request_callback ( NetAppRequest request,
NetAppResponse response 
)

This function handles netapp request callbacks.

This is public only so that an extern "C" method can call it. DO NOT use directly.

Parameters
requestpointer to NetApp Request info
responsepointer to NetApp Response info

Definition at line 1461 of file net_cc3220/CC32xxWiFi.cxx.

◆ netapp_request_callback() [2/2]

void CC32xxWiFi::netapp_request_callback ( NetAppRequest request,
NetAppResponse response 
)

This function handles netapp request callbacks.

This is public only so that an extern "C" method can call it. DO NOT use directly.

Parameters
requestpointer to NetApp Request info
responsepointer to NetApp Response info

◆ run_on_network_thread() [1/2]

void CC32xxWiFi::run_on_network_thread ( std::function< void()>  callback)

Executes the given function on the network thread.

Parameters
callbackisthe function to execute.

Definition at line 1115 of file net_cc3220/CC32xxWiFi.cxx.

◆ run_on_network_thread() [2/2]

void CC32xxWiFi::run_on_network_thread ( std::function< void()>  callback)

Executes the given function on the network thread.

Parameters
callbackisthe function to execute.

◆ security_type_from_scan() [1/2]

CC32xxWiFi::SecurityType CC32xxWiFi::security_type_from_scan ( unsigned  sec_type)
staticprivate

Translates the SimpleLink code from the network scan to SecurityType enum.

Parameters
sec_typesimplelink network scan security result
Returns
security type

Definition at line 222 of file net_cc3220/CC32xxWiFi.cxx.

◆ security_type_from_scan() [2/2]

static SecurityType CC32xxWiFi::security_type_from_scan ( unsigned  sec_type)
staticprivate

Translates the SimpleLink code from the network scan to SecurityType enum.

Parameters
sec_typesimplelink network scan security result
Returns
security type

◆ security_type_from_simplelink() [1/2]

CC32xxWiFi::SecurityType CC32xxWiFi::security_type_from_simplelink ( uint8_t  sec_type)
staticprivate

Translates the SimpleLink code to SecurityType enum.

Parameters
sec_typesimplelink security type
Returns
security type

Definition at line 241 of file net_cc3220/CC32xxWiFi.cxx.

◆ security_type_from_simplelink() [2/2]

static SecurityType CC32xxWiFi::security_type_from_simplelink ( uint8_t  sec_type)
staticprivate

Translates the SimpleLink code to SecurityType enum.

Parameters
sec_typesimplelink security type
Returns
security type

◆ security_type_to_simplelink() [1/2]

uint8_t CC32xxWiFi::security_type_to_simplelink ( SecurityType  sec_type)
staticprivate

Translates the SecurityType enum to the internal SimpleLink code.

Parameters
sec_typesecurity type
Returns
simplelink security type

Definition at line 208 of file net_cc3220/CC32xxWiFi.cxx.

◆ security_type_to_simplelink() [2/2]

static uint8_t CC32xxWiFi::security_type_to_simplelink ( SecurityType  sec_type)
staticprivate

Translates the SecurityType enum to the internal SimpleLink code.

Parameters
sec_typesecurity type
Returns
simplelink security type

◆ select_wakeup()

void CC32xxWiFi::select_wakeup ( )
private

Asynchronously wakeup the select call.

Definition at line 1087 of file net_cc3220/CC32xxWiFi.cxx.

◆ send_post_respose() [1/2]

void CC32xxWiFi::send_post_respose ( uint16_t  handle,
uint16_t  http_status = 204,
const string &  redirect = "" 
)

Sends a POST response.

Parameters
handlethe POST operation handle, given by the POST callback.
codeHTTP error code (e.g. 204 for success).
redirectoptional, if present, will send back a 302 redirect status with this URL (http_status will be ignored).

Definition at line 1550 of file net_cc3220/CC32xxWiFi.cxx.

◆ send_post_respose() [2/2]

void CC32xxWiFi::send_post_respose ( uint16_t  handle,
uint16_t  http_status = 204,
const string &  redirect = "" 
)

Sends a POST response.

Parameters
handlethe POST operation handle, given by the POST callback.
codeHTTP error code (e.g. 204 for success).
redirectoptional, if present, will send back a 302 redirect status with this URL (http_status will be ignored).

◆ set_default_state()

void CC32xxWiFi::set_default_state ( )
private

Set the CC32xx to its default state, including station mode.

Definition at line 891 of file net_cc3220/CC32xxWiFi.cxx.

◆ set_ip_acquired_callback() [1/2]

void CC32xxWiFi::set_ip_acquired_callback ( std::function< void(bool)>  callback)
inline

Definition at line 455 of file net_cc3220/CC32xxWiFi.hxx.

◆ set_ip_acquired_callback() [2/2]

void CC32xxWiFi::set_ip_acquired_callback ( std::function< void(bool)>  callback)
inline

Definition at line 455 of file net_cc32xx/CC32xxWiFi.hxx.

◆ sock_event_handler() [1/2]

void CC32xxWiFi::sock_event_handler ( SockEvent event)

This function handles socket events indication.

This is public only so that an extern "C" method can call it. DO NOT use directly.

Parameters
eventpointer to Socket Event Info

Definition at line 1344 of file net_cc3220/CC32xxWiFi.cxx.

◆ sock_event_handler() [2/2]

void CC32xxWiFi::sock_event_handler ( SockEvent event)

This function handles socket events indication.

This is public only so that an extern "C" method can call it. DO NOT use directly.

Parameters
eventpointer to Socket Event Info

◆ start() [1/2]

void CC32xxWiFi::start ( WlanRole  role = WlanRole::STA,
WlanPowerPolicy  power_policy = WLAN_NO_CHANGE_POLICY,
WlanConnectionPolicy  connection_policy = WLAN_CONNECTION_NO_CHANGE 
)

Startup the Wi-Fi.

Parameters
devicerole
power_policydesired power policy

Definition at line 699 of file net_cc3220/CC32xxWiFi.cxx.

◆ start() [2/2]

void CC32xxWiFi::start ( WlanRole  role = WlanRole::STA,
WlanPowerPolicy  power_policy = WLAN_NO_CHANGE_POLICY,
WlanConnectionPolicy  connection_policy = WLAN_CONNECTION_NO_CHANGE 
)

Startup the Wi-Fi.

Parameters
devicerole
power_policydesired power policy

◆ stop() [1/2]

void CC32xxWiFi::stop ( )

Stops the Wi-Fi in preparation for a reboot.

TODO: does this need to be called from a critical section?

Definition at line 720 of file net_cc3220/CC32xxWiFi.cxx.

◆ stop() [2/2]

void CC32xxWiFi::stop ( )

Stops the Wi-Fi in preparation for a reboot.

TODO: does this need to be called from a critical section?

◆ test_mode_start() [1/2]

void CC32xxWiFi::test_mode_start ( )

Startup the Wi-Fi in test mode.

This mode of operation does not support connection to an AP. This mode is only for RF testing. Test mode can be exited by stop().

Definition at line 620 of file net_cc3220/CC32xxWiFi.cxx.

◆ test_mode_start() [2/2]

void CC32xxWiFi::test_mode_start ( )

Startup the Wi-Fi in test mode.

This mode of operation does not support connection to an AP. This mode is only for RF testing. Test mode can be exited by stop().

◆ trigger_event_handler() [1/2]

void CC32xxWiFi::trigger_event_handler ( SockTriggerEvent event)

Notifies the service about a wifi asynchronous socket event callback.

This means that sl_Select needs to be re-run and certain sockets might need wakeup. DO NOT use directly.

Parameters
eventparameters from the socket.

Definition at line 1389 of file net_cc3220/CC32xxWiFi.cxx.

◆ trigger_event_handler() [2/2]

void CC32xxWiFi::trigger_event_handler ( SockTriggerEvent event)

Notifies the service about a wifi asynchronous socket event callback.

This means that sl_Select needs to be re-run and certain sockets might need wakeup. DO NOT use directly.

Parameters
eventparameters from the socket.

◆ wlan_connect() [1/2]

WlanConnectResult CC32xxWiFi::wlan_connect ( const char *  ssid,
const char *  security_key,
SecurityType  security_type 
)

Connect to access point.

Parameters
ssidaccess point ssid
security_keyaccess point security key
security_typespecifies security type
Returns
WlanConnectResult::OK upon success, else error on failure

Definition at line 731 of file net_cc3220/CC32xxWiFi.cxx.

◆ wlan_connect() [2/2]

WlanConnectResult CC32xxWiFi::wlan_connect ( const char *  ssid,
const char *  security_key,
SecurityType  security_type 
)

Connect to access point.

Parameters
ssidaccess point ssid
security_keyaccess point security key
security_typespecifies security type
Returns
WlanConnectResult::OK upon success, else error on failure

◆ wlan_connection_policy_set() [1/2]

void CC32xxWiFi::wlan_connection_policy_set ( WlanConnectionPolicy  policy)

Sets connection policy to auto connect.

Updates the Wifi fast-reconnect policy if desired.

Parameters
policythe desired policy

Definition at line 533 of file net_cc3220/CC32xxWiFi.cxx.

◆ wlan_connection_policy_set() [2/2]

void CC32xxWiFi::wlan_connection_policy_set ( WlanConnectionPolicy  policy)

Sets connection policy to auto connect.

Updates the Wifi fast-reconnect policy if desired.

Parameters
policythe desired policy

◆ wlan_country_code_get() [1/2]

CountryCode CC32xxWiFi::wlan_country_code_get ( )

Get the current country code.

Returns
current country code, CountryCode::UNKNOWN on error

Definition at line 261 of file net_cc3220/CC32xxWiFi.cxx.

◆ wlan_country_code_get() [2/2]

CountryCode CC32xxWiFi::wlan_country_code_get ( )

Get the current country code.

Returns
current country code, CountryCode::UNKNOWN on error

◆ wlan_country_code_set() [1/2]

int CC32xxWiFi::wlan_country_code_set ( CountryCode  cc,
bool  restart = false 
)

Set the current country code.

Parameters
cccountry code to set
restarttrue to restart NWP, else false, use extreme caution when restart = true;
Returns
0 upon success, else -1 on error

Definition at line 291 of file net_cc3220/CC32xxWiFi.cxx.

◆ wlan_country_code_set() [2/2]

int CC32xxWiFi::wlan_country_code_set ( CountryCode  cc,
bool  restart = false 
)

Set the current country code.

Parameters
cccountry code to set
restarttrue to restart NWP, else false, use extreme caution when restart = true;
Returns
0 upon success, else -1 on error

◆ wlan_disconnect()

void CC32xxWiFi::wlan_disconnect ( )

Disconnects from the current AP.

Definition at line 765 of file net_cc3220/CC32xxWiFi.cxx.

◆ wlan_event_handler() [1/2]

void CC32xxWiFi::wlan_event_handler ( WlanEvent event)

This function handles WLAN events.

This is public only so that an extern "C" method can call it. DO NOT use directly.

Parameters
eventpointer to WLAN Event Info

Definition at line 1176 of file net_cc3220/CC32xxWiFi.cxx.

◆ wlan_event_handler() [2/2]

void CC32xxWiFi::wlan_event_handler ( WlanEvent event)

This function handles WLAN events.

This is public only so that an extern "C" method can call it. DO NOT use directly.

Parameters
eventpointer to WLAN Event Info

◆ wlan_get_ap_config() [1/2]

void CC32xxWiFi::wlan_get_ap_config ( string *  ssid,
SecurityType security_type 
)

Retrieve current AP config.

Parameters
ssidwill be filled with the SSID of the AP
security_typewill be filled with the security type

Definition at line 837 of file net_cc3220/CC32xxWiFi.cxx.

◆ wlan_get_ap_config() [2/2]

void CC32xxWiFi::wlan_get_ap_config ( string *  ssid,
SecurityType security_type 
)

Retrieve current AP config.

Parameters
ssidwill be filled with the SSID of the AP
security_typewill be filled with the security type

◆ wlan_get_ap_station_count() [1/2]

int CC32xxWiFi::wlan_get_ap_station_count ( )

Retrieves how many stations are connected to the wifi in AP mode.

Returns
number of connected stations (0 to 4). If not in AP mode, returns 0.

Definition at line 859 of file net_cc3220/CC32xxWiFi.cxx.

◆ wlan_get_ap_station_count() [2/2]

int CC32xxWiFi::wlan_get_ap_station_count ( )

Retrieves how many stations are connected to the wifi in AP mode.

Returns
number of connected stations (0 to 4). If not in AP mode, returns 0.

◆ wlan_ip() [1/2]

uint32_t CC32xxWiFi::wlan_ip ( )
inline

Get the assigned IP address.

Returns
assigned IP address, else 0 if not assigned

Definition at line 430 of file net_cc3220/CC32xxWiFi.hxx.

◆ wlan_ip() [2/2]

uint32_t CC32xxWiFi::wlan_ip ( )
inline

Get the assigned IP address.

Returns
assigned IP address, else 0 if not assigned

Definition at line 430 of file net_cc32xx/CC32xxWiFi.hxx.

◆ wlan_mac() [1/2]

void CC32xxWiFi::wlan_mac ( uint8_t  mac[6])

Get the device MAC address.

Parameters
mac6 byte array which will hold the resulting MAC address.

Definition at line 602 of file net_cc3220/CC32xxWiFi.cxx.

◆ wlan_mac() [2/2]

void CC32xxWiFi::wlan_mac ( uint8_t  mac[6])

Get the device MAC address.

Parameters
mac6 byte array which will hold the resulting MAC address.

◆ wlan_network_list_get() [1/2]

int CC32xxWiFi::wlan_network_list_get ( WlanNetworkEntry entries,
size_t  count 
)

Get a list of available networks.

Parameters
entriesreturns a list of available network entries
countsize of entry list in number of elements, max 20
Returns
number of valid network entries in the list

Definition at line 582 of file net_cc3220/CC32xxWiFi.cxx.

◆ wlan_network_list_get() [2/2]

int CC32xxWiFi::wlan_network_list_get ( WlanNetworkEntry entries,
size_t  count 
)

Get a list of available networks.

Parameters
entriesreturns a list of available network entries
countsize of entry list in number of elements, max 20
Returns
number of valid network entries in the list

◆ wlan_power_policy_get() [1/2]

int CC32xxWiFi::wlan_power_policy_get ( WlanPowerPolicy wpp)

Get the power policy.

Parameters
wpppower policy to returned
Returns
0 upon success, else -1 on error

Definition at line 459 of file net_cc3220/CC32xxWiFi.cxx.

◆ wlan_power_policy_get() [2/2]

int CC32xxWiFi::wlan_power_policy_get ( WlanPowerPolicy wpp)

Get the power policy.

Parameters
wpppower policy to returned
Returns
0 upon success, else -1 on error

◆ wlan_power_policy_set() [1/2]

int CC32xxWiFi::wlan_power_policy_set ( WlanPowerPolicy  wpp)

Set the power policy.

Parameters
wpppower policy to set
Returns
0 upon success, else -1 on error

Definition at line 497 of file net_cc3220/CC32xxWiFi.cxx.

◆ wlan_power_policy_set() [2/2]

int CC32xxWiFi::wlan_power_policy_set ( WlanPowerPolicy  wpp)

Set the power policy.

Parameters
wpppower policy to set
Returns
0 upon success, else -1 on error

◆ wlan_profile_add() [1/2]

int CC32xxWiFi::wlan_profile_add ( const char *  ssid,
SecurityType  sec_type,
const char *  key,
unsigned  priority 
)

Add a saved WLAN profile.

Parameters
ssidWLAN SSID of the profile to save
sec_typeSecurityType of the profile to be saved
keypassword of the SSID, nullptr allowed if sec_type is SEC_OPEN
priorityconnection priority when more than one of the saved networks is available, 0 == lowest priority
Returns
resulting index in the list of profiles, else -1 on error

Definition at line 364 of file net_cc3220/CC32xxWiFi.cxx.

◆ wlan_profile_add() [2/2]

int CC32xxWiFi::wlan_profile_add ( const char *  ssid,
SecurityType  sec_type,
const char *  key,
unsigned  priority 
)

Add a saved WLAN profile.

Parameters
ssidWLAN SSID of the profile to save
sec_typeSecurityType of the profile to be saved
keypassword of the SSID, nullptr allowed if sec_type is SEC_OPEN
priorityconnection priority when more than one of the saved networks is available, 0 == lowest priority
Returns
resulting index in the list of profiles, else -1 on error

◆ wlan_profile_del() [1/4]

int CC32xxWiFi::wlan_profile_del ( const char *  ssid)

Delete a saved WLAN profile.

Parameters
ssidWLAN SSID of the profile to delete
Returns
0 upon success, else -1 on error

Definition at line 390 of file net_cc3220/CC32xxWiFi.cxx.

◆ wlan_profile_del() [2/4]

int CC32xxWiFi::wlan_profile_del ( const char *  ssid)

Delete a saved WLAN profile.

Parameters
ssidWLAN SSID of the profile to delete
Returns
0 upon success, else -1 on error

◆ wlan_profile_del() [3/4]

int CC32xxWiFi::wlan_profile_del ( int  index)
overridevirtual

Delete a saved WLAN profile.

Parameters
indexindex within saved profile list to remove, 0xFF removes all
Returns
0 upon success, else -1 on error

Implements CC32xxWiFiInterface.

Definition at line 382 of file net_cc3220/CC32xxWiFi.cxx.

◆ wlan_profile_del() [4/4]

int CC32xxWiFi::wlan_profile_del ( int  index)
overridevirtual

Delete a saved WLAN profile.

Parameters
indexindex within saved profile list to remove, 0xFF removes all
Returns
0 upon success, else -1 on error

Implements CC32xxWiFiInterface.

◆ wlan_profile_get() [1/2]

int CC32xxWiFi::wlan_profile_get ( int  index,
char  ssid[],
SecurityType sec_type,
uint32_t *  priority 
)

Get a saved WLAN profile by index.

Parameters
indexindex within saved profile list to get
ssid33 byte array that will return the ssid of the index
sec_typewill return the security type of the index
prioritywill return the priority of the index
Returns
0 upon success, else -1 on error

Definition at line 415 of file net_cc3220/CC32xxWiFi.cxx.

◆ wlan_profile_get() [2/2]

int CC32xxWiFi::wlan_profile_get ( int  index,
char  ssid[],
SecurityType sec_type,
uint32_t *  priority 
)

Get a saved WLAN profile by index.

Parameters
indexindex within saved profile list to get
ssid33 byte array that will return the ssid of the index
sec_typewill return the security type of the index
prioritywill return the priority of the index
Returns
0 upon success, else -1 on error

◆ wlan_profile_test_none() [1/2]

bool CC32xxWiFi::wlan_profile_test_none ( )

Test if there are any saved profiles.

Returns
true if there are no profiles saved, else false

Definition at line 442 of file net_cc3220/CC32xxWiFi.cxx.

◆ wlan_profile_test_none() [2/2]

bool CC32xxWiFi::wlan_profile_test_none ( )

Test if there are any saved profiles.

Returns
true if there are no profiles saved, else false

◆ wlan_ready() [1/2]

bool CC32xxWiFi::wlan_ready ( )
inline
Returns
true if the wlan interface is ready to establish outgoing connections.

Definition at line 258 of file net_cc3220/CC32xxWiFi.hxx.

◆ wlan_ready() [2/2]

bool CC32xxWiFi::wlan_ready ( )
inline
Returns
true if the wlan interface is ready to establish outgoing connections.

Definition at line 258 of file net_cc32xx/CC32xxWiFi.hxx.

◆ wlan_rescan()

void CC32xxWiFi::wlan_rescan ( )

Initiate rescanning available networks.

Definition at line 570 of file net_cc3220/CC32xxWiFi.cxx.

◆ wlan_role() [1/2]

WlanRole CC32xxWiFi::wlan_role ( )
inline

Get the current Wi-Fi role.

Returns
the current Wi-Fi role.

Definition at line 266 of file net_cc3220/CC32xxWiFi.hxx.

◆ wlan_role() [2/2]

WlanRole CC32xxWiFi::wlan_role ( )
inline

Get the current Wi-Fi role.

Returns
the current Wi-Fi role.

Definition at line 266 of file net_cc32xx/CC32xxWiFi.hxx.

◆ wlan_rssi() [1/2]

int CC32xxWiFi::wlan_rssi ( )
inline

Get the receive signal strength indicator.

Returns
receive signal strength

Definition at line 449 of file net_cc3220/CC32xxWiFi.hxx.

◆ wlan_rssi() [2/2]

int CC32xxWiFi::wlan_rssi ( )
inline

Get the receive signal strength indicator.

Returns
receive signal strength

Definition at line 449 of file net_cc32xx/CC32xxWiFi.hxx.

◆ wlan_set_mac() [1/2]

void CC32xxWiFi::wlan_set_mac ( uint8_t  mac[6])

Sets the device MAC address.

WARNING. The MAC address will be persistently set to the value indicated. Only a factory reset of the device can undo this operation. After calling this API there is no way to recover the factory MAC address. Make sure not to call this API too many times in the lifetime of the product, as flash wear is a concern.

Parameters
mac6 byte array which holds the desired MAC address.

Definition at line 612 of file net_cc3220/CC32xxWiFi.cxx.

◆ wlan_set_mac() [2/2]

void CC32xxWiFi::wlan_set_mac ( uint8_t  mac[6])

Sets the device MAC address.

WARNING. The MAC address will be persistently set to the value indicated. Only a factory reset of the device can undo this operation. After calling this API there is no way to recover the factory MAC address. Make sure not to call this API too many times in the lifetime of the product, as flash wear is a concern.

Parameters
mac6 byte array which holds the desired MAC address.

◆ wlan_set_role() [1/2]

void CC32xxWiFi::wlan_set_role ( WlanRole  new_role)

Change the default Wlan Role.

This will be used in the next start(...) if the UNKNOWN role is specified. The new setting takes effect when the device is restarted (either via reboot or stop + start).

Parameters
rolenew role. Must not be UNKNOWN

Definition at line 947 of file net_cc3220/CC32xxWiFi.cxx.

◆ wlan_set_role() [2/2]

void CC32xxWiFi::wlan_set_role ( WlanRole  new_role)

Change the default Wlan Role.

This will be used in the next start(...) if the UNKNOWN role is specified. The new setting takes effect when the device is restarted (either via reboot or stop + start).

Parameters
rolenew role. Must not be UNKNOWN

◆ wlan_set_scan_params() [1/2]

void CC32xxWiFi::wlan_set_scan_params ( int  mask,
int  min_rssi 
)

Sets the scan parameters.

Parameters
maskthe channel mask (bit 0 = channel1, bit1=channel2). If -1 then the channel mask is not changed.
min_rssithe minimal RSSI to return a wifi in the scan. If >= 0 then the min_rssi is not changed. (Default min_rssi is -95.)

Definition at line 332 of file net_cc3220/CC32xxWiFi.cxx.

◆ wlan_set_scan_params() [2/2]

void CC32xxWiFi::wlan_set_scan_params ( int  mask,
int  min_rssi 
)

Sets the scan parameters.

Parameters
maskthe channel mask (bit 0 = channel1, bit1=channel2). If -1 then the channel mask is not changed.
min_rssithe minimal RSSI to return a wifi in the scan. If >= 0 then the min_rssi is not changed. (Default min_rssi is -95.)

◆ wlan_setup_ap() [1/2]

void CC32xxWiFi::wlan_setup_ap ( const char *  ssid,
const char *  security_key,
SecurityType  security_type 
)
overridevirtual

Setup access point role credentials.

Parameters
ssidaccess point ssid
security_keyaccess point security key
security_typespecifies security type

Implements CC32xxWiFiInterface.

Definition at line 805 of file net_cc3220/CC32xxWiFi.cxx.

◆ wlan_setup_ap() [2/2]

void CC32xxWiFi::wlan_setup_ap ( const char *  ssid,
const char *  security_key,
SecurityType  security_type 
)
overridevirtual

Setup access point role credentials.

Parameters
ssidaccess point ssid
security_keyaccess point security key
security_typespecifies security type

Implements CC32xxWiFiInterface.

◆ wlan_ssid() [1/2]

const char * CC32xxWiFi::wlan_ssid ( )
inline

Get the SSID of the access point we are connected to.

In AP mode gives the current advertised AP.

Returns
SSID of the access point we are connected to or in AP mode the access point name of the current device.

Definition at line 440 of file net_cc3220/CC32xxWiFi.hxx.

◆ wlan_ssid() [2/2]

const char * CC32xxWiFi::wlan_ssid ( )
inline

Get the SSID of the access point we are connected to.

In AP mode gives the current advertised AP.

Returns
SSID of the access point we are connected to or in AP mode the access point name of the current device.

Definition at line 440 of file net_cc32xx/CC32xxWiFi.hxx.

◆ wlan_startup_state() [1/2]

WlanState CC32xxWiFi::wlan_startup_state ( )
inline
Returns
0 if !wlan_ready, else a debugging status code.

Definition at line 279 of file net_cc3220/CC32xxWiFi.hxx.

◆ wlan_startup_state() [2/2]

WlanState CC32xxWiFi::wlan_startup_state ( )
inline
Returns
0 if !wlan_ready, else a debugging status code.

Definition at line 279 of file net_cc32xx/CC32xxWiFi.hxx.

◆ wlan_task()

void CC32xxWiFi::wlan_task ( )
private

Thread that will manage the WLAN connection inside object context.

Definition at line 965 of file net_cc3220/CC32xxWiFi.cxx.

◆ wlan_task_entry() [1/2]

static void * CC32xxWiFi::wlan_task_entry ( void *  context)
inlinestaticprivate

Thread that will manage the WLAN connection.

Parameters
contextcontext passed into the stack.

Definition at line 623 of file net_cc3220/CC32xxWiFi.hxx.

◆ wlan_task_entry() [2/2]

static void * CC32xxWiFi::wlan_task_entry ( void *  context)
inlinestaticprivate

Thread that will manage the WLAN connection.

Parameters
contextcontext passed into the stack.

Definition at line 623 of file net_cc32xx/CC32xxWiFi.hxx.

◆ wlan_wps_pbc_initiate()

void CC32xxWiFi::wlan_wps_pbc_initiate ( )

Initiate a WPS Push Button Control connection.

Definition at line 781 of file net_cc3220/CC32xxWiFi.cxx.

Friends And Related Symbol Documentation

◆ ::NetworkSpace

friend class ::NetworkSpace
friend

Definition at line 595 of file net_cc3220/CC32xxWiFi.hxx.

◆ CC32xxSocket

CC32xxSocket
friend

allow access to private members from CC32xxSocket

Definition at line 697 of file net_cc3220/CC32xxWiFi.hxx.

Member Data Documentation

◆ callbacks_

std::vector< std::function< void()> > CC32xxWiFi::callbacks_
private

List of callbacks to execute on the network thread.

Definition at line 668 of file net_cc3220/CC32xxWiFi.hxx.

◆ connected

unsigned CC32xxWiFi::connected
private

AP connected state.

Definition at line 689 of file net_cc3220/CC32xxWiFi.hxx.

◆ connectionFailed

unsigned CC32xxWiFi::connectionFailed
private

Connection attempt failed status.

Definition at line 690 of file net_cc3220/CC32xxWiFi.hxx.

◆ connectionPolicy

WlanConnectionPolicy CC32xxWiFi::connectionPolicy
private

scan or reconnect to last AP

Definition at line 686 of file net_cc3220/CC32xxWiFi.hxx.

◆ httpGetTokenCallbacks_

std::vector< std::pair< const char *, std::function< std::string()> > > CC32xxWiFi::httpGetTokenCallbacks_
private

List of callbacks for http get tokens.

Definition at line 672 of file net_cc3220/CC32xxWiFi.hxx.

◆ httpPostCallbacks_

std::vector< std::pair< const char *, PostFunction > > CC32xxWiFi::httpPostCallbacks_
private

List of callbacks for http post handlers.

Definition at line 675 of file net_cc3220/CC32xxWiFi.hxx.

◆ ipAcquired

unsigned CC32xxWiFi::ipAcquired
private

IP address aquired state.

Definition at line 691 of file net_cc3220/CC32xxWiFi.hxx.

◆ ipAcquiredCallback_

std::function< void(bool)> CC32xxWiFi::ipAcquiredCallback_
private

Callback for when IP is acquired.

Definition at line 665 of file net_cc3220/CC32xxWiFi.hxx.

◆ ipAddress

uint32_t CC32xxWiFi::ipAddress
private

assigned IP adress

Definition at line 661 of file net_cc3220/CC32xxWiFi.hxx.

◆ ipLeased

unsigned CC32xxWiFi::ipLeased
private

IP address leased to a client(AP mode)

Definition at line 692 of file net_cc3220/CC32xxWiFi.hxx.

◆ IPPROTO_TCP_TLS

static constexpr unsigned CC32xxWiFi::IPPROTO_TCP_TLS = 254
staticconstexpr

Pass this option as protocol to socket to create a secure socket.

Definition at line 103 of file net_cc3220/CC32xxWiFi.hxx.

◆ lock_

OSMutex CC32xxWiFi::lock_
private

Protects callbacks_ vector.

Definition at line 678 of file net_cc3220/CC32xxWiFi.hxx.

◆ NUM_PROFILES

static constexpr int CC32xxWiFi::NUM_PROFILES = 7
staticconstexpr

What is the maximum number of profiles in the CC32xx.

Profile index is 0 to NUM_PROFILES-1.

Definition at line 100 of file net_cc3220/CC32xxWiFi.hxx.

◆ PROFILE_DELETE_ALL

static constexpr int CC32xxWiFi::PROFILE_DELETE_ALL = 0xFF
staticconstexpr

the value passed to wlan_profile_del() to remove all profiles

Definition at line 96 of file net_cc3220/CC32xxWiFi.hxx.

◆ rssi

int16_t CC32xxWiFi::rssi
private

receive signal strength indicator

Definition at line 682 of file net_cc3220/CC32xxWiFi.hxx.

◆ securityFailure

unsigned CC32xxWiFi::securityFailure
private

Disconnected due to wrong password.

Definition at line 694 of file net_cc3220/CC32xxWiFi.hxx.

◆ smartConfigStart

unsigned CC32xxWiFi::smartConfigStart
private

Smart config in progress.

Definition at line 693 of file net_cc3220/CC32xxWiFi.hxx.

◆ SO_SIMPLELINK_SD

static constexpr unsigned CC32xxWiFi::SO_SIMPLELINK_SD = 65537
staticconstexpr

Retrieves the socket descriptor for setting TLS parameters.

Definition at line 106 of file net_cc3220/CC32xxWiFi.hxx.

◆ ssid

char CC32xxWiFi::ssid
private

SSID of AP, or AP we are connected to.

Definition at line 662 of file net_cc3220/CC32xxWiFi.hxx.

◆ started

unsigned CC32xxWiFi::started
private

network processor started

Definition at line 688 of file net_cc3220/CC32xxWiFi.hxx.

◆ wakeup

int CC32xxWiFi::wakeup
private

loopback socket to wakeup select()

Definition at line 680 of file net_cc3220/CC32xxWiFi.hxx.

◆ wlanPowerPolicy

WlanPowerPolicy CC32xxWiFi::wlanPowerPolicy
private

the desired power policy

Definition at line 685 of file net_cc3220/CC32xxWiFi.hxx.

◆ wlanRole

WlanRole CC32xxWiFi::wlanRole
private

the Wi-Fi role we are in

Definition at line 684 of file net_cc3220/CC32xxWiFi.hxx.


The documentation for this class was generated from the following files: