Modifications

Sauter à la navigation Sauter à la recherche
382 octets ajoutés ,  3 août 2017 à 20:10
Ligne 200 : Ligne 200 :  
De même, le service DFU est également nécessaire pour maintenir la fonctionnalité de mise-à-jour OTA (over-the-air). Désactiver ce service créerait plus de problèmes que sa présence n'en provoque.
 
De même, le service DFU est également nécessaire pour maintenir la fonctionnalité de mise-à-jour OTA (over-the-air). Désactiver ce service créerait plus de problèmes que sa présence n'en provoque.
   −
== How can I use BlueZ and gatttool with Bluefruit modules? ==
+
== Comment puis-je utiliser BlueZ et gatttool avec les modules Bluefruit ? ==
BlueZ has a bit of a learning curve associated with it, but you can find some notes below on one option to send and receive data using the BLE UART Service built into all of our Bluefruit LE modules and boards.
+
BlueZ nécessite un peu d'étude pour pouvoir l'utiliser. Vous trouverez ci-dessous quelques notes sur une option permettant d'envoyer et recevoir des données en utilisant le service BLE UART disponible sur tous les modules Bluefruit LE et cartes Bluefruit LE.
   −
These commands may change with different versions of BlueZ. Version 5.21 was used below.
+
Ces commandes pourraient changer avec une version différente de BlueZ. La version 5.21 était utilisée ci-dessous.
    
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
# Initialise the USB dongle
+
# Initialiser la clé USB
 
$ sudo hciconfig hci0 up
 
$ sudo hciconfig hci0 up
   −
# Scan for the UART BLE device
+
# Scan des périphériques BLE UART
 
$ sudo hcitool lescan
 
$ sudo hcitool lescan
 
   D6:4E:06:4F:72:86 UART
 
   D6:4E:06:4F:72:86 UART
   −
# Start gatttool, pointing to the UART device found above
+
# Démarrer gatttool, pointant sur le périphérique UART trouvé ci-dessus
 
$ sudo gatttool -b D6:4E:06:4F:72:86 -I -t random --sec-level=high
 
$ sudo gatttool -b D6:4E:06:4F:72:86 -I -t random --sec-level=high
   Ligne 220 : Ligne 220 :  
   Connection successful
 
   Connection successful
 
    
 
    
# Scan for primary GATT Services
+
# Scan des services GATT principaux
 
   [D6:4E:06:4F:72:86][LE]> primary
 
   [D6:4E:06:4F:72:86][LE]> primary
 
   attr handle: 0x0001, end grp handle: 0x0007 uuid: 00001800-0000-1000-8000-00805f9b34fb
 
   attr handle: 0x0001, end grp handle: 0x0007 uuid: 00001800-0000-1000-8000-00805f9b34fb
Ligne 227 : Ligne 227 :  
   attr handle: 0x000f, end grp handle: 0xffff uuid: 0000180a-0000-1000-8000-00805f9b34fb
 
   attr handle: 0x000f, end grp handle: 0xffff uuid: 0000180a-0000-1000-8000-00805f9b34fb
   −
# Get the handles for the entries in the UART service (handle 0x0009)
+
# Obtenir les handles pour les entrées dans le service UART (handle 0x0009)
 
   [D6:4E:06:4F:72:86][LE]> char-desc
 
   [D6:4E:06:4F:72:86][LE]> char-desc
 
   handle: 0x0001, uuid: 00002800-0000-1000-8000-00805f9b34fb
 
   handle: 0x0001, uuid: 00002800-0000-1000-8000-00805f9b34fb
Ligne 250 : Ligne 250 :  
# 6e400003 (handle 0x000d) = RX characteristic
 
# 6e400003 (handle 0x000d) = RX characteristic
   −
# Optional (but maybe helpful) ... scan for CCCD entries
+
# Optionel (mais peut être utile) ... scan des entrées CCCD
 
   [D6:4E:06:4F:72:86][LE]> char-read-uuid 2902
 
   [D6:4E:06:4F:72:86][LE]> char-read-uuid 2902
 
   handle: 0x000e value: 00 00  
 
   handle: 0x000e value: 00 00  
 
    
 
    
