Skip to content

Commit

Permalink
Merge branch 'release-2.10.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen Schiffli committed Oct 24, 2017
2 parents 329b091 + 8d4a2a2 commit 76c4eeb
Show file tree
Hide file tree
Showing 162 changed files with 10,132 additions and 9,779 deletions.
2 changes: 1 addition & 1 deletion Docs/gen_api_reference.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
appledoc -p "MetaWear iOS/macOS/tvOS API 2.9.0" --project-version "2.9.0" -c "MBIENTLAB INC" --company-id com.mbientlab --no-create-docset --no-repeat-first-par --ignore .m -o . ../MetaWear/Classes
appledoc -p "MetaWear iOS/macOS/tvOS API 2.10.0" --project-version "2.10.0" -c "MBIENTLAB INC" --company-id com.mbientlab --no-create-docset --no-repeat-first-par --ignore .m -o . ../MetaWear/Classes
open html/index.html

make html
Expand Down
2 changes: 1 addition & 1 deletion Docs/source/advanced_features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The properties of the configuration objected are automatically persisted to disk
Updating Firmware
-----------------

The firmware running on the MetaWear is periodically updated by MbientLab with additional features and bug-fixes. To update, you first call a MetaWear API which puts the device in a special bootloader mode, then use the Nordic Semiconductor `IOS-DFU-Librarly <https://github.com/NordicSemiconductor/IOS-DFU-Library>`_ to upload the new firmware. We recommend looking at our `Sample App <https://github.com/mbientlab/Metawear-SampleiOSApp>`_ for an example on how to integrate.
The firmware running on the MetaWear is periodically updated by MbientLab with additional features and bug-fixes. To update, you first call a MetaWear API which puts the device in a special bootloader mode, then use the Nordic Semiconductor `IOS-DFU-Librarly <https://github.com/NordicSemiconductor/IOS-DFU-Library>`_ to upload the new firmware. We recommend looking at our `Sample App <https://github.com/mbientlab/MetaWear-SampleApp-iOS>`_ for an example on how to integrate.

This is one API you can call WITHOUT being connected, there are some cases where you can't connect because the firmware is too old, but you still need to be able to update it!

Expand Down
4 changes: 2 additions & 2 deletions Docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
# built documents.
#
# The short X.Y version.
version = '2.9.0'
version = '2.10.0'
# The full version, including alpha/beta/rc tags.
release = '2.9.0'
release = '2.10.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion Docs/source/gen_api_reference.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
appledoc -p "MetaWear iOS/macOS/tvOS API 2.9.0" --project-version "2.9.0" -c "MBIENTLAB INC" --company-id com.mbientlab --no-create-docset --no-repeat-first-par --ignore .m -o . ../MetaWear/Classes
appledoc -p "MetaWear iOS/macOS/tvOS API 2.10.0" --project-version "2.10.0" -c "MBIENTLAB INC" --company-id com.mbientlab --no-create-docset --no-repeat-first-par --ignore .m -o . ../MetaWear/Classes
open html/index.html

make html
Expand Down
25 changes: 20 additions & 5 deletions Docs/source/metawearboard.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@ Bluetooth LE Connection
-----------------------
Before using any API features, you must first connect to the board with `connectAsync <https://mbientlab.com/docs/metawear/ios/latest/Classes/MBLMetaWear.html#//api/name/connectAsync>`_. The returned task will finish when a connection has been established and the ``MBLMetaWear`` state has been initialized. ::

