This document describes the interface for the OpenXC library version 6.0.
Vehicle data is accessed after adding the framework to the demo app. Both of these can be found in openxc-ios-library.
You must first create an object of VehicleManager and set targets before you can receive any vehicle data.
VehicleManager is a singleton class, so instantiate using shared instance in viewDidLoad():
This will require you to import OpenXC framework in your class:
While setting up the callbacks, set the action as a method in viewDidLoad():
Once the callbacks are set and you have a connection to it in your controller, you can start sending and receiving messages with the vehicle interface.
The VehicleMessage is the parent of all message sent to and from the vehicle interface. You can register to receive asynchronous updates for anything from all receive messages to only those matching a certain key. All of the examples here show how to receive updates for more specific subtypes, but you do have the option of interfacing directly with VehicleMessages.
If the attached VI is sending low-level CAN messages, you can receive them in your iOS application.
First, grab the VehicleManager instance and then set the callback:
The callback method will receive the CAN message in the form on dictionary (key-value pairs):
To clear the default can target:
First, grab the VehicleManager instance and then set the callback:
The callback method will receive the Diagnostic response in the form on dictionary (key-value pairs):
You can also send the request:
To clear the default target:
The commands defined in the OpenXC message
format that are
supported by your VI firmware can be sent using a Command
message type.
To send a command and wait to receive a response:
For commands that don’t require any data in the request you can use:
For commands that require any data in the request you can use:
The callback method will receive the Commands response in the form on dictionary (key-value pairs):
If you need to be kept up-to-date on any vehicle measurement, you can set callbacks to be notified of updates.
First, grab the VehicleManager instance and then set the callback:
The callback method will receive the measurement in the form on dictionary (key-value pairs):