Wlan

Functions

_i16 sl_WlanConnect (const _i8 *pName, const _i16 NameLen, const _u8 *pMacAddr, const SlSecParams_t *pSecParams, const SlSecParamsExt_t *pSecExtParams)
 Connect to wlan network as a station. More...
 
_i16 sl_WlanDisconnect (void)
 wlan disconnect More...
 
_i16 sl_WlanProfileAdd (const _i8 *pName, const _i16 NameLen, const _u8 *pMacAddr, const SlSecParams_t *pSecParams, const SlSecParamsExt_t *pSecExtParams, const _u32 Priority, const _u32 Options)
 add profile More...
 
_i16 sl_WlanProfileGet (const _i16 Index, _i8 *pName, _i16 *pNameLen, _u8 *pMacAddr, SlSecParams_t *pSecParams, SlGetSecParamsExt_t *pSecExtParams, _u32 *pPriority)
 get profile More...
 
_i16 sl_WlanProfileDel (const _i16 Index)
 Delete WLAN profile. More...
 
_i16 sl_WlanPolicySet (const _u8 Type, const _u8 Policy, _u8 *pVal, const _u8 ValLen)
 Set policy values. More...
 
_i16 sl_WlanPolicyGet (const _u8 Type, _u8 Policy, _u8 *pVal, _u8 *pValLen)
 get policy values More...
 
_i16 sl_WlanGetNetworkList (const _u8 Index, const _u8 Count, Sl_WlanNetworkEntry_t *pEntries)
 Gets the WLAN scan operation results. More...
 
_i16 sl_WlanRxStatStart (void)
 Start collecting wlan RX statistics, for unlimited time. More...
 
_i16 sl_WlanRxStatStop (void)
 Stop collecting wlan RX statistic, (if previous called sl_WlanRxStatStart) More...
 
_i16 sl_WlanRxStatGet (SlGetRxStatResponse_t *pRxStat, const _u32 Flags)
 Get wlan RX statistics. upon calling this command, the statistics counters will be cleared. More...
 
_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. More...
 
_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. More...
 
_i16 sl_WlanSetMode (const _u8 mode)
 Wlan set mode. More...
 
_i16 sl_WlanSet (const _u16 ConfigId, const _u16 ConfigOpt, const _u16 ConfigLen, const _u8 *pValues)
 Internal function for setting WLAN configurations. More...
 
_i16 sl_WlanGet (const _u16 ConfigId, _u16 *pConfigOpt, _u16 *pConfigLen, _u8 *pValues)
 Internal function for getting WLAN configurations. More...
 
_i16 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. More...
 
_i16 sl_WlanRxFilterSet (const SLrxFilterOperation_t RxFilterOperation, const _u8 *const pInputBuffer, _u16 InputbufferLength)
 Sets parameters to Rx filters. More...
 
_i16 sl_WlanRxFilterGet (const SLrxFilterOperation_t RxFilterOperation, _u8 *pOutputBuffer, _u16 OutputbufferLength)
 Gets parameters of Rx filters. More...
 

Enumerations

enum  SlRateIndex_e {
  RATE_1M = 1,
  RATE_2M = 2,
  RATE_5_5M = 3,
  RATE_11M = 4,
  RATE_6M = 6,
  RATE_9M = 7,
  RATE_12M = 8,
  RATE_18M = 9,
  RATE_24M = 10,
  RATE_36M = 11,
  RATE_48M = 12,
  RATE_54M = 13,
  RATE_MCS_0 = 14,
  RATE_MCS_1 = 15,
  RATE_MCS_2 = 16,
  RATE_MCS_3 = 17,
  RATE_MCS_4 = 18,
  RATE_MCS_5 = 19,
  RATE_MCS_6 = 20,
  RATE_MCS_7 = 21,
  MAX_NUM_RATES = 0xFF
}
 
enum  sl_p2p_dev_password_method {
  DEV_PW_DEFAULT =0,
  DEV_PW_PIN_KEYPAD =1,
  DEV_PW_PUSH_BUTTON =4,
  DEV_PW_PIN_DISPLAY =5
}
 
