English 中文(简体)
• 如何用文字执行军法指挥?
原标题:How to execute BLE command in script?

我想把我的蓝色装置放在我的嵌入的含水层上。 我可以人工执行以下指挥系统,使我的BT装置能够使用,并能从BALE扫描仪中扫描。

#bluetoothctl
#menu advertise
#manufacturer 0xffff 0x12 0x34
#name myAX564
#discoverable on
#back
#advertise on
#menu gatt
#register-service e2d36f99-8909-4136-9a49-d825508b297b
#register-characteristic 0x1234 read
#register-characteristic 0x4567 read,write
#register-application
#back
#power on

然而,当我试图用文字处理时,我总是在“登记-申请”之后会见了“org.bluex.Error.Failed”。

下面是我的文字,是否有人能够帮助?

#!/usr/bin/expect -f
spawn bluetoothctl
expect "Agent registered"
sleep 1
send -- "menu advertise
"
expect "Menu advertise:"
sleep 2
send -- "manufacturer 0xffff 0x12 0x34
"
send -- "name myAX564
"
send -- "discoverable on
"
send -- "back
"
expect "Menu main:"
sleep 2
send -- "advertise on
"
expect "Advertising object registered "
sleep 4
send -- "menu gatt
"
expect "Menu gatt:"
sleep 4
send -- "register-service e2d36f99-8909-4136-9a49-d825508b297b
"
expect "Primary (yes/no):"
sleep 2
send -- "yes
"
sleep 4
send -- "register-characteristic 0x1234 read
"
expect "Enter value:"
sleep 2
send -- "0xFA
"
sleep 4
send -- "register-characteristic 0x4567 read, write
"
expect "Enter value:"
sleep 2
send -- "0xFE
"
sleep 4
send -- "register-application
"
sleep 5
expect "Application registered"
send -- "back
"
expect "Menu main:"
send -- "power on
"
expect "Changeing power on succeed"
send -- "exit
"
问题回答

最后,我发现原因。

它应当是“注册-果园”0-x4567读,“标准”之前没有空间。





相关问题
using python expect to run openvpn

i need a python script to run open vpn automaticaly but i use sudo for run the open vpn sudo openvpn --cd /etc/openvpn --config openvpn.conf & thats my terminal command. i have to give the ...

Regular Expression to find string in Expect buffer

I m trying to find a regex that works to match a string of escape characters (an Expect response, see this question) and a six digit number (with alpha-numeric first character). Here s the whole ...

Where can I find TTY and curses documentation for Unix?

I m working on automation tools for an ERP program running on SCO Unix. See my questions on Expect: (Tcl/Expect) clear screen after exit Expect - get variable from screen region based on row and ...

(Tcl/Expect) clear screen after exit

I want to clear the screen (on the local machine) after exiting from my (semi) interactive expect script. Can I do that from within the script? Here s what I tried, that failed. #!/usr/bin/expect -f ...

How can I flush the input buffer in an expect script?

I m writing an Expect script and am having trouble dealing with the shell prompt (on Linux). My Expect script spawns rlogin and the remote system is using ksh. The prompt on the remote system contains ...

default timeout handler for expect script

I have a expect script that need to fail when certain any of the expect condition is not meet. For example: expect "Hello World" If the expect script does not find "Hello World" in certain amount of ...

How can I debug a Perl CGI script?

I inherited a legacy Perl script from an old server which is being removed. The script needs to be implemented on a new server. I ve got it on the new server. The script is pretty simple; it ...

热门标签