Modifications

Sauter à la navigation Sauter à la recherche
Ligne 98 : Ligne 98 :  
AT+BLEUARTFIFO=RX
 
AT+BLEUARTFIFO=RX
 
1024
 
1024
 +
OK</nowiki>
 +
 +
== AT+BLEKEYBOARDEN ==
 +
This command will enable GATT over HID (GoH) keyboard support, which allows you to emulate a keyboard on supported iOS and Android devices.  By default HID keyboard support is disabled, so you need to set BLEKEYBOARDEN to 1 and then perform a system reset before the keyboard will be enumerated and appear in the Bluetooth preferences on your phone, where if can be bonded as a BLE keyboard.
 +
* Codebase Revision: 0.5.0
 +
* Parameters: 1 or 0 (1 = enable, 0 = disable)
 +
* Output: None
 +
{{ambox|text=As of firmware version 0.6.6 this command is now an alias for AT+BLEHIDEN}}
 +
{{ambox-stop|text= You must perform a system reset (ATZ) before the changes take effect!}}
 +
{{ambox-stop|text=Before you can use your HID over GATT keyboard, you will need to bond your mobile device with the Bluefruit LE module in the Bluetooth preferences panel.}}
 +
<nowiki># Enable BLE keyboard support then reset
 +
AT+BLEKEYBOARDEN=1
 +
OK
 +
ATZ
 +
OK
 +
 
 +
# Disable BLE keyboard support then reset
 +
AT+BLEKEYBOARDEN=0
 +
OK
 +
ATZ
 +
OK</nowiki>
 +
 +
== AT+BLEKEYBOARD ==
 +
Sends text data over the BLE keyboard interface (if it has previously been enabled via AT+BLEKEYBOARDEN).
 +
* Codebase Revision: 0.5.0
 +
* Parameters: The text string (optionally including escape characters) to transmit
 +
* Output: None
 +
 +
Any valid alpha-numeric character can be sent, and the following escape sequences are also supported:
 +
* \r - Carriage Return
 +
* \n - Line Feed
 +
* \b - Backspace
 +
* \t - Tab
 +
* \\ - Backslash
 +
 +
As of version 0.6.7 you can also use the following escape code when sending a single character ('AT+BLEKEYBOARD=?' has another meaning for the AT parser):
 +
* \? - Question mark
 +
 +
<nowiki># Send a URI with a new line ending to execute in Chrome, etc.
 +
AT+BLEKEYBOARD=http://www.adafruit.com\r\n
 
OK
 
OK
</nowiki>
+
 
 +
# Send a single question mark (special use case, 0.6.7+)
 +
AT+BLEKEYBOARD=\?
 +
OK</nowiki>
 +
 
 +
== AT+BLEKEYBOARDCODE ==
 +
Sends a raw hex sequence of USB HID keycodes to the BLE keyboard interface including key modifiers and up to six alpha-numeric characters.
 +
* Codebase Revision: 0.5.0
 +
* Parameters: A set of hexadecimal values separated by a hyphen ('-').  Note that these are HID scan code values, not standard ASCII values!
 +
