#include <stcan.h>
Inherits CanModule::CCanAccess, CanModule::CCanAccess, and CanModule::CCanAccess.
|
| STCanScan () |
|
virtual | ~STCanScan () |
|
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[]) |
|
| STCanScan () |
|
virtual | ~STCanScan () |
|
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) |
|
bool | sendErrorCode (long) |
|
| STCanScan () |
|
| STCanScan (STCanScan const &other)=delete |
|
STCanScan & | operator= (STCanScan const &other)=delete |
|
virtual | ~STCanScan () |
|
virtual bool | createBus (const string name, const string parameters) |
| Method that initialises a CAN bus channel for systec. More...
|
|
virtual bool | sendMessage (short cobID, unsigned char len, unsigned char *message, bool rtr=false) |
| Method that sends a message trough the can bus channel. More...
|
|
virtual bool | sendRemoteRequest (short cobID) |
|
virtual void | getStatistics (CanStatistics &result) |
|
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) |
|
Definition at line 24 of file stcan.h.
◆ STCanScan() [1/4]
◆ ~STCanScan() [1/3]
STCanScan::~STCanScan |
( |
| ) |
|
|
virtual |
◆ STCanScan() [2/4]
◆ ~STCanScan() [2/3]
virtual STCanScan::~STCanScan |
( |
| ) |
|
|
virtual |
◆ STCanScan() [3/4]
◆ STCanScan() [4/4]
STCanScan::STCanScan |
( |
STCanScan const & |
other | ) |
|
|
delete |
◆ ~STCanScan() [3/3]
virtual STCanScan::~STCanScan |
( |
| ) |
|
|
virtual |
◆ CanScanControlThread() [1/2]
DWORD WINAPI STCanScan::CanScanControlThread |
( |
LPVOID |
pCanScan | ) |
|
|
staticprivate |
thread to supervise port activity
Definition at line 44 of file stcan.cpp.
◆ CanScanControlThread() [2/2]
static DWORD WINAPI STCanScan::CanScanControlThread |
( |
LPVOID |
pCanScan | ) |
|
|
staticprivate |
◆ configureCanboard() [1/2]
bool STCanScan::configureCanboard |
( |
const char * |
name, |
|
|
const char * |
parameters |
|
) |
| |
|
private |
◆ configureCanboard() [2/2]
bool STCanScan::configureCanboard |
( |
char * |
, |
|
|
char * |
, |
|
|
tUcanHandle & |
|
|
) |
| |
|
private |
◆ configureCanBoard()
int STCanScan::configureCanBoard |
( |
const string |
name, |
|
|
const string |
parameters |
|
) |
| |
|
private |
◆ createBUS() [1/2]
bool STCanScan::createBUS |
( |
const char * |
name, |
|
|
const char * |
parameters |
|
) |
| |
|
virtual |
◆ createBUS() [2/2]
virtual bool STCanScan::createBUS |
( |
const char * |
, |
|
|
const char * |
|
|
) |
| |
|
virtual |
◆ createBus()
bool STCanScan::createBus |
( |
const string |
name, |
|
|
const string |
parameters |
|
) |
| |
|
virtual |
Method that initialises a CAN bus channel for systec.
All following methods called on the same object will be using this initialized channel.
- Parameters
-
name | = 2 parameters separated by ":" like "n0:n1"
- n0 = "st" for systec
- n1 = CAN port number on the module, can be prefixed with "can"
- ex.: "st:can1" speaks to port 1 on systec module at the ip
- ex.: "st:1" works as well
|
parameters | one parameter: "p0", positive integers
- "Unspecified" (or empty): using defaults = "125000" // params missing
- p0: bitrate: 50000, 100000, 125000, 250000, 500000, 1000000 bit/s i.e. "250000"
|
- Returns
- was the initialisation process successful?
===note from Piotr=== in the Windows implementation of Systec (hardware component: st): to define the interface naming as canX, where X is a non-negative number note: the SysTec driver for windows expects addressing in terms of module number and channel (e.g. 0:0 is can0, 1:0 is can2, 1:1 is can3, etc) so can0 should open a SysTec interface 0:0 matching "can0" on the box, can1 should open a SysTec interface 0:1 matching "can1" on the box, etc.
Implements CanModule::CCanAccess.
Definition at line 151 of file STCanScan.cpp.
◆ errorCodeToString()
bool STCanScan::errorCodeToString |
( |
long |
error, |
|
|
char |
message[] |
|
) |
| |
|
private |
◆ getCanHandle() [1/2]
static tUcanHandle STCanScan::getCanHandle |
( |
int |
n | ) |
|
|
inlinestaticprivate |
◆ getCanHandle() [2/2]
static tUcanHandle STCanScan::getCanHandle |
( |
int |
n | ) |
|
|
inlinestaticprivate |
◆ getErrorMessage() [1/2]
bool STCanScan::getErrorMessage |
( |
long |
error, |
|
|
char |
message[] |
|
) |
| |
|
virtual |
◆ getErrorMessage() [2/2]
bool STCanScan::getErrorMessage |
( |
long |
error, |
|
|
char ** |
message |
|
) |
| |
|
virtual |
◆ getNamePort() [1/2]
string STCanScan::getNamePort |
( |
| ) |
|
|
inlineprivate |
◆ getNamePort() [2/2]
string STCanScan::getNamePort |
( |
| ) |
|
|
inlineprivate |
◆ getStatistics()
◆ isCanHandleInUse()
static bool STCanScan::isCanHandleInUse |
( |
int |
n | ) |
|
|
inlinestaticprivate |
◆ isInUse()
static bool STCanScan::isInUse |
( |
int |
n | ) |
|
|
inlinestaticprivate |
◆ logItHandle()
◆ openCanPort()
int STCanScan::openCanPort |
( |
tUcanInitCanParam |
initializationParameters | ) |
|
|
private |
Obtains a Systec canport and opens it.
The name of the port and parameters should have been specified by preceding call to configureCanboard()
- Returns
- less than zero in case of error, otherwise success
Definition at line 240 of file STCanScan.cpp.
◆ operator=()
◆ sendErrorCode() [1/3]
bool STCanScan::sendErrorCode |
( |
long |
| ) |
|
◆ sendErrorCode() [2/3]
bool STCanScan::sendErrorCode |
( |
long |
status | ) |
|
|
private |
◆ sendErrorCode() [3/3]
bool STCanScan::sendErrorCode |
( |
long |
| ) |
|
|
private |
◆ sendMessage() [1/3]
bool STCanScan::sendMessage |
( |
short |
cobID, |
|
|
unsigned char |
len, |
|
|
unsigned char * |
message |
|
) |
| |
|
virtual |
◆ sendMessage() [2/3]
virtual bool STCanScan::sendMessage |
( |
short |
cobID, |
|
|
unsigned char |
len, |
|
|
unsigned char * |
message |
|
) |
| |
|
virtual |
◆ sendMessage() [3/3]
bool STCanScan::sendMessage |
( |
short |
cobID, |
|
|
unsigned char |
len, |
|
|
unsigned char * |
message, |
|
|
bool |
rtr = false |
|
) |
| |
|
virtual |
Method that sends a message trough the can bus channel.
If the method createBUS was not called before this, sendMessage will fail, as there is no can bus channel to send a message through.
- Parameters
-
cobID | Identifier that will be used for the message. |
len | Length of the message. If the message is bigger than 8 characters, it will be split into separate 8 characters messages. |
message | Message to be sent trough the can bus. |
rtr | is the message a remote transmission request? |
- Returns
- Was the sending process successful?
Implements CanModule::CCanAccess.
Definition at line 305 of file STCanScan.cpp.
◆ sendRemoteRequest() [1/3]
bool STCanScan::sendRemoteRequest |
( |
short |
cobID | ) |
|
|
virtual |
◆ sendRemoteRequest() [2/3]
virtual bool STCanScan::sendRemoteRequest |
( |
short |
cobID | ) |
|
|
virtual |
◆ sendRemoteRequest() [3/3]
virtual bool STCanScan::sendRemoteRequest |
( |
short |
cobID | ) |
|
|
virtual |
◆ setCanHandle() [1/2]
static void STCanScan::setCanHandle |
( |
int |
n, |
|
|
tUcanHandle |
tU |
|
) |
| |
|
inlinestaticprivate |
◆ setCanHandle() [2/2]
static void STCanScan::setCanHandle |
( |
int |
n, |
|
|
tUcanHandle |
tU |
|
) |
| |
|
inlinestaticprivate |
◆ setCanHandleInUse()
static void STCanScan::setCanHandleInUse |
( |
int |
n, |
|
|
bool |
t |
|
) |
| |
|
inlinestaticprivate |
◆ setInUse()
static void STCanScan::setInUse |
( |
int |
n, |
|
|
bool |
t |
|
) |
| |
|
inlinestaticprivate |
◆ BaudRate
◆ bus_status
DWORD STCanScan::bus_status |
|
private |
◆ canHandle
tUcanHandle STCanScan::canHandle |
|
staticprivate |
◆ canName
string STCanScan::canName |
|
private |
◆ inUse
◆ m_baudRate
unsigned int STCanScan::m_baudRate |
|
private |
◆ m_busStatus
DWORD STCanScan::m_busStatus |
|
private |
◆ m_canHandleNumber
int STCanScan::m_canHandleNumber |
|
private |
◆ m_CanScanThreadShutdownFlag
bool STCanScan::m_CanScanThreadShutdownFlag |
|
private |
◆ m_channelNumber
int STCanScan::m_channelNumber |
|
private |
◆ m_hCanScanThread
HANDLE STCanScan::m_hCanScanThread |
|
private |
◆ m_idCanScanThread
DWORD STCanScan::m_idCanScanThread |
|
private |
◆ m_logItHandleSt
◆ m_moduleNumber
int STCanScan::m_moduleNumber |
|
private |
◆ m_statistics
◆ m_UcanHandle
tUcanHandle STCanScan::m_UcanHandle |
|
private |
◆ numCanHandle
int STCanScan::numCanHandle |
|
private |
◆ numChannel
int STCanScan::numChannel |
|
private |
◆ numModule
◆ run_can
◆ s_canHandleArray
tUcanHandle STCanScan::s_canHandleArray |
|
staticprivate |
◆ s_isCanHandleInUseArray
bool STCanScan::s_isCanHandleInUseArray |
|
staticprivate |
© Copyright CERN, 2015.
All rights not expressly granted are reserved.
STCanScap.cpp
Created on: Jul 21, 2011 Based on work by vfilimon Rework and logging done by Piotr Nikiel piotr.nosp@m.@nik.nosp@m.iel.i.nosp@m.nfo 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/.The macro below is applicable only to this translation unit
Definition at line 107 of file STCanScan.h.
The documentation for this class was generated from the following files: