BLE Mesh Custom(Vendor) Model creation

A6ESPF
Posts: 28
Joined: Tue Dec 10, 2019 12:16 pm

BLE Mesh Custom(Vendor) Model creation

Postby A6ESPF » Tue Dec 10, 2019 12:23 pm

I'm trying to make my custom BLE Mesh model that I'm going to use to send custom messages across the BLE Mesh network.
However, I'm not sure I'm on the right path. I've started making the model from scratch, copying the Generic OnOff model files and modifying them. I've also seen there is a fast provisioning vendor model included in the examples, but I'm not sure how I can utilize it to send my custom messages.
Could someone please guide me through this process?

Wangcheng
Posts: 73
Joined: Wed Mar 06, 2019 3:26 am

Re: BLE Mesh Custom(Vendor) Model creation

Postby Wangcheng » Fri Jan 10, 2020 8:04 am

A6ESPF wrote:
Tue Dec 10, 2019 12:23 pm
I'm trying to make my custom BLE Mesh model that I'm going to use to send custom messages across the BLE Mesh network.
However, I'm not sure I'm on the right path. I've started making the model from scratch, copying the Generic OnOff model files and modifying them. I've also seen there is a fast provisioning vendor model included in the examples, but I'm not sure how I can utilize it to send my custom messages.
Could someone please guide me through this process?
The attachment contains the usage of the vendor model, which may help you.
Attachments
ble_mesh_demo_main.c
(17.35 KiB) Downloaded 608 times
ble_mesh_client_model_main.c
(20.29 KiB) Downloaded 583 times

xiaoyao
Posts: 18
Joined: Wed Apr 10, 2019 9:04 am

Re: BLE Mesh Custom(Vendor) Model creation

Postby xiaoyao » Wed Jan 15, 2020 7:32 am

Hi,
I downloaded and used them to create my vendor model. And I used nrf Mesh APP to provision,there is something wrong.when I want to set publication ,it show "invalid publish parameters".I have tried to solve it, and I test the example ble_mesh_fast_prov_server,it show the same error.I have found the code about it

Code: Select all

static esp_ble_mesh_model_t vnd_models[] = {
	ESP_BLE_MESH_VENDOR_MODEL(CID_ESP, ESP_BLE_MESH_VND_MODEL_ID_FAST_PROV_CLI,
    fast_prov_cli_op, NULL, &fast_prov_client),
    ESP_BLE_MESH_VENDOR_MODEL(CID_ESP, ESP_BLE_MESH_VND_MODEL_ID_FAST_PROV_SRV,
    fast_prov_srv_op, NULL, &fast_prov_server),    
};

Code: Select all

#define ESP_BLE_MESH_VENDOR_MODEL(_company, _id, _op, _pub, _user_data) \
{                                                                       \
    .vnd.company_id = (_company),                                       \
    .vnd.model_id = (_id),                                              \
    .op = _op,                                                          \
    .pub = _pub,                                                        \
    .keys = { [0 ... (CONFIG_BLE_MESH_MODEL_KEY_COUNT - 1)] =           \
            ESP_BLE_MESH_KEY_UNUSED },                                  \
    .groups = { [0 ... (CONFIG_BLE_MESH_MODEL_GROUP_COUNT - 1)] =       \
            ESP_BLE_MESH_ADDR_UNASSIGNED },                             \
    .user_data = _user_data,                                            \
}
the pub is NULL. I don't know if it is.by the way ,I am working on the vendor model communication of project between esp32 mesh and Nordic mesh .

Wangcheng
Posts: 73
Joined: Wed Mar 06, 2019 3:26 am

Re: BLE Mesh Custom(Vendor) Model creation

Postby Wangcheng » Wed Jan 15, 2020 9:07 am

A6ESPF wrote:
Tue Dec 10, 2019 12:23 pm
I'm trying to make my custom BLE Mesh model that I'm going to use to send custom messages across the BLE Mesh network.
However, I'm not sure I'm on the right path. I've started making the model from scratch, copying the Generic OnOff model files and modifying them. I've also seen there is a fast provisioning vendor model included in the examples, but I'm not sure how I can utilize it to send my custom messages.
Could someone please guide me through this process?
Note: the pub is NULL. nrf app cannot configure the publish address for node, you need to initialize the structure to make it not null.

