peak source

This commit is contained in:
rusefillc 2023-12-15 11:53:46 -05:00
commit 83bf9711cc
22 changed files with 3029 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.idea

3
build.gradle Normal file
View File

@ -0,0 +1,3 @@
plugins {
id 'java'
}

View File

@ -0,0 +1,43 @@
/* SPDX-License-Identifier: LGPL-2.1-only */
/*
* $Id: IRcvEventProcessor.java 7391 2020-08-10 08:32:30Z Fabrice $
* @LastChange $Date: 2020-08-10 10:32:30 +0200 (Mon, 10 Aug 2020) $
*
* PCANBasic JAVA Interface.
*
* Copyright (C) 2001-2020 PEAK System-Technik GmbH <www.peak-system.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* PCAN is a registered Trademark of PEAK-System Germany GmbH
*
* Author: Jonathan Urban/Uwe Wilhelm/Fabrice Vergnaud
* Contact: <linux@peak-system.com>
* Maintainer: Fabrice Vergnaud <f.vergnaud@peak-system.com>
*/
package peak.can.basic;
/**
* This interface is implemented by classes which need to process the CAN Receive-Event.
*/
public interface IRcvEventProcessor
{
/**
* This method is called by the RcvEventDispatcher to process the CAN Receive-Event
* by the current implementor
* @param channel CAN channel to process event
*/
public void processRcvEvent(TPCANHandle channel);
}

View File

@ -0,0 +1,103 @@
/* SPDX-License-Identifier: LGPL-2.1-only */
/*
* $Id: MutableTPCANHandle.java 7377 2020-08-07 14:40:53Z Fabrice $
* @LastChange $Date: 2020-08-07 16:40:53 +0200 (ven., 07 août 2020) $
*
* Demo Application for PCANBasic JAVA JNI Interface.
*
* Copyright (C) 2001-2020 PEAK System-Technik GmbH <www.peak-system.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* PCAN is a registered Trademark of PEAK-System Germany GmbH
*
* Author: Jonathan Urban/Uwe Wilhelm/Fabrice Vergnaud
* Contact: <linux@peak-system.com>
* Maintainer: Fabrice Vergnaud <f.vergnaud@peak-system.com>
*/
package peak.can.basic;
/**
* The MutableTPCANHandle class wraps a value of the immutable enumeration TPCANHandle in an object (to be used with the JNI library).
*
* @version 1.0
* @LastChange $Date: $
* @author $Author: $
*
* @Copyright (C) 1999-2021 PEAK-System Technik GmbH, Darmstadt
* more Info at http://www.peak-system.com
*/
public class MutableTPCANHandle
{
/**
* Constructor
* @param value TPCANHandle value
*/
public MutableTPCANHandle()
{
this(TPCANHandle.PCAN_NONEBUS);
}
/**
* Constructor
* @param value TPCANHandle value
*/
public MutableTPCANHandle(TPCANHandle value)
{
this.value = value;
}
/**
* Constructor based on internal TPCANHandle enum value
* @param value TPCANHandle as string
*/
public MutableTPCANHandle(short value)
{
this.value = TPCANHandle.PCAN_NONEBUS;
for(TPCANHandle handle: TPCANHandle.values()) {
if (value == handle.getValue())
this.value = handle;
}
}
/**
* Gets TPCANHandle value
* @return TPCANHandle value
*/
public TPCANHandle getValue()
{
return value;
}
/**
* Sets TPCANHandle value
* @param value TPCANHandle value
*/
public void setValue(TPCANHandle value)
{
this.value = value;
}
public TPCANHandle value;
/**
* Overrides toString() to display int value
* @return MutableInteger's value as a string
*/
@Override
public String toString()
{
return value.toString();
}
}

View File

@ -0,0 +1,335 @@
/* SPDX-License-Identifier: LGPL-2.1-only */
/*
* $Id: PCANBasic.java 12274 2021-08-30 12:20:04Z Fabrice $
* @LastChange $Date: 2021-08-30 14:20:04 +0200 (Mon, 30 Aug 2021) $
*
* PCANBasic JAVA Interface.
*
* Copyright (C) 2001-2021 PEAK System-Technik GmbH <www.peak-system.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* PCAN is a registered Trademark of PEAK-System Germany GmbH
*
* Author: Jonathan Urban/Uwe Wilhelm/Fabrice Vergnaud
* Contact: <linux@peak-system.com>
* Maintainer: Fabrice Vergnaud <f.vergnaud@peak-system.com>
*/
package peak.can.basic;
/**
* This is the main class for using the PCANBasic API with your java
* applications. Steps to use this api:<br><br>
* <pre>
* 1. Create a new PCANBasic object:<br>
* example: <br>
* can = new PCANBasic();
*
* 2. Call the initializeAPI method<br>
* example: <br>
* can.initializeAPI();<br>
*
* 3. Call the Initialize method passing the TPCANHandle parameter which you want use, TPCANBaudrate and other parameters for Non-PNP devices <br>
* example: <br>
* can.initialize(TPCANHandle.PCAN_USBBUS1, TPCANBaudrate.PCAN_BAUD_1M);<br>
*
* 4. Call the read or write method passing the TPCANHandle parameter which is initialized and you want use<br>
* example:
* TPCANMsg msg = new TPCANMsg();;
* can.Read(TPCANHandle.PCAN_USBBUS1, msg, null);
* can.Write(TPCANHandle.PCAN_USBBUS1, msg);
* (do not forget to check if msg is null after calling the Read method)<br>
*
* 5. At the end call the Uninitialize method
* example:
* can.Uninitialize(TPCANHandle.PCAN_USBBUS1);
* </pre>
* <br>
* A minimalistic program that writes every can message that it receives
* (ping-pong)<br>
* looks like this:<br>
* <pre>
*import peak.can.basic.*;
*
*public class MinimalisticProgram
*{
* public static void main(String[] args)
* {
* PCANBasic can = null;
* TPCANMsg msg = null;
* TPCANStatus status = null;
* can = new PCANBasic();
* if(!can.initializeAPI())
* {
* System.out.println("Unable to initialize the API");
* System.exit(0);
* }
* status = can.Initialize(TPCANHandle.PCAN_PCIBUS1, TPCANBaudrate.PCAN_BAUD_1M, TPCANType.PCAN_TYPE_NONE, 0, (short) 0);
* msg = new TPCANMsg();
* while(true)
* {
* while(can.Read(TPCANHandle.PCAN_PCIBUS1, msg, null) == TPCANStatus.PCAN_ERROR_OK)
* {
* status = can.Write(TPCANHandle.PCAN_PCIBUS1, msg);
* if(status != TPCANStatus.PCAN_ERROR_OK)
* {
* System.out.println("Unable to write the CAN message");
* System.exit(0);
* }
* }
* }
* }
*}
* </pre>
*/
public class PCANBasic {
/**
* Initializes a PCAN Channel
*
* @param Channel The handle of a PCAN Channel
* @param Btr0Btr1 The speed for the communication (BTR0BTR1 code)
* @param HwType NON PLUG'n'PLAY: The type of hardware and operation mode
* @param IOPort NON PLUG'n'PLAY: The I/O address for the parallel port
* @param Interrupt NON PLUG'n'PLAY: Interrupt number of the parallel port
* @return a TPCANStatus error code
*/
public native TPCANStatus Initialize(
TPCANHandle Channel,
TPCANBaudrate Btr0Btr1,
TPCANType HwType,
int IOPort,
short Interrupt);
/**
* Initializes a FD capable PCAN Channel
*
* <p>
* See PCAN_BR_* values Bitrate string must follow the following
* construction rules: - parameters and values must be separated by '=' -
* Couples of Parameter/value must be separated by ',' - Following Parameter
* must be filled out: f_clock, data_brp, data_sjw, data_tseg1, data_tseg2,
* nom_brp, nom_sjw, nom_tseg1, nom_tseg2. - Following Parameters are
* optional (not used yet): data_ssp_offset, nom_samp
* </p>
* <p>
* Example: f_clock_mhz=80, nom_brp=1, nom_tset1=63, nom_tseg2=16,
* nom_sjw=7, data_brp=4, data_tset1=12, data_tseg2=7, data_sjw=1
* </p>
*
* @param Channel The handle of a FD capable PCAN Channel
* @param BitrateFD The speed for the communication (FD Bitrate string)
* @return A TPCANStatus error code
*/
public native TPCANStatus InitializeFD(
TPCANHandle Channel,
TPCANBitrateFD BitrateFD);
/**
* Uninitializes one or all PCAN Channels initialized by CAN_Initialize
* Giving the TPCANHandle value "PCAN_NONEBUS", uninitialize all initialized
* channels
*
* @param Channel The handle of a PCAN Channel
* @return A TPCANStatus error code
*/
public native TPCANStatus Uninitialize(TPCANHandle Channel);
/**
* Resets the receive and transmit queues of the PCAN Channel A reset of the
* CAN controller is not performed.
*
* @param Channel The handle of a PCAN Channel
* @return A TPCANStatus error code
*/
public native TPCANStatus Reset(
TPCANHandle Channel);
/**
* Gets the current status of a PCAN Channel
*
* @param Channel The handle of a PCAN Channel
* @return A TPCANStatus error code
*/
public native TPCANStatus GetStatus(
TPCANHandle Channel);
/**
* Transmits a CAN message
*
* @param Channel The handle of a PCAN Channel
* @param MessageBuffer A TPCANMsg buffer with the message to be read
* @param TimestampBuffer A TPCANTimestamp structure buffer to get the
* reception time of the message. If this value is not desired, this
* parameter should be passed as NULL
* @return A TPCANStatus error code
*/
public native TPCANStatus Read(
TPCANHandle Channel,
TPCANMsg MessageBuffer,
TPCANTimestamp TimestampBuffer);
/**
* Reads a CAN message from the receive queue of a FD capable PCAN Channel
*
* @param Channel The handle of a FD capable PCAN Channel
* @param MessageBuffer A TPCANMsgFD structure buffer to store the CAN
* message
* @param TimestampBuffer A TPCANTimestampFD buffer to get the reception
* time of the message
* @return A TPCANStatus error code
*/
public native TPCANStatus ReadFD(
TPCANHandle Channel,
TPCANMsgFD MessageBuffer,
TPCANTimestampFD TimestampBuffer);
/**
* Transmits a CAN message
*
* @param Channel The handle of a PCAN Channel
* @param MessageBuffer A TPCANMsg buffer with the message to be sent
* @return A TPCANStatus error code
*/
public native TPCANStatus Write(
TPCANHandle Channel,
TPCANMsg MessageBuffer);
/**
* Transmits a CAN message over a FD capable PCAN Channel
*
* @param Channel The handle of a FD capable PCAN Channel
* @param MessageBuffer A TPCANMsgFD buffer with the message to be sent
* @return A TPCANStatus error code
*/
public native TPCANStatus WriteFD(
TPCANHandle Channel,
TPCANMsgFD MessageBuffer);
/**
* Configures the reception filter. The message filter will be expanded with
* every call to this function. If it is desired to reset the filter, please
* use the CAN_SetParameter function
*
* @param Channel The handle of a PCAN Channel
* @param FromID The lowest CAN ID to be received
* @param ToID The highest CAN ID to be received
* @param Mode Message type, Standard (11-bit identifier) or Extended
* (29-bit identifier)
* @return A TPCANStatus error code
*/
public native TPCANStatus FilterMessages(
TPCANHandle Channel,
int FromID,
int ToID,
TPCANMode Mode);
/**
* Retrieves a PCAN Channel value Parameters can be present or not according
* with the kind of Hardware (PCAN Channel) being used. If a parameter is
* not available, a PCAN_ERROR_ILLPARAMTYPE error will be returned
*
* @param Channel The handle of a PCAN Channel
* @param Parameter The TPCANParameter parameter to get
* @param Buffer Buffer for the parameter value
* @param BufferLength Size in bytes of the buffer
* @return A TPCANStatus error code
*/
public native TPCANStatus GetValue(
TPCANHandle Channel,
TPCANParameter Parameter,
Object Buffer,
int BufferLength);
/**
* Configures or sets a PCAN Channel value Parameters can be present or not
* according with the kind of Hardware (PCAN Channel) being used. If a
* parameter is not available, a PCAN_ERROR_ILLPARAMTYPE error will be
* returned
*
* @param Channel The handle of a PCAN Channel
* @param Parameter The TPCANParameter parameter to get
* @param Buffer Buffer for the parameter value
* @param BufferLength Size in bytes of the buffer
* @return A TPCANStatus error code
*/
public native TPCANStatus SetValue(
TPCANHandle Channel,
TPCANParameter Parameter,
Object Buffer,
int BufferLength);
/**
* Returns a descriptive text of a given TPCANStatus error code, in any
* desired language The current languages available for translation are:
* Neutral (0x00), German (0x07), English (0x09), Spanish (0x0A), Italian
* (0x10) and French (0x0C)
*
* @param Error A TPCANStatus error code
* @param Language Indicates a 'Primary language ID'
* @param Buffer Buffer for a null terminated char array
* @return A TPCANStatus error code
*/
public native TPCANStatus GetErrorText(
TPCANStatus Error,
short Language,
StringBuffer Buffer);
/**
* Finds a PCAN-Basic channel that matches with the given parameters
*
* @param Parameters A comma separated string contained pairs of parameter-name/value to be matched within a PCAN-Basic channel
* @param FoundChannel Buffer for returning the PCAN-Basic channel
* @param Buffer Buffer for a null terminated char array
* @return A TPCANStatus error code
*/
public native TPCANStatus LookUpChannel(
StringBuffer Parameters,
MutableTPCANHandle FoundChannel);
/**
* Sets the handle of the Receive-Event for the Channel. static method
* peak.can.basic.RcvEventDispatcher.dispatchRcvEvent is used to notify each
* Receive-Event
*
* @param Channel The handle of a PCAN Channel
* @return A TPCANStatus error code
*/
public native TPCANStatus SetRcvEvent(TPCANHandle Channel);
/**
* Resets the handle of the Receive-Event for the Channel.
*
* @param Channel The handle of a PCAN Channel
* @return A TPCANStatus error code
*/
public native TPCANStatus ResetRcvEvent(TPCANHandle Channel);
/**
* Initializes the PCANBasic API
*
* @return a boolean to indicate if API is successfully loaded
*/
public native boolean initializeAPI();
static {
try {
System.loadLibrary("pcanbasic_jni");
} catch (UnsatisfiedLinkError e) {
System.out.println(e.getMessage());
System.loadLibrary("PCANBasic_JNI");
}
}
}

