Metawear Dart
Over the last couple of days I've been working on a dart implementation for the metawear libraries. I'm working on an app in flutter, my original plan was to somehow rework the messaging scheme to work with the java and ios versions of the library but that proved to be much more complicated. I've been trying to port the library over to dart. I might need some questions answer in regards to the library as I go through the implementation. For the most part it's pretty straight forward. There is already a nice Bluetooth flutter library that I'm going to use in conjunction with this.
I've been having some problems because the dynamic typing of the dart breaks some of existing functions calls.
Comments
@mpollind,
Cool. Keep us updated. Please note our APIs are open-source so you can dig into the source code as much as your please.
Yep, I'm working from the java implementation. At the moment I'm trying to keep it as close to 1 to 1 as possible. I might have to tweak things to work with some of the constraints in Dart. For instance the dynamic typing nature of the library prevents function overriding. I'm doing things like re-wrapping some function calls in a nested object.
@Laura one thing I'm a little confused about the api is Data. what does it do actually. It looks like it some method to query modules and their subtypes of some kind . As far as i can tell it's mainly used for functional testing.
Making some good progress, I've made my way through half of the library. Still quite a lot to implement but I think I'm getting somewhere.
https://github.com/pollend/flutter_metawear/pull/1/files
The Data interface, assuming that is what you are referring to, is the Java variant of the MblMwData struct from the C++ api.
@mpollind: thanks for that! I don't have the skills in dart yet but I am working on flutter then happy to test!!
just a quick update, I've re-implemented nearly all the modules. The only large remaining part is the bluetooth interface and verifying that the api is correct. then I could work on restructuring things a bit better to work with dart.
https://github.com/pollend/flutter_metawear/pull/1
very interested in this :-)
I've kind of underestimated the difficult but I'm getting there hopefully. The only really difficult part is verifying if the implementation is correct. good thing there is a large variety of tests that I will have to re-implement but it will prove that everything is working. I only have one of the sensors so I can't quite verify this for others.
good luck! keep us updated.
I can't devote any dev time to this just yet, but I can definitely test the library out with multiple metamotion R devices if you like.
That sounds good.
Is this implementation working at the moment? Can it be used to connect and read accel, gyro data from MetaWear sensors?
Any update on this? Is there any plan by Mbientlab to provide official Flutter Metawear SDK?
@nekos, on our side we don't have any plans because our team is not big enough to support all the tools we already have (maybe one day )
@Laura OK thank you for the answer!
@mpollind what’s the status of your effort. I am very interested in this as well. Happy to help development/testing
I had to do something similar on one commercial project (Flutter + Unity). It was possible to implement the transfer of the necessary functionality of the MetaWear API to the Dart language.