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 PBAM Demo App

From Texas Instruments Wiki
Jump to: navigation, search

Return to WL18xx AM335x TI Bluetooth Stack

Demo Overview[edit]

NoteNote: : This instructions can be used to run this demo on the AM335x Platform.

PBAP sample application code is provided to enable a rich out-of-box experience to the user. The application allows the user to use a console to send Bluetooth commands, setup a Bluetooth Device to accept connections, connect to a remote Bluetooth device and communicate over Bluetooth

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;
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 & ./LinuxPBAM”

 root@am335x-evm:~/BluetopiaPM/bin# ./SS1BTPM & ./LinuxPBAM
 [1] 1789

Now the help screen is displayed

******************************************************************
* Command Options: 1) Initialize                                 *
*                  2) Cleanup                                    *
*                  3) QueryDebugZoneMask                         *
*                  4) SetDebugZoneMask                           *
*                  5) ShutdownService                            *
*                  6) RegisterEventCallback,                     *
*                  7) UnRegisterEventCallback,                   *
*                  8) QueryDevicePower                           *
*                  9) SetDevicePower                             *
*                  10)QueryLocalDeviceProperties                 *
*                  11)SetLocalDeviceName                         *
*                  12)SetLocalClassOfDevice                      *
*                  13)SetDiscoverable                            *
*                  14)SetConnectable                             *
*                  15)SetPairable                                *
*                  16)StartDeviceDiscovery                       *
*                  17)StopDeviceDiscovery                        *
*                  18)QueryRemoteDeviceList                      *
*                  19)QueryRemoteDeviceProperties                *
*                  20)AddRemoteDevice                            *
*                  21)DeleteRemoteDevice                         *
*                  22)PairWithRemoteDevice                       *
*                  23)CancelPairWithRemoteDevice                 *
*                  24)UnPairRemoteDevice                         *
*                  25)QueryRemoteDeviceServices                  *
*                  26)RegisterAuthentication                     *
*                  27)UnRegisterAuthentication                   *
*                  28)PINCodeResponse                            *
*                  29)PassKeyResponse                            *
*                  30)UserConfirmationResponse                   *
*                  31)ChangeSimplePairingParameters              *
*                  32)ConnectRemoteDevice                        *
*                  33)DisconnectDevice                           *
*                  34)Abort                                      *
*                  35)PullPhoneBook                              *
*                  36)PullPhoneBookSize                          *
*                  37)SetPhoneBook                               *
*                  38)SetPhoneBookAbsolute                       *
*                  39)PullvCardListing                           *
*                  40)PullvCard                                  *
*                  41)EnableBluetoothDebug                       *
*                  Help, Quit.                                   *
******************************************************************




Demo Application[edit]

The demo application provides a description on how to use the demo application to connect two devices exchange Phone Book objects between devices over Bluetooth.


Phone Book Access Profile (PBAP) - Client Equipment Role[edit]

To verify the PBAM Client Role functionality, start by running the "LinuxPBAM" executable, initializing, and powering on the local device if necessary.


a) Initialize the profile by typing “1 1” or “Initialize 1”.
b) Powering up the Bluetooth device by typing “9 1” or "SetDevicePower 1”, if the device is already powered up you’ll receive an error that the device is already powered up
PBAM>Initialize 1

BTPM_Initialize() Success: 0.
DEVM_RegisterEventCallback() Success: 5.
PBAM>SetDevicePower 1


[264429.673788] (hci_tty): inside hci_tty_open (ecb2e788, ecd6ae40)
[264429.681180] (stc):  chnl_id list empty :4
[264429.685235] (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
[264429.848529] (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
[264429.862764] (stk) :TIInit_11.8.32.bts
uim:begin polling...
(stk) :change remote baud rate command in firmware
[264429.875679] (stk) :skipping the wait event of change remote baud[264430.631196] (stc): add_channel_to_table: id 4
[264430.635686] (stc): add_channel_to_table: id 2
[264430.640188] (stc): add_channel_to_table: id 3
BT COMM PORT (/dev/hci_tty): 1
DEVM_PowerOnDevice() Success: 0.
PBAM>
Device Powered On.
PBAM>
c) Next make sure that the local device is discoverable, connectable, and pairable, using the SetDiscoverable, SetConnectable, and SetPairable commands respectively. Now connect the phone to the local device using the settings menu of the phone.

NoteNote: If the phone cannot discover the local device you may need to set the class of the local device, 0x040424 will work, e.g. execute SetLocalClassOfDevice 0x040424 from within the application

d) After you have successfully connected the phone to the local device, from within the application connect the local device to the remote device's PBAP server. To do this you will first need to discover what RFCOMM port is the remote device is hosting the PBAP server on. This can be done by running:
 PBAM>QueryRemoteDeviceServices 60C5474C8455 1
 PBAM>QueryRemoteDeviceServices 60C5474C8455 0 2000
