Currently the only officially supported API's are via Android and IOS, so minus a version of Jython that is supported on Android (currently there doesn't appear to be one), there is no support with this. Another option might be to use a Rasberry Pi with a bluetooth adapter, but you would need to get deeper into the protocol etc..
I'm working on an embedded platform that runs a flavor of Linux. The platform has Wi-Fi and Bluetooth. I'm writing some code in python and I'd like to be able to make the Metawear vibrate. I've been able to connect to the Metawear through the Linux command line with commands such as hcitiool and gatttool, but I don't know how to make it vibrate.
If you take a look at the low level Java code for the vibration motor API call, you can reverse engineer the Bluetooth packet (down to the byte) you need to send to the MetaWear board.
Then just send the same packet using your Linux commands and voila!
We're on the right track. I've been able to read the battery level, manufacturer name, firmware version, etc., but I can't figure out the command to make the metawear vibrate. I know I need to send a command to UUID 9001 (which has a handle of 0x1b). See below. But I can't figure out what that command should be.
public enum MetaWear implements GATTCharacteristic {
/** UUID for issuing commands to MetaWear*/
COMMAND("9001"),
/** UUID for receiving notifications from MetaWear i.e. reads or characteristic changes */
NOTIFICATION_1("9006"),
/** UUID for receiving notifications from MetaWear i.e. reads or characteristic changes */
NOTIFICATION_2("9007"),
/** UUID for receiving notifications from MetaWear i.e. reads or characteristic changes */
NOTIFICATION_3("9008");
I'm using the following commands to connect to the metawear:
Discover descriptors finished: No attribute found within the given range
[FD:B5:47:BA:20:55][LE]>
Handle 0x1b corresponds to UUID 9001, which according to the Android API, is " /** UUID for issuing commands to MetaWear*/". I can send commands like so:
[FD:B5:47:BA:20:55][LE]> char-write-req 0x1b XX XX
But I can't figure out what to send in place of XX XX above.
Yes, I can try to reverse engineer the Android API, but it's difficult without an Android phone. I'm developing an application on an embedded Linux platform, not an Android app.
The LED module is pretty straightforward, like the haptic module, in that all the code does underneath is properly place the respective parameters in a byte array. An implementation of the Led interface is provided in the DefaultMetaWearBoard class:
In src/registers/*.js you can take a look on a bunch of ported functionallity which might help for your python code.The next days i try to port more features.
Comments