NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.
WL18xx TI Bluetooth Stack HOGM Demo App
Return to WL18xx AM335x TI Bluetooth Stack
Contents
Demo Overview[edit]
Note: : This instructions can be used to run this demo on the AM335x Platform.
The human interface device enables a host to connect and control a HID device over GATT. There are two roles defined in this profile, Host and Device. The first is the Host which sends control and report requests and the second is the device which responds to the host’s requests. The host is a device that like a computer or tablet and the device is a I/O device like keyboard or mouse.
The HID Over GATT Profile(HOGP) allows a user to use HID services over Low Energy.
It is recommended that the user visits the kit setup Getting Started Guide for AM335x pages before trying the application described on this page.
Running the Bluetooth Code[edit]
Once the am335x is initialized on the terminal, follow the instructions;
Note: When using a CC256x controller you will need to change the init script in order to enable BLE.
You can use the following command in the AM335x device terminal
cp -f /lib/firmware/TIInit_6.7.16_ble_on.bts /lib/firmware/TIInit_6.7.16.bts
Enter to the Sample Application folder, for this example “cd BluetopiaPM/bin”
root@am335x-evm:~# cd BluetopiaPM/bin/ root@am335x-evm:~/BluetopiaPM/bin#
Start the Server and the Demo application by typing “./SS1BTPM & ./LinuxHOGM”
root@am335x-evm:~/BluetopiaPM/bin# ./SS1BTPM & ./LinuxHOGM [1] 1789
Now the help screen is displayed
****************************************************************** * Command Options: 1) Initialize * * 2) Cleanup * * 3) QueryDebugZoneMask * * 4) SetDebugZoneMask * * 5) SetDebugZoneMaskPID * * 6) ShutdownService * * 7) RegisterEventCallback, * * 8) UnRegisterEventCallback, * * 9) QueryDevicePower * * 10)SetDevicePower * * 11)QueryLocalDeviceProperties * * 12)SetLocalDeviceName * * 13)SetLocalClassOfDevice * * 14)SetDiscoverable * * 15)SetConnectable * * 16)SetPairable * * 17)StartDeviceDiscovery * * 18)StopDeviceDiscovery * * 19)QueryRemoteDeviceList * * 20)QueryRemoteDeviceProperties * * 21)AddRemoteDevice * * 22)DeleteRemoteDevice * * 23)UpdateRemoteDeviceAppData * * 24)DeleteRemoteDevices * * 25)PairWithRemoteDevice * * 26)CancelPairWithRemoteDevice * * 27)UnPairRemoteDevice * * 28)QueryRemoteDeviceServices * * 29)QueryRemoteDeviceServiceSupported * * 30)QueryRemoteDevicesForService * * 31)QueryRemoteDeviceServiceClasses * * 32)AuthenticateRemoteDevice * * 33)EncryptRemoteDevice * * 34)ConnectWithRemoteDevice * * 35)DisconnectRemoteDevice * * 36)SetRemoteDeviceLinkActive * * 37)CreateSDPRecord * * 38)DeleteSDPRecord * * 39)AddSDPAttribute * * 40)DeleteSDPAttribute * * 41)EnableBluetoothDebug * * 42)RegisterAuthentication * * 43)UnRegisterAuthentication * * 44)PINCodeResponse * * 45)PassKeyResponse * * 46)UserConfirmationResponse * * 47)ChangeSimplePairingParameters * * 48)RegisterHOGMCallback * * 49)UnRegisterHOGMCallback * * 50)SetProtocolMode * * 51)SetSuspendMode * * 52)GetReportRequest * * 53)SetReportRequest * * 54)StartAdvertising * * 55)StopAdvertising * * Help, Quit. * ******************************************************************
Demo Application[edit]
The demo application provides a description on how to use the demo application to connect two configured boards and communicate over Bluetooth-LE. The included application registers a custom service on a board when the stack is initialized.
HID over GATT (HOGM) - Host Role[edit]
- To verify HOGM host role functionality, after running the "LinuxHOGM" executable, initializing, and powering on the local device if necessary, first register for HOG events.
- a) Initialize the profile by typing “1 1” or “Initialize 1”.
- b) Powering up the Bluetooth device by typing “10 1” or "SetDevicePower 1”, if the device is already powered up you’ll receive an error that the device is already powered up
HOGM>Initialize 1 BTPM_Initialize() Success: 0. DEVM_RegisterEventCallback() Success: 5. HOGM>SetDevicePower 1 [12965.239306] (hci_tty): inside hci_tty_open (ecc473c0, eb82a300) [12965.246652] (stc): chnl_id list empty :4 [12965.250682] (stk) : st_kim_start(stk) :ldisc_install = 1uim:poll broke due to event 10(PRI:2/ERR:8) uim:read 1 from install uim:@ st_uart_config uim: signal received, opening /dev/ttyS1 uim:@ set_baud_rate uim:set_baud_rate() done uim:Setting speed to 3000000 uim:@ read_command_complete uim: Command complete started uim:@ read_hci_event uim: read_hci_event uim:Command complete done [12965.413384] (stc): st_tty_open uim:Speed changing to 3000000, 1 uim:@ set_custom_baud_rate (stk) :line discipline installeduim:Installed N_TI_WL Line displine [12965.427537] (stk) :TIInit_11.8.32.bts uim:begin polling... (stk) :change remote baud rate command in firmware [12965.440763] (stk) :skipping the wait event of change remote baud[12966.205171] (stc): add_channel_to_table: id 4 [12966.209573] (stc): add_channel_to_table: id 2 [12966.213975] (stc): add_channel_to_table: id 3 BT COMM PORT (/dev/hci_tty): 1 DEVM_PowerOnDevice() Success: 0. HOGM> Device Powered On. HOGM>
- c) Registering an HOG Event callback
HOGM>RegisterHOGMCallback HOGM_Register_Data_Event_Callback() Success: 1. HOGM>
- d) To connect to a remote HID device to you have already paired with use:
Usage: ConnectWithRemoteDevice [BD_ADDR] [Connect LE (1 = LE, 0 = BR/EDR)] [ConnectFlags (Optional)]. where ConnectFlags is a bitmask of 0x00000001 = Authenticate 0x00000002 = Encrypt 0x00000004 = Use Local Random Address 0x00000008 = Use Peer Random Address
HOGM>ConnectWithRemoteDevice D03972CD5E23 1 0x02 Attempting to Connect With (LE) Remote Device: D03972CD5E23 (Flags = 0x80000002). DEVM_ConnectWithRemoteDevice() Success: 0. HOGM> Remote Device Properties Changed. BD_ADDR: D03972CD5E23 Address Type: Public LE Type: Single Mode Device Flags: 0x4006F001 LE Connect State: TRUE HOGM> Remote Device Properties Changed. BD_ADDR: D03972CD5E23 Address Type: Public LE Type: Single Mode Device Flags: 0x4007F001 LE Encrypt State: TRUE HOGM> Remote Device Connection Status: D03972CD5E23, 0 (SUCCESS) HOGM> HOGM HID Device Connection Remote Address: D03972CD5E23 Supported Features: Remote Wakeup: Not Capable Normally Connectable: YES Boot Keyboard: SUPPORTED Boot Mouse: NOT SUPPORTED HID Information: HID Version: 0x111 Country Code: 0x0 Product ID: 0xDEAD Product Version: 0xBEEF Vendor ID Source: Bluetooth SIG Vendor ID: 0x5E Report Descriptor: Length: 63 Data: 05 01 09 06 A1 01 05 07 19 E0 29 E7 15 00 25 01 75 01 95 08 81 02 95 01 75 08 81 03 95 05 75 01 05 08 19 01 29 05 91 02 95 01 75 03 91 03 95 06 75 08 15 00 25 65 05 07 19 00 29 65 81 00 C0 HOGM>
Note: :The Connect Flags value of 0x00000002 in the above command. A value of 0x00000002 is used to specify the DEVM_CONNECT_WITH_REMOTE_DEVICE_FLAGS_ENCRYPT flag which is defined in BluetopiaPM/include/DEVMMSG.h. When this flag is set it tells the stack to encrypt the Bluetooth link. It is used here because an encrypted link is required by the HOG profile. When using the PairWithRemoteDevice command it is not required to specify the the encrypt flag because the link will get encrypted as part of the pairing process, so that the link keys are not sent over an un-encrypted link.
- e) Set the protocol mode.
HOGM>SetProtocolMode Usage: SetProtocolMode [BD_ADDR] [ProtocolMode (0 = Boot, 1 = Report)]. Function Error. HOGM>
HOGM>SetProtocolMode D03972CD5E23 0 HOGM_Set_Protocol_Mode() Success. HOGM>
- f) Set the suspend mode.
HOGM>SetSuspendMode Usage: SetSuspendMode [BD_ADDR] [Suspend Mode (0 = Exit Suspend, 1 = Suspend)]. Function Error. HOGM>
HOGM>SetSuspendMode D03972CD5E23 0 HOGM_Set_Suspend_Mode() Success. HOGM>
- g) Get a report request
HOGM>GetReportRequest Usage: GetReport [BD_ADDR] [ReportType] [ReportID (0 = None)]. Where: ReportType = Input Report = 0. Output Report = 1. Feature Report = 2. Boot Keyboard Input Report = 3. Boot Keyboard Output Report = 4. Boot Mouse Input Report = 5. Function Error. HOGM>
HOGM>GetReportRequest D03972CD5E23 3 0 HOGM_Get_Report_Request() Success: Transaction ID = 2. HOGM> HOGM HID Get Report Response Remote Address: D03972CD5E23 Transaction ID: 2 Report Type: Boot Keyboard Input Report Report ID: 0 Status: SUCCESS Report Length: 8 Report Data: 00 00 00 00 00 00 00 00 HOGM>