//-----------------------------------------------------------------------
//
// 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 Protocol.OBD
{
using System;
using global::SharedObjects.Misc;
///
/// Interface to request matching engine where responses
/// are matched to an earlier request in order to improve
/// parsing.
///
public interface IRequestMatcher
{
///
/// Gets the number of requests that we wait for answer on.
///
int openRequests { get; }
///
/// Set request data to help with parsing the received data in some cases.
///
/// Request data to set.
/// 'true' on success.
bool addRequestData(SharedObjects.Misc.IRequestData requestData);
///
/// Find a matching request for the data we got.
///
/// Destination address to send to.
/// Current mode.
/// Payload data.
/// Matched request data.
IRequestData getMatchingRequest(uint? destinationAddress, byte mode, byte[] payload);
///
/// Check if address already is listed.
///
/// This method will also set 'false' if the time waiting for answer exceeds 2 seconds.
///
///
/// Address to check.
/// 'true' if waiting for answer from ECU.
bool hasListedAddress(uint address);
}
}