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

Dependencies:   C027_Support C027_SupportTest mbed picojson

Fork of C027_SupportTest by u-blox

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

Files at this revision

API Documentation at this revision

Comitter:
ntaka206
Date:
Wed Jul 16 12:56:24 2014 +0000
Parent:
27:3e720b569fc3
Child:
29:1f18e74ff972
Commit message:
Xively datastream?context???

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Jul 16 12:49:10 2014 +0000
+++ b/main.cpp	Wed Jul 16 12:56:24 2014 +0000
@@ -33,6 +33,13 @@
 //#define PASSWORD    NULL 
 #define PASSWORD    "nnku62"
 
+//---- Xively --------------------------------------------------------------
+#define XI_FEED_ID 128488 // set Xively Feed ID (numerical, no quoutes)
+#define XI_API_KEY "T4KXAH_dasgw1PWBPc3fdsfsdgsdy-dUc4ND0g" // set Xively API key (double-quoted string)
+
+#include "xively.h"
+#include "xi_err.h"
+
 //------------------------------------------------------------------------------------
 
 int main(void)
@@ -81,6 +88,33 @@
         mdmOk = mdm.registerNet(&netStatus);
         mdm.dumpNetStatus(&netStatus);
     }
+// Xively
+    xi_feed_t feed;
+    memset( &feed, NULL, sizeof( xi_feed_t ) );
+    
+    feed.feed_id = XI_FEED_ID;
+    feed.datastream_count = 2;
+
+    feed.datastreams[0].datapoint_count = 1;
+    xi_datastream_t* lat_datastream = &feed.datastreams[0];
+    strcpy( lat_datastream->datastream_id, "lat" );
+    xi_datapoint_t* current_lat = &lat_datastream->datapoints[0];
+
+    feed.datastreams[1].datapoint_count = 1;
+    xi_datastream_t* lon_datastream = &feed.datastreams[1];
+    strcpy( lon_datastream->datastream_id, "lon" );
+    xi_datapoint_t* current_lon = &lon_datastream->datapoints[0];
+    
+    // create the cosm library context
+    xi_context_t* xi_context
+        = xi_create_context( XI_HTTP, XI_API_KEY, feed.feed_id );
+
+    // check if everything works
+    if( xi_context == NULL )
+    {
+        return -1;
+    }
+
     if (mdmOk)
     {
         // http://www.geckobeach.com/cellular/secrets/gsmcodes.php