spencercap / MetaWear-SDK-iOS-macOS-tvOS

MetaMotion / MetaWear Swift SDK for iOS/macOS/tvOS

Home Page:https://mbientlab.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MetaWear SDK for iOS/macOS/tvOS/watchOS by MBIENTLAB

Platforms License Version

alt tag

SDK for creating MetaWear apps that run in the Apple ecosystem. This is a thin wrapper around the MetaWear C++ API so you will find the C++ documentation and API reference useful.

Overview

MetaWear is a complete development and production platform for wearable and connected device applications.

MetaWear features a number of sensors and peripherals all easily controllable over Bluetooth 4.0 Low Energy using this SDK, no firmware or hardware experience needed!

The MetaWear hardware comes pre-loaded with a wirelessly upgradeable firmware, so it keeps getting more powerful over time.

Requirements

REQUIREMENT NOTES
The iOS simulator doesn’t support Bluetooth 4.0, so test apps must be run on a real iOS device which requires a developer account. Bluetooth 4.0 available on iPhone 4S+, iPad 3rd generation+, or iPod Touch 5th generation.

License

See the License

Support

Reach out to the community if you encounter any problems, or just want to chat :)

Getting Started

Installation

MetaWear is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "MetaWear", :subspecs => ['UI', 'AsyncUtils', 'Mocks', 'DFU']

For first time CocoaPods users we have a detailed video guide.

Simple API Test

Here is a walkthrough to showcase a very basic connect and toggle LED operation.

First, import the framework header files like this:

import MetaWear
import MetaWearCpp

Then add the following code wherever appropriate to make the LED flash green:

MetaWearScanner.shared.startScan(allowDuplicates: true) { (device) in
    // We found a MetaWear board, see if it is close
    if device.rssi.intValue > -50 {
        // Hooray! We found a MetaWear board, so stop scanning for more
        MetaWearScanner.shared.stopScan()
        // Connect to the board we found
        device.connectAndSetup().continueWith { t in
            if let error = t.error {
                // Sorry we couldn't connect
                print(error)
            } else {
                // Hooray! We connected to a MetaWear board, so flash its LED!
                var pattern = MblMwLedPattern()
                mbl_mw_led_load_preset_pattern(&pattern, MBL_MW_LED_PRESET_PULSE)
                mbl_mw_led_stop_and_clear(device.board)
                mbl_mw_led_write_pattern(device.board, &pattern, MBL_MW_LED_COLOR_GREEN)
                mbl_mw_led_play(device.board)
            }
        }
    }
}

Now run the app!

BLUETOOTH IS NOT SUPPORTED IN THE SIMULATOR

About

MetaMotion / MetaWear Swift SDK for iOS/macOS/tvOS

https://mbientlab.com

License:Other


Languages

Language:Swift 90.6%Language:Objective-C 7.7%Language:Ruby 1.5%Language:Shell 0.2%