OpcUaCanOpen
CANopen OPC-UA server
|
#include <pkcan.h>
Inherits CanModule::CCanAccess, and CanModule::CCanAccess.
Public Member Functions | |
PKCanScan () | |
virtual | ~PKCanScan () |
virtual bool | createBUS (const char *, const char *) |
virtual bool | sendMessage (short cobID, unsigned char len, unsigned char *message) |
virtual bool | sendRemoteRequest (short cobID) |
virtual bool | getErrorMessage (long error, char **message) |
PKCanScan () | |
PKCanScan (PKCanScan const &other)=delete | |
PKCanScan & | operator= (PKCanScan const &other)=delete |
virtual | ~PKCanScan () |
virtual bool | createBus (const string name, const string parameters) |
Method that initialises a CAN bus channel for peak (using PEAK Basic) All following methods called on the same object will be using this initialized channel. More... | |
virtual bool | sendMessage (short cobID, unsigned char len, unsigned char *message, bool rtr=false) |
method to send a CAN message to the peak module. More... | |
virtual bool | sendRemoteRequest (short cobID) |
virtual void | getStatistics (CanStatistics &result) |
bool | getErrorMessage (long error, char **message) |
Log::LogComponentHandle | logItHandle () |
![]() | |
CCanAccess () | |
virtual bool | sendMessage (CanMessage *canm) |
std::string & | getBusName () |
virtual | ~CCanAccess () |
bool | initialiseLogging (LogItInstance *remoteInstance) |
LogItInstance * | getLogItInstance () |
the LogIt instance is NOT shared by inheritance in windows, the instance has to be passed explicitly from the parent More... | |
vector< string > | parseNameAndParameters (string name, string parameters) |
Static Public Attributes | |
static std::map< string, string > | m_busMap |
© Copyright CERN, 2015. More... | |
Private Member Functions | |
TPCANHandle | getHandle (const char *name) |
This method returns a TPCANHandle (which is in fact a specific vendor defined hex value) as a function of a human readable string. More... | |
string | getNamePort () |
bool | sendErrorCode (long) |
bool | configureCanboard (const char *, const char *) |
TPCANHandle | getHandle (const char *name) |
bool | sendErrorCode (long) |
bool | configureCanboard (const string name, const string parameters) |
method to configure peak modules, one channel at a time. More... | |
void | stopBus (void) |
notify the main thread to finish and delete the bus from the map of connections More... | |
Static Private Member Functions | |
static DWORD WINAPI | CanScanControlThread (LPVOID pCanScan) |
thread to supervise port activity More... | |
static DWORD WINAPI | CanScanControlThread (LPVOID pCanScan) |
Private Attributes | |
TPCANStatus | bus_status |
bool | run_can |
int | numChannel |
unsigned int | BaudRate |
string | canName |
TPCANHandle | canObjHandler |
HANDLE | m_hCanScanThread |
HANDLE | m_ReadEvent |
DWORD | m_idCanScanThread |
Log::LogComponentHandle | m_logItHandlePk |
CanStatistics | m_statistics |
TPCANStatus | m_busStatus |
bool | m_CanScanThreadRunEnableFlag |
unsigned int | m_baudRate |
string | m_busName |
string | m_busParameters |
TPCANHandle | m_canObjHandler |
Additional Inherited Members | |
![]() | |
boost::signals2::signal< void(const CanMessage &) > | canMessageCame |
boost::signals2::signal< void(const int, const char *, timeval &) > | canMessageError |
![]() | |
string | m_sBusName |
CanParameters | m_CanParameters |
PKCanScan::PKCanScan | ( | ) |
|
delete |
|
virtual |
|
private |
|
private |
method to configure peak modules, one channel at a time.
We restrict this to USB interfaces and fixed datarate (not FD) modules If needed this can relatively easily be extended to other interfaces and FD mods as well.
FD (flexible datarate) modules. we need to contruct (a complicated) bitrate string in this case, according to PEAK PCAN-Basic Documentation API manual p.82 two data rates, for nominal and data, can be defined. all these parameters have to be passed TPCANStatus tpcanStatus = CAN_InitializeFD(m_canObjHandler, m_baudRate); TPCANBitrateFD br = "f_clock_mhz=20, nom_brp=5, nom_tseg1=2, nom_tseg2=1, nom_sjw=1"; PCAN_BR_CLOCK_MHZ=20, PCAN_BR_NOM_BRP=5, PCAN_BR_DATA_TSEG1=2, PCAN_BR_DATA_TSEG2=1, PCAN_BR_NOM_SJW=1;
fixed datarate modules (classical CAN), plug and play we try 10 times until success, the OS is a bit slow
fixed data rate, non plug-and-play static TPCANStatus Initialize( TPCANHandle Channel, TPCANBaudrate Btr0Btr1, TPCANType HwType, UInt32 IOPort, UInt16 Interrupt);
|
virtual |
|
virtual |
Method that initialises a CAN bus channel for peak (using PEAK Basic) All following methods called on the same object will be using this initialized channel.
Only USB interfaces for PEAK modules, and only NON FD modules are supported for now.
name | = 2 parameters separated by ":" like "n0:n1"
|
parameters | one parameter: "p0", positive integer
|
Implements CanModule::CCanAccess.
|
virtual |
bool PKCanScan::getErrorMessage | ( | long | error, |
char ** | message | ||
) |
|
private |
This method returns a TPCANHandle (which is in fact a specific vendor defined hex value) as a function of a human readable string.
The human readable string basically codes the intefrace type (USB, ISA, PCI...) and the CAN port (1..8) so that i.e. USB3->0x53 which means USB interface 3rd channel
|
private |
|
virtual |
Implements CanModule::CCanAccess.
|
inline |
|
private |
|
virtual |
|
virtual |
method to send a CAN message to the peak module.
we use the standard API "PCAN-Basic" for this for windows and we talk only over USB to fixed bitrate modules. The flexible bitrate (FD) modules can be implemented later as well: for this we need more parameters to pass and a switch between CAN_Write and CAN_WriteFD.
Implements CanModule::CCanAccess.
|
virtual |
Implements CanModule::CCanAccess.
|
virtual |
Implements CanModule::CCanAccess.
|
private |
|
static |
© Copyright CERN, 2015.
All rights not expressly granted are reserved.
Created on: Mar 17, 2015 Author: pnikiel, vfilimon, quasar team mludwig at cern dot ch
This file is part of Quasar.
Quasar is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public Licence as published by the Free Software Foundation, either version 3 of the Licence.
Quasar 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 Licence for more details.
You should have received a copy of the GNU Lesser General Public License along with Quasar. If not, see http://www.gnu.org/licenses/.
PEAK bridge integration for windows
|
private |
|
private |