OpcUaCanOpen
CANopen OPC-UA server
AnaCanScan.cpp File Reference
#include "AnaCanScan.h"
#include <time.h>
#include <string.h>
#include <map>
#include <LogIt.h>
#include <sstream>
#include <iostream>
#include <boost/thread/thread.hpp>
#include "CanModuleUtils.h"
#include <sys/time.h>

Go to the source code of this file.

Macros

#define DLLEXPORTFLAG
 © Copyright CERN, 2015. More...
 
#define WINAPI
 
#define MLOGANA(LEVEL, THIS)   LOG(Log::LEVEL, AnaCanScan::st_logItHandleAnagate) << __FUNCTION__ << " " << " anagate bus= " << THIS->getBusName() << " "
 

Functions

DLLEXPORTFLAG CCanAccessgetCanBusAccess ()
 creates and returns anagate can access object More...
 
void WINAPI InternalCallback (AnaUInt32 nIdentifier, const char *pcBuffer, AnaInt32 nBufferLen, AnaInt32 nFlags, AnaInt32 hHandle, AnaInt32 nSeconds, AnaInt32 nMicroseconds)
 call back to catch incoming CAN messages for reading. More...
 

Variables

boost::mutex anagateReconnectMutex
 
std::map< AnaInt32, AnaCanScan * > g_AnaCanScanPointerMap
 global map of connection-object-pointers: the map-key is the handle. More...
 

Macro Definition Documentation

◆ DLLEXPORTFLAG

#define DLLEXPORTFLAG

© Copyright CERN, 2015.

All rights not expressly granted are reserved.

AnaCanScan.cpp

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/.

Here the Anagate ethernet-CAN bridges are implemented

Definition at line 47 of file AnaCanScan.cpp.

◆ MLOGANA

#define MLOGANA (   LEVEL,
  THIS 
)    LOG(Log::LEVEL, AnaCanScan::st_logItHandleAnagate) << __FUNCTION__ << " " << " anagate bus= " << THIS->getBusName() << " "

Definition at line 63 of file AnaCanScan.cpp.

◆ WINAPI

#define WINAPI

Definition at line 48 of file AnaCanScan.cpp.

Function Documentation

◆ getCanBusAccess()

DLLEXPORTFLAG CCanAccess* getCanBusAccess ( )

creates and returns anagate can access object

Definition at line 143 of file AnaCanScan.cpp.

◆ InternalCallback()

void WINAPI InternalCallback ( AnaUInt32  nIdentifier,
const char *  pcBuffer,
AnaInt32  nBufferLen,
AnaInt32  nFlags,
AnaInt32  hHandle,
AnaInt32  nSeconds,
AnaInt32  nMicroseconds 
)

call back to catch incoming CAN messages for reading.

It is called on a handle, which is internally registered and managed by the anagate API. If that handle changes, the callback has to be unregistered before I guess.

Definition at line 154 of file AnaCanScan.cpp.

Variable Documentation

◆ anagateReconnectMutex

boost::mutex anagateReconnectMutex

Definition at line 56 of file AnaCanScan.cpp.

◆ g_AnaCanScanPointerMap

std::map<AnaInt32, AnaCanScan*> g_AnaCanScanPointerMap

global map of connection-object-pointers: the map-key is the handle.

Since handles are allocated by the OS the keys are getting changed as well when we reconnect, so that we do not keep the stale keys(=handles) in the map at all. The map the InternalCallback code straightforward and speedy, because we can get to the object by just looking up the map using the key(=the handle).

Definition at line 71 of file AnaCanScan.cpp.