device.connectAsync().success { _ in
print("Connected")
}.failure { error in
print("Failed to connect", error)
device.connectAsync().continueOnDispatch { t in
if t.isCancelled {
print("disconnectAsync() called before connection completed")
} else if t.isFaulted {
print("Connection Error: \(t.error?.localizedDescription ?? "N/A")")
} else {
print("Connection Success")
}
return t
}

There is also a convenient `connectWithTimeoutAsync <https://mbientlab.com/docs/metawear/ios/latest/Classes/MBLMetaWear.html#//api/name/connectWithTimeoutAsync:>`_ which will finish when the connection is complete, or timeout seconds have passed. If a timeout occurs, the task will get an error of kMBLErrorDomain and kMBLErrorConnectionTimeout code. ::
Expand Down Expand Up @@ -106,7 +111,7 @@ Since we do not support using a single MetaWear device with multiple application
Identifier
----------

Apple generates a unique identifier for each BLE device. Note, two different Apple devices will generate two different identifiers for the same MetaWear.
Apple generates a unique identifier for each BLE device. Note, two different Apple devices will generate two different identifiers for the same MetaWear. It might be useful to use ``device.mac`` instead.

::

Expand All @@ -129,3 +134,13 @@ MetaWear modules, represented by the `MBLModule <https://mbientlab.com/docs/meta
* Requested module is not supported on the board
* Board is in MetaBoot mode
* Has not yet connected

Sleep Mode
----------

Use the ``sleepModeOnReset`` function to put the device in a low-power sleep mode after the next reset. To wake the device back up you can press the button, connect usb power (latest models only), or remove and reconnect the coin cell battery.

::

[device sleepModeOnReset];
[device resetDevice];
3 changes: 2 additions & 1 deletion Docs/source/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,11 @@ Event representing a BLE disconnection event. Note this doesn't make sense to s
MAC Address
-----------

Get the MAC address of the MetaWear.
Get the MAC address of the MetaWear. As of SDK 2.10.0 this is now automaticaly cached upon connection and avaliable at ``device.mac``.

::

print(device.mac)
device.settings?.macAddress?.readAsync().success { mac in
print(mac)
}
Expand Down
2 changes: 1 addition & 1 deletion MetaWear.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'MetaWear'
s.version = '2.9.0'
s.version = '2.10.0'
s.license = { :type => 'Commercial', :text => 'See https://www.mbientlab.com/terms/', :file => 'LICENSE' }
s.homepage = 'https://mbientlab.com'
s.summary = 'iOS/macOS/tvOS API and documentation for the MetaWear platform'
Expand Down
2 changes: 1 addition & 1 deletion MetaWear/Classes/Categories/BFTask+MBLExtensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,6 @@ typedef __nullable id(^MBLExtensionsContinuationBlock)(BFTask<ResultType> *t);
@end


extern void MBLForceLoadCategory_BFTask_MBLExtensions();
extern void MBLForceLoadCategory_BFTask_MBLExtensions(void);

NS_ASSUME_NONNULL_END
2 changes: 1 addition & 1 deletion MetaWear/Classes/Categories/BFTask+MBLExtensions.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ + (BFExecutor *)dispatchExecutor
static BFExecutor *singleton;
static dispatch_once_t onceToken = 0;
dispatch_once(&onceToken, ^{
singleton = [BFExecutor executorWithBlock:^void(void(^block)()) {
singleton = [BFExecutor executorWithBlock:^void(void(^block)(void)) {
[[MBLMetaWearManager dispatchQueue] addOperationWithBlock:block];
}];
});
Expand Down
50 changes: 50 additions & 0 deletions MetaWear/Classes/Core/MBLAnonymousEvent.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* MBLAnonymousEvent.h
* MetaWear
*
* Created by Stephen Schiffli on 9/22/17.
* Copyright 2017 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: hello@mbientlab.com
*/

#import <MetaWear/MBLEvent.h>
@class MBLDataSample;

/**
Pared down variant of the MBLEvent interface that can only be used to
retrieve logged data from a board that was programmed elsewhere.
*/
@interface MBLAnonymousEvent : MBLEvent<MBLDataSample *>

/*
String identifying the data producer chain
*/
@property (nonatomic, readonly, nullable) NSString *identifier;

@end
99 changes: 99 additions & 0 deletions MetaWear/Classes/Core/MBLAnonymousEvent.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/**
* MBLAnonymousEvent.m
* MetaWear
*
* Created by Stephen Schiffli on 9/22/17.
* Copyright 2017 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: hello@mbientlab.com
*/

#import "MBLAnonymousEvent+Private.h"
#import "MBLEvent+Private.h"
#import "MBLMetaWear+Private.h"
#import "MBLRegister+Private.h"

@implementation MBLAnonymousEvent

@dynamic identifier;

- (instancetype)initWithRegister:(MBLRegister *)reg
{
self = [super initWithModule:reg.module registerId:reg.registerId index:reg.index format:reg.format identifier:reg.identifier];
return self;
}

- (BFTask *)downloadLogAndStopLoggingAsync:(BOOL)stopLogging remainingHandler:(MBLLogProgressHandler)progressHandler
{
MBLMetaWear *device = self.module.device;
if (device.state != MBLConnectionStateConnected) {
NSError *error = [NSError errorWithDomain:kMBLErrorDomain
code:kMBLErrorNotConnected
userInfo:@{NSLocalizedDescriptionKey : @"MetaWear not connected, can't perform operation. Please connect to MetaWear before downloading log."}];
return [BFTask taskWithError:error];
}
[device incrementCount];
return [[device.logging downloadLogEvents:self progressHandler:progressHandler] continueOnMetaWearWithBlock:^id _Nullable(BFTask * _Nonnull task) {
[device decrementCount];
return task;
}];
}

+ (BFTask *)mustLogError
{
return [BFTask taskWithError:[NSError errorWithDomain:kMBLErrorDomain
code:kMBLErrorOperationInvalid
userInfo:@{NSLocalizedDescriptionKey : @"You can only download log data from anonymous events, please call downloadLogAndStopLoggingAsync:"}]];
}

- (BFTask *)startNotificationsWithHandlerAsync:(MBLNotificationHandler)handler
{
return [MBLAnonymousEvent mustLogError];
}

- (BFTask *)stopNotificationsAsync
{
return [MBLAnonymousEvent mustLogError];
}

- (BFTask *)programCommandsToRunOnEventAsync:(MBLVoidHandler)block
{
return [MBLAnonymousEvent mustLogError];
}

- (BFTask *)eraseCommandsToRunOnEventAsync
{
return [MBLAnonymousEvent mustLogError];
}

- (BFTask *)startLoggingAsync
{
return [MBLAnonymousEvent mustLogError];
}

@end
11 changes: 3 additions & 8 deletions MetaWear/Classes/Core/MBLConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ typedef NS_ENUM(uint8_t, MBLFirmwareVersion) {
MBLFirmwareVersion1_3_1,
MBLFirmwareVersion1_3_2,
MBLFirmwareVersion1_3_3,
MBLFirmwareVersion1_3_4
MBLFirmwareVersion1_3_4,
MBLFirmwareVersion1_3_5
};
NSString *MBLFirmwareVersionString(MBLFirmwareVersion version);

Expand Down Expand Up @@ -122,7 +123,7 @@ NSString *MBLCalibrationAccuracyString(MBLCalibrationAccuracy accuracy);

#pragma mark - Block Typedefs

typedef void (^MBLVoidHandler)();
typedef void (^MBLVoidHandler)(void);
typedef void (^MBLErrorHandler)(NSError *__nullable error);
typedef void (^MBLDataHandler)(NSData *__nullable data, NSError *__nullable error);
typedef void (^MBLObjectHandler)(id __nullable obj, NSError *__nullable error);
Expand Down Expand Up @@ -204,10 +205,4 @@ extern NSInteger const kMBLErrorBluetoothUnsupported;
/*! @abstract 117: The application is not authorized to use the Bluetooth Low Energy Central/Client role.*/
extern NSInteger const kMBLErrorBluetoothUnauthorized;

/*! @abstract 118: Requested a disconnect while a connection was in progress .*/
extern NSInteger const kMBLErrorDisconnectRequested;

/*! @abstract 119: DFU service was found during a connection .*/
extern NSInteger const kMBLErrorDFUServiceFound;

NS_ASSUME_NONNULL_END
6 changes: 3 additions & 3 deletions MetaWear/Classes/Core/MBLConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#import "MBLConstants.h"
#import "MBLConstants+Private.h"

NSString *const kMBLAPIVersion = @"2.9.0";
NSString *const kMBLAPIVersion = @"2.10.0";

NSString *MBLFirmwareVersionString(MBLFirmwareVersion version)
{
Expand Down Expand Up @@ -77,6 +77,8 @@
return @"1.3.3";
case MBLFirmwareVersion1_3_4:
return @"1.3.4";
case MBLFirmwareVersion1_3_5:
return @"1.3.5";
}
}

Expand Down Expand Up @@ -146,8 +148,6 @@
NSInteger const kMBLErrorBluetoothPoweredOff = 115;
NSInteger const kMBLErrorBluetoothUnsupported = 116;
NSInteger const kMBLErrorBluetoothUnauthorized = 117;
NSInteger const kMBLErrorDisconnectRequested = 118;
NSInteger const kMBLErrorDFUServiceFound = 119;


static const uint8_t simulatorKey;
Expand Down
15 changes: 11 additions & 4 deletions MetaWear/Classes/Core/MBLData.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,24 @@

@implementation MBLData

- (instancetype)initWithModule:(MBLModule *)module registerId:(uint8_t)registerId index:(uint8_t)index format:(MBLFormat *)format
- (instancetype)initWithModule:(MBLModule *)module registerId:(uint8_t)registerId index:(uint8_t)index format:(MBLFormat *)format identifier:(nullable NSString *)identifier
{
self = [super initWithModule:module registerId:registerId index:index format:format];
self = [super initWithModule:module registerId:registerId index:index format:format identifier:identifier];
if (self) {
}
return self;
}

- (instancetype)initWithModule:(MBLModule *)module registerId:(uint8_t)registerId format:(MBLFormat *)format identifier:(NSString *)identifier
{
return [self initWithModule:module registerId:registerId index:0xFF format:format identifier:identifier];
}
- (instancetype)initWithModule:(MBLModule *)module registerId:(uint8_t)registerId index:(uint8_t)index format:(MBLFormat *)format
{
return [self initWithModule:module registerId:registerId index:index format:format identifier:nil];
}
- (instancetype)initWithModule:(MBLModule *)module registerId:(uint8_t)registerId format:(MBLFormat *)format
{
return [self initWithModule:module registerId:registerId index:0xFF format:format];
return [self initWithModule:module registerId:registerId index:0xFF format:format identifier:nil];
}

- (BFTask *)simulatedReadAsync:(BOOL)isLocal
Expand Down
2 changes: 1 addition & 1 deletion MetaWear/Classes/Core/MBLEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ typedef void (^MBLNotificationHandler)(ResultType __nullable obj, NSError *__nul
@param depth Number of samples to average (works fastest if a power of 2)
@returns New event representing average of input
*/
- (MBLFilter<ResultType> *)highPassOfEventWithDepth:(uint8_t)depth;
- (nullable MBLFilter<ResultType> *)highPassOfEventWithDepth:(uint8_t)depth;

/**
Create a new event that compares the current event's value to one or more data points
Expand Down
15 changes: 11 additions & 4 deletions MetaWear/Classes/Core/MBLEvent.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,27 @@ @interface MBLEvent ()

@implementation MBLEvent

- (instancetype)initWithModule:(MBLModule *)module registerId:(uint8_t)registerId index:(uint8_t)index format:(MBLFormat *)format
- (instancetype)initWithModule:(MBLModule *)module registerId:(uint8_t)registerId index:(uint8_t)index format:(MBLFormat *)format identifier:(nullable NSString *)identifier
{
self = [super initWithModule:module registerId:registerId index:index format:format];
self = [super initWithModule:module registerId:registerId index:index format:format identifier:identifier];
if (self) {
self.loggingIds = [NSMutableArray array];
self.commandIds = [NSMutableArray array];
self.commandActivatedRegisters = [NSMutableArray array];
}
return self;
}

- (instancetype)initWithModule:(MBLModule *)module registerId:(uint8_t)registerId format:(MBLFormat *)format identifier:(NSString *)identifier
{
return [self initWithModule:module registerId:registerId index:0xFF format:format identifier:identifier];
}
- (instancetype)initWithModule:(MBLModule *)module registerId:(uint8_t)registerId index:(uint8_t)index format:(MBLFormat *)format
{
return [self initWithModule:module registerId:registerId index:index format:format identifier:nil];
}
- (instancetype)initWithModule:(MBLModule *)module registerId:(uint8_t)registerId format:(MBLFormat *)format
{
return [self initWithModule:module registerId:registerId index:0xFF format:format];
return [self initWithModule:module registerId:registerId index:0xFF format:format identifier:nil];
}

- (nonnull BFTask *)startNotificationsWithHandlerAsync:(nullable MBLObjectHandler)handler
Expand Down
Loading

0 comments on commit 76c4eeb

Please sign in to comment.