Chapter 2. API Reference
Client Side Implementation
The client side implementation will have establish a protocomm session with the device first, over the supported mode
of transport, and then send and receive protobuf messages understood by the esp_local_ctrl service. The service will
translate these messages into requests and then call the appropriate handlers (set / get). Then, the generated response
for each handler is again packed into a protobuf message and transmitted back to the client.
See below the various protobuf messages understood by the esp_local_ctrl service:
1. get_prop_count : This should simply return the total number of properties supported by the service
2. get_prop_values : This accepts an array of indices and should return the information (name, type, flags) and
values of the properties corresponding to those indices
3. set_prop_values : This accepts an array of indices and an array of new values, which are used for setting the
values of the properties corresponding to the indices
Note that indices may or may not be the same for a property, across multiple sessions. Therefore, the client must
only use the names of the properties to uniquely identify them. So, every time a new session is established, the client
should first call get_prop_count and then get_prop_values, hence form an index to name mapping for all properties.
Now when calling set_prop_values for a set of properties, it must first convert the names to indexes, using the created
mapping. As emphasized earlier, the client must refresh the index to name mapping every time a new session is
established with the same device.
The various protocomm endpoints provided by esp_local_ctrl are listed below:
Table 6: Endpoints provided by ESP Local Control
Endpoint
Name
(BLE +
GATT
Server)
URI (HTTPS Server +
mDNS)
Description
esp_local_ctrl/versionhttps://<mdns-
hostname>.local/esp_local_ctrl/version
Endpoint used for retrieving version string
esp_local_ctrl/controlhttps://<mdns-
hostname>.local/esp_local_ctrl/control
Endpoint used for sending / receiving control messages
API Reference
Header File
• components/esp_local_ctrl/include/esp_local_ctrl.h
Functions
const esp_local_ctrl_transport_t *esp_local_ctrl_get_transport_ble(void)
Function for obtaining BLE transport mode.
const esp_local_ctrl_transport_t *esp_local_ctrl_get_transport_httpd(void)
Function for obtaining HTTPD transport mode.
esp_err_t esp_local_ctrl_start(const esp_local_ctrl_config_t *config)
Start local control service.
Return
• ESP_OK : Success
• ESP_FAIL : Failure
Parameters
• [in] config: Pointer to configuration structure
esp_err_t esp_local_ctrl_stop(void)
Stop local control service.
Espressif Systems 603
Submit Document Feedback
Release v4.4