Skip to content

serviceChanged() recommended workflow? #401

Description

@chmorgan

I'm working on a BLE device that has changed characteristics over time. Ran into an odd offset issue with iOS where one characteristic was showing up when another was read and in running it down found out about ble_svc_gatt_changed(), characteristic 0x2A05 etc.

My understanding is that if there is a change to the service that I should call ble_svc_gatt_changed() to inform the stack that all bonded peers need to rescan when they connect in the future. It looks like this functionality is exposed via serviceChanged().

Is there a flow you'd recommend in this use case? Let me throw out my straw man so we have something to discuss against. Perhaps this could become a PR for a doc addition as I don't find any mention of serviceChanged() or ble_svc_gatt_changed() anywhere except in the code.

NimBLEDevice::init();
auto pServer = NimBLEDevice::createServer();
auto pService = pServer->createService(serviceUUID);
// add characteristics
pService->start();

// determine if service has changed
auto getHash = pService->getHash(); // this doesn't appear to exist
if(getHash != nvs_get_hash())
{
    pService->serviceChanged();
   nvs_set_hash();
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions