How to create the COAP error message in contiki cooja simulator?

To create error message in COAP using contiki cooja . If the requested URLs is not available or to restrict unauthorized access.

+ Description

To create error message in COAP using contiki cooja . If the requested URLs is not available or to restrict unauthorized access.

  • Step 1: er-coap.c
    The file handling server receives data function
    static int coap_receive(void)
    erbium_status_code = NO_ERROR;//initialization
    erbium_status_code=coap_parse_message(message,uip_appdata, uip_datalen());
    //for example error messages
    if(erbium_status_code == NO_ERROR)
    erbium_status_code = NOT_IMPLEMENTED_5_01;
    coap_error_message = “NoBlock1Support”;
    erbium_status_code = PACKET_SERIALIZATION_ERROR;
    erbium_status_code = SERVICE_UNAVAILABLE_5_03;
    coap_error_message = “NoFreeTraBuffer”;
    }

u5a
+ Source code:
  • Step 1: er-coap.c
    The file handling server receives data function
    static int coap_receive(void)
    erbium_status_code = NO_ERROR;//initialization
    erbium_status_code=coap_parse_message(message,uip_appdata, uip_datalen());
    //for example error messages
    if(erbium_status_code == NO_ERROR)
    erbium_status_code = NOT_IMPLEMENTED_5_01;
    coap_error_message = “NoBlock1Support”;
    erbium_status_code = PACKET_SERIALIZATION_ERROR;
    erbium_status_code = SERVICE_UNAVAILABLE_5_03;
    coap_error_message = “NoFreeTraBuffer”;
    }

u5a
Leave Comment

Your email address will not be published. Required fields are marked *

clear formSubmit