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 1e992cdcb625cabe7e839b7c98860f31217148f8..e49268a40b914f8506af8257fea6eb4bcc8ecf76 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 3b6ad56e7d1f293c61ed5f6974afcf4f0fa0d4ca..07ef6fd3247e0877dccfcfa30da66b8535262ea8 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