Skip to content

Latest commit

 

History

History
37 lines (23 loc) · 809 Bytes

README.md

File metadata and controls

37 lines (23 loc) · 809 Bytes

CoAP_app

在ESP8266上运行CoAP Server示例工程。

说明

代码移植于https://github.com/1248/microcoap

移植代码主要部分在udp_server.c文件下的udp_server_recv函数。

CoAP主要处理流程:收到请求buf/len->coap_parse->coap_handle_req->coap_build->生成响应buf/rsplen

endpoint

endpoint在endpoints.c文件

/* endpoints */
const coap_endpoint_t endpoints[] =
{
  {COAP_METHOD_GET, handle_get_well_known_core, &path_well_known_core, "ct=40"},
  {COAP_METHOD_GET, handle_get_light, &path_light, "ct=0"},
  {COAP_METHOD_PUT, handle_put_light, &path_light, NULL},
  {(coap_method_t)0, NULL, NULL, NULL}
};

主要有两个

  1. coap://<IP>/.well-known/core:GET
  2. coap://<IP>/light:GET、PUT

效果图

CoAP