cc3000 hostdriver with the mbed socket interface

Dependents:   cc3000_hello_world_demo cc3000_simple_socket_demo cc3000_ntp_demo cc3000_ping_demo ... more

Embed: (wiki syntax)

« Back to documentation index

cc3000_netapp Class Reference

cc3000_netapp Class Reference

Netapp layer. More...

#include <cc3000.h>

Public Member Functions

 cc3000_netapp (cc3000_simple_link &simple_link, cc3000_nvmem &nvmem, cc3000_hci &hci, cc3000_event &event)
 Ctor.
 ~cc3000_netapp ()
 Dtor.
int32_t config_mac_adrress (uint8_t *mac)
 Configure device MAC address and store it in NVMEM.
int32_t dhcp (uint32_t *ip, uint32_t *subnet_mask, uint32_t *default_gateway, uint32_t *dns_server)
 Configure the network interface, static or dynamic (DHCP).
void ipconfig (tNetappIpconfigRetArgs *ipconfig)
 Get the CC3000 Network interface information.
int32_t timeout_values (uint32_t *dhcp, uint32_t *arp, uint32_t *keep_alive, uint32_t *inactivity)
 Set new timeout values for DHCP lease timeout, ARP refresh timeout, keepalive event timeout and socket inactivity timeout.
int32_t ping_send (uint32_t *ip, uint32_t ping_attempts, uint32_t ping_size, uint32_t ping_timeout)
 send ICMP ECHO_REQUEST to network hosts
void ping_report ()
 Ping status request.
int32_t ping_stop ()
 Stop any ping request.
int32_t arp_flush ()
 Flush ARP table.

Detailed Description

Netapp layer.

Definition at line 436 of file cc3000.h.


Constructor & Destructor Documentation

cc3000_netapp ( cc3000_simple_link simple_link,
cc3000_nvmem nvmem,
cc3000_hci hci,
cc3000_event event 
)

Ctor.

Parameters:
simple_linkReference to the simple link object.
nvmemReference to the nvmem object.
hciReference to the hci object.
eventReference to the event object.
Returns:
none

Definition at line 46 of file cc3000_netapp.cpp.

~cc3000_netapp (  )

Dtor.

Parameters:
none
Returns:
none

Definition at line 51 of file cc3000_netapp.cpp.


Member Function Documentation

int32_t arp_flush (  )

Flush ARP table.

Parameters:
none
Returns:
none

Definition at line 182 of file cc3000_netapp.cpp.

int32_t config_mac_adrress ( uint8_t *  mac )

Configure device MAC address and store it in NVMEM.

The value of the MAC address configured through the API will be
stored in CC3000 non volatile memory, thus preserved over resets.

Parameters:
macdevice mac address, 6 bytes. Saved: yes
Returns:
return on success 0, otherwise error.

Definition at line 55 of file cc3000_netapp.cpp.

int32_t dhcp ( uint32_t *  ip,
uint32_t *  subnet_mask,
uint32_t *  default_gateway,
uint32_t *  dns_server 
)

Configure the network interface, static or dynamic (DHCP).

In order to activate DHCP mode, ip, subnet_mask, default_gateway must be 0.
The default mode of CC3000 is DHCP mode. The configuration is saved in non volatile memory
and thus preserved over resets.

Parameters:
ipdevice mac address, 6 bytes. Saved: yes
subnet_maskdevice mac address, 6 bytes. Saved: yes
default_gatewaydevice mac address, 6 bytes. Saved: yes
dns_serverdevice mac address, 6 bytes. Saved: yes
Returns:
0 on success, otherwise error.
Note:
If the mode is altered, a reset of CC3000 device is required to apply the changes.
Also note that an asynchronous event of type 'DHCP_EVENT' is generated only when
a connection to the AP was established. This event is generated when an IP address
is allocated either by the DHCP server or by static allocation.

Definition at line 59 of file cc3000_netapp.cpp.

void ipconfig ( tNetappIpconfigRetArgs *  ipconfig )

Get the CC3000 Network interface information.

This information is only available after establishing a WLAN connection.
Undefined values are returned when this function is called before association.