* Output: None
 +
 
 +
{{ambox|text=HID key code values don't correspond to ASCII key codes! For example, 'a' has an HID keycode value of '04', and there is no keycode for an upper case 'A' since you use the modifier to set upper case values. For details, google 'usb hid keyboard scan codes', and see the example below. }}
 +
 
 +
This command accepts the following ascii-encoded HEX payload, matching the way HID over GATT sends keyboard data:
 +
* '''Byte 0''': Modifier
 +
* '''Byte 1''': Reserved (should always be 00)
 +
* '''Bytes 2..7''': Hexadecimal values for ASCII-encoded characters (if no character is used you can enter '00' or leave trailing characters empty)
 +
 
 +
After a keycode sequence is sent with the AT+BLEKEYBOARDCODE command, you must send a second AT+BLEKEYBOARDCODE command with at least two 00 characters to indicate the keys were released!
 +
 
 +
<nowiki># send 'abc' with shift key --> 'ABC'
 +
AT+BLEKEYBOARDCODE=02-00-04-05-06-00-00
 +
OK
 +
# Indicate that the keys were released (mandatory!)
 +
AT+BLEKEYBOARDCODE=00-00
 +
OK</nowiki>
 +
 
 +
A list of HID keyboard codes can be found [http://www.freebsddiary.org/APC/usb_hid_usages.php here] (see section 7).
 +
 
 +
=== Modifier Values ===
 +
The modifier byte can have one or more of the following bits set:
 +
* Bit 0 (0x01): Left Control
 +
* Bit 1 (0x02): Left Shift
 +
* Bit 2 (0x04): Left Alt
 +
* Bit 3 (0x08): Left Window
 +
* Bit 4 (0x10): Right Control
 +
* Bit 5 (0x20): Right Shift
 +
* Bit 6 (0x40): Right Alt
 +
* Bit 7 (0x80): Right Window
 +
 
 +
== AT+BLEHIDEN ==
 +
This command will enable GATT over HID (GoH) support, which allows you to emulate a keyboard, mouse or media controll on supported iOS, Android, OSX and Windows 10 devices.  By default HID support is disabled, so you need to set BLEHIDEN to 1 and then perform a system reset before the HID devices will be enumerated and appear in on your central device.
 +
* Codebase Revision: 0.6.6
 +
* Parameters: 1 or 0 (1 = enable, 0 = disable)
 +
* Output: None
 +
 
 +
{{ambox|text=You normally need to 'bond' the Bluefruit LE peripheral to use the HID commands, and the exact bonding process will change from one operating system to another.}}
 +
{{ambox|text=If you have previously bonded to a device and need to clear the bond, you can run the AT+FACTORYRESET command which will erase all stored bond data on the Bluefruit LE module.}}
 +
 
 +
<nowiki># Enable GATT over HID support on the Bluefruit LE module
 +
AT+BLEHIDEN=1
 +
OK
 +
 
 +
# Reset so that the changes take effect
 +
ATZ
 +
OK</nowiki>
 +
 
 +
== AT+BLEHIDMOUSEMOVE ==
 +
Moves the HID mouse or scroll wheen position the specified number of ticks.
 +
 
 +
All parameters are signed 8-bit values (-128 to +127).  Positive values move to the right or down, and origin is the top left corner.
 +
* Codebase Revision: 0.6.6
 +
* Parameters: X Ticks (+/-), Y Ticks (+/-), Scroll Wheel (+/-), Pan Wheel (+/-)
 +
* Output: None
 +
<nowiki># Move the mouse 100 ticks right and 100 ticks down
 +
AT+BLEHIDMOUSEMOVE=100,100
 +
OK
 +
 
 +
# Scroll down 20 pixels or lines (depending on context)
 +
AT+BLEHIDMOUSEMOVE=,,20,
 +
OK
 +
 
 +
# Pan (horizontal scroll) to the right (exact behaviour depends on OS)
 +
AT+BLEHIDMOUSEMOVE=0,0,0,100</nowiki>
 +
 
 +
== AT+BLEHIDMOUSEBUTTON ==
 +
Manipulates the HID mouse buttons via the specific string(s).
 +
* Codebase Revision: 0.6.6
 +
* Parameters: Button Mask String [L][R][M][B][F], Action [PRESS][CLICK][DOUBLECLICK][HOLD]
 +
** L = Left Button
 +
** R = Right Button
 +
** M = Middle Button
 +
** B = Back Button
 +
** F = Forward Button
 +
** If the second parameter (Action) is "HOLD", an optional third parameter can be passed specifying how long the button should be held in milliseconds.
 +
* Output: None
 +
 
 +
<nowiki># Double click the left mouse button
 +
AT+BLEHIDMOUSEBUTTON=L,doubleclick
 +
OK
 +
 
 +
# Press the left mouse button down, move the mouse, then release L
 +
# This is required to perform 'drag' then stop type operations
 +
AT+BLEHIDMOUSEBUTTON=L
 +
OK
 +
AT+BLEHIDMOUSEMOVE=-100,50
 +
OK
 +
AT+BLEHIDMOUSEBUTTON=0
 +
OK
 +
 
 +
# Hold the backward mouse button for 200 milliseconds (OS dependent)
 +
AT+BLEHIDMOUSEBUTTON=B,hold,200
 +
OK</nowiki>
 +
 
 +
== AT+BLEHIDCONTROLKEY ==
 +
Sends HID media control commands for the bonded device (adjust volume, screen brightness, song selection, etc.).
 +
* Codebase Revision: 0.6.6
 +
* Parameters: The HID control key to send, followed by an optional delay in ms to hold the button. Voir les valeurs ci-dessous.
 +
* Output: Normally none.
 +
 
 +
The control key string can be one of the following values:
 +
* System Controls (works on most systems)
 +
** BRIGHTNESS+
 +
** BRIGHTNESS-
 +
* Media Controls (works on most systems)
 +
** PLAYPAUSE
 +
** MEDIANEXT
 +
** MEDIAPREVIOUS
 +
** MEDIASTOP
 +
* Sound Controls (works on most systems)
 +
** VOLUME
 +
** MUTE
 +
** BASS
 +
** TREBLE
 +
** BASS_BOOST
 +
** VOLUME+
 +
** VOLUME-
 +
** BASS+
 +
** BASS-
 +
** TREBLE+
 +
** TREBLE-
 +
* Application Launchers (Windows 10 only so far)
 +
** EMAILREADER
 +
** CALCULATOR
 +
** FILEBROWSER
 +
* Browser/File Explorer Controls (Firefox on Windows/Android only)
 +
** SEARCH
 +
** HOME
 +
** BACK
 +
** FORWARD
 +
** STOP
 +
** REFRESH
 +
** BOOKMARKS
 +
 
 +
You can also send a raw 16-bit hexadecimal value in the '0xABCD' format as parameter. A full list of 16-bit 'HID Consumer Control Key Codes' can be found here (see section 12).
 +
 
 +
{{ambox-stop|text=If you are not bonded and connected to a central device, this command will return ERROR. Make sure you are connected and HID support is enabled before running these commands.}}
 +
 
 +
<nowiki># Toggle the sound on the bonded central device
 +
AT+BLEHIDCONTROLKEY=MUTE
 +
OK
 +
 
 +
# Hold the VOLUME+ key for 500ms
 +
AT+BLEHIDCONTROLKEY=VOLUME+,500
 +
OK
 +
 
 +
# Send a raw 16-bit Consumer Key Code (0x006F = Brightness+)
 +
AT+BLEHIDCONTROLKEY=0x006F
 +
OK</nowiki>
 +
 
 +
== AT+BLEHIDGAMEPADEN ==
 +
 
 +
Enables HID gamepad support in the HID service. By default the gamepad is disabled as of version 0.7.6 of the firmware since it causes problems on iOS and OS X and should only be used on Android and Windows based devices.
 +
 
 +
* Codebase Revision: 0.7.6
 +
* Parameters: Whether the gamepad service should be enabled via one of the following values:
 +
** '''1''' ou '''on'''
 +
** '''0''' ou '''off'''
 +
* Output: If executed with no parameters, a numeric value will be returned indicating whether the battery service is enabled (1) or disabled (0).
 +
{{ambox|text=This command requires a system reset to take effect.}}
 +
 
 +
== AT+BLEHIDGAMEPAD ==
 +
Sends a specific HID gamepad payload out over BLE
 +
* Codebase Revision: 0.7.0
 +
* Parameters: The following comma-separated parameters are available:
 +
** '''Axe x''':  LEFT, RIGHT: If X=-1 then 'LEFT' is pressed, if X=1 then 'RIGHT' is pressed, if X=0 then neither left nor right are pressed
 +
** '''Axe y''': UP, DOWN: If Y=-1 then 'UP' is pressed, if Y=1 then 'DOWN' is pressed, if Y=0 then neither up nor down are pressed
 +
** '''Boutons''': 0x00-0xFF, which is a bit mask for 8 button 0-7
 +
* Output: Nothing
 +
{{ambox|text=HID gamepad is disabled by default as of version 0.7.6, and must first be enabled via AT+BLEHIDGAMEPADEN=1 before it can be used.}}
 +
{{ambox|text=Note: You need to send both 'press' and 'release' events for each button, otherwise the system will think that the button is still pressed until a release state is received.}}
 +
 
 +
<nowiki># Press 'RIGHT' and 'Button0' at the same time
 +
AT+BLEHIDGAMEPAD=1,0,0x01
    +
# Press 'UP' and 'Button1' + 'Button0' at the same time
 +
AT+BLEHIDGAMEPAD=0,-1,0x03</nowiki>
    
{{Bluefruit-LE-Shield-TRAILER}}
 
{{Bluefruit-LE-Shield-TRAILER}}
29 917

modifications

Menu de navigation