Multiple MetaWear Support
Version 1.3 adds support to connect to multiple MetaWear boards, and new features and bug fixes for the temperature, gpio, haptic, and metawear service/controller classes. There are some changes to the API that users will want to carefully look over when using the release. A blog post detailing how to connect to multiple boards with the API is available on our project's page
Features
- Support to communicate with multiple MetaWear boards
- Thermistor mode for the temperature module
- GPIO pin state notifications
- Callback function to notify the user of GATT errors
- Fixed bug that would falsely report non-existent ble device is connected on Android 4.4 devices
- Fixed bug with the buzzer code
Known Issues
- BluetoothGatt is not properly freed when the board disconnects on its own (i.e. out of range, pulled power etc.). This results in the gatt callbacks being called multiple times if you discard the internal state (with MetaWearController.setRetainState(false)) and reconnect to the board.
- Work around is to either opt to retain the internal state, or use the same MetaWearController reference to close or reconnect to the board instead of retrieving a new controller form MetaWearBleService.getMetaWearController(BluetoothDevice)
Build Changes
- Depends on Android Support Library for use of LocalBroadcastManager
- Library is available in the Android SDK Manager, under the "Extras" section
Code Changes
Haptic
- Fixed issue with the startBuzzer implementation which resulted from using the incorrect duty cycle value
- Added another startMotor function to set the dutyCycle percentage
GPIO
- Added functions to support pin state change notifications: setPinChangeType, enablePinChangeNotification, disablePinChangeNotification
- Added pinChangeDetected callback function that is called when the pin state changes
Temperature
- Added functions to support for thermistor mode: enableThermistorMode, disableThermistorMode
- Thermister mode uses the thermistor to read the temperature rather than the onboard temperature chip
- Temperature is still reported through the receivedTemperature callback function
MetaWearController
- Added setRetainState and clearCallbacks
- Added receivedGattError function to the DeviceCallbacks class
- Function is called when a non-zero status is returned in a Gatt callback function
- Added connect, close, and reconnect
- Ffunctions are replacements for their respective functions in the mw ble service class
MetaWearBleService
- Added useLocalBroadcasterManager to use the LocalBroadcastManager class to broadcast the intents
- Deprecated close, connect, and reconnect
- New versions are in the MetaWearController
- Deprecated getMetaWearController
- Replaced with variant that takes a BluetoothDevice as a parameter
- Controller returned by variant function supports new connect, close, and reconnect functions
- Deprecated disconnect
- Disconnect is replaced with the close function in the MetaWearController interface