//-----------------------------------------------------------------------
//
// 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
{
using global::SharedObjects.Protocol;
///
/// Wrapper class for one filter item.
///
public class FilterItem : IFilterItem
{
///
/// Gets Filter ID.
///
public int filterId { get; private set; }
///
/// Gets Type of filter.
///
public uint filterType { get; private set; }
///
/// Gets Datasize value.
///
public int datasize { get; private set; }
///
/// Gets Mask value.
///
public uint mask { get; private set; }
///
/// Gets Pattern value.
///
public uint pattern { get; private set; }
///
/// Gets Flow value.
///
public uint flow { get; private set; }
///
/// Gets TX Flags value.
///
public uint txFlags { get; private set; }
///
/// Gets Current protocol.
///
public Protocols protocol { get; private set; }
///
/// Initializes a new instance of the class.
///
/// Filter ID
/// Type of filter
/// Datasize value
/// Mask value
/// Pattern value
/// Flow value
/// TX Flags value
/// Current protocol
public FilterItem(
int msgId,
uint filterType,
int datasize,
uint mask,
uint pattern,
uint flow,
uint txFlags,
Protocols protocol)
{
this.filterId = msgId;
this.filterType = filterType;
this.datasize = datasize;
this.protocol = protocol;
this.mask = mask;
this.pattern = pattern;
this.flow = flow;
this.txFlags = txFlags;
}
///
/// Get string representation of object.
///
/// String representation of object.
public override string ToString()
{
#if TRACE_FILTER
return "filterId=" + this.filterId + ", filterType=" + this.filterType + ", datasize=" + this.datasize + ", protocol=0x" + this.protocol.id.ToString("x2") + ", mask=0x" + this.mask.ToString("x4") + ", pattern=0x" + this.pattern.ToString("x4") + ", flow=0x" + this.flow.ToString("x4") + ", txFlags=0x" + this.txFlags.ToString("x4") + "\r\n";
#else
return string.Empty;
#endif
}
}
}