RVS_BTDriver_Device_OBD_ELM327

class RVS_BTDriver_Device_OBD_ELM327 : RVS_BTDriver_Device_OBD
extension RVS_BTDriver_Device_OBD_ELM327: RVS_BTDriver_OBD_ELM327_DeviceProtocol

This is a specialization of the device for OBD ELM327 Devices.

RVS_BTDriver_OBD_ELM327_DeviceProtocol Support

  • This will hold the ELM327 version string.

    Declaration

    Swift

    public var elm327Version: String

Internal Static Properties

  • This is the command that we send to retrieve the version.

    Declaration

    Swift

    internal static let crlf: String
  • This is the command that we send to retrieve the version.

    Declaration

    Swift

    internal static let initialQueryCommand: String
  • This is the minimum supported ELM version.

    Declaration

    Swift

    internal static let minimumELMVersion: Float
  • This is set to true, once we have explicitly set the echo on.

    Declaration

    Swift

    internal var echoTurnedOn: Bool

Internal Computed Properties

  • This returns an easy-to-display description string

    Declaration

    Swift

    public override var description: String { get }
  • This method should be called after all setup has been done, so that subclasses can do what needs doing. We use it to send an initial “ATZ” command.

    Declaration

    Swift

    internal override func initialSetup()

Base Class Override

  • This is a NOP, because we fetch the ELM version before closing the books.

    This needs to be done here, because we are overriding a non-objC method.

    Declaration

    Swift

    internal override func reportCompletion()

CBPeripheralDelegate Support

  • Declaration

    Swift

    internal override func peripheral(_ inPeripheral: CBPeripheral, didUpdateValueFor inCharacteristic: CBCharacteristic, error inError: Error?)

    Parameters

    inPeripheral

    The peripheral that owns this service.

    didUpdateValueFor

    The characteristic that was updated.

    error

    Any error that may have occurred. It can be nil.

General

  • Return the device description

    Declaration

    Swift

    public func getDeviceDescription()
  • Return the device ID

    Declaration

    Swift

    public func getDeviceIdentifier()
  • Set the device ID

    Declaration

    Swift

    public func setDeviceIdentifier(_ id: String)

    Parameters

    id

    A String, with up to 12 ASCII characters.

  • Set the Baud Rate Divisor

    Declaration

    Swift

    public func setBaudRateDivisor(_ divisor: UInt8)

    Parameters

    divisor

    0-255, unsigned 8-bit integer.

  • Set the Baud Rate Rate Handshake Timeout

    Declaration

    Swift

    public func setBaudRateHandshakeTimeout(_ timeout: UInt8)

    Parameters

    timeout

    0-255, unsigned 8-bit integer.

  • Restore the OBD Device to Defaults

    Declaration

    Swift

    public func restoreToDefaults()
  • Turn echo on

    Declaration

    Swift

    public func turnEchoOn()
  • Turn Echo Off

    We block this from the public, as we don’t want to turn off the echo.

    Declaration

    Swift

    internal func turnEchoOff()
  • Flush All Events

    Declaration

    Swift

    public func flushAllEvents()
  • Return the unit ID

    Declaration

    Swift

    public func getID()
  • Turn on Linefeeds

    Declaration

    Swift

    public func turnLinefeedsOn()
  • Turn Off Linefeeds

    Declaration

    Swift

    public func turnLinefeedsOff()
  • Turn On Low Power Mode

    Declaration

    Swift

    public func turnLowPowerModeOn()
  • Turn On Memory

    Declaration

    Swift

    public func turnMemoryOn()
  • Turn Off Memory

    Declaration

    Swift

    public func turnMemoryOff()
  • Return Stored Data In Memory

    Declaration

    Swift

    public func fetchStoredData()
  • Store 1 Byte of Data in Memory

    Declaration

    Swift

    public func storeData(_ data: UInt8)

    Parameters

    data

    0-255, unsigned 8-bit integer.

  • Perform a “Warm Start”

    Declaration

    Swift

    public func warmStart()
  • Reset All

    Declaration

    Swift

    public func resetAll()

