erez i / cc3000_hostdriver_mbedsocket

Dependents:   cc3000_ping_demo_try_2

Fork of cc3000_hostdriver_mbedsocket by Martin Kojtal

Embed: (wiki syntax)

« Back to documentation index

cc3000 Class Reference

The main object of cc3000 implementation. More...

#include <cc3000.h>

Data Structures

struct  tStatus
 status structure More...

Public Member Functions

 cc3000 (PinName cc3000_irq, PinName cc3000_en, PinName cc3000_cs, SPI cc3000_spi)
 Ctor.
 ~cc3000 ()
 Dtor.
void start (uint8_t patch)
 Initiate cc3000.
void stop ()
 Stops the wlan communication.
void restart (uint8_t patch)
 Restarts the wlan communication.
void usync_callback (int32_t event_type, uint8_t *data, uint8_t length)
 Callback which is called from the event class.
bool connect_non_blocking (const uint8_t *ssid, const uint8_t *key, int32_t security_mode)
 Start connection to SSID (open/secured) non-blocking.
bool connect_to_AP (const uint8_t *ssid, const uint8_t *key, int32_t security_mode)
 Connect to SSID (open/secured) with timeout (10s).
bool connect_secure (const uint8_t *ssid, const uint8_t *key, int32_t security_mode)
 Connect to SSID which is secured.
bool connect_open (const uint8_t *ssid)
 Connect to SSID which is open (no security)
bool is_enabled ()
 Status of the cc3000 module.
bool is_connected ()
 Status of the cc3000 connection.
bool is_dhcp_configured ()
 Status of DHCP.
bool is_smart_confing_completed ()
 Status of smart confing completation.
uint8_t get_mac_address (uint8_t address[6])
 Return the cc3000's mac address.
uint8_t set_mac_address (uint8_t address[6])
 Set the cc3000's mac address.
void get_user_file_info (uint8_t *info_file, size_t size)
 Get user file info.
void set_user_file_info (uint8_t *info_file, size_t size)
 Set user filo info.
void start_smart_config (const uint8_t *smart_config_key)
 Start smart config.
bool get_ip_config (tNetappIpconfigRetArgs *ip_config)
 Return ip configuration.
void delete_profiles (void)
 Delete all stored profiles.
uint32_t ping (uint32_t ip, uint8_t attempts, uint16_t timeout, uint8_t size)
 Ping an ip address.
 cc3000 (PinName cc3000_irq, PinName cc3000_en, PinName cc3000_cs, SPI cc3000_spi, const char *ssid, const char *phrase, Security sec, bool smart_config)
 Ctor for EthernetInterface.
int disconnect ()
 Disconnect wlan device.
void init ()
 Initialize the interface with DHCP.
void init (const char *ip, const char *mask, const char *gateway)
 Initialize the interface with a static IP address.
int connect (unsigned int timeout_ms=20000)
 Connect Bring the interface up.
char * getMACAddress ()
 Get the MAC address of your Ethernet interface.
char * getIPAddress ()
 Get the IP address of your Ethernet interface.
char * getGateway ()
 Get the Gateway address of your Ethernet interface.
char * getNetworkMask ()
 Get the Network mask of your Ethernet interface.

Static Public Member Functions

static cc3000get_instance ()
 Returns cc3000 instance.

Detailed Description

The main object of cc3000 implementation.

Definition at line 1538 of file cc3000.h.


Constructor & Destructor Documentation

cc3000 ( PinName  cc3000_irq,
PinName  cc3000_en,
PinName  cc3000_cs,
SPI  cc3000_spi 
)

Ctor.

Parameters:
cc3000_irqIRQ pin
cc3000_enEnable pin
cc3000_csChip select pin
cc3000_spiSPI interface

Definition at line 50 of file cc3000.cpp.

~cc3000 (  )

Dtor.

Definition at line 60 of file cc3000.cpp.

cc3000 ( PinName  cc3000_irq,
PinName  cc3000_en,
PinName  cc3000_cs,
SPI  cc3000_spi,
const char *  ssid,
const char *  phrase,
Security  sec,
bool  smart_config 
)

Ctor for EthernetInterface.

Parameters:
cc3000_irqIRQ pin
cc3000_enEnable pin
cc3000_csChip select pin
cc3000_spiSPI interface
ssidSSID
phrasePassword
secSecurity of the AP
smart_configSmart config selection

Definition at line 64 of file cc3000.cpp.


Member Function Documentation

int connect ( unsigned int  timeout_ms = 20000 )

Connect Bring the interface up.

Parameters:
timeout_mstimeout in ms
Returns:
0 if successful, -1 otherwise.

Definition at line 119 of file cc3000.cpp.

bool connect_non_blocking ( const uint8_t *  ssid,
const uint8_t *  key,
int32_t  security_mode 
)

Start connection to SSID (open/secured) non-blocking.

Parameters:
ssidSSID name
keySecurity key (if key = 0, open connection)
security_modeSecurity mode
Returns:
true if connection was established, false otherwise.

Definition at line 324 of file cc3000.cpp.

bool connect_open ( const uint8_t *  ssid )

Connect to SSID which is open (no security)

Parameters:
ssidSSID name
Returns:
true if connection was established, false otherwise.

Definition at line 398 of file cc3000.cpp.

bool connect_secure ( const uint8_t *  ssid,
const uint8_t *  key,
int32_t  security_mode 
)