View File

@ -0,0 +1,70 @@
/* SPDX-License-Identifier: LGPL-2.1-only */
/*
* $Id: RcvEventDispatcher.java 7391 2020-08-10 08:32:30Z Fabrice $
* @LastChange $Date: 2020-08-10 10:32:30 +0200 (Mon, 10 Aug 2020) $
*
* PCANBasic JAVA Interface.
*
* Copyright (C) 2001-2020 PEAK System-Technik GmbH <www.peak-system.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* PCAN is a registered Trademark of PEAK-System Germany GmbH
*
* Author: Jonathan Urban/Uwe Wilhelm/Fabrice Vergnaud
* Contact: <linux@peak-system.com>
* Maintainer: Fabrice Vergnaud <f.vergnaud@peak-system.com>
*/
package peak.can.basic;
/**
* This class is a gateway between the PCAN Light JNI and the application to dispatch the CAN Receive-Event.
*
* RcvEventDispatcher contains a public static method dispatchRcvEvent which is called from the JNI to notify the Java
* application when the handle of the Receive-Event detects a state change.
*/
public class RcvEventDispatcher
{
static private IRcvEventProcessor listener;
/**
* Gets the Receive-Event processor
* @return a IRcvEventProcessor
*/
public static IRcvEventProcessor getListener()
{
return listener;
}
/**
* Sets the Receive-Event processor
* @param listener a IRcvEventProcessor implementor
*/
public static void setListener(IRcvEventProcessor listener)
{
RcvEventDispatcher.listener = listener;
}
/**
* This static public method will call from JNI to process the Receive-Event
* by the listener
* @param channel CAN Channel to dispatch the event to.
*/
static public void dispatchRcvEvent(TPCANHandle channel)
{
if(listener != null)
listener.processRcvEvent(channel);
}
}

View File

@ -0,0 +1,191 @@
/* SPDX-License-Identifier: LGPL-2.1-only */
/*
* $Id: TPCANBaudrate.java 7391 2020-08-10 08:32:30Z Fabrice $
* @LastChange $Date: 2020-08-10 10:32:30 +0200 (Mon, 10 Aug 2020) $
*
* PCANBasic JAVA Interface.
*
* Copyright (C) 2001-2020 PEAK System-Technik GmbH <www.peak-system.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* PCAN is a registered Trademark of PEAK-System Germany GmbH
*
* Author: Jonathan Urban/Uwe Wilhelm/Fabrice Vergnaud
* Contact: <linux@peak-system.com>
* Maintainer: Fabrice Vergnaud <f.vergnaud@peak-system.com>
*/
package peak.can.basic;
/**
* Baud rate codes = BTR0/BTR1 register values for the CAN controller. You can
* define your own Baud rate with the BTROBTR1 register. Take a look at
* www.peak-system.com for our free software "BAUDTOOL" to calculate the
* BTROBTR1 register for every baudrate and sample point.
*/
public enum TPCANBaudrate {
/**
* 1 MBit/s
*/
PCAN_BAUD_1M(0x0014, false),
/**
* 800 kBit/s
*/
PCAN_BAUD_800K(0x0016, false),
/**
* 500 kBit/s
*/
PCAN_BAUD_500K(0x001C, false),
/**
* 250 kBit/s
*/
PCAN_BAUD_250K(0x011C, false),
/**
* 125 kBit/s
*/
PCAN_BAUD_125K(0x031C, false),
/**
* 100 kBit/s
*/
PCAN_BAUD_100K(0x432F, false),
/**
* 95,238 kBit/s
*/
PCAN_BAUD_95K(0xC34E, false),
/**
* 83,33 kBit/s
*/
PCAN_BAUD_83K(0x852B, false),
/**
* 50 kBit/s
*/
PCAN_BAUD_50K(0x472F, false),
/**
* 47,619 kBit/s
*/
PCAN_BAUD_47K(0x1414, false),
/**
* 33,333 kBit/s
*/
PCAN_BAUD_33K(0x8B2F, false),
/**
* 20 kBit/s
*/
PCAN_BAUD_20K(0x532F, false),
/**
* 10 kBit/s
*/
PCAN_BAUD_10K(0x672F, false),
/**
* 5 kBit/s
*/
PCAN_BAUD_5K(0x7F7F, false),
/**
* User
*/
PCAN_BAUD_User0(0x0, true),
/**
* User
*/
PCAN_BAUD_User1(0x0, true),
/**
* User
*/
PCAN_BAUD_User2(0x0, true),
/**
* User
*/
PCAN_BAUD_User3(0x0, true),
/**
* User
*/
PCAN_BAUD_User4(0x0, true),
/**
* User
*/
PCAN_BAUD_User5(0x0, true),
/**
* User
*/
PCAN_BAUD_User6(0x0, true),
/**
* User
*/
PCAN_BAUD_User7(0x0, true),
/**
* User
*/
PCAN_BAUD_User8(0x0, true),
/**
* User
*/
PCAN_BAUD_User9(0x0, true);
private int value;
private final boolean user;
private TPCANBaudrate(int value, boolean user) {
this.value = value;
this.user = user;
}
/**
* Returns the value of the baud rate code.
* @return value of the baud rate code
*/
public int getValue() {
return this.value;
}
/**
* Sets the user-defined value.
* @param value Baud rate code
*/
public void setValue(int value) {
if (user) {
this.value = value;
}
}
/**
* Clears the user-defined value
*/
public void clearValue() {
if (user) {
this.value = 0;
}
}
/**
* Returns a TPCANBaudrate matching the corresponding Baud rate code
* @param value Baud rate code
* @return null or a TPCANBaudrate matching the Baud rate code
*/
public static TPCANBaudrate valueOf(int value) {
for (TPCANBaudrate rate : values()) {
if (rate.getValue() == value) {
return rate;
}
}
for (TPCANBaudrate rate : values()) {
if (rate.user && rate.getValue() == 0) {
rate.value = value;
return rate;
}
}
return null;
}
};

View File

@ -0,0 +1,65 @@
/* SPDX-License-Identifier: LGPL-2.1-only */
/*
* $Id: TPCANBitrateFD.java 7391 2020-08-10 08:32:30Z Fabrice $
* @LastChange $Date: 2020-08-10 10:32:30 +0200 (Mon, 10 Aug 2020) $
*
* PCANBasic JAVA Interface.
*
* Copyright (C) 2001-2020 PEAK System-Technik GmbH <www.peak-system.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* PCAN is a registered Trademark of PEAK-System Germany GmbH
*
* Author: Jonathan Urban/Uwe Wilhelm/Fabrice Vergnaud
* Contact: <linux@peak-system.com>
* Maintainer: Fabrice Vergnaud <f.vergnaud@peak-system.com>
*/
package peak.can.basic;
/**
* FD bit rates for the CAN FD controller. You can
* define your own bit rate with the FD string, as shown in this exemple:
* "f_clock_mhz=20, nom_brp=5, nom_tseg1=2, nom_tseg2=1, nom_sjw=1,
* data_brp=2, data_tseg1=3, data_tseg2=1, data_sjw=1"
*/
public class TPCANBitrateFD {
private String value;
/**
* Creates a CAN FD bitrate
* @param value A CAN FD bitrate string (for instance:
* "f_clock_mhz=20, nom_brp=5, nom_tseg1=2, nom_tseg2=1, nom_sjw=1,
* data_brp=2, data_tseg1=3, data_tseg2=1, data_sjw=1")
*/
public TPCANBitrateFD(String value) {
this.value = value;
}
/**
* Returns the string configuration of the bitrate code.
* @return The bitrate string configuration
*/
public String getValue() {
return this.value;
}
/**
* Sets string configuration of the bitrate code.
* @param value The new bitrate string configuration
*/
public void setValue(String value) {
this.value = value;
}
};