OBD

  • Use Long (>7 Byte) Messages

    Declaration

    Swift

    public func useLongMessages()
  • Use Short (<= 7 Byte) Messages

    Declaration

    Swift

    public func useShortMessages()
  • Enable Automatic Receive

    Declaration

    Swift

    public func autoReceive()
  • Enable Adaptive Timing Auto Mode 1

    Declaration

    Swift

    public func useAdaptiveTimingMode1()
  • Enable Adaptive Timing Auto Mode 1

    Declaration

    Swift

    public func useAdaptiveTimingMode2()
  • Turn Adaptive Timing Off

    Declaration

    Swift

    public func turnAdaptiveTimingOff()
  • Return a Buffer Dump

    Declaration

    Swift

    public func bufferDump()
  • Bypass the Initialization Sequence

    Declaration

    Swift

    public func bypassInitialization()
  • Describe the Current Protocol

    Declaration

    Swift

    public func describeCurrentProtocol()
  • Describe the Current Protocol as a Number

    Declaration

    Swift

    public func describeProtocolByNumber()
  • Turn Headers On

    Declaration

    Swift

    public func turnHeadersOn()
  • Turn Headers Off

    Declaration

    Swift

    public func turnHeadersOff()
  • Monitor All

    Declaration

    Swift

    public func monitorAll()
  • Set the Monitor for Receiver

    Declaration

    Swift

    public func setMonitorForReceiver(_ monitor: UInt8)

    Parameters

    monitor

    0-255 (8-bit unsigned integer)

  • Set the Monitor for Transmitter

    Declaration

    Swift

    public func setMonitorForTransmitter(_ monitor: UInt8)

    Parameters

    monitor

    0-255 (8-bit unsigned integer)

  • Set the Protocol

    Declaration

    Swift

    public func setProtocol(_ protocolNumber: UInt8)

    Parameters

    protocolNumber

    0-7 (unsigned integer)

  • Set Protocol (Alternate Try)

    Declaration

    Swift

    public func setProtocol2(_ protocolNumber: UInt8)

    Parameters

    protocolNumber

    0-7 (unsigned integer)

  • Set Auto Protocol (1 hex Digit)

    Declaration

    Swift

    public func setAutoProtocol(_ protocolNumber: UInt8)

    Parameters

    protocolNumber

    0-7 (unsigned integer)

  • Set Auto Protocol (Alternate Try)

    Declaration

    Swift

    public func setAutoProtocol2(_ protocolNumber: UInt8)

    Parameters

    protocolNumber

    0-7 (unsigned integer)

  • Use Auto Protocol

    Declaration

    Swift

    public func useAutoProtocol()
  • Close the Protocol

    Declaration

    Swift

    public func closeProtocol()
  • Turn Responses On

    Declaration

    Swift

    public func turnResponsesOn()
  • Turn Responses Off

    Declaration

    Swift

    public func turnResponsesOff()
  • Set the Receive Address

    Declaration

    Swift

    public func setReceiveAddress(_ address: UInt8)

    Parameters

    address

    0-255 (8-bit unsigned integer)

  • Set the Receive Address (Alternate Command)

    Declaration

    Swift

    public func setReceiveAddress2(_ address: UInt8)

    Parameters

    address

    0-255 (8-bit unsigned integer)

  • Turn On Print Spaces

    Declaration

    Swift

    public func turnPrintSpacesOn()
  • Turn Off Print Spaces

    Declaration

    Swift

    public func turnPrintSpacesOff()
  • Set Header

    Declaration

    Swift

    public func setHeader(_ pref: UInt8, _ value: UInt8)

    Parameters

    pref

    Prefix 0-7

    value

    0-255

  • Set Header

    Declaration

    Swift

    public func setHeader(_ value1: UInt8, _ value2: UInt8, _ value3: UInt8)

    Parameters

    value1

    0-255

    value2

    0-255

    value3

    0-255

  • Set Standard (J1978) Search Order

    Declaration

    Swift

    public func useStandardSearchOrder()
  • Set Tester Address

    Declaration

    Swift

    public func setTesterAddress(_ address: UInt8)

    Parameters

    address

    0-255 (8-bit unsigned integer)

  • Set Timeout to Multiples of 4ms

    Declaration

    Swift

    public func setTimeOutBy4MillisecondIntervals(_ timeout: UInt8)

    Parameters

    timeout

    0-255 (8-bit unsigned integer)

