RVS_BTDriver_Vendor_OBD_Parser
internal struct RVS_BTDriver_Vendor_OBD_Parser
This struct acts as an OBD response parser, accepting a near-complete transaction, parsing the response, then storing the complete transaction.
-
This is per this SO answer. What is happening here, is that each interpreter type has a “factory” static funtion that will create (or not create) an instance of the interpreter, based on the input data. We can add each type to our Array, so that we can have a dynamic assignment.
Declaration
Swift
static let interpreterClasses: [RVS_BTDriver_OBD_Command_Service_Command_Interpreter_Internal.Type]
-
Searching placeholder always begins with this
Declaration
Swift
internal static let searchingString: String
-
If the command returns no data, this will be the string.
Declaration
Swift
internal static let noDataString: String
-
The first two characters in an AT response (echoing the command).
Declaration
Swift
internal static let atHeader: String
-
This will hold the transaction we are parsing.
Declaration
Swift
internal let transaction: RVS_BTDriver_OBD_Device_TransactionStruct!
-
Declaration
Swift
public var interpreter: RVS_BTDriver_OBD_Command_Service_Command_Interpreter! { get }
Return Value
The Transaction interpreter (if any). May be nil.
-
This static function will parse a response string from an AT command.
Declaration
Swift
internal static func parseATResponse(_ inResponseStrings: [String]) -> String!
Parameters
inResponseString
The transaction response.
Return Value
A String, containing the transaction response. Nil, if the packet could not be parsed.
-
This static function will parse a response string from an OBD command.
Declaration
Swift
internal static func parseOBDResponse(_ inResponseStrings: [String]) -> String!
Parameters
inResponseString
The transaction response.
Return Value
A String, containing the transaction response. Nil, if the packet could not be parsed.
-
This static function will parse the transaction response, and return it to be added to the transaction.
Declaration
Swift
internal static func parseOBDPacket(_ inPacketData: String) -> String!
Parameters
inPacketData
The transaction response.
Return Value
A String, containing the transaction response. Nil, if the packet could not be parsed.
-
The initializer actually does the parsing.
Upon instantiation, the transaction property woill contain the parsed and complete transaction.
Declaration
Swift
internal init(transaction inTransaction: RVS_BTDriver_OBD_Device_TransactionStruct)
Parameters
transaction
The transaction to be parsed.