Skip to content

Commit

Permalink
api v3.5.0 commit
Browse files Browse the repository at this point in the history
  • Loading branch information
scaryghost committed Jul 17, 2018
1 parent b5d9d75 commit fb62da2
Show file tree
Hide file tree
Showing 15 changed files with 611 additions and 90 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.android.tools.build:gradle:3.1.3'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 2 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ android {
defaultConfig {
minSdkVersion 18
targetSdkVersion 27
versionCode 57
versionName "3.4.7"
versionCode 58
versionName "3.5.0"
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright 2014-2018 MbientLab Inc. All rights reserved.
*
* IMPORTANT: Your use of this Software is limited to those specific rights granted under the terms of a software
* license agreement between the user who downloaded the software, his/her employer (which must be your
* employer) and MbientLab Inc, (the "License"). You may not use this Software unless you agree to abide by the
* terms of the License which can be found at www.mbientlab.com/terms. The License limits your use, and you
* acknowledge, that the Software may be modified, copied, and distributed when used in conjunction with an
* MbientLab Inc, product. Other than for the foregoing purpose, you may not use, reproduce, copy, prepare
* derivative works of, modify, distribute, perform, display or sell this Software and/or its documentation for any
* purpose.
*
* YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY
* OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
* NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MBIENTLAB OR ITS LICENSORS BE LIABLE OR
* OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE
* THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT,
* PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY,
* SERVICES, OR ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
*
* Should you have any questions regarding your right to use this Software, contact MbientLab via email:
* [email protected].
*/
package com.mbientlab.metawear;

/**
* Exception indicating that an invalid firmware file was attempted to be paired with the board
* @author Eric Tsai
*/
public class IllegalFirmwareFile extends Exception {
private static final long serialVersionUID = -6711055411857745594L;

public IllegalFirmwareFile(String message) {
super(message);
}
}
27 changes: 27 additions & 0 deletions library/src/main/java/com/mbientlab/metawear/MetaWearBoard.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;
import java.util.UUID;

import bolts.Task;
Expand Down Expand Up @@ -87,18 +88,44 @@ public interface MetaWearBoard {
*/
Task<DeviceInformation> readDeviceInformationAsync();

/**
* Retrieves the files needed to update the board to the specific firmware version.
* A connection must be first established before calling this function.
*
* When uploading the files, ensure that they are uploaded in the same order as the returned list
* @param version Firmware revision to download, null to retrieve the latest version
* @return Task containing the list of files to upload
*/
Task<List<File>> downloadFirmwareUpdateFilesAsync(String version);
/**
* Retrieves the files needed to update the board to the latest available firmware.
* A connection must be first established before calling this function.
* @return Task containing the list of files to upload
*/
Task<List<File>> downloadFirmwareUpdateFilesAsync();
/**
* Checks if a newer firmware version is available for the current board.
* A connection must be first established before calling this function.
* @return Task containing the version string, contains null if no update is available
*/
Task<String> findLatestAvailableFirmwareAsync();

/**
* Downloads the specific firmware release for the board to your local device. You must be connected to the
* board before calling this function.
* @param version Firmware revision to download, null to retrieve the latest version
* @return Task holding the file pointing to where the downloaded firmware resides on the local device
* @deprecated Since v3.5.0, use {@link #downloadFirmwareUpdateFilesAsync(String)} instead
*/
@Deprecated
Task<File> downloadFirmwareAsync(String version);
/**
* Downloads the latest firmware release for the board to your local device. You must be connected to the
* board before calling this function.
* @return Task holding the file pointing to where the downloaded firmware resides on the local device
* @deprecated Since v3.5.0, use {@link #downloadFirmwareUpdateFilesAsync()} instead
*/
@Deprecated
Task<File> downloadLatestFirmwareAsync();
/**
* Checks if there is a newer version of the firmware available for your board. The firmware check requires
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import android.util.Base64;
import android.util.Log;

import com.mbientlab.metawear.BuildConfig;
import com.mbientlab.metawear.MetaWearBoard;
import com.mbientlab.metawear.impl.JseMetaWearBoard;
import com.mbientlab.metawear.impl.platform.BtleGatt;
Expand Down Expand Up @@ -212,7 +213,7 @@ private class AndroidPlatform implements IO, BtleGatt {

AndroidPlatform(BluetoothDevice btDevice) {
this.btDevice = btDevice;
board = new JseMetaWearBoard(this, this, btDevice.getAddress());
board = new JseMetaWearBoard(this, this, btDevice.getAddress(), BuildConfig.VERSION_NAME);
}

void disconnected(int status) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ public AnyMotionConfigEditor threshold(float threshold) {
public void commit() {
if (count != null) {
motionConfig[0]&= 0xfc;
motionConfig[0]|= count - 1;
motionConfig[0]|= (count - 1) & 0x3;
}

if (threshold != null) {
Expand Down
Loading

0 comments on commit fb62da2

Please sign in to comment.