Chapter 2. API Reference
information. The function will check if characteristic defined as a cid parameter is supported and returns its
description in param_info. Returns ESP_ERR_NOT_FOUND if characteristic is not supported.
Return
• esp_err_t ESP_OK - request was successful and buffer contains the supported characteristic name
• esp_err_t ESP_ERR_INVALID_ARG - invalid argument of function
• esp_err_t ESP_ERR_NOT_FOUND - the characteristic (cid) not found
• esp_err_t ESP_FAIL - unknown error during lookup table processing
Parameters
• [in] cid: characteristic id
• param_info: pointer to pointer of characteristic data.
esp_err_t
mbc_master_get_parameter(uint16_t cid, char *name, uint8_t *value, uint8_t *type)
Read parameter from modbus slave device whose name is defined by name and has cid. The additional data
for request is taken from parameter description (lookup) table.
Return
• esp_err_t ESP_OK - request was successful and value buffer contains representation of actual pa-
rameter data from slave
• esp_err_t ESP_ERR_INVALID_ARG - invalid argument of function or parameter descriptor
• esp_err_t ESP_ERR_INVALID_RESPONSE - an invalid response from slave
• esp_err_t ESP_ERR_INVALID_STATE - invalid state during data processing or allocation failure
• esp_err_t ESP_ERR_TIMEOUT - operation timed out and no response from slave
• esp_err_t ESP_ERR_NOT_SUPPORTED - the request command is not supported by slave
• esp_err_t ESP_ERR_NOT_FOUND - the parameter is not found in the parameter description table
• esp_err_t ESP_FAIL - slave returned an exception or other failure
Parameters
• [in] cid: id of the characteristic for parameter
• [in] name: pointer into string name (key) of parameter (null terminated)
• [out] value: pointer to data buffer of parameter
• [out] type: parameter type associated with the name returned from parameter description table.
esp_err_t
mbc_master_set_parameter(uint16_t cid, char *name, uint8_t *value, uint8_t *type)
Set characteristic's value defined as a name and cid parameter. The additional data for cid parameter request
is taken from master parameter lookup table.
Return
• esp_err_t ESP_OK - request was successful and value was saved in the slave device registers
• esp_err_t ESP_ERR_INVALID_ARG - invalid argument of function or parameter descriptor
• esp_err_t ESP_ERR_INVALID_RESPONSE - an invalid response from slave during processing of
parameter
• esp_err_t ESP_ERR_INVALID_STATE - invalid state during data processing or allocation failure
• esp_err_t ESP_ERR_TIMEOUT - operation timed out and no response from slave
• esp_err_t ESP_ERR_NOT_SUPPORTED - the request command is not supported by slave
• esp_err_t ESP_FAIL - slave returned an exception or other failure
Parameters
• [in] cid: id of the characteristic for parameter
• [in] name: pointer into string name (key) of parameter (null terminated)
• [out] value: pointer to data buffer of parameter (actual representation of json value field in
binary form)
• [out] type: pointer to parameter type associated with the name returned from parameter lookup
table.
Unions
union mb_parameter_opt_t
#include <esp_modbus_master.h> Modbus parameter options for description table.
Espressif Systems
637
Submit Document Feedback
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?