CAN

  • Turn CAN Auto-Formatting On

    Declaration

    Swift

    public func turnCANAutoFormattingOn()
  • Turn CAN Auto-Formatting Off

    Declaration

    Swift

    public func turnCANAutoFormattingOff()
  • Turn on CAN Extended Addressing, and Set it to the Given Value

    Declaration

    Swift

    public func setCANExtendedAddressing(_ address: UInt8)

    Parameters

    address

    0-255 (8-bit unsigned integer)

  • Turn CAN Extended Addressing Off

    Declaration

    Swift

    public func turnOffCANExtendedAddressing()
  • Set the ID Filter

    • paramater pref: Prefix 0-7

    Declaration

    Swift

    public func setIDFilter(_ pref: UInt8, _ value: UInt8)

    Parameters

    value

    0-255

  • Set the ID Filter

    Declaration

    Swift

    public func setIDFilter(_ value1: UInt8, _ value2: UInt8, _ value3: UInt8, _ value4: UInt8)

    Parameters

    value1

    0-255

    value2

    0-255

    value3

    0-255

    value4

    0-255

  • Turn CAN Flow Control On

    Declaration

    Swift

    public func turnCANFlowControlOn()
  • Turn CAN Flow Control Off

    Declaration

    Swift

    public func turnCANFlowControlOff()
  • Turn CAN Silent Mode On

    Declaration

    Swift

    public func turnCANSilentModeOn()
  • Turn CAN Silent Mode Off

    Declaration

    Swift

    public func turnCANSilentModeOff()
  • Turn DLC Display On

    Declaration

    Swift

    public func turnDLCDisplayOn()
  • Turn DLC Display Off

    Declaration

    Swift

    public func turnDLCDisplayOff()
  • Set the CAN Flow Control Data

    Declaration

    Swift

    public func setFlowControlData(_ inValues: [UInt8])

    Parameters

    inValues

    Up to 5 values of 0-255

  • Set the CAN Flow Control Header

    Declaration

    Swift

    public func setFlowControlHeader(_ value1: UInt8, _ value2: UInt8, _ value3: UInt8, _ value4: UInt8)

    Parameters

    value1

    0-255

    value2

    0-255

    value3

    0-255

    value4

    0-255

  • Set the CAN Flow Control Mode

    Declaration

    Swift

    public func setFlowControlMode(_ mode: UInt8)

    Parameters

    mode

    0-7

  • Set the Protocol B Options and Baud Rate

    Declaration

    Swift

    public func setProtocolBOptionsAndBaudRate(_ options: UInt8, _ baudRate: UInt8)

    Parameters

    options

    0-255

    baudRate

    0-255

  • Send an RTR Message

    Declaration

    Swift

    public func rtrMessage()
  • Turn the Variable DLC On

    Declaration

    Swift

    public func turnVariableDLCOn()
  • Turn the Variable DLC Off

    Declaration

    Swift

    public func turnVariableDLCOff()

Volts

  • Set the Calibration Volts

    Declaration

    Swift

    public func setCalibratingVoltage(_ value: Float)

    Parameters

    value

    Calibrating voltage.

  • Reset the Calibration Voltage

    Declaration

    Swift

    public func resetCalibratingVoltage()