View File

@ -0,0 +1,103 @@
/* SPDX-License-Identifier: LGPL-2.1-only */
/*
* $Id: TPCANBitrateFDValue.java 7391 2020-08-10 08:32:30Z Fabrice $
* @LastChange $Date: 2020-08-10 10:32:30 +0200 (Mon, 10 Aug 2020) $
*
* PCANBasic JAVA Interface.
*
* Copyright (C) 2001-2020 PEAK System-Technik GmbH <www.peak-system.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* PCAN is a registered Trademark of PEAK-System Germany GmbH
*
* Author: Jonathan Urban/Uwe Wilhelm/Fabrice Vergnaud
* Contact: <linux@peak-system.com>
* Maintainer: Fabrice Vergnaud <f.vergnaud@peak-system.com>
*/
package peak.can.basic;
/**
* Baud rate codes = BTR0/BTR1 register values for the CAN controller. You can
* define your own Baud rate with the BTROBTR1 register. Take a look at
* www.peak-system.com for our free software "BAUDTOOL" to calculate the
* BTROBTR1 register for every baudrate and sample point.
*/
public enum TPCANBitrateFDValue {
/**
* Clock frequency in Herz (80000000, 60000000, 40000000, 30000000,
* 24000000, 20000000)
*/
PCAN_BR_CLOCK("f_clock"),
/**
* Clock frequency in Megaherz (80, 60, 40, 30, 24, 20)
*/
PCAN_BR_CLOCK_MHZ("f_clock_mhz"),
/**
* Clock prescaler for nominal time quantum
*/
PCAN_BR_NOM_BRP("nom_brp"),
/**
* TSEG1 segment for nominal bit rate in time quanta
*/
PCAN_BR_NOM_TSEG1("nom_tseg1"),
/**
* TSEG2 segment for nominal bit rate in time quanta
*/
PCAN_BR_NOM_TSEG2("nom_tseg2"),
/**
* Synchronization Jump Width for nominal bit rate in time quanta
*/
PCAN_BR_NOM_SJW("nom_sjw"),
/**
* Sample point for nominal bit rate
*/
PCAN_BR_NOM_SAMPLE("nom_sam"),
/**
* Clock prescaler for highspeed data time quantum
*/
PCAN_BR_DATA_BRP("data_brp"),
/**
* TSEG1 segment for fast data bit rate in time quanta
*/
PCAN_BR_DATA_TSEG1("data_tseg1"),
/**
* TSEG2 segment for fast data bit rate in time quanta
*/
PCAN_BR_DATA_TSEG2("data_tseg2"),
/**
* Synchronization Jump Width for highspeed data bit rate in time quanta
*/
PCAN_BR_DATA_SJW("data_sjw"),
/**
* Secondary sample point delay for highspeed data bitrate in cyles
*/
PCAN_BR_DATA_SAMPLE("data_ssp_offset");
private final String value;
private TPCANBitrateFDValue(String value) {
this.value = value;
}
/**
* The string value of Bitrate FD string parameter
* @return String corresponding to the bitrate FD string parameter
*/
public String getValue() {
return this.value;
}
};

View File

@ -0,0 +1,111 @@
/* SPDX-License-Identifier: LGPL-2.1-only */
/*
* $Id: TPCANChannelInformation.java 7391 2020-08-10 08:32:30Z Fabrice $
* @LastChange $Date: 2020-08-10 10:32:30 +0200 (Mon, 10 Aug 2020) $
*
* PCANBasic JAVA Interface.
*
* Copyright (C) 2001-2020 PEAK System-Technik GmbH <www.peak-system.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* PCAN is a registered Trademark of PEAK-System Germany GmbH
*
* Author: Fabrice Vergnaud
* Contact: <linux@peak-system.com>
* Maintainer: Fabrice Vergnaud <f.vergnaud@peak-system.com>
*/
package peak.can.basic;
/**
* Class storing the channel's information retrieved with parameter TPCANParameter.PCAN_ATTACHED_CHANNELS.
*/
public class TPCANChannelInformation {
private TPCANHandle _channel_handle; // PCAN channel handle
private TPCANDevice _device_type; // Kind of PCAN device
private byte _controller_number; // CAN-Controller number
private int _device_features; // Device capabilities flag (see FEATURE_*)
private String _device_name; // Device name
private int _device_id; // Device number
private int _channel_condition; // Availability status of a PCAN-Channel
/**
* Default constructor
*/
public TPCANChannelInformation()
{
}
public TPCANHandle getChannelHandle() {
return _channel_handle;
}
public void setChannelHandle(TPCANHandle handle) {
this._channel_handle = handle;
}
public TPCANDevice getDeviceType() {
return _device_type;
}
public void setDeviceType(TPCANDevice type) {
this._device_type = type;
}
public byte getControllerNumber() {
return _controller_number;
}
public void setControllerNumber(byte value) {
this._controller_number = value;
}
public int getDeviceFeatures() {
return _device_features;
}
public void setDeviceFeatures(int features) {
this._device_features = features;
}
public String getDeviceName() {
return _device_name;
}
public void setDeviceName(String name) {
this._device_name = name;
}
public int getDeviceId() {
return _device_id;
}
public void setDeviceId(int id) {
this._device_id = id;
}
public int getChannelCondition() {
return _channel_condition;
}
public void setChannelCondition(int value) {
this._channel_condition = value;
}
public String toListString(String listIndent) {
String str = "";
str += "\n" + listIndent + "channel_handle = " + getChannelHandle();
str += "\n" + listIndent + "device_type = " + getDeviceType();
str += "\n" + listIndent + "controller_number = " + getControllerNumber();
str += "\n" + listIndent + "device_features = " + getDeviceFeatures();
str += "\n" + listIndent + "device_name = " + getDeviceName();
str += "\n" + listIndent + "device_id = 0x" + Integer.toHexString(getDeviceId());
str += "\n" + listIndent + "channel_condition = " + getChannelCondition();
return str;
}
}

View File

@ -0,0 +1,86 @@
/* SPDX-License-Identifier: LGPL-2.1-only */
/*
* $Id: TPCANDevice.java 7391 2020-08-10 08:32:30Z Fabrice $
* @LastChange $Date: 2020-08-10 10:32:30 +0200 (Mon, 10 Aug 2020) $
*
* PCANBasic JAVA Interface.
*
* Copyright (C) 2001-2020 PEAK System-Technik GmbH <www.peak-system.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* PCAN is a registered Trademark of PEAK-System Germany GmbH
*
* Author: Jonathan Urban/Uwe Wilhelm/Fabrice Vergnaud
* Contact: <linux@peak-system.com>
* Maintainer: Fabrice Vergnaud <f.vergnaud@peak-system.com>
*/
package peak.can.basic;
/**
* Represents a PCAN device
*/
public enum TPCANDevice {
/**
* Undefined, unknown or not selected PCAN device value
*/
PCAN_NONE((byte) 0x00),
/**
* PCAN Non-Plug'n'Play devices. NOT USED WITHIN PCAN-Basic API
*/
PCAN_PEAKCAN((byte) 0x01),
/**
* PCAN-ISA, PCAN-PC/104, and PCAN-PC/104-Plus
*/
PCAN_ISA((byte) 0x02),
/**
* PCAN-Dongle
*/
PCAN_DNG((byte) 0x03),
/**
* PCAN-PCI, PCAN-cPCI, PCAN-miniPCI, and PCAN-PCI Express
*/
PCAN_PCI((byte) 0x04),
/**
* PCAN-USB and PCAN-USB Pro
*/
PCAN_USB((byte) 0x05),
/**
* PCAN-PC Card
*/
PCAN_PCC((byte) 0x06),
/**
* PCAN Virtual hardware. NOT USED WITHIN PCAN-Basic API
*/
PCAN_VIRTUAL((byte) 0x07),
/**
* PCAN Gateway devices
*/
PCAN_LAN((byte) 0x08);
private TPCANDevice(byte value) {
this.value = value;
}
/**
* The value of the CAN device
* @return Byte value of the CAN device
*/
public byte getValue() {
return this.value;
}
private final byte value;
};

View File

