[89] | 1 | /// Purpose: Inherits from the CanDriver class
|
---|
| 2 | /// Reimplement all the virtual members of the CanDriverBase
|
---|
| 3 | /// class in order to be used with the Vector driver.
|
---|
| 4 | ///
|
---|
| 5 | /// @date created 2015/06/23
|
---|
| 6 | /// @author Gerald Dherbomez
|
---|
| 7 | /// @version $Id$
|
---|
| 8 |
|
---|
| 9 | #ifndef __KVASERCANDRIVER_H__
|
---|
| 10 | #define __KVASERCANDRIVER_H__
|
---|
| 11 |
|
---|
| 12 | #include <string>
|
---|
| 13 |
|
---|
| 14 | #include "CanDriverBase.h"
|
---|
| 15 | #include "../CanGatewayConfig.h"
|
---|
| 16 |
|
---|
| 17 | class CANGATEWAY_API KVaserCanDriver
|
---|
| 18 | : public CanDriverBase
|
---|
| 19 | {
|
---|
| 20 | public:
|
---|
| 21 | KVaserCanDriver(void);
|
---|
| 22 | KVaserCanDriver(const int hwType, const int hwChannel, const unsigned long bitrate);
|
---|
| 23 | KVaserCanDriver(const int channel);
|
---|
| 24 | KVaserCanDriver(const int channel, const unsigned int bitRate);
|
---|
| 25 | KVaserCanDriver(char * /*dummy1*/, char * /*dummy2*/) {} // DON'T USE
|
---|
| 26 | ~KVaserCanDriver(void);
|
---|
| 27 |
|
---|
| 28 | void initialize(const int hwType, const int hwChannel, const unsigned long bitrate);
|
---|
| 29 |
|
---|
| 30 | short initPort (void);
|
---|
| 31 | short cleanUpPort (void);
|
---|
| 32 |
|
---|
| 33 | void displayHardware(void);
|
---|
| 34 |
|
---|
| 35 | short sendFrame (struct CanFrame frame);
|
---|
| 36 | short receiveFrame (struct CanFrame &frame);
|
---|
| 37 | void waitReceivingFrame(void);
|
---|
| 38 |
|
---|
| 39 | protected:
|
---|
| 40 |
|
---|
| 41 | private:
|
---|
| 42 | /*
|
---|
| 43 | VportHandle gPortHandle; //!< Handle to the AC2PCI CAN Card
|
---|
| 44 | Vaccess gChannelMask; //!< Mask to select the channel of the card (channel 0 or 1)
|
---|
| 45 | Vaccess gPermissionMask; //!< Mask of the channel selected
|
---|
| 46 | unsigned int gCanId; //!< Identificator of the CAN frame send by the card
|
---|
| 47 | unsigned int gBitRate; //!< Variable which defined the bitrate of the card
|
---|
| 48 | unsigned int gHwType; //!< Defined the type of the hardware use for CAN communication. for the moment the only possible value is HWTYPE_CANAC2PCI for the AC2PCI CAN Card
|
---|
| 49 | int gHwChannel; //!< Defined the channel of the card what we want used (channel 0 or 1)
|
---|
| 50 | HANDLE gEventHandle; //!< Handle on a windows event for known if a CAN frame is present on the frame's buffer of the card
|
---|
| 51 |
|
---|
| 52 | XLaccess accessMask;
|
---|
| 53 | XLportHandle port;
|
---|
| 54 | XLhandle msgEvent;
|
---|
| 55 | */
|
---|
| 56 |
|
---|
| 57 | int canHandle_; //!< handle used to manage the CAN interface
|
---|
| 58 | int canChannel_; //!< channel provided by the user
|
---|
| 59 | int canBitRate_; //!< frequency of the CAN bus (unit: bit/s)
|
---|
| 60 | int kvaserHardwareType_; //!< an ID specifying the hardware type, not used for the moment
|
---|
| 61 |
|
---|
| 62 |
|
---|
| 63 | };
|
---|
| 64 |
|
---|
| 65 | #endif // XLVECTORCANDRIVER_H
|
---|