2

I need to setup my Linux laptop as a BLE peripheral to advertise service with specified device name and service UUID. I can achieve this with the following set of commands,

sudo hciconfig 0 reset
sudo hcitool -i hci0 cmd 0x08 0x0008 15 02 01 1a 11 07 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 00 00 00 00 00 00 00 00 00 00
sudo btmgmt -i hci0 le on
sudo btmgmt -i hci0 connectable on
sudo btmgmt -i hci0 name MYNAME
sudo btmgmt -i hci0 advertising on
sudo btmgmt -i hci0 power on

(Note that btmgmt was built from bluez5.37)

It works well and my iPhone can scan and discover the peripheral with name "MYNAME" and service UUID 504f4e4d-4c4b-4a49-4847-464544434241.

My question is, I need to replace the above btmgmt commands with hciconfig and/or hcitool, is it possible? And if yes, how to set the parameters for each command?

Thanks in advance.

kuang
  • 309
  • 1
  • 11
  • I'm voting to close this question as off-topic because it is not a programming question as defined in the [help] guidelines. It may be more suitable for a different site such as [unix.se] or [su] instead, but check the site's guidelines (available in the site's help center) to ensure you're selecting the most appropriate site for your question before posting there. Good luck. – Ken White Apr 22 '16 at 01:56

1 Answers1

2

You should be able to replace your btmgmt commands with this to start advertising:

sudo hciconfig hci0 leadv 0