Update revision to use TI's mqtt and Freertos.

Dependencies:   mbed client server

Fork of cc3100_Test_mqtt_CM3 by David Fletcher

Embed: (wiki syntax)

« Back to documentation index

Wlan

Wlan

Functions

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

Function Documentation

int16_t sl_WlanConnect ( const signed char *  pName,
const int16_t  NameLen,
const uint8_t *  pMacAddr,
const SlSecParams_t *  pSecParams,
const SlSecParamsExt_t *  pSecExtParams 
) [inherited]

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

Definition at line 86 of file cc3100_wlan.cpp.

int16_t sl_WlanDisconnect ( void   ) [inherited]

wlan disconnect

Disconnect connection

Returns:
0 disconnected done, other already disconnected
See also:
sl_WlanConnect
Note:
belongs to ext_api
Warning:

Definition at line 204 of file cc3100_wlan.cpp.

int16_t sl_WlanGet ( const uint16_t  ConfigId,
uint16_t *  pConfigOpt,
uint16_t *  pConfigLen,
uint8_t *  pValues 
) [inherited]

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 uint8_t as parameter
    • WLAN_AP_OPT_CHANNEL
      Get channel for AP mode.
      This option takes uint8_t 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 uint8_t 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 uint8_t 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 uint8_t 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 uint8_t 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 uint8_t 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 uint8_t 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 uint8_t[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:
              slWlanScanParamCommand_t ScanParamConfig;
              uint16_t Option = WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS;
              uint16_t OptionLen = sizeof(slWlanScanParamCommand_t);
              sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID ,&Option,&OptionLen,(uint8_t *)&ScanParamConfig);
WLAN_GENERAL_PARAM_OPT_AP_TX_POWER:
               _i8 TXPower = 0;
               _u16 Option = WLAN_GENERAL_PARAM_OPT_AP_TX_POWER;
               _u16 OptionLen = sizeof(_i8);
           sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID ,&Option,&OptionLen,(_u8 *)&TXPower);
WLAN_GENERAL_PARAM_OPT_STA_TX_POWER:
           _i8 TXPower = 0;
           _u16 Option = WLAN_GENERAL_PARAM_OPT_STA_TX_POWER;
           _u16 OptionLen = sizeof(_i8);

               sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID ,&Option,&OptionLen,(uint8_t *)&TXPower);
WLAN_P2P_OPT_DEV_TYPE:
               int8_t device_type[18];
               uint16_t len = 18;
               uint16_t config_opt = WLAN_P2P_OPT_DEV_TYPE;
               sl_WlanGet(SL_WLAN_CFG_P2P_PARAM_ID, &config_opt , &len, (uint8_t* )device_type);
WLAN_AP_OPT_SSID:
               int8_t ssid[32];
               uint16_t len = 32;
               uint16_t  config_opt = WLAN_AP_OPT_SSID;
               sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt , &len, (uint8_t* )ssid);
WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE:
               int8_t country[3];
               uint16_t len = 3;
               uint16_t  config_opt = WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE;
               sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID, &config_opt, &len, (uint8_t* )country);
WLAN_AP_OPT_CHANNEL:
               int8_t channel;
               uint16_t len = 1;
               uint16_t  config_opt = WLAN_AP_OPT_CHANNEL;
               sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt, &len, (uint8_t* )&channel);
WLAN_AP_OPT_HIDDEN_SSID:
              uint8_t hidden;
              uint16_t len = 1;
              uint16_t  config_opt = WLAN_AP_OPT_HIDDEN_SSID;
              sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt, &len, (uint8_t* )&hidden);
WLAN_AP_OPT_SECURITY_TYPE:
             uint8_t sec_type;
             uint16_t len = 1;
             uint16_t  config_opt = WLAN_AP_OPT_SECURITY_TYPE;
             sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt, &len, (uint8_t* )&sec_type);
WLAN_AP_OPT_PASSWORD:
             uint8_t password[64];
             uint16_t len = 64;
             memset(password,0,64);
             uint16_t config_opt = WLAN_AP_OPT_PASSWORD;
             sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt, &len, (uint8_t* )password);