J1939

  • Monitor for DM1 Messages

    Declaration

    Swift

    public func monitorForDM1Messages()
  • Use ELM Data Format

    Declaration

    Swift

    public func useElmDataFormat()
  • Use SAE Data Format

    Declaration

    Swift

    public func useSAEDataFormat()
  • Turn Header Formatting On

    Declaration

    Swift

    public func turnJ1939HeaderFormattingOn()
  • Turn Header Formatting Off

    Declaration

    Swift

    public func turnJ1939HeaderFormattingOff()
  • Use the 1X Timer Multiplier

    Declaration

    Swift

    public func use1XTimerMultiplier()
  • Use the 5X Timer Multiplier

    Declaration

    Swift

    public func use5XTimerMultiplier()
  • Set the PGN Monitor

    Declaration

    Swift

    public func setPGNMonitor(_ value: UInt64)

    Parameters

    value

    0-4096

  • Set the PGN Monitor

    Declaration

    Swift

    public func setPGNMonitorGetMessages(_ value: UInt64, _ messages: UInt8)

    Parameters

    value

    0-4096

    messages

    0-7 (the number of messages to receive)

J1850

  • The IFR Value Should be Set From the Header

    Declaration

    Swift

    public func getIFRValueFromHeader()
  • The IFR Value Should be Set From the Source

    Declaration

    Swift

    public func getIFRValueFromSource()
  • Turn IFRs On

    Declaration

    Swift

    public func turnIFRsOn()
  • Turn On IFRs, and Set to Auto

    Declaration

    Swift

    public func useIFRsAuto()
  • Turn IFRs Off

    Declaration

    Swift

    public func turnIFRsOff()

ISO

  • Try to Set Baud Rate to 10400

    Declaration

    Swift

    public func isoBaudRate10400()
  • Try to Set Baud Rate to 4800

    Declaration

    Swift

    public func isoBaudRate4800()
  • Try to Set Baud Rate to 9600

    Declaration

    Swift

    public func isoBaudRate9600()
  • Set the ISO Initial Address

    Declaration

    Swift

    public func setISOInitAddress(_ address: UInt8)

    Parameters

    address

    0-255

  • Display Keywords

    Declaration

    Swift

    public func displayKeywords()
  • Turn Keyword Checking On

    Declaration

    Swift

    public func turnKeywordCheckingOn()
  • Turn Keyword Checking Off

    Declaration

    Swift

    public func turnKeywordCheckingOff()
  • Perform a Slow Initiation

    Declaration

    Swift

    public func performSlowInitiation()
  • Set the Wakeup Interval to Multiple of 4ms

    Declaration

    Swift

    public func setWakeupIntervalMultiplerBy20ms(_ multiplier: UInt8)

    Parameters

    multiplier

    0-255

  • Set the Wakeup Message

    Declaration

    Swift

    public func setWakeupMessage(_ inMessage: [UInt8])

    Parameters

    message

    Up to 6 0-255

PPs

  • Turn On All Program Parameters

    Declaration

    Swift

    public func turnAllPPsProgParametersOn()
  • Turn Off All Program Parameters

    Declaration

    Swift

    public func turnAllPPsProgParametersOff()
  • Turn On the Given Program Parameter

    Declaration

    Swift

    public func setPPsProgParameterOnFor(_ index: UInt8)

    Parameters

    index

    Parameter index 0-255

  • Turn On the Given Program Parameter

    Declaration

    Swift

    public func setPPsProgParameterOffFor(_ index: UInt8)

    Parameters

    index

    Parameter index 0-255

  • Set the Given Program Parameter to the Given Value

    Declaration

    Swift

    public func setPPsProgParameterValue(_ inValue: UInt8, for inIndex: UInt8)

    Parameters

    inValue

    0-255

    for

    Parameter index 0-255

  • Return a PPs Summary

    Declaration

    Swift

    public func ppSummary()