seeedstudio ARCH GPRS Demo. post data to yeelink.

Dependencies:   mbed

Committer:
loovee
Date:
Fri Aug 23 02:31:06 2013 +0000
Revision:
0:6d297fe482af
seeedstudio Arch Gprs Demo. ; ; post data to yeelink.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
loovee 0:6d297fe482af 1 /*
loovee 0:6d297fe482af 2 IOT_Mbed.h
loovee 0:6d297fe482af 3 2013 Copyright (c) Seeed Technology Inc. All right reserved.
loovee 0:6d297fe482af 4
loovee 0:6d297fe482af 5 Author:Loovee
loovee 0:6d297fe482af 6 2013-7-21
loovee 0:6d297fe482af 7
loovee 0:6d297fe482af 8 This library is free software; you can redistribute it and/or
loovee 0:6d297fe482af 9 modify it under the terms of the GNU Lesser General Public
loovee 0:6d297fe482af 10 License as published by the Free Software Foundation; either
loovee 0:6d297fe482af 11 version 2.1 of the License, or (at your option) any later version.
loovee 0:6d297fe482af 12
loovee 0:6d297fe482af 13 This library is distributed in the hope that it will be useful,
loovee 0:6d297fe482af 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
loovee 0:6d297fe482af 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
loovee 0:6d297fe482af 16 Lesser General Public License for more details.
loovee 0:6d297fe482af 17
loovee 0:6d297fe482af 18 You should have received a copy of the GNU Lesser General Public
loovee 0:6d297fe482af 19 License along with this library; if not, write to the Free Software
loovee 0:6d297fe482af 20 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
loovee 0:6d297fe482af 21 */
loovee 0:6d297fe482af 22
loovee 0:6d297fe482af 23 #ifndef __TCP_YEELINK_H__
loovee 0:6d297fe482af 24 #define __TCP_YEELINK_H__
loovee 0:6d297fe482af 25
loovee 0:6d297fe482af 26 #include "mbed.h"
loovee 0:6d297fe482af 27
loovee 0:6d297fe482af 28 class IOT_Mbed{
loovee 0:6d297fe482af 29
loovee 0:6d297fe482af 30 private:
loovee 0:6d297fe482af 31
loovee 0:6d297fe482af 32 //Serial serial1(P0_19, P0_18); // tx, rx
loovee 0:6d297fe482af 33 private:
loovee 0:6d297fe482af 34 char yeelinkPostURL[100];
loovee 0:6d297fe482af 35 char yeelinkPostHeads[100];
loovee 0:6d297fe482af 36
loovee 0:6d297fe482af 37 char yeelinkDns[20];
loovee 0:6d297fe482af 38 char yeelinkPort[10];
loovee 0:6d297fe482af 39
loovee 0:6d297fe482af 40 private:
loovee 0:6d297fe482af 41
loovee 0:6d297fe482af 42 void callTest();
loovee 0:6d297fe482af 43
loovee 0:6d297fe482af 44 int sendCmdAndWaitForRest(char *dta, const char *resq, int timeout);
loovee 0:6d297fe482af 45 void sendCmd(char *dta);
loovee 0:6d297fe482af 46 int parseURL(const char *url, char *host, int max_host_len, unsigned int *port, char *path, int max_path_len);
loovee 0:6d297fe482af 47
loovee 0:6d297fe482af 48 public:
loovee 0:6d297fe482af 49 int waitString(const char *str, int timeout);
loovee 0:6d297fe482af 50 void init(char *postURL, char *APIKey);
loovee 0:6d297fe482af 51 int checkAT(int timeout);
loovee 0:6d297fe482af 52 int connectTCP();
loovee 0:6d297fe482af 53 int connectTCP(char *ip, char *port);
loovee 0:6d297fe482af 54 void postDtaToYeelink();
loovee 0:6d297fe482af 55 int postDtaToYeelink(char *url, char *apikey, int sensorDta);
loovee 0:6d297fe482af 56 int postDtaToYeelink(char *url, char *apikey, float sensorDta, int dec);
loovee 0:6d297fe482af 57
loovee 0:6d297fe482af 58 int sendDtaTcp(char *dta, int timeout);
loovee 0:6d297fe482af 59 bool sendToYeelink_t();
loovee 0:6d297fe482af 60
loovee 0:6d297fe482af 61
loovee 0:6d297fe482af 62 };
loovee 0:6d297fe482af 63
loovee 0:6d297fe482af 64
loovee 0:6d297fe482af 65 extern IOT_Mbed IOT;
loovee 0:6d297fe482af 66
loovee 0:6d297fe482af 67
loovee 0:6d297fe482af 68 #endif
loovee 0:6d297fe482af 69
loovee 0:6d297fe482af 70 /*********************************************************************************************************
loovee 0:6d297fe482af 71 END FILE
loovee 0:6d297fe482af 72 *********************************************************************************************************/