/******************************************************************************* Function: void WF_CPSetBssid(UINT8 CpId, UINT8 *p_bssid) Summary: Sets the BSSID for the specified Connection Profile ID. Description: Sets the BSSID element in a Connection Profile. Precondition: MACInit must be called first. Parameters: CpId - Connection Profile ID p_bssid - Pointer to the BSSID Returns: None. Remarks: None. *****************************************************************************/ void WF_CPSetBssid(UINT8 CpId, UINT8 *p_bssid) { LowLevel_CPSetElement(CpId, /* CP ID */ WF_CP_ELEMENT_BSSID, /* Element ID */ p_bssid, /* pointer to element data */ WF_BSSID_LENGTH); /* number of element data bytes */ }
/******************************************************************************* Function: void WF_CPSetNetworkType(UINT8 CpId, UINT8 networkType) Summary: Sets the network for the specified Connection Profile ID. Description: Sets the Network Type element a Connection Profile. Allowable values are: * WF_INFRASTRUCTURE * WF_ADHOC Precondition: MACInit must be called first. Parameters: CpId - Connection Profile ID networkType - Type of network to create (infrastructure or adhoc) Returns: None. Remarks: None. *****************************************************************************/ void WF_CPSetNetworkType(UINT8 CpId, UINT8 networkType) { LowLevel_CPSetElement(CpId, /* CP ID */ WF_CP_ELEMENT_NETWORK_TYPE, /* Element ID */ &networkType, /* pointer to element data */ 1); /* number of element data bytes */ }
/******************************************************************************* Function: void SetWepKeyType(uint8_t wepKeyType) Summary: Sets the Wep key type Description: Sets the Wep key type Precondition: MACInit must be called first. Parameters: wepKeyType -- DRV_WIFI_SECURITY_WEP_SHAREDKEY or DRV_WIFI_SECURITY_WEP_OPENKEY (default) Returns: None. Remarks: None. *****************************************************************************/ void SetWepKeyType(uint8_t wepKeyType) { LowLevel_CPSetElement(WF_CP_ELEMENT_WEPKEY_TYPE, /* Element ID */ &wepKeyType, /* pointer to element data */ 1); /* number of element data bytes */ p_wifi_ConfigData->wepKeyType = wepKeyType; }
/******************************************************************************* Function: void WF_CPSetWepKeyType(UINT8 CpId, UINT8 wepKeyType) Summary: Sets the Wep key type for the specified Connection Profile ID. Description: Sets the Wep key type for the specified Connection Profile ID. Precondition: MACInit must be called first. Parameters: CpId -- Connection Profile ID wepKeyType -- WF_SECURITY_WEP_SHAREDKEY or WF_SECURITY_WEP_OPENKEY (default) Returns: None. Remarks: None. *****************************************************************************/ void WF_CPSetWepKeyType(UINT8 CpId, UINT8 wepKeyType) { LowLevel_CPSetElement(CpId, /* CP ID */ WF_CP_ELEMENT_WEPKEY_TYPE, /* Element ID */ &wepKeyType, /* pointer to element data */ 1); /* number of element data bytes */ }
/******************************************************************************* Function: WF_SsidTypeSet(bool hidden) Summary: Sets the SSID type Description: Sets the SSID type element in the Connection Profile. ***** This is valid only when we create AdHoc network. Precondition: MACInit must be called first. Parameters: CpId -- Connection Profile ID hidden -- True or False Returns: None. Remarks: None. *****************************************************************************/ void WF_SsidTypeSet(bool hidden) { LowLevel_CPSetElement(WF_CP_ELEMENT_SSID_TYPE, /* Element ID */ (uint8_t *)&hidden, /* pointer to element data */ 1); /* number of element data bytes */ }
/******************************************************************************* Function: void WF_CPSetAdHocBehavior(UINT8 CpId, UINT8 adHocBehavior) Summary: Selects the desired Ad Hoc behavior Description: Sets the AdHoc behavior within a Connection Profile. Allowable values are: * WF_ADHOC_CONNECT_THEN_START * WF_ADHOC_CONNECT_ONLY * WF_ADHOC_START_ONLY Precondition: MACInit must be called first. Parameters: CpId - Connection Profile ID adHocBehavior - Value of the adhoc behavior for this connection profile. Returns: None. Remarks: None. *****************************************************************************/ void WF_CPSetAdHocBehavior(UINT8 CpId, UINT8 adHocBehavior) { LowLevel_CPSetElement(CpId, /* CP ID */ WF_CP_ELEMENT_ADHOC_BEHAVIOR, /* Element ID */ &adHocBehavior, /* pointer to element data */ 1); /* number of element data bytes */ }
/******************************************************************************* Function: void WF_CPSetDefaultWepKeyIndex(UINT8 CpId, UINT8 defaultWepKeyIndex) Summary: Selects one of the 4 WEP keys to use. Description: Only applicable if the Connection Profile security type is either WF_SECURITY_WEP_40 or WF_SECURITY_WEP_104. Selects which of the four WEP keys to use. Precondition: MACInit must be called first. Parameters: CpId - Connection Profile ID defaultWepKeyIndex - Index of WEP key to use (0 - 3) Returns: None. Remarks: Note that only key 0 amongst AP manufacturers is typically used. Using any of the other three keys may be unpredictable from brand to brand. *****************************************************************************/ void WF_CPSetDefaultWepKeyIndex(UINT8 CpId, UINT8 defaultWepKeyIndex) { LowLevel_CPSetElement(CpId, /* CP ID */ WF_CP_ELEMENT_WEP_KEY_INDEX, /* Element ID */ &defaultWepKeyIndex, /* pointer to element data */ 1); /* number of element data bytes */ }
/* Function: void DRV_WIFI_NetworkTypeSet(uint8_t networkType); Summary: Sets the WiFi network type Description: This function selects the WiFi network type. Parameters: networkType - One of the following: DRV_WIFI_NETWORK_TYPE_INFRASTRUCTURE DRV_WIFI_NETWORK_TYPE_ADHOC DRV_WIFI_NETWORK_TYPE_SOFT_AP Returns: None */ void DRV_WIFI_NetworkTypeSet(uint8_t networkType) { LowLevel_CPSetElement(WF_CP_ELEMENT_NETWORK_TYPE, /* Element ID */ &networkType, /* pointer to element data */ 1); /* number of element data bytes */ p_wifi_ConfigData->networkType = networkType; g_networkType = networkType; }
/******************************************************************************* Function: WF_CPUpdatePMK(uint8_t CpId, uint8_t *pmk) Summary: Updates the PMK element in the connection profile ID retrieved out of 802.1x authentication process Description: Applicable for MRF24WG0M only. Updates the PMK element in the connection profile ID retrieved out of 802.1x authentication process. This function is not used in the TCPIP demo apps. Precondition: MACInit must be called first. Parameters: CpId - Connection Profile ID pmk - pairwise master key Returns: None. Remarks: None. *****************************************************************************/ void WF_CPUpdatePMK(uint8_t CpId, uint8_t *pmk) { LowLevel_CPSetElement(CpId, /* CP ID */ WF_CP_ELEMENT_UPDATE_PMK , /* Element ID */ (uint8_t *)pmk, /* pointer to element data */ 32); /* number of element data bytes */ }
/******************************************************************************* Function: void WF_CPSetSsidType(UINT8 CpId, UINT8 hidden) Summary: Sets the SSID type for the specified Connection Profile ID. Description: Sets the SSID type element in the Connection Profile. This is valid only when we create AdHoc network. Precondition: MACInit must be called first. Parameters: CpId -- Connection Profile ID hidden -- True or False Returns: None. Remarks: None. *****************************************************************************/ void WF_CPSetSsidType(UINT8 CpId, UINT8 hidden) { LowLevel_CPSetElement(CpId, /* CP ID */ WF_CP_ELEMENT_SSID_TYPE, /* Element ID */ (UINT8 *)&hidden, /* pointer to element data */ 1); /* number of element data bytes */ }
/******************************************************************************* Function: void WF_CPSetSsid(UINT8 CpId, UINT8 *p_ssid, UINT8 *p_ssidLength) Summary: Sets the SSID for the specified Connection Profile ID. Description: Sets the SSID and SSID Length elements in the Connection Profile. Note that an Access Point can have either a visible or hidden SSID. If an Access Point uses a hidden SSID then an active scan must be used (see scanType field in the Connection Algorithm). Precondition: MACInit must be called first. Parameters: CpId - Connection Profile ID p_ssid - Pointer to the SSID string ssidLength - Number of bytes in the SSID Returns: None. Remarks: None. *****************************************************************************/ void WF_CPSetSsid(UINT8 CpId, UINT8 *p_ssid, UINT8 ssidLength) { WF_ASSERT(ssidLength <= WF_MAX_SSID_LENGTH); LowLevel_CPSetElement(CpId, /* CP ID */ WF_CP_ELEMENT_SSID, /* Element ID */ (UINT8 *)p_ssid, /* pointer to element data */ ssidLength); /* number of element data bytes */ }
/******************************************************************************* Function: void WF_CPSetElements(UINT8 CpId, tWFCPElements *p_elements) Summary: Writes out data for a specific connection profile element. Description: Sets all Connection Profile elements. If the Host CPU does not have enough memory to create a structure of this size then call the individual set functions. Precondition: MACInit must be called. Parameters: CpId - Connectino Profile ID. p_elements - Pointer to Connection Profile elements structure. Returns: None. Remarks: None. *****************************************************************************/ void WF_CPSetElements(UINT8 CpId, tWFCPElements *p_elements) { WF_ASSERT(p_elements->ssidLength <= WF_MAX_SSID_LENGTH); #if !defined(MRF24WG) LowLevel_CPSetElement(CpId, /* CP ID */ WF_CP_ELEMENT_ALL, /* Element ID */ (UINT8 *)p_elements, /* pointer to element data */ gRFModuleVer1209orLater ? sizeof(tWFCPElements) : sizeof(tWFCPElements)-2); /* number of element data bytes */ #else LowLevel_CPSetElement(CpId, /* CP ID */ WF_CP_ELEMENT_ALL, /* Element ID */ (UINT8 *)p_elements, /* pointer to element data */ sizeof(tWFCPElements)); /* number of element data bytes */ #endif }
/* Function: void DRV_WIFI_SsidSet(uint8_t *p_ssid, uint8_t ssidLength); Summary: Sets the SSID Description: Sets the SSID and SSID Length. Note that an Access Point can have either a visible or hidden SSID. If an Access Point uses a hidden SSID then an active scan must be used. Parameters: p_ssid - Pointer to SSID buffer ssidLength - number of bytes in SSID Returns: None */ void DRV_WIFI_SsidSet(uint8_t *p_ssid, uint8_t ssidLength) { SYS_ASSERT(ssidLength <= DRV_WIFI_MAX_SSID_LENGTH, ""); LowLevel_CPSetElement(WF_CP_ELEMENT_SSID, /* Element ID */ (uint8_t *)p_ssid, /* pointer to element data */ ssidLength); /* number of element data bytes */ memcpy(p_wifi_ConfigData->netSSID,p_ssid,ssidLength); p_wifi_ConfigData->SsidLength=ssidLength; p_wifi_ConfigData->netSSID[ssidLength]=0x00; }
/******************************************************************************* Function: void WF_SsidSet(uint8_t *p_ssid, uint8_t *p_ssidLength) Summary: Sets the SSID for the specified Connection Profile ID. Description: Sets the SSID and SSID Length elements in the Connection Profile. Note that an Access Point can have either a visible or hidden SSID. If an Access Point uses a hidden SSID then an active scan must be used (see scanType field in the Connection Algorithm). Precondition: MACInit must be called first. Parameters: p_ssid - Pointer to the SSID string ssidLength - Number of bytes in the SSID Returns: None. Remarks: None. *****************************************************************************/ void WF_SsidSet(uint8_t *p_ssid, uint8_t ssidLength) { #if defined(WF_ERROR_CHECKING) uint32_t errorCode = UdSetSsid(p_ssid, ssidLength); if (errorCode != UD_SUCCESS) { EventEnqueue(WF_EVENT_ERROR, errorCode); return; } #endif LowLevel_CPSetElement(WF_CP_ELEMENT_SSID, /* Element ID */ p_ssid, /* pointer to element data */ ssidLength); /* number of element data bytes */ }
/******************************************************************************* Function: void WF_NetworkTypeSet(uint8_t networkType) Summary: Sets the network for the specified Connection Profile ID. Description: Sets the Network Type element a Connection Profile. Allowable values are: * WF_NETWORK_TYPE_INFRASTRUCTURE * WF_NETWORK_TYPE_ADHOC Precondition: Parameters: networkType - Type of network to create (infrastructure or adhoc) Returns: None. Remarks: None. *****************************************************************************/ void WF_NetworkTypeSet(uint8_t networkType) { #if defined(WF_ERROR_CHECKING) uint32_t errorCode; errorCode = UdSetNetworkType(networkType); if (errorCode != UD_SUCCESS) { EventEnqueue(WF_EVENT_ERROR, errorCode); return; } #endif LowLevel_CPSetElement(WF_CP_ELEMENT_NETWORK_TYPE, /* Element ID */ &networkType, /* pointer to element data */ 1); /* number of element data bytes */ }
/* Function: void DRV_WIFI_BssidSet(uint8_t *p_bssid); Summary: Sets the the Basic Service Set Identifier (BSSID). Description: This sets 6 byte (48-bit) MAC address of the Access Point that is being scanned for. It is optional to use this. Where it is useful is if there are two AP's with the same ID; the BSSID is used to connect to the specified AP. This setting can be used in lieu of the SSID. Set each byte to 0xFF (default) if the BSSID is not being used. Not typically needed. Parameters: p_context - pointer to BSSID Returns: None */ void DRV_WIFI_BssidSet(uint8_t *p_bssid) { LowLevel_CPSetElement(WF_CP_ELEMENT_BSSID, /* Element ID */ p_bssid, /* pointer to element data */ DRV_WIFI_BSSID_LENGTH); /* number of element data bytes */ }
void SetHiddenSsid(bool hiddenSsid) { LowLevel_CPSetElement(WF_CP_ELEMENT_SSID_TYPE, // Element ID (uint8_t *)&hiddenSsid, // pointer to element data 1); // number of element data bytes }
// called from SetAdhocContext(). Error checking performed there void SetAdHocMode(uint8_t mode) { LowLevel_CPSetElement(WF_CP_ELEMENT_ADHOC_BEHAVIOR, // Element ID &mode, // pointer to element data 1); // number of element data bytes }