Skip to content

Commit 63ecb35

Browse files
committed
Imported api v2.7.0
1 parent ad545f4 commit 63ecb35

17 files changed

+1253
-32
lines changed

.idea/gradle.xml

Lines changed: 2 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Then, add the compile element to the dependencies closure in the module's *build
2020

2121
```gradle
2222
dependencies {
23-
compile 'com.mbientlab:metawear:2.6.5'
23+
compile 'com.mbientlab:metawear:2.7.0'
2424
}
2525
```
2626

library/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ android {
3131
defaultConfig {
3232
minSdkVersion 18
3333
targetSdkVersion 24
34-
versionCode 35
35-
versionName "2.6.5"
34+
versionCode 36
35+
versionName "2.7.0"
3636
}
3737
buildTypes {
3838
release {

library/library.iml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,6 @@
6767
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
6868
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
6969
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
70-
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
71-
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
72-
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
73-
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
74-
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
75-
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
76-
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
77-
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
7870
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
7971
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
8072
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
@@ -83,6 +75,14 @@
8375
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
8476
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
8577
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
78+
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
79+
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
80+
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
81+
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
82+
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
83+
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
84+
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
85+
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
8686
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
8787
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
8888
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
@@ -97,6 +97,8 @@
9797
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
9898
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
9999
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
100+
<excludeFolder url="file://$MODULE_DIR$/build/javadoc" />
101+
<excludeFolder url="file://$MODULE_DIR$/build/javadoc.tar.gz" />
100102
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
101103
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
102104
</content>
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
* Copyright 2014-2015 MbientLab Inc. All rights reserved.
3+
*
4+
* IMPORTANT: Your use of this Software is limited to those specific rights granted under the terms of a software
5+
* license agreement between the user who downloaded the software, his/her employer (which must be your
6+
* employer) and MbientLab Inc, (the "License"). You may not use this Software unless you agree to abide by the
7+
* terms of the License which can be found at www.mbientlab.com/terms. The License limits your use, and you
8+
* acknowledge, that the Software may be modified, copied, and distributed when used in conjunction with an
9+
* MbientLab Inc, product. Other than for the foregoing purpose, you may not use, reproduce, copy, prepare
10+
* derivative works of, modify, distribute, perform, display or sell this Software and/or its documentation for any
11+
* purpose.
12+
*
13+
* YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY
14+
* OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
15+
* NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MBIENTLAB OR ITS LICENSORS BE LIABLE OR
16+
* OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE
17+
* THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT,
18+
* PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY,
19+
* SERVICES, OR ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
20+
*
21+
* Should you have any questions regarding your right to use this Software, contact MbientLab via email:
22+
* hello@mbientlab.com.
23+
*/
24+
25+
package com.mbientlab.metawear.data;
26+
27+
import com.mbientlab.metawear.Message;
28+
29+
import java.nio.ByteBuffer;
30+
import java.nio.ByteOrder;
31+
import java.util.Calendar;
32+
33+
/**
34+
* Created by etsai on 11/9/16.
35+
*/
36+
37+
public class SensorFusionCartesianFloatMessage extends Message {
38+
private static float MSS_TO_G = 9.80665f;
39+
private final float x, y, z;
40+
41+
public SensorFusionCartesianFloatMessage(byte[] data) {
42+
this(null, data);
43+
}
44+
45+
public SensorFusionCartesianFloatMessage(Calendar timestamp, byte[] data) {
46+
super(timestamp, data);
47+
48+
ByteBuffer buffer = ByteBuffer.wrap(data).order(ByteOrder.LITTLE_ENDIAN);
49+
x = buffer.getFloat() / MSS_TO_G;
50+
y = buffer.getFloat() / MSS_TO_G;
51+
z = buffer.getFloat() / MSS_TO_G;
52+
}
53+
54+
@Override
55+
public <T> T getData(Class<T> type) {
56+
if (type.equals(CartesianFloat.class)) {
57+
return type.cast(new CartesianFloat() {
58+
@Override
59+
public Float x() {
60+
return x;
61+
}
62+
63+
@Override
64+
public Float y() {
65+
return y;
66+
}
67+
68+
@Override
69+
public Float z() {
70+
return z;
71+
}
72+
});
73+
}
74+
throw new UnsupportedOperationException(String.format("Type \'%s\' not supported for message class: %s",
75+
type.toString(), getClass().toString()));
76+
}
77+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/*
2+
* Copyright 2014-2015 MbientLab Inc. All rights reserved.
3+
*
4+
* IMPORTANT: Your use of this Software is limited to those specific rights granted under the terms of a software
5+
* license agreement between the user who downloaded the software, his/her employer (which must be your
6+
* employer) and MbientLab Inc, (the "License"). You may not use this Software unless you agree to abide by the
7+
* terms of the License which can be found at www.mbientlab.com/terms. The License limits your use, and you
8+
* acknowledge, that the Software may be modified, copied, and distributed when used in conjunction with an
9+
* MbientLab Inc, product. Other than for the foregoing purpose, you may not use, reproduce, copy, prepare
10+
* derivative works of, modify, distribute, perform, display or sell this Software and/or its documentation for any
11+
* purpose.
12+
*
13+
* YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY
14+
* OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
15+
* NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MBIENTLAB OR ITS LICENSORS BE LIABLE OR
16+
* OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE
17+
* THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT,
18+
* PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY,
19+
* SERVICES, OR ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
20+
*
21+
* Should you have any questions regarding your right to use this Software, contact MbientLab via email:
22+
* hello@mbientlab.com.
23+
*/
24+
25+
package com.mbientlab.metawear.data;
26+
27+
import com.mbientlab.metawear.Message;
28+
import com.mbientlab.metawear.module.SensorFusion;
29+
30+
import java.nio.ByteBuffer;
31+
import java.nio.ByteOrder;
32+
import java.util.Calendar;
33+
import java.util.Locale;
34+
35+
/**
36+
* Created by etsai on 11/14/16.
37+
*/
38+
39+
public class SensorFusionCorrectedAccMessage extends Message {
40+
private final float x, y, z;
41+
private final SensorFusion.CalibrationAccuracy accuracy;
42+
43+
public SensorFusionCorrectedAccMessage(byte[] data) {
44+
this(null, data);
45+
}
46+
47+
public SensorFusionCorrectedAccMessage(Calendar timestamp, byte[] data) {
48+
super(timestamp, data);
49+
50+
ByteBuffer buffer = ByteBuffer.wrap(data).order(ByteOrder.LITTLE_ENDIAN);
51+
x = buffer.getFloat() / 1000f;
52+
y = buffer.getFloat() / 1000f;
53+
z = buffer.getFloat() / 1000f;
54+
accuracy = SensorFusion.CalibrationAccuracy.values()[buffer.get()];
55+
}
56+
57+
@Override
58+
public <T> T getData(Class<T> type) {
59+
if (type.equals(SensorFusion.CorrectedCartesianFloat.class)) {
60+
return type.cast(new SensorFusion.CorrectedCartesianFloat() {
61+
@Override
62+
public String toString() {
63+
return String.format(Locale.US, "{x:, %.3f, y: %.3f, z: %.3f, accuracy: %s}",
64+
x(), y(), z(), accuracy());
65+
}
66+
67+
@Override
68+
public float x() {
69+
return x;
70+
}
71+
72+
@Override
73+
public float y() {
74+
return y;
75+
}
76+
77+
@Override
78+
public float z() {
79+
return z;
80+
}
81+
82+
@Override
83+
public SensorFusion.CalibrationAccuracy accuracy() {
84+
return accuracy;
85+
}
86+
});
87+
}
88+
throw new UnsupportedOperationException(String.format("Type \'%s\' not supported for message class: %s",
89+
type.toString(), getClass().toString()));
90+
}
91+
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/*
2+
* Copyright 2014-2015 MbientLab Inc. All rights reserved.
3+
*
4+
* IMPORTANT: Your use of this Software is limited to those specific rights granted under the terms of a software
5+
* license agreement between the user who downloaded the software, his/her employer (which must be your
6+
* employer) and MbientLab Inc, (the "License"). You may not use this Software unless you agree to abide by the
7+
* terms of the License which can be found at www.mbientlab.com/terms. The License limits your use, and you
8+
* acknowledge, that the Software may be modified, copied, and distributed when used in conjunction with an
9+
* MbientLab Inc, product. Other than for the foregoing purpose, you may not use, reproduce, copy, prepare
10+
* derivative works of, modify, distribute, perform, display or sell this Software and/or its documentation for any
11+
* purpose.
12+
*
13+
* YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY
14+
* OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
15+
* NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MBIENTLAB OR ITS LICENSORS BE LIABLE OR
16+
* OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE
17+
* THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT,
18+
* PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY,
19+
* SERVICES, OR ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
20+
*
21+
* Should you have any questions regarding your right to use this Software, contact MbientLab via email:
22+
* hello@mbientlab.com.
23+
*/
24+
25+
package com.mbientlab.metawear.data;
26+
27+
import com.mbientlab.metawear.Message;
28+
import com.mbientlab.metawear.module.SensorFusion.CalibrationAccuracy;
29+
import com.mbientlab.metawear.module.SensorFusion.CorrectedCartesianFloat;
30+
31+
import java.nio.ByteBuffer;
32+
import java.nio.ByteOrder;
33+
import java.util.Calendar;
34+
import java.util.Locale;
35+
36+
/**
37+
* Created by etsai on 11/8/16.
38+
*/
39+
40+
public class SensorFusionCorrectedCartesianFloatMessage extends Message {
41+
private final float x, y, z;
42+
private final CalibrationAccuracy accuracy;
43+
44+
public SensorFusionCorrectedCartesianFloatMessage(byte[] data) {
45+
this(null, data);
46+
}
47+
48+
public SensorFusionCorrectedCartesianFloatMessage(Calendar timestamp, byte[] data) {
49+
super(timestamp, data);
50+
51+
ByteBuffer buffer = ByteBuffer.wrap(data).order(ByteOrder.LITTLE_ENDIAN);
52+
x = buffer.getFloat();
53+
y = buffer.getFloat();
54+
z = buffer.getFloat();
55+
accuracy = CalibrationAccuracy.values()[buffer.get()];
56+
}
57+
58+
@Override
59+
public <T> T getData(Class<T> type) {
60+
if (type.equals(CorrectedCartesianFloat.class)) {
61+
return type.cast(new CorrectedCartesianFloat() {
62+
@Override
63+
public String toString() {
64+
return String.format(Locale.US, "{x:, %.3f, y: %.3f, z: %.3f, accuracy: %s}",
65+
x(), y(), z(), accuracy());
66+
}
67+
68+
@Override
69+
public float x() {
70+
return x;
71+
}
72+
73+
@Override
74+
public float y() {
75+
return y;
76+
}
77+
78+
@Override
79+
public float z() {
80+
return z;
81+
}
82+
83+
@Override
84+
public CalibrationAccuracy accuracy() {
85+
return accuracy;
86+
}
87+
});
88+
}
89+
throw new UnsupportedOperationException(String.format("Type \'%s\' not supported for message class: %s",
90+
type.toString(), getClass().toString()));
91+
}
92+
}

0 commit comments

Comments
 (0)