TI's CC3100 host driver and demo. Experimental and a work in progress.
Wlan
Functions | |
_i16 | sl_WlanConnect (_i8 *pName, _i16 NameLen, _u8 *pMacAddr, SlSecParams_t *pSecParams, SlSecParamsExt_t *pSecExtParams) |
Connect to wlan network as a station. | |
_i16 | sl_WlanDisconnect (void) |
wlan disconnect | |
_i16 | sl_WlanProfileAdd (_i8 *pName, _i16 NameLen, _u8 *pMacAddr, SlSecParams_t *pSecParams, SlSecParamsExt_t *pSecExtParams, _u32 Priority, _u32 Options) |
add profile | |
_i16 | sl_WlanProfileGet (_i16 Index, _i8 *pName, _i16 *pNameLen, _u8 *pMacAddr, SlSecParams_t *pSecParams, SlGetSecParamsExt_t *pSecExtParams, _u32 *pPriority) |
get profile | |
_i16 | sl_WlanProfileDel (_i16 Index) |
Delete WLAN profile. | |
_i16 | sl_WlanPolicySet (_u8 Type, const _u8 Policy, _u8 *pVal, _u8 ValLen) |
Set policy values. | |
_i16 | sl_WlanPolicyGet (_u8 Type, _u8 Policy, _u8 *pVal, _u8 *pValLen) |
get policy values | |
_i16 | sl_WlanGetNetworkList (_u8 Index, _u8 Count, Sl_WlanNetworkEntry_t *pEntries) |
Gets the WLAN scan operation results. | |
_i16 | sl_WlanRxStatStart (void) |
Start collecting wlan RX statistics, for unlimited time. | |
_i16 | sl_WlanRxStatStop (void) |
Stop collecting wlan RX statistic, (if previous called sl_WlanRxStatStart) | |
_i16 | sl_WlanRxStatGet (SlGetRxStatResponse_t *pRxStat, _u32 Flags) |
Get wlan RX statistics. upon calling this command, the statistics counters will be cleared. | |
_i16 | sl_WlanSmartConfigStop (void) |
Stop Smart Config procedure. Once Smart Config will be stopped, Asynchronous event will be received - SL_OPCODE_WLAN_SMART_CONFIG_STOP_ASYNC_RESPONSE. | |
_i16 | sl_WlanSmartConfigStart (const _u32 groupIdBitmask, const _u8 cipher, const _u8 publicKeyLen, const _u8 group1KeyLen, const _u8 group2KeyLen, const _u8 *publicKey, const _u8 *group1Key, const _u8 *group2Key) |
Start Smart Config procedure. | |
_i16 | sl_WlanSetMode (const _u8 mode) |
Wlan set mode. | |
_i16 | sl_WlanSet (_u16 ConfigId, _u16 ConfigOpt, _u16 ConfigLen, _u8 *pValues) |
Internal function for setting WLAN configurations. | |
_i16 | sl_WlanGet (_u16 ConfigId, _u16 *pConfigOpt, _u16 *pConfigLen, _u8 *pValues) |
Internal function for getting WLAN configurations. | |
SlrxFilterID_t | sl_WlanRxFilterAdd (SlrxFilterRuleType_t RuleType, SlrxFilterFlags_t FilterFlags, const SlrxFilterRule_t *const Rule, const SlrxFilterTrigger_t *const Trigger, const SlrxFilterAction_t *const Action, SlrxFilterID_t *pFilterId) |
Adds new filter rule to the system. | |
_i16 | sl_WlanRxFilterSet (const SLrxFilterOperation_t RxFilterOperation, const _u8 *const pInputBuffer, _u16 InputbufferLength) |
Sets parameters to Rx filters. | |
_i16 | sl_WlanRxFilterGet (const SLrxFilterOperation_t RxFilterOperation, _u8 *pOutputBuffer, _u16 OutputbufferLength) |
Gets parameters of Rx filters. |
Function Documentation
_i16 sl_WlanConnect | ( | _i8 * | pName, |
_i16 | NameLen, | ||
_u8 * | pMacAddr, | ||
SlSecParams_t * | pSecParams, | ||
SlSecParamsExt_t * | pSecExtParams | ||
) |
Connect to wlan network as a station.
- Parameters:
-
[in] sec_type security types options:
- SL_SEC_TYPE_OPEN
- SL_SEC_TYPE_WEP
- SL_SEC_TYPE_WPA_WPA2
- SL_SEC_TYPE_WPA_ENT
- SL_SEC_TYPE_WPS_PBC
- SL_SEC_TYPE_WPS_PIN
[in] pName up to 32 bytes in case of STA the name is the SSID of the Access Point [in] NameLen name length [in] pMacAddr 6 bytes for MAC address [in] pSecParams Security parameters (use NULL key for SL_SEC_TYPE_OPEN) [in] pSecExtParams Enterprise parameters (set NULL in case Enterprise parameters is not in use)
- Returns:
- On success, zero is returned. On error, negative is returned In case error number (-71) is returned, it indicates a connection was activated while the device it running in AP role
- See also:
- sl_WlanDisconnect
- Note:
- belongs to ext_api
- Warning:
- In this version only single enterprise mode could be used SL_SEC_TYPE_WPA is a deprecated definition, the new definition is SL_SEC_TYPE_WPA_WPA2
Definition at line 73 of file cc3100_wlan.cpp.
_i16 sl_WlanDisconnect | ( | void | ) |
wlan disconnect
Disconnect connection
- Returns:
- 0 disconnected done, other already disconnected
- See also:
- sl_WlanConnect
- Note:
- belongs to ext_api
- Warning:
Definition at line 206 of file cc3100_wlan.cpp.
_i16 sl_WlanGet | ( | _u16 | ConfigId, |
_u16 * | pConfigOpt, | ||
_u16 * | pConfigLen, | ||
_u8 * | pValues | ||
) |
Internal function for getting WLAN configurations.
- Returns:
- On success, zero is returned. On error, -1 is returned
- Parameters:
-
[in] ConfigId - configuration id - SL_WLAN_CFG_AP_ID
- SL_WLAN_CFG_GENERAL_PARAM_ID
- SL_WLAN_CFG_P2P_PARAM_ID
[out] pConfigOpt - get configurations option - SL_WLAN_CFG_AP_ID
- WLAN_AP_OPT_SSID
Get SSID for AP mode.
Get up to 32 characters of SSID
This options takes _u8 as parameter - WLAN_AP_OPT_CHANNEL
Get channel for AP mode.
This option takes _u8 as a parameter - WLAN_AP_OPT_HIDDEN_SSID
Get Hidden SSID Mode for AP mode.Hidden options:
0: disabled
1: Send empty (length=0) SSID in beacon and ignore probe request for broadcast SSID
2: Clear SSID (ASCII 0), but keep the original length (this may be required with some
clients that do not support empty SSID) and ignore probe requests for broadcast SSID
This option takes _u8 as a parameter - WLAN_AP_OPT_SECURITY_TYPE
Get Security type for AP mode. Security options are:- Open security: SL_SEC_TYPE_OPEN
- WEP security: SL_SEC_TYPE_WEP
- WPA security: SL_SEC_TYPE_WPA_WPA2
This option takes _u8 as a parameter
- WLAN_AP_OPT_PASSWORD
Get Password for for AP mode (for WEP or for WPA):
Returns password - string, fills up to 64 characters.
This options takes _u8 buffer as parameter
- WLAN_AP_OPT_SSID
- SL_WLAN_CFG_GENERAL_PARAM_ID
- WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS
Get scan parameters. This option uses slWlanScanParamCommand_t as parameter - WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE
Get Country Code for AP mode
This options takes _u8 buffer as parameter - WLAN_GENERAL_PARAM_OPT_STA_TX_POWER
Get STA mode Tx power level
Number between 0-15, as dB offset from max power (0 indicates MAX power)
This options takes _u8 as parameter - WLAN_GENERAL_PARAM_OPT_AP_TX_POWER Get AP mode Tx power level
Number between 0-15, as dB offset from max power (0 indicates MAX power)
This options takes _u8 as parameter
- WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS
- SL_WLAN_CFG_P2P_PARAM_ID
- WLAN_P2P_OPT_CHANNEL_N_REGS
Get P2P Channels.
listen channel (either 1/6/11 for 2.4GHz)
listen regulatory class (81 for 2.4GHz)
oper channel (either 1/6/11 for 2.4GHz)
oper regulatory class (81 for 2.4GHz)
listen channel and regulatory class will determine the device listen channel during p2p find listen phase
oper channel and regulatory class will determine the operating channel preferred by this device (in case it is group owner this will be the operating channel)
channels should be one of the social channels (1/6/11). In case no listen/oper channel selected, a random 1/6/11 will be selected.
This option takes pointer to _u8[4] as parameter
- WLAN_P2P_OPT_CHANNEL_N_REGS
[out] pConfigLen - The length of the allocated memory as input, when the function complete, the value of this parameter would be the len that actually read from the device. If the device return length that is longer from the input value, the function will cut the end of the returned structure and will return SL_ESMALLBUF. [out] pValues - get configurations values
- See also:
- sl_WlanSet
- Note:
- Warning:
- Examples:
- WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS:
slWlanScanParamCommand_t ScanParamConfig; _u16 Option = WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS; _u16 OptionLen = sizeof(slWlanScanParamCommand_t); sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID ,&Option,&OptionLen,(_u8 *)&ScanParamConfig);
- WLAN_GENERAL_PARAM_OPT_AP_TX_POWER:
_i16 TXPower = 0; _u16 Option = WLAN_GENERAL_PARAM_OPT_AP_TX_POWER; _u16 OptionLen = sizeof(_i16); sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID ,&Option,&OptionLen,(_u8 *)&TXPower);
- WLAN_GENERAL_PARAM_OPT_STA_TX_POWER:
_i16 TXPower = 0; _u16 Option = WLAN_GENERAL_PARAM_OPT_STA_TX_POWER; _u16 OptionLen = sizeof(_i16); sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID ,&Option,&OptionLen,(_u8 *)&TXPower);
- WLAN_P2P_OPT_DEV_TYPE:
_i8 device_type[18]; _u16 len = 18; _u16 config_opt = WLAN_P2P_OPT_DEV_TYPE; sl_WlanGet(SL_WLAN_CFG_P2P_PARAM_ID, &config_opt , &len, (_u8* )device_type);
- WLAN_AP_OPT_SSID:
_i8 ssid[32]; _u16 len = 32; _u16 config_opt = WLAN_AP_OPT_SSID; sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt , &len, (_u8* )ssid);
- WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE:
_i8 country[3]; _u16 len = 3; _u16 config_opt = WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE; sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID, &config_opt, &len, (_u8* )country);
- WLAN_AP_OPT_CHANNEL:
_i8 channel; _u16 len = 1; _u16 config_opt = WLAN_AP_OPT_CHANNEL; sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt, &len, (_u8* )&channel);
- WLAN_AP_OPT_HIDDEN_SSID:
_u8 hidden; _u16 len = 1; _u16 config_opt = WLAN_AP_OPT_HIDDEN_SSID; sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt, &len, (_u8* )&hidden);
- WLAN_AP_OPT_SECURITY_TYPE:
_u8 sec_type; _u16 len = 1; _u16 config_opt = WLAN_AP_OPT_SECURITY_TYPE; sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt, &len, (_u8* )&sec_type);
- WLAN_AP_OPT_PASSWORD:
_u8 password[64]; _u16 len = 64; memset(password,0,64); _u16 config_opt = WLAN_AP_OPT_PASSWORD; sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt, &len, (_u8* )password);
- WLAN_P2P_OPT_CHANNEL_N_REGS:
_u16 listen_channel,listen_reg,oper_channel,oper_reg; _u16 len = 4; _u16 config_opt = WLAN_P2P_OPT_CHANNEL_N_REGS; _u8 channel_n_regs[4]; sl_WlanGet(SL_WLAN_CFG_P2P_PARAM_ID, &config_opt, &len, (_u8* )channel_n_regs); listen_channel = channel_n_regs[0]; listen_reg = channel_n_regs[1]; oper_channel = channel_n_regs[2]; oper_reg = channel_n_regs[3];
Definition at line 949 of file cc3100_wlan.cpp.
_i16 sl_WlanGetNetworkList | ( | _u8 | Index, |
_u8 | Count, | ||
Sl_WlanNetworkEntry_t * | pEntries | ||
) |
Gets the WLAN scan operation results.
Gets scan results , gets entry from scan result table
- Parameters:
-
[in] Index - Starting index identifier (range 0-19) for getting scan results [in] Count - How many entries to fetch. Max is (20-"Index"). [out] pEntries - pointer to an allocated Sl_WlanNetworkEntry_t. the number of array items should match "Count" sec_type: SL_SCAN_SEC_TYPE_OPEN, SL_SCAN_SEC_TYPE_WEP, SL_SCAN_SEC_TYPE_WPA or SL_SCAN_SEC_TYPE_WPA2
- Returns:
- Number of valid networks list items
- See also:
- Note:
- belongs to ext_api
- Warning:
- This command do not initiate any active scanning action
- Example:
An example of fetching max 10 results: Sl_WlanNetworkEntry_t netEntries[10]; _i16 resultsCount = sl_WlanGetNetworkList(0,10,&netEntries[0]); for(i=0; i< resultsCount; i++) { printf("%s\n",netEntries[i].ssid); }
Definition at line 584 of file cc3100_wlan.cpp.
_i16 sl_WlanPolicyGet | ( | _u8 | Type, |
_u8 | Policy, | ||
_u8 * | pVal, | ||
_u8 * | pValLen | ||
) |
get policy values
- Parameters:
-
[in] Type SL_POLICY_CONNECTION, SL_POLICY_SCAN, SL_POLICY_PM,SL_POLICY_P2P
[in] Policy argument may be set to any value
[out] The returned values, depends on each policy type, will be stored in the allocated buffer pointed by pVal with a maximum buffer length set by the calling function and pointed to by argument *pValLen
- Returns:
- On success, zero is returned. On error, -1 is returned
- See also:
- sl_WlanPolicySet
- Note:
- belongs to ext_api
- Warning:
- The value pointed by the argument *pValLen should be set to a value different from 0 and greater than the buffer length returned from the SL device. Otherwise, an error will be returned.
Definition at line 268 of file cc3100_wlan.cpp.
_i16 sl_WlanPolicySet | ( | _u8 | Type, |
const _u8 | Policy, | ||
_u8 * | pVal, | ||
_u8 | ValLen | ||
) |
Set policy values.
- Parameters:
-
[in] Type Type of policy to be modified. The Options are:
- SL_POLICY_CONNECTION
- SL_POLICY_SCAN
- SL_POLICY_PM
- SL_POLICY_P2P
[in] Policy The option value which depends on action type [in] pVal An optional value pointer [in] ValLen An optional value length, in bytes
- Returns:
- On success, zero is returned. On error, -1 is returned
- See also:
- sl_WlanPolicyGet
- Note:
- belongs to ext_api
- Warning:
- SL_POLICY_CONNECTION type defines three options available to connect the CC31xx device to the AP:
- If Auto Connect is set, the CC31xx device tries to automatically reconnect to one of its stored profiles, each time the connection fails or the device is rebooted.
To set this option, use:
sl_WlanPolicySet(SL_POLICY_CONNECTION,SL_CONNECTION_POLICY(1,0,0,0,0),NULL,0) - If Fast Connect is set, the CC31xx device tries to establish a fast connection to AP.
To set this option, use:
sl_WlanPolicySet(SL_POLICY_CONNECTION,SL_CONNECTION_POLICY(0,1,0,0,0),NULL,0) - (relevant for P2P mode only) - If Any P2P is set, CC31xx/CC32xx device tries to automatically connect to the first P2P device available,
supporting push button only. To set this option, use:
sl_WlanPolicySet(SL_POLICY_CONNECTION,SL_CONNECTION_POLICY(0,0,0,1,0),NULL,0) - For auto smart config upon restart (any command from Host will end this state) use:
sl_WlanPolicySet(SL_POLICY_CONNECTION,SL_CONNECTION_POLICY(0,0,0,0,1),NULL,0)
The options above could be combined to a single action, if more than one action is required.
- SL_POLICY_SCAN defines system scan time interval in case there is no connection. Default interval is 10 minutes.
After settings scan interval, an immediate scan is activated. The next scan will be based on the interval settings.
- For example, setting scan interval to 1 minute interval use:
_u32 intervalInSeconds = 60;
define SL_SCAN_ENABLE 1
sl_WlanPolicySet(SL_POLICY_SCAN,SL_SCAN_ENABLE, (_u8 *)&intervalInSeconds,sizeof(intervalInSeconds));
- For example, setting scan interval to 1 minute interval use:
- For example, disable scan:
define SL_SCAN_DISABLE 0
sl_WlanPolicySet(SL_POLICY_SCAN,SL_SCAN_DISABLE,0,0);
- SL_POLICY_PM defines a power management policy for Station mode only:
- For setting normal power management (default) policy use: sl_WlanPolicySet(SL_POLICY_PM , SL_NORMAL_POLICY, NULL,0)
- For setting low latency power management policy use: sl_WlanPolicySet(SL_POLICY_PM , SL_LOW_LATENCY_POLICY, NULL,0)
- For setting low power management policy use: sl_WlanPolicySet(SL_POLICY_PM , SL_LOW_POWER_POLICY, NULL,0)
- For setting always on power management policy use: sl_WlanPolicySet(SL_POLICY_PM , SL_ALWAYS_ON_POLICY, NULL,0)
- For setting Long Sleep Interval policy use:
_u16 PolicyBuff[4] = {0,0,800,0}; // PolicyBuff[2] is max sleep time in mSec
sl_WlanPolicySet(SL_POLICY_PM , SL_LONG_SLEEP_INTERVAL_POLICY, (_u8*)PolicyBuff,sizeof(PolicyBuff));
SL_POLICY_P2P defines p2p negotiation policy parameters for P2P role:
- To set intent negotiation value, set on of the following: SL_P2P_ROLE_NEGOTIATE - intent 3 SL_P2P_ROLE_GROUP_OWNER - intent 15 SL_P2P_ROLE_CLIENT - intent 0
- To set negotiation initiator value (initiator policy of first negotiation action frame), set on of the following: SL_P2P_NEG_INITIATOR_ACTIVE SL_P2P_NEG_INITIATOR_PASSIVE SL_P2P_NEG_INITIATOR_RAND_BACKOFF For example:
sl_WlanPolicySet(SL_POLICY_P2P, SL_P2P_POLICY(SL_P2P_ROLE_NEGOTIATE,SL_P2P_NEG_INITIATOR_RAND_BACKOFF),NULL,0)
Definition at line 229 of file cc3100_wlan.cpp.
_i16 sl_WlanProfileAdd | ( | _i8 * | pName, |
_i16 | NameLen, | ||
_u8 * | pMacAddr, | ||
SlSecParams_t * | pSecParams, | ||
SlSecParamsExt_t * | pSecExtParams, | ||
_u32 | Priority, | ||
_u32 | Options | ||
) |
add profile
When auto start is enabled, the device connects to a station from the profiles table. Up to 7 profiles are supported. If several profiles configured the device chose the highest priority profile, within each priority group, device will chose profile based on security policy, signal strength, etc parameters.
- Parameters:
-
[in] pName up to 32 bytes in case of STA the name is the SSID of the Access Point in case of P2P the name is the remote device name [in] NameLen name length [in] pMacAddr 6 bytes for MAC address [in] pSecParams Security parameters - security type (SL_SEC_TYPE_OPEN,SL_SEC_TYPE_WEP,SL_SEC_TYPE_WPA_WPA2, SL_SEC_TYPE_P2P_PBC,SL_SEC_TYPE_P2P_PIN_KEYPAD,SL_SEC_TYPE_P2P_PIN_DISPLAY, SL_SEC_TYPE_WPA_ENT), key, and key length in case of p2p security type pin the key refers to pin code [in] pSecExtParams Enterprise parameters - identity, identity length, Anonymous, Anonymous length, CertIndex (not supported, certificates need to be placed in a specific file ID), EapMethod.Use NULL in case Enterprise parameters is not in use [in] Priority profile priority. Lowest priority: 0 [in] Options Not supported
- Returns:
- On success, profile stored index is returned. On error, negative value is returned
- See also:
- sl_WlanProfileGet , sl_WlanProfileDel
- Note:
- belongs to ext_api
- Warning:
- Only one Enterprise profile is supported. Please Note that in case of adding an existing profile (compared by pName,pMACAddr and security type) the old profile will be deleted and the same index will be returned. SL_SEC_TYPE_WPA is a deprecated definition, the new definition is SL_SEC_TYPE_WPA_WPA2
Definition at line 327 of file cc3100_wlan.cpp.
_i16 sl_WlanProfileDel | ( | _i16 | Index ) |
Delete WLAN profile.
Delete WLAN profile
- Parameters:
-
[in] index number of profile to delete.Possible values are 0 to 6. Index value 255 will delete all saved profiles
- Returns:
- On success, zero is returned. On error, -1 is returned
- See also:
- sl_WlanProfileAdd , sl_WlanProfileGet
- Note:
- belongs to ext_api
- Warning:
Definition at line 553 of file cc3100_wlan.cpp.
_i16 sl_WlanProfileGet | ( | _i16 | Index, |
_i8 * | pName, | ||
_i16 * | pNameLen, | ||
_u8 * | pMacAddr, | ||
SlSecParams_t * | pSecParams, | ||
SlGetSecParamsExt_t * | pSecExtParams, | ||
_u32 * | pPriority | ||
) |
get profile
read profile from the device
- Parameters:
-
[in] Index profile stored index, if index does not exists error is return [out] pName up to 32 bytes, in case of sta mode the name of the Access Point in case of p2p mode the name of the Remote Device [out] pNameLen name length [out] pMacAddr 6 bytes for MAC address [out] pSecParams security parameters - security type (LAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2, WLAN_SEC_P2P_PBC, WLAN_SEC_P2P_PIN_KEYPAD or WLAN_SEC_P2P_DISPLAY), key and key length are not in case of p2p security type pin the key refers to pin code return due to security reasons. [out] pSecExtParams enterprise parameters - identity, identity length, Anonymous, Anonymous length CertIndex (not supported), EapMethod. [out] Priority profile priority
- Returns:
- On success, Profile security type is returned (0 or positive number). On error, -1 is returned
- See also:
- sl_WlanProfileAdd , sl_WlanProfileDel
- Note:
- belongs to ext_api
- Warning:
Definition at line 496 of file cc3100_wlan.cpp.
SlrxFilterID_t sl_WlanRxFilterAdd | ( | SlrxFilterRuleType_t | RuleType, |
SlrxFilterFlags_t | FilterFlags, | ||
const SlrxFilterRule_t *const | Rule, | ||
const SlrxFilterTrigger_t *const | Trigger, | ||
const SlrxFilterAction_t *const | Action, | ||
SlrxFilterID_t * | pFilterId | ||
) |
Adds new filter rule to the system.
- Parameters:
-
[in] RuleType The rule type [in] FilterFlags Flags which set the type of header rule Args and sets the persistent flag [in] pRule Determine the filter rule logic [in] pTrigger Determine when the rule is triggered also sets rule parent. [in] pAction Sets the action to be executed in case the match functions pass [out] pFilterId The filterId which was created
- Returns:
- On success, zero is returned. Otherwise error code is returned
Definition at line 668 of file cc3100_wlan.cpp.
_i16 sl_WlanRxFilterGet | ( | const SLrxFilterOperation_t | RxFilterOperation, |
_u8 * | pOutputBuffer, | ||
_u16 | OutputbufferLength | ||
) |
Gets parameters of Rx filters.
- Parameters:
-
[in] RxFilterOperation possible operations : - SL_FILTER_RETRIEVE_ENABLE_STATE - Retrieves the enable disable status
- SL_FILTER_PRE_PREPARED_RETRIEVE_CREATE_REMOVE_STATE - Retrieves the pre-prepared filters creation status
[in] pOutputBuffer The buffer input is _WlanRxFilterRetrieveEnableStatusCommandResponseBuff_t: - SL_FILTER_RETRIEVE_ENABLE_STATE The buffer input is _WlanRxFilterPrePreparedFiltersCommandResponseBuff_t:
- SL_FILTER_PRE_PREPARED_RETRIEVE_CREATE_REMOVE_STATE
[in] OutputbufferLength The length in byte of the output buffer
- Returns:
- On success, zero is returned. Otherwise error code is returned
Definition at line 725 of file cc3100_wlan.cpp.
_i16 sl_WlanRxFilterSet | ( | const SLrxFilterOperation_t | RxFilterOperation, |
const _u8 *const | pInputBuffer, | ||
_u16 | InputbufferLength | ||
) |
Sets parameters to Rx filters.
- Parameters:
-
[in] RxFilterOperation possible operations : - SL_ENABLE_DISABLE_RX_FILTER - Enables filter in a filter list
- SL_REMOVE_RX_FILTER - Removes filter from memory ( to remove from flash call SL_STORE_RX_FILTERS after this command)
- SL_STORE_RX_FILTERS - Save the filters for persistent
- SL_UPDATE_RX_FILTER_ARGS - Update the arguments of existing filter
- SL_FILTER_PRE_PREPARED_SET_CREATE_REMOVE_STATE - Change the default creation of the pre-prepared filters
[in] pInputBuffer options: The buffer input is _WlanRxFilterOperationCommandBuff_t: - SL_ENABLE_DISABLE_RX_FILTER
- SL_REMOVE_RX_FILTER
- SL_STORE_RX_FILTERS The buffer input is _WlanRxFilterUpdateArgsCommandBuff_t:
- SL_UPDATE_RX_FILTER_ARGS The buffer input is _WlanRxFilterPrePreparedFiltersCommandBuff_t:
- SL_FILTER_PRE_PREPARED_SET_CREATE_REMOVE_STATE
- Parameters:
-
[in] InputbufferLength The length in byte of the input buffer
- Returns:
- On success, zero is returned. Otherwise error code is returned
Definition at line 698 of file cc3100_wlan.cpp.
_i16 sl_WlanRxStatGet | ( | SlGetRxStatResponse_t * | pRxStat, |
_u32 | Flags | ||
) |
Get wlan RX statistics. upon calling this command, the statistics counters will be cleared.
- Parameters:
-
[in] Flags should be 0 ( not applicable right now, will be added the future ) [in] pRxStat a pointer to SlGetRxStatResponse_t filled with Rx statistics results
- Returns:
- On success, zero is returned. On error, -1 is returned
- See also:
- sl_WlanRxStatStart sl_WlanRxStatStop
- Note:
- belongs to ext_api
- Warning:
Definition at line 775 of file cc3100_wlan.cpp.
_i16 sl_WlanRxStatStart | ( | void | ) |
Start collecting wlan RX statistics, for unlimited time.
- Returns:
- On success, zero is returned. On error, -1 is returned
- See also:
- sl_WlanRxStatStop sl_WlanRxStatGet
- Note:
- belongs to ext_api
- Warning:
- This API is deprecated and should be removed for next release
- Example:
Getting wlan RX statistics: void RxStatCollectTwice() { SlGetRxStatResponse_t rxStat; _i16 rawSocket; _i8 DataFrame[200]; struct SlTimeval_t timeval; timeval.tv_sec = 0; // Seconds timeval.tv_usec = 20000; // Microseconds. 10000 microseconds resolution sl_WlanRxStatStart(); // set statistics mode rawSocket = sl_Socket(SL_AF_RF, SL_SOCK_RAW, eChannel); // set timeout - in case we have no activity for the specified channel sl_SetSockOpt(rawSocket,SL_SOL_SOCKET,SL_SO_RCVTIMEO, &timeval, sizeof(timeval)); // Enable receive timeout status = sl_Recv(rawSocket, DataFrame, sizeof(DataFrame), 0); Sleep(1000); // sleep for 1 sec sl_WlanRxStatGet(&rxStat,0); // statistics has been cleared upon read Sleep(1000); // sleep for 1 sec sl_WlanRxStatGet(&rxStat,0); }
Definition at line 761 of file cc3100_wlan.cpp.
_i16 sl_WlanRxStatStop | ( | void | ) |
Stop collecting wlan RX statistic, (if previous called sl_WlanRxStatStart)
- Returns:
- On success, zero is returned. On error, -1 is returned
- See also:
- sl_WlanRxStatStart sl_WlanRxStatGet
- Note:
- belongs to ext_api
- Warning:
- This API is deprecated and should be removed for next release
Definition at line 768 of file cc3100_wlan.cpp.
_i16 sl_WlanSet | ( | _u16 | ConfigId, |
_u16 | ConfigOpt, | ||
_u16 | ConfigLen, | ||
_u8 * | pValues | ||
) |
Internal function for setting WLAN configurations.
- Returns:
- On success, zero is returned. On error one of the following error codes returned:
- CONF_ERROR (-1)
- CONF_NVMEM_ACCESS_FAILED (-2)
- CONF_OLD_FILE_VERSION (-3)
- CONF_ERROR_NO_SUCH_COUNTRY_CODE (-4)
- Parameters:
-
[in] ConfigId - configuration id - SL_WLAN_CFG_AP_ID
- SL_WLAN_CFG_GENERAL_PARAM_ID
- SL_WLAN_CFG_P2P_PARAM_ID
[in] ConfigOpt - configurations option - SL_WLAN_CFG_AP_ID
- WLAN_AP_OPT_SSID
Set SSID for AP mode.
This options takes _u8 buffer as parameter - WLAN_AP_OPT_CHANNEL
Set channel for AP mode.
The channel is dependant on the country code which is set. i.e. for "US" the channel should be in the range of [1-11]
This option takes _u8 as a parameter - WLAN_AP_OPT_HIDDEN_SSID
Set Hidden SSID Mode for AP mode.Hidden options:
0: disabled
1: Send empty (length=0) SSID in beacon and ignore probe request for broadcast SSID
2: Clear SSID (ASCII 0), but keep the original length (this may be required with some
clients that do not support empty SSID) and ignore probe requests for broadcast SSID
This option takes _u8 as a parameter - WLAN_AP_OPT_SECURITY_TYPE
Set Security type for AP mode. Security options are:- Open security: SL_SEC_TYPE_OPEN
- WEP security: SL_SEC_TYPE_WEP
- WPA security: SL_SEC_TYPE_WPA_WPA2
This option takes _u8 pointer as a parameter
- WLAN_AP_OPT_PASSWORD
Set Password for for AP mode (for WEP or for WPA):
Password - for WPA: 8 - 63 characters
for WEP: 5 / 13 characters (ascii)
This options takes _u8 buffer as parameter
- WLAN_AP_OPT_SSID
- SL_WLAN_CFG_GENERAL_PARAM_ID
- WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE
Set Country Code for AP mode
This options takes _u8 2 bytes buffer as parameter - WLAN_GENERAL_PARAM_OPT_STA_TX_POWER
Set STA mode Tx power level
Number between 0-15, as dB offset from max power (0 will set MAX power)
This options takes _u8 as parameter - WLAN_GENERAL_PARAM_OPT_AP_TX_POWER Set AP mode Tx power level
Number between 0-15, as dB offset from max power (0 will set MAX power)
This options takes _u8 as parameter - WLAN_GENERAL_PARAM_OPT_INFO_ELEMENT Set Info Element for AP mode.
The Application can set up to MAX_PRIVATE_INFO_ELEMENTS_SUPPROTED info elements per Role (AP / P2P GO).
To delete an info element use the relevant index and length = 0.
The Application can set up to MAX_PRIVATE_INFO_ELEMENTS_SUPPROTED to the same role.
However, for AP - no more than INFO_ELEMENT_MAX_TOTAL_LENGTH_AP bytes can be stored for all info elements.
For P2P GO - no more than INFO_ELEMENT_MAX_TOTAL_LENGTH_P2P_GO bytes can be stored for all info elements.
This option takes sl_protocol_WlanSetInfoElement_t as parameter
- WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE
- SL_WLAN_CFG_P2P_PARAM_ID
- WLAN_P2P_OPT_DEV_TYPE
Set P2P Device type.Maximum length of 17 characters. Device type is published under P2P I.E,
allows to make devices easier to recognize.
In case no device type is set, the default type is "1-0050F204-1"
This options takes _u8 buffer as parameter - WLAN_P2P_OPT_CHANNEL_N_REGS
Set P2P Channels.
listen channel (either 1/6/11 for 2.4GHz)
listen regulatory class (81 for 2.4GHz)
oper channel (either 1/6/11 for 2.4GHz)
oper regulatory class (81 for 2.4GHz)
listen channel and regulatory class will determine the device listen channel during p2p find listen phase
oper channel and regulatory class will determine the operating channel preferred by this device (in case it is group owner this will be the operating channel)
channels should be one of the social channels (1/6/11). In case no listen/oper channel selected, a random 1/6/11 will be selected. This option takes pointer to _u8[4] as parameter
- WLAN_P2P_OPT_DEV_TYPE
[in] ConfigLen - configurations len [in] pValues - configurations values
- See also:
- Note:
- Warning:
- Examples:
- WLAN_AP_OPT_SSID:
_u8 str[33]; memset(str, 0, 33); memcpy(str, ssid, len); // ssid string of 32 characters sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SSID, strlen(ssid), str);
- WLAN_AP_OPT_CHANNEL:
_u8 val = channel; sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_CHANNEL, 1, (_u8 *)&val);
- WLAN_AP_OPT_HIDDEN_SSID:
_u8 val = hidden; sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_HIDDEN_SSID, 1, (_u8 *)&val);
- WLAN_AP_OPT_SECURITY_TYPE:
_u8 val = SL_SEC_TYPE_WPA_WPA2; sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SECURITY_TYPE, 1, (_u8 *)&val);
- WLAN_AP_OPT_PASSWORD:
_u8 str[65]; _u16 len = strlen(password); memset(str, 0, 65); memcpy(str, password, len); sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_PASSWORD, len, (_u8 *)str);
- WLAN_GENERAL_PARAM_OPT_STA_TX_POWER:
_u8 stapower=(_u8)power; sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, WLAN_GENERAL_PARAM_OPT_STA_TX_POWER,1,(_u8 *)&stapower);
- WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE:
_u8* str = (_u8 *) country; // string of 2 characters. i.e. - "US" sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE, 2, str);
- WLAN_GENERAL_PARAM_OPT_AP_TX_POWER:
_u8 appower=(_u8)power; sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, WLAN_GENERAL_PARAM_OPT_AP_TX_POWER,1,(_u8 *)&appower);
- WLAN_P2P_OPT_DEV_TYPE:
_u8 str[17]; _u16 len = strlen(device_type); memset(str, 0, 17); memcpy(str, device_type, len); sl_WlanSet(SL_WLAN_CFG_P2P_PARAM_ID, WLAN_P2P_OPT_DEV_TYPE, len, str);
- WLAN_P2P_OPT_CHANNEL_N_REGS:
_u8 str[4]; str[0] = (_u8)11; // listen channel str[1] = (_u8)81; // listen regulatory class str[2] = (_u8)6; // oper channel str[3] = (_u8)81; // oper regulatory class sl_WlanSet(SL_WLAN_CFG_P2P_PARAM_ID, WLAN_P2P_OPT_CHANNEL_N_REGS, 4, str);
- WLAN_GENERAL_PARAM_OPT_INFO_ELEMENT:
sl_protocol_WlanSetInfoElement_t infoele; infoele.index = Index; // Index of the info element. range: 0 - MAX_PRIVATE_INFO_ELEMENTS_SUPPROTED infoele.role = Role; // INFO_ELEMENT_AP_ROLE (0) or INFO_ELEMENT_P2P_GO_ROLE (1) infoele.ie.id = Id; // Info element ID. if INFO_ELEMENT_DEFAULT_ID (0) is set, ID will be set to 221. // Organization unique ID. If all 3 bytes are zero - it will be replaced with 08,00,28. infoele.ie.oui[0] = Oui0; // Organization unique ID first Byte infoele.ie.oui[1] = Oui1; // Organization unique ID second Byte infoele.ie.oui[2] = Oui2; // Organization unique ID third Byte infoele.ie.length = Len; // Length of the info element. must be smaller than 253 bytes memset(infoele.ie.data, 0, INFO_ELEMENT_MAX_SIZE); if ( Len <= INFO_ELEMENT_MAX_SIZE ) { memcpy(infoele.ie.data, IE, Len); // Info element. length of the info element is [0-252] sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID,WLAN_GENERAL_PARAM_OPT_INFO_ELEMENT,sizeof(sl_protocol_WlanSetInfoElement_t),(_u8* ) &infoele); } sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID,WLAN_GENERAL_PARAM_OPT_INFO_ELEMENT,sizeof(sl_protocol_WlanSetInfoElement_t),(_u8* ) &infoele);
Definition at line 910 of file cc3100_wlan.cpp.
_i16 sl_WlanSetMode | ( | const _u8 | mode ) |
Wlan set mode.
Setting WLAN mode
- Parameters:
-
[in] mode - WLAN mode to start the CC31xx device. Possible options are: - ROLE_STA - for WLAN station mode
- ROLE_AP - for WLAN AP mode
- ROLE_P2P -for WLAN P2P mode
- Returns:
- 0 - if mode was set correctly
- Note:
- belongs to ext_api
- Warning:
- After setting the mode the system must be restarted for activating the new mode
- Example:
//Switch from any role to STA: sl_WlanSetMode(ROLE_STA); sl_Stop(0); sl_Start(NULL,NULL,NULL);
Definition at line 876 of file cc3100_wlan.cpp.
_i16 sl_WlanSmartConfigStart | ( | const _u32 | groupIdBitmask, |
const _u8 | cipher, | ||
const _u8 | publicKeyLen, | ||
const _u8 | group1KeyLen, | ||
const _u8 | group2KeyLen, | ||
const _u8 * | publicKey, | ||
const _u8 * | group1Key, | ||
const _u8 * | group2Key | ||
) |
Start Smart Config procedure.
- The target of the procedure is to let the
device to gain the network parameters: SSID and Password (if network is secured)
and to connect to it once located in the network range.
An external application should be used on a device connected to any mobile network.
The external application will transmit over the air the network parameters in secured manner.
The Password may be decrypted using a Key.
The decryption method may be decided in the command or embedded in the Flash.
The procedure can be activated for 1-3 group ID in the range of BIT_0 - BIT_15 where the default group ID id 0 (BIT_0)
Once Smart Config has ended successfully, Asynchronous event will be received -
SL_OPCODE_WLAN_SMART_CONFIG_START_ASYNC_RESPONSE.
The Event will hold the SSID and an extra field that might have been delivered as well (i.e. - device name)
- Parameters:
-
[in] groupIdBitmask - each bit represent a group ID that should be searched. The Default group ID id BIT_0. 2 more group can be searched in addition. The range is BIT_0 - BIT_15. [in] chiper - 0: check in flash, 1 - AES, 0xFF - do not check in flash [in] publicKeyLen - public key len (used for the default group ID - BIT_0) [in] group1KeyLen - group ID1 length [in] group2KeyLen - group ID2 length [in] publicKey - public key (used for the default group ID - BIT_0) [in] group1Key - group ID1 key [in] group2Key - group ID2 key [out] none
- Returns:
- 0 - if Smart Config started successfully.
- See also:
- sl_WlanSmartConfigStop
- Note:
- belongs to ext_api
- Warning:
An example of starting smart Config on group ID's 0 + 1 + 2 sl_WlanSmartConfigStart(7, //group ID's (BIT_0 | BIT_1 | BIT_2) 1, //decrypt key by AES method 16, //decryption key length for group ID0 16, //decryption key length for group ID1 16, //decryption key length for group ID2 "Key0Key0Key0Key0", //decryption key for group ID0 "Key1Key1Key1Key1", //decryption key for group ID1 "Key2Key2Key2Key2" //decryption key for group ID2 );
Definition at line 823 of file cc3100_wlan.cpp.
_i16 sl_WlanSmartConfigStop | ( | void | ) |
Stop Smart Config procedure. Once Smart Config will be stopped, Asynchronous event will be received - SL_OPCODE_WLAN_SMART_CONFIG_STOP_ASYNC_RESPONSE.
- Parameters:
-
[in] none [out] none
- Returns:
- 0 - if Stop Smart Config is about to be executed without errors.
- See also:
- sl_WlanSmartConfigStart
- Note:
- belongs to ext_api
- Warning:
- This API is deprecated and should be removed for next release
Definition at line 791 of file cc3100_wlan.cpp.
Generated on Tue Jul 12 2022 22:55:21 by 1.7.2