@ -0,0 +1,284 @@
/* SPDX-License-Identifier: LGPL-2.1-only */
/*
* $Id: TPCANHandle.java 7391 2020-08-10 08:32:30Z Fabrice $
* @LastChange $Date: 2020-08-10 10:32:30 +0200 (Mon, 10 Aug 2020) $
*
* PCANBasic JAVA Interface.
*
* Copyright (C) 2001-2020 PEAK System-Technik GmbH <www.peak-system.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* PCAN is a registered Trademark of PEAK-System Germany GmbH
*
* Author: Jonathan Urban/Uwe Wilhelm/Fabrice Vergnaud
* Contact: <linux@peak-system.com>
* Maintainer: Fabrice Vergnaud <f.vergnaud@peak-system.com>
*/
package peak.can.basic;
import java.util.ArrayDeque;
import java.util.Deque;
/**
* Represents a PCAN-hardware channel handle.
*/
public enum TPCANHandle
{
/**Undefined/default value for a PCAN bus*/
PCAN_NONEBUS((short) 0x00),
/**PCAN-ISA interface, channel 1*/
PCAN_ISABUS1((short) 0x21),
/**PCAN-ISA interface, channel 2*/
PCAN_ISABUS2((short) 0x22),
/**PCAN-ISA interface, channel 3*/
PCAN_ISABUS3((short) 0x23),
/**PCAN-ISA interface, channel 4*/
PCAN_ISABUS4((short) 0x24),
/**PCAN-ISA interface, channel 5*/
PCAN_ISABUS5((short) 0x25),
/**PCAN-ISA interface, channel 6*/
PCAN_ISABUS6((short) 0x26),
/**PCAN-ISA interface, channel 7*/
PCAN_ISABUS7((short) 0x27),
/**PCAN-ISA interface, channel 8*/
PCAN_ISABUS8((short) 0x28),
/**PCAN-Dongle/LPT interface, channel 1*/
PCAN_DNGBUS1((short) 0x31),
/**PCAN-PCI interface, channel 1*/
PCAN_PCIBUS1((short) 0x41),
/**PCAN-PCI interface, channel 2*/
PCAN_PCIBUS2((short) 0x42),
/**PCAN-PCI interface, channel 3*/
PCAN_PCIBUS3((short) 0x43),
/**PCAN-PCI interface, channel 4*/
PCAN_PCIBUS4((short) 0x44),
/**PCAN-PCI interface, channel 5*/
PCAN_PCIBUS5((short) 0x45),
/**PCAN-PCI interface, channel 6*/
PCAN_PCIBUS6((short) 0x46),
/**PCAN-PCI interface, channel 7*/
PCAN_PCIBUS7((short) 0x47),
/**PCAN-PCI interface, channel 8*/
PCAN_PCIBUS8((short) 0x48),
/**PCAN-PCI interface, channel 9*/
PCAN_PCIBUS9((short) 0x409),
/**PCAN-PCI interface, channel 10*/
PCAN_PCIBUS10((short) 0x40A),
/**PCAN-PCI interface, channel 11*/
PCAN_PCIBUS11((short) 0x40B),
/**PCAN-PCI interface, channel 12*/
PCAN_PCIBUS12((short) 0x40C),
/**PCAN-PCI interface, channel 13*/
PCAN_PCIBUS13((short) 0x40D),
/**PCAN-PCI interface, channel 14*/
PCAN_PCIBUS14((short) 0x40E),
/**PCAN-PCI interface, channel 15*/
PCAN_PCIBUS15((short) 0x40F),
/**PCAN-PCI interface, channel 16*/
PCAN_PCIBUS16((short) 0x410),
/**PCAN-USB interface, channel 1*/
PCAN_USBBUS1((short) 0x51),
/**PCAN-USB interface, channel 2*/
PCAN_USBBUS2((short) 0x52),
/**PCAN-USB interface, channel 3*/
PCAN_USBBUS3((short) 0x53),
/**PCAN-USB interface, channel 4*/
PCAN_USBBUS4((short) 0x54),
/**PCAN-USB interface, channel 5*/
PCAN_USBBUS5((short) 0x55),
/**PCAN-USB interface, channel 6*/
PCAN_USBBUS6((short) 0x56),
/**PCAN-USB interface, channel 7*/
PCAN_USBBUS7((short) 0x57),
/**PCAN-USB interface, channel 8*/
PCAN_USBBUS8((short) 0x58),
/**PCAN-USB interface, channel 9*/
PCAN_USBBUS9((short) 0x509),
/**PCAN-USB interface, channel 10*/
PCAN_USBBUS10((short) 0x50A),
/**PCAN-USB interface, channel 11*/
PCAN_USBBUS11((short) 0x50B),
/**PCAN-USB interface, channel 12*/
PCAN_USBBUS12((short) 0x50C),
/**PCAN-USB interface, channel 13*/
PCAN_USBBUS13((short) 0x50D),
/**PCAN-USB interface, channel 14*/
PCAN_USBBUS14((short) 0x50E),
/**PCAN-USB interface, channel 15*/
PCAN_USBBUS15((short) 0x50F),
/**PCAN-USB interface, channel 16*/
PCAN_USBBUS16((short) 0x510),
/**PCAN-PC Card interface, channel 1*/
PCAN_PCCBUS1((short) 0x61),
/**PCAN-PC Card interface, channel 2*/
PCAN_PCCBUS2((short) 0x62),
/**PCAN-LAN1 interface, channel 1*/
PCAN_LANBUS1((short) 0x801),
/**PCAN-LAN2 interface, channel 2*/
PCAN_LANBUS2((short) 0x802),
/**PCAN-LAN3 interface, channel 3*/
PCAN_LANBUS3((short) 0x803),
/**PCAN-LAN4 interface, channel 4*/
PCAN_LANBUS4((short) 0x804),
/**PCAN-LAN5 interface, channel 5*/
PCAN_LANBUS5((short) 0x805),
/**PCAN-LAN6 interface, channel 6*/
PCAN_LANBUS6((short) 0x806),
/**PCAN-LAN7 interface, channel 7*/
PCAN_LANBUS7((short) 0x807),
/**PCAN-LAN8 interface, channel 8*/
PCAN_LANBUS8((short) 0x808),
/**PCAN-LAN interface, channel 9*/
PCAN_LANBUS9((short) 0x809),
/**PCAN-LAN interface, channel 10*/
PCAN_LANBUS10((short) 0x80A),
/**PCAN-LAN interface, channel 11*/
PCAN_LANBUS11((short) 0x80B),
/**PCAN-LAN interface, channel 12*/
PCAN_LANBUS12((short) 0x80C),
/**PCAN-LAN interface, channel 13*/
PCAN_LANBUS13((short) 0x80D),
/**PCAN-LAN interface, channel 14*/
PCAN_LANBUS14((short) 0x80E),
/**PCAN-LAN interface, channel 15*/
PCAN_LANBUS15((short) 0x80F),
/**PCAN-LAN interface, channel 16*/
PCAN_LANBUS16((short) 0x810);
/**
* Creates a CAN Handle
* @param value value of the CAN Handle
*/
private TPCANHandle(short value)
{
this.value = value;
}
/**
* The value of the CAN handle
* @return Value of the CAN handle
*/
public short getValue()
{
return this.value;
}
/**
* Returns All PCAN Channels which are initializable (All except PCAN_NONEBUS)
* @return PCAN Channels array
*/
public static Object[] initializableChannels()
{
TPCANHandle[] values = TPCANHandle.values();
int size = values.length;
Deque<TPCANHandle> result = new ArrayDeque<TPCANHandle>(size);
for (int i = 1; i < size; i++)
{
result.add(values[i]);
}
return result.toArray();
}
/**
* Verify the provided TPCANHandle is an USB Device
* @param handle to verify
* @return true if the TPCANHandle is an USB Device, false if not
*/
public static boolean isPCANUSBHardware(TPCANHandle handle)
{
switch (handle)
{
case PCAN_USBBUS1:
case PCAN_USBBUS2:
case PCAN_USBBUS3:
case PCAN_USBBUS4:
case PCAN_USBBUS5:
case PCAN_USBBUS6:
case PCAN_USBBUS7:
case PCAN_USBBUS8:
case PCAN_USBBUS9:
case PCAN_USBBUS10:
case PCAN_USBBUS11:
case PCAN_USBBUS12:
case PCAN_USBBUS13:
case PCAN_USBBUS14:
case PCAN_USBBUS15:
case PCAN_USBBUS16:
return true;
default:
return false;
}
}
/**
* Verify the provided TPCANHandle is an PC-Card Device
* @param handle to verify
* @return true if the TPCANHandle is an PC-Card Device, false if not
*/
public static boolean isPCANPCCardHardware(TPCANHandle handle)
{
switch (handle)
{
case PCAN_PCCBUS1:
case PCAN_PCCBUS2:
return true;
default:
return false;
}
}
/**
* Verify the provided TPCANHandle contains a SJA1000 controller
* @param handle to verify
* @param type the PCAN device associated with the handle
* @return true if the TPCANHandle contains a SJA1000 controller, false if not
*/
public static boolean containsSJA(TPCANHandle handle, TPCANType type)
{
switch (handle)
{
case PCAN_DNGBUS1:
case PCAN_ISABUS1:
case PCAN_ISABUS2:
case PCAN_ISABUS3:
case PCAN_ISABUS4:
case PCAN_ISABUS5:
case PCAN_ISABUS6:
case PCAN_ISABUS7:
case PCAN_ISABUS8:
switch (type)
{
case PCAN_TYPE_DNG_SJA:
case PCAN_TYPE_DNG_SJA_EPP:
case PCAN_TYPE_ISA_SJA:
return true;
default:
break;
}
default:
break;
}
return false;
}
private final short value;
};

View File

@ -0,0 +1,101 @@
/* SPDX-License-Identifier: LGPL-2.1-only */
/*
* $Id: TPCANMessageType.java 7391 2020-08-10 08:32:30Z Fabrice $
* @LastChange $Date: 2020-08-10 10:32:30 +0200 (Mon, 10 Aug 2020) $
*
* PCANBasic JAVA Interface.
*
* Copyright (C) 2001-2020 PEAK System-Technik GmbH <www.peak-system.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* PCAN is a registered Trademark of PEAK-System Germany GmbH
*
* Author: Jonathan Urban/Uwe Wilhelm/Fabrice Vergnaud
* Contact: <linux@peak-system.com>
* Maintainer: Fabrice Vergnaud <f.vergnaud@peak-system.com>
*/
package peak.can.basic;
import java.util.EnumSet;
/**
* Represents the type of a PCAN message
*/
public enum TPCANMessageType {
/**
* The PCAN message is a CAN Standard Frame (11-bit identifier)
*/
PCAN_MESSAGE_STANDARD((byte) 0x00),
/**
* The PCAN message is a CAN Remote-Transfer-Request Frame
*/
PCAN_MESSAGE_RTR((byte) 0x01),
/**
* The PCAN message is a CAN Extended Frame (29-bit identifier)
*/
PCAN_MESSAGE_EXTENDED((byte) 0x02),
/**
* The PCAN message represents a FD frame in terms of CiA Specs
*/
PCAN_MESSAGE_FD((byte) 0x04),
/**
* The PCAN message represents a FD bit rate switch (CAN data at a higher
* bitrate)
*/
PCAN_MESSAGE_BRS((byte) 0x08),
/**
* The PCAN message represents a FD error state indicator(CAN FD transmitter was
* error active)
*/
PCAN_MESSAGE_ESI((byte) 0x10),
/**
* The PCAN message represents an error frame
*/
PCAN_MESSAGE_ERRFRAME((byte) 0x40),
/**
* The PCAN message represents a PCAN status message
*/
PCAN_MESSAGE_STATUS((byte) 0x80);
private TPCANMessageType(byte value) {
this.value = value;
}
/**
* The value of the message type
*
* @return Value of the message type
*/
public byte getValue() {
return this.value;
}
private final byte value;
/**
* Gets the value of an EnumSet
*
* @param type collection of TPCANMessageType
* @return value of the EnumSet
*/
public static byte getValue(EnumSet<TPCANMessageType> type) {
byte result = 0;
for (TPCANMessageType t : type)
result |= t.value;
return result;
}
}

View File

@ -0,0 +1,58 @@
/* SPDX-License-Identifier: LGPL-2.1-only */
/*
* $Id: TPCANMode.java 7391 2020-08-10 08:32:30Z Fabrice $
* @LastChange $Date: 2020-08-10 10:32:30 +0200 (Mon, 10 Aug 2020) $
*
* PCANBasic JAVA Interface.
*
* Copyright (C) 2001-2020 PEAK System-Technik GmbH <www.peak-system.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* PCAN is a registered Trademark of PEAK-System Germany GmbH
*
* Author: Jonathan Urban/Uwe Wilhelm/Fabrice Vergnaud
* Contact: <linux@peak-system.com>
* Maintainer: Fabrice Vergnaud <f.vergnaud@peak-system.com>
*/
package peak.can.basic;
/**
* Represents a PCAN filter mode.
*/
public enum TPCANMode {
/**
* Mode is Standard (11-bit identifier).
*/
PCAN_MODE_STANDARD(TPCANMessageType.PCAN_MESSAGE_STANDARD.getValue()),
/**
* Mode is Extended (29-bit identifier).
*/
PCAN_MODE_EXTENDED(TPCANMessageType.PCAN_MESSAGE_EXTENDED.getValue());
private TPCANMode(byte value) {
this.value = value;
}
/**
* The value of the CAN ID type
* @return Value of the CAN ID type
*/
public byte getValue() {
return this.value;
}
private final byte value;
};

View File

