Real-time bike tracker using Adafruit Ultimate GPS, Huzzah wifi, and Pubnub

Dependencies:   MBed_Adafruit-GPS-Library mbed

Committer:
ECE4180
Date:
Wed Apr 19 01:00:53 2017 +0000
Revision:
1:0701bf58c9fa
Child:
3:ceca81e8ac2b
GPS String sending to Pubnub and working.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ECE4180 1:0701bf58c9fa 1 #include "PubNub.h"
ECE4180 1:0701bf58c9fa 2
ECE4180 1:0701bf58c9fa 3
ECE4180 1:0701bf58c9fa 4 PubNub::PubNub(string pkey, string skey, string channel, PinName tx_pin, PinName rx_pin)
ECE4180 1:0701bf58c9fa 5 : pubkey(pkey), subkey(skey), channel(channel), huz(tx_pin, rx_pin)
ECE4180 1:0701bf58c9fa 6 {
ECE4180 1:0701bf58c9fa 7 conn_host = "www.pubsub.pubnub.com";
ECE4180 1:0701bf58c9fa 8 conn_port = "80";
ECE4180 1:0701bf58c9fa 9 }
ECE4180 1:0701bf58c9fa 10
ECE4180 1:0701bf58c9fa 11
ECE4180 1:0701bf58c9fa 12 void PubNub::send_message(string message)
ECE4180 1:0701bf58c9fa 13 {
ECE4180 1:0701bf58c9fa 14 string r("GET /publish/");
ECE4180 1:0701bf58c9fa 15 r += pubkey + "/" + subkey + "/0/" + channel + "/0/" + "%%7B%%22text%%22%%3A%%22" +
ECE4180 1:0701bf58c9fa 16 message + "%%22%%7D HTTP/1.1\\r\\nHost: www.pubsub.pubnub.com" +
ECE4180 1:0701bf58c9fa 17 "\\r\\nConnection: keep-alive\\r\\nAccept: */*\\r\\n\\r\\n";
ECE4180 1:0701bf58c9fa 18 huz.http_get(r, conn_host, conn_port);
ECE4180 1:0701bf58c9fa 19 }
ECE4180 1:0701bf58c9fa 20
ECE4180 1:0701bf58c9fa 21 void PubNub::send_message(char* message)
ECE4180 1:0701bf58c9fa 22 {
ECE4180 1:0701bf58c9fa 23 string m(message);
ECE4180 1:0701bf58c9fa 24 send_message(m);
ECE4180 1:0701bf58c9fa 25 }