Parameters:
ipconfigpointer to a tNetappIpconfigRetArgs structure for storing the network interface configuration.
tNetappIpconfigRetArgs: aucIP - ip address,
aucSubnetMask - mask aucDefaultGateway - default gateway address
aucDHCPServer - dhcp server address
aucDNSServer - dns server address
uaMacAddr - mac address
uaSSID - connected AP ssid
Returns:
none
Note:
This function is useful for figuring out the IP Configuration of
the device when DHCP is used and for figuring out the SSID of
the Wireless network the device is associated with.

Definition at line 85 of file cc3000_netapp.cpp.

void ping_report (  )

Ping status request.

This API triggers the CC3000 to send asynchronous events: HCI_EVNT_WLAN_ASYNC_PING_REPORT.
This event will create the report structure in netapp_pingreport_args_t.
This structure is filled with ping results until the API is triggered.
netapp_pingreport_args_t: packets_sent - echo sent
packets_received - echo reply
min_round_time - minimum round time
max_round_time - max round time
avg_round_time - average round time

Parameters:
none
Returns:
none
Note:
When a ping operation is not active, the returned structure fields are 0.

Definition at line 151 of file cc3000_netapp.cpp.

int32_t ping_send ( uint32_t *  ip,
uint32_t  ping_attempts,
uint32_t  ping_size,
uint32_t  ping_timeout 
)

send ICMP ECHO_REQUEST to network hosts

Parameters:
ipdestination IP address
ping_attemptsnumber of echo requests to send
ping_sizesend buffer size which may be up to 1400 bytes
ping_timeoutTime to wait for a response,in milliseconds.
Returns:
0 on success, otherwise error.
Note:
A succesful operation will generate an asynchronous ping report event.
The report structure is defined by structure netapp_pingreport_args_t.
Warning:
Calling this function while a Ping Request is in progress will kill the ping request in progress.

Definition at line 128 of file cc3000_netapp.cpp.

int32_t ping_stop (  )

Stop any ping request.

Parameters:
none
Returns:
0 on success -1 on error

Definition at line 166 of file cc3000_netapp.cpp.

int32_t timeout_values ( uint32_t *  dhcp,
uint32_t *  arp,
uint32_t *  keep_alive,
uint32_t *  inactivity 
)

Set new timeout values for DHCP lease timeout, ARP refresh timeout, keepalive event timeout and socket inactivity timeout.

Parameters:
dhcpDHCP lease time request, also impact
the DHCP renew timeout.
Range: [0-0xffffffff] seconds,
0 or 0xffffffff = infinite lease timeout.
Resolution: 10 seconds.
Influence: only after reconnecting to the AP.
Minimal bound value: MIN_TIMER_VAL_SECONDS - 20 seconds.
The parameter is saved into the CC3000 NVMEM.
The default value on CC3000 is 14400 seconds.
arpARP refresh timeout, if ARP entry is not updated by
incoming packet, the ARP entry will be deleted by
the end of the timeout.
Range: [0-0xffffffff] seconds, 0 = infinite ARP timeout
Resolution: 10 seconds.
Influence: at runtime.
Minimal bound value: MIN_TIMER_VAL_SECONDS - 20 seconds
The parameter is saved into the CC3000 NVMEM.
The default value on CC3000 is 3600 seconds.
keep_aliveKeepalive event sent by the end of keepalive timeout
Range: [0-0xffffffff] seconds, 0 == infinite timeout
Resolution: 10 seconds.
Influence: at runtime.
Minimal bound value: MIN_TIMER_VAL_SECONDS - 20 sec
The parameter is saved into the CC3000 NVMEM.
The default value on CC3000 is 10 seconds.
inactivitySocket inactivity timeout, socket timeout is
refreshed by incoming or outgoing packet, by the
end of the socket timeout the socket will be closed
Range: [0-0xffffffff] sec, 0 == infinite timeout.
Resolution: 10 seconds.
Influence: at runtime.
Minimal bound value: MIN_TIMER_VAL_SECONDS - 20 sec
The parameter is saved into the CC3000 NVMEM.
The default value on CC3000 is 60 seconds.
Returns:
0 on success,otherwise error.
Note:
A parameter set to a non zero value less than 20s automatically changes to 20s.

Definition at line 98 of file cc3000_netapp.cpp.