//----------------------------------------------------------------------- // // Copyright © 2012 Nils Hammar. All rights reserved. // //----------------------------------------------------------------------- /* * Software to access vehicle information via the OBD-II connector. * * Copyright © 2012 Nils Hammar * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Alternative licensing is possible, see the licensing document. * * The above text may not be removed or modified. */ namespace SharedObjects.Api { /// /// In-between interface to handle different implementations of calls to external DLL:s. /// public interface IPassThruBase { /// /// Implementation of PassThruOpen. /// /// Always 'null'. /// Pointer to selected device ID. (return value) /// '0' if success, non-zero if a failure occurred. unsafe PassThruConstants.resultCode PassThruOpen(void* pName, int* pDeviceID); /// /// Close the given device. /// /// ID of device to close. /// '0' if success, non-zero if a failure occurred. PassThruConstants.resultCode PassThruClose(int DeviceID); /// /// Establish a connection on the given device. /// /// ID of current device. /// ID of protocol to use. /// Connection Flags. /// Baudrate to use for connection. /// Pointer to value for channel id (return value) /// '0' if success, non-zero if a failure occurred. unsafe PassThruConstants.resultCode PassThruConnect(int DeviceID, int ProtocolID, uint Flags, uint Baudrate, int* pChannelID); /// /// Disconnect the given channel. /// /// ID of channel to disconnect. /// '0' if success, non-zero if a failure occurred. PassThruConstants.resultCode PassThruDisconnect(int ChannelID); /// /// Read messages from the given channel. /// /// ID of channel to read from. /// Pointer to message(s) read. /// Number of messages to read, value set at return to actual number read. /// Timeout value before returning with no message read. /// '0' if success, non-zero if a failure occurred. unsafe PassThruConstants.resultCode PassThruReadMsgs(int ChannelID, PASSTHRU_MSG* pMsg, int* pNumMsgs, int Timeout); /// /// Write messages to the given channel. /// /// ID of channel to write to. /// Message(s) to write. /// Number of messages to write. /// Timeout when writing message to out channel. /// '0' if success, non-zero if a failure occurred. unsafe PassThruConstants.resultCode PassThruWriteMsgs(int ChannelID, PASSTHRU_MSG* pMsg, int* pNumMsgs, int Timeout); /// /// Start a periodic message to send from application to vehicle. /// /// ID of channel to write to. /// Message(s) to write. /// Return value: ID of message being sent. /// Interval between each message in milliseconds. /// '0' if success, non-zero if a failure occurred. unsafe PassThruConstants.resultCode PassThruStartPeriodicMsg(int ChannelID, PASSTHRU_MSG* pMsg, int* pMsgID, int TimeInterval); /// /// Stop a periodic message from being sent to the vehicle. /// /// ID of channel to stop message on. /// ID of message to stop sending. /// '0' if success, non-zero if a failure occurred. PassThruConstants.resultCode PassThruStopPeriodicMsg(int ChannelID, int MsgID); /// /// Configure a message filter. /// /// Channel to configure filter on. /// Type of filter to configure. /// Mask message in filter. /// Pattern message in filter. /// Flow control message in filter. /// ID of filter created (out value) /// '0' if success, non-zero if a failure occurred. unsafe PassThruConstants.resultCode PassThruStartMsgFilter( int ChannelID, int FilterType, PASSTHRU_MSG* pMaskMsg, PASSTHRU_MSG* pPatternMsg, PASSTHRU_MSG* pFlowControlMsg, int* pMsgID); /// /// Stop a message filter. /// /// Channel to remove filter from. /// ID of filter to remove. /// '0' if success, non-zero if a failure occurred. PassThruConstants.resultCode PassThruStopMsgFilter(int ChannelID, int MsgID); /// /// Configure the programming voltage pin and voltage. /// /// ID of Device to configure. /// Number of pin to configure. /// Voltage to set at pin. /// '0' if success, non-zero if a failure occurred. PassThruConstants.resultCode PassThruSetProgrammingVoltage(int DeviceID, int Pin, int Voltage); /// /// Read API version. /// /// ID to get version information from. /// Firmware version (return value). /// DLL version (return value). /// API version (return value). /// '0' if success, non-zero if a failure occurred. unsafe PassThruConstants.resultCode PassThruReadVersion(int DeviceID, byte* pFirmwareVersion, byte* pDllVersion, byte* pApiVersion); /// /// Get the last error encountered on the device. /// /// Pointer to string with error description. /// '0' if success, non-zero if a failure occurred. unsafe PassThruConstants.resultCode PassThruGetLastError(sbyte* pErrorDescription); /// /// Perform IOCTL operation on the device. /// /// ID of channel to perform operation on. /// IOCTL Operation. /// Input parameter for operation. /// Output parameter for operation. /// '0' if success, non-zero if a failure occurred. unsafe PassThruConstants.resultCode PassThruIoctl( int ChannelID, int IoctlID, void* pInput, void* pOutput); } }