![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
二期c++接口
Dependencies: EthernetInterface mbed-rtos mbed uniqueCPUID
Fork of bcsdk by
Order.cpp@12:1b24ea479a59, 2018-05-16 (annotated)
- Committer:
- MrAI
- Date:
- Wed May 16 13:46:01 2018 +0000
- Revision:
- 12:1b24ea479a59
??14???
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MrAI | 12:1b24ea479a59 | 1 | #include "Order.h" |
MrAI | 12:1b24ea479a59 | 2 | bool Order::SetJsonBody(MbedJSONValue& out, string secretIn, string typeIn, string currencypayIn, string cntpartypayIn, string valuepayIn, string currencygetIn, string cntpartygetIn, string valuegetIn) |
MrAI | 12:1b24ea479a59 | 3 | { |
MrAI | 12:1b24ea479a59 | 4 | MbedJSONValue val; |
MrAI | 12:1b24ea479a59 | 5 | val["secret"] = secretIn; |
MrAI | 12:1b24ea479a59 | 6 | val["order"]["type"] = typeIn; |
MrAI | 12:1b24ea479a59 | 7 | val["order"]["taker_pays"]["currency"] = currencypayIn; |
MrAI | 12:1b24ea479a59 | 8 | val["order"]["taker_pays"]["counterparty"] = cntpartypayIn; |
MrAI | 12:1b24ea479a59 | 9 | val["order"]["taker_pays"]["value"] = valuepayIn; |
MrAI | 12:1b24ea479a59 | 10 | val["order"]["taker_gets"]["currency"] = currencygetIn; |
MrAI | 12:1b24ea479a59 | 11 | val["order"]["taker_gets"]["counterparty"] = cntpartygetIn; |
MrAI | 12:1b24ea479a59 | 12 | val["order"]["taker_gets"]["value"] = valuegetIn; |
MrAI | 12:1b24ea479a59 | 13 | out = val; |
MrAI | 12:1b24ea479a59 | 14 | return true; |
MrAI | 12:1b24ea479a59 | 15 | } |
MrAI | 12:1b24ea479a59 | 16 | |
MrAI | 12:1b24ea479a59 | 17 | string Order::PostOrder(MbedJSONValue& in, string sUrl, string sAddr, string sequence) |
MrAI | 12:1b24ea479a59 | 18 | { |
MrAI | 12:1b24ea479a59 | 19 | string strRep = ""; |
MrAI | 12:1b24ea479a59 | 20 | string strUrl = sUrl + sAddr + sequence; |
MrAI | 12:1b24ea479a59 | 21 | string strJson = in.serialize(); |
MrAI | 12:1b24ea479a59 | 22 | client.http_post_delete(strUrl, strJson, strRep); |
MrAI | 12:1b24ea479a59 | 23 | string content = client.get_content(strRep); |
MrAI | 12:1b24ea479a59 | 24 | return content; |
MrAI | 12:1b24ea479a59 | 25 | } |