二期c++接口
Dependencies: EthernetInterface mbed-rtos mbed uniqueCPUID
Fork of bcsdk by
Client.h@14:59412fcf8fa2, 2018-05-23 (annotated)
- Committer:
- MrAI
- Date:
- Wed May 23 02:40:40 2018 +0000
- Revision:
- 14:59412fcf8fa2
- Parent:
- 12:1b24ea479a59
??????
Who changed what in which revision?
User | Revision | Line number | New 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); |
MrAI | 12:1b24ea479a59 | 45 | |
MrAI | 12:1b24ea479a59 | 46 | int http_post_delete(const string & url, const string & content, string & strOut); |
MrAI | 12:1b24ea479a59 | 47 | // GET |
MrAI | 12:1b24ea479a59 | 48 | bool build_get_raw(const string & url, const string & content, string & get_raw); |
MrAI | 12:1b24ea479a59 | 49 | bool build_get_raw(const string & url, const string & host, const string & token, const string & content, string & get_raw); |
MrAI | 12:1b24ea479a59 | 50 | //DELETE |
MrAI | 12:1b24ea479a59 | 51 | bool build_delete_raw(const string & url, const string & content, string & post_raw); |
MrAI | 12:1b24ea479a59 | 52 | bool build_delete_raw(const string & url, const string & host, const string & token, const string & content, string & post_raw); |
MrAI | 12:1b24ea479a59 | 53 | int http_get(const string & url, const string & content, string & strOut); |
MrAI | 12:1b24ea479a59 | 54 | int http_get_raw(const string &strIn, string &strOut); |
MrAI | 14:59412fcf8fa2 | 55 | bool getipbydomain(string& strDomain); |
webmaster | 8:f2a567ee3a46 | 56 | |
webmaster | 8:f2a567ee3a46 | 57 | protected: |
webmaster | 8:f2a567ee3a46 | 58 | private: |
webmaster | 8:f2a567ee3a46 | 59 | int urlIndex; |
webmaster | 8:f2a567ee3a46 | 60 | //list<URL> urls; |
webmaster | 8:f2a567ee3a46 | 61 | std::string accessToken; |
webmaster | 8:f2a567ee3a46 | 62 | //socket httpClient; |
webmaster | 8:f2a567ee3a46 | 63 | std::string json; |
webmaster | 8:f2a567ee3a46 | 64 | std::string version; |
webmaster | 8:f2a567ee3a46 | 65 | |
webmaster | 8:f2a567ee3a46 | 66 | string m_strIP; |
webmaster | 8:f2a567ee3a46 | 67 | short m_sPort; |
webmaster | 8:f2a567ee3a46 | 68 | string m_url; |
webmaster | 8:f2a567ee3a46 | 69 | string m_host; |
webmaster | 8:f2a567ee3a46 | 70 | string m_token; |
webmaster | 8:f2a567ee3a46 | 71 | |
webmaster | 8:f2a567ee3a46 | 72 | |
webmaster | 8:f2a567ee3a46 | 73 | }; |
webmaster | 8:f2a567ee3a46 | 74 | |
webmaster | 8:f2a567ee3a46 | 75 | #endif |