enum  SlWlanMode_e {
  ROLE_STA = 0,
  ROLE_UNKNOWN = 1,
  ROLE_AP = 2,
  ROLE_P2P = 3,
  ROLE_STA_ERR = -1,
  ROLE_AP_ERR = -2,
  ROLE_P2P_ERR = -3,
  INIT_CALIB_FAIL = -4
}
 

Detailed Description

Function Documentation

_i16 sl_WlanConnect ( const _i8 *  pName,
const _i16  NameLen,
const _u8 *  pMacAddr,
const SlSecParams_t pSecParams,
const SlSecParamsExt_t pSecExtParams 
)

Connect to wlan network as a station.

Parameters
[in]pNameup to 32 bytes in case of STA the name is the SSID of the Access Point
[in]NameLenname length
[in]pMacAddr6 bytes for MAC address
[in]pSecParamsSecurity parameters (use NULL key for SL_SEC_TYPE_OPEN) 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]pSecExtParamsEnterprise 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
_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
_i16 sl_WlanGet ( const _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
  • 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
  • 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
[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:
1 slWlanScanParamCommand_t ScanParamConfig;
2 _u16 Option = WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS;
3 _u16 OptionLen = sizeof(slWlanScanParamCommand_t);
4 sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID ,&Option,&OptionLen,(_u8 *)&ScanParamConfig);
WLAN_GENERAL_PARAM_OPT_AP_TX_POWER:
1 _i8 TXPower = 0;
2 _u16 Option = WLAN_GENERAL_PARAM_OPT_AP_TX_POWER;
3 _u16 OptionLen = sizeof(_i8);
4 sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID ,&Option,&OptionLen,(_u8 *)&TXPower);
WLAN_GENERAL_PARAM_OPT_STA_TX_POWER:
1 _i8 TXPower = 0;
2 _u16 Option = WLAN_GENERAL_PARAM_OPT_STA_TX_POWER;
3 _u16 OptionLen = sizeof(_i8);
4 
5 sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID ,&Option,&OptionLen,(_u8 *)&TXPower);
WLAN_P2P_OPT_DEV_TYPE:
1 _i8 device_type[18];
2 _u16 len = 18;
3 _u16 config_opt = WLAN_P2P_OPT_DEV_TYPE;
4 sl_WlanGet(SL_WLAN_CFG_P2P_PARAM_ID, &config_opt , &len, (_u8* )device_type);
WLAN_AP_OPT_SSID:
1 _i8 ssid[32];
2 _u16 len = 32;
3 _u16 config_opt = WLAN_AP_OPT_SSID;
4 sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt , &len, (_u8* )ssid);
WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE:
1 _i8 country[3];
2 _u16 len = 3;
3 _u16 config_opt = WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE;
4 sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID, &config_opt, &len, (_u8* )country);
WLAN_AP_OPT_CHANNEL:
1 _i8 channel;
2 _u16 len = 1;
3 _u16 config_opt = WLAN_AP_OPT_CHANNEL;
4 sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt, &len, (_u8* )&channel);
WLAN_AP_OPT_HIDDEN_SSID:
1 _u8 hidden;
2 _u16 len = 1;
3 _u16 config_opt = WLAN_AP_OPT_HIDDEN_SSID;
4 sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt, &len, (_u8* )&hidden);
WLAN_AP_OPT_SECURITY_TYPE:
1 _u8 sec_type;
2 _u16 len = 1;
3 _u16 config_opt = WLAN_AP_OPT_SECURITY_TYPE;
4 sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt, &len, (_u8* )&sec_type);
WLAN_AP_OPT_PASSWORD:
1 _u8 password[64];
2 _u16 len = 64;
3 memset(password,0,64);
4 _u16 config_opt = WLAN_AP_OPT_PASSWORD;
5 sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt, &len, (_u8* )password);
WLAN_P2P_OPT_CHANNEL_N_REGS:
1 _u16 listen_channel,listen_reg,oper_channel,oper_reg;
2 _u16 len = 4;
3 _u16 config_opt = WLAN_P2P_OPT_CHANNEL_N_REGS;
4 _u8 channel_n_regs[4];
5 sl_WlanGet(SL_WLAN_CFG_P2P_PARAM_ID, &config_opt, &len, (_u8* )channel_n_regs);
6 listen_channel = channel_n_regs[0];
7 listen_reg = channel_n_regs[1];
8 oper_channel = channel_n_regs[2];
9 oper_reg = channel_n_regs[3];
_i16 sl_WlanGetNetworkList ( const _u8  Index,
const _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:
1 An example of fetching max 10 results:
2 
3  Sl_WlanNetworkEntry_t netEntries[10];
4  _i16 resultsCount = sl_WlanGetNetworkList(0,10,&netEntries[0]);
5  for(i=0; i< resultsCount; i++)
6  {
7  printf("%s\n",netEntries[i].ssid);
8  }
_i16 sl_WlanPolicyGet ( const _u8  Type,
_u8  Policy,
_u8 *  pVal,
_u8 *  pValLen 
)

get policy values

Parameters
[in]TypeSL_POLICY_CONNECTION, SL_POLICY_SCAN, SL_POLICY_PM,SL_POLICY_P2P
[in]Policyargument may be set to any value
[out]Thereturned 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.
_i16 sl_WlanPolicySet ( const _u8  Type,
const _u8  Policy,
_u8 *  pVal,
const _u8  ValLen 
)

Set policy values.

Parameters
[in]TypeType of policy to be modified. The Options are:
  • SL_POLICY_CONNECTION
  • SL_POLICY_SCAN
  • SL_POLICY_PM
  • SL_POLICY_P2P
[in]PolicyThe option value which depends on action type
[in]pValAn optional value pointer
[in]ValLenAn 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.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, 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)
_i16 sl_WlanProfileAdd ( const _i8 *  pName,
const _i16  NameLen,
const _u8 *  pMacAddr,
const SlSecParams_t pSecParams,
const SlSecParamsExt_t pSecExtParams,
const _u32  Priority,
const _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]pNameup 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]NameLenname length
[in]pMacAddr6 bytes for MAC address
[in]pSecParamsSecurity 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]pSecExtParamsEnterprise 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]Priorityprofile priority. Lowest priority: 0
[in]OptionsNot 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
_i16 sl_WlanProfileDel ( const _i16  Index)

