Adafruit_CC3000_Library/utility/netapp.cpp
//*****************************************************************************
//
//!  netapp_dhcp
//!
//!  @param  aucIP               device mac address, 6 bytes. Saved: yes 
//!  @param  aucSubnetMask       device mac address, 6 bytes. Saved: yes 
//!  @param  aucDefaultGateway   device mac address, 6 bytes. Saved: yes 
//!  @param  aucDNSServer        device mac address, 6 bytes. Saved: yes 
//!
//!  @return       return on success 0, otherwise error.
//!
//!  @brief       netapp_dhcp is used to configure the network interface, 
//!               static or dynamic (DHCP).\n In order to activate DHCP mode, 
//!               aucIP, aucSubnetMask, aucDefaultGateway must be 0.
//!               The default mode of CC3000 is DHCP mode.
//!               Note that the configuration is saved in non volatile memory
//!               and thus preserved over resets.
//!	 
//! @note         If the mode is altered a reset of CC3000 device is required 
//!               in order to apply changes.\nAlso note that asynchronous event 
//!               of DHCP_EVENT, which is generated when an IP address is 
//!               allocated either by the DHCP server or due to static 
//!               allocation is generated only upon a connection to the 
//!               AP was established. 
//!
//*****************************************************************************
netapp_dhcp
@param  aucIP               device mac address, 6 bytes. Saved: yes
@param  aucSubnetMask       device mac address, 6 bytes. Saved: yes
@param  aucDefaultGateway   device mac address, 6 bytes. Saved: yes
@param  aucDNSServer        device mac address, 6 bytes. Saved: yes

@return       return on success 0, otherwise error.

@brief       netapp_dhcp is used to configure the network interface,
static or dynamic (DHCP).\n In order to activate DHCP mode,
aucIP, aucSubnetMask, aucDefaultGateway must be 0.
The default mode of CC3000 is DHCP mode.
Note that the configuration is saved in non volatile memory
and thus preserved over resets.
netapp_dhcp @param aucIP device mac address 6 bytes . Saved : yes @param aucSubnetMask device mac address 6 bytes . Saved : yes @param aucDefaultGateway device mac address 6 bytes . Saved : yes @param aucDNSServer device mac address 6 bytes . Saved : yes @return return on success 0 otherwise error . @brief netapp_dhcp is used to configure the network interface static or dynamic ( DHCP ) . \ n In order to activate DHCP mode aucIP aucSubnetMask aucDefaultGateway must be 0 . The default mode of CC3000 is DHCP mode . Note that the configuration is saved in non volatile memory and thus preserved over resets .
INT32 netapp_dhcp(UINT32 *aucIP, UINT32 *aucSubnetMask,UINT32 *aucDefaultGateway, UINT32 *aucDNSServer)
{
	INT8 scRet;
	UINT8 *ptr;
	UINT8 *args;
	scRet = EFAIL;
	ptr = tSLInformation.pucTxCommandBuffer;
	args = (ptr + HEADERS_SIZE_CMD);
	ARRAY_TO_STREAM(args,aucIP,4);
	ARRAY_TO_STREAM(args,aucSubnetMask,4);
	ARRAY_TO_STREAM(args,aucDefaultGateway,4);
	args = UINT32_TO_STREAM(args, 0);
	ARRAY_TO_STREAM(args,aucDNSServer,4);
	hci_command_send(HCI_NETAPP_DHCP, ptr, NETAPP_DHCP_PARAMS_LEN);
	SimpleLinkWaitEvent(HCI_NETAPP_DHCP, &scRet);
	return(scRet);
}
INT32 netapp_dhcp ( UINT32 * aucIP , UINT32 * aucSubnetMask , UINT32 * aucDefaultGateway , UINT32 * aucDNSServer ) { INT8 scRet ; UINT8 * ptr ; UINT8 * args ; scRet = EFAIL ; ptr = tSLInformation . pucTxCommandBuffer ; args = ( ptr + HEADERS_SIZE_CMD ) ; ARRAY_TO_STREAM ( args , aucIP , 4 ) ; ARRAY_TO_STREAM ( args , aucSubnetMask , 4 ) ; ARRAY_TO_STREAM ( args , aucDefaultGateway , 4 ) ; args = UINT32_TO_STREAM ( args , 0 ) ; ARRAY_TO_STREAM ( args , aucDNSServer , 4 ) ; hci_command_send ( HCI_NETAPP_DHCP , ptr , NETAPP_DHCP_PARAMS_LEN ) ; SimpleLinkWaitEvent ( HCI_NETAPP_DHCP , & scRet ) ; return ( scRet ) ; }
netapp_dhcp
@param  aucIP               device mac address, 6 bytes.
netapp_dhcp @param aucIP device mac address 6 bytes .
// Fill in temporary command buffer // Initiate a HCI command // Wait for command complete event