hirotakaster / CoAP-simple-library

Other
111 stars 48 forks source link

REQUEST TYPE #38

Open follimatteo opened 1 year ago

follimatteo commented 1 year ago

there is a way to specify a particular request type (GET, POST, PUT) when we ad a callback method with coap.server ?

hirotakaster commented 1 year ago

Hi @follimatteo , You could check the request type at CoapPacket.code . example is like this.

void callback_light(CoapPacket &packet, IPAddress ip, int port) {
  switch (packet.code) {
  case COAP_GET:
    break;
  case COAP_POST:
    break;
  case COAP_PUT:
    break;
  case COAP_DELETE :
    break;
}