@ -0,0 +1,218 @@
/* SPDX-License-Identifier: LGPL-2.1-only */
/*
* $Id: TPCANMsg.java 7391 2020-08-10 08:32:30Z Fabrice $
* @LastChange $Date: 2020-08-10 10:32:30 +0200 (Mon, 10 Aug 2020) $
*
* PCANBasic JAVA Interface.
*
* Copyright (C) 2001-2020 PEAK System-Technik GmbH <www.peak-system.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* PCAN is a registered Trademark of PEAK-System Germany GmbH
*
* Author: Jonathan Urban/Uwe Wilhelm/Fabrice Vergnaud
* Contact: <linux@peak-system.com>
* Maintainer: Fabrice Vergnaud <f.vergnaud@peak-system.com>
*/
package peak.can.basic;
import java.util.EnumSet;
/**
* Defines a CAN message.
*/
public class TPCANMsg implements Cloneable
{
/**
* 11bit message type (standard)
* @deprecated Use enum TPCANMessageType instead
*/
@Deprecated
static public final byte MSGTYPE_STANDARD = TPCANMessageType.PCAN_MESSAGE_STANDARD.getValue();
/**
* Remote request
* @deprecated Use enum TPCANMessageType instead
*/
@Deprecated
static public final byte MSGTYPE_RTR = TPCANMessageType.PCAN_MESSAGE_RTR.getValue();
/**
* 29bit message type (extended)
* @deprecated Use enum TPCANMessageType instead
*/
@Deprecated
static public final byte MSGTYPE_EXTENDED = TPCANMessageType.PCAN_MESSAGE_EXTENDED.getValue();
private int _id;
private byte _type;
private byte _length;
private byte _data[];
/**
* Default constructor
*/
public TPCANMsg()
{
_data = new byte[8];
}
// rusEFI custom https://github.com/rusefi/rusefi/issues/4370 workaround
public TPCANMsg(byte length)
{
_data = new byte[length];
}
/**
* Constructs a new message object.
* @param id the message id
* @param type the message type
* @param length the message length
* @param data the message data
*/
public TPCANMsg(int id, byte type, byte length, byte[] data)
{
_id = id;
_type = type;
_length = length;
_data = new byte[length];
System.arraycopy(data, 0, _data, 0, length);
}
/**
* Constructs a new message object.
* @param id the message id
* @param type the message type as an enumeration set
* @param length the message length
* @param data the message data
*/
public TPCANMsg(int id, EnumSet<TPCANMessageType> type, byte length, byte[] data)
{
_id = id;
_type = TPCANMessageType.getValue(type);
_length = length;
_data = new byte[length];
System.arraycopy(data, 0, _data, 0, length);
}
/**
* Sets the id of this message.
* @param id the message id
*/
public void setID(int id)
{
_id = id;
}
/**
* Sets the data and length of this message.
* @param data the message data
* @param length the message length
*/
public void setData(byte[] data, byte length)
{
_length = length;
System.arraycopy(data, 0, _data, 0, length);
}
/**
* Sets the length of this message.
* @param length the length of the message
*/
public void setLength(byte length)
{
_length = length;
}
/**
* Sets the type of this message.
* @param type the message type
*/
public void setType(byte type)
{
_type = type;
}
/**
* Sets the type of this message.
* @param type the message type
*/
public void setType(TPCANMessageType type)
{
_type = type.getValue();
}
/**
* Sets the type of this message.
* @param type the message type
*/
public void setType(EnumSet<TPCANMessageType> type)
{
_type = TPCANMessageType.getValue(type);
}
/**
* Gets the id of this message.
* @return the message id
*/
public int getID()
{
return _id;
}
/**
* Gets the data of this message.
* @return the message data
*/
public byte[] getData()
{
return _data;
}
/**
* Gets the length of this message.
* @return the message length
*/
public byte getLength()
{
return _length;
}
/**
* Gets the type of this message.
* @return the message type
*/
public byte getType()
{
return _type;
}
/**
* Clones this message object.
* @return The cloned message object.
*/
@Override
public Object clone()
{
TPCANMsg msg = null;
try
{
msg = (TPCANMsg) super.clone();
msg._data = _data.clone();
}
catch (CloneNotSupportedException e)
{
System.out.println(e.getMessage());
}
return msg;
}
}

View File

@ -0,0 +1,237 @@
/* SPDX-License-Identifier: LGPL-2.1-only */
/*
* $Id: TPCANMsgFD.java 7391 2020-08-10 08:32:30Z Fabrice $
* @LastChange $Date: 2020-08-10 10:32:30 +0200 (Mon, 10 Aug 2020) $
*
* PCANBasic JAVA Interface.
*
* Copyright (C) 2001-2020 PEAK System-Technik GmbH <www.peak-system.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* PCAN is a registered Trademark of PEAK-System Germany GmbH
*
* Author: Jonathan Urban/Uwe Wilhelm/Fabrice Vergnaud
* Contact: <linux@peak-system.com>
* Maintainer: Fabrice Vergnaud <f.vergnaud@peak-system.com>
*/
package peak.can.basic;
import java.util.EnumSet;
/**
* Defines a CAN FD message.
*/
public class TPCANMsgFD implements Cloneable
{
private int _id;
private EnumSet<TPCANMessageType> _type;
private byte _dlc;
private byte _len;
private byte _data[];
/**
* Default constructor
*/
public TPCANMsgFD()
{
_data = new byte[64];
}
/**
* Constructs a new message object.
* @param id the message id
* @param type the message type
* @param dlc the message data length code
* @param data the message data
*/
public TPCANMsgFD(int id, EnumSet<TPCANMessageType> type, byte dlc, byte[] data)
{
_id = id;
_type = type;
_dlc = dlc;
_len = getLengthFromDLC(dlc);
_data = new byte[64];
System.arraycopy(data, 0, _data, 0, _len);
}
/**
* Sets the id of this message.
* @param id the message id
*/
public void setID(int id)
{
_id = id;
}
/**
* Sets the data and length of this message.
* @param data the message data
* @param dlc the message length
*/
public void setData(byte[] data, byte dlc)
{
setDlc(dlc);
System.arraycopy(data, 0, _data, 0, _len);
}
/**
* Sets the data length code of this message.
* @param dlc the data length code of the message
*/
public void setDlc(byte dlc)
{
_dlc = dlc;
_len = getLengthFromDLC(dlc);
}
/**
* Sets the type of this message.
* @param type the message type
*/
public void setType(EnumSet<TPCANMessageType> type)
{
_type = type;
}
/**
* Sets the type of this message.
* @param type the message type
*/
public void setType(byte type)
{
EnumSet<TPCANMessageType> eset;
eset = EnumSet.noneOf(TPCANMessageType.class);
for (TPCANMessageType t : TPCANMessageType.values()) {
if ((type & t.getValue()) == t.getValue())
eset.add(t);
}
// fix type PCAN_MESSAGE_STANDARD (value is 0)
if (eset.contains(TPCANMessageType.PCAN_MESSAGE_EXTENDED) ||
eset.contains(TPCANMessageType.PCAN_MESSAGE_STATUS) ||
eset.contains(TPCANMessageType.PCAN_MESSAGE_RTR) ||
eset.contains(TPCANMessageType.PCAN_MESSAGE_BRS) ||
eset.contains(TPCANMessageType.PCAN_MESSAGE_ESI))
eset.remove(TPCANMessageType.PCAN_MESSAGE_STANDARD);
_type = eset;
}
/**
* Gets the id of this message.
* @return the message id
*/
public int getID()
{
return _id;
}
/**
* Gets the data of this message.
* @return the message data
*/
public byte[] getData()
{
return _data;
}
/**
* Gets the data length code of this message.
* @return the message length
*/
public byte getDlc()
{
return _dlc;
}
/**
* Gets the length of this message based on its DLC.
* @return the message length
*/
public byte getLengthFromDLC()
{
return getLengthFromDLC(_dlc);
}
/**
* Gets the length of a message based on a DLC.
* @param dlc data length code
* @return the message length
*/
public static byte getLengthFromDLC(byte dlc)
{
switch(dlc)
{
case 9:
return 12;
case 10:
return 16;
case 11:
return 20;
case 12:
return 24;
case 13:
return 32;
case 14:
return 48;
case 15:
return 64;
default:
return dlc;
}
}
/**
* Gets the type of this message.
* @return the message type
*/
public EnumSet<TPCANMessageType> getTypeEnum()
{
return _type;
}
/**
* Gets the type of this message.
* @return the message type
*/
public byte getType()
{
byte res;
res = 0;
for (TPCANMessageType t : _type)
res |= t.getValue();
return res;
}
/**
* Clones this message object.
* @return The cloned message object.
*/
@Override
public Object clone()
{
TPCANMsgFD msg = null;
try
{
msg = (TPCANMsgFD) super.clone();
msg._data = _data.clone();
}
catch (CloneNotSupportedException e)
{
System.out.println(e.getMessage());
}
return msg;
}
}

View File