Delete WLAN profile.

Delete WLAN profile

Parameters
[in]indexnumber 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
_i16 sl_WlanProfileGet ( const _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]Indexprofile stored index, if index does not exists error is return
[out]pNameup 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]pNameLenname length
[out]pMacAddr6 bytes for MAC address
[out]pSecParamssecurity parameters - security type (SL_SEC_TYPE_OPEN, SL_SEC_TYPE_WEP, SL_SEC_TYPE_WPA_WPA2 or SL_SEC_TYPE_WPS_PBC, SL_SEC_TYPE_WPS_PIN, SL_SEC_TYPE_WPA_ENT,SL_SEC_TYPE_P2P_PBC,SL_SEC_TYPE_P2P_PIN_KEYPAD or SL_SEC_TYPE_P2P_PIN_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]pSecExtParamsenterprise parameters - identity, identity length, Anonymous, Anonymous length CertIndex (not supported), EapMethod.
[out]Priorityprofile 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
_i16 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]RuleTypeThe rule type
[in]FilterFlagsFlags which set the type of header rule Args and sets the persistent flag
[in]pRuleDetermine the filter rule logic
[in]pTriggerDetermine when the rule is triggered also sets rule parent.
[in]pActionSets the action to be executed in case the match functions pass
[out]pFilterIdThe filterId which was created
Returns
On success, zero is returned. Otherwise error code is returned
_i16 sl_WlanRxFilterGet ( const SLrxFilterOperation_t  RxFilterOperation,
_u8 *  pOutputBuffer,
_u16  OutputbufferLength 
)

Gets parameters of Rx filters.

