Latest 0.3.5
Homepage https://github.com/kinetic-fit/sensors-swift-kinetic
License MIT
Platforms ios 8.2, osx 10.11
Dependencies SwiftySensors, Signals
Authors

Kinetic Plugin for Swifty Sensors

iOS
macOS
Swift 3.0
License
CocoaPods

This Swifty Sensor plugin adds Services and Characteristics for Kinetic Sensors (inRide and Smart Control). It uses the Objective C Kinetic SDK (included) to serialize and deserialize the messages coming from the Kinetic sensors. An API key is required (create a free API key after you create an account at the Kinetic Dev Portal).

Installation

CocoaPods

use_frameworks!
pod 'SwiftySensors'
pod 'SwiftySensorsKinetic'

Manual

Copy all of the swift files in the Sources directory into you project. Also copy the Headers and Libraries directories. Include the appropriate lib for your project (libKineticSDKCocoa.a for macOS). You may need to add some includes to the header files in your Bridging Header (and create one if you don’t have one).

Swift Package Manager

This library is not compatible with Swift Package Manager yet. It relies upon Kinetic’s Objective C SDK library and Objective C libs are not supported in the SPM yet.

Usage

When setting up your SensorManager, simply add the Kinetic Services to the scan list.

import SwiftySensors
import SwiftySensorsKinetic

// Launch the Kinetic SDK with your API Key
KineticSDK.launch("INSERT API KEY HERE")

// Customize what services you want to scan for
SensorManager.instance.setServicesToScanFor([
    CyclingPowerService.self,
    ...
    InRide2Service.self,
    SmartControlService.self
])

The Kinetic inRide2 behaves a lot like a CyclingPowerService with some additional data and functionality (such as calibration).

The Kinetic Smart Control Service provides methods to control the Trainer:

// ERG Mode
let targetWatts: UInt16 = 150
smartControlService.setResistanceErg(targetWatts)

// Simulation Mode
let weight: Float = 85 // kgs
let rollingResistance: Float = 0.004 // asphault
let windResistance: Float = 0.6 // typical human
let grade: Float = 5 // ugh
let windSpeed: Float = 3  // meters / second headwind (negative for tail)
smartControlService.setSimulationMode(weight, rollingResistance: rollingResistance, windResistance: windResistance, grade: grade, windSpeed: windSpeed)

// Static Brake
let brakePercent: Float = 0.5 // 0 to 1
smartControlService.setResistanceBrake(brakePercent)

// Fluid Mode
let fluidMode: UInt8 = 2
smartControlService.setResistanceFluid(fluidMode)

Known bugs

None.

ToDos

Example iOS App needs calibration demo.

Latest podspec

{
    "name": "SwiftySensorsKinetic",
    "version": "0.3.5",
    "summary": "Kinetic Plugins for SwiftySensors",
    "homepage": "https://github.com/kinetic-fit/sensors-swift-kinetic",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Kinetic": "[email protected]"
    },
    "platforms": {
        "ios": "8.2",
        "osx": "10.11"
    },
    "source": {
        "git": "https://github.com/kinetic-fit/sensors-swift-kinetic.git",
        "tag": "0.3.5"
    },
    "source_files": [
        "Sources/**/*.swift",
        "Headers/*.h"
    ],
    "ios": {
        "vendored_libraries": "Libraries/libKineticSDK.a"
    },
    "osx": {
        "vendored_libraries": "Libraries/libKineticSDKCocoa.a"
    },
    "dependencies": {
        "SwiftySensors": [
            "~>0.3"
        ],
        "Signals": [
            "~> 4.0"
        ]
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This