BLE QUESTION: How can I add more advertised GATT services to a BLE mesh node?

lukecam95
Posts: 14
Joined: Thu Sep 23, 2021 9:37 am

BLE QUESTION: How can I add more advertised GATT services to a BLE mesh node?

Postby lukecam95 » Sat Jan 14, 2023 6:06 pm

Hi,

I am currently writing a mobile application with Capacitor framework and I need the app and a node in a ESP-BLE mesh to share data. To do this, I have the idea of creating 2 GATT services on the BLE mesh node; 1 for receiving another 1 for transmitting.

When I scan the BLE node using the app, I see that it has 1 service used for the mesh advertising. How can I add another custom GATT service?

Thank you for your time.

ujurmsde
Posts: 38
Joined: Tue Jan 19, 2021 6:37 am

Re: BLE QUESTION: How can I add more advertised GATT services to a BLE mesh node?

Postby ujurmsde » Sun Jan 15, 2023 4:50 pm

I do not know about which BLE framework, lets say esp's own(bluedroid) or NimBLE port for ESP32 you are using.?

But Nimble also supports mesh network. For that you need to define a struct containing services and characteristics. Then you should have callbacks for those BLE GATT/GAP events. This is the normal flow...

Example....

Code: Select all

static const struct ble_gatt_svc_def gatt_svr_svcs[] = {
    {
        .type = BLE_GATT_SVC_TYPE_PRIMARY,
        .uuid = &gatt_server_service_uuid.u,
        .characteristics = (struct ble_gatt_chr_def[]){ {
        
        .uuid = &gatt_server_f_characteristic_uuid.u,
        .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ,
        .access_cb = gatt_callback
        //.val_handle = &gatt_svr_chr_val_handle,       
    
    },  {
        .uuid = &gatt_server_s_characteristic_uuid.u,
        .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ,
        .access_cb = gatt_callback
        //.val_handle = &gatt_svr_chr_val_handle,    
    }, {
        .uuid = &gatt_server_t_characteristic_uuid.u,
        .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ,
        .access_cb = gatt_callback
        //.val_handle = &gatt_svr_chr_val_handle,
        
    },  {
    0,
    },
    }
    },
    {
    0,
    },
};

lukecam95
Posts: 14
Joined: Thu Sep 23, 2021 9:37 am

Re: BLE QUESTION: How can I add more advertised GATT services to a BLE mesh node?

Postby lukecam95 » Sun Jan 15, 2023 5:07 pm

Thanks for the reply.

I am using the ESP-BLE-MESH library with NimBLE stack.

The confusing part for me is how to register those GATT services when setting the ESP32 as a BLE Mesh node since the initialization of the GATT server and registering of services is handled internally by the BLE-MESH library code. Hence, I do not have a pointer to the GATT server to register custom services.

Who is online

Users browsing this forum: No registered users and 144 guests