Best way to programming this app?

Hi!

First of all, i am new in Eclipse and Monkey C programming language. But i have good background programming in C#.

I am currently working with a vivoactive 3 watch given up by Garmin to my PhD research. My aim is to progrmming an app which be able to get the watch sensor signals to externally processing it. Concretelly i need the accelerometre and the hearth rate signals. I have read the Garmin´s official website programmer guide to get some background on Monkey C. But i would like to ask about what will be the best way to get these signals and send it from the watch to an smartphone. I would like to run the app in background, so i would not need to programming a GUI.

Someone can help me on "where to begin":

I would like to know what is the best App Type for my project, if there exist some open source/example apps to get the signal and communicate the watch and finally how i can store data on the watch.

For example, i am having problems creating a .xml file on resources folder, to use JSON as in Garmins example. When i compile the code, i get errors.:

Garmin example:

<resources>
<jsonData id="jsonDictionary">{"key":"value", "3":"three", "three":3}</jsonData>
<jsonData id="jsonArray">[1,2,3,4,5,6]</jsonData>
<jsonData id="jsonMix">[1,{"1":"one"},["a","b","c"]]</jsonData>
<jsonData id="jsonPrimitive">5</jsonData>
<jsonData id="jsonFile" filename="data.json"/>
</resources>


Errors:

BUILD: ERROR: Problem validating a resource file: Premature end of file.
BUILD: com.garmin.monkeybrains.resourcecompiler.ResourceException: Problem validating a resource file: Premature end of file.
BUILD: at com.garmin.monkeybrains.resourcecompiler.DocumentParser.validateResourceFile(DocumentParser.java:285)
BUILD: at com.garmin.monkeybrains.resourcecompiler.DocumentParser.addJungleResources(DocumentParser.java:399)
BUILD: at com.garmin.monkeybrains.Project.addProjectResources(Project.java:163)
BUILD: at com.garmin.monkeybrains.ProjectBuilder.addCIQProjectFiles(ProjectBuilder.java:210)
BUILD: at com.garmin.monkeybrains.Monkeybrains.runPRGCompiler(Monkeybrains.java:1229)
BUILD: at com.garmin.monkeybrains.Monkeybrains.compileApplication(Monkeybrains.java:1024)
BUILD: at com.garmin.monkeybrains.Monkeybrains.run(Monkeybrains.java:2315)
BUILD: at com.garmin.monkeybrains.Monkeybrains.simpleMain(Monkeybrains.java:254)
BUILD: at com.garmin.monkeybrains.Monkeybrains.simpleMain(Monkeybrains.java:236)
BUILD: at com.garmin.monkeybrains.Monkeybrains.main(Monkeybrains.java:283)
BUILD: Caused by: org.xml.sax.SAXParseException; systemId: file:/D:/1.-GIT/4.%20Tesis/Desarrollo-Tesis/Desarrollos/03-Pruebas%20Recursos/resources/jsonData.xml; lineNumber: 1; columnNumber: 1; Premature end of file.
BUILD: at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:204)
BUILD: at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:178)
BUILD: at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
BUILD: at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
BUILD: at java.xml/com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1471)
BUILD: at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1013)
BUILD: at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
BUILD: at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
BUILD: at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:534)
BUILD: at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:888)
BUILD: at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:824)
BUILD: at java.xml/com.sun.org.apache.xerces.internal.jaxp.validation.StreamValidatorHelper.validate(StreamValidatorHelper.java:176)
BUILD: at java.xml/com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.validate(ValidatorImpl.java:115)
BUILD: at java.xml/javax.xml.validation.Validator.validate(Validator.java:124)
BUILD: at com.garmin.monkeybrains.resourcecompiler.DocumentParser.validateResourceFile(DocumentParser.java:281)
BUILD: ... 9 more
BUILD: usage: monkeyc [-a <arg>] [-d <arg>] [-e] [--Eno-invalid-symbol] [-f <arg>] [-g]
BUILD: [-h] [-i <arg>] [-m <arg>] [-o <arg>] [-p <arg>] [-r] [-s <arg>] [-t] [-u
BUILD: <arg>] [-v] [-w] [-x <arg>] [-y <arg>] [-z <arg>]
BUILD: -a,--apidb <arg> API import file
BUILD: -d,--device <arg> Target device
BUILD: -e,--package-app Create an application package.
BUILD: --Eno-invalid-symbolDo not error when a symbol is found to be invalid
BUILD: -f,--jungles <arg> Jungle files
BUILD: -g,--debug Print debug output
BUILD: -h,--help Prints help information
BUILD: -i,--import-dbg <arg> Import api.debug.xml
BUILD: -m,--manifest <arg> Manifest file
BUILD: -o,--output <arg> Output file to create
BUILD: -p,--project-info <arg>projectInfo.xml file to use when compiling
BUILD: -r,--release Strip debug information
BUILD: -s,--sdk-version <arg> SDK version to target
BUILD: -t,--unit-test Enables compilation of unit tests
BUILD: -u,--devices <arg> devices.xml file to use when compiling
BUILD: -v,--version Prints the compiler version
BUILD: -w,--warn Show compiler warnings
BUILD: -x,--excludes <arg> Add annotations to the exclude list
BUILD: -y,--private-key <arg> Private key to sign builds with
BUILD: -z,--rez <arg> Resource file

