Android Question BLE2 ReadItem fetches all characteristics in a service? [SOLVED]

SimonInCanada

Member
Licensed User
Using Android and BLE2 V1.35 I'm trying to read a single characteristic from a BlueGiga for which I wrote the program using BGScript.

However, each time I issue the query where I specify the service and individual characteristic, it's sending all three characteristics from that service (i.e. using three packets).

The GATT declaration, for the record, is
B4X:
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>

    <service uuid="1800">
      <description>Generic Access Profile</description>

      <characteristic uuid="2a00">
        <properties read="true" const="true" />
        <value>MSL BLE Link</value>
      </characteristic>

      <characteristic uuid="2a01">
      <!-- 2A01: org.bluetooth.characteristic.gap.appearance set to Generic Access -->
        <properties read="true" const="true" />
        <value type="hex">0100</value>
      </characteristic>
    </service>

    <service type="primary" uuid="180A" id="manufacturer">
        <characteristic uuid="2A29">
            <properties read="true" const="true" />
            <value>MSL Oilfield Services Ltd</value>
        </characteristic>
    </service>

    <!-- 07-09-2017 integrated the two cal arrays in with Strain Guage Reading -->
    <!-- 15-12-2017 added TareVal, TareOn and ShuntOn to XCAL -->
    <service uuid="6201be54-f2ba-407c-94aa-78000f71db00" advertise="true">
       <description>Link Strain Guage Reading</description>
       <include id="manufacturer" />
      <characteristic uuid="b864d088-8ba6-4026-87a8-5dd09f59800b" id="xgatt_readings">
          <properties read="true" notify="true" />
          <!-- 18 bytes 0-2 ADC: 3-5 Peak: 6-8 Offs: 9-10 Battery: 11-15 Temp: 16 RSSI: 17 ErrCode -->
          <value type="hex">000000000000000000000000000000000000</value>
      </characteristic>
        <characteristic uuid="b0fa7d86-3c5f-410e-8ebd-08fb6798bba9" id="xgatt_cal">
          <properties read="true" write="true" notify="true" />
          <!-- 20 Bytes 0-2 Cal0 (Z): 3-5 Cal1 (20%): 6-8 Cal2 (40%): 9-11 Cal3 (60%): 12-14 Cal4 (80%): 15-17 Cal5 (100%): 18 SaampRate: 19: ErrCode -->
          <value type="hex">0000000000000000000000000000000000000000</value>
      </characteristic>
      <characteristic uuid="394de3d8-cc6b-47ca-8270-6543d8b16089" id="xgatt_xcal">
          <properties read="true" write="true" notify="true" />
          <!-- 16 Bytes 0-1 WLL in t.t: 2-3 Alarm Level t.t: 4-6 SerialNo: 7-9 CalDate: 10-12 TareADC: 13 TareOn: 14 ShuntOn: 15 ErrCode -->
          <value type="hex">00000000000000000000000000000000</value>
        </characteristic>
    </service>

</configuration>

The call I am making from my main module results in
B4X:
Starter.ReadItem(6201be54-f2ba-407c-94aa-78000f71db00,b864d088-8ba6-4026-87a8-5dd09f59800b)

But I susbsequently receive these characteristics:
B4X:
CCI:b864d088-8ba6-4026-87a8-5dd09f59800b len:18
then
CCI:b0fa7d86-3c5f-410e-8ebd-08fb6798bba9 len:20
then
CCI:394de3d8-cc6b-47ca-8270-6543d8b16089 len:16

Nothing else is causing any messages. The receiving part is agnostic to whether we have sent a request or not so I'm not missing messages, i.e. it seems that the response of three characteristics can only be due to that single request.

Does anyone have any ideas?

TIA Simon
 

SimonInCanada

Member
Licensed User
It sends a read request for the specific characteristic.
The DataAvailable event is raised with all characteristics. So the data that you see for other characteristics might not be updated.

Thank you, Erel

Is that just something that you knew due to experience using BLE or did you check out some souce code? If it's source code, how could I have accessed it as there are quite a few details of BLE that are not really explained in the BLE module's documentation?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…