@ -0,0 +1,434 @@
/* SPDX-License-Identifier: LGPL-2.1-only */
/*
* $Id: TPCANParameter.java 7391 2020-08-10 08:32:30Z Fabrice $
* @LastChange $Date: 2020-08-10 10:32:30 +0200 (Mon, 10 Aug 2020) $
*
* PCANBasic JAVA Interface.
*
* Copyright (C) 2001-2020 PEAK System-Technik GmbH <www.peak-system.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* PCAN is a registered Trademark of PEAK-System Germany GmbH
*
* Author: Jonathan Urban/Uwe Wilhelm/Fabrice Vergnaud
* Contact: <linux@peak-system.com>
* Maintainer: Fabrice Vergnaud <f.vergnaud@peak-system.com>
*/
package peak.can.basic;
import java.util.ArrayDeque;
import java.util.Deque;
/**
* Parameter definition.
*/
public enum TPCANParameter {
/**
* PCAN-USB device number parameter
*
* @deprecated Deprecated parameter. Use PCAN_DEVICE_ID instead
*/
PCAN_DEVICE_NUMBER(0x01),
/**
* PCAN-USB device number parameter
*/
PCAN_DEVICE_ID(0x01),
/**
* PCAN-PC Card 5-Volt power parameter
*/
PCAN_5VOLTS_POWER(0x02),
/**
* PCAN receive event handler parameter
*/
PCAN_RECEIVE_EVENT(0x03),
/**
* PCAN message filter parameter
*/
PCAN_MESSAGE_FILTER(0x04),
/**
* PCAN-Basic API version parameter
*/
PCAN_API_VERSION(0x05),
/**
* PCAN device channel version parameter
*/
PCAN_CHANNEL_VERSION(0x06),
/**
* PCAN Reset-On-Busoff parameter
*/
PCAN_BUSOFF_AUTORESET(0x07),
/**
* PCAN Listen-Only parameter
*/
PCAN_LISTEN_ONLY(0x08),
/**
* Directory path for trace files
*/
PCAN_LOG_LOCATION(0x09),
/**
* Debug-Trace activation status
*/
PCAN_LOG_STATUS(0x0A),
/**
* Configuration of the debugged information (LOG_FUNCTION_***)
*/
PCAN_LOG_CONFIGURE(0x0B),
/**
* Custom insertion of text into the log file
*/
PCAN_LOG_TEXT(0x0C),
/**
* Availability status of a PCAN-Channel
*/
PCAN_CHANNEL_CONDITION(0x0D),
/**
* PCAN hardware name parameter
*/
PCAN_HARDWARE_NAME(0x0E),
/**
* Message reception status of a PCAN-Channel
*/
PCAN_RECEIVE_STATUS(0x0F),
/**
* CAN-Controller number of a PCAN-Channel
*/
PCAN_CONTROLLER_NUMBER(0x10),
/**
* Directory path for PCAN trace files
*/
PCAN_TRACE_LOCATION(0x11),
/**
* CAN tracing activation status
*/
PCAN_TRACE_STATUS(0x12),
/**
* Configuration of the maximum file size of a CAN trace
*/
PCAN_TRACE_SIZE(0x13),
/**
* Configuration of the trace file storing mode (TRACE_FILE_***)
*/
PCAN_TRACE_CONFIGURE(0x14),
/**
* Physical identification of a USB based PCAN-Channel by blinking its
* associated LED
*/
PCAN_CHANNEL_IDENTIFYING(0x15),
/**
* Capabilities of a PCAN device (FEATURE_***)
*/
PCAN_CHANNEL_FEATURES(0x16),
/**
* Using of an existing bit rate (PCAN-View connected to a channel)
*/
PCAN_BITRATE_ADAPTING(0x17),
/**
* Configured Bit rate as Btr0Btr1 value
*/
PCAN_BITRATE_INFO(0x18),
/**
* Configured Bit rate as TPCANBitrateFD string
*/
PCAN_BITRATE_INFO_FD(0x19),
/**
* Configured nominal CAN Bus speed as Bits per seconds
*/
PCAN_BUSSPEED_NOMINAL(0x1A),
/**
* Configured CAN data speed as Bits per seconds
*/
PCAN_BUSSPEED_DATA(0x1B),
/**
* Remote address of a LAN channel as string in IPv4 format
*/
PCAN_IP_ADDRESS(0x1C),
/**
* Status of the Virtual PCAN-Gateway Service
*/
PCAN_LAN_SERVICE_STATUS(0x1D),
/**
* Status messages reception status within a PCAN-Channel
*/
PCAN_ALLOW_STATUS_FRAMES(0x1E),
/**
* RTR messages reception status within a PCAN-Channel
*/
PCAN_ALLOW_RTR_FRAMES(0x1F),
/**
* Error messages reception status within a PCAN-Channel
*/
PCAN_ALLOW_ERROR_FRAMES(0x20),
/**
* Delay, in microseconds, between sending frames
*/
PCAN_INTERFRAME_DELAY(0x21),
/**
* Filter over code and mask patterns for 11-Bit messages
*/
PCAN_ACCEPTANCE_FILTER_11BIT(0x22),
/**
* Filter over code and mask patterns for 29-Bit messages
*/
PCAN_ACCEPTANCE_FILTER_29BIT(0x23),
/**
* Output mode of 32 digital I/O pin of a PCAN-USB Chip. 1: Output-Active 0 :
* Output Inactive
*/
PCAN_IO_DIGITAL_CONFIGURATION(0x24),
/**
* Value assigned to a 32 digital I/O pins of a PCAN-USB Chip
*/
PCAN_IO_DIGITAL_VALUE(0x25),
/**
* Value assigned to a 32 digital I/O pins of a PCAN-USB Chip - Multiple digital
* I/O pins to 1 = High
*/
PCAN_IO_DIGITAL_SET(0x26),
/**
* Clear multiple digital I/O pins to 0
*/
PCAN_IO_DIGITAL_CLEAR(0x27),
/**
* Get value of a single analog input pin
*/
PCAN_IO_ANALOG_VALUE(0x28),
/**
* Get the version of the firmware used by the device associated with a
* PCAN-Channel
*/
PCAN_FIRMWARE_VERSION(0x29),
/**
* Get the amount of PCAN channels attached to a system
*/
PCAN_ATTACHED_CHANNELS_COUNT(0x2A),
/**
* Get information about PCAN channels attached to a system
*/
PCAN_ATTACHED_CHANNELS(0x2B);
private TPCANParameter(int value) {
this.value = value;
}
/**
* The identifier of the CAN parameter
*
* @return Identifier of the CAN parameter
*/
public int getValue() {
return this.value;
}
/**
* Returns the list of PCAN Parameters which are customizable as array
*
* @return the list of PCAN Parameters which are customizable as array
*/
public static TPCANParameter[] customizableParameters() {
Deque<TPCANParameter> result = new ArrayDeque<TPCANParameter>();
result.add(TPCANParameter.PCAN_DEVICE_ID);
result.add(TPCANParameter.PCAN_5VOLTS_POWER);
result.add(TPCANParameter.PCAN_API_VERSION);
result.add(TPCANParameter.PCAN_CHANNEL_VERSION);
result.add(TPCANParameter.PCAN_BUSOFF_AUTORESET);
result.add(TPCANParameter.PCAN_LISTEN_ONLY);
result.add(TPCANParameter.PCAN_LOG_LOCATION);
result.add(TPCANParameter.PCAN_LOG_STATUS);
result.add(TPCANParameter.PCAN_LOG_CONFIGURE);
result.add(TPCANParameter.PCAN_CHANNEL_CONDITION);
result.add(TPCANParameter.PCAN_HARDWARE_NAME);
result.add(TPCANParameter.PCAN_RECEIVE_STATUS);
result.add(TPCANParameter.PCAN_CONTROLLER_NUMBER);
result.add(TPCANParameter.PCAN_TRACE_LOCATION);
result.add(TPCANParameter.PCAN_TRACE_STATUS);
result.add(TPCANParameter.PCAN_TRACE_SIZE);
result.add(TPCANParameter.PCAN_TRACE_CONFIGURE);
result.add(TPCANParameter.PCAN_CHANNEL_IDENTIFYING);
result.add(TPCANParameter.PCAN_CHANNEL_FEATURES);
result.add(TPCANParameter.PCAN_BITRATE_ADAPTING);
result.add(TPCANParameter.PCAN_BITRATE_INFO);
result.add(TPCANParameter.PCAN_BITRATE_INFO_FD);
result.add(TPCANParameter.PCAN_BUSSPEED_NOMINAL);
result.add(TPCANParameter.PCAN_BUSSPEED_DATA);
result.add(TPCANParameter.PCAN_IP_ADDRESS);
result.add(TPCANParameter.PCAN_LAN_SERVICE_STATUS);
result.add(TPCANParameter.PCAN_ALLOW_STATUS_FRAMES);
result.add(TPCANParameter.PCAN_ALLOW_RTR_FRAMES);
result.add(TPCANParameter.PCAN_ALLOW_ERROR_FRAMES);
result.add(TPCANParameter.PCAN_INTERFRAME_DELAY);
result.add(TPCANParameter.PCAN_ACCEPTANCE_FILTER_11BIT);
result.add(TPCANParameter.PCAN_ACCEPTANCE_FILTER_29BIT);
result.add(TPCANParameter.PCAN_IO_DIGITAL_CONFIGURATION);
result.add(TPCANParameter.PCAN_IO_DIGITAL_VALUE);
result.add(TPCANParameter.PCAN_IO_DIGITAL_SET);
result.add(TPCANParameter.PCAN_IO_DIGITAL_CLEAR);
result.add(TPCANParameter.PCAN_IO_ANALOG_VALUE);
result.add(TPCANParameter.PCAN_FIRMWARE_VERSION);
result.add(TPCANParameter.PCAN_ATTACHED_CHANNELS_COUNT);
result.add(TPCANParameter.PCAN_ATTACHED_CHANNELS);
return result.toArray(new TPCANParameter[result.size()]);
}
/**
* Returns a description for the given TPCANParameter
*
* @param param TPCANParameter for which we need description
* @return a string description for the given TPCANParameter
*/
public static String getParameterDescription(TPCANParameter param) {
String description = "";
switch (param) {
case PCAN_DEVICE_NUMBER:
case PCAN_DEVICE_ID:
description = "This parameter is used on PCAN-USB hardware to distinguish between 2 (or more) of them on the same computer. This value is persistent, i.e. the identifier will not be lost after disconnecting and connecting again the hardware.";
break;
case PCAN_5VOLTS_POWER:
description = "This parameter is used on PCAN-PC Card hardware for switching the external 5V on the D-Sub connector of the PC Card. This is useful when connecting external bus converter modules to the card (AU5790 / TJA1954)).";
break;
case PCAN_RECEIVE_EVENT:
description = "This parameter allows the user to easily configure the message filter of a PCAN channel. With it is possible to fully open or complete close the filter.";
break;
case PCAN_MESSAGE_FILTER:
description = "This parameter is used to let the PCAN driver notify an application when CAN messages are placed in its receive queue.";
break;
case PCAN_API_VERSION:
description = "This parameter is used to get information about the PCAN-Basic API implementation version.";
break;
case PCAN_CHANNEL_VERSION:
description = "This parameter is used to get version information about the Driver of a PCAN Channel.";
break;
case PCAN_BUSOFF_AUTORESET:
description = "This parameter instructs the PCAN driver to reset automatically the CAN controller of a PCAN channel when a bus-off state is detected. Since no communication is possible on a bus-off state, it is useful to let the driver to catch this event automatically and reset the controller, avoiding extra handling of this problem in an end application.";
break;
case PCAN_LISTEN_ONLY:
description = "This parameter allows the user to set a CAN hardware in Listen-Only mode. When this mode is set, the CAN controller doens't take part on active events (eg. transmit CAN messages) but stays in a passive mode (CAN monitor), in which it can analyse the traffic on the CAN bus used by a PCAN channel. See also the Philips Data Sheet \"SJA1000 Stand-alone CAN controller\".";
break;
case PCAN_LOG_LOCATION:
description = "This value is used to set the folder location on a computer for the Log-File generated by the PCAN-Basic API, within a debug session. Setting this value starts recording debug information automatically. If a debug session is running (a log file is being written), PCAN_LOG_LOCATION instructs the API to close the current log file and to start the process again with the new folder information. Note that the name of the log file cannot be specified, this name is fixed as PCANBasic.log.";
break;
case PCAN_LOG_STATUS:
description = "This value is used to control the activity status of a debug session within the PCAN-Basic API. If the log status is set to ON without having set a location for the log file or without having configured the information to be traced, then the session process will start with the default values.";
break;
case PCAN_LOG_CONFIGURE:
description = "This value is used to configure the debug information to be included in the log file generated in a debug session within the PCAN-Basic API.";
break;
case PCAN_LOG_TEXT:
description = "This Parameter is used to insert custom information in the log file generated in a debug session within the PCAN-Basic API.";
break;
case PCAN_CHANNEL_CONDITION:
description = "This parameter is used to check and detect available PCAN hardware on a computer, even before trying to connect any of them. This is useful when an application wants the user to select which hardware should be using in a communication session.";
break;
case PCAN_HARDWARE_NAME:
description = "This parameter is to read the Name of the Hardware.";
break;
case PCAN_RECEIVE_STATUS:
description = "This Parameter is to get the reception status of a PCAN-Channel.";
break;
case PCAN_CONTROLLER_NUMBER:
description = "This Parameter is to get CAN-Controller number of a PCAN-Channel. Only usefull with 2 Channel HW.";
break;
case PCAN_TRACE_LOCATION:
description = "This Parameter is used to configure the Trace File Directory.";
break;
case PCAN_TRACE_STATUS:
description = "This Parameter is used to control the activity of the Tracer status.";
break;
case PCAN_TRACE_SIZE:
description = "This Parameter is used to configure the maximum file size of a CAN trace.";
break;
case PCAN_TRACE_CONFIGURE:
description = "This Parameter is used to configure the trace file storing mode (TRACE_FILE_***).";
break;
case PCAN_CHANNEL_IDENTIFYING:
description = "This Parameter is used to Physically identify a USB based PCAN-Channel by blinking its associated LED.";
break;
case PCAN_CHANNEL_FEATURES:
description = "This Parameter is used to get the capabilities of a PCAN device.";
break;
case PCAN_BITRATE_ADAPTING:
description = "This Parameter is used to force an initialization process to succeed, even if the PCAN-Channel is being used by a PCAN-View with a different or unknown bit rate.";
break;
case PCAN_BITRATE_INFO:
description = "This Parameter is used to read the currently configured communication speed of a PCAN Channel connected as standard CAN.";
break;
case PCAN_BITRATE_INFO_FD:
description = "This Parameter is used to read the currently configured communication speed, as a parameterized string value (FD Bit rate String), of a PCAN Channel connected as CAN FD.";
break;
case PCAN_BUSSPEED_NOMINAL:
description = "This Parameter is used to read the configured nominal CAN Bus speed as Bits per seconds.";
break;
case PCAN_BUSSPEED_DATA:
description = "This Parameter is used to read configured CAN data speed as Bits per seconds.";
break;
case PCAN_IP_ADDRESS:
description = "This Parameter is used to read the remote address of a LAN channel as string in IPv4 format.";
break;
case PCAN_LAN_SERVICE_STATUS:
description = "This Parameter is used to read the status of the Virtual PCAN-Gateway Service.";
break;
case PCAN_ALLOW_STATUS_FRAMES:
description = "This Parameter is used to configure the reception of status messages within a PCAN-Channel.";
break;
case PCAN_ALLOW_RTR_FRAMES:
description = "This Parameter is used to configure the reception of RTR messages within a PCAN-Channel.";
break;
case PCAN_ALLOW_ERROR_FRAMES:
description = "This Parameter is used to configure the reception of Error messages within a PCAN-Channel.";
break;
case PCAN_INTERFRAME_DELAY:
description = "This Parameter is used to configure the delay, in microseconds, between sending frames.";
break;
case PCAN_ACCEPTANCE_FILTER_11BIT:
description = "This Parameter is used to configure the filter over code and mask patterns for 11-Bit messages.";
break;
case PCAN_ACCEPTANCE_FILTER_29BIT:
description = "This Parameter is used to configure the filter over code and mask patterns for 29-Bit messages.";
break;
case PCAN_IO_DIGITAL_CONFIGURATION:
description = "This Parameter is used to configure the output mode of 32 digital I/O pin of a PCAN-USB Chip (1: Output Active, 0: Output Inactive).";
break;
case PCAN_IO_DIGITAL_VALUE:
description = "This Parameter is used to configure the value assigned to a 32 digital I/O pins of a PCAN-USB Chip.";
break;
case PCAN_IO_DIGITAL_SET:
description = "This Parameter is used to configure the value assigned to a 32 digital I/O pins of a PCAN-USB Chip (Multiple digital I/O pins to 1 = High).";
break;
case PCAN_IO_DIGITAL_CLEAR:
description = "This Parameter is used to clear multiple digital I/O pins to 0.";
break;
case PCAN_IO_ANALOG_VALUE:
description = "This Parameter is used to read the value of a single analog input pin.";
break;
case PCAN_FIRMWARE_VERSION:
description = "This Parameter is used to read the version of the firmware used by the device associated with a PCAN-Channel.";
break;
case PCAN_ATTACHED_CHANNELS_COUNT:
description = "This Parameter is used to read the amount of PCAN channels attached to a system.";
break;
case PCAN_ATTACHED_CHANNELS:
description = "This Parameter is used to read information about PCAN channels attached to a system.";
break;
default:
break;
}
return description;
}
private final int value;
}

