Battery Service Notification

Hi, I am using a NCS v2.6.0.I created a custom zephyr project. Implemented custom ble service and added BLE DIS and BAS services from source. 3 out of 2 services working properly but in the battery service notification is not enable automatically. so I am not able to send battery percentage to client( Mobile). previously I'm working in nrf5 sdk in that code it is working properly.

In nrf connect app I enable notification manually. but I am using custom android application.I want to Implement features like if device connected with application battery percentage should be display in application.


how notifications are enable in zephyr??


For this Issue I have been checked below topics.

  • compared nrf5 sdk vs nrf connect sdk battery service
  • checked cccd value in bas service
  • CONFIG_BT_GATT_ENFORCE_SUBSCRIPTION=y
    service configuration.
    BT_GATT_SERVICE_DEFINE(bas,
    BT_GATT_PRIMARY_SERVICE(BT_UUID_BAS),
    BT_GATT_CHARACTERISTIC(BT_UUID_BAS_BATTERY_LEVEL,
    BT_GATT_CHRC_READ | BT_GATT_CHRC_NOTIFY,
    BT_GATT_PERM_READ,read_blvl,NULL,
    &battery_level),
    BT_GATT_CCC(blvl_ccc_cfg_changed,
    BT_GATT_PERM_READ | BT_GATT_PERM_WRITE),

    Is there any another issue?
Related