Fix result code translations from COAP to CA.
authorMandeep Shetty <mandeep.shetty@intel.com>
Fri, 13 Mar 2015 21:02:44 +0000 (14:02 -0700)
committerSudarshan Prasad <sudarshan.prasad@intel.com>
Mon, 16 Mar 2015 16:14:50 +0000 (16:14 +0000)
Temp fix with  macros to convert COAP codes to CA code.

Change-Id: I3bb759c63dafcfcc5a491133577c75240d63affe
Signed-off-by: Mandeep Shetty <mandeep.shetty@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/475
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Sashi Penta <sashi.kumar.penta@intel.com>
Reviewed-by: Sudarshan Prasad <sudarshan.prasad@intel.com>
resource/csdk/connectivity/inc/caprotocolmessage.h
resource/csdk/connectivity/src/caprotocolmessage.c

index 1e992cd..e49268a 100644 (file)
@@ -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.
index 3b6ad56..07ef6fd 100644 (file)
@@ -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