WLAN_P2P_OPT_CHANNEL_N_REGS:
           uint16_t listen_channel,listen_reg,oper_channel,oper_reg;
           uint16_t len = 4;
           uint16_t  config_opt = WLAN_P2P_OPT_CHANNEL_N_REGS;
           uint8_t channel_n_regs[4];
           sl_WlanGet(SL_WLAN_CFG_P2P_PARAM_ID, &config_opt, &len, (uint8_t* )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 749 of file cc3100_wlan.cpp.

int16_t sl_WlanGetNetworkList ( const uint8_t  Index,
const uint8_t  Count,
Sl_WlanNetworkEntry_t *  pEntries 
) [inherited]

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];
                    int16_t resultsCount = sl_WlanGetNetworkList(0,10,&netEntries[0]);
                    for(i=0; i< resultsCount; i++)
                    {
                          printf("%s\n",netEntries[i].ssid);
                    }

Definition at line 548 of file cc3100_wlan.cpp.

int16_t sl_WlanPolicyGet ( const uint8_t  Type,
uint8_t  Policy,
uint8_t *  pVal,
uint8_t *  pValLen 
) [inherited]

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.

Definition at line 261 of file cc3100_wlan.cpp.

int16_t sl_WlanPolicySet ( const uint8_t  Type,
const uint8_t  Policy,
uint8_t *  pVal,
const uint8_t  ValLen 
) [inherited]

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:
      uint32_t intervalInSeconds = 60;
      define SL_SCAN_ENABLE 1
      sl_WlanPolicySet(SL_POLICY_SCAN,SL_SCAN_ENABLE, (uint8_t *)&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:
      uint16_t PolicyBuff[4] = {0,0,800,0}; // PolicyBuff[2] is max sleep time in mSec
      sl_WlanPolicySet(SL_POLICY_PM , SL_LONG_SLEEP_INTERVAL_POLICY, (uint8_t*)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 225 of file cc3100_wlan.cpp.

int16_t sl_WlanProfileAdd ( const int8_t *  pName,
const int16_t  NameLen,
const uint8_t *  pMacAddr,
const SlSecParams_t *  pSecParams,
const SlSecParamsExt_t *  pSecExtParams,
const uint32_t  Priority,
const uint32_t  Options 
) [inherited]

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

Definition at line 310 of file cc3100_wlan.cpp.

int16_t sl_WlanProfileDel ( const int16_t  Index ) [inherited]

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:

Definition at line 521 of file cc3100_wlan.cpp.

int16_t sl_WlanProfileGet ( const int16_t  Index,
int8_t *  pName,
int16_t *  pNameLen,
uint8_t *  pMacAddr,
SlSecParams_t *  pSecParams,
SlGetSecParamsExt_t *  pSecExtParams,
uint32_t *  pPriority 
) [inherited]

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:

Definition at line 469 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 
) [inherited]

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

Definition at line 830 of file cc3100_wlan.cpp.

int16_t sl_WlanRxFilterGet ( const SLrxFilterOperation_t  RxFilterOperation,
uint8_t *  pOutputBuffer,
uint16_t  OutputbufferLength 
) [inherited]

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:

  • SL_FILTER_RETRIEVE_ENABLE_STATE The buffer input is _WlanRxFilterPrePreparedFiltersCommandResponseBuff_t:
  • SL_FILTER_PRE_PREPARED_RETRIEVE_CREATE_REMOVE_STATE
[in]OutputbufferLengthThe length in byte of the output buffer
Returns:
On success, zero is returned. Otherwise error code is returned

Definition at line 900 of file cc3100_wlan.cpp.

int16_t sl_WlanRxFilterSet ( const SLrxFilterOperation_t  RxFilterOperation,
const uint8_t *const   pInputBuffer,
uint16_t  InputbufferLength 
) [inherited]

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
  • SL_REMOVE_RX_FILTER
  • SL_STORE_RX_FILTERS The buffer input is _WlanRxFilterUpdateArgsCommandBuff_t:
Parameters:
[in]InputbufferLengthThe length in byte of the input buffer
Returns:
On success, zero is returned. Otherwise error code is returned

Definition at line 867 of file cc3100_wlan.cpp.

int16_t sl_WlanRxStatGet ( SlGetRxStatResponse_t *  pRxStat,
const uint32_t  Flags 
) [inherited]

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:

Definition at line 590 of file cc3100_wlan.cpp.

int16_t sl_WlanRxStatStart ( void   ) [inherited]

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:
 Getting wlan RX statistics:

        void RxStatCollectTwice()
        {
            SlGetRxStatResponse_t rxStat;
            int16_t rawSocket;
            int8_t 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 576 of file cc3100_wlan.cpp.

int16_t sl_WlanRxStatStop ( void   ) [inherited]

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:

Definition at line 583 of file cc3100_wlan.cpp.

int16_t sl_WlanSet ( const uint16_t  ConfigId,
const uint16_t  ConfigOpt,
const uint16_t  ConfigLen,
const uint8_t *  pValues 
) [inherited]

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 uint8_t 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 uint8_t 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 uint8_t 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 uint8_t 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 uint8_t 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 uint8_t 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 uint8_t 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 uint8_t 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 uint8_t 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 uint8_t[4] as parameter
[in]ConfigLen- configurations len
[in]pValues- configurations values
See also:
Note:
Warning:
Examples:
WLAN_AP_OPT_SSID:
                uint8_t  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:
                uint8_t  val = channel;
                sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_CHANNEL, 1, (uint8_t *)&val);
WLAN_AP_OPT_HIDDEN_SSID:
                uint8_t  val = hidden;
                sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_HIDDEN_SSID, 1, (uint8_t *)&val);
