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

Custom service discovery on iOS

Hi,

I searched here for a while and I couldn't find the answer. I implemented custom service by referencing nAN-36 and the github code. For some reasons, the github code didn't work for me. So ported the code to the example project able_app_proximity. I got everything working as I wanted with Master Control Pannel. However, I can not discover my custom service when I do peripheral.discoverServices(nil) in iOS or in light blue app. I can only discover these 4 service (shown as uuid) 1804, 1802, 1803, Battery.

 static void advertising_init(uint8_t adv_flags)
 {
      uint32_t      err_code;
      ble_advdata_t advdata;
      ble_advdata_t scanrsp;

      ble_uuid_t adv_uuids[] =
      {
          {LBS_UUID_SERVICE,                 m_lbs.uuid_type}
      };

      m_advertising_mode = BLE_NO_ADV;

      // Build and set advertising data
      memset(&advdata, 0, sizeof(advdata));

      advdata.name_type               = BLE_ADVDATA_FULL_NAME;
      advdata.include_appearance      = true;
      advdata.flags                   = adv_flags;

      memset(&scanrsp, 0, sizeof(scanrsp));
      scanrsp.uuids_complete.uuid_cnt = sizeof(adv_uuids) / sizeof(adv_uuids[0]);
      scanrsp.uuids_complete.p_uuids  = adv_uuids;

      err_code = ble_advdata_set(&advdata, &scanrsp);
      APP_ERROR_CHECK(err_code);
 }

I assume I am missing something in advertising. So I put my advertising_init in main.c here. Is there anyone knows how to discover custom service in iOS? Another question is how do I get rid of those default services like 1804, 1802, 1803, Battery since I am not using it anyway?

Thanks.

Parents Reply Children
No Data
Related