# Enable notifications on the RX characteristic (CCCD handle = 0x000e)
+
# Activer les notifications pour la caractéristique RX (CCCD handle = 0x000e)
# 0100 = get notifications
+
# 0100 = get notifications / obtenir des notifications
# 0200 = get indications
+
# 0200 = get indications / obtenir des indications  
# 0300 = get notifications + indications
+
# 0300 = get notifications + indications / Obtenir des notification et indications  
# 0000 = disable notifications + indications
+
# 0000 = désactiver les notifications + indications
 
   [D6:4E:06:4F:72:86][LE]> char-write-req 0x000e 0100
 
   [D6:4E:06:4F:72:86][LE]> char-write-req 0x000e 0100
 
   Characteristic value was written successfully
 
   Characteristic value was written successfully
   −
# Just to make sure it was updated
+
# S'assurer que la caractéristique à été mise-à-jour
 
   [D6:4E:06:4F:72:86][LE]> char-read-hnd 0x000e
 
   [D6:4E:06:4F:72:86][LE]> char-read-hnd 0x000e
 
   Characteristic value/descriptor: 01 00  
 
   Characteristic value/descriptor: 01 00  
 
    
 
    
# Writing "test" in the Serial Monitor of the Arduino sketch should
+
# Ecrire "test" dans le moniteur série du croquis Arduino. Cela
# cause this output not that notifications are enabled:
+
# devrait cette sortie.
 
   Notification handle = 0x000d value: 74 65 73 74  
 
   Notification handle = 0x000d value: 74 65 73 74  
   −
# Write something to the TX characteristic (handle = 0x000b)
+
# Ecrire quelque chose sur la caractéristique TX (handle = 0x000b)
# This should cause E F G H to appear in the Serial Monitor
+
# Cela devrait faire apparaître les caractères E F G H dans le
 +
# moniteur série d'Arduino
 
   [D6:4E:06:4F:72:86][LE]> char-write-cmd 0x000b 45         
 
   [D6:4E:06:4F:72:86][LE]> char-write-cmd 0x000b 45         
 
   [D6:4E:06:4F:72:86][LE]> char-write-cmd 0x000b 46
 
   [D6:4E:06:4F:72:86][LE]> char-write-cmd 0x000b 46
Ligne 277 : Ligne 278 :  
   [D6:4E:06:4F:72:86][LE]> char-write-cmd 0x000b 48
 
   [D6:4E:06:4F:72:86][LE]> char-write-cmd 0x000b 48
   −
# To send multiple bytes
+
# Envoyer plusieurs octets
 
   [D6:4E:06:4F:72:86][LE]> char-write-cmd 0x000B 707172737475
 
   [D6:4E:06:4F:72:86][LE]> char-write-cmd 0x000B 707172737475
 
    
 
    
# If you are running the callbackEcho sketch and notifications
+
# Si vous exécutez le croquis callbackEcho et que les notifications  
# are enabled you should get this response after the above cmd:
+
# sont activée alors vous devriez voir cette réponse après avoir
 +
# exécuté la commande ci-dessus:
 
   Notification handle = 0x000d value: 70 71 72 73 74 75  
 
   Notification handle = 0x000d value: 70 71 72 73 74 75  
    
--------------
 
--------------
   −
# If you just want to enable constant listening, enter the following command from the CLI:
+
# Si vous désirez seulement une écoute permanente, saisissez la
 +
# commande suivante dans le CLI:
 
$ sudo gatttool -b D6:4E:06:4F:72:86 -t random --char-write-req -a 0x000e -n 0100 --listen
 
$ sudo gatttool -b D6:4E:06:4F:72:86 -t random --char-write-req -a 0x000e -n 0100 --listen
   −
# This should give us the following output as data is written on the Uno,
+
# Cela devrait produire les sorties suivantes lorsque des données sont
# though we can't send anything back:
+
# saisie dans Arduino IDE. Nous ne pouvons cependant pas renvoyer
 +
# de données:
 
   Characteristic value was written successfully
 
   Characteristic value was written successfully
 
   Notification handle = 0x000d value: 74 65 73 74  
 
   Notification handle = 0x000d value: 74 65 73 74  
   Notification handle = 0x000d value: 6d 6f 72 65 20 74 65 73 74 </bash>
+
   Notification handle = 0x000d value: 6d 6f 72 65 20 74 65 73 74 </syntaxhighlight>
    
==  Can I use the IRQ pin to wake my MCU up from sleep when BLE UART data is available? ==
 
==  Can I use the IRQ pin to wake my MCU up from sleep when BLE UART data is available? ==
29 917

modifications

Menu de navigation