Forum Archive

Apple watch peripheral characteristics scan using pythonista

Hameed

Hi,

I would like to scan the peripheral characteristics of the apple watch.
I have tried to discover services as mentioned in Core bluetooth module document and I was able to get the UUIDs of the services.
But now I need to get the names of the services and the characteristics, I would appreciate if anyone could guide me in this step.

Further I would like to extract data from the apple watch( from aforementioned services), is any information available with regards to this as well.

I eagerly wait for your help.

Thanks and Regards
Hameed

ccc

Please provide the code that you have so far.

mcriley821

I’ve been doing something similar. Here’s a list of GATT characteristics that helped me. https://www.bluetooth.com/specifications/gatt/characteristics/

Hameed

Hi,

Sorry for the late reply.
Here is my current code:

import cb
import sound
import struct

class MyCentralManagerDelegate (object) :
       def __init__(self):
              self.peripheral = None

       def did_discover_peripheral(self, P):
              print ( '+++ Discovered peripheral: %s (%s)' % (P.name, P.uuid))
              if P.name and 'Apple Watch' in P.name and not self.peripheral:
                      self.peripheral = P
                      cb.connect_peripheral(self.peripheral)

      def did_connect_peripheral(self,P):
              print('***Connected: %s' % P.name)
              print('Discovering services...')
              P.discover_services()

     def did_fail_to_connect_peripheral(self, P, error):
             print('Failed to connect')

     def did_discover_services(self, P, error):
            for S in P.services:
                   print(S.uuid)