{"ArrivalDate":"预计04月20日送达","ArrivalDatePromise":"(原预计04月20日送达)","CouponAmount":"0","CouponAmountLiQuan":"0","CouponId":"","CustCreditUsed":"0.00","errorCode":"0","ExpectedDeliveryTime":"2016-4-20 15:37:46","InvoiceCategory":"0","InvoiceContent":"","InvoiceTitle":"","ObtainTotalPoints":"0","order_type":"0","OrderCreationDate":"2016-04-19 15:41:12","OrderId":"33634157908","OrderInvoiceInfo":"","OrderSendDate":"","OrderStatus":"等待到款","OrderStatusCode":"0","parent_id":"33634157908","PayType":"网上支付","PayTypeName":"网上支付","PointDeductionAmount":"0.00","ProductTotal":"168.00","rcv_zip":"300000","ReceiverAddress":"中国,天津,天津市,河西区,石宏东路8号","ReceiverFixTel":"","ReceiverMobilePhone":"18888888888","ReceiverName":"李生","ReceiverTel":"18888888888","SendCompany":"","SendCompanyTel":"","SendPackageCode":"","ShippingFee":"0.00","ShipType":"普通快递送货上门,时间不限","ShopName":"当当网","ShopType":"0","TotalActivityFee":"0.00","TotalBarginPrice":"168.00","Warehouse":"北京百货","products":[{"bargin_price":"168.00","dangdang_price":"336.00","gift_product_id":"0","gift_product_name":"","gift_quantity":"1","gift_sale_price":"0.00","product_id":"60617961","product_points":"","ProductName":"[当当自营] 意大利进口 Ferrero 费列罗 榛果威化巧克力 婚庆装 96粒","promotion_type":"102","Quantity":"1","gift_list":[],"img_url":"http:\/\/img3x1.ddimg.cn\/63\/10\/60617961-1_m_2.jpg"}],"shoplink":"暂无商家联系方式","InvoiceCategoryMsg":"","promo_model":[],"route_info":[{"desc":"提交订单","time_point":"2016-4-19 15:41:12","time_bucket":""},{"desc":"网上支付","time_point":"","time_bucket":"0-1小时"},{"desc":"款项到达","time_point":"","time_bucket":"0-1小时"},{"desc":"订单审核通过","time_point":"","time_bucket":"0-1天"},{"desc":"北京百货发货","time_point":"","time_bucket":"0-1天"},{"desc":"收货并确认","time_point":"","time_bucket":null}],"payable":"168.00","shop_id":"0","collect_promotion_type":[],"shop_promotion_type":"","CouponTitle":"礼品卡","payment_id":"9543493854","order_info":"33634157908,168.00","PayOrNot":1,"isConfirm":0,"isOverSeaOrder":false,"overSeaorderTax":false}
static const char hex_table_uc[16] = { '0', '1', '2', '3',
'4', '5', '6', '7',
'8', '9', 'A', 'B',
'C', 'D', 'E', 'F' };
static const char hex_table_lc[16] = { '0', '1', '2', '3',
'4', '5', '6', '7',
'8', '9', 'a', 'b',
'c', 'd', 'e', 'f' };
char *encodeToHex(char *buff, const uint8_t *src, int len, int type) {
int i;
const char *hex_table = type ? hex_table_lc : hex_table_uc;
for(i = 0; i < len; i++) {
buff[i * 2] = hex_table[src[i] >> 4];
buff[i * 2 + 1] = hex_table[src[i] & 0xF];
}
buff[2 * len] = '\0';
return buff;
}
uint8_t *decodeFromHex(uint8_t *data, const char *src, int len) {
size_t outLen = len / 2;
uint8_t *out = data;
uint8_t accum = 0;
for (size_t i = 0; i < len; ++i) {
char c = src[i];
unsigned value;
if (c >= '0' && c <= '9') {
value = c - '0';
} else if (c >= 'a' && c <= 'f') {
value = c - 'a' + 10;
} else if (c >= 'A' && c <= 'F') {
value = c - 'A' + 10;
} else {
return NULL;
}
accum = (accum << 4) | value;
if (i & 1) {
*out++ = accum;
accum = 0;
}
}
return data;
}