View File

@ -0,0 +1,186 @@
/* SPDX-License-Identifier: LGPL-2.1-only */
/*
* $Id: TPCANParameterValue.java 7391 2020-08-10 08:32:30Z Fabrice $
* @LastChange $Date: 2020-08-10 10:32:30 +0200 (Mon, 10 Aug 2020) $
*
* PCANBasic JAVA Interface.
*
* Copyright (C) 2001-2020 PEAK System-Technik GmbH <www.peak-system.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* PCAN is a registered Trademark of PEAK-System Germany GmbH
*
* Author: Jonathan Urban/Uwe Wilhelm/Fabrice Vergnaud
* Contact: <linux@peak-system.com>
* Maintainer: Fabrice Vergnaud <f.vergnaud@peak-system.com>
*/
package peak.can.basic;
import java.util.*;
//import java.util.RegularEnumSet;
/**
* Parameter values definition
*/
public enum TPCANParameterValue
{
/** The PCAN parameter is not set (inactive) */
PCAN_PARAMETER_OFF(0),
/** The PCAN parameter is set (active) */
PCAN_PARAMETER_ON(1),
/** The PCAN filter is closed. No messages will be received */
PCAN_FILTER_CLOSE(0),
/** The PCAN filter is fully opened. All messages will be received */
PCAN_FILTER_OPEN(1),
/** The PCAN filter is custom configured. Only registered messages will be received */
PCAN_FILTER_CUSTOM(2),
/** The PCAN-Channel handle is illegal */
PCAN_CHANNEL_UNAVAILABLE(0),
/** The PCAN-Channel handle is valid to connect/initialize */
PCAN_CHANNEL_AVAILABLE(1),
/** The PCAN-Channel handle is valid, but is already being used */
PCAN_CHANNEL_OCCUPIED(2),
/** The PCAN-Channel handle is already being used by a PCAN-View application, but is available to connect */
PCAN_CHANNEL_PCANVIEW(PCAN_CHANNEL_AVAILABLE.value | PCAN_CHANNEL_OCCUPIED.value),
/** Logs system exceptions / errors */
LOG_FUNCTION_DEFAULT(0x00),
/** Logs the entries to the PCAN-Basic API functions */
LOG_FUNCTION_ENTRY(0x01),
/** Logs the parameters passed to the PCAN-Basic API functions */
LOG_FUNCTION_PARAMETERS(0x02),
/** Logs the exits from the PCAN-Basic API functions */
LOG_FUNCTION_LEAVE(0x04),
/** Logs the CAN messages passed to the CAN_Write function */
LOG_FUNCTION_WRITE(0x08),
/** Logs the CAN messages received within the CAN_Read function */
LOG_FUNCTION_READ(0x10),
/** Logs all possible information within the PCAN-Basic API functions */
LOG_FUNCTION_ALL(0xFFFF),
/** A single file is written until it size reaches PCAN_TRACE_SIZE */
TRACE_FILE_SINGLE(0x00),
/** Traced data is distributed in several files with size PCAN_TRACE_SIZE */
TRACE_FILE_SEGMENTED(0x01),
/** Includes the date into the name of the trace file */
TRACE_FILE_DATE(0x02),
/** Includes the start time into the name of the trace file */
TRACE_FILE_TIME(0x04),
/** Causes the overwriting of available traces (same name) */
TRACE_FILE_OVERWRITE(0x80),
/** Device supports flexible data-rate (CAN-FD) */
FEATURE_FD_CAPABLE(0x01),
/** Device supports a delay between sending frames (FPGA based USB devices) */
FEATURE_DELAY_CAPABLE(0x02),
/** Device supports I/O functionality for electronic circuits (USB-Chip devices) */
FEATURE_IO_CAPABLE(0x04),
/** The service is not running */
SERVICE_STATUS_STOPPED(0x01),
/** The service is running */
SERVICE_STATUS_RUNNING(0x04);
/** Maximum length of the name of a device: 32 characters + terminator */
public static final int MAX_LENGTH_HARDWARE_NAME = 33;
/** Maximum length of a version string: 17 characters + terminator */
public static final int MAX_LENGTH_VERSION_STRING = 18;
/** Recommended length for an error string: 255 characters + terminator */
public static final int MIN_LENGTH_ERROR_STRING = 256;
private TPCANParameterValue(int value)
{
this.value = value;
}
/**
* The value of the CAN parameter's value
* @return Value of the CAN parameter's value
*/
public int getValue()
{
return this.value;
}
/**
* Parses a int value into the TPCANParameterValue PCAN_PARAMETER_ON or PCAN_PARAMETER_OFF
* @param value parsed value
* @return Corresponding TPCANParameterValue
*/
static public TPCANParameterValue parseOnOff(int value)
{
if(value == TPCANParameterValue.PCAN_PARAMETER_ON.getValue())
return TPCANParameterValue.PCAN_PARAMETER_ON;
else if(value == TPCANParameterValue.PCAN_PARAMETER_OFF.getValue())
return TPCANParameterValue.PCAN_PARAMETER_OFF;
else
return null;
}
/**
* Parses a int value into the TPCANParameterValue PCAN_CHANNEL_AVAILABLE, PCAN_CHANNEL_ILLEGAL, PCAN_CHANNEL_OCCUPIED or PCAN_CHANNEL_UNOCCUPIED
* @param value parsed value
* @return Corresponding TPCANParameterValue
*/
static public TPCANParameterValue parseCondition(int value)
{
if(value == TPCANParameterValue.PCAN_CHANNEL_AVAILABLE.getValue())
return TPCANParameterValue.PCAN_CHANNEL_AVAILABLE;
else if(value == TPCANParameterValue.PCAN_CHANNEL_UNAVAILABLE.getValue())
return TPCANParameterValue.PCAN_CHANNEL_UNAVAILABLE;
else if(value == TPCANParameterValue.PCAN_CHANNEL_OCCUPIED.getValue())
return TPCANParameterValue.PCAN_CHANNEL_OCCUPIED;
else if(value == TPCANParameterValue.PCAN_CHANNEL_PCANVIEW.getValue())
return TPCANParameterValue.PCAN_CHANNEL_PCANVIEW;
else
return null;
}
/**
* Parses a int value into the TPCANParameterValue PCAN_FILTER_CLOSE, PCAN_FILTER_OPEN or PCAN_FILTER_CUSTOM.
* @param value parsed value
* @return Corresponding TPCANParameterValue
*/
static public TPCANParameterValue parseFilterStatus(int value)
{
if(value == TPCANParameterValue.PCAN_FILTER_CLOSE.getValue())
return TPCANParameterValue.PCAN_FILTER_CLOSE;
else if(value == TPCANParameterValue.PCAN_FILTER_OPEN.getValue())
return TPCANParameterValue.PCAN_FILTER_OPEN;
else if(value == TPCANParameterValue.PCAN_FILTER_CUSTOM.getValue())
return TPCANParameterValue.PCAN_FILTER_CUSTOM;
else
return null;
}
/**
* Parses a int value into the TPCANParameterValue PCAN_CHANNEL_AVAILABLE, PCAN_CHANNEL_ILLEGAL, PCAN_CHANNEL_OCCUPIED or PCAN_CHANNEL_UNOCCUPIED
* @param value parsed value
* @return Corresponding TPCANParameterValue
*/
static public EnumSet<TPCANParameterValue> parseFeatures(int value)
{
EnumSet<TPCANParameterValue> result = EnumSet.noneOf(TPCANParameterValue.class);
if((value & TPCANParameterValue.FEATURE_DELAY_CAPABLE.getValue()) != 0)
result.add(TPCANParameterValue.FEATURE_DELAY_CAPABLE);
if((value & TPCANParameterValue.FEATURE_FD_CAPABLE.getValue()) != 0)
result.add(TPCANParameterValue.FEATURE_FD_CAPABLE);
if((value & TPCANParameterValue.FEATURE_IO_CAPABLE.getValue()) != 0)
result.add(TPCANParameterValue.FEATURE_IO_CAPABLE);
return result;
}
private final int value;
};

