Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f32f8cb9 authored by Hemant Gupta's avatar Hemant Gupta Committed by android-build-merger
Browse files

GATT: Fix usage of 16 and 32 bit UUID's in Discover services by UUID

am: f56395dd

Change-Id: I7f2ac1a2f2af399cb61d878f95c99c3bf5684590
parents 6816cb30 f56395dd
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -107,10 +107,14 @@ void gatt_act_discovery(tGATT_CLCB* p_clcb) {

    size_t size = p_clcb->uuid.GetShortestRepresentationSize();
    cl_req.find_type_value.value_len = size;
    if (size == Uuid::kNumBytes32) {
    if (size == Uuid::kNumBytes16) {
      uint8_t* p = cl_req.find_type_value.value;
      UINT16_TO_STREAM(p, p_clcb->uuid.As16Bit());
    } else if (size == Uuid::kNumBytes32) {
      /* if service type is 32 bits UUID, convert it now */
      memcpy(cl_req.find_type_value.value, p_clcb->uuid.To128BitLE().data(),
            Uuid::kNumBytes128);
      cl_req.find_type_value.value_len = Uuid::kNumBytes128;
    } else
      memcpy(cl_req.find_type_value.value, p_clcb->uuid.To128BitLE().data(),
             size);