This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Service Changed Characteristic not enabled on iOS

Hi,

My current project make use of pairing/bonding and at certain times I change the attribute table. To notify the central device about this change I have added the Service Changed Characteristic. It works good on Android after enabling notifications from the characteristic. However on iOS I cannot see the Service Changed Characteristic (iOS filter these out according to their guidelines), and I always receive error: NRF_ERROR_INVALID_STATE when I try to send I notification to an iOS device. I  seems like iOS is not enabling notifications on the Service Changed characteristic.

Is there something more to be done in order to make iOS enable notification for the Service Changed Characteristic?

I send the notification from the BLE_GAP_EVT_CONN_SEC_UPDATE event:

        err_code = sd_ble_gatts_service_changed(
            p_ble_evt->evt.gap_evt.conn_handle,
            system_service_get_service_handle(),
            0xFFFF
        );

        if (err_code != NRF_SUCCESS)
        {
            NRF_LOG_INFO("Failed to send service changed indication!, err_code: %d", err_code);
        }

Edit:

After pairing I can send a Service Changed Notification. When the device eventually get disconnected after pairing/bonding I reconnect and after that the nRF52832 can no longer send Service Changed Notifications (NRF_ERROR_INVALID_STATE). Do I need to restore the CCCDs or what is happening here?

Related