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

Fork of WncControllerLibrary by Fred Kellerman

Files at this revision

API Documentation at this revision

Comitter:
fkellermavnet
Date:
Sat Sep 10 01:10:20 2016 +0000
Parent:
12:33290e9e6e5f
Child:
14:e846217affcd
Commit message:
Cleaned up write a bit too, tested all good!

Changed in this revision

WncController.cpp Show annotated file Show diff for this revision Revisions of this file
WncController.h Show annotated file Show diff for this revision Revisions of this file
--- a/WncController.cpp	Sat Sep 10 00:49:34 2016 +0000
+++ b/WncController.cpp	Sat Sep 10 01:10:20 2016 +0000
@@ -392,7 +392,7 @@
  *  arriving at the endpoint.
  */
  
-bool WncController::sockWrite(const char * const s, uint32_t n, uint16_t numSock, bool isTcp)
+bool WncController::sockWrite(const char * const s, uint16_t n, uint16_t numSock, bool isTcp)
 {
     bool result = true;
     
@@ -422,7 +422,7 @@
             }
             else {
                 uint16_t rem = n % MAX_WNC_WRITE_BYTES;
-                while (n > MAX_WNC_WRITE_BYTES) {
+                while (n >= MAX_WNC_WRITE_BYTES) {
                     n -= MAX_WNC_WRITE_BYTES;
                     result = sockWrite(s, MAX_WNC_WRITE_BYTES, numSock, m_sSock[numSock].isTcp);
                     if (result == false) {
@@ -1422,7 +1422,7 @@
     return (false);
 }
 
-WncController::AtCmdErr_e WncController::at_sockwrite_wnc(const char * s, uint32_t n, uint16_t numSock, bool isTcp)
+WncController::AtCmdErr_e WncController::at_sockwrite_wnc(const char * s, uint16_t n, uint16_t numSock, bool isTcp)
 {
     AtCmdErr_e result;
 
@@ -1444,7 +1444,7 @@
             n--;
             num2str = _to_hex_string((uint8_t)*s++);
             // Always 2-digit ascii hex:
-            if (strlen(num2str) == 1)
+            if (num2str[1] == '\0')
                 cmd_str += '0';
             cmd_str += num2str;
         }
--- a/WncController.h	Sat Sep 10 00:49:34 2016 +0000
+++ b/WncController.h	Sat Sep 10 01:10:20 2016 +0000
@@ -352,7 +352,7 @@
     int16_t at_sockopen_wnc(const char * const ip, uint16_t port, uint16_t numSock, bool tcp, uint16_t timeOutSec);
     bool at_sockclose_wnc(uint16_t numSock);
     bool at_dnsresolve_wnc(const char * s, string * ipStr);
-    AtCmdErr_e at_sockwrite_wnc(const char * s, uint32_t n, uint16_t numSock, bool isTcp);
+    AtCmdErr_e at_sockwrite_wnc(const char * s, uint16_t n, uint16_t numSock, bool isTcp);
     AtCmdErr_e at_sockread_wnc(uint8_t * pS, uint16_t * numRead, uint16_t n, uint16_t numSock, bool isTcp);
     AtCmdErr_e at_sockread_wnc(string * pS, uint16_t numSock, bool isTcp);
     bool at_reinitialize_mdm(void);
@@ -365,7 +365,7 @@
     size_t at_readSMStext_wnc(const char n, const char ** log);
     bool at_getrssiber_wnc(int16_t * dBm, int16_t * ber3g);
     void closeOpenSocket(uint16_t numSock);
-    bool sockWrite(const char * const s, uint32_t n, uint16_t numSock, bool isTcp);
+    bool sockWrite(const char * const s, uint16_t n, uint16_t numSock, bool isTcp);
     bool at_sendSMStextMem_wnc(char n);
     bool at_deleteSMSTextFromMem_wnc(char n);
     bool at_saveSMStext_wnc(const char * const phoneNum, const char * const text, char * msgIdx);