C027_SupportTest_xively_locationで使用しているC027用ライブラリ

Fork of C027_Support by u-blox

下記のプログラムC027_SupportTest_xively_locationで使用しているC027用ライブラリです。

Import programC027_SupportTest_xively_location

インターフェース2014年10月号のu-blox C027で3G通信する記事で使用したプログラム。   CQ publishing Interface 2014.10 issue, C027 3G test program.

オリジナルのライブラリは下記を参照してください。

Import libraryC027_Support

support library for C027 helper functions for Buffer Pipes, Buffered Serial Port (rtos capable) and GPS parsing. It includes modem APIs for USSD, SMS and Sockets.

Revision:
5:5362073f2689
Parent:
2:b6012cd91657
Child:
7:9aa830f5811e
diff -r c959dd4c5fe8 -r 5362073f2689 Pipe.h
--- a/Pipe.h	Fri Oct 25 17:50:17 2013 +0000
+++ b/Pipe.h	Sat Nov 02 16:08:20 2013 +0000
@@ -12,17 +12,18 @@
         return i;
     }
 public:
-    Pipe(int n)
+    Pipe(int n, T* p = NULL)
     {
+        a = p ? NULL : new T[n];
         r = 0;
         w = 0;
-        n ++; // we add one more element to be able to identify empty from full
-        b = new T[n];
+        b = p ? p : a;
         s = n;
     }    
     virtual ~Pipe()
     {
-        delete [] b;
+        if (a) 
+            delete [] a;
     }
     // writing thread
     bool writeable(void) // = not full
@@ -123,6 +124,7 @@
 private:
     // buffer
     T*            b; //!< buffer
+    T*            a; //!< allocated buffer
     int           s; //!< size of buffer (s - 1) elements can be stored
     volatile int  w; //! write index 
     volatile int  r; //! read index