Vodafone K3770/K3772-Z modems driver & networking library

Dependencies:   Socket USBHostWANDongle lwip-sys lwip

Dependents:   VodafoneUSBModemHTTPClientTest VodafoneUSBModemNTPClientTest VodafoneUSBModemSMSTest VodafoneUSBModemUSSDTest ... more

Fork of VodafoneUSBModem_bleedingedge by Donatien Garnier

Embed: (wiki syntax)

« Back to documentation index

VodafoneUSBModem Class Reference

VodafoneUSBModem Class Reference

Vodafone USB Modem (K3770/K3772-Z) dongle. More...

#include <VodafoneUSBModem.h>

Public Member Functions

 VodafoneUSBModem (PinName powerGatingPin=NC, bool powerGatingOnWhenPinHigh=true)
 Create Vodafone USB Modem (K3770/K3772-Z) dongle API instance.
int connect (const char *apn=NULL, const char *user=NULL, const char *password=NULL)
 Open a 3G internet connection.
int disconnect ()
 Close the internet connection.
int sendSM (const char *number, const char *message)
 Send a SM.
int getSM (char *number, char *message, size_t maxLength)
 Receive a SM.
int getSMCount (size_t *pCount)
 Get the number of SMs in the incoming box.
int sendUSSD (const char *command, char *result, size_t maxLength)
 Send a USSD command & wait for its result.
int getLinkState (int *pRssi, LinkMonitor::REGISTRATION_STATE *pRegistrationState, LinkMonitor::BEARER *pBearer)
 Get link state.
ATCommandsInterfacegetATCommandsInterface ()
 Get the ATCommandsInterface instance.
int power (bool enable)
 Switch power on or off In order to use this function, a pin name must have been entered in the constructor.
char * getIPAddress ()
 Get the IP address of a connected device.

Protected Member Functions

int init ()
 Initialise dongle.
int cleanup ()
 De-initialise dongle.

Detailed Description

Vodafone USB Modem (K3770/K3772-Z) dongle.

Definition at line 35 of file VodafoneUSBModem.h.


Constructor & Destructor Documentation

VodafoneUSBModem ( PinName  powerGatingPin = NC,
bool  powerGatingOnWhenPinHigh = true 
)

Create Vodafone USB Modem (K3770/K3772-Z) dongle API instance.

Parameters:
powerGatingPinOptional pin commanding a power gating transistor on the modem's power line
powerGatingOnWhenPinHightrue if the pin needs to be high to power the dongle, defaults to true

Definition at line 31 of file VodafoneUSBModem.cpp.


Member Function Documentation

int cleanup (  ) [protected]

De-initialise dongle.

The following actions are performed: 1) Tear down PPP session 2) Set SMS,USSD, and LinkMonitor subsystems to un-initialised 3) Close the AT commands interface 4) Tear down the USB connection to dongle

Definition at line 692 of file VodafoneUSBModem.cpp.

int connect ( const char *  apn = NULL,
const char *  user = NULL,
const char *  password = NULL 
)

Open a 3G internet connection.

Returns:
0 on success, error code on failure

Definition at line 179 of file VodafoneUSBModem.cpp.

int disconnect (  )

Close the internet connection.

Returns:
0 on success, error code on failure

Definition at line 278 of file VodafoneUSBModem.cpp.

ATCommandsInterface * getATCommandsInterface (  )

Get the ATCommandsInterface instance.

Returns:
Pointer to the ATCommandsInterface instance

Definition at line 474 of file VodafoneUSBModem.cpp.

char * getIPAddress (  )

Get the IP address of a connected device.

Returns:
A pointer to a string containing the IP address.

Definition at line 717 of file VodafoneUSBModem.cpp.

int getLinkState ( int *  pRssi,
LinkMonitor::REGISTRATION_STATE pRegistrationState,
LinkMonitor::BEARER pBearer 
)

Get link state.

Parameters:
pRssipointer to store the current RSSI in dBm, between -51 dBm and -113 dBm if known; -51 dBm means -51 dBm or more; -113 dBm means -113 dBm or less; 0 if unknown
pRegistrationStatepointer to store the current registration state
pBearerpointer to store the current bearer
Returns:
0 on success, error code on failure

Definition at line 445 of file VodafoneUSBModem.cpp.

int getSM ( char *  number,
char *  message,
size_t  maxLength 
)

Receive a SM.

Parameters:
numberPointer to a buffer to store the sender's phone number (must be at least 17 characters-long, including the sapce for the null-terminating char)
messagePointer to a buffer to store the the incoming message
maxLengthMaximum message length that can be stored in buffer (including null-terminating character)
Returns:
0 on success, error code on failure

Definition at line 364 of file VodafoneUSBModem.cpp.

int getSMCount ( size_t *  pCount )

Get the number of SMs in the incoming box.

Parameters:
pCountpointer to store the number of unprocessed SMs on
Returns:
0 on success, error code on failure

Definition at line 391 of file VodafoneUSBModem.cpp.

int init (  ) [protected]

Initialise dongle.

The following actions are performed: 1) Power up 2) Establish USB connection to dongle 3) Start AT interface thread 4) Wait for network registration

Definition at line 508 of file VodafoneUSBModem.cpp.

int power ( bool  enable )

Switch power on or off In order to use this function, a pin name must have been entered in the constructor.

Parameters:
enabletrue to switch the dongle on, false to switch it off
Returns:
0 on success, error code on failure

Definition at line 479 of file VodafoneUSBModem.cpp.

int sendSM ( const char *  number,
const char *  message 
)

Send a SM.

Parameters:
numberThe receiver's phone number
messageThe message to send
Returns:
0 on success, error code on failure

Definition at line 337 of file VodafoneUSBModem.cpp.

int sendUSSD ( const char *  command,
char *  result,
size_t  maxLength 
)

Send a USSD command & wait for its result.

Parameters:
commandThe command to send
resultBuffer in which to store the result
maxLengthMaximum result length that can be stored in buffer (including null-terminating character)
Returns:
0 on success, error code on failure

Definition at line 418 of file VodafoneUSBModem.cpp.