Chapter 2. API Reference
• [in] pc: Pointer to the protocomm instance to be deleted
esp_err_t protocomm_add_endpoint(protocomm_t *pc, const char *ep_name, proto-
comm_req_handler_t h, void *priv_data)
Add endpoint request handler for a protocomm instance.
This API will bind an endpoint handler function to the specified endpoint name, along with any private data
that needs to be pass to the handler at the time of call.
Note
• An endpoint must be bound to a valid protocomm instance, created using protocomm_new().
• This function internally calls the registered add_endpoint() function of the selected transport
which is a member of the protocomm_t instance structure.
Return
• ESP_OK : Success
• ESP_FAIL : Error adding endpoint / Endpoint with this name already exists
• ESP_ERR_NO_MEM : Error allocating endpoint resource
• ESP_ERR_INVALID_ARG : Null instance/name/handler arguments
Parameters
• [in] pc: Pointer to the protocomm instance
• [in] ep_name: Endpoint identifier(name) string
• [in] h: Endpoint handler function
• [in] priv_data: Pointer to private data to be passed as a parameter to the handler function on
call. Pass NULL if not needed.
esp_err_t protocomm_remove_endpoint(protocomm_t *pc, const char *ep_name)
Remove endpoint request handler for a protocomm instance.
This API will remove a registered endpoint handler identified by an endpoint name.
Note
• This function internally calls the registered remove_endpoint() function which is a member
of the protocomm_t instance structure.
Return
• ESP_OK : Success
• ESP_ERR_NOT_FOUND : Endpoint with specified name doesn’t exist
• ESP_ERR_INVALID_ARG : Null instance/name arguments
Parameters
• [in] pc: Pointer to the protocomm instance
• [in] ep_name: Endpoint identifier(name) string
esp_err_t protocomm_open_session(protocomm_t *pc, uint32_t session_id)
Allocates internal resources for new transport session.
Note
• An endpoint must be bound to a valid protocomm instance, created using protocomm_new().
Return
• ESP_OK : Request handled successfully
• ESP_ERR_NO_MEM : Error allocating internal resource
• ESP_ERR_INVALID_ARG : Null instance/name arguments
Parameters
• [in] pc: Pointer to the protocomm instance
• [in] session_id: Unique ID for a communication session
esp_err_t protocomm_close_session(protocomm_t *pc, uint32_t session_id)
Frees internal resources used by a transport session.
Note
• An endpoint must be bound to a valid protocomm instance, created using protocomm_new().
Return
• ESP_OK : Request handled successfully
• ESP_ERR_INVALID_ARG : Null instance/name arguments
Parameters
Espressif Systems 668
Submit Document Feedback
Release v4.4