Hope you can help me.

Regards!

  • As I suggested, you should step back and try to get the PitchCounter sample app to record the data. Once you know that is working, then look at your app.

    I've had no problems verifying that the PitchCounter is recording data:

    1. Import the PitchCounter project into Eclipse
    2. Create a run Configuration for the app with the fr935 device
    3. Run the app under the simulator
    4. Click Simulation > FIT Data > Playback File...
    5. Select the sample FIT file included with the sample app samples\PitchCounter\pitch_counter_8_pitches.FIT
    6. Watch the displayed sample count and sample period increment along with the pitch count
    7. When the pitch count reaches 8 (about 35 seconds), press the back button on the simulated device
    8. Click Simulation > FIT Data > Save FIT Session.. and save the FIT file to the desktop.
    9. Ran the FitToCSV conversion tool included with the FIT SDK to convert the FIT file I just saved to a CSV
    10. Open that CSV in Excel
    11. Examine the accelerometer data

    Now that I know things are working, I can venture off into experimenting with the app and tweaking it to fit my needs.

  • After enabling heartBeatIntervals, I'm still seeing accelerometer data in my FIT file, but I'm not seeing any heart beat interval data.

  • Hi!

    I would try to test on this week the steps you said me in your last message.

    I monitorize the heart beat interval data, but i don´t know why i am not able to write it in the file. Indeed, i don´t know in where part of the code the accelerometre data is written in the file in real time, becouse of the session.save() function is called when the session is stopped. 

    Any suggestions?

  • HI!

    I have tried your solution following it step by step, the only step that i have done different is convert the file. I have use the next online tool to this aim:

    http://www.rainorshine.bike

    The output i have achived is this:

  • I'm not convinced that the website you're looking at is doing anything more than showing the output generated by the FitToCSV tool. Most sites just skip over other data, and I'm betting that this is one of them.

    Your best bet is to look into the FIT SDK tools. The PitchCounter sample app has a sample FIT file with accelerometer data in it. You should be able to use this to verify that the tools you are using are able to read that data from the file. Once you have that working, you should move on to verifying BBI.

    You're really on the edge of what I've done with the FIT data, so I'm probably not going to be of much help from here.

  • Thanks again Travis. 

    Two questions. Where is the sample FIT file from the PitchCounter sample? I have seen the 8_pitch_counter_file to generate dummy samples. Is it? 

    I do not know what is the FIT SDK Tool. I have read the official website and downloaded it, but I don't know if it is like a library to instance it from eclipse or... How can I work with it? 

    Thanks! 

  • Two questions. Where is the sample FIT file from the PitchCounter sample? I have seen the 8_pitch_counter_file to generate dummy samples. Is it? 

    Yes. I'm pretty sure that is the only .FIT file in the PitchCounter sample folder. That file is a .FIT file that is known to have accelerometer data in it, and you should be able to use it to verify everything is working from end to end with accelerometer data.

    I do not know what is the FIT SDK Tool. I have read the official website and downloaded it, but I don't know if it is like a library to instance it from eclipse or... How can I work with it? 

    You need to download the FIT SDK (like suggested). It is a Software Development Kit that includes some command-line tools to view the contents of .FIT files. If the tools don't meet your needs, you can use the SDK to write an app to do what you need.