Parameters
[in]RxFilterOperationpossible 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]pOutputBufferThe buffer input is _WlanRxFilterRetrieveEnableStatusCommandResponseBuff_t:
[in]OutputbufferLengthThe length in byte of the output buffer
Returns
On success, zero is returned. Otherwise error code is returned
_i16 sl_WlanRxFilterSet ( const SLrxFilterOperation_t  RxFilterOperation,
const _u8 *const  pInputBuffer,
_u16  InputbufferLength 
)

Sets parameters to Rx filters.

Parameters
[in]RxFilterOperationpossible 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]pInputBufferoptions: The buffer input is _WlanRxFilterOperationCommandBuff_t:
  • SL_ENABLE_DISABLE_RX_FILTER
Parameters
[in]InputbufferLengthThe length in byte of the input buffer
Returns
On success, zero is returned. Otherwise error code is returned
_i16 sl_WlanRxStatGet ( SlGetRxStatResponse_t pRxStat,
const _u32  Flags 
)

Get wlan RX statistics. upon calling this command, the statistics counters will be cleared.

Parameters
[in]Flagsshould be 0 ( not applicable right now, will be added the future )
[in]pRxStata 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
_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
Example:
1  Getting wlan RX statistics:
2 
3 void RxStatCollectTwice()
4 {
5  SlGetRxStatResponse_t rxStat;
6  _i16 rawSocket;
7  _i8 DataFrame[200];
8  struct SlTimeval_t timeval;
9  timeval.tv_sec = 0; // Seconds
10  timeval.tv_usec = 20000; // Microseconds. 10000 microseconds resolution
11 
12  sl_WlanRxStatStart(); // set statistics mode
13 
14  rawSocket = sl_Socket(SL_AF_RF, SL_SOCK_RAW, eChannel);
15  // set timeout - in case we have no activity for the specified channel
16  sl_SetSockOpt(rawSocket,SL_SOL_SOCKET,SL_SO_RCVTIMEO, &timeval, sizeof(timeval)); // Enable receive timeout
17  status = sl_Recv(rawSocket, DataFrame, sizeof(DataFrame), 0);
18 
19  Sleep(1000); // sleep for 1 sec
20  sl_WlanRxStatGet(&rxStat,0); // statistics has been cleared upon read
21  Sleep(1000); // sleep for 1 sec
22  sl_WlanRxStatGet(&rxStat,0);
23 
24 }
_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
_i16 sl_WlanSet ( const _u16  ConfigId,
const _u16  ConfigOpt,
const _u16  ConfigLen,
const _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
  • SL_WLAN_CFG_GENERAL_PARAM_ID
    • WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS
      Set scan parameters. This option uses slWlanScanParamCommand_t as parameter
    • 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
  • 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
[in]ConfigLen- configurations len
[in]pValues- configurations values
See also
Note
Warning
Examples:
WLAN_AP_OPT_SSID:
1 _u8 str[33];
2 memset(str, 0, 33);
3 memcpy(str, ssid, len); // ssid string of 32 characters
4 sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SSID, strlen(ssid), str);
WLAN_AP_OPT_CHANNEL:
1 _u8 val = channel;
2 sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_CHANNEL, 1, (_u8 *)&val);
WLAN_AP_OPT_HIDDEN_SSID:
1 _u8 val = hidden;
2 sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_HIDDEN_SSID, 1, (_u8 *)&val);
WLAN_AP_OPT_SECURITY_TYPE:
1 _u8 val = SL_SEC_TYPE_WPA_WPA2;
2 sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SECURITY_TYPE, 1, (_u8 *)&val);
WLAN_AP_OPT_PASSWORD:
1 _u8 str[65];
2 _u16 len = strlen(password);
3 memset(str, 0, 65);
4 memcpy(str, password, len);
5 sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_PASSWORD, len, (_u8 *)str);
WLAN_GENERAL_PARAM_OPT_STA_TX_POWER:
1 _u8 stapower=(_u8)power;
2 sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, WLAN_GENERAL_PARAM_OPT_STA_TX_POWER,1,(_u8 *)&stapower);
WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS:
1 slWlanScanParamCommand_t ScanParamConfig;
2 ScanParamConfig.G_Channels_mask = 0x01; // bit mask for channels:1 means channel 1 is enabled, 3 means channels 1 + 2 are enabled
3 ScanParamConfig.rssiThershold = -70; // only for RSSI level which is higher than -70
4 sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID ,WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS,sizeof(slWlanScanParamCommand_t),(_u8*)&ScanParamConfig);
WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE:
1 _u8* str = (_u8 *) country; // string of 2 characters. i.e. - "US"
2 sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE, 2, str);
WLAN_GENERAL_PARAM_OPT_AP_TX_POWER:
1 _u8 appower=(_u8)power;
2 sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, WLAN_GENERAL_PARAM_OPT_AP_TX_POWER,1,(_u8 *)&appower);
WLAN_P2P_OPT_DEV_TYPE:
1 _u8 str[17];
2 _u16 len = strlen(device_type);
3 memset(str, 0, 17);
4 memcpy(str, device_type, len);
5 sl_WlanSet(SL_WLAN_CFG_P2P_PARAM_ID, WLAN_P2P_OPT_DEV_TYPE, len, str);
WLAN_P2P_OPT_CHANNEL_N_REGS:
1 _u8 str[4];
2 str[0] = (_u8)11; // listen channel
3 str[1] = (_u8)81; // listen regulatory class
4 str[2] = (_u8)6; // oper channel
5 str[3] = (_u8)81; // oper regulatory class
6 sl_WlanSet(SL_WLAN_CFG_P2P_PARAM_ID, WLAN_P2P_OPT_CHANNEL_N_REGS, 4, str);
WLAN_GENERAL_PARAM_OPT_INFO_ELEMENT:
1 sl_protocol_WlanSetInfoElement_t infoele;
2 infoele.index = Index; // Index of the info element. range: 0 - MAX_PRIVATE_INFO_ELEMENTS_SUPPROTED
3 infoele.role = Role; // INFO_ELEMENT_AP_ROLE (0) or INFO_ELEMENT_P2P_GO_ROLE (1)
4 infoele.ie.id = Id; // Info element ID. if INFO_ELEMENT_DEFAULT_ID (0) is set, ID will be set to 221.
5 // Organization unique ID. If all 3 bytes are zero - it will be replaced with 08,00,28.
6 infoele.ie.oui[0] = Oui0; // Organization unique ID first Byte
7 infoele.ie.oui[1] = Oui1; // Organization unique ID second Byte
8 infoele.ie.oui[2] = Oui2; // Organization unique ID third Byte
9 infoele.ie.length = Len; // Length of the info element. must be smaller than 253 bytes
10 memset(infoele.ie.data, 0, INFO_ELEMENT_MAX_SIZE);
11 if ( Len <= INFO_ELEMENT_MAX_SIZE )
12 {
13  memcpy(infoele.ie.data, IE, Len); // Info element. length of the info element is [0-252]
14  sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID,WLAN_GENERAL_PARAM_OPT_INFO_ELEMENT,sizeof(sl_protocol_WlanSetInfoElement_t),(_u8* ) &infoele);
15 }
16 sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID,WLAN_GENERAL_PARAM_OPT_INFO_ELEMENT,sizeof(sl_protocol_WlanSetInfoElement_t),(_u8* ) &infoele);
_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
See also
sl_Start sl_Stop
Note
belongs to ext_api
Warning
After setting the mode the system must be restarted for activating the new mode
Example:
1 //Switch from any role to STA:
2 sl_WlanSetMode(ROLE_STA);
3 sl_Stop(0);
4 sl_Start(NULL,NULL,NULL);
_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
1 An example of starting smart Config on group ID's 0 + 1 + 2
2 
3  sl_WlanSmartConfigStart(7, //group ID's (BIT_0 | BIT_1 | BIT_2)
4  1, //decrypt key by AES method
5  16, //decryption key length for group ID0
6  16, //decryption key length for group ID1
7  16, //decryption key length for group ID2
8  "Key0Key0Key0Key0", //decryption key for group ID0
9  "Key1Key1Key1Key1", //decryption key for group ID1
10  "Key2Key2Key2Key2" //decryption key for group ID2
11  );
_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

