Code Monkey home page Code Monkey logo

obd2_ble's Introduction

OBD2_BLE

CI Status Version License Platform

OBD2_BLE is a Swift framework for interfacing with OBD-II devices using iOS Bluetooth Low Energy capabilities.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

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

pod "OBD2_BLE"

Usage

Initialization

import OBD2_BLE

...

let obd2 = OBD2_BLE.sharedInstance

OBD2_BLE is implemented as a Singleton class.

iOS BLE Background Processing

override func viewDidLoad() {
    super.viewDidLoad()
	
    OBD2_BLE.setup(restoreId: "myAppID.Bluetooth.RestoreID")
    let obd2 = OBD2_BLE.sharedInstance
}

Properties

iOS CoreBluetooth Objects
var centralManager: CBCentralManager!
var obd2: CBPeripheral?
var dataCharacteristic:CBCharacteristic?
obdCommands Dictionary
var obdCommands:[String: String]! = [
    "speed": "010D",
    "rpm": "010C",
    "engineLoad": "0104",
    "coolantTemp": "0105",
    "vin": "0902"
]

OBD-II PIDs

configurationCommands Dictionary
var configurationCommands = [
    "ATE0", // Echo Off
    "ATH0", // Headers Off
    "ATS0", // printing of Spaces Off
    "ATL0", // Linefeeds Off
    "ATSP0" // Set Protocol to 0 (Auto)
]

ELM327 AT Commands

Configuration

  • createCommand(name: String, command: String)

  • clearConfigurationCommands()

  • setConfigurationCommands(commands: [String])

  • addConfigurationCommands(commands: [String])

  • configureOBD()

Requesting Data

  • getVin()

  • getSpeed()

  • sendCommandNamed(name: String)

  • getVehicleInfo(vinNumber: String, completion: @escaping (_ vehicleInfo: [String: Any]) -> ())

Author

Nick Nordale, [email protected]

License

OBD2_BLE is available under the MIT license. See the LICENSE file for more info.

obd2_ble's People

Contributors

nicknordale avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.