This library controls the WNC. There is a derived class for usage from the K64F board.

Fork of WncControllerLibrary by Fred Kellerman

Embed: (wiki syntax)

« Back to documentation index

WncController Class Reference

WncController Class Reference

#include <WncController.h>

Data Structures

struct  WncDateTime
 A struct for the WNC modem Date and Time. More...
struct  WncSmsInfo
 Struct for SMS messages. More...
struct  WncSmsList
 Struct to contain a list of SMS message structs. More...

Public Types

enum  WncState_e
 

Tracks mode of the WNC Shield hardware.

More...

Public Member Functions

 WncController (void)
 Constructor for WncController class, sets up internals.
WncState_e getWncStatus (void)
 Used internally but also make public for a user of the Class to interrogate state as well.
bool setApnName (const char *const apnStr)
 Allows a user to set the WNC modem to use the given Cellular APN.
int16_t getDbmRssi (void)
 Queries the WNC modem for the current RX RSSI in units of coded dBm.
int16_t get3gBer (void)
 Queries the WNC modem for the current Bit Error Rate.
bool powerWncOn (const char *const apn, uint8_t powerUpTimeoutSecs=MAX_POWERUP_TIMEOUT)
 Powers up the WNC modem.
bool getWncNetworkingStats (WncIpStats *s)
 Returns the NAT Self, gateway, masks and dns IP.
bool resolveUrl (uint16_t numSock, const char *url)
 Takes a text URL and converts it internally to an IP address for the socket number given.
bool setIpAddr (uint16_t numSock, const char *ipStr)
 If you know the IP address you can set the socket up to use it rather than using a text URL.
bool openSocket (uint16_t numSock, uint16_t port, bool tcp, uint16_t timeOutSec=30)
 Opens a socket for the given number, port and IP protocol.
bool openSocketUrl (uint16_t numSock, const char *url, uint16_t port, bool tcp, uint16_t timeOutSec=30)
 Opens a socket for the given text URL, number, port and IP protocol.
bool openSocketIpAddr (uint16_t numSock, const char *ipAddr, uint16_t port, bool tcp, uint16_t timeOutSec=30)
 Opens a socket for the given text IP address, number, port and IP protocol.
bool write (uint16_t numSock, const uint8_t *s, uint32_t n)
 Write data bytes to a Socket, the Socket must already be open.
size_t read (uint16_t numSock, uint8_t *readBuf, uint32_t maxReadBufLen)
 Poll to read available data bytes from an already open Socket.
size_t read (uint16_t numSock, const uint8_t **readBuf)
 Poll to read available data bytes from an already open Socket.
void setReadRetries (uint16_t numSock, uint16_t retries)
 Set the number of retries that the read methods will use.
void setReadRetryWait (uint16_t numSock, uint16_t waitMs)
 Set the time between retires that the read methods will use.
bool closeSocket (uint16_t numSock)
 Closes an already open Socket.
void setWncCmdTimeout (uint16_t toMs)
 Sets the amount of time to wait between the raw AT commands that are sent to the WNC modem.
bool getIpAddr (uint16_t numSock, char myIpAddr[MAX_LEN_IP_STR])
 Gets the IP address of the given socket number.
void enableDebug (bool on, bool moreDebugOn)
 Enables debug output from this class.
bool sendSMSText (const char *const phoneNum, const char *const text)
 Sends an SMS text message to someone.
bool readSMSLog (struct WncSmsList *log)
 Incoming messages are stored in a log in the WNC modem, this will read that log.
bool readUnreadSMSText (struct WncSmsList *w, bool deleteRead=true)
 Incoming messages are stored in a log in the WNC modem, this will read out messages that are unread and also then mark them read.
bool saveSMSText (const char *const phoneNum, const char *const text, char *msgIdx)
 Saves a text message into internal SIM card memory of the WNC modem.
bool sendSMSTextFromMem (char msgIdx)
 Sends a prior stored a text message from internal SIM card memory of the WNC modem.
bool deleteSMSTextFromMem (char msgIdx)
 Deletes a prior stored a text message from internal SIM card memory of the WNC modem.
bool getICCID (string *iccid)
 Retreives the SIM card ICCID number.
bool convertICCIDtoMSISDN (const string &iccid, string *msisdn)
 Converts an ICCID number into a MSISDN number.
size_t getSignalQuality (const char **log)
 Fetches the signal quality log from the WNC modem.
bool getTimeDate (struct WncDateTime *tod)
 Fetches the cell tower's time and date.
bool pingUrl (const char *url)
 ICMP Pings a URL, the results are only output to the debug log for now!
bool pingIp (const char *ip)
 ICMP Pings an IP, the results are only output to the debug log for now!
size_t sendCustomCmd (const char *cmd, char *resp, size_t sizeRespBuf, int ms_timeout)
 Allows a user to send a raw AT command to the WNC modem.

Detailed Description

Author:
Fred Kellerman
See also:
The WncControllerLibrary API

WncController This mbed C++ class is for controlling the WNC Cellular modem via the serial AT command interface. This was developed with respect to version 1.3 of the WNC authored unpublished spec. This class is only designed to have 1 instantiation, it is also not multi-thread safe. There are no OS specific entities being used, there are pure virtual methods that an inheriting class must fulfill. That inheriting class will have OS and platform specific entities. See WncControllerK64F for an example for the NXP K64F Freedom board.

Definition at line 76 of file WncController.h.


Member Enumeration Documentation

enum WncState_e

Tracks mode of the WNC Shield hardware.

Definition at line 85 of file WncController.h.