* You flash ble_mesh_node (onoff_server) and ble_mesh_client_model(onoff_client) project to different devices.
* You should use the nRF Mesh App(V1.1.0).Configure two devices to access the network.And bind the appkey to the vender model.
* Check if the vender model is bound to appkey.Establish a serial port connection with node that flash ble_mesh_client_model ((onoff_client))project.The pin define in borad.h.
* Then You should use the serial port to input address of another node. Example:input 5 ,Then Node will send messge to the node that unicast address is 0x5.

xiaoyao
Posts: 18
Joined: Wed Apr 10, 2019 9:04 am

Re: BLE Mesh Custom(Vendor) Model creation

Postby xiaoyao » Thu Jan 16, 2020 6:04 am

Hi,
I use the newest nrf Mesh APP(v2.2.1).I think I have done it.But I don't know why. I just write something data into the pub parameter.

Code: Select all

uint8_t pub_demo[64] = "123456";
static esp_ble_mesh_model_t vnd_models[] = {
	ESP_BLE_MESH_VENDOR_MODEL(CID_ESP, ESP_BLE_MESH_VND_MODEL_ID_FAST_PROV_CLI,
    fast_prov_cli_op, pub_demo, &fast_prov_client),
    ESP_BLE_MESH_VENDOR_MODEL(CID_ESP, ESP_BLE_MESH_VND_MODEL_ID_FAST_PROV_SRV,
    fast_prov_srv_op, pub_demo, &fast_prov_server),    
};
I test some data and find if the pub is not NULL,it is OK.But it can not send message and receive message.

Wangcheng
Posts: 73
Joined: Wed Mar 06, 2019 3:26 am

Re: BLE Mesh Custom(Vendor) Model creation

Postby Wangcheng » Thu Jan 16, 2020 7:31 am

xiaoyao wrote:
Thu Jan 16, 2020 6:04 am
Hi,
I use the newest nrf Mesh APP(v2.2.1).I think I have done it.But I don't know why. I just write something data into the pub parameter.

Code: Select all

uint8_t pub_demo[64] = "123456";
static esp_ble_mesh_model_t vnd_models[] = {
	ESP_BLE_MESH_VENDOR_MODEL(CID_ESP, ESP_BLE_MESH_VND_MODEL_ID_FAST_PROV_CLI,
    fast_prov_cli_op, pub_demo, &fast_prov_client),
    ESP_BLE_MESH_VENDOR_MODEL(CID_ESP, ESP_BLE_MESH_VND_MODEL_ID_FAST_PROV_SRV,
    fast_prov_srv_op, pub_demo, &fast_prov_server),    
};
I test some data and find if the pub is not NULL,it is OK.But it can not send message and receive message.


//vender server model define
/* Fast Prov Model ID */
#define ESP_BLE_MESH_VND_MODEL_ID_FAST_PROV_CLI 0x0000
#define ESP_BLE_MESH_VND_MODEL_ID_FAST_PROV_SRV 0x0001

/* Fast Prov Message Opcode */
#define ESP_BLE_MESH_VND_MODEL_OP_FAST_PROV_INFO_SET ESP_BLE_MESH_MODEL_OP_3(0x00, CID_ESP)
#define ESP_BLE_MESH_VND_MODEL_OP_FAST_PROV_INFO_STATUS ESP_BLE_MESH_MODEL_OP_3(0x01, CID_ESP)

static esp_ble_mesh_model_op_t fast_prov_srv_op[] = {
{ ESP_BLE_MESH_VND_MODEL_OP_FAST_PROV_INFO_SET, 3, NULL },
ESP_BLE_MESH_MODEL_OP_END,
};

ESP_BLE_MESH_MODEL_PUB_DEFINE(vnd_pub, 2 + 3, ROLE_NODE);
static esp_ble_mesh_model_t vnd_models[] = {
ESP_BLE_MESH_VENDOR_MODEL(CID_ESP, ESP_BLE_MESH_VND_MODEL_ID_FAST_PROV_SRV,
fast_prov_srv_op, &vnd_pub, NULL),
};

Who is online

Users browsing this forum: radurotaru19, snehapawar# and 109 guests