![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
二期c++接口
Dependencies: EthernetInterface mbed-rtos mbed uniqueCPUID
Fork of bcsdk by
Client.h@8:f2a567ee3a46, 2017-09-21 (annotated)
- Committer:
- webmaster
- Date:
- Thu Sep 21 02:09:04 2017 +0000
- Revision:
- 8:f2a567ee3a46
- Child:
- 10:aabd720e632c
test create asset;
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 | 8:f2a567ee3a46 | 4 | * Modified: 2017Äê9ÔÂ4ÈÕ 11:08:02 |
webmaster | 8:f2a567ee3a46 | 5 | * Purpose: Declaration of the class Client |
webmaster | 8:f2a567ee3a46 | 6 | * Comment: Client¶ÔÏó°üº¬¶ÔÔ¶³Ì |
webmaster | 8:f2a567ee3a46 | 7 | * APIÖ´ÐÐHTTPÇëÇóËùÐèµÄËùÓÐ |
webmaster | 8:f2a567ee3a46 | 8 | * ÐÅÏ¢¡£ ͨ³££¬Ó¦ÓóÌÐò½«¾ßÓÐÏò |
webmaster | 8:f2a567ee3a46 | 9 | * Á´ºËÐÄ·¢³öÇëÇóµÄ¿Í»§¶ËºÍÏòHSM |
webmaster | 8:f2a567ee3a46 | 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 | 8:f2a567ee3a46 | 41 | |
webmaster | 8:f2a567ee3a46 | 42 | protected: |
webmaster | 8:f2a567ee3a46 | 43 | private: |
webmaster | 8:f2a567ee3a46 | 44 | int urlIndex; |
webmaster | 8:f2a567ee3a46 | 45 | //list<URL> urls; |
webmaster | 8:f2a567ee3a46 | 46 | std::string accessToken; |
webmaster | 8:f2a567ee3a46 | 47 | //socket httpClient; |
webmaster | 8:f2a567ee3a46 | 48 | std::string json; |
webmaster | 8:f2a567ee3a46 | 49 | std::string version; |
webmaster | 8:f2a567ee3a46 | 50 | |
webmaster | 8:f2a567ee3a46 | 51 | string m_strIP; |
webmaster | 8:f2a567ee3a46 | 52 | short m_sPort; |
webmaster | 8:f2a567ee3a46 | 53 | string m_url; |
webmaster | 8:f2a567ee3a46 | 54 | string m_host; |
webmaster | 8:f2a567ee3a46 | 55 | string m_token; |
webmaster | 8:f2a567ee3a46 | 56 | |
webmaster | 8:f2a567ee3a46 | 57 | |
webmaster | 8:f2a567ee3a46 | 58 | }; |
webmaster | 8:f2a567ee3a46 | 59 | |
webmaster | 8:f2a567ee3a46 | 60 | #endif |