This library controls the WNC. There is a derived class for usage from the K64F board.
Fork of WncControllerLibrary by
Diff: WncController.h
- Revision:
- 18:ca2899c353c2
- Parent:
- 15:2c8211ef69e1
- Child:
- 19:83a52353b97e
--- a/WncController.h Sat Sep 10 02:55:56 2016 +0000
+++ b/WncController.h Tue Sep 13 19:10:34 2016 +0000
@@ -46,21 +46,14 @@
*/
-static const uint8_t MAX_LEN_IP_STR = 16; // Length includes room for the extra NULL
-static const uint16_t WNC_MAX_SMS_MSG_SLOTS = 3; // How many SMS messages the WNC can store and receive at a time.
-
-struct WncSmsInfo
-{
- char idx[WNC_MAX_SMS_MSG_SLOTS];
- string msgText[WNC_MAX_SMS_MSG_SLOTS];
-};
-
+static const uint8_t MAX_LEN_IP_STR = 16; // Length includes room for the extra NULL
/**
* \brief Contains info fields for the WNC Internet Attributes
*/
struct WncIpStats
{
+ string wncMAC;
char ip[MAX_LEN_IP_STR];
char mask[MAX_LEN_IP_STR];
char gateway[MAX_LEN_IP_STR];
@@ -68,21 +61,10 @@
char dnsSecondary[MAX_LEN_IP_STR];
};
-struct WncDateTime
-{
- uint8_t year;
- uint8_t month;
- uint8_t day;
- uint8_t hour;
- uint8_t min;
- uint8_t sec;
-};
-
class WncController
{
public:
-
- static const unsigned MAX_NUM_WNC_SOCKETS = 1; // Max number of simultaneous sockets that the WNC supports
+ static const unsigned MAX_NUM_WNC_SOCKETS = 5; // Max number of simultaneous sockets that the WNC supports
static const unsigned MAX_POWERUP_TIMEOUT = 60; // How long the powerUp method will try to turn on the WNC Shield
// (this is the default if the user does not over-ride on power-up
@@ -274,9 +256,33 @@
// SMS messaging
///////////////////////////////////////////
+ static const uint16_t MAX_WNC_SMS_MSG_SLOTS = 3; // How many SMS messages the WNC can store and receive at a time.
+ static const uint16_t MAX_WNC_SMS_LENGTH = 160; // The maximum length of an SMS message the WNC can send and receive.
+
+ struct WncSmsInfo
+ {
+ // Content
+ string number;
+ string timestamp;
+ string msg;
+
+ // Attributes
+ bool incoming;
+ bool unsent;
+ bool unread;
+ };
+
+ struct WncSmsList
+ {
+ uint8_t msgCount;
+ WncSmsInfo e[MAX_WNC_SMS_MSG_SLOTS];
+ };
+
bool sendSMSText(const char * const phoneNum, const char * const text);
- size_t readSMSLog(const char ** log);
+ bool readSMSLog(struct WncSmsList * log);
+
+ bool readUnreadSMSText(struct WncSmsList * w);
bool saveSMSText(const char * const phoneNum, const char * const text, char * msgIdx);
@@ -284,9 +290,9 @@
bool deleteSMSTextFromMem(char msgIdx);
- size_t readSMSText(const char n, const char ** msg);
-
- bool readUnreadSMSText(WncSmsInfo * w);
+ bool getICCID(string * iccid);
+
+ bool convertICCIDtoMSISDN(const string & iccid, string * msisdn);
///////////////////////////////////////////
// Neighborhood Cell Info
@@ -294,6 +300,16 @@
size_t getSignalQuality(const char ** log);
// Date Time
+ struct WncDateTime
+ {
+ uint8_t year;
+ uint8_t month;
+ uint8_t day;
+ uint8_t hour;
+ uint8_t min;
+ uint8_t sec;
+ };
+
bool getTimeDate(struct WncDateTime * tod);
// Ping
@@ -365,7 +381,7 @@
bool at_setapn_wnc(const char * const apnStr);
bool at_sendSMStext_wnc(const char * const phoneNum, const char * const text);
bool at_get_wnc_net_stats(WncIpStats * s);
- size_t at_readSMSlog_wnc(const char ** log);
+ bool at_readSMSlog_wnc(string ** log);
size_t at_readSMStext_wnc(const char ** log);
size_t at_readSMStext_wnc(const char n, const char ** log);
bool at_getrssiber_wnc(int16_t * dBm, int16_t * ber3g);
@@ -393,7 +409,6 @@
static const uint16_t WNC_CMD_TIMEOUT_MS = 40000; // Sets default (may be overriden) time that the software waits for an AT response from the WNC.
static const uint16_t WNC_QUICK_CMD_TIMEOUT_MS = 2000; // Used for simple commands that should immediately respond such as "AT", cmds that are quicker than WNC_CMD_TIMEOUT_MS.
static const uint16_t WNC_WAIT_FOR_AT_CMD_MS = 0; // Wait this much between multiple in a row AT commands to the WNC.
- static const uint16_t MAX_WNC_SMS_LENGTH = 150; // The maximum length of an SMS message the WNC can send and receive.
static const uint16_t WNC_SOFT_INIT_RETRY_COUNT = 10; // How many times the WNC will be tried to revive if it stops responding.
static const uint16_t WNC_DNS_RESOLVE_WAIT_MS = 60000; // How much time to wait for the WNC to respond to a DNS resolve/lookup.
static const uint16_t WNC_TRUNC_DEBUG_LENGTH = 80; // Always make this an even number, how many chars for the debug output before shortening the debug ouput, this is used when moreDebug = false.