Data Structure Documentation

struct slSmartConfigStartAsyncResponse_t

Definition at line 377 of file wlan.h.

Data Fields
_u8 private_token[32]
_u32 private_token_len
_u8 ssid[32]
_u32 ssid_len
_u32 status
struct slSmartConfigStopAsyncResponse_t

Definition at line 386 of file wlan.h.

Data Fields
_u16 padding
_u16 status
struct slWlanConnFailureAsyncResponse_t

Definition at line 392 of file wlan.h.

Data Fields
_u16 padding
_u16 status
struct slWlanConnectAsyncResponse_t

Definition at line 398 of file wlan.h.

Data Fields
_u8 bssid[6]
_u8 connection_type
_u8 go_peer_device_name[32]
_u8 go_peer_device_name_len
_u8 padding[2]
_u8 reason_code
_u8 ssid_len
_u8 ssid_name[32]
struct slPeerInfoAsyncResponse_t

Definition at line 410 of file wlan.h.

Data Fields
_u8 go_peer_device_name[32]
_u8 go_peer_device_name_len
_u8 mac[6]
_u8 own_ssid[32]
_u8 own_ssid_len
_u8 padding[3]
_u8 wps_dev_password_id
union SlWlanEventData_u

Definition at line 422 of file wlan.h.

