Skip to content

Commit fb62da2

Browse files
committed
api v3.5.0 commit
1 parent b5d9d75 commit fb62da2

File tree

15 files changed

+611
-90
lines changed

15 files changed

+611
-90
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
google()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.1.2'
9+
classpath 'com.android.tools.build:gradle:3.1.3'
1010

1111
// NOTE: Do not place your application dependencies here; they belong
1212
// in the individual module build.gradle files

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 27
34-
versionCode 57
35-
versionName "3.4.7"
34+
versionCode 58
35+
versionName "3.5.0"
3636
}
3737
buildTypes {
3838
release {
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright 2014-2018 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+
23+
*/
24+
package com.mbientlab.metawear;
25+
26+
/**
27+
* Exception indicating that an invalid firmware file was attempted to be paired with the board
28+
* @author Eric Tsai
29+
*/
30+
public class IllegalFirmwareFile extends Exception {
31+
private static final long serialVersionUID = -6711055411857745594L;
32+
33+
public IllegalFirmwareFile(String message) {
34+
super(message);
35+
}
36+
}

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import java.io.IOException;
3131
import java.io.InputStream;
3232
import java.io.OutputStream;
33+
import java.util.List;
3334
import java.util.UUID;
3435

3536
import bolts.Task;
@@ -87,18 +88,44 @@ public interface MetaWearBoard {
8788
*/
8889
Task<DeviceInformation> readDeviceInformationAsync();
8990

91+
/**
92+
* Retrieves the files needed to update the board to the specific firmware version.
93+
* A connection must be first established before calling this function.
94+
*
95+
* When uploading the files, ensure that they are uploaded in the same order as the returned list
96+
* @param version Firmware revision to download, null to retrieve the latest version
97+
* @return Task containing the list of files to upload
98+
*/
99+
Task<List<File>> downloadFirmwareUpdateFilesAsync(String version);
100+
/**
101+
* Retrieves the files needed to update the board to the latest available firmware.
102+
* A connection must be first established before calling this function.
103+
* @return Task containing the list of files to upload
104+
*/
105+
Task<List<File>> downloadFirmwareUpdateFilesAsync();
106+
/**
107+
* Checks if a newer firmware version is available for the current board.
108+
* A connection must be first established before calling this function.
109+
* @return Task containing the version string, contains null if no update is available
110+
*/
111+
Task<String> findLatestAvailableFirmwareAsync();
112+
90113
/**
91114
* Downloads the specific firmware release for the board to your local device. You must be connected to the
92115
* board before calling this function.
93116
* @param version Firmware revision to download, null to retrieve the latest version
94117
* @return Task holding the file pointing to where the downloaded firmware resides on the local device
118+
* @deprecated Since v3.5.0, use {@link #downloadFirmwareUpdateFilesAsync(String)} instead
95119
*/
120+
@Deprecated
96121
Task<File> downloadFirmwareAsync(String version);
97122
/**
98123
* Downloads the latest firmware release for the board to your local device. You must be connected to the
99124
* board before calling this function.
100125
* @return Task holding the file pointing to where the downloaded firmware resides on the local device
126+
* @deprecated Since v3.5.0, use {@link #downloadFirmwareUpdateFilesAsync()} instead
101127
*/
128+
@Deprecated
102129
Task<File> downloadLatestFirmwareAsync();
103130
/**
104131
* Checks if there is a newer version of the firmware available for your board. The firmware check requires

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import android.util.Base64;
4040
import android.util.Log;
4141

42+
import com.mbientlab.metawear.BuildConfig;
4243
import com.mbientlab.metawear.MetaWearBoard;
4344
import com.mbientlab.metawear.impl.JseMetaWearBoard;
4445
import com.mbientlab.metawear.impl.platform.BtleGatt;
@@ -212,7 +213,7 @@ private class AndroidPlatform implements IO, BtleGatt {
212213

213214
AndroidPlatform(BluetoothDevice btDevice) {
214215
this.btDevice = btDevice;
215-
board = new JseMetaWearBoard(this, this, btDevice.getAddress());
216+
board = new JseMetaWearBoard(this, this, btDevice.getAddress(), BuildConfig.VERSION_NAME);
216217
}
217218

218219
void disconnected(int status) {

library/src/main/java/com/mbientlab/metawear/impl/AccelerometerBoschImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ public AnyMotionConfigEditor threshold(float threshold) {
573573
public void commit() {
574574
if (count != null) {
575575
motionConfig[0]&= 0xfc;
576-
motionConfig[0]|= count - 1;
576+
motionConfig[0]|= (count - 1) & 0x3;
577577
}
578578

579579
if (threshold != null) {

0 commit comments

Comments
 (0)