8 Replies Latest reply on Dec 26, 2014 7:56 AM by VictorZ_46

    Problem with HIGH_UNDIRECTED_DISCOVERABLE

      I am trying to add custom advertisement data in hello_client.

      This is the code I am adding in void hello_client_create(void) function (copied from hello_sensor):

       

          // Read value of the service from GATT DB.

          bleprofile_ReadHandle(HANDLE_HELLO_SENSOR_SERVICE_UUID, &db_pdu);

          ble_tracen((char *)db_pdu.pdu, db_pdu.len);

       

          if (db_pdu.len != 16)

          {

              ble_trace1("bad service UUID len: %d\n", db_pdu.len);

          }

          else

          {

          // total length should be less than 31 bytes

          BLE_ADV_FIELD adv[3];

              // flags

              adv[0].len     = 1 + 1;

              adv[0].val     = ADV_FLAGS;

              adv[0].data[0] = LE_LIMITED_DISCOVERABLE | BR_EDR_NOT_SUPPORTED;

       

              adv[1].len     = 16 + 1;

              adv[1].val     = ADV_SERVICE_UUID128_COMP;

              memcpy(adv[1].data, db_pdu.pdu, 16);

       

              // name

              adv[2].len      = strlen(bleprofile_p_cfg->local_name) + 1;

              adv[2].val      = ADV_LOCAL_NAME_COMP;

              memcpy(adv[2].data, bleprofile_p_cfg->local_name, adv[2].len - 1);

              bleprofile_GenerateADVData(adv, 3);

          }

       

      At this point discoverable is turned on with:

          // need to do adverts to enable slave connections

          bleprofile_Discoverable(HIGH_UNDIRECTED_DISCOVERABLE, NULL);

       

      What I noticed is that device is not discoverable for the first 30 seconds (high_undirect_adv_duration) until bleprofile_GetDiscoverable() reports:

      LOW_UNDIRECTED_DISCOVERABLE

       

      Can you tell me why it cannot start from HIGH_UNDIRECTED_DISCOVERABLE ?

       

       

      I am attaching modified hello_client.