terence zhang / Mbed OS mbed-os-example-wakaama

Dependencies:   C12832 LM75B

Revision:
11:1fadb70654a6
Parent:
10:df97539c6ddd
Child:
12:cc4b0014fc3a
--- a/wakaama/liblwm2m.h	Wed May 03 18:24:09 2017 +0800
+++ b/wakaama/liblwm2m.h	Wed May 03 19:00:24 2017 +0800
@@ -56,7 +56,6 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-#define MBED_OS_EXAMPLE_WAKAAMA
 
 #include <stdint.h>
 #include <stddef.h>
@@ -64,10 +63,15 @@
 #include <time.h>
 
 
-//////////////////////////////////////////////////
+#define MBED_OS_EXAMPLE_WAKAAMA
+
 #ifdef MBED_OS_EXAMPLE_WAKAAMA
 #include <stdlib.h>
 #include <string.h>
+#endif
+
+//////////////////////////////////////////////////
+#ifdef MBED_OS_EXAMPLE_WAKAAMA
 // Global definitions
 #define LWM2M_LITTLE_ENDIAN
 #define LWM2M_CLIENT_MODE
@@ -89,8 +93,6 @@
   int tz_minuteswest;         /*minutes to greenwich time*/
   int tz_dsttime;             /*type of DST correction*/
 };
-
-
 int gettimeofday(struct timeval* t, void* timezone);
 
 #define lwm2m_gettimeofday gettimeofday
@@ -175,13 +177,40 @@
  * Error code
  */
 
+#ifdef MBED_OS_EXAMPLE_WAKAAMA
+//Prefer to use the orignal enum from the coap stack, remove warnings.
+#define COAP_NO_ERROR                   NO_ERROR//(uint8_t)0x00
+#define COAP_IGNORE                     (uint8_t)0x01
+
+#define COAP_201_CREATED                CREATED_2_01//(uint8_t)0x41
+#define COAP_202_DELETED                DELETED_2_02//(uint8_t)0x42
+
+#define COAP_204_CHANGED                CHANGED_2_04//(uint8_t)0x44
+#define COAP_205_CONTENT                CONTENT_2_05//(uint8_t)0x45
+#define COAP_231_CONTINUE               (uint8_t)0x5F
+
+#define COAP_400_BAD_REQUEST            BAD_REQUEST_4_00//(uint8_t)0x80
+#define COAP_401_UNAUTHORIZED           UNAUTHORIZED_4_01//(uint8_t)0x81
+#define COAP_402_BAD_OPTION             BAD_OPTION_4_02//(uint8_t)0x82
+#define COAP_404_NOT_FOUND              NOT_FOUND_4_04//(uint8_t)0x84
+#define COAP_405_METHOD_NOT_ALLOWED     METHOD_NOT_ALLOWED_4_05//(uint8_t)0x85
+#define COAP_406_NOT_ACCEPTABLE         NOT_ACCEPTABLE_4_06//(uint8_t)0x86
+#define COAP_408_REQ_ENTITY_INCOMPLETE  (uint8_t)0x88
+#define COAP_412_PRECONDITION_FAILED    PRECONDITION_FAILED_4_12//(uint8_t)0x8C
+#define COAP_413_ENTITY_TOO_LARGE       REQUEST_ENTITY_TOO_LARGE_4_13//(uint8_t)0x8D
+#define COAP_500_INTERNAL_SERVER_ERROR  INTERNAL_SERVER_ERROR_5_00//(uint8_t)0xA0
+#define COAP_501_NOT_IMPLEMENTED        NOT_IMPLEMENTED_5_01//(uint8_t)0xA1
+#define COAP_503_SERVICE_UNAVAILABLE    SERVICE_UNAVAILABLE_5_03//(uint8_t)0xA3
+#else
 #define COAP_NO_ERROR                   (uint8_t)0x00
 #define COAP_IGNORE                     (uint8_t)0x01
 
 #define COAP_201_CREATED                (uint8_t)0x41
 #define COAP_202_DELETED                (uint8_t)0x42
+
 #define COAP_204_CHANGED                (uint8_t)0x44
 #define COAP_205_CONTENT                (uint8_t)0x45
+
 #define COAP_231_CONTINUE               (uint8_t)0x5F
 #define COAP_400_BAD_REQUEST            (uint8_t)0x80
 #define COAP_401_UNAUTHORIZED           (uint8_t)0x81
@@ -195,6 +224,7 @@
 #define COAP_500_INTERNAL_SERVER_ERROR  (uint8_t)0xA0
 #define COAP_501_NOT_IMPLEMENTED        (uint8_t)0xA1
 #define COAP_503_SERVICE_UNAVAILABLE    (uint8_t)0xA3
+#endif
 
 /*
  * Standard Object IDs