本文整理汇总了C++中WaitForMgmtResponse函数的典型用法代码示例。如果您正苦于以下问题:C++ WaitForMgmtResponse函数的具体用法?C++ WaitForMgmtResponse怎么用?C++ WaitForMgmtResponse使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了WaitForMgmtResponse函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: LowLevel_CAGetElement
/*******************************************************************************
Function:
static void LowLevel_CAGetElement(uint8_t elementId,
uint8_t *p_elementData,
uint8_t elementDataLength,
uint8_t dataReadAction)
Summary:
Get an element of the connection algorithm on the MRF24W.
Description:
Low-level function to send the appropriate management message to the
MRF24W to get the Connection Algorithm element.
Precondition:
MACInit must be called first.
Parameters:
elementId - Element that is being read
p_elementData - Pointer to where element data will be written
elementDataLength - Number of element data bytes that will be read
dataReadAction - If TRUE then read data per paramters and free mgmt response buffer.
If FALSE then return after response received, do not read any data as the
caller will do that, and don't free buffer, as caller will do that as well.
Returns:
None.
Remarks:
All Connection Algorithm 'Get Element' functions call this function to
construct the management message. The caller must fix up any endian issues
after getting the data from this function.
*****************************************************************************/
static void LowLevel_CAGetElement(uint8_t elementId,
uint8_t *p_elementData,
uint8_t elementDataLength,
bool dataReadAction)
{
uint8_t hdrBuf[4];
hdrBuf[0] = WF_MGMT_REQUEST_TYPE; /* indicate this is a mgmt msg */
hdrBuf[1] = WF_CA_GET_ELEMENT_SUBTYPE; /* mgmt request subtype */
hdrBuf[2] = elementId; /* Element ID */
hdrBuf[3] = 0; /* not used */
SendMgmtMsg(hdrBuf,
sizeof(hdrBuf),
NULL,
0);
if (dataReadAction == true)
{
/* wait for mgmt response, read desired data, and then free response buffer */
WaitForMgmtResponseAndReadData(WF_CA_GET_ELEMENT_SUBTYPE,
elementDataLength, /* num data bytes to read */
sizeof(tCAElementResponseHdr), /* index of first byte of element data */
p_elementData); /* where to write element data */
}
else
{
/* wait for mgmt response, don't read any data bytes, do not release mgmt buffer */
WaitForMgmtResponse(WF_CA_GET_ELEMENT_SUBTYPE, DO_NOT_FREE_MGMT_BUFFER);
}
}
开发者ID:757Nauman,项目名称:chipKIT32-MAX,代码行数:64,代码来源:wf_connection_algorithm.c
示例2: WF_Connect
/*******************************************************************************
Function:
void WF_Connect()
Summary:
Commands the MRF24WB0MA/B or MRF24WG0MA/B to start a connection.
Description:
Directs the Connection Manager to scan for and connect to a WiFi network.
This function does not wait until the connection attempt is successful, but
returns immediately. See WF_ProcessEvent for events that can occur as a
result of a connection attempt being successful or not.
Note that if the Connection Profile being used has WPA or WPA2 security
enabled and is using a passphrase, the connection manager will first
calculate the PSK key, and then start the connection process. The key
calculation can take up to 30 seconds.
Precondition:
MACInit must be called first.
Parameters:
CpId - If this value is equal to an existing Connection Profile�s ID than
only that Connection Profile will be used to attempt a connection to
a WiFi network.
If this value is set to WF_CM_CONNECT_USING_LIST then the
connectionProfileList will be used to connect, starting with the
first Connection Profile in the list.
Returns:
None.
Remarks:
None.
*****************************************************************************/
void WF_Connect(void)
{
uint8_t hdrBuf[4];
#if defined(WF_ERROR_CHECKING)
{
uint32_t errorCode;
errorCode = UdCheckConnectionConfig();
if (errorCode != UD_SUCCESS)
{
EventEnqueue(WF_EVENT_ERROR, errorCode);
return;
}
}
#endif /* WF_ERROR_CHECKING */
/* Write out header portion of msg (which is whole msg, there is no data) */
hdrBuf[0] = WF_MGMT_REQUEST_TYPE; /* indicate this is a mgmt msg */
hdrBuf[1] = WF_CM_CONNECT_SUBYTPE; /* mgmt request subtype */
hdrBuf[2] = GetCpid();
hdrBuf[3] = 0;
SendMgmtMsg(hdrBuf,
sizeof(hdrBuf),
NULL,
0);
/* wait for mgmt response, free after it comes in, don't need data bytes */
WaitForMgmtResponse(WF_CM_CONNECT_SUBYTPE, FREE_MGMT_BUFFER);
}
开发者ID:757Nauman,项目名称:chipKIT32-MAX,代码行数:66,代码来源:wf_connection_algorithm.c
示例3: WF_Disconnect
/*******************************************************************************
Function:
UINT16 WF_Disconnect(void)
Summary:
Commands the MRF24WG to close any open connections and/or to cease attempting
to connect.
Description:
Directs the Connection Manager to close any open connection or connection
attempt in progress. No further attempts to connect are taken until
WF_Connect() is called.
Precondition:
Parameters:
None.
Returns:
None
Remarks:
None.
*****************************************************************************/
void WF_Disconnect(void)
{
uint8_t hdrBuf[2];
uint8_t connectionState; // not used, but required for function call
/* WARNING !!! :
* Disconnect is allowed only in connected state.
* If module FW is in the midst of connection (or reconnection) process, then
* disconnect can hammer connection process, and furthermore it may cause
* fatal failure in module FW operation.
*/
// verify it is OK to issue a disconnect command
WF_ConnectionStateGet(&connectionState);
if ((connectionState != WF_CSTATE_CONNECTED_INFRASTRUCTURE) && (connectionState != WF_CSTATE_CONNECTED_ADHOC))
{
EventEnqueue(WF_EVENT_ERROR, UD_ERROR_DISCONNECT_NOT_ALLOWED);
return;
}
hdrBuf[0] = WF_MGMT_REQUEST_TYPE;
hdrBuf[1] = WF_CM_DISCONNECT_SUBYTPE;
SendMgmtMsg(hdrBuf,
sizeof(hdrBuf),
NULL,
0);
/* wait for mgmt response, free after it comes in, don't need data bytes */
WaitForMgmtResponse(WF_CM_DISCONNECT_SUBYTPE, FREE_MGMT_BUFFER);
UdSetConnectionState(CS_NOT_CONNECTED);
}
开发者ID:757Nauman,项目名称:chipKIT32-MAX,代码行数:58,代码来源:wf_connection_algorithm.c
示例4: CPElementGet
/*******************************************************************************
Function:
static void CPElementGet(uint8_t elementId,
uint8_t *p_elementData,
uint8_t elementDataLength,
uint8_t dataReadAction)
Summary:
Get an element of the connection profile on the MRF24W.
Description:
All Connection Profile 'Get Element' functions call this function to
construct the management message. The caller must fix up any endian issues
prior to calling this function.
Precondition:
MACInit must be called first.
Parameters:
elementId - Element that is being read.
p_elementData - Pointer to where element data will be written.
elementDataLength - Number of element data bytes that will be read.
dataReadAction - If true then read data per paramters and free mgmt
response buffer. If false then return after response
received, do not read any data as the caller will do that,
and don't free buffer, as caller will do that as well.
Returns:
None.
Remarks:
None.
*******************************************************************************/
static void CPElementGet(uint8_t elementId,
uint8_t *p_elementData,
uint8_t elementDataLength,
uint8_t dataReadAction) /* true or false */
{
uint8_t hdrBuf[4];
hdrBuf[0] = WF_MGMT_REQUEST_TYPE; /* indicate this is a mgmt msg */
hdrBuf[1] = WF_CP_GET_ELEMENT_SUBTYPE; /* mgmt request subtype */
hdrBuf[2] = CPID; /* Connection Profile ID */
hdrBuf[3] = elementId; /* Element ID */
SendMgmtMsg(hdrBuf, sizeof(hdrBuf), NULL, 0);
if (dataReadAction == (uint8_t)true)
{
/* wait for mgmt response, read desired data, and then free response buffer */
WaitForMgmtResponseAndReadData(WF_CP_GET_ELEMENT_SUBTYPE, elementDataLength,
sizeof(CPELEMENT_RESPONSE_HDR), p_elementData);
}
else
{
/* wait for mgmt response, don't read any data bytes, do not release mgmt buffer */
WaitForMgmtResponse(WF_CP_GET_ELEMENT_SUBTYPE, DO_NOT_FREE_MGMT_BUFFER);
}
}
开发者ID:TheThingsProducts,项目名称:gateway,代码行数:59,代码来源:drv_wifi_connection_profile.c
示例5: LowLevel_CPGetElement
/*******************************************************************************
Function:
static void LowLevel_CPGetElement(UINT8 CpId,
UINT8 elementId,
UINT8 *p_elementData,
UINT8 elementDataLength,
UINT8 dataReadAction)
Summary:
Get an element of the connection profile on the MRF24W.
Description:
All Connection Profile 'Get Element' functions call this function to
construct the management message. The caller must fix up any endian issues
prior to calling this function.
Precondition:
MACInit must be called first.
Parameters:
CpId - Connection Profile ID
elementId - Element that is being read
p_elementData - Pointer to where element data will be written
elementDataLength - Number of element data bytes that will be read
dataReadAction - If TRUE then read data per paramters and free mgmt
response buffer. If FALSE then return after response
received, do not read any data as the caller will do that,
and don't free buffer, as caller will do that as well.
Returns:
None.
Remarks:
None.
*****************************************************************************/
static void LowLevel_CPGetElement(UINT8 CpId,
UINT8 elementId,
UINT8 *p_elementData,
UINT8 elementDataLength,
UINT8 dataReadAction) /* TRUE or FALSE */
{
UINT8 hdrBuf[4];
hdrBuf[0] = WF_MGMT_REQUEST_TYPE; /* indicate this is a mgmt msg */
hdrBuf[1] = WF_CP_GET_ELEMENT_SUBTYPE; /* mgmt request subtype */
hdrBuf[2] = CpId; /* Connection Profile ID */
hdrBuf[3] = elementId; /* Element ID */
SendMgmtMsg(hdrBuf, /* msg header */
sizeof(hdrBuf), /* msg header length */
NULL, /* msg data */
0); /* msg data length */
if (dataReadAction == (UINT8)TRUE)
{
/* wait for mgmt response, read desired data, and then free response buffer */
WaitForMgmtResponseAndReadData(WF_CP_GET_ELEMENT_SUBTYPE,
elementDataLength, /* num data bytes to read */
sizeof(tCPElementResponseHdr), /* index of first byte of element data */
p_elementData); /* where to write element data */
}
else
{
/* wait for mgmt response, don't read any data bytes, do not release mgmt buffer */
WaitForMgmtResponse(WF_CP_GET_ELEMENT_SUBTYPE, DO_NOT_FREE_MGMT_BUFFER);
}
}
开发者ID:guillaume9433,项目名称:Microchip,代码行数:67,代码来源:WFConnectionProfile.c
示例6: WF_CMDisconnect
/*******************************************************************************
Function:
uint16_t WF_CMDisconnect(void)
Summary:
Commands the MRF24W to close any open connections and/or to cease
attempting to connect.
Description:
Directs the Connection Manager to close the open connection.
No further attempts to connect are taken until WF_CMConnect() is called.
Precondition:
MACInit must be called.
Parameters:
None.
Returns:
Operation results. Success or Failure
Remarks:
Disconnection can work only in the connected state.
To use this API safely, we recommend to disable module FW connection
manager by setting WF_MODULE_CONNECTION_MANAGER == WF_DISABLED
in drv_wifi_config.h
*****************************************************************************/
uint16_t WF_CMDisconnect(void)
{
uint8_t hdrBuf[2];
/* Check if we can call disconnect. Disconnect can work only in the connected state */
if (!WF_CMIsDisconnectAllowed())
{
return WF_ERROR_DISCONNECT_FAILED;
}
hdrBuf[0] = WF_MGMT_REQUEST_TYPE;
hdrBuf[1] = WF_CM_DISCONNECT_SUBYTPE;
SendMgmtMsg(hdrBuf,
sizeof(hdrBuf),
NULL,
0);
/* wait for mgmt response, free after it comes in, don't need data bytes */
WaitForMgmtResponse(WF_CM_DISCONNECT_SUBYTPE, FREE_MGMT_BUFFER);
/* set state to no connection */
SetLogicalConnectionState(false);
return WF_SUCCESS;
}
开发者ID:243-510-MA,项目名称:243-510-A15,代码行数:53,代码来源:drv_wifi_connection_manager.c
示例7: WaitForMgmtResponseAndReadData
/*****************************************************************************
* FUNCTION: WaitForMgmtRespAndReadData
*
* RETURNS: None
*
* PARAMS: expectedSubtype -- management message subtype that we are expecting
* p_data -- pointer where any desired management data bytes
* will be written
* numDataBytes -- Number of data bytes from mgmt response to write to
* p_data. Data always starts at index 4 of mgmt response.
* skipDataRead -- if TRUE, then no data will be read and the mgmt buffer will not
* be freed. If FALSE, the data will be read and the mgmt buffer
* will be freed.
*
* NOTES: Waits for the mgmt response message and validates it by:
* 1) checking the result field
* 2) verifying that the received subtype matches the execpted subtype
*
* In addition, this function reads the desired number of data bytes from
* the mgmt response, copies them to p_data, and then frees the mgmt buffer.
*****************************************************************************/
void WaitForMgmtResponseAndReadData(UINT8 expectedSubtype,
UINT8 numDataBytes,
UINT8 startIndex,
UINT8 *p_data)
{
tMgmtMsgRxHdr hdr; /* management msg header struct */
WaitForMgmtResponse(expectedSubtype, DO_NOT_FREE_MGMT_BUFFER);
/* if made it here then received a management message */
RawRead(RAW_RX_ID, 0, (UINT16)(sizeof(tMgmtMsgRxHdr)), (UINT8 *)&hdr);
/* check header result and subtype fields */
WF_ASSERT(hdr.result == WF_SUCCESS || hdr.result == WF_ERROR_NO_STORED_BSS_DESCRIPTOR);
WF_ASSERT(hdr.subtype == expectedSubtype);
/* if caller wants to read data from this mgmt response */
if (numDataBytes > 0)
{
RawRead(RAW_RX_ID, startIndex, numDataBytes, p_data);
}
/* free the mgmt buffer */
DeallocateMgmtRxBuffer();
/* if there was a mounted data packet prior to the mgmt tx/rx transaction, then restore it */
if (RestoreRxData == TRUE)
{
RestoreRxData = FALSE;
PopRawWindow(RAW_RX_ID);
SetRawWindowState(RAW_RX_ID, WF_RAW_DATA_MOUNTED);
}
}
开发者ID:Subaru-PFS,项目名称:ics_xcu_pcm,代码行数:56,代码来源:WFMgmtMsg.c
示例8: WaitForMgmtResponseAndReadData
/*******************************************************************************
Function:
void WaitForMgmtResponseAndReadData(UINT8 expectedSubtype, UINT8 numDataBytes,
UINT8 startIndex, UINT8 *p_data)
Summary:
Waits for a management response and read data.
Description:
Waits for the mgmt response message and validates it by:
1) checking the result field
2) verifying that the received subtype matches the expected subtype
In addition, this function reads the desired number of data bytes from
the mgmt response, copies them to p_data, and then frees the mgmt buffer.
Precondition:
MACInit must be called.
Parameters:
expectedSubtype -- management message subtype that we are expecting
p_data -- pointer where any desired management data bytes will be written
numDataBytes -- Number of data bytes from mgmt response to write to
p_data. Data always starts at index 4 of mgmt response.
skipDataRead -- if TRUE, then no data will be read and the mgmt buffer will not
be freed. If FALSE, the data will be read and the mgmt buffer
will be freed.
Returns:
None
Remarks:
*****************************************************************************/
void WaitForMgmtResponseAndReadData(UINT8 expectedSubtype,
UINT8 numDataBytes,
UINT8 startIndex,
UINT8 *p_data)
{
tMgmtMsgRxHdr hdr; /* management msg header struct */
WaitForMgmtResponse(expectedSubtype, DO_NOT_FREE_MGMT_BUFFER);
/* if made it here then received a management message */
RawRead(RAW_MGMT_RX_ID, 0, (UINT16)(sizeof(tMgmtMsgRxHdr)), (UINT8 *)&hdr);
/* check header result and subtype fields */
WF_ASSERT(hdr.result == WF_SUCCESS || hdr.result == WF_ERROR_NO_STORED_BSS_DESCRIPTOR);
WF_ASSERT(hdr.subtype == expectedSubtype);
/* if caller wants to read data from this mgmt response */
if (numDataBytes > 0)
{
RawRead(RAW_MGMT_RX_ID, startIndex, numDataBytes, p_data);
}
/* free the mgmt buffer */
DeallocateMgmtRxBuffer();
}
开发者ID:cnkker,项目名称:Microchip,代码行数:58,代码来源:WFMgmtMsg_24G.c
示例9: WF_CMDisconnect
/*******************************************************************************
Function:
UINT16 WF_CMDisconnect(void)
Summary:
Commands the MRF24W to close any open connections and/or to cease
attempting to connect.
Description:
Directs the Connection Manager to close any open connection or connection
attempt in progress. No further attempts to connect are taken until
WF_CMConnect() is called. Generates the event
WF_EVENT_CONNECTION_PERMANENTLY_LOST when the connection is successfully
terminated.
Precondition:
MACInit must be called.
Parameters:
None.
Returns:
Operation results. Success or Failure
Remarks:
None.
*****************************************************************************/
UINT16 WF_CMDisconnect(void)
{
UINT8 hdrBuf[2];
/* WARNING !!! :
* Disconnect is allowed only in connected state.
* If module FW is in the midst of connection ( or reconenction) process, then
* disconnect can hammer connection process, and furthermore it may cause
* fatal failure in module FW operation. To be safte to use disconnect, we strongly
* recommend you to disable module FW connection manager by uncommenting
* #define DISABLE_MODULE_FW_CONNECT_MANAGER_IN_INFRASTRUCTURE
* in WF_Config.h
*/
if (!WF_CMIsDisconnectAllowed())
return WF_ERROR_DISCONNECT_FAILED;
hdrBuf[0] = WF_MGMT_REQUEST_TYPE;
hdrBuf[1] = WF_CM_DISCONNECT_SUBYTPE;
SendMgmtMsg(hdrBuf,
sizeof(hdrBuf),
NULL,
0);
/* wait for mgmt response, free after it comes in, don't need data bytes */
WaitForMgmtResponse(WF_CM_DISCONNECT_SUBYTPE, FREE_MGMT_BUFFER);
/* set state to no connection */
SetLogicalConnectionState(FALSE);
return WF_SUCCESS;
}
开发者ID:guillaume9433,项目名称:Microchip,代码行数:59,代码来源:WFConnectionManager.c
示例10: DRV_WIFI_Scan
/*******************************************************************************
Function:
uint16_t DRV_WIFI_Scan(bool scanAll)
Summary:
Commands the MRF24W to start a scan operation. This will generate the
WF_EVENT_SCAN_RESULTS_READY event.
Description:
Directs the MRF24W to initiate a scan operation. The Host Application will
be notified that the scan results are ready when it receives the
WF_EVENT_SCAN_RESULTS_READY event. The eventInfo field for this event will
contain the number of scan results. Once the scan results are ready they
can be retrieved with DRV_WIFI_ScanGetResult().
Scan results are retained on the MRF24W until:
1. Calling DRV_WIFI_Scan() again (after scan results returned from previous
call).
2. MRF24W reset.
Parameters:
scanAll -
If false:
* If SSID defined then only scan results with that SSID are retained.
* If SSID not defined then all scanned SSID’s will be retained
* Only scan results from Infrastructure or AdHoc networks are retained
* The channel list that is scanned will be determined from the channels
passed in via DRV_WIFI_ChannelListSet().
If true:
* All scan results are retained (both Infrastructure and Ad Hoc
networks).
* All channels within the MRF24W’s regional domain will be
scanned.
Returns:
None.
*****************************************************************************/
uint16_t DRV_WIFI_Scan(bool scanAll)
{
uint8_t hdr[4];
/* WARNING !!! :
* Host scan is allowed only in idle or connected state.
* If module FW is in the midst of connection ( or reconenction) process, then
* host scan can hammer connection process, and furthermore it may cause
* fatal failure in module FW operation. To be safte to use host scan, we strongly
* recommend you to disable module FW connection manager by setting
* WF_MODULE_CONNECTION_MANAGER == DRV_WIFI_DISABLED in wf_drv_config.h
*/
if (!isHostScanAllowed())
{
return DRV_WIFI_ERROR_OPERATION_CANCELLED;
}
hdr[0] = WF_MGMT_REQUEST_TYPE;
hdr[1] = WF_SCAN_START_SUBTYPE;
hdr[2] = (scanAll == true)?0xff:CPID;
hdr[3] = 0; /* not used */
SendMgmtMsg(hdr, /* header */
sizeof(hdr), /* size of header */
NULL, /* no data */
0); /* no data */
/* wait for mgmt response, free it after it comes in (no data needed) */
WaitForMgmtResponse(WF_SCAN_START_SUBTYPE, FREE_MGMT_BUFFER);
return DRV_WIFI_SUCCESS;
}
开发者ID:ufanders,项目名称:wordClock,代码行数:70,代码来源:drv_wifi_scan.c
示例11: ConnectionProfileCreate
// creates a connection profile on MRF24WG that will be used forever
void ConnectionProfileCreate(void)
{
uint8_t hdr[2];
hdr[0] = WF_MGMT_REQUEST_TYPE;
hdr[1] = WF_CP_CREATE_PROFILE_SUBTYPE;
SendMgmtMsg(hdr, sizeof(hdr), NULL, 0);
/* wait for MRF24W management response, read data, free response after read */
WaitForMgmtResponse(WF_CP_CREATE_PROFILE_SUBTYPE, FREE_MGMT_BUFFER);
}
开发者ID:TheThingsProducts,项目名称:gateway,代码行数:13,代码来源:drv_wifi_connection_profile.c
示例12: WF_CPDelete
/*******************************************************************************
Function:
void WF_CPDelete(UINT8 CpId)
Summary:
Deletes a Connection Profile on the MRF24W.
Description:
Deletes the specified Connection Profile. If the Connection Profile was in
FLASH it will be erased from FLASH.
NOTE: First release of this code will not support FLASH, only the two CP’s
in memory.
Precondition:
MACInit must be called first.
Parameters:
CpId - Connection Profile to delete.
Returns:
None.
Remarks:
None.
*****************************************************************************/
void WF_CPDelete(UINT8 CpId)
{
UINT8 hdr[2];
hdr[0] = WF_MGMT_REQUEST_TYPE;
hdr[1] = WF_CP_DELETE_PROFILE_SUBTYPE;
SendMgmtMsg(hdr,
sizeof(hdr),
&CpId, /* input data */
1); /* data size */
/* wait for mgmt response, free it after it comes in (no data needed) */
WaitForMgmtResponse(WF_CP_DELETE_PROFILE_SUBTYPE, FREE_MGMT_BUFFER);
}
开发者ID:guillaume9433,项目名称:Microchip,代码行数:41,代码来源:WFConnectionProfile.c
示例13: SendPowerModeMsg
static void SendPowerModeMsg(t_WFPwrModeReq *p_powerMode)
{
uint8_t hdr[2];
hdr[0] = WF_MGMT_REQUEST_TYPE;
hdr[1] = WF_SET_POWER_MODE_SUBTYPE;
SendMgmtMsg(hdr,
sizeof(hdr),
(uint8_t *)p_powerMode,
sizeof(t_WFPwrModeReq));
/* wait for mgmt response, free buffer after it comes in (no data to read) */
WaitForMgmtResponse(WF_SET_POWER_MODE_SUBTYPE, FREE_MGMT_BUFFER);
}
开发者ID:ricklon,项目名称:deIPcK,代码行数:15,代码来源:wf_power.c
示例14: SetSecurity
/*******************************************************************************
Function:
void SetSecurity(uint8_t securityType,
uint8_t *p_securityKey,
uint8_t securityKeyLength)
Summary:
Sets the security
Description:
Configures security
<table>
Security Key Length
-------- --- ------
DRV_WIFI_SECURITY_OPEN N/A N/A
DRV_WIFI_SECURITY_WEP_40 hex 4, 5 byte keys
DRV_WIFI_SECURITY_WEP_104 hex 4, 13 byte keys
DRV_WIFI_SECURITY_WPA_WITH_KEY hex 32 bytes
DRV_WIFI_SECURITY_WPA_WITH_PASS_PHRASE ascii 8-63 ascii characters
DRV_WIFI_SECURITY_WPA2_WITH_KEY hex 32 bytes
DRV_WIFI_SECURITY_WPA2_WITH_PASS_PHRASE ascii 8-63 ascii characters
DRV_WIFI_SECURITY_WPA_AUTO_WITH_KEY hex 32 bytes
DRV_WIFI_SECURITY_WPA_AUTO_WITH_PASS_PHRASE ascii 8-63 ascii characters
</table>
Precondition:
MACInit must be called first.
Parameters:
securityType - Value corresponding to the security type desired.
p_securityKey - Binary key or passphrase (not used if security is
DRV_WIFI_SECURITY_OPEN)
securityKeyLength - Number of bytes in p_securityKey (not used if security
is DRV_WIFI_SECURITY_OPEN)
Returns:
None.
Remarks:
None.
*****************************************************************************/
static void SetSecurity(uint8_t securityType,
uint8_t *p_securityKey,
uint8_t securityKeyLength)
{
uint8_t hdrBuf[7];
uint8_t *p_key;
/* Write out header portion of msg */
hdrBuf[0] = WF_MGMT_REQUEST_TYPE; /* indicate this is a mgmt msg */
hdrBuf[1] = WF_CP_SET_ELEMENT_SUBTYPE; /* mgmt request subtype */
hdrBuf[2] = CPID; /* Connection Profile ID */
hdrBuf[3] = WF_CP_ELEMENT_SECURITY; /* Element ID */
/* Next to header bytes are really part of data, but need to put them in header*/
/* bytes in order to prepend to security key */
hdrBuf[5] = securityType;
hdrBuf[6] = 0; /* only support wep key index 0 */
/* if security is open (no key) or WPS push button method */
if (securityType == DRV_WIFI_SECURITY_OPEN ||
securityType == DRV_WIFI_SECURITY_WPS_PUSH_BUTTON ||
securityType == DRV_WIFI_SECURITY_EAP)
{
hdrBuf[4] = 2; /* Only data is security type and wep index */
p_key = NULL;
securityKeyLength = 0;
}
/* else security is selected, so need to send key */
else
{
hdrBuf[4] = 2 + securityKeyLength; /* data is security type + wep index + key */
p_key = p_securityKey;
}
SendMgmtMsg(hdrBuf, /* msg header which includes the security type and WEP index) */
sizeof(hdrBuf), /* msg header length */
p_key, /* msg data (security key), can be NULL */
securityKeyLength); /* msg data length (will be 0 if p_securityKey is NULL) */
/* wait for mgmt response, free after it comes in, don't need data bytes */
WaitForMgmtResponse(WF_CP_SET_ELEMENT_SUBTYPE, FREE_MGMT_BUFFER);
p_wifi_ConfigData->SecurityMode = securityType;
p_wifi_ConfigData->SecurityKeyLength = securityKeyLength;
memcpy(p_wifi_ConfigData->SecurityKey,p_securityKey,securityKeyLength);
}
开发者ID:ctapang,项目名称:v0_70b,代码行数:89,代码来源:drv_wifi_connection_profile.c
示例15: WF_CPSetSecurity
/*******************************************************************************
Function:
void WF_CPSetSecurity(UINT8 CpId,
UINT8 securityType,
UINT8 wepKeyIndex,
UINT8 *p_securityKey,
UINT8 securityKeyLength)
Summary:
Sets the security for the specified Connection Profile.
Description:
Configures security for a Connection Profile.
<table>
Security Key Length
-------- --- ------
WF_SECURITY_OPEN N/A N/A
WF_SECURITY_WEP_40 hex 4, 5 byte keys
WF_SECURITY_WEP_104 hex 4, 13 byte keys
WF_SECURITY_WPA_WITH_KEY hex 32 bytes
WF_SECURITY_WPA_WITH_PASS_PHRASE ascii 8-63 ascii characters
WF_SECURITY_WPA2_WITH_KEY hex 32 bytes
WF_SECURITY_WPA2_WITH_PASS_PHRASE ascii 8-63 ascii characters
WF_SECURITY_WPA_AUTO_WITH_KEY hex 32 bytes
WF_SECURITY_WPA_AUTO_WITH_PASS_PHRASE ascii 8-63 ascii characters
WF_SECURITY_WPS_PUSH_BUTTON
WF_SECURITY_WPS_PIN
WF_SECURITY_WPA2_ENTERPRISE
</table>
Precondition:
MACInit must be called first.
Parameters:
CpId - Connection Profile ID
securityType - Value corresponding to the security type desired.
wepKeyIndex - Only index 0 is valid. (Applicable for WF_SECURITY_WEP_40 or
WF_SECURITY_WEP_104)
p_securityKey - Binary key or passphrase (not used if security is
WF_SECURITY_OPEN)
securityKeyLength - Number of bytes in p_securityKey (not used if security
is WF_SECURITY_OPEN)
Returns:
None.
Remarks:
None.
*****************************************************************************/
void WF_CPSetSecurity(UINT8 CpId,
UINT8 securityType,
UINT8 wepKeyIndex,
UINT8 *p_securityKey,
UINT8 securityKeyLength)
{
UINT8 hdrBuf[7];
UINT8 *p_key;
/* Write out header portion of msg */
hdrBuf[0] = WF_MGMT_REQUEST_TYPE; /* indicate this is a mgmt msg */
hdrBuf[1] = WF_CP_SET_ELEMENT_SUBTYPE; /* mgmt request subtype */
hdrBuf[2] = CpId; /* Connection Profile ID */
hdrBuf[3] = WF_CP_ELEMENT_SECURITY; /* Element ID */
/* Next to header bytes are really part of data, but need to put them in header */
/* bytes in order to prepend to security key */
hdrBuf[5] = securityType;
hdrBuf[6] = wepKeyIndex;
/* if security is open (no key) or WPS push button or WPA2 enterprise method */
if (securityType == WF_SECURITY_OPEN
|| securityType == WF_SECURITY_WPS_PUSH_BUTTON
|| securityType == WF_SECURITY_WPA2_ENTERPRISE)
{
hdrBuf[4] = 2; /* Only data is security type and wep index */
p_key = NULL;
securityKeyLength = 0;
}
/* else security is selected, so need to send key */
else
{
hdrBuf[4] = 2 + securityKeyLength; /* data is security type + wep index + key */
p_key = p_securityKey;
}
SendMgmtMsg(hdrBuf, /* msg header which includes the security type and WEP index) */
sizeof(hdrBuf), /* msg header length */
p_key, /* msg data (security key), can be NULL */
securityKeyLength); /* msg data length (will be 0 if p_securityKey is NULL) */
/* wait for mgmt response, free after it comes in, don't need data bytes */
WaitForMgmtResponse(WF_CP_SET_ELEMENT_SUBTYPE, FREE_MGMT_BUFFER);
}
开发者ID:Athuli7,项目名称:Microchip,代码行数:95,代码来源:WFConnectionProfile.c
示例16: WF_CMConnectWicom
void WF_CMConnectWicom(UINT8 CpId, tWFConnectParams *connParams)
{
UINT8 hdrBuf[4];
/* Write out header portion of msg (which is whole msg, there is no data) */
hdrBuf[0] = WF_MGMT_REQUEST_TYPE; /* indicate this is a mgmt msg */
hdrBuf[1] = WF_CM_CONNECT_SUBYTPE; /* mgmt request subtype */
hdrBuf[2] = CpId;
hdrBuf[3] = 0;
SendMgmtMsg(hdrBuf,
sizeof(hdrBuf),
(UINT8 *)connParams,
sizeof(tWFConnectParams));
/* wait for mgmt response, free after it comes in, don't need data bytes */
WaitForMgmtResponse(WF_CM_CONNECT_SUBYTPE, FREE_MGMT_BUFFER);
}
开发者ID:guillaume9433,项目名称:Microchip,代码行数:18,代码来源:WFConnectionManager.c
示例17: WF_CMConnect
/*******************************************************************************
Function:
void WF_CMConnect(uint8_t CpId)
Summary:
Commands the MRF24W to start a connection.
Description:
Directs the Connection Manager to scan for and connect to a WiFi network.
This function does not wait until the connection attempt is successful, but
returns immediately. See WF_ProcessEvent for events that can occur as a
result of a connection attempt being successful or not.
Note that if the Connection Profile being used has WPA-PSK/WPA2-PSK security
and is using a passphrase, the connection manager will first calculate the PSK,
and then start the connection process. Convert of passphrase to PSK can take up
to 32 seconds in MRF24WB and 25 seconds in MRF24WG.
Precondition:
MACInit must be called first.
Parameters:
CpId - If this value is equal to an existing Connection Profile ID then
only that Connection Profile will be used to attempt a connection to
a WiFi network.
If this value is set to WF_CM_CONNECT_USING_LIST then the
connectionProfileList will be used to connect, starting with the
first Connection Profile in the list.
Returns:
None.
Remarks:
None.
*****************************************************************************/
void WF_CMConnect(uint8_t CpId)
{
uint8_t hdrBuf[4];
/* Write out header portion of msg (which is whole msg, there is no data) */
hdrBuf[0] = WF_MGMT_REQUEST_TYPE; /* indicate this is a mgmt msg */
hdrBuf[1] = WF_CM_CONNECT_SUBYTPE; /* mgmt request subtype */
hdrBuf[2] = CpId;
hdrBuf[3] = 0;
SendMgmtMsg(hdrBuf,
sizeof(hdrBuf),
NULL,
0);
/* wait for mgmt response, free after it comes in, don't need data bytes */
WaitForMgmtResponse(WF_CM_CONNECT_SUBYTPE, FREE_MGMT_BUFFER);
}
开发者ID:243-510-MA,项目名称:243-510-A15,代码行数:53,代码来源:drv_wifi_connection_manager.c
示例18: CPElementSet
/*******************************************************************************
Function:
static void CPElementSet(uint8_t elementId,
uint8_t *p_elementData,
uint8_t elementDataLength)
Summary:
Set an element of the connection profile on the MRF24W.
Description:
All Connection Profile 'Set Element' functions call this function to
construct the management message. The caller must fix up any endian issues
prior to calling this function.
Precondition:
MACInit must be called first.
Parameters:
elementId - Element that is being set.
p_elementData - Pointer to element data.
elementDataLength - Number of bytes pointed to by p_elementData.
Returns:
None.
Remarks:
None.
*******************************************************************************/
static void CPElementSet(uint8_t elementId,
uint8_t *p_elementData,
uint8_t elementDataLength)
{
uint8_t hdrBuf[5];
/* Write out header portion of msg. */
hdrBuf[0] = WF_MGMT_REQUEST_TYPE; /* indicate this is a mgmt msg */
hdrBuf[1] = WF_CP_SET_ELEMENT_SUBTYPE; /* MGMT Request Subtype */
hdrBuf[2] = CPID; /* Connection Profile ID */
hdrBuf[3] = elementId; /* Element ID */
hdrBuf[4] = elementDataLength; /* number of bytes of element data */
SendMgmtMsg(hdrBuf, sizeof(hdrBuf), p_elementData, elementDataLength);
/* wait for mgmt response, free after it comes in, don't need data bytes */
WaitForMgmtResponse(WF_CP_SET_ELEMENT_SUBTYPE, FREE_MGMT_BUFFER);
}
开发者ID:TheThingsProducts,项目名称:gateway,代码行数:46,代码来源:drv_wifi_connection_profile.c
示例19: LowLevel_CASetElement
/*******************************************************************************
Function:
static void LowLevel_CASetElement(uint8_t elementId,
uint8_t *p_elementData,
uint8_t elementDataLength)
Summary:
Set an element of the c
|
请发表评论