Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tools:bluetooth [2023/12/06 07:26] – [C development] darrontools:bluetooth [2023/12/15 07:48] (current) – [Python] darron
Line 1: Line 1:
 ====Bluetooth==== ====Bluetooth====
- 
-There are two standards in use known as BT classic and BT low energy. 
- 
-Anything other than BLE is considered obsolete now. 
- 
-^HCI / LMP^Version^ 
-|0| 1.0b| 
-|1| 1.1| 
-|2| 1.2| 
-|3| 2.0+EDR| 
-|4| 2.1+EDR| 
-|5| 3.0+HS| 
-|6| 4.0| 
-|7| 4.1| 
-|8| 4.2| 
-|9| 5.0| 
-|10| 5.1| 
-|11| 5.2| 
-|12| 5.3| 
- 
-BT 3.0+HS utilises WiFi. BT 4.0 onward is BLE, anything prior is BDR/EDR. 
  
 See [[interfaces:bluetooth]] for Linux Bluetooth devices and setup. See [[interfaces:bluetooth]] for Linux Bluetooth devices and setup.
Line 26: Line 5:
 ===Services=== ===Services===
  
-Development has two services dependencies, dbus and bluetoothd.+Development has two service dependencies, dbus and bluetoothd.
  
 ==DBUS== ==DBUS==
Line 107: Line 86:
 == Test== == Test==
  
-Test [[:boards:wb15|BLE]] device.+Test [[:boards:wb15|STM32WB15CC]] BLE device.
  
 <code> <code>
Line 136: Line 115:
 </code> </code>
  
-LED on/off for p2pServer demo+LED on/off for demo connection above. 
 <code> <code>
 [GATT client]# write-value -w 0x000E 0x01 0x01 [GATT client]# write-value -w 0x000E 0x01 0x01
Line 146: Line 126:
  
 ===Python=== ===Python===
 +
 +It's certainly a lot easier to write code to access BLE devices
 +in Python and preferred for demo purposes and maybe even
 +end use cases.
  
 <code> <code>
Line 151: Line 135:
 </code> </code>
  
-This doesn't appear to work with the [[:boards:wb15|STM32WB15CC]] p2pServer demo so  +Example for the [[:boards:wb15|STM32WB15CC]] BLE demo. 
-no further comment at this time.+ 
 +<code> 
 +import sys, time 
 + 
 +from gattlib import GATTRequester 
 + 
 +req = GATTRequester("00:80:E1:22:F9:7C", False) 
 + 
 +req.connect(True) 
 + 
 +for n in range(10): 
 +    req.write_cmd(0x000E, bytes([0x01,0x01])) 
 +    time.sleep(1) 
 +    req.write_cmd(0x000E, bytes([0x01,0x00])) 
 +    time.sleep(1) 
 + 
 +req.disconnect() 
 +</code>