Skip to content

Commit b880064

Browse files
committed
Imported v3.0.0 beta03
1 parent d868565 commit b880064

File tree

120 files changed

+4309
-749
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+4309
-749
lines changed

README.md

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

2222
```gradle
2323
dependencies {
24-
compile 'com.mbientlab:metawear:3.0.0-beta02'
24+
compile 'com.mbientlab:metawear:3.0.0-beta03'
2525
}
2626
```
2727

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 39
35-
versionName "3.0.0-beta02"
34+
versionCode 41
35+
versionName "3.0.0-beta03"
3636
}
3737
buildTypes {
3838
release {

library/src/main/java/com/mbientlab/metawear/AsyncDataProducer.java

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,11 @@
2424

2525
package com.mbientlab.metawear;
2626

27-
import com.mbientlab.metawear.builder.RouteBuilder;
28-
import com.mbientlab.metawear.builder.filter.Comparison;
29-
import com.mbientlab.metawear.builder.filter.ComparisonOutput;
30-
import com.mbientlab.metawear.builder.function.Function2;
31-
32-
import bolts.Task;
33-
3427
/**
3528
* Interrupt driven data producer
3629
* @author Eric Tsai
3730
*/
38-
public interface AsyncDataProducer {
39-
/**
40-
* Adds a route to direct where the data will go
41-
* @param builder Builder object to construct the route
42-
* @return Created route
43-
*/
44-
Task<Route> addRoute(RouteBuilder builder);
45-
/**
46-
* Unique name identifying the data, used for data processor loops
47-
* @return DataToken name
48-
* @see com.mbientlab.metawear.builder.RouteElement#filter(Comparison, ComparisonOutput, String...)
49-
* @see com.mbientlab.metawear.builder.RouteElement#map(Function2, String...)
50-
*/
51-
String name();
31+
public interface AsyncDataProducer extends DataProducer {
5232
/**
5333
* Starts producing data
5434
*/
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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;
26+
27+
import com.mbientlab.metawear.builder.RouteBuilder;
28+
import com.mbientlab.metawear.builder.RouteElement;
29+
import com.mbientlab.metawear.builder.filter.Comparison;
30+
import com.mbientlab.metawear.builder.filter.ComparisonOutput;
31+
import com.mbientlab.metawear.builder.function.Function2;
32+
33+
import bolts.Task;
34+
35+
/**
36+
* A component connected to the board that creates data
37+
* @author Eric Tsai
38+
*/
39+
public interface DataProducer {
40+
/**
41+
* Adds a route to direct where the data will go
42+
* @param builder Builder object to construct the route
43+
* @return Created route
44+
*/
45+
Task<Route> addRoute(RouteBuilder builder);
46+
/**
47+
* Unique name identifying the data for feedback loops
48+
* @return DataToken name
49+
* @see RouteElement#filter(Comparison, ComparisonOutput, String...)
50+
* @see RouteElement#map(Function2, String...)
51+
*/
52+
String name();
53+
}

library/src/main/java/com/mbientlab/metawear/ForcedDataProducer.java

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,11 @@
2424

2525
package com.mbientlab.metawear;
2626

27-
import com.mbientlab.metawear.builder.RouteBuilder;
28-
import com.mbientlab.metawear.builder.filter.Comparison;
29-
import com.mbientlab.metawear.builder.filter.ComparisonOutput;
30-
import com.mbientlab.metawear.builder.function.Function2;
31-
32-
import bolts.Task;
33-
3427
/**
3528
* Data creator that only produces data when a {@link #read()} command is issued
36-
* @author Erici Tsai
29+
* @author Eric Tsai
3730
*/
38-
public interface ForcedDataProducer {
39-
/**
40-
* Adds a route to direct where the data will go
41-
* @param builder Builder object to construct the route
42-
* @return Created route
43-
*/
44-
Task<Route> addRoute(RouteBuilder builder);
45-
/**
46-
* Unique name identifying the data, used for data processor loops
47-
* @return DataToken name
48-
* @see com.mbientlab.metawear.builder.RouteElement#filter(Comparison, ComparisonOutput, String...)
49-
* @see com.mbientlab.metawear.builder.RouteElement#map(Function2, String...)
50-
*/
51-
String name();
31+
public interface ForcedDataProducer extends DataProducer {
5232
/**
5333
* Sends a read command to the producer
5434
*/

library/src/main/java/com/mbientlab/metawear/MetaWearBoard.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,16 @@ interface UnexpectedDisconnectHandler {
129129
/**
130130
* Retrieves a reference to the requested module if supported. You must connected to the board before
131131
* calling this function and the board must not be in MetaBoot mode
132-
* @param moduleClass Module class to lookup
132+
* @param moduleClass Module class to lookup
133+
* @param <T> Runtime type the return value is casted as
133134
* @return Reference to the requested module, null if the board is not connected, module not supported, or board is in MetaBoot mode
134135
*/
135136
<T extends Module> T getModule(Class<T> moduleClass);
136137
/**
137138
* Retrieves a reference to the requested module if supported, throws a checked exception if the function fails.
138139
* You must connected to the board before calling this function and the board must not be in MetaBoot mode
139-
* @param moduleClass ModuleId class to lookup
140+
* @param moduleClass ModuleId class to lookup
141+
* @param <T> Runtime type the return value is casted as
140142
* @return Reference to the requested module
141143
* @throws UnsupportedModuleException If the requested module is not supported or the board is in MetaBoot mode
142144
*/

library/src/main/java/com/mbientlab/metawear/UnsupportedModuleException.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
* @author Eric Tsai
3030
*/
3131
public class UnsupportedModuleException extends Exception {
32+
private static final long serialVersionUID = -2869845467241050695L;
33+
3234
/**
3335
* Creates an exception with the given message
3436
* @param msg Data to accompany the exception

library/src/main/java/com/mbientlab/metawear/android/BtleService.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -608,18 +608,26 @@ public File findFile(String filename) {
608608
}
609609
return mwBoards.get(btDevice);
610610
}
611-
611+
/**
612+
* Removes the MetaWearBoard object associated with the BluetoothDevice object
613+
* @param btDevice BluetoothDevice object corresponding to the target MetaWear board
614+
*/
612615
public void removeMetaWearBoard(final BluetoothDevice btDevice) {
613616
mwBoards.remove(btDevice);
614617
}
615-
618+
/**
619+
* Removes the saved serialized state of the MetaWearBoard object associated with the BluetoothDevice object
620+
* @param btDevice BluetoothDevice object corresponding to the target MetaWear board
621+
*/
616622
public void clearSerializedState(final BluetoothDevice btDevice) {
617623
SharedPreferences.Editor editor= BtleService.this.getSharedPreferences(btDevice.getAddress(), MODE_PRIVATE).edit();
618624
editor.remove(MODULE_INFO);
619625
editor.remove(BOARD_STATE);
620626
editor.apply();
621627
}
622-
628+
/**
629+
* Removes cached firmware files from the Android device
630+
*/
623631
public void clearFirmwareCache() {
624632
File firmwareDir = new File(getFilesDir(), FIRMWARE_DIR_NAME);
625633
for(File it: firmwareDir.listFiles()) {
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
/** Android specific classes implementing the {@link com.mbientlab.metawear.impl.Platform} interface */
26+
package com.mbientlab.metawear.android;

library/src/main/java/com/mbientlab/metawear/builder/RouteElement.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ interface Action {
158158
RouteElement map(Function2 fn, String ... dataNames);
159159

160160
/**
161-
* Reduce the amount of data allowed through such that the output data rate matches the period
161+
* Reduce the amount of data allowed through such that the output data rate matches the delay
162162
* @param period How often to allow data through, in milliseconds (ms)
163163
* @return Object representing the output of the limiter
164164
*/

0 commit comments

Comments
 (0)