Line | |
---|
1 | #ifndef COSY_Interface
|
---|
2 | #define COSY_Interface
|
---|
3 |
|
---|
4 | #ifdef __CINT__
|
---|
5 | //#include <TROOT.h>
|
---|
6 | typedef UShort_t WORD_t;
|
---|
7 | typedef Byte_t BYTE_t;
|
---|
8 | struct Message;
|
---|
9 | struct FastMessage;
|
---|
10 | #else
|
---|
11 | #include "gendef.h"
|
---|
12 | #include "dpm.h"
|
---|
13 | #endif
|
---|
14 |
|
---|
15 | typedef struct timeval timeval_t;
|
---|
16 |
|
---|
17 | class CanOpen;
|
---|
18 |
|
---|
19 | class Interface
|
---|
20 | {
|
---|
21 | private:
|
---|
22 | CanOpen *fReceiver;
|
---|
23 |
|
---|
24 | protected:
|
---|
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 |
|
---|
36 | public:
|
---|
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.