tohox tohox - 1 year ago 84
Python Question

Olympus camera kit bluetooth wakeup

I'm working on a Python script destined to run on a Raspberry Pi which controls an Olympus Air A01 camera remotely via WiFi. The WiFi control works fine but I would also like for the script to be able to turn the camera on remotely.

As far as I can tell this can only be done through Bluetooth LE but the OPC SDK doesn't give much details regarding how this is done. I think that when developing under iOS/Android the "wakeup" Java method is used for this purpose but again there are no details as to what exactly this method transmits to the camera in order to get it to power up.

I've been experimenting with Bluez/Gatttool and have a list of the camera's services and handles but have no idea which handle does what and what values I should write to it to wake up the camera.

Has anyone been able to turn this camera on through Bluetooth LE without using the OPC SDK?


Answer Source

So I ended up imitating the traffic between the Olympus Android App and the camera while turning it on and I am now able to wake up the camera using Gatttool to send the same values.

Here is the minimal Gatttool sequence which wakes up the camera:

sudo gatttool -b 90:B6:86:XX:YY:ZZ -I
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


The same can be achieved in python like so:

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')

Replacing 90:B6:86:XX:YY:ZZ by your own MAC address...

At first I tried using Pygatt but wasn't able to perform the primary and char-desc operations from Gatttool so I reverted to calling Gatttool directly through its non-interactive mode.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download