//-----------------------------------------------------------------------
//
// 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 DynamicApiLoading.Api.Dynamic
{
using System.Collections.Generic;
///
/// One instance of an encountered J2534 driver.
///
public class DynamicAdapter
{
///
/// Gets a value indicating whether old J2534 API not supporting the 04.04 format is used.
///
public bool oldDriver { get; private set; }
///
/// Gets Registry key name for driver.
///
public string KeyName { get; private set; }
///
/// Gets Name of driver.
///
public string Name { get; private set; }
///
/// Gets Driver vendor.
///
public string Vendor { get; private set; }
///
/// Gets Log file for driver, may be 'null'.
///
public string LogFile { get; private set; }
///
/// Gets Configuration application for driver, may be 'null'.
///
public string ConfigApplication { get; private set; }
///
/// Gets J2534 library DLL path.
///
public string FunctionLibrary { get; private set; }
///
/// Gets RP 1210 library DLL path, may be 'null'.
///
public string RP1210Library { get; private set; }
///
/// Gets RP 1210 device ID, may be 'null'.
///
public int? RP1210DeviceId { get; private set; }
///
/// Gets List of supported protocols by the driver.
///
public IList protocols { get; private set; }
///
/// Initializes a new instance of the class.
///
/// 'true' if old J2534 API not supporting the 04.04 format.
/// Registry key name for driver.
/// Name of driver.
/// Driver vendor.
/// Log file for driver, may be 'null'.
/// Configuration application for driver, may be 'null'.
/// J2534 library DLL path.
/// RP 1210 library DLL path, may be 'null'.
/// RP 1210 device ID, may be 'null'.
/// List of supported protocols by the driver.
public DynamicAdapter(
bool oldDriver,
string KeyName,
string Name,
string Vendor,
string LogFile,
string ConfigApplication,
string FunctionLibrary,
string RP1210Library,
int? RP1210DeviceId,
IList protocols)
{
this.oldDriver = oldDriver;
this.KeyName = KeyName;
this.Name = Name;
this.Vendor = Vendor;
this.LogFile = LogFile;
this.ConfigApplication = ConfigApplication;
this.FunctionLibrary = FunctionLibrary;
this.RP1210Library = RP1210Library;
this.RP1210DeviceId = RP1210DeviceId;
this.protocols = protocols;
}
///
/// Get a string representation of the object.
///
/// A string representation of the object.
public override string ToString()
{
string printedProtocols = string.Empty;
bool first = true;
foreach (string protocol in this.protocols)
{
if (!first)
{
printedProtocols += ",";
}
else
{
first = false;
}
printedProtocols += protocol;
}
return this.KeyName
+ ": " + this.Name
+ ": " + this.Vendor
+ ": " + this.LogFile
+ ": " + this.ConfigApplication
+ ": " + this.FunctionLibrary
+ ": " + this.RP1210Library
+ ": " + this.RP1210DeviceId
+ ": " + printedProtocols;
}
}
}