Data Fields
slPeerInfoAsyncResponse_t APModeStaConnected
slPeerInfoAsyncResponse_t APModestaDisconnected
slPeerInfoAsyncResponse_t P2PModeDevFound
slPeerInfoAsyncResponse_t P2PModeNegReqReceived
slWlanConnFailureAsyncResponse_t P2PModewlanConnectionFailure
slSmartConfigStartAsyncResponse_t smartConfigStartResponse
slSmartConfigStopAsyncResponse_t smartConfigStopResponse
slWlanConnectAsyncResponse_t STAandP2PModeDisconnected
slWlanConnectAsyncResponse_t STAandP2PModeWlanConnected
struct SlWlanEvent_t

Definition at line 436 of file wlan.h.

Data Fields
_u32 Event
SlWlanEventData_u EventData
struct SlGetRxStatResponse_t

Definition at line 443 of file wlan.h.

Data Fields
_i16 AvarageDataCtrlRssi
_i16 AvarageMgMntRssi
_u32 GetTimeStamp
_u16 RateHistogram[NUM_OF_RATE_INDEXES]
_u32 ReceivedAddressMismatchPacketsNumber
_u32 ReceivedFcsErrorPacketsNumber
_u32 ReceivedValidPacketsNumber
_u16 RssiHistogram[SIZE_OF_RSSI_HISTOGRAM]
_u32 StartTimeStamp
struct Sl_WlanNetworkEntry_t

Definition at line 457 of file wlan.h.

Data Fields
_u8 bssid[SL_BSSID_LENGTH]
_i8 reserved[3]
_i8 rssi
_u8 sec_type
_u8 ssid[MAXIMAL_SSID_LENGTH]
_u8 ssid_len
struct SlSecParams_t

Definition at line 468 of file wlan.h.

Data Fields
_i8 * Key
_u8 KeyLen
_u8 Type
struct SlSecParamsExt_t

Definition at line 475 of file wlan.h.

Data Fields
_i8 * AnonUser
_u8 AnonUserLen
_u8 CertIndex
_u32 EapMethod
_i8 * User
_u8 UserLen
struct SlGetSecParamsExt_t

Definition at line 485 of file wlan.h.

Data Fields
_i8 AnonUser[32]
_u8 AnonUserLen
_u8 CertIndex
_u32 EapMethod
_i8 User[32]
_u8 UserLen
struct slWlanScanParamCommand_t

Definition at line 508 of file wlan.h.

Data Fields
_u32 G_Channels_mask
_i32 rssiThershold
struct sl_protocol_InfoElement_t

Definition at line 515 of file wlan.h.

Data Fields
_u8 data[252]
_u8 id
_u16 length
_u8 oui[3]
struct sl_protocol_WlanSetInfoElement_t

Definition at line 523 of file wlan.h.

Data Fields
sl_protocol_InfoElement_t ie
_u8 index
_u8 role