Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
846 views
in Technique[技术] by (71.8m points)

bluetooth - How to use gatttool non-interactive mode

I want to write gatttool in non-interactive mode.

$ sudo gatttool -i hci0 -b 78:A5:04:44:0A:57 -I
[78:A5:04:44:0A:57][LE]> connect
Attempting to connect to 78:A5:04:44:0A:57
Connection successful
[78:A5:04:44:0A:57][LE]> char-write-cmd 0x0025 ff

I'm changing color of light that is using bluetooth.

What is the equivalent by using non-interactive mode? I tried like this, but it doesn't change the color of light and to stop it I must use ctrl+c. There is no message at all.

sudo gatttool -i hci0 -b 78:A5:04:44:0A:57 --char-write -a 0x0025 -n ff

How can I write the command?

Environment:

I'm using Raspberry Pi and Rasbian.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

the option is not --char-write but a --char-write-req.

Total command must be:

sudo gatttool -i hci0 -b 78:A5:04:44:0A:57 --char-write-req -a 0x0025 -n ff

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...