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

Show/hide line numbers WncController.h Source File

WncController.h

Go to the documentation of this file.
00001 /** 
00002     Copyright (c) 2016 Fred Kellerman
00003  
00004     Permission is hereby granted, free of charge, to any person obtaining a copy
00005     of this software and associated documentation files (the "Software"), to deal
00006     in the Software without restriction, including without limitation the rights
00007     to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00008     copies of the Software, and to permit persons to whom the Software is
00009     furnished to do so, subject to the following conditions:
00010  
00011     The above copyright notice and this permission notice shall be included in
00012     all copies or substantial portions of the Software.
00013  
00014     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00015     IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00016     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00017     AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00018     LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00019     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00020     THE SOFTWARE.
00021     
00022     @file          WncController.h
00023     @purpose       Controls WNC Cellular Modem
00024     @version       1.0
00025     @date          July 2016
00026     @author        Fred Kellerman
00027     
00028     Notes: This code originates from the following mbed repository:
00029     
00030     https://developer.mbed.org/teams/Avnet/code/WncControllerLibrary/
00031 */
00032 
00033 
00034 #ifndef __WNCCONTROLLER_H_
00035 #define __WNCCONTROLLER_H_
00036 
00037 #include <string>
00038 #include <stdint.h>
00039 
00040 namespace WncController_fk {
00041 
00042 using namespace std;
00043 
00044 /** @defgroup API The WncControllerLibrary API */
00045 /** @defgroup MISC Misc WncControllerLibrary functions */
00046 /** @defgroup INTERNALS WncControllerLibrary Internals */
00047 
00048 static const uint8_t  MAX_LEN_IP_STR = 16;         // Length includes room for the extra NULL
00049 
00050 /** \brief  Contains info fields for the WNC Internet Attributes */
00051 struct WncIpStats
00052 {
00053     string wncMAC;
00054     char ip[MAX_LEN_IP_STR];
00055     char mask[MAX_LEN_IP_STR];
00056     char gateway[MAX_LEN_IP_STR];
00057     char dnsPrimary[MAX_LEN_IP_STR];
00058     char dnsSecondary[MAX_LEN_IP_STR];
00059 };
00060 
00061 
00062 /**
00063  * @author Fred Kellerman
00064  * @see API 
00065  *
00066  * <b>WncController</b> This mbed C++ class is for controlling the WNC
00067  *  Cellular modem via the serial AT command interface.  This was
00068  *  developed with respect to version 1.3 of the WNC authored
00069  *  unpublished spec.  This class is only designed to have 1 instantiation,
00070  *  it is also not multi-thread safe.  There are no OS specific
00071  *  entities being used, there are pure virtual methods that an 
00072  *  inheriting class must fulfill.  That inheriting class will have
00073  *  OS and platform specific entities.  See WncControllerK64F for an
00074  *  example for the NXP K64F Freedom board.
00075  */
00076 class WncController 
00077 {
00078 public:
00079 
00080     static const unsigned MAX_NUM_WNC_SOCKETS = 5;  // Max number of simultaneous sockets that the WNC supports
00081     static const unsigned MAX_POWERUP_TIMEOUT = 60; // How long the powerUp method will try to turn on the WNC Shield
00082                                                     //  (this is the default if the user does not over-ride on power-up
00083 
00084     /** Tracks mode of the WNC Shield hardware */
00085     enum WncState_e {
00086         WNC_OFF = 0,
00087         WNC_ON, // This is intended to mean all systems go, including cell link up but socket may not be open
00088         WNC_ON_NO_CELL_LINK,
00089         WNC_NO_RESPONSE
00090     };
00091 
00092     /**
00093      *
00094      * Constructor for WncController class, sets up internals.
00095      * @ingroup API
00096      * @return none.
00097      */
00098     WncController (void);
00099     
00100     /**
00101      *
00102      * Used internally but also make public for a user of the Class to 
00103      * interrogate state as well.
00104      * @ingroup API
00105      * @return the current state of the Wnc hardware.
00106      */
00107     WncState_e getWncStatus(void);
00108     
00109     /**
00110      *
00111      * Allows a user to set the WNC modem to use the given Cellular APN 
00112      * @ingroup API
00113      * @param apnStr - a null terminated c-string
00114      * @return true if the APN set was succesful, else false
00115      */
00116     bool setApnName(const char * const apnStr);
00117 
00118     /**
00119      *
00120      * Queries the WNC modem for the current RX RSSI in units of coded dBm
00121      * @ingroup API
00122      * @return 0 – -113 dBm or less
00123      *         1 – -111 dBm
00124      *         2...30 – -109 dBm to –53 dBm
00125      *        31 – -51 dBm or greater
00126      *        99 – not known or not detectable
00127      */
00128     int16_t getDbmRssi(void);
00129     
00130     /**
00131      *
00132      * Queries the WNC modem for the current Bit Error Rate
00133      * @ingroup API
00134      * @return 0...7 – as RXQUAL values in the table in 3GPP TS 45.008
00135      *            subclause 8.2.4
00136      *         99 – not known or not detectable
00137      */
00138     int16_t get3gBer(void);
00139 
00140     /**
00141      *
00142      * Powers up the WNC modem
00143      * @ingroup API
00144      * @param apn - the apn c-string to set the WNC modem to use
00145      * @param powerUpTimeoutSecs - the amount of time to wait for the WNC modem to turn on
00146      * @return true if powerup was a success, else false.
00147      */
00148     bool powerWncOn(const char * const apn, uint8_t powerUpTimeoutSecs = MAX_POWERUP_TIMEOUT);
00149 
00150     /**
00151      *
00152      * Returns the NAT Self, gateway, masks and dns IP
00153      * @ingroup API
00154      * @param s - a pointer to a struct that will contain the IP info.
00155      * @return true if success, else false.
00156      */
00157     bool getWncNetworkingStats(WncIpStats * s);
00158 
00159     /**
00160      *
00161      * Takes a text URL and converts it internally to an IP address for the
00162      * socket number given.
00163      * @ingroup API
00164      * @param numSock - The number of the socket to lookup the IP address for.
00165      * @param url - a c-string text URL
00166      * @return true if success, else false.
00167      */
00168     bool resolveUrl(uint16_t numSock, const char * url);
00169 
00170     /**
00171      *
00172      * If you know the IP address you can set the socket up to use it rather
00173      * than using a text URL.
00174      * @ingroup API
00175      * @param numSock - The number of the socket to use the IP address for.
00176      * @param ipStr - a c-string text IP addrese like: 192.168.0.1
00177      * @return true if success, else false.
00178      */
00179     bool setIpAddr(uint16_t numSock, const char * ipStr);
00180 
00181     /**
00182      *
00183      * Opens a socket for the given number, port and IP protocol.  Before
00184      * using open, you must use either resolveUrl() or setIpAddr().
00185      * @ingroup API
00186      * @param numSock - The number of the socket to open.
00187      * @param port - the IP port to open
00188      * @param tcp - set true for TCP, false for UDP
00189      * @param timeoutSec - the amount of time in seconds to wait for the open to complete
00190      * @return true if success, else false.
00191      */
00192     bool openSocket(uint16_t numSock, uint16_t port, bool tcp, uint16_t timeOutSec = 30);
00193 
00194     /**
00195      *
00196      * Opens a socket for the given text URL, number, port and IP protocol.
00197      * @ingroup API
00198      * @param numSock - The number of the socket to open.
00199      * @param url - a c-string text URL, the one to open a socket for.
00200      * @param port - the IP port to open.
00201      * @param tcp - set true for TCP, false for UDP.
00202      * @param timeoutSec - the amount of time in seconds to wait for the open to complete.
00203      * @return true if success, else false.
00204      */
00205     bool openSocketUrl(uint16_t numSock, const char * url, uint16_t port, bool tcp, uint16_t timeOutSec = 30);
00206 
00207     /**
00208      *
00209      * Opens a socket for the given text IP address, number, port and IP protocol.
00210      * @ingroup API
00211      * @param numSock - The number of the socket to open.
00212      * @param ipAddr - a c-string text IP address like: "192.168.0.1".
00213      * @param port - the IP port to open.
00214      * @param tcp - set true for TCP, false for UDP.
00215      * @param timeoutSec - the amount of time in seconds to wait for the open to complete.
00216      * @return true if success, else false.
00217      */
00218     bool openSocketIpAddr(uint16_t numSock, const char * ipAddr, uint16_t port, bool tcp, uint16_t timeOutSec = 30);
00219 
00220 
00221     /**
00222      *
00223      * Write data bytes to a Socket, the Socket must already be open.
00224      * @ingroup API
00225      * @param numSock - The number of the socket to open.
00226      * @parma s - an array of bytes to write to the socket.
00227      * @param n - the number of bytes to write.
00228      * @return true if success, else false.
00229      */
00230      bool write(uint16_t numSock, const uint8_t * s, uint32_t n);
00231 
00232     /**
00233      *
00234      * Poll to read available data bytes from an already open Socket.  This method
00235      * will retry reads to what setReadRetries() sets it to and the delay in between
00236      * retries that is set with setReadRetryWait()
00237      * @ingroup API
00238      * @param numSock - The number of the socket to open.
00239      * @parma readBuf - a pointer to where read will put the data.
00240      * @param maxReadBufLen - The number of bytes readBuf has room for.
00241      * @return the number of bytes actually read into readBuf.  0 is a valid value if no data is available.
00242      */
00243     size_t read(uint16_t numSock, uint8_t * readBuf, uint32_t maxReadBufLen);
00244     
00245     /**
00246      *
00247      * Poll to read available data bytes from an already open Socket.  This method
00248      * will retry reads to what setReadRetries() sets it to and the delay in between
00249      * retries that is set with setReadRetryWait()
00250      * @ingroup API
00251      * @param numSock - The number of the socket to open.
00252      * @parma readBuf - a pointer to pointer that will be set to point to an internal byte buffer that contains any read data.
00253      * @return the number of bytes actually read into the pointer that readBuf points to.  0 is a valid value if no data is available.
00254      */
00255     size_t read(uint16_t numSock, const uint8_t ** readBuf);
00256 
00257     /**
00258      *
00259      * Set the number of retries that the read methods will use.  If a read returns 0 data this setting will have the read
00260      * re-read to see if new data is available.
00261      * @ingroup API
00262      * @param numSock - The number of the socket to open.
00263      * @parma retries - the number of retries to perform.
00264      * @return none.
00265      */
00266     void setReadRetries(uint16_t numSock, uint16_t retries);
00267 
00268     /**
00269      *
00270      * Set the time between retires that the read methods will use.  If a read returns 0 data this setting will have the read
00271      * re-read and use this amount of delay in between the re-reads.
00272      * @ingroup API
00273      * @param numSock - The number of the socket to open.
00274      * @parma waitMs - the amount of time in mS to wait between retries.
00275      * @return none.
00276      */
00277     void setReadRetryWait(uint16_t numSock, uint16_t waitMs);
00278 
00279     /**
00280      *
00281      * Closes an already open Socket.
00282      * @ingroup API
00283      * @param numSock - The number of the socket to open.
00284      * @return true if success else false.
00285      */
00286     bool closeSocket(uint16_t numSock);
00287 
00288     /**
00289      *
00290      * Sets the amount of time to wait between the raw AT commands that are sent to the WNC modem.
00291      * Generally you don't want to use this but it is here just in case.
00292      * @ingroup API
00293      * @param toMs - num mS to wait between the AT cmds.
00294      * @return none.
00295      */
00296     void setWncCmdTimeout(uint16_t toMs);
00297 
00298     /**
00299      *
00300      * Gets the IP address of the given socket number.
00301      * @ingroup API
00302      * @param numSock - The number of the socket to open.
00303      * @param myIpAddr - a c-string that contains the socket's IP address.
00304      * @return true if success else false.
00305      */
00306     bool getIpAddr(uint16_t numSock, char myIpAddr[MAX_LEN_IP_STR]);
00307     
00308     /**
00309      *
00310      * Enables debug output from this class.
00311      * @ingroup API
00312      * @param on - true enables debug output, false disables
00313      * @param moreDebugOn - true enables verbose debug, false truncates debug output.
00314      * @return none.
00315      */
00316     void enableDebug(bool on, bool moreDebugOn);
00317     
00318     ///////////////////////////////////////////
00319     //  SMS messaging
00320     ///////////////////////////////////////////
00321 
00322     static const uint16_t MAX_WNC_SMS_MSG_SLOTS = 3;   // How many SMS messages the WNC can store and receive at a time.
00323     static const uint16_t MAX_WNC_SMS_LENGTH    = 160; // The maximum length of a 7-bit SMS message the WNC can send and receive.
00324     
00325     /** Struct for SMS messages */
00326     struct WncSmsInfo
00327     {
00328         // Content
00329         char   idx;
00330         string number;
00331         string date;
00332         string time;
00333         string msg;
00334         
00335         // Attributes
00336         bool incoming;
00337         bool unsent;
00338         bool unread;
00339         bool pduMode;
00340         bool msgReceipt;
00341     };
00342 
00343     /** Struct to contain a list of SMS message structs */
00344     struct WncSmsList
00345     {
00346         uint8_t msgCount;
00347         WncSmsInfo e[MAX_WNC_SMS_MSG_SLOTS];
00348     };
00349 
00350     /**
00351      *
00352      * Sends an SMS text message to someone.
00353      * @ingroup API
00354      * @param phoneNum - c-string 15 digit MSISDN number or ATT Jasper number (standard phone number not supported because ATT IoT SMS does not support it).
00355      * @param text - the c-string text to send to someone.
00356      * @return true if success else false.
00357      */
00358     bool sendSMSText(const char * const phoneNum, const char * const text);
00359 
00360     /**
00361      *
00362      * Incoming messages are stored in a log in the WNC modem, this will read that
00363      * log.
00364      * @ingroup API
00365      * @param log - the log contents if reading it was successful.
00366      * @return true if success else false.
00367      */
00368     bool readSMSLog(struct WncSmsList * log);
00369 
00370     /**
00371      *
00372      * Incoming messages are stored in a log in the WNC modem, this will read out
00373      * messages that are unread and also then mark them read.
00374      * @ingroup API
00375      * @param w - a list of SMS messages that unread messages will be put into.
00376      * @param deleteRead - if a message is read and this is set true the message will be deleted from the WNC modem log.
00377      * If it is false the message will remain in the internal log but be marked as read.
00378      * @return true if success else false.
00379      */
00380     bool readUnreadSMSText(struct WncSmsList * w, bool deleteRead = true);
00381     
00382     /**
00383      *
00384      * Saves a text message into internal SIM card memory of the WNC modem.
00385      * There are only 3 slots available this is for unread, read and saved.
00386      * @ingroup API
00387      * @param phoneNum - c-string 15 digit MSISDN number or ATT Jasper number (standard phone number not supported because ATT IoT SMS does not support it).
00388      * @param text - the c-string text to send to someone.
00389      * @param msgIdx - the slot position to save the message: '1', '2', '3'
00390      * @return true if success else false.
00391      */
00392     bool saveSMSText(const char * const phoneNum, const char * const text, char * msgIdx);
00393 
00394     /**
00395      *
00396      * Sends a prior stored a text message from internal SIM card memory of the WNC modem.
00397      * If no messages are stored the behaviour of this method is undefined.
00398      * @ingroup API
00399      * @param msgIdx - the slot position to save the message: '1', '2', '3'
00400      * @return true if success else false.
00401      */
00402     bool sendSMSTextFromMem(char msgIdx);
00403 
00404     /**
00405      *
00406      * Deletes a prior stored a text message from internal SIM card memory of the WNC modem.
00407      * If no messages are stored the behaviour of this method is undefined.
00408      * @ingroup API
00409      * @param msgIdx - the slot position to save the message: '1', '2', '3' or '*' deletes them all.
00410      * @return true if success else false.
00411      */
00412     bool deleteSMSTextFromMem(char msgIdx);
00413     
00414     /**
00415      *
00416      * Retreives the SIM card ICCID number.
00417      * @ingroup API
00418      * @param iccid - a pointer to C++ string that contains the retrieved number.
00419      * @return true if success else false.
00420      */
00421     bool getICCID(string * iccid);
00422 
00423     /**
00424      *
00425      * Converts an ICCID number into a MSISDN number.  The ATT SMS system for IoT only allows use of the 15-digit MSISDN number.
00426      * @ingroup API
00427      * @param iccid - the number to convert.
00428      * @param msisdn - points to a C++ string that has the converted number.
00429      * @return true if success else false.
00430      */
00431     bool convertICCIDtoMSISDN(const string & iccid, string * msisdn);
00432     
00433     ///////////////////////////////////////////
00434     // Neighborhood Cell Info
00435     ///////////////////////////////////////////
00436     
00437     /**
00438      *
00439      * Fetches the signal quality log from the WNC modem.
00440      * @ingroup API
00441      * @param log - a pointer to an internal buffer who's contents contain the signal quality metrics.
00442      * @return The number of chars in the log.
00443      */
00444     size_t getSignalQuality(const char ** log);
00445     
00446     /**  A struct for the WNC modem Date and Time */
00447     struct WncDateTime
00448     {
00449         uint8_t  year;
00450         uint8_t  month;
00451         uint8_t  day;
00452         uint8_t  hour;
00453         uint8_t  min;
00454         uint8_t  sec;
00455     };
00456 
00457     /**
00458      *
00459      * Fetches the cell tower's time and date.  The time is accurate when read
00460      * but significant delays exist between the time it is read and returned.
00461      * @ingroup API
00462      * @param tod - User supplies a pointer to a tod struct and this method fills it in.
00463      * @return true if success else false.
00464      */
00465     bool getTimeDate(struct WncDateTime * tod);
00466     
00467     /**
00468      *
00469      * ICMP Pings a URL, the results are only output to the debug log for now!
00470      * @ingroup API
00471      * @param url - a c-string whose URL is to be pinged.
00472      * @return true if success else false.
00473      */
00474     bool pingUrl(const char * url);
00475 
00476     /**
00477      *
00478      * ICMP Pings an IP, the results are only output to the debug log for now!
00479      * @ingroup API
00480      * @param ip - a c-string whose IP is to be pinged.
00481      * @return true if success else false.
00482      */
00483     bool pingIp(const char * ip);
00484     
00485     /**
00486      *
00487      * Allows a user to send a raw AT command to the WNC modem.
00488      * @ingroup API
00489      * @param cmd - the c-string cmd to send like: "AT"
00490      * @param resp - a pointer to the c-string cmd's response.
00491      * @param sizeRespBuf - how large the command response buffer is, sets the max response length.
00492      * @param ms_timeout - how long to wait for the WNC to respond to your command.
00493      * @return the number of characters in the response from the WNC modem.
00494      */
00495     size_t sendCustomCmd(const char * cmd, char * resp, size_t sizeRespBuf, int ms_timeout);
00496 
00497 protected:
00498 
00499     // Debug output methods
00500     int dbgPutsNoTime(const char * s, bool crlf = true);
00501     int dbgPuts(const char * s, bool crlf = true);
00502     const char * _to_string(int64_t value);
00503     const char * _to_hex_string(uint8_t value);    
00504 
00505     // Sends commands to WNC via
00506     enum AtCmdErr_e {
00507         WNC_AT_CMD_OK,
00508         WNC_AT_CMD_ERR,
00509         WNC_AT_CMD_ERREXT,
00510         WNC_AT_CMD_ERRCME,
00511         WNC_AT_CMD_INVALID_RESPONSE,
00512         WNC_AT_CMD_TIMEOUT,
00513         WNC_AT_CMD_NO_CELL_LINK,
00514         WNC_AT_CMD_WNC_NOT_ON
00515     };
00516 
00517     bool waitForPowerOnModemToRespond(uint8_t powerUpTimeoutSecs);    
00518     AtCmdErr_e sendWncCmd(const char * const s, string ** r, int ms_timeout);
00519 
00520     // Users must define these functionalities in the inheriting class:
00521         // General I/O and timing:
00522     virtual int putc(char c)              = 0;
00523     virtual int puts(const char * s)      = 0;
00524     virtual char getc(void)               = 0;
00525     virtual int charReady(void)           = 0;
00526     virtual int dbgWriteChar(char b)      = 0;
00527     virtual int dbgWriteChars(const char *b) = 0;
00528     virtual void waitMs(int t)            = 0;
00529     virtual void waitUs(int t)            = 0;
00530     virtual bool initWncModem(uint8_t powerUpTimeoutSecs) = 0;
00531     
00532         // Isolate OS timers
00533     virtual int  getLogTimerTicks(void)  = 0;
00534     virtual void startTimerA(void)       = 0;
00535     virtual void stopTimerA(void)        = 0;
00536     virtual int  getTimerTicksA_mS(void) = 0;
00537     virtual void startTimerB(void)       = 0;
00538     virtual void stopTimerB(void)        = 0;
00539     virtual int  getTimerTicksB_mS(void) = 0;
00540     
00541 private:
00542 
00543     bool softwareInitMdm(void);
00544     bool checkCellLink(void);
00545     AtCmdErr_e mdmSendAtCmdRsp(const char * cmd, int timeout_ms, string * rsp, bool crLf = true);
00546     size_t mdmGetline(string * buff, int timeout_ms);
00547     bool at_at_wnc(void);
00548     bool at_init_wnc(bool hardReset = false);
00549     int16_t at_sockopen_wnc(const char * const ip, uint16_t port, uint16_t numSock, bool tcp, uint16_t timeOutSec);
00550     bool at_sockclose_wnc(uint16_t numSock);
00551     bool at_dnsresolve_wnc(const char * s, string * ipStr);
00552     AtCmdErr_e at_sockwrite_wnc(const uint8_t * s, uint16_t n, uint16_t numSock, bool isTcp);
00553     AtCmdErr_e at_sockread_wnc(uint8_t * pS, uint16_t * numRead, uint16_t n, uint16_t numSock, bool isTcp);
00554     AtCmdErr_e at_sockread_wnc(string * pS, uint16_t numSock, bool isTcp);
00555     bool at_reinitialize_mdm(void);
00556     AtCmdErr_e at_send_wnc_cmd(const char * s, string ** r, int ms_timeout);
00557     bool at_setapn_wnc(const char * const apnStr);
00558     bool at_sendSMStext_wnc(const char * const phoneNum, const char * const text);
00559     bool at_get_wnc_net_stats(WncIpStats * s);
00560     bool at_readSMSlog_wnc(string ** log);
00561     size_t at_readSMStext_wnc(const char ** log);
00562     size_t at_readSMStext_wnc(const char n, const char ** log);
00563     bool at_getrssiber_wnc(int16_t * dBm, int16_t * ber3g);
00564     void closeOpenSocket(uint16_t numSock);
00565     bool sockWrite(const uint8_t * const s, uint16_t n, uint16_t numSock, bool isTcp);
00566     bool at_sendSMStextMem_wnc(char n);
00567     bool at_deleteSMSTextFromMem_wnc(char n);
00568     bool at_saveSMStext_wnc(const char * const phoneNum, const char * const text, char * msgIdx);
00569     size_t at_getSignalQuality_wnc(const char ** log);
00570     bool at_gettimedate_wnc(struct WncDateTime * tod);
00571     bool at_ping_wnc(const char * ip);
00572     bool at_geticcid_wnc(string * iccid);
00573     
00574     // Utility methods
00575     void sendCmd(const char * cmd, bool crLf);
00576     void sendCmd(const char * cmd, unsigned n, unsigned wait_uS, bool crLf);    
00577     inline void rx_char_wait(void) {
00578         // waitUs(1000);
00579     }
00580     
00581     // Important constants
00582     static const uint16_t MAX_WNC_READ_BYTES        = 1500;                            // This bounds the largest amount of data that the WNC read from a socket will return
00583     static const uint16_t MAX_WNC_WRITE_BYTES       = MAX_WNC_READ_BYTES;              // This is the largest amount of data that the WNC can write per sockwrite.
00584     static const uint16_t MAX_LEN_WNC_CMD_RESPONSE  = (MAX_WNC_READ_BYTES * 2 + 100);  // Max number of text characters in a WNC AT response *2 because bytes are converted into 2 hex-digits +100 for other AT@ chars.
00585     static const uint16_t WNC_AUTO_POLL_MS          = 250;   // Sets default (may be overriden with method) poll interval (currently not used, future possible feature.
00586     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.
00587     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.
00588     static const uint16_t WNC_WAIT_FOR_AT_CMD_MS    = 0;     // Wait this much between multiple in a row AT commands to the WNC.
00589     static const uint16_t WNC_SOFT_INIT_RETRY_COUNT = 10;    // How many times the WNC will be tried to revive if it stops responding.
00590     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.
00591     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. 
00592     static const uint16_t WNC_APNSET_TIMEOUT_MS     = 60000; // How long to wait for the WNC to respond to setting the APN string.
00593     static const uint16_t WNC_PING_CMD_TIMEOUT_MS   = 60000; // Amount of time to wait for the WNC to respond to AT@PINGREQ (with cmd default params for timeout, does not change WNC cmd's timeout) 
00594     static const int      WNC_REINIT_MAX_TIME_MS    = 60000; // How long to wait for the WNC to reset after it was already up and running after power-up.
00595     static const uint16_t WNC_SOCK_CLOSE_RETRY_CNT  = 3;     // How many times to try to close the socket if the WNC gives an error.
00596     static const char * const INVALID_IP_STR;                // Just a string set to an IP address when DNS resolve fails.
00597         
00598     struct WncSocketInfo_s {
00599         int16_t numWncSock;
00600         bool open;
00601         string myIpAddressStr;
00602         uint16_t myPort;
00603         uint8_t readRetries;
00604         uint16_t readRetryWaitMs;
00605         bool isTcp;
00606         uint16_t timeOutSec;
00607     };
00608 
00609     static WncSocketInfo_s m_sSock[MAX_NUM_WNC_SOCKETS];
00610     static const WncSocketInfo_s defaultSockStruct;
00611     static WncState_e m_sState;
00612     static uint16_t m_sCmdTimeoutMs;
00613     static string m_sApnStr;
00614     static string m_sWncStr;
00615     static uint8_t m_sPowerUpTimeoutSecs;
00616     static bool m_sDebugEnabled;
00617     static bool m_sMoreDebugEnabled;
00618     static bool m_sCheckNetStatus;
00619     static bool m_sReadyForSMS;
00620 };
00621 
00622 };  // End namespace WncController_fk
00623 
00624 #endif
00625