Skip to content

Commit

Permalink
peak source
Browse files Browse the repository at this point in the history
  • Loading branch information
rusefillc committed Dec 15, 2023
0 parents commit 83bf971
Show file tree
Hide file tree
Showing 22 changed files with 3,029 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
.idea
3 changes: 3 additions & 0 deletions build.gradle
@@ -0,0 +1,3 @@
plugins {
id 'java'
}
43 changes: 43 additions & 0 deletions src/main/java/peak/can/peak/basic/IRcvEventProcessor.java
@@ -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);
}
103 changes: 103 additions & 0 deletions src/main/java/peak/can/peak/basic/MutableTPCANHandle.java
@@ -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();
}
}

0 comments on commit 83bf971

Please sign in to comment.