二期c++接口

Dependencies:   EthernetInterface mbed-rtos mbed uniqueCPUID

Fork of bcsdk by Heng Well

Committer:
webmaster
Date:
Fri Nov 03 01:07:32 2017 +0000
Revision:
10:aabd720e632c
Parent:
8:f2a567ee3a46
Child:
12:1b24ea479a59
publish v0.1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
webmaster 8:f2a567ee3a46 1 /***********************************************************************
webmaster 8:f2a567ee3a46 2 * Module: Client.h
webmaster 8:f2a567ee3a46 3 * Author: Administrator
webmaster 10:aabd720e632c 4 * Modified: 2017��9��4�� 11:08:02
webmaster 8:f2a567ee3a46 5 * Purpose: Declaration of the class Client
webmaster 10:aabd720e632c 6 * Comment: Client���������Զ��
webmaster 10:aabd720e632c 7 * APIִ��HTTP�������������
webmaster 10:aabd720e632c 8 * ��Ϣ�� ͨ����Ӧ�ó��򽫾�����
webmaster 10:aabd720e632c 9 * �����ķ�������Ŀͻ��˺���HSM
webmaster 10:aabd720e632c 10 * ��������������ĵ����ͻ��ˡ�
webmaster 8:f2a567ee3a46 11 ***********************************************************************/
webmaster 8:f2a567ee3a46 12
webmaster 8:f2a567ee3a46 13 #if !defined(__Account_Client_h)
webmaster 8:f2a567ee3a46 14 #define __Account_Client_h
webmaster 8:f2a567ee3a46 15
webmaster 8:f2a567ee3a46 16 #include "define.h"
webmaster 8:f2a567ee3a46 17 #include <stdio.h>
webmaster 8:f2a567ee3a46 18 #include <iostream>
webmaster 8:f2a567ee3a46 19 #include <string>
webmaster 8:f2a567ee3a46 20
webmaster 8:f2a567ee3a46 21
webmaster 8:f2a567ee3a46 22 using namespace std;
webmaster 8:f2a567ee3a46 23
webmaster 8:f2a567ee3a46 24 class Client
webmaster 8:f2a567ee3a46 25 {
webmaster 8:f2a567ee3a46 26 public:
webmaster 8:f2a567ee3a46 27 Client();
webmaster 8:f2a567ee3a46 28 Client(string ip, short port);
webmaster 8:f2a567ee3a46 29 ~Client();
webmaster 8:f2a567ee3a46 30
webmaster 8:f2a567ee3a46 31 void setIp(string newIp){ this->m_strIP = newIp;};
webmaster 8:f2a567ee3a46 32 string getIp(){return this->m_strIP;};
webmaster 8:f2a567ee3a46 33 void setPort(short newPort){this->m_sPort = newPort;};
webmaster 8:f2a567ee3a46 34 short getPort(){return this->m_sPort;};
webmaster 8:f2a567ee3a46 35 int http_post(const string &strIn,string &strOut);
webmaster 8:f2a567ee3a46 36
webmaster 8:f2a567ee3a46 37 bool build_post_raw(const string & url,const string & content, string & post_raw);
webmaster 8:f2a567ee3a46 38 bool build_post_raw(const string & url, const string & host, const string & token, const string & content, string & post_raw);
webmaster 8:f2a567ee3a46 39 int http_post(const string & url,const string & content,string & strOut);
webmaster 8:f2a567ee3a46 40 int http_post_raw(const string &strIn,string &strOut);
webmaster 10:aabd720e632c 41
webmaster 10:aabd720e632c 42 int get_content_length(const string & strRaw);
webmaster 10:aabd720e632c 43 string get_content(const string & strRep);
webmaster 10:aabd720e632c 44 bool unbuild_post_raw(const string & strRep, int & content_length, string & url,string & content);
webmaster 8:f2a567ee3a46 45
webmaster 8:f2a567ee3a46 46 protected:
webmaster 8:f2a567ee3a46 47 private:
webmaster 8:f2a567ee3a46 48 int urlIndex;
webmaster 8:f2a567ee3a46 49 //list<URL> urls;
webmaster 8:f2a567ee3a46 50 std::string accessToken;
webmaster 8:f2a567ee3a46 51 //socket httpClient;
webmaster 8:f2a567ee3a46 52 std::string json;
webmaster 8:f2a567ee3a46 53 std::string version;
webmaster 8:f2a567ee3a46 54
webmaster 8:f2a567ee3a46 55 string m_strIP;
webmaster 8:f2a567ee3a46 56 short m_sPort;
webmaster 8:f2a567ee3a46 57 string m_url;
webmaster 8:f2a567ee3a46 58 string m_host;
webmaster 8:f2a567ee3a46 59 string m_token;
webmaster 8:f2a567ee3a46 60
webmaster 8:f2a567ee3a46 61
webmaster 8:f2a567ee3a46 62 };
webmaster 8:f2a567ee3a46 63
webmaster 8:f2a567ee3a46 64 #endif