andycw / movesensedotnet Goto Github PK
View Code? Open in Web Editor NEWMovesense .NET SDK for Xamarin Android and Xamarin iOS
License: MIT License
Movesense .NET SDK for Xamarin Android and Xamarin iOS
License: MIT License
I need to develop a Windows UWP application or a WPF that could use Movesense.
Is it possible to create a C# application that works on windows with x86-64 architecture and not with ARM mobile deployments?
As run time permissions is not introduced before android Marshmallow the BasicDemo will crash. I am not sure if this is caused by the Plugin.Permission or the MovesenseDotNet library.
As I am not familiar with Android programming I did not want to make a pull request for this issue.
My solution was to wrap the permission check to include a version check and skip the permission check for older versions of android. So the GetLocationPermissionAsync() now look like this:
void GetLocationPermissionAsync()
{
//Check to see if any permission in our group is available, if one, then all are
const string permission = Manifest.Permission.AccessCoarseLocation;
if (Android.OS.Build.VERSION.SdkInt >= BuildVersionCodes.M) {
if (CheckSelfPermission(permission) == (int)Permission.Granted) {
return;
}
//Finally request permissions with the list of permissions and Id
RequestPermissions(PermissionsLocation, RequestLocationId);
}
}
in the mainActivity.cs file. This might be a bad solution but it is working for me on Android Kit-Kat (4.4.2) on a Samsung galaxy s4 mini.
Hey, just a small thing on the side. The Movesense repositories have moved to a new location.
For example, the old iOS mobile lib vs the new one:
Old: pod 'Movesense', :git => 'ssh://[email protected]:443/suunto/movesense-mobile-lib.git'
New: pod 'Movesense', :git => 'ssh://[email protected]:443/movesense/movesense-mobile-lib.git'
Hi there,
I am trying to read HR data from the device, I am using the following piece of code:
but I get the following error:
Unhandled Exception:
MdsLibrary.MdsException: Com.Movesense.Mds.MdsException: Failed status: 404, reason: NOT_FOUND
--- End of managed Com.Movesense.Mds.MdsException stack trace ---
com.movesense.mds.MdsException: Failed status: 404, reason: NOT_FOUND at com.movesense.mds.internal.operation.MdsRestOperation.onResponse(MdsRestOperation.java:81) at com.movesense.mds.internal.operation.MdsResponseOperation.protectedRun(MdsResponseOperation.java:26)
at com.movesense.mds.internal.workqueue.QueueOperation.run(QueueOperation.java:70)
at com.movesense.mds.internal.workqueue.WorkQueueImpl.runOperation(WorkQueueImpl.java:79)
at com.movesense.mds.internal.workqueue.WorkQueueImpl$1.run(WorkQueueImpl.java:30)
at java.lang.Thread.run(Thread.java:784)
occurred
Also, will HR capability be added in the future?
There is a discrepancy in the datatypes on the sensor and in the movesenseDotNet Library.
The logbook modificationTimestamp is a "uint32" on the sensor and in the library it's an "int".
This results in an error where the json deserialization will cause an exception to be thrown.
LogEntriesMDSResult.cs
LogEntriesResult.cs
The output from IMovesense.GetLogbookDataJsonAsync has more than one value for ArrayAcc, ArrayGyro and ArrayMagn at the same timestamp. Not sure which of the values I should use.
Here is the code for context:
//Delete all data entries
await movesense.DeleteLogEntriesAsync(tappedSensor.Name);
//Create DataLogger config
await movesense.SetupLoggerAsync(tappedSensor.Name, 26);
//Start logging
await movesense.SetLoggerStatusAsync(tappedSensor.Name, true);
//Read for 2 seconds
Thread.Sleep(2000);
//Stop logging
await movesense.SetLoggerStatusAsync(tappedSensor.Name, false);
//List Log contents
var logbook_entries = await movesense.GetLogEntriesAsync(tappedSensor.Name);
//Read Data
var data = await movesense.GetLogbookDataJsonAsync(tappedSensor.Name, logbook_entries.LogEntries.Elements[0].Id);
The ApiSubscriptionAsync function is requiring a freq as an input argument which is put on the end of the path. This causes the function to return 404 NOT_FOUND for all API calls that does not have a number at the end. eg the /Time api from the movesense library.
await Plugin.Movesense.CrossMovesense.Current.ApiSubscriptionAsync<string>(this.Device.Name, "Temp/", 1 ,
(d) => {
Debug.WriteLine(d);
});
Also note that in ApiSubscriptionAsync the user will need to remove the leading slash and insert a trailing slash in the path compared to the ApiCallASync where you need the leading slash but not the tailing slash.
Suggested fix: remove the "freq" argument or make it nullable. Also decide on where to put the slashes.
workaround (for your own services): Add a magic number to the end of your path and use that as the freq when subscribing.
Edit:
This was on an Android device running android 4.4 (KitKat). Code compiled with VS 2017 and the V1.0.3-beta of the Plugin.Movesense NuGet package
The API /Mem/Logbook/Entries (see docs), is supposed to return either status code 200 or 100 if there is much data, that needs to be spiltted to multiple requests.
In that case the method GetLogEntriesAsync as well as ApiCallAsync throws an MdsException.
Example call:
IMovesense mds /* ... */;
string data = await mds.ApiCallAsync<string>(myMovesenseDevice, MdsOp.GET, "/Mem/Logbook/Entries");
The call works for small amounts of data on the movesense device. However not, if there are plenty of LogbookEntries stored (about 50).
As stated in the above linked docs, the api caller has to react to status code 100. In that case, the first 4-5 entries are already in the body of the "Status 100"-response, as seen in logcat. that should be cached, and the api call needs to be called again (with parameter StartAfterId), as long as there are no more data available.
Edit: The same seems to apply to /Mem/Logbook/byId/{LogId}/Data docs
Btw: Please provide the steps to compile the project in src
folder, so we can try to fork and PR a solution ourself.
Plugin.Movesense 2.2.3.2 expects on iOS MoveSenseBindingiOS 1.38.0.2, but only 1.38.0.1 is available. Thus, currently, you can't use the latest version on iOS.
When running the following code:
await movesense.ConnectMdsAsync(tappedSensor.Id);
I get this error, I am not sure what may be causing it. :
No implementation found for void com.movesense.mds.SDSInternalWrapper.sdsSetDelegate(java.lang.Object) (tried Java_com_movesense_mds_SDSInternalWrapper_sdsSetDelegate and Java_com_movesense_mds_SDSInternalWrapper_sdsSetDelegate__Ljava_lang_Object_2)
I get the following error on I build CustomServiceSample.Android: Unable to remove directory "obj\Debug\81\android\bin\classes". Could not find a part of the path 'AccessibilityManagerCompat_AccessibilityStateChangeListenerImplementor.class'.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.