Latest 1.0.1
Homepage https://github.com/BenWoodford/KeiserKit
License MIT
Platforms ios , requires ARC
Frameworks QuartzCore
Authors

You can find a sample project here

To start tracking bikes, you need to make a delegate that implements KKManagerDelegate, and then init KKManager:

KKManager *manager = [[KKManager alloc] initWithDelegate:yourDelegateClass];

You can start scanning straight away, but I’d recommend ensuring the Bluetooth state is on in bluetoothStateDidChange (in your delegate) and calling it from there:

- (void)bluetoothStateDidChange:(CBCentralManagerState)state withManager:(KKManager *)manager {
    if(state == CBCentralManagerStatePoweredOn) {
    [manager startScanningForBikes];
    } else {
        // There's many more [states to check for](https://developer.apple.com/library/IOs//documentation/CoreBluetooth/Reference/CBCentralManager_Class/index.html#//apple_ref/c/tdef/CBCentralManagerState) but this is a simple example.
    }
}

You can start scanning with [manager startScanningForBikes] or simulate bikes with [manager startSimulationWithBikes:aNumberOfBikes], the same methods will be called for updates either way.

bikeListUpdated is called when bikes are found, and provides their latest info. It’s recommended that you identify them to the user by the Bike ID, but internally make sure you use the UUID for any unique-identifying as the Bike ID is something set by the bike owner.

You can then follow a bike with [manager followBike:bikeObject] and then bikeListUpdated will stop being called and followedBikeDidUpdate will be called only for that bike.

Easy! Three method implementations and you’re tracking a single bike. You could of course track multiple bikes by never following a bike, but that’s probably a bit more niche.

Latest podspec

{
    "name": "KeiserKit",
    "version": "1.0.1",
    "summary": "Static Library for interfacing with the Keiser M3i Exercise Bike over Bluetooth Low Energy",
    "description": "Objective-C Library for reading data from the Keiser M3i Exercise Bike using CoreBluetooth for iOS.nnThis library provides scanning and bike simulation (for n bikes), through a few methods that provide all the necessary functionality to start working with the bikes.nNOTE: This library will not work in the background unfortunately. The M3i does not provide service/characteristic data and cannot be connected to, iOS only allows you to see a device's advertising data once in the background and has to search for a specific list of services/characteristics or connect to a device to get a stream of data.",
    "homepage": "https://github.com/BenWoodford/KeiserKit",
    "authors": {
        "Ben Woodford": "[email protected]"
    },
    "social_media_url": "http://twitter.com/IrregularExpr",
    "platforms": {
        "ios": null
    },
    "source": {
        "git": "https://github.com/BenWoodford/KeiserKit.git",
        "tag": "1.0.1"
    },
    "source_files": [
        "KeiserKit",
        "KeiserKit/**/*.{h,m}"
    ],
    "exclude_files": "Classes/Exclude",
    "frameworks": "QuartzCore",
    "public_header_files": "KeiserKit/**/*.h",
    "requires_arc": true,
    "license": "MIT"
}

Pin It on Pinterest

Share This