Connect to SSID which is secured.

Parameters:
ssidSSID name
keySecurity key
security_modeSecurity mode
Returns:
true if connection was established, false otherwise.

Definition at line 306 of file cc3000.cpp.

bool connect_to_AP ( const uint8_t *  ssid,
const uint8_t *  key,
int32_t  security_mode 
)

Connect to SSID (open/secured) with timeout (10s).

Parameters:
ssidSSID name
keySecurity key (if key = 0, open connection)
security_modeSecurity mode
Returns:
true if connection was established, false otherwise.

Definition at line 345 of file cc3000.cpp.

void delete_profiles ( void   )

Delete all stored profiles.

Parameters:
none
Returns:
none

Definition at line 459 of file cc3000.cpp.

int disconnect ( void   )

Disconnect wlan device.

Parameters:
none
Returns:
0 if successful, -1 otherwise.

Definition at line 187 of file cc3000.cpp.

static cc3000* get_instance (  ) [static]

Returns cc3000 instance.

Used in Socket interface.

Parameters:
none
Returns:
Pointer to cc3000 object

Definition at line 1694 of file cc3000.h.

bool get_ip_config ( tNetappIpconfigRetArgs *  ip_config )

Return ip configuration.

Parameters:
ip_configPointer to ipconfig data.
Returns:
true if it's connected and info was retrieved, false otherwise.

Definition at line 449 of file cc3000.cpp.

uint8_t get_mac_address ( uint8_t  address[6] )

Return the cc3000's mac address.

Parameters:
addressRetreived mac address.
Returns:

Definition at line 436 of file cc3000.cpp.

void get_user_file_info ( uint8_t *  info_file,
size_t  size 
)

Get user file info.

Parameters:
info_filePointer where info will be stored.
sizeAvailable size.
Returns:
none

Definition at line 444 of file cc3000.cpp.

char * getGateway (  )

Get the Gateway address of your Ethernet interface.

Parameters:
none
Returns:
Pointer to a string containing the Gateway address

Definition at line 179 of file cc3000.cpp.

char * getIPAddress (  )

Get the IP address of your Ethernet interface.

Parameters:
none
Returns:
Pointer to a string containing the IP address.

Definition at line 175 of file cc3000.cpp.

char * getMACAddress (  )

Get the MAC address of your Ethernet interface.

Parameters:
none
Returns:
Pointer to a string containing the MAC address.

Definition at line 171 of file cc3000.cpp.

char * getNetworkMask (  )

Get the Network mask of your Ethernet interface.

Parameters:
none
Returns:
Pointer to a string containing the Network mask

Definition at line 183 of file cc3000.cpp.

void init ( const char *  ip,
const char *  mask,
const char *  gateway 
)

Initialize the interface with a static IP address.

Parameters:
ipthe IP address to use.
maskthe IP address mask
gatewaythe gateway to use
Returns:
none

Definition at line 109 of file cc3000.cpp.

void init (  )

Initialize the interface with DHCP.

Parameters:
none
Returns:
none

Definition at line 84 of file cc3000.cpp.

bool is_connected (  )

Status of the cc3000 connection.

Returns:
true if it's connected, false otherwise.

Definition at line 420 of file cc3000.cpp.

bool is_dhcp_configured (  )

Status of DHCP.

Parameters:
none
Returns:
true if DCHP is configured, false otherwise.

Definition at line 428 of file cc3000.cpp.

bool is_enabled (  )

Status of the cc3000 module.

Returns:
true if it's enabled, false otherwise.

Definition at line 415 of file cc3000.cpp.

bool is_smart_confing_completed (  )

Status of smart confing completation.

Parameters:
none
Returns:
smart config was set, false otherwise.

Definition at line 432 of file cc3000.cpp.

uint32_t ping ( uint32_t  ip,
uint8_t  attempts,
uint16_t  timeout,
uint8_t  size 
)

Ping an ip address.

Parameters:
ipDestination IP address
attemptsNumber of attempts
timeoutTime to wait for a response,in milliseconds.
sizeSend buffer size which may be up to 1400 bytes

Definition at line 473 of file cc3000.cpp.

void restart ( uint8_t  patch )

Restarts the wlan communication.

Definition at line 390 of file cc3000.cpp.

uint8_t set_mac_address ( uint8_t  address[6] )

Set the cc3000's mac address.

Parameters:
addressMac address to be set.
Returns:

Definition at line 440 of file cc3000.cpp.

void set_user_file_info ( uint8_t *  info_file,
size_t  size 
)

Set user filo info.

Parameters:
info_filePointer to user's info.
Returns:
none

Definition at line 469 of file cc3000.cpp.

void start ( uint8_t  patch )

Initiate cc3000.

It starts the wlan communication.

Parameters:
patchPatch

Definition at line 376 of file cc3000.cpp.

void start_smart_config ( const uint8_t *  smart_config_key )

Start smart config.

Parameters:
smart_config_keyPointer to smart config key.
Returns:
none

Definition at line 254 of file cc3000.cpp.

void stop ( void   )

Stops the wlan communication.

Definition at line 385 of file cc3000.cpp.

void usync_callback ( int32_t  event_type,
uint8_t *  data,
uint8_t  length 
)

Callback which is called from the event class.

This updates status of cc3000.

Parameters:
event_typeType of the event
dataPointer to data
lengthLength of data
Returns:
none

Definition at line 197 of file cc3000.cpp.