Adafruit_CC3000_Library/utility/wlan.cpp
// Adafruit CC3k Host Driver Difference
// Make ssid a const char pointer because it isn't modified and the Adafruit
// driver code needs it to be const to interface with Arduino's client library.
// Noted 12-12-2014 by tdicola
Adafruit CC3k Host Driver Difference
Make ssid a const char pointer because it isn't modified and the Adafruit
driver code needs it to be const to interface with Arduino's client library.
Adafruit CC3k Host Driver Difference Make ssid a const char pointer because it isn ' t modified and the Adafruit driver code needs it to be const to interface with Arduino ' s client library .
INT32 wlan_connect(UINT32 ulSecType, const CHAR *ssid, INT32 ssid_len,
	UINT8 *bssid, UINT8 *key, INT32 key_len)
{
	INT32 ret;
	UINT8 *ptr;
	UINT8 *args;
	UINT8 bssid_zero[] = {0, 0, 0, 0, 0, 0};
	ret  	= EFAIL;
	ptr  	= tSLInformation.pucTxCommandBuffer;
	args 	= (ptr + HEADERS_SIZE_CMD);
	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);
	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);
	}
	hci_command_send(HCI_CMND_WLAN_CONNECT, ptr, WLAN_CONNECT_PARAM_LEN + 
		ssid_len + key_len - 1);
	SimpleLinkWaitEvent(HCI_CMND_WLAN_CONNECT, &ret);
	errno = ret;
	return(ret);
}
INT32 wlan_connect ( UINT32 ulSecType , const CHAR * ssid , INT32 ssid_len , UINT8 * bssid , UINT8 * key , INT32 key_len ) { INT32 ret ; UINT8 * ptr ; UINT8 * args ; UINT8 bssid_zero [ ] = { 0 , 0 , 0 , 0 , 0 , 0 } ; ret = EFAIL ; ptr = tSLInformation . pucTxCommandBuffer ; args = ( ptr + HEADERS_SIZE_CMD ) ; 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 ) ; 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 ) ; } hci_command_send ( HCI_CMND_WLAN_CONNECT , ptr , WLAN_CONNECT_PARAM_LEN + ssid_len + key_len - 1 ) ; SimpleLinkWaitEvent ( HCI_CMND_WLAN_CONNECT , & ret ) ; errno = ret ; return ( ret ) ; }
Adafruit CC3k Host Driver Difference
Make ssid a const char pointer because it isn't modified and the Adafruit
driver code needs it to be const to interface with Arduino's client library.
Adafruit CC3k Host Driver Difference Make ssid a const char pointer because it isn ' t modified and the Adafruit driver code needs it to be const to interface with Arduino ' s client library .
// Fill in command buffer // padding shall be zeroed // Initiate a HCI command // Wait for command complete event