e) Several service records may be returned, search for the service record containing the PBAP Server Equipment UUID 0x112F (Reference: https://www.bluetooth.org/en-us/specification/assigned-numbers/service-discovery), typically the service record will also have a text entry that will distinguish it from the other records, e.g. "Phonebook". Following is the PBAB Server Service Record returned from the iPhone that was used in this demonstration:
Service Record: 7:
     Attribute ID 0x0000
        Type: Unsigned Int = 0x4F49112F
     Attribute ID 0x0001
        Type: Data Element Sequence
           Type: UUID_16 = 0x112F
     Attribute ID 0x0002
        Type: Unsigned Int = 0x00000000
     Attribute ID 0x0004
        Type: Data Element Sequence
           Type: Data Element Sequence
              Type: UUID_16 = 0x0100
           Type: Data Element Sequence
              Type: UUID_16 = 0x0003
              Type: Unsigned Int = 0x0D
           Type: Data Element Sequence
              Type: UUID_16 = 0x0008
     Attribute ID 0x0005
        Type: Data Element Sequence
           Type: UUID_16 = 0x1002
     Attribute ID 0x0006
        Type: Data Element Sequence
           Type: Unsigned Int = 0x656E
           Type: Unsigned Int = 0x006A
           Type: Unsigned Int = 0x0100
           Type: Unsigned Int = 0x6672
           Type: Unsigned Int = 0x006A
           Type: Unsigned Int = 0x0110
           Type: Unsigned Int = 0x6465
           Type: Unsigned Int = 0x006A
           Type: Unsigned Int = 0x0120
           Type: Unsigned Int = 0x6A61
           Type: Unsigned Int = 0x006A
           Type: Unsigned Int = 0x0130
     Attribute ID 0x0008
        Type: Unsigned Int = 0xFF
     Attribute ID 0x0009
        Type: Data Element Sequence
           Type: Data Element Sequence
              Type: UUID_16 = 0x1130
              Type: Unsigned Int = 0x0100
     Attribute ID 0x0100
        Type: Text String = Phonebook
     Attribute ID 0x0314
        Type: Unsigned Int = 0x01
f) The RFCOMM port is defined by the UUID 0x0003 (Reference: https://www.bluetooth.org/en-us/specification/assigned-numbers/service-discovery), and in the above service record we see that the RFCOMM port number is 0x0D, or 13, (see "Type: Unsigned Int = 0x0D" above). Now that we know the RFCOMM port number we can connect to the PBAP Server on the phone:
 PBAM>ConnectRemoteDevice 60C5474C8455 13

 PBAM_Connect_Remote_Device(60C5474C8455, 13) Success.
 PBAM>
 PBAM Connection Status.
     Remote Address:    60C5474C8455
     Connection Status: 0
g) Next Set Directories and pull the phone book's size (the number of entries in the phone book) and then pull the phone book:
 PBAM>PullPhoneBookSize 60C5474C8455

 PBAM_Pull_Phone_Book_Size(60C5474C8455) Success.
 PBAM>
 PBAM Phone Book Size.
     Remote Address: 60C5474C8455
     Status          0
     PhoneBook Size: 5
 PBAM>SetPhoneBookAbsolute 60C5474C8455 telecom

 PBAM_Set_Phone_Book_Absolute(60C5474C8455, telecom) Success.
 PBAM>
 PBAM Phone Book Set.
     Remote Address: 60C5474C8455
     Status:         0
     CurrentPath:    /telecom
 PBAM>PullPhoneBook 60C5474C8455 pb.vcf 0 0 2 20 0

 PBAM_Pull_Phone_Book(60C5474C8455) Success.
 PBAM>
 PBAM VCard Event Data.
     Remote Address:   60C5474C8455
     Status:           0
     Final:            TRUE
     New Missed Calls: 0
     Buffer Size       2163
     VCard Format:     Default
h) Pull the list of VCard entries and then pull a single entry:
 PBAM>PullvCardListing 60C5474C8455 pb 0 0 5 0

 PBAM_PullvCardListing(60C5474C8455, pb, 0, 0, 5, 0, NULL) Success.
 PBAM>
 PBAM VCard Listing.
     Remote Address:   60C5474C8455
     Status:           0
     Final:            1
     New Missed Calls: 0
     Buffer Size:      332
     Buffer Data:
   <?xml version="1.0"?>
 <!DOCTYPE vcard-listing SYSTEM "vcard-listing.dtd">
 <vCard-listing version="1.0">
 <card handle="0.vcf" name="My Number"/>
 <card handle="5.vcf" name="Test 1"/>
 <card handle="6.vcf" name="Test 2"/>
 <card handle="7.vcf" name="Test 3"/>
 <card handle="8.vcf" name="Test 4"/>
 </vCard-listing>
 PBAM>SetPhoneBook 60C5474C8455 1 pb

 PBAM_Set_Phone_Book(60C5474C8455, 1) Success.
 PBAM>
 PBAM Phone Book Set.
     Remote Address: 60C5474C8455
     Status:         0
     CurrentPath:    /telecom/pb
 PBAM>PullvCard 60C5474C8455 5.vcf 1 0 0 1

 PBAM_Pull_vCard(60C5474C8455, 5.vcf, 1, 0, 0) Success.
 PBAM>
 PBAM VCard Event Data.
     Remote Address:   60C5474C8455
     Status:           0
     Final:            TRUE
     New Missed Calls: 0
     Buffer Size       97
     VCard Format:     Card21

For more detailed information about the Phone Book Access Profile refer to the profile's overview and specification.

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article WL18xx TI Bluetooth Stack PBAM Demo App here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article WL18xx TI Bluetooth Stack PBAM Demo App here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article WL18xx TI Bluetooth Stack PBAM Demo App here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article WL18xx TI Bluetooth Stack PBAM Demo App here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article WL18xx TI Bluetooth Stack PBAM Demo App here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article WL18xx TI Bluetooth Stack PBAM Demo App here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article WL18xx TI Bluetooth Stack PBAM Demo App here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article WL18xx TI Bluetooth Stack PBAM Demo App here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article WL18xx TI Bluetooth Stack PBAM Demo App here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity