我正在编写一个Python脚本,它注定要运行在一个Raspberry Pi上,它通过A01远程控制奥林巴斯航空公司的摄像头。WiFi控件工作正常,但我也希望脚本能够远程打开摄像机。
据我所知,这只能通过蓝牙来完成,但是OPC并没有给出更多的细节。我认为在iOS/Android环境下开发时,使用了“唤醒”Java方法,但对于这种方法到底向摄像机发送了什么以使其启动并没有详细说明。
我一直在试验Bluez/Gatttool,并有一个相机的服务和处理列表,但不知道哪个处理程序做什么,以及我应该写什么值来唤醒相机。
有没有人可以通过蓝牙来打开这个摄像头而不用OPC呢?
谢谢!
发布于 2016-09-07 17:30:38
因此,我最终模仿了奥林巴斯Android应用程序和摄像头之间的流量,同时打开了它,现在我可以用Gatttool来发送同样的值了。
下面是最小的Gatttool序列,它唤醒了摄像机:
sudo gatttool -b 90:B6:86:XX:YY:ZZ -I
connect
primary
char-desc
char-write-req 0x0013 0001
char-write-req 0x0016 0001
char-write-req 0x0019 0001
char-write-req 0x0012 0101090c01023132333435364400
char-write-req 0x0015 0202000000
char-write-req 0x0012 0102040f0101021300
char-write-req 0x0015 0203000000
exit编辑:
在python中也可以这样实现:
import os
os.system('gatttool -b 90:B6:86:XX:YY:ZZ --primary')
os.system('gatttool -b 90:B6:86:XX:YY:ZZ --char-desc')
os.system('gatttool -b 90:B6:86:XX:YY:ZZ --char-write-req --handle 0x0013 -n 0001')
os.system('gatttool -b 90:B6:86:XX:YY:ZZ --char-write-req --handle 0x0016 -n 0001')
os.system('gatttool -b 90:B6:86:XX:YY:ZZ --char-write-req --handle 0x0019 -n 0001')
os.system('gatttool -b 90:B6:86:XX:YY:ZZ --char-write-req --handle 0x0012 -n 0101090c01023132333435364400')
os.system('gatttool -b 90:B6:86:XX:YY:ZZ --char-write-req --handle 0x0015 -n 0202000000')
os.system('gatttool -b 90:B6:86:XX:YY:ZZ --char-write-req --handle 0x0012 -n 0102040f0101021300')
os.system('gatttool -b 90:B6:86:XX:YY:ZZ --char-write-req --handle 0x0015 -n 02030000000; sleep 5')
os.system('gatttool -b 90:B6:86:XX:YY:ZZ --char-write-req --handle 0x0012 -n 010304140101011700')
os.system('gatttool -b 90:B6:86:XX:YY:ZZ --char-write-req --handle 0x0015 -n 02040000000')用你自己的MAC地址代替90:B6:86:XX:YY:ZZ
一开始,我尝试使用Pygatt,但是无法执行Gatttool的主要和char-desc操作,所以我返回到通过它的非交互模式直接调用Gatttool。
https://stackoverflow.com/questions/39272712
复制相似问题