From: Mandeep Shetty Date: Fri, 13 Mar 2015 21:02:44 +0000 (-0700) Subject: Fix result code translations from COAP to CA. X-Git-Tag: 1.2.0+RC1~1855^2~110 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=45676e721e9954db2dafbe78c79c284d83c48f0f;p=platform%2Fupstream%2Fiotivity.git Fix result code translations from COAP to CA. Temp fix with macros to convert COAP codes to CA code. Change-Id: I3bb759c63dafcfcc5a491133577c75240d63affe Signed-off-by: Mandeep Shetty Reviewed-on: https://gerrit.iotivity.org/gerrit/475 Tested-by: jenkins-iotivity Reviewed-by: Sashi Penta Reviewed-by: Sudarshan Prasad --- diff --git a/resource/csdk/connectivity/inc/caprotocolmessage.h b/resource/csdk/connectivity/inc/caprotocolmessage.h index 1e992cdcb..e49268a40 100644 --- a/resource/csdk/connectivity/inc/caprotocolmessage.h +++ b/resource/csdk/connectivity/inc/caprotocolmessage.h @@ -38,6 +38,8 @@ extern "C" #endif typedef uint32_t code_t; +#define CA_RESPONSE_CLASS(C) (((C) >> 5)*100) +#define CA_RESPONSE_CODE(C) (CA_RESPONSE_CLASS(C) + (C - COAP_RESPONSE_CODE(CA_RESPONSE_CLASS(C)))) /** * @brief generates pdu structure from the given information. diff --git a/resource/csdk/connectivity/src/caprotocolmessage.c b/resource/csdk/connectivity/src/caprotocolmessage.c index 3b6ad56e7..07ef6fd32 100644 --- a/resource/csdk/connectivity/src/caprotocolmessage.c +++ b/resource/csdk/connectivity/src/caprotocolmessage.c @@ -402,7 +402,7 @@ void CAGetInfoFromPDU(const coap_pdu_t *pdu, uint32_t *outCode, CAInfo_t *outInf // set code if (outCode) { - (*outCode) = (uint32_t) pdu->hdr->code; + (*outCode) = (uint32_t) CA_RESPONSE_CODE(pdu->hdr->code); } // init HeaderOption list