Différences entre versions de « Bluefruit-LE-Shield-BLE-Services »

De MCHobby - Wiki
Sauter à la navigation Sauter à la recherche
Ligne 28 : Ligne 28 :
 
{{ambox-stop|text= You must be connected to another device for this command to execute}}
 
{{ambox-stop|text= You must be connected to another device for this command to execute}}
  
<syntaxhighlight lang="python">
+
<nowiki>
 
# Send a string when connected to another device
 
# Send a string when connected to another device
 
AT+BLEUARTTX=THIS IS A TEST
 
AT+BLEUARTTX=THIS IS A TEST
Ligne 36 : Ligne 36 :
 
AT+BLEUARTTX=THIS IS A TEST
 
AT+BLEUARTTX=THIS IS A TEST
 
ERROR
 
ERROR
</syntaxhighlight>
+
</nowiki>
  
 
=== Gestion de la mémoire tampon de réception ===
 
=== Gestion de la mémoire tampon de réception ===
Ligne 69 : Ligne 69 :
 
{{ambox|text= You can also use the AT+BLEUARTFIFO=RX command to check if any incoming data is available or not.}}
 
{{ambox|text= You can also use the AT+BLEUARTFIFO=RX command to check if any incoming data is available or not.}}
  
<syntaxhighlight lang="python">
+
<nowiki>
 
# Command results when data is available
 
# Command results when data is available
 
AT+BLEUARTRX
 
AT+BLEUARTRX
Ligne 78 : Ligne 78 :
 
AT+BLEUARTRX
 
AT+BLEUARTRX
 
OK
 
OK
</syntaxhighlight>
+
</nowiki>
  
 
== AT+BLEUARTFIFO ==
 
== AT+BLEUARTFIFO ==
Ligne 87 : Ligne 87 :
 
* Output: The free space remaining in the TX and RX FIFO buffer if no parameter is present, otherwise the free space remaining in the specified FIFO buffer.
 
* Output: The free space remaining in the TX and RX FIFO buffer if no parameter is present, otherwise the free space remaining in the specified FIFO buffer.
  
<syntaxhighlight lang="python">
+
<nowiki>
 
AT+BLEUARTFIFO
 
AT+BLEUARTFIFO
 
1024,1024
 
1024,1024
Ligne 99 : Ligne 99 :
 
1024
 
1024
 
OK
 
OK
</syntaxhighlight>
+
</nowiki>
  
  
 
{{Bluefruit-LE-Shield-TRAILER}}
 
{{Bluefruit-LE-Shield-TRAILER}}

Version du 12 juin 2017 à 14:49


MCHobby investit du temps et de l'argent dans la réalisation de traduction et/ou documentation. C'est un travail long et fastidieux réalisé dans l'esprit Open-Source... donc gratuit et librement accessible.
SI vous aimez nos traductions et documentations ALORS aidez nous à en produire plus en achetant vos produits chez MCHobby.

Services BLE

The following commands allow you to interact with various GATT services present on Bluefruit LE modules when running in Command Mode.

Le service GATT et ses caractéristiques (Adafruit, anglais) gouvernent l'organisation et l'échange de données entre les périphériques.

AT+BLEUARTTX

This command will transmit the specified text message out via the UART Service while you are running in Command Mode.

  • Codebase Revision: 0.3.0
  • Parameters: The message payload to transmit. The payload can be up to 240 characters (since AT command strings are limited to a maximum of 256 bytes total).
  • Output: This command will produce an ERROR message if you are not connected to a central device, or if the internal TX FIFO on the Bluefruit LE module is full.

As of firmware release 0.6.2 and higher, AT+BLEUARTTX can accept a limited set of escape code sequences:

  • \r = carriage return
  • \n = new line
  • \t = tab
  • \b = backspace
  • \\ = backward slash

As of firmware release 0.6.7 and higher, AT+BLEUARTTX can accept the following escape code sequence since AT+BLEUARTTX=? has a specific meaning to the AT parser:

  • \? = transmits a single question mark

As of firmware release 0.7.6 and higher, AT+BLEUARTTX can accept the following escape code sequence:

  • \+ = transmit a single '+' character without having to worry about `+++` mode switch combinations
# Send a string when connected to another device
AT+BLEUARTTX=THIS IS A TEST
OK
  
# Send a string when not connected
AT+BLEUARTTX=THIS IS A TEST
ERROR

Gestion de la mémoire tampon de réception

Starting with firmware version 0.6.7, when the TX FIFO buffer is full a 200ms blocking delay will be used to see if any free space becomes available in the FIFO before returning ERROR. The exact process is detailed in the flow chart below:

Bluefruit-LE-Shield-BLE-Services-00.jpg

You can use the AT+BLEUARTFIFO=TX command to check the size of the TX FIFO before sending data to ensure that you have enough free space available in the buffer.

The TX FIFO has the following size, depending on the firmware version used:

  • Firmware <=0.6.6: 160 characters wide
  • Firmware >=0.6.7: 1024 characters wide

AT+BLEUARTTXF

This is a convenience function the serves the same purpose as AT+BLEUARTTX, but data is immediately sent in a single BLE packet ('F' for force packet). This command will accept a maximum of 20 characters, which is the limit of what can be send in a single packet.

  • Codebase Revision: 0.7.6
  • Parameters: See AT+BLEUARTTX
  • Output: See AT+BLEUARTTX

AT+BLEUARTRX

This command will dump the UART service's RX buffer to the display if any data has been received from from the UART service while running in Command Mode. The data will be removed from the buffer once it is displayed using this command.

Any characters left in the buffer when switching back to Data Mode will cause the buffered characters to be displayed as soon as the mode switch is complete (within the limits of available buffer space, which is 1024 bytes on current black 32KB SRAM devices, or 160 bytes for the blue first generation BLEFriend board based on 16KB SRAM parts).

  • Codebase Revision: 0.3.0
  • Parameters: None
  • Output: The RX buffer's content if any data is available, otherwise nothing.
# Command results when data is available
AT+BLEUARTRX
Sent from Android
OK
  
# Command results when no data is available
AT+BLEUARTRX
OK

AT+BLEUARTFIFO

This command will return the free space available in the BLE UART TX and RX FIFOs. If you are transmitting large chunks of data, you may want to check if you have enough free space in the TX FIFO before sending, keeping in mind that individual GATT packets can contain up to 20 user bytes each.

  • Codebase Revision: 0.6.7
  • Parameters: Running this command with no parameters will return two comma-separated values indicating the free space in the TX buffer, following by the RX buffer. To request a specific buffer, you can execute the command with either a "TX" or "RX" value (For example: "AT+BLEUARTFIFO=TX").
  • Output: The free space remaining in the TX and RX FIFO buffer if no parameter is present, otherwise the free space remaining in the specified FIFO buffer.
AT+BLEUARTFIFO
1024,1024
OK

AT+BLEUARTFIFO=TX
1024
OK

AT+BLEUARTFIFO=RX
1024
OK



Basé sur "Bluefruit LE Shield" d'Adafruit Industries, écrit par Kevin Townsend - Traduit en Français par shop.mchobby.be CC-BY-SA pour la traduction
Toute copie doit contenir ce crédit, lien vers cette page et la section "crédit de traduction".

Based on "Bluefruit LE Shield" from Adafruit Industries, written by Kevin Townsend - Translated to French by shop.mchobby.be CC-BY-SA for the translation
Copies must includes this credit, link to this page and the section "crédit de traduction" (translation credit).

Traduit avec l'autorisation d'AdaFruit Industries - Translated with the permission from Adafruit Industries - www.adafruit.com