本文整理汇总了C++中UINT32_TO_STREAM函数的典型用法代码示例。如果您正苦于以下问题:C++ UINT32_TO_STREAM函数的具体用法?C++ UINT32_TO_STREAM怎么用?C++ UINT32_TO_STREAM使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UINT32_TO_STREAM函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: accept
long
accept(long sd, sockaddr *addr, socklen_t *addrlen)
{
long ret;
unsigned char *ptr, *args;
tBsdReturnParams tAcceptReturnArguments;
ret = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer;
args = (ptr + HEADERS_SIZE_CMD);
// Fill in temporary command buffer
args = UINT32_TO_STREAM(args, sd);
// Initiate a HCI command
hci_command_send(HCI_CMND_ACCEPT,
ptr, SOCKET_ACCEPT_PARAMS_LEN);
// Since we are in blocking state - wait for event complete
SimpleLinkWaitEvent(HCI_CMND_ACCEPT, &tAcceptReturnArguments);
// need specify return parameters!!!
memcpy(addr, &tAcceptReturnArguments.tSocketAddress, ASIC_ADDR_LEN);
*addrlen = ASIC_ADDR_LEN;
errno = tAcceptReturnArguments.iStatus;
ret = errno;
// if succeeded, iStatus = new socket descriptor. otherwise - error number
if(M_IS_VALID_SD(ret))
{
set_socket_active_status(ret, SOCKET_STATUS_ACTIVE);
}
else
{
set_socket_active_status(sd, SOCKET_STATUS_INACTIVE);
}
return(ret);
}
示例2: UINT32_TO_STREAM
int32_t cc3000_wlan::set_event_mask(uint32_t mask) {
int32_t ret;
uint8_t *ptr;
uint8_t *args;
if ((mask & HCI_EVNT_WLAN_TX_COMPLETE) == HCI_EVNT_WLAN_TX_COMPLETE)
{
_simple_link.set_tx_complete_signal(0);
// Since an event is a virtual event - i.e. it is not coming from CC3000
// there is no need to send anything to the device if it was an only event
if (mask == HCI_EVNT_WLAN_TX_COMPLETE)
{
return 0;
}
mask &= ~HCI_EVNT_WLAN_TX_COMPLETE;
mask |= HCI_EVNT_WLAN_UNSOL_BASE;
}
else
{
_simple_link.set_tx_complete_signal(1);
}
ret = EFAIL;
ptr = _simple_link.get_transmit_buffer();
args = (uint8_t *)(ptr + HEADERS_SIZE_CMD);
// Fill in HCI packet structure
args = UINT32_TO_STREAM(args, mask);
// Initiate a HCI command
_hci.command_send(HCI_CMND_EVENT_MASK, ptr, WLAN_SET_MASK_PARAMS_LEN);
// Wait for command complete event
_event.simplelink_wait_event(HCI_CMND_EVENT_MASK, &ret);
return(ret);
}
示例3: wlan_ioctl_del_profile
INT32 wlan_ioctl_del_profile(UINT32 ulIndex)
{
INT32 ret;
UINT8 *ptr;
UINT8 *args;
ptr = tSLInformation.pucTxCommandBuffer;
args = (UINT8 *)(ptr + HEADERS_SIZE_CMD);
// Fill in HCI packet structure
args = UINT32_TO_STREAM(args, ulIndex);
ret = EFAIL;
// Initiate a HCI command
hci_command_send(HCI_CMND_WLAN_IOCTL_DEL_PROFILE,
ptr, WLAN_DEL_PROFILE_PARAMS_LEN);
// Wait for command complete event
SimpleLinkWaitEvent(HCI_CMND_WLAN_IOCTL_DEL_PROFILE, &ret);
return(ret);
}
示例4: wlan_ioctl_get_scan_results
long
wlan_ioctl_get_scan_results(unsigned long ulScanTimeout,
unsigned char *ucResults)
{
unsigned char *ptr;
unsigned char *args;
ptr = tSLInformation.pucTxCommandBuffer;
args = (ptr + HEADERS_SIZE_CMD);
// Fill in temporary command buffer
args = UINT32_TO_STREAM(args, ulScanTimeout);
// Initiate a HCI command
hci_command_send(HCI_CMND_WLAN_IOCTL_GET_SCAN_RESULTS,
ptr, WLAN_GET_SCAN_RESULTS_PARAMS_LEN);
// Wait for command complete event
SimpleLinkWaitEvent(HCI_CMND_WLAN_IOCTL_GET_SCAN_RESULTS, ucResults);
return(0);
}
示例5: btsnd_hcic_user_passkey_reply
BOOLEAN btsnd_hcic_user_passkey_reply (BD_ADDR bd_addr, UINT32 value)
{
BT_HDR *p;
UINT8 *pp;
if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_U_PKEY_REPLY)) == NULL)
return (FALSE);
pp = (UINT8 *)(p + 1);
p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_U_PKEY_REPLY;
p->offset = 0;
UINT16_TO_STREAM (pp, HCI_USER_PASSKEY_REQ_REPLY);
UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_U_PKEY_REPLY);
BDADDR_TO_STREAM (pp, bd_addr);
UINT32_TO_STREAM (pp, value);
btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
return (TRUE);
}
示例6: wlan_smart_config_start
INT32 wlan_smart_config_start(UINT32 algoEncryptedFlag)
{
INT32 ret;
UINT8 *ptr;
UINT8 *args;
ret = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer;
args = (UINT8 *)(ptr + HEADERS_SIZE_CMD);
// Fill in HCI packet structure
args = UINT32_TO_STREAM(args, algoEncryptedFlag);
ret = EFAIL;
hci_command_send(HCI_CMND_WLAN_IOCTL_SIMPLE_CONFIG_START, ptr,
WLAN_SMART_CONFIG_START_PARAMS_LEN);
// Wait for command complete event
SimpleLinkWaitEvent(HCI_CMND_WLAN_IOCTL_SIMPLE_CONFIG_START, &ret);
return(ret);
}
示例7: SpiReceiveHandler
//.........这里部分代码省略.........
//! connected. An asynchronous "Connected" event is generated when
//! actual association process finishes and CC3000 is connected to
//! the AP. If DHCP is set, An asynchronous "DHCP" event is
//! generated when DHCP process is finish.
//!
//!
//! @brief Connect to AP
//! @warning Please Note that when connection to AP configured with security
//! type WEP, please confirm that the key is set as ASCII and not
//! as HEX.
//! @sa wlan_disconnect
//
//*****************************************************************************
#ifndef CC3000_TINY_DRIVER
#ifdef __ENABLE_MULTITHREADED_SUPPORT__
long c_wlan_connect(unsigned long ulSecType, char *ssid, long ssid_len,
unsigned char *bssid, unsigned char *key, long key_len)
#else /* __ENABLE_MULTITHREADED_SUPPORT__ */
long wlan_connect(unsigned long ulSecType, char *ssid, long ssid_len,
unsigned char *bssid, unsigned char *key, long key_len)
#endif /* __ENABLE_MULTITHREADED_SUPPORT__ */
{
long ret;
unsigned char *ptr;
unsigned char *args;
unsigned char bssid_zero[] = {0, 0, 0, 0, 0, 0};
ret = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer;
args = (ptr + HEADERS_SIZE_CMD);
// Fill in command buffer
args = UINT32_TO_STREAM(args, 0x0000001c);
args = UINT32_TO_STREAM(args, ssid_len);
args = UINT32_TO_STREAM(args, ulSecType);
args = UINT32_TO_STREAM(args, 0x00000010 + ssid_len);
args = UINT32_TO_STREAM(args, key_len);
args = UINT16_TO_STREAM(args, 0);
// padding shall be zeroed
if(bssid)
{
ARRAY_TO_STREAM(args, bssid, ETH_ALEN);
}
else
{
ARRAY_TO_STREAM(args, bssid_zero, ETH_ALEN);
}
ARRAY_TO_STREAM(args, ssid, ssid_len);
if(key_len && key)
{
ARRAY_TO_STREAM(args, key, key_len);
}
// Initiate a HCI command
hci_command_send(HCI_CMND_WLAN_CONNECT, ptr, WLAN_CONNECT_PARAM_LEN +
ssid_len + key_len - 1);
// Wait for command complete event
SimpleLinkWaitEvent(HCI_CMND_WLAN_CONNECT, &ret);
errno = ret;
return(ret);
示例8: c_accept
//*****************************************************************************
//
//! accept
//!
//! @param[in] sd socket descriptor (handle)
//! @param[out] addr the argument addr is a pointer to a sockaddr structure
//! This structure is filled in with the address of the
//! peer socket, as known to the communications layer.
//! determined. The exact format of the address returned
//! addr is by the socket's address sockaddr.
//! On this version only AF_INET is supported.
//! This argument returns in network order.
//! @param[out] addrlen the addrlen argument is a value-result argument:
//! it should initially contain the size of the structure
//! pointed to by addr.
//!
//! @return For socket in blocking mode:
//! On success, socket handle. on failure negative
//! For socket in non-blocking mode:
//! - On connection establishment, socket handle
//! - On connection pending, SOC_IN_PROGRESS (-2)
//! - On failure, SOC_ERROR (-1)
//!
//! @brief accept a connection on a socket:
//! This function is used with connection-based socket types
//! (SOCK_STREAM). It extracts the first connection request on the
//! queue of pending connections, creates a new connected socket, and
//! returns a new file descriptor referring to that socket.
//! The newly created socket is not in the listening state.
//! The original socket sd is unaffected by this call.
//! The argument sd is a socket that has been created with socket(),
//! bound to a local address with bind(), and is listening for
//! connections after a listen(). The argument addr is a pointer
//! to a sockaddr structure. This structure is filled in with the
//! address of the peer socket, as known to the communications layer.
//! The exact format of the address returned addr is determined by the
//! socket's address family. The addrlen argument is a value-result
//! argument: it should initially contain the size of the structure
//! pointed to by addr, on return it will contain the actual
//! length (in bytes) of the address returned.
//!
//! @sa socket ; bind ; listen
//
//*****************************************************************************
long c_accept(long sd, sockaddr *addr, socklen_t *addrlen)
{
long ret;
uint8_t *args;
tBsdReturnParams tAcceptReturnArguments;
ret = EFAIL;
args = hci_get_cmd_buffer();
// Fill in temporary command buffer
args = UINT32_TO_STREAM(args, sd);
// Initiate a HCI command
hci_command_send(HCI_CMND_ACCEPT, SOCKET_ACCEPT_PARAMS_LEN,
HCI_CMND_ACCEPT, &tAcceptReturnArguments);
// need specify return parameters!!!
memcpy(addr, &tAcceptReturnArguments.tSocketAddress, ASIC_ADDR_LEN);
*addrlen = ASIC_ADDR_LEN;
errno = tAcceptReturnArguments.iStatus;
ret = errno;
return(ret);
}
示例9: select
int
select(long nfds, TICC3000fd_set *readsds, TICC3000fd_set *writesds, TICC3000fd_set *exceptsds,
struct timeval *timeout)
{
unsigned char *ptr, *args;
tBsdSelectRecvParams tParams;
unsigned long is_blocking;
if( timeout == NULL)
{
is_blocking = 1; /* blocking , infinity timeout */
}
else
{
is_blocking = 0; /* no blocking, timeout */
}
// Fill in HCI packet structure
ptr = tSLInformation.pucTxCommandBuffer;
args = (ptr + HEADERS_SIZE_CMD);
// Fill in temporary command buffer
args = UINT32_TO_STREAM(args, nfds);
args = UINT32_TO_STREAM(args, 0x00000014);
args = UINT32_TO_STREAM(args, 0x00000014);
args = UINT32_TO_STREAM(args, 0x00000014);
args = UINT32_TO_STREAM(args, 0x00000014);
args = UINT32_TO_STREAM(args, is_blocking);
args = UINT32_TO_STREAM(args, ((readsds) ? *(unsigned long*)readsds : 0));
args = UINT32_TO_STREAM(args, ((writesds) ? *(unsigned long*)writesds : 0));
args = UINT32_TO_STREAM(args, ((exceptsds) ? *(unsigned long*)exceptsds : 0));
if (timeout)
{
if ( 0 == timeout->tv_sec && timeout->tv_usec <
SELECT_TIMEOUT_MIN_MICRO_SECONDS)
{
timeout->tv_usec = SELECT_TIMEOUT_MIN_MICRO_SECONDS;
}
args = UINT32_TO_STREAM(args, timeout->tv_sec);
args = UINT32_TO_STREAM(args, timeout->tv_usec);
}
// Initiate a HCI command
hci_command_send(HCI_CMND_BSD_SELECT, ptr, SOCKET_SELECT_PARAMS_LEN);
// Since we are in blocking state - wait for event complete
SimpleLinkWaitEvent(HCI_EVNT_SELECT, &tParams);
// Update actually read FD
if (tParams.iStatus >= 0)
{
if (readsds)
{
memcpy(readsds, &tParams.uiRdfd, sizeof(tParams.uiRdfd));
}
if (writesds)
{
memcpy(writesds, &tParams.uiWrfd, sizeof(tParams.uiWrfd));
}
if (exceptsds)
{
memcpy(exceptsds, &tParams.uiExfd, sizeof(tParams.uiExfd));
}
return(tParams.iStatus);
}
else
{
errno = tParams.iStatus;
return(-1);
}
}
示例10: simple_link_send
//*****************************************************************************
//
//! simple_link_send
//!
//! @param sd socket handle
//! @param buf write buffer
//! @param len buffer length
//! @param flags On this version, this parameter is not supported
//! @param to pointer to an address structure indicating destination
//! address
//! @param tolen destination address structure size
//!
//! @return Return the number of bytes transmitted, or -1 if an error
//! occurred, or -2 in case there are no free buffers available
//! (only when SEND_NON_BLOCKING is enabled)
//!
//! @brief This function is used to transmit a message to another
//! socket
//
//*****************************************************************************
int
simple_link_send(long sd, const void *buf, long len, long flags,
const sockaddr *to, long tolen, long opcode)
{
unsigned char uArgSize, addrlen;
unsigned char *ptr, *pDataPtr, *args;
unsigned long addr_offset;
int res;
tBsdReadReturnParams tSocketSendEvent;
// Check the bsd_arguments
if (0 != (res = HostFlowControlConsumeBuff(sd)))
{
return res;
}
//Update the number of sent packets
tSLInformation.NumberOfSentPackets++;
// Allocate a buffer and construct a packet and send it over spi
ptr = tSLInformation.pucTxCommandBuffer;
args = (ptr + HEADERS_SIZE_DATA);
// Update the offset of data and parameters according to the command
switch(opcode)
{
case HCI_CMND_SENDTO:
{
addr_offset = len + sizeof(len) + sizeof(len);
addrlen = 8;
uArgSize = SOCKET_SENDTO_PARAMS_LEN;
pDataPtr = ptr + HEADERS_SIZE_DATA + SOCKET_SENDTO_PARAMS_LEN;
break;
}
case HCI_CMND_SEND:
{
tolen = 0;
to = NULL;
uArgSize = HCI_CMND_SEND_ARG_LENGTH;
pDataPtr = ptr + HEADERS_SIZE_DATA + HCI_CMND_SEND_ARG_LENGTH;
break;
}
default:
{
break;
}
}
// Fill in temporary command buffer
args = UINT32_TO_STREAM(args, sd);
args = UINT32_TO_STREAM(args, uArgSize - sizeof(sd));
args = UINT32_TO_STREAM(args, len);
args = UINT32_TO_STREAM(args, flags);
if (opcode == HCI_CMND_SENDTO)
{
args = UINT32_TO_STREAM(args, addr_offset);
args = UINT32_TO_STREAM(args, addrlen);
}
// Copy the data received from user into the TX Buffer
ARRAY_TO_STREAM(pDataPtr, ((unsigned char *)buf), len);
// In case we are using SendTo, copy the to parameters
if (opcode == HCI_CMND_SENDTO)
{
ARRAY_TO_STREAM(pDataPtr, ((unsigned char *)to), tolen);
}
// Initiate a HCI command
hci_data_send(opcode, ptr, uArgSize, len,(unsigned char*)to, tolen);
if (opcode == HCI_CMND_SENDTO)
SimpleLinkWaitEvent(HCI_EVNT_SENDTO, &tSocketSendEvent);
else
SimpleLinkWaitEvent(HCI_EVNT_SEND, &tSocketSendEvent);
return (len);
//.........这里部分代码省略.........
示例11: hci_event_handler
unsigned char *
hci_event_handler(void *pRetParams, unsigned char *from, unsigned char *fromlen)
{
unsigned char *pucReceivedData, ucArgsize;
unsigned short usLength;
unsigned char *pucReceivedParams;
unsigned short usReceivedEventOpcode = 0;
unsigned long retValue32;
unsigned char * RecvParams;
unsigned char *RetParams;
JsSysTime timeout = jshGetSystemTime() + jshGetTimeFromMilliseconds(10000); // blocking for 10 seconds (!!!)
cc3000_irq_disable();
while (!jspIsInterrupted())
{
if (tSLInformation.usEventOrDataReceived != 0)
{
pucReceivedData = (tSLInformation.pucReceivedData);
if (*pucReceivedData == HCI_TYPE_EVNT)
{
// Event Received
STREAM_TO_UINT16((char *)pucReceivedData, HCI_EVENT_OPCODE_OFFSET,
usReceivedEventOpcode);
pucReceivedParams = pucReceivedData + HCI_EVENT_HEADER_SIZE;
RecvParams = pucReceivedParams;
RetParams = pRetParams;
// In case unsolicited event received - here the handling finished
if (hci_unsol_event_handler((char *)pucReceivedData) == 0)
{
STREAM_TO_UINT8(pucReceivedData, HCI_DATA_LENGTH_OFFSET, usLength);
switch(usReceivedEventOpcode)
{
case HCI_CMND_READ_BUFFER_SIZE:
{
STREAM_TO_UINT8((char *)pucReceivedParams, 0,
tSLInformation.usNumberOfFreeBuffers);
STREAM_TO_UINT16((char *)pucReceivedParams, 1,
tSLInformation.usSlBufferLength);
}
break;
case HCI_CMND_WLAN_CONFIGURE_PATCH:
case HCI_NETAPP_DHCP:
case HCI_NETAPP_PING_SEND:
case HCI_NETAPP_PING_STOP:
case HCI_NETAPP_ARP_FLUSH:
case HCI_NETAPP_SET_DEBUG_LEVEL:
case HCI_NETAPP_SET_TIMERS:
case HCI_EVNT_NVMEM_READ:
case HCI_EVNT_NVMEM_CREATE_ENTRY:
case HCI_CMND_NVMEM_WRITE_PATCH:
case HCI_NETAPP_PING_REPORT:
case HCI_EVNT_MDNS_ADVERTISE:
STREAM_TO_UINT8(pucReceivedData, HCI_EVENT_STATUS_OFFSET
,*(unsigned char *)pRetParams);
break;
case HCI_CMND_SETSOCKOPT:
case HCI_CMND_WLAN_CONNECT:
case HCI_CMND_WLAN_IOCTL_STATUSGET:
case HCI_EVNT_WLAN_IOCTL_ADD_PROFILE:
case HCI_CMND_WLAN_IOCTL_DEL_PROFILE:
case HCI_CMND_WLAN_IOCTL_SET_CONNECTION_POLICY:
case HCI_CMND_WLAN_IOCTL_SET_SCANPARAM:
case HCI_CMND_WLAN_IOCTL_SIMPLE_CONFIG_START:
case HCI_CMND_WLAN_IOCTL_SIMPLE_CONFIG_STOP:
case HCI_CMND_WLAN_IOCTL_SIMPLE_CONFIG_SET_PREFIX:
case HCI_CMND_EVENT_MASK:
case HCI_EVNT_WLAN_DISCONNECT:
case HCI_EVNT_SOCKET:
case HCI_EVNT_BIND:
case HCI_CMND_LISTEN:
case HCI_EVNT_CLOSE_SOCKET:
case HCI_EVNT_CONNECT:
case HCI_EVNT_NVMEM_WRITE:
STREAM_TO_UINT32((char *)pucReceivedParams,0
,*(unsigned long *)pRetParams);
break;
case HCI_EVNT_READ_SP_VERSION:
STREAM_TO_UINT8(pucReceivedData, HCI_EVENT_STATUS_OFFSET
,*(unsigned char *)pRetParams);
pRetParams = ((char *)pRetParams) + 1;
STREAM_TO_UINT32((char *)pucReceivedParams, 0, retValue32);
UINT32_TO_STREAM((unsigned char *)pRetParams, retValue32);
break;
case HCI_EVNT_BSD_GETHOSTBYNAME:
STREAM_TO_UINT32((char *)pucReceivedParams
,GET_HOST_BY_NAME_RETVAL_OFFSET,*(unsigned long *)pRetParams);
pRetParams = ((char *)pRetParams) + 4;
STREAM_TO_UINT32((char *)pucReceivedParams
//.........这里部分代码省略.........
示例12: while
uint8_t *cc3000_event::hci_event_handler(void *ret_param, uint8_t *from, uint8_t *fromlen) {
uint8_t *received_data, argument_size;
uint16_t length;
uint8_t *pucReceivedParams;
uint16_t received_op_code = 0;
uint32_t return_value;
uint8_t * RecvParams;
uint8_t *RetParams;
while (1)
{
if (_simple_link.get_data_received_flag() != 0)
{
received_data = _simple_link.get_received_data();
if (*received_data == HCI_TYPE_EVNT)
{
// Event Received
STREAM_TO_UINT16((uint8_t *)received_data, HCI_EVENT_OPCODE_OFFSET,received_op_code);
pucReceivedParams = received_data + HCI_EVENT_HEADER_SIZE;
RecvParams = pucReceivedParams;
RetParams = (uint8_t *)ret_param;
// unsolicited event received - finish handling
if (hci_unsol_event_handler((uint8_t *)received_data) == 0)
{
STREAM_TO_UINT8(received_data, HCI_DATA_LENGTH_OFFSET, length);
hci_event_debug_print( received_op_code );
switch(received_op_code)
{
case HCI_CMND_READ_BUFFER_SIZE:
{
uint16_t temp = _simple_link.get_number_free_buffers();
STREAM_TO_UINT8((uint8_t *)pucReceivedParams, 0, temp);
_simple_link.set_number_free_buffers(temp);
temp = _simple_link.get_buffer_length();
STREAM_TO_UINT16((uint8_t *)pucReceivedParams, 1, temp);
_simple_link.set_buffer_length(temp);
}
break;
case HCI_CMND_WLAN_CONFIGURE_PATCH:
case HCI_NETAPP_DHCP:
case HCI_NETAPP_PING_SEND:
case HCI_NETAPP_PING_STOP:
case HCI_NETAPP_ARP_FLUSH:
case HCI_NETAPP_SET_DEBUG_LEVEL:
case HCI_NETAPP_SET_TIMERS:
case HCI_EVNT_NVMEM_READ:
case HCI_EVNT_NVMEM_CREATE_ENTRY:
case HCI_CMND_NVMEM_WRITE_PATCH:
case HCI_NETAPP_PING_REPORT:
case HCI_EVNT_MDNS_ADVERTISE:
STREAM_TO_UINT8(received_data, HCI_EVENT_STATUS_OFFSET, *(uint8_t *)ret_param);
break;
case HCI_CMND_SETSOCKOPT:
case HCI_CMND_WLAN_CONNECT:
case HCI_CMND_WLAN_IOCTL_STATUSGET:
case HCI_EVNT_WLAN_IOCTL_ADD_PROFILE:
case HCI_CMND_WLAN_IOCTL_DEL_PROFILE:
case HCI_CMND_WLAN_IOCTL_SET_CONNECTION_POLICY:
case HCI_CMND_WLAN_IOCTL_SET_SCANPARAM:
case HCI_CMND_WLAN_IOCTL_SIMPLE_CONFIG_START:
case HCI_CMND_WLAN_IOCTL_SIMPLE_CONFIG_STOP:
case HCI_CMND_WLAN_IOCTL_SIMPLE_CONFIG_SET_PREFIX:
case HCI_CMND_EVENT_MASK:
case HCI_EVNT_WLAN_DISCONNECT:
case HCI_EVNT_SOCKET:
case HCI_EVNT_BIND:
case HCI_CMND_LISTEN:
case HCI_EVNT_CLOSE_SOCKET:
case HCI_EVNT_CONNECT:
case HCI_EVNT_NVMEM_WRITE:
STREAM_TO_UINT32((uint8_t *)pucReceivedParams,0, *(uint32_t *)ret_param);
break;
case HCI_EVNT_READ_SP_VERSION:
STREAM_TO_UINT8(received_data, HCI_EVENT_STATUS_OFFSET, *(uint8_t *)ret_param);
ret_param = ((uint8_t *)ret_param) + 1;
STREAM_TO_UINT32((uint8_t *)pucReceivedParams, 0, return_value);
UINT32_TO_STREAM((uint8_t *)ret_param, return_value);
break;
case HCI_EVNT_BSD_GETHOSTBYNAME:
STREAM_TO_UINT32((uint8_t *)pucReceivedParams,GET_HOST_BY_NAME_RETVAL_OFFSET,*(uint32_t *)ret_param);
ret_param = ((uint8_t *)ret_param) + 4;
STREAM_TO_UINT32((uint8_t *)pucReceivedParams,GET_HOST_BY_NAME_ADDR_OFFSET,*(uint32_t *)ret_param);
break;
case HCI_EVNT_ACCEPT:
{
STREAM_TO_UINT32((uint8_t *)pucReceivedParams,ACCEPT_SD_OFFSET,*(uint32_t *)ret_param);
ret_param = ((uint8_t *)ret_param) + 4;
//.........这里部分代码省略.........
示例13: while
uint8_t *hci_event_handler(void *pRetParams, uint8_t *from, uint8_t *fromlen)
{
uint8_t *pucReceivedData, ucArgsize;
uint16_t usLength;
uint8_t *pucReceivedParams;
uint16_t usReceivedEventOpcode = 0;
unsigned long retValue32;
uint8_t * RecvParams;
uint8_t *RetParams;
while (1)
{
if (tSLInformation.usEventOrDataReceived != 0) {
pucReceivedData = (tSLInformation.pucReceivedData);
if (*pucReceivedData == HCI_TYPE_EVNT)
{
/* Event Received */
STREAM_TO_UINT16((char *)pucReceivedData,
HCI_EVENT_OPCODE_OFFSET,
usReceivedEventOpcode);
pucReceivedParams = pucReceivedData + HCI_EVENT_HEADER_SIZE;
RecvParams = pucReceivedParams;
RetParams = (uint8_t *)pRetParams;
/* In case unsolicited event received - here the handling finished */
if (hci_unsol_event_handler((char *)pucReceivedData) == 0)
{
STREAM_TO_UINT8(pucReceivedData, HCI_DATA_LENGTH_OFFSET, usLength);
switch(usReceivedEventOpcode)
{
case HCI_CMND_READ_BUFFER_SIZE:
{
STREAM_TO_UINT8((char *)pucReceivedParams, 0,
tSLInformation.usNumberOfFreeBuffers);
STREAM_TO_UINT16((char *)pucReceivedParams, 1,
tSLInformation.usSlBufferLength);
}
break;
case HCI_CMND_WLAN_CONFIGURE_PATCH:
case HCI_NETAPP_DHCP:
case HCI_NETAPP_PING_SEND:
case HCI_NETAPP_PING_STOP:
case HCI_NETAPP_ARP_FLUSH:
case HCI_NETAPP_SET_DEBUG_LEVEL:
case HCI_NETAPP_SET_TIMERS:
case HCI_EVNT_NVMEM_READ:
case HCI_EVNT_NVMEM_CREATE_ENTRY:
case HCI_CMND_NVMEM_WRITE_PATCH:
case HCI_NETAPP_PING_REPORT:
case HCI_EVNT_MDNS_ADVERTISE:
STREAM_TO_UINT8(pucReceivedData, HCI_EVENT_STATUS_OFFSET,
*(uint8_t *)pRetParams);
break;
case HCI_CMND_SETSOCKOPT:
case HCI_CMND_WLAN_CONNECT:
case HCI_CMND_WLAN_IOCTL_STATUSGET:
case HCI_EVNT_WLAN_IOCTL_ADD_PROFILE:
case HCI_CMND_WLAN_IOCTL_DEL_PROFILE:
case HCI_CMND_WLAN_IOCTL_SET_CONNECTION_POLICY:
case HCI_CMND_WLAN_IOCTL_SET_SCANPARAM:
case HCI_CMND_WLAN_IOCTL_SIMPLE_CONFIG_START:
case HCI_CMND_WLAN_IOCTL_SIMPLE_CONFIG_STOP:
case HCI_CMND_WLAN_IOCTL_SIMPLE_CONFIG_SET_PREFIX:
case HCI_CMND_EVENT_MASK:
case HCI_EVNT_WLAN_DISCONNECT:
case HCI_EVNT_SOCKET:
case HCI_EVNT_BIND:
case HCI_CMND_LISTEN:
case HCI_EVNT_CLOSE_SOCKET:
case HCI_EVNT_CONNECT:
case HCI_EVNT_NVMEM_WRITE:
STREAM_TO_UINT32((char *)pucReceivedParams, 0,
*(unsigned long *)pRetParams);
break;
case HCI_EVNT_READ_SP_VERSION:
STREAM_TO_UINT8(pucReceivedData, HCI_EVENT_STATUS_OFFSET,
*(uint8_t *)pRetParams);
pRetParams = ((char *)pRetParams) + 1;
STREAM_TO_UINT32((char *)pucReceivedParams, 0, retValue32);
UINT32_TO_STREAM((uint8_t *)pRetParams, retValue32);
break;
case HCI_EVNT_BSD_GETHOSTBYNAME:
STREAM_TO_UINT32((char *)pucReceivedParams,
GET_HOST_BY_NAME_RETVAL_OFFSET,
*(unsigned long *)pRetParams);
pRetParams = ((char *)pRetParams) + 4;
STREAM_TO_UINT32((char *)pucReceivedParams,
//.........这里部分代码省略.........
示例14: hci_event_handler
//.........这里部分代码省略.........
case HCI_NETAPP_PING_REPORT:
case HCI_EVNT_MDNS_ADVERTISE:
STREAM_TO_UINT8(pucReceivedData, HCI_EVENT_STATUS_OFFSET,*(unsigned char *)pRetParams);
break;
case HCI_CMND_SETSOCKOPT:
case HCI_CMND_WLAN_CONNECT:
case HCI_CMND_WLAN_IOCTL_STATUSGET:
case HCI_EVNT_WLAN_IOCTL_ADD_PROFILE:
case HCI_CMND_WLAN_IOCTL_DEL_PROFILE:
case HCI_CMND_WLAN_IOCTL_SET_CONNECTION_POLICY:
case HCI_CMND_WLAN_IOCTL_SET_SCANPARAM:
case HCI_CMND_WLAN_IOCTL_SIMPLE_CONFIG_START:
case HCI_CMND_WLAN_IOCTL_SIMPLE_CONFIG_STOP:
case HCI_CMND_WLAN_IOCTL_SIMPLE_CONFIG_SET_PREFIX:
case HCI_CMND_EVENT_MASK:
case HCI_EVNT_WLAN_DISCONNECT:
case HCI_EVNT_SOCKET:
case HCI_EVNT_BIND:
case HCI_CMND_LISTEN:
case HCI_EVNT_CLOSE_SOCKET:
case HCI_EVNT_CONNECT:
case HCI_EVNT_NVMEM_WRITE:
STREAM_TO_UINT32((char *)pucReceivedParams, 0, *(unsigned long *)pRetParams);
break;
case HCI_EVNT_READ_SP_VERSION:
STREAM_TO_UINT8(pucReceivedData, HCI_EVENT_STATUS_OFFSET, *(unsigned char *)pRetParams);
pRetParams = ((char *)pRetParams) + 1;
STREAM_TO_UINT32((char *)pucReceivedParams, 0, retValue32);
UINT32_TO_STREAM((unsigned char *)pRetParams, retValue32);
break;
case HCI_EVNT_BSD_GETHOSTBYNAME:
STREAM_TO_UINT32((char *)pucReceivedParams,GET_HOST_BY_NAME_RETVAL_OFFSET,*(unsigned long *)pRetParams);
pRetParams = ((char *)pRetParams) + 4;
STREAM_TO_UINT32((char *)pucReceivedParams,GET_HOST_BY_NAME_ADDR_OFFSET,*(unsigned long *)pRetParams);
break;
case HCI_EVNT_ACCEPT:
{
STREAM_TO_UINT32((char *)pucReceivedParams,ACCEPT_SD_OFFSET,*(unsigned long *)pRetParams);
pRetParams = ((char *)pRetParams) + 4;
STREAM_TO_UINT32((char *)pucReceivedParams,ACCEPT_RETURN_STATUS_OFFSET,*(unsigned long *)pRetParams);
pRetParams = ((char *)pRetParams) + 4;
//This argument returns in network order
memcpy((unsigned char *)pRetParams, pucReceivedParams + ACCEPT_ADDRESS__OFFSET, sizeof(sockaddr));
break;
}
case HCI_EVNT_RECV:
case HCI_EVNT_RECVFROM:
{
STREAM_TO_UINT32((char *)pucReceivedParams,SL_RECEIVE_SD_OFFSET ,*(unsigned long *)pRetParams);
pRetParams = ((char *)pRetParams) + 4;
STREAM_TO_UINT32((char *)pucReceivedParams,SL_RECEIVE_NUM_BYTES_OFFSET,*(unsigned long *)pRetParams);
pRetParams = ((char *)pRetParams) + 4;
STREAM_TO_UINT32((char *)pucReceivedParams,SL_RECEIVE__FLAGS__OFFSET,*(unsigned long *)pRetParams);
if(((tBsdReadReturnParams *)pRetParams)->iNumberOfBytes == ERROR_SOCKET_INACTIVE)
{
示例15: wlan_add_profile
long
wlan_add_profile(unsigned long ulSecType,
unsigned char* ucSsid,
unsigned long ulSsidLen,
unsigned char *ucBssid,
unsigned long ulPriority,
unsigned long ulPairwiseCipher_Or_TxKeyLen,
unsigned long ulGroupCipher_TxKeyIndex,
unsigned long ulKeyMgmt,
unsigned char* ucPf_OrKey,
unsigned long ulPassPhraseLen)
{
unsigned short arg_len;
long ret;
unsigned char *ptr;
long i = 0;
unsigned char *args;
unsigned char bssid_zero[] = {0, 0, 0, 0, 0, 0};
ptr = tSLInformation.pucTxCommandBuffer;
args = (ptr + HEADERS_SIZE_CMD);
args = UINT32_TO_STREAM(args, ulSecType);
// Setup arguments in accordance with the security type
switch (ulSecType)
{
//OPEN
case WLAN_SEC_UNSEC:
{
args = UINT32_TO_STREAM(args, 0x00000014);
args = UINT32_TO_STREAM(args, ulSsidLen);
args = UINT16_TO_STREAM(args, 0);
if(ucBssid)
{
ARRAY_TO_STREAM(args, ucBssid, ETH_ALEN);
}
else
{
ARRAY_TO_STREAM(args, bssid_zero, ETH_ALEN);
}
args = UINT32_TO_STREAM(args, ulPriority);
ARRAY_TO_STREAM(args, ucSsid, ulSsidLen);
arg_len = WLAN_ADD_PROFILE_NOSEC_PARAM_LEN + ulSsidLen;
}
break;
//WEP
case WLAN_SEC_WEP:
{
args = UINT32_TO_STREAM(args, 0x00000020);
args = UINT32_TO_STREAM(args, ulSsidLen);
args = UINT16_TO_STREAM(args, 0);
if(ucBssid)
{
ARRAY_TO_STREAM(args, ucBssid, ETH_ALEN);
}
else
{
ARRAY_TO_STREAM(args, bssid_zero, ETH_ALEN);
}
args = UINT32_TO_STREAM(args, ulPriority);
args = UINT32_TO_STREAM(args, 0x0000000C + ulSsidLen);
args = UINT32_TO_STREAM(args, ulPairwiseCipher_Or_TxKeyLen);
args = UINT32_TO_STREAM(args, ulGroupCipher_TxKeyIndex);
ARRAY_TO_STREAM(args, ucSsid, ulSsidLen);
for(i = 0; i < 4; i++)
{
unsigned char *p = &ucPf_OrKey[i * ulPairwiseCipher_Or_TxKeyLen];
ARRAY_TO_STREAM(args, p, ulPairwiseCipher_Or_TxKeyLen);
}
arg_len = WLAN_ADD_PROFILE_WEP_PARAM_LEN + ulSsidLen +
ulPairwiseCipher_Or_TxKeyLen * 4;
}
break;
//WPA
//WPA2
case WLAN_SEC_WPA:
case WLAN_SEC_WPA2:
{
args = UINT32_TO_STREAM(args, 0x00000028);
args = UINT32_TO_STREAM(args, ulSsidLen);
args = UINT16_TO_STREAM(args, 0);
if(ucBssid)
{
ARRAY_TO_STREAM(args, ucBssid, ETH_ALEN);
}
else
{
ARRAY_TO_STREAM(args, bssid_zero, ETH_ALEN);
}
args = UINT32_TO_STREAM(args, ulPriority);
args = UINT32_TO_STREAM(args, ulPairwiseCipher_Or_TxKeyLen);
args = UINT32_TO_STREAM(args, ulGroupCipher_TxKeyIndex);
//.........这里部分代码省略.........