WLAN_AP_OPT_SECURITY_TYPE:
               uint8_t  val = SL_SEC_TYPE_WPA_WPA2;
               sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SECURITY_TYPE, 1, (uint8_t *)&val);
WLAN_AP_OPT_PASSWORD:
               uint8_t  str[65];
               uint16_t  len = strlen(password);
               memset(str, 0, 65);
               memcpy(str, password, len);
               sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_PASSWORD, len, (uint8_t *)str);
WLAN_GENERAL_PARAM_OPT_STA_TX_POWER:
             uint8_t  stapower=(uint8_t)power;
             sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, WLAN_GENERAL_PARAM_OPT_STA_TX_POWER,1,(uint8_t *)&stapower);
WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS:
          slWlanScanParamCommand_t ScanParamConfig;
          ScanParamConfig.G_Channels_mask = 0x01;  // bit mask for channels:1 means channel 1 is enabled, 3 means channels 1 + 2 are enabled
          ScanParamConfig.rssiThershold = -70;     // only for RSSI level which is higher than -70
          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:
                uint8_t*  str = (uint8_t *) 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:
             uint8_t  appower=(uint8_t)power;
             sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, WLAN_GENERAL_PARAM_OPT_AP_TX_POWER,1,(uint8_t *)&appower);
WLAN_P2P_OPT_DEV_TYPE:
             uint8_t   str[17];
             uint16_t  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:
            uint8_t  str[4];
            str[0] = (uint8_t)11;           // listen channel
            str[1] = (uint8_t)81;            // listen regulatory class
            str[2] = (uint8_t)6;            // oper channel
            str[3] = (uint8_t)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),(uint8_t* ) &infoele);
            }
            sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID,WLAN_GENERAL_PARAM_OPT_INFO_ELEMENT,sizeof(sl_protocol_WlanSetInfoElement_t),(uint8_t* ) &infoele);

Definition at line 713 of file cc3100_wlan.cpp.

int16_t sl_WlanSetMode ( const uint8_t  mode ) [inherited]

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:
                    //Switch from any role to STA:
                    sl_WlanSetMode(ROLE_STA);
                    sl_Stop(0);
                    sl_Start(NULL,NULL,NULL);

Definition at line 685 of file cc3100_wlan.cpp.

int16_t sl_WlanSmartConfigStart ( const uint32_t  groupIdBitmask,
const uint8_t  cipher,
const uint8_t  publicKeyLen,
const uint8_t  group1KeyLen,
const uint8_t  group2KeyLen,
const uint8_t *  publicKey,
const uint8_t *  group1Key,
const uint8_t *  group2Key 
) [inherited]

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 635 of file cc3100_wlan.cpp.

int16_t sl_WlanSmartConfigStop ( void   ) [inherited]

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:

Definition at line 606 of file cc3100_wlan.cpp.