ESP_OK on success or error code otherwise.
Before calling this function, the user needs to ensure that the model publication message (
esp_ble_mesh_model_pub_t
.msg) contains a valid message to be sent. And if users want to update the publishing message, this API should be called in ESP_BLE_MESH_MODEL_PUBLISH_UPDATE_EVT with the message updated.