- August 15, 2016 at 4:13 am #13790AnonymousInactive
When using the example script to start the device streaming I then view the data in a terminal window. Below is the first few lines at 115200 baud.
00 34 00 01 0E FB FF FF FB FF FF 3B 71 8F 43 FE B0 15 48 80 13 04 05 00
34 00 01 0E FA FF FF 0E 00 00 7B 14 3D 43 35 DA 19 48 80 13 04 05 00 34
00 01 0E 04 00 00 F8 FF FF EC C4 4D 43 C0 36 16 48 80 13 04 05 00 34 00
01 0E FC FF FF 09 00 00 96 FB A1 43 A9 03 16 48 80 13 04 05 00 34 00 01
0E FE FF FF 00 00 00 84 E5 09 43 84 BD 15 48 80 13 04 05 00 34 00 01 0E
How is this data formatted and how can I decode it to get useful data?
- August 15, 2016 at 10:19 am #13792AnonymousGuest
Mark, Wow, good question, but my guess is the answer is going to disappoint you. I think the BLE protocol plus the various kinds of data passed between the phone and meter will make this approach very very difficult to extract only the measured values you want.
At this point, I would say the easiest method would be to use Android Studio. James developed the android app using AS. It is free and James provides the source code for each app version for free on GitHub. By the way, this is quite commendable; not every manufacturer will provide the source code for their product apps. It is complex software, but with just a little knowledge and research you can load his latest app source code into the latest Android Studio and it will compile into an app which will run correctly. From there with a lot more knowledge and studying his code, you can modify the source code to do what you want. Not easy by any means, but easier than decoding a serial stream, unless somebody has already done it for you.
Perhaps the Python app would be easier, but I believe I remember reading the latest app is not compatible with the latest meter firmware changes.
As always, just my humble opinion.
- August 15, 2016 at 11:53 pm #13796AnonymousInactive
The Android stuff is fine however I need to run it on a windows machine and to talk with a different application which controls all my other hardware. I suppose I will have to figure out how the python scripts work and try and create my own so I can run them from my main application. Time to get the books out I think.
- August 16, 2016 at 3:36 am #13799AnonymousGuest
Here is a related thread https://moosh.im/f/topic/python-api-and-april-update-issue-not-connecting/
I’m not sure if seergio has made any progress since then. – – – – Duane
- August 18, 2016 at 9:38 am #13835
I haven’t totally parsed the data you provided, but I can tell you that you are better off modifying the python script to have it spit out the data you want than trying to interpret the raw serial stream from a different script. There are a few layers of interaction happening – between the BLED112 and the Python script, on the BLE layer, and on the application layer.
Specifically, if you look at notifyCB on line 48 of Example.py, this function is probably all you need to adjust to start sending data out to a new end point.
PS. Thanks again Duane
- August 19, 2016 at 12:39 am #13845AnonymousInactive
I was initially going to use the Example.py script and modify it so it just does the initialisation part and then another script to grab some readings as i require. But closing the init script seems to kill everything, the paramaters or arguments for the read get lost. Is it possible to have different scripts for init, read and close?
- August 25, 2016 at 2:17 pm #13914
I dug in to this more today and updated the Example.py script. During all the beta testing with the apps, I made some changes to the protocol that didn’t get ported back to the Python API. I fixed the issue and now the example script connects and talks to firmware version 1470628829 without problem.
Hope this helps, best
- August 30, 2016 at 1:40 am #13936AnonymousGuest
I had no issue with the original software. The issue I have is that i require separate scripts for initialise, get sample and close. I am not very experienced with python and just want to take measurements, I wasn’t expecting to re-write python scripts.
The stream part in the infinite loop checks BGWrapper.idle(). How does it call notifyCB() from here.
#This will be called every time a new sample is received
I cannot see in any of the files where this is called.
- August 31, 2016 at 7:38 pm #13949
A couple of issues:
Separating the scripts is quite difficult because the code needs to store a lot of session information to interact with the Mooshimeter. What is it you are trying to accomplish? You might be better served by modifying the script to respond to actions from the user through some other means.
Regarding notifyCB: notifyCB is a callback, which is called from an inner layer of the bluetooth stack when the update is received over bluetooth. BGWrapper.idle() constantly serves the bluetooth stack and will call notifyCB when something is received.
If your code is on Github I can probably be more specific. Hope this helps! Best
- September 1, 2016 at 8:45 am #13955AnonymousGuest
I managed to tweak the code a bit so it would spit out the relevant data which I captured on the pc. However when using the phone app the latest firmware update has been pushed to the meter I believe. I have tried using the latest example that you provided and that dosn’t work at all. It exits at didn’t find our friend.
Has this code been tested and is there any additional files required.
Is it possible to revert back to the previous firmware version where I had a system working????
- September 1, 2016 at 9:38 am #13956
Sorry this has become complicated…
It sounds like you were using an older version of the python API that’s not compatible with the latest firmware. I think the best option is to base your python code off the latest version of the Mooshimeter-PythonAPI. Sorry, but downgrading firmware is not presently supported.
If your code is visible online somewhere I can try to help you. Please let me know
- September 2, 2016 at 12:24 am #13959AnonymousGuest
The only code i am using at the moment is the Latest you put on github.
“the best option is to base your python code off the latest version of the Mooshimeter-PythonAPI”
Is this following link not the latest to use with build 1470628829
If not where can I get it?
- September 2, 2016 at 11:08 am #13961
I am asking because you referenced notifyCB, which is a variable name that I don’t think is present in the most recent version of the code. Are you sure your git repository is up to date?
The URL you reference is the correct one, but I’ve been making updates to the code there over the last few days largely based on your feedback.
- This topic has 12 replies, 3 voices, and was last updated 5 years, 8 months ago by .
Viewing 12 reply threads
Viewing 12 reply threads