Reading Objects


#1

Hi,

The following is returned from a bluetooth device communicating with my app:

{
  "address": "00:22:D0:3B:32:10",
  "status": "discovered",
  "services": [
    {
      "characteristics": [
        {
          "descriptors": [
 
          ],
          "uuid": "2a00", 
          "properties": {
            "write": true,
            "writeWithoutResponse": true,
            "read": true
          }
        },
        {
          "descriptors": [
 
          ],
          "uuid": "2a01",  
          "properties": {
            "read": true
          }
        },
        {
          "descriptors": [
 
          ],
          "uuid": "2a02",  
          "properties": {
            "read": true
          }
        },
        {
          "descriptors": [
 
          ],
          "uuid": "2a03",  
          "properties": {
            "write": true
          }
        },
        {
          "descriptors": [
 
          ],
          "uuid": "2a04",  
          "properties": {
            "read": true
          }
        }
      ],
      "uuid": "1800"  
    },
    {
      "characteristics": [
        {
          "descriptors": [
            {
              "uuid": "2902"
            }
          ],
          "uuid": "2a05", 
          "properties": {
            "indicate": true
          }
        }
      ],
      "uuid": "1801"  
    },
    {
      "characteristics": [
        {
          "descriptors": [
            {
              "uuid": "2902"
            }
          ],
          "uuid": "2a37",  
          "properties": {
            "notify": true
          }
        },
        {
          "descriptors": [
 
          ],
          "uuid": "2a38",  
          "properties": {
            "read": true
          }
        }
      ],
      "uuid": "180d"  
    },
    {
      "characteristics": [
        {
          "descriptors": [
 
          ],
          "uuid": "2a23",  
          "properties": {
            "read": true
          }
        },
        {
          "descriptors": [
 
          ],
          "uuid": "2a24", 
          "properties": {
            "read": true
          }
        },
        {
          "descriptors": [
 
          ],
          "uuid": "2a25",  
          "properties": {
            "read": true
          }
        },
        {
          "descriptors": [
 
          ],
          "uuid": "2a26",  
          "properties": {
            "read": true
          }
        },
        {
          "descriptors": [
 
          ],
          "uuid": "2a27",  
          "properties": {
            "read": true
          }
        },
        {
          "descriptors": [
 
          ],
          "uuid": "2a28",  
          "properties": {
            "read": true
          }
        },
        {
          "descriptors": [
 
          ],
          "uuid": "2a29",  
          "properties": {
            "read": true
          }
        }
      ],
      "uuid": "180a" 
    },
    {
      "characteristics": [
        {
          "descriptors": [
 
          ],
          "uuid": "2a19", 
          "properties": {
            "read": true
          }
        }
      ],
      "uuid": "180f"  
    },
    {
      "characteristics": [
        {
          "descriptors": [
 
          ],
          "uuid": "6217ff4c-c8ec-b1fb-1380-3ad986708e2d",
          "properties": {
            "read": true
          }
        },
        {
          "descriptors": [
            {
              "uuid": "2902"
            }
          ],
          "uuid": "6217ff4d-91bb-91d0-7e2a-7cd3bda8a1f3",
          "properties": {
            "write": true,
            "indicate": true
          }
        }
      ],
      "uuid": "6217ff4b-fb31-1140-ad5a-a45545d7ecf3"
    }
  ],
  "name": "Polar H7 3B321015"
}

To get the address from above, i use result.address (= 00:22:D0:3B:32:10).
How do i get the value of the first uuid from the result above?

Thanks


#2

(I corrected the formatting of your message by using the </> icon in the editor.)

It should be something like

result.services[0].characteristics[0].uuid


#3

That’s great, thank you.