source: trunk/Cosy/candrv/interface.h@ 18450

Last change on this file since 18450 was 8864, checked in by tbretz, 17 years ago
*** empty log message ***
File size: 1.1 KB
Line 
1#ifndef COSY_Interface
2#define COSY_Interface
3
4#ifdef __CINT__
5//#include <TROOT.h>
6typedef UShort_t WORD_t;
7typedef Byte_t BYTE_t;
8struct Message;
9struct FastMessage;
10#else
11#include "gendef.h"
12#include "dpm.h"
13#endif
14
15typedef struct timeval timeval_t;
16
17class CanOpen;
18
19class Interface
20{
21private:
22 CanOpen *fReceiver;
23
24protected:
25 Interface(CanOpen *rx);
26
27 // Interface to receiver
28 void HandleMessage(const Message &msg) const;
29
30 // Helper for SendCanFrame
31 WORD_t MsgDescr(const WORD_t cobid, const BYTE_t dlc, const BYTE_t rtr=0)
32 {
33 return (cobid<<5) | ((rtr&0x1)<<4) | (dlc&0xf);
34 }
35
36public:
37 virtual ~Interface();
38
39 // Start/stop communication
40 virtual void Start() = 0; /*{ RunThread(); }*/
41 virtual void Stop() = 0; /*{ CancelThread(); }*/
42
43 // Public transmit interface
44 virtual void SendCanFrame(WORD_t cobid, BYTE_t m[8], BYTE_t rtr) = 0;
45 virtual void EnableCobId(WORD_t cobid, int flag=TRUE) { }
46
47 virtual bool HasConnection() const { return true; }
48
49 // Public interface
50 void PrintMsg(const Message &m);
51};
52
53#endif
Note: See TracBrowser for help on using the repository browser.