因此,我最終模仿奧林巴斯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')
更換90:B6 :86:XX:YY:ZZ由你自己的MAC地址...
起初我嘗試使用Pygatt,但w無法執行Gatttool的主要操作和char-desc操作,因此我通過非交互模式直接調用Gatttool。
你可能在這裏找不到答案,但你爲什麼不試着寫每個服務的數據;你可以在iOS上下載一個名爲lightblue的應用程序並試試。 –