View File

@ -0,0 +1,173 @@
/* SPDX-License-Identifier: LGPL-2.1-only */
/*
* $Id: TPCANStatus.java 7391 2020-08-10 08:32:30Z Fabrice $
* @LastChange $Date: 2020-08-10 10:32:30 +0200 (Mon, 10 Aug 2020) $
*
* PCANBasic JAVA Interface.
*
* Copyright (C) 2001-2020 PEAK System-Technik GmbH <www.peak-system.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* PCAN is a registered Trademark of PEAK-System Germany GmbH
*
* Author: Jonathan Urban/Uwe Wilhelm/Fabrice Vergnaud
* Contact: <linux@peak-system.com>
* Maintainer: Fabrice Vergnaud <f.vergnaud@peak-system.com>
*/
package peak.can.basic;
/**
* Represent the PCAN error and status codes
*/
public enum TPCANStatus {
/**
* No Error
*/
PCAN_ERROR_OK(0x00000),
/**
* Transmit buffer in CAN controller is full
*/
PCAN_ERROR_XMTFULL(0x00001),
/**
* CAN controller was read too late
*/
PCAN_ERROR_OVERRUN(0x00002),
/**
* Bus error: an error counter reached the 'light' limit
*/
PCAN_ERROR_BUSLIGHT(0x00004),
/**
* Bus error: an error counter reached the 'heavy' limit
*/
PCAN_ERROR_BUSHEAVY(0x00008),
/**
* Bus error: an error counter reached the 'warning' limit
*/
PCAN_ERROR_BUSWARNING(PCAN_ERROR_BUSHEAVY.value),
/**
* Bus error: the CAN controller is error passive
*/
PCAN_ERROR_BUSPASSIVE(0x40000),
/**
* Bus error: the CAN controller is in bus-off state
*/
PCAN_ERROR_BUSOFF(0x00010),
/**
* PCAN_ERROR_ANYBUSERR
*/
PCAN_ERROR_ANYBUSERR(PCAN_ERROR_BUSWARNING.value |
PCAN_ERROR_BUSLIGHT.value | PCAN_ERROR_BUSHEAVY.value |
PCAN_ERROR_BUSOFF.value | PCAN_ERROR_BUSPASSIVE.value),
/**
* Receive queue is empty
*/
PCAN_ERROR_QRCVEMPTY(0x00020),
/**
* Receive queue was read too late
*/
PCAN_ERROR_QOVERRUN(0x00040),
/**
* Transmit queue is full
*/
PCAN_ERROR_QXMTFULL(0x00080),
/**
* Test of the CAN controller hardware registers failed (no hardware found)
*/
PCAN_ERROR_REGTEST(0x00100),
/**
* Driver not loaded
*/
PCAN_ERROR_NODRIVER(0x00200),
/**
* Hardware already in use by a Net
*/
PCAN_ERROR_HWINUSE(0x00400),
/**
* A Client is already connected to the Net
*/
PCAN_ERROR_NETINUSE(0x00800),
/**
* Hardware handle is invalid
*/
PCAN_ERROR_ILLHW(0x01400),
/**
* Net handle is invalid
*/
PCAN_ERROR_ILLNET(0x01800),
/**
* Client handle is invalid
*/
PCAN_ERROR_ILLCLIENT(0x01C00),
/**
* Mask for all handle errors
*/
PCAN_ERROR_ILLHANDLE(PCAN_ERROR_ILLHW.value | PCAN_ERROR_ILLNET.value | PCAN_ERROR_ILLCLIENT.value),
/**
* Resource (FIFO, Client, timeout) cannot be created
*/
PCAN_ERROR_RESOURCE(0x02000),
/**
* Invalid parameter
*/
PCAN_ERROR_ILLPARAMTYPE(0x04000),
/**
* Invalid parameter value
*/
PCAN_ERROR_ILLPARAMVAL(0x08000),
/**
* Unknow error
*/
PCAN_ERROR_UNKNOWN(0x10000),
/**
* Invalid data, function, or action.
*/
PCAN_ERROR_ILLDATA(0x20000),
/**
* Driver object state is wrong for the attempted operation
*/
PCAN_ERROR_ILLMODE(0x80000),
/**
* An operation was successfully carried out, however, irregularities were
* registered
*
* @remark Value was changed from 0x40000 to 0x4000000
*/
PCAN_ERROR_CAUTION(0x2000000),
/**
* Channel is not initialized
*/
PCAN_ERROR_INITIALIZE(0x4000000),
/**
* Invalid operation
*
* @remark Value was changed from 0x80000 to 0x8000000
*/
PCAN_ERROR_ILLOPERATION(0x8000000);
private TPCANStatus(int value) {
this.value = value;
}
/**
* The value of the CAN status code
* @return Value of the CAN status code
*/
public int getValue() {
return this.value;
}
private final int value;
};

View File

@ -0,0 +1,101 @@
/* SPDX-License-Identifier: LGPL-2.1-only */
/*
* $Id: TPCANTimestamp.java 7391 2020-08-10 08:32:30Z Fabrice $
* @LastChange $Date: 2020-08-10 10:32:30 +0200 (Mon, 10 Aug 2020) $
*
* PCANBasic JAVA Interface.
*
* Copyright (C) 2001-2020 PEAK System-Technik GmbH <www.peak-system.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* PCAN is a registered Trademark of PEAK-System Germany GmbH
*
* Author: Jonathan Urban/Uwe Wilhelm/Fabrice Vergnaud
* Contact: <linux@peak-system.com>
* Maintainer: Fabrice Vergnaud <f.vergnaud@peak-system.com>
*/
package peak.can.basic;
/**
* Defines the point of time at which a CAN message was received.
*/
public class TPCANTimestamp
{
private long millis;
private short millis_overflow;
private short micros;
/**
* Default constructor
*/
public TPCANTimestamp()
{
}
/**
* Gets microseconds
* @return microseconds (0-999)
*/
public short getMicros()
{
return micros;
}
/**
* Sets microseconds
* @param micros microseconds (0-999)
*/
public void setMicros(short micros)
{
this.micros = micros;
}
/**
* Gets milliseconds
* @return milliseconds
*/
public long getMillis()
{
return millis;
}
/**
* Sets milliseconds
* @param millis milliseconds
*/
public void setMillis(long millis)
{
this.millis = millis;
}
/**
* Gets milliseconds overflow
* @return milliseconds overflow
*/
public short getMillis_overflow()
{
return millis_overflow;
}
/**
* Sets milliseconds overflow
* @param millis_overflow milliseconds overflow
*/
public void setMillis_overflow(short millis_overflow)
{
this.millis_overflow = millis_overflow;
}
}

View File

@ -0,0 +1,59 @@
/* SPDX-License-Identifier: LGPL-2.1-only */
/*
* $Id: TPCANTimestampFD.java 7391 2020-08-10 08:32:30Z Fabrice $
* @LastChange $Date: 2020-08-10 10:32:30 +0200 (Mon, 10 Aug 2020) $
*
* PCANBasic JAVA Interface.
*
* Copyright (C) 2001-2020 PEAK System-Technik GmbH <www.peak-system.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* PCAN is a registered Trademark of PEAK-System Germany GmbH
*
* Author: Jonathan Urban/Uwe Wilhelm/Fabrice Vergnaud
* Contact: <linux@peak-system.com>
* Maintainer: Fabrice Vergnaud <f.vergnaud@peak-system.com>
*/
package peak.can.basic;
/**
* Defines the point of time at which a CAN message was received.
*/
public class TPCANTimestampFD
{
private long _timestamp;
/**
* Default constructor
*/
public TPCANTimestampFD()
{
}
/**
* @return the timestamp
*/
public long getValue() {
return _timestamp;
}
/**
* @param timestamp the timestamp to set
*/
public void setValue(long timestamp) {
this._timestamp = timestamp;
}
}

View File

@ -0,0 +1,67 @@
/* SPDX-License-Identifier: LGPL-2.1-only */
/*
* $Id: TPCANType.java 7391 2020-08-10 08:32:30Z Fabrice $
* @LastChange $Date: 2020-08-10 10:32:30 +0200 (Mon, 10 Aug 2020) $
*
* PCANBasic JAVA Interface.
*
* Copyright (C) 2001-2020 PEAK System-Technik GmbH <www.peak-system.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* PCAN is a registered Trademark of PEAK-System Germany GmbH
*
* Author: Jonathan Urban/Uwe Wilhelm/Fabrice Vergnaud
* Contact: <linux@peak-system.com>
* Maintainer: Fabrice Vergnaud <f.vergnaud@peak-system.com>
*/
package peak.can.basic;
/**
* Represents a PCAN device
*/
public enum TPCANType
{
/**Undefined, unknown or not selected PCAN type value*/
PCAN_TYPE_NONE((byte)0x00),
/**PCAN-ISA 82C200*/
PCAN_TYPE_ISA((byte)0x01),
/**PCAN-ISA SJA1000*/
PCAN_TYPE_ISA_SJA((byte)0x09),
/**PHYTEC ISA*/
PCAN_TYPE_ISA_PHYTEC((byte)0x04),
/**PCAN-Dongle 82C200*/
PCAN_TYPE_DNG((byte)0x02),
/**PCAN-Dongle EPP 82C200*/
PCAN_TYPE_DNG_EPP((byte)0x03),
/**PCAN-Dongle SJA1000*/
PCAN_TYPE_DNG_SJA((byte)0x05),
/**PCAN-Dongle EPP SJA1000*/
PCAN_TYPE_DNG_SJA_EPP((byte)0x06);
private TPCANType(byte value)
{
this.value = value;
}
/**
* The identifier of the CAN hardware type
* @return Identifier of the CAN hardware type
*/
public byte getValue()
{
return this.value;
}
private final byte value;
};