source: trunk/MagicSoft/Cosy/candrv/nodedrv.h@ 851

Last change on this file since 851 was 808, checked in by tbretz, 23 years ago
*** empty log message ***
File size: 2.0 KB
Line 
1#ifndef NODEDRV_H
2#define NODEDRV_H
3
4#include "log.h"
5#include "gendef.h"
6
7class Network;
8
9class NodeDrv : public Log
10{
11private:
12 Network *fNetwork;
13 BYTE_t fId;
14
15 int fError;
16
17protected:
18 void SetError(int err) { fError = err; }
19 void DelError() { fError = 0; }
20 int GetError() { return fError; }
21
22public:
23 NodeDrv(BYTE_t nodeid, ostream &out=cout);
24
25 BYTE_t GetId() { return fId; }
26 Network *GetNetwork() { return fNetwork; }
27
28 virtual void InitDevice(Network *net);
29 virtual void StopDevice() = 0;
30
31 bool HasError() { return fError; }
32
33 virtual void HandleSDO(WORD_t idx, BYTE_t subidx, LWORD_t val, struct timeval *tv);
34 virtual void HandleSDOOK(WORD_t idx, BYTE_t subidx);
35 virtual void HandleSDOError(LWORD_t data);
36
37 virtual void HandlePDO1(BYTE_t *data, struct timeval *tv) {};
38 virtual void HandlePDO2(BYTE_t *data, struct timeval *tv) {};
39 virtual void HandlePDO3(BYTE_t *data, struct timeval *tv) {};
40 virtual void HandlePDO4(BYTE_t *data, struct timeval *tv) {};
41
42 void SendPDO1(BYTE_t data[8]);
43 void SendPDO2(BYTE_t data[8]);
44 void SendPDO1(BYTE_t m0=0, BYTE_t m1=0, BYTE_t m2=0, BYTE_t m3=0,
45 BYTE_t m4=0, BYTE_t m5=0, BYTE_t m6=0, BYTE_t m7=0);
46 void SendPDO2(BYTE_t m0=0, BYTE_t m1=0, BYTE_t m2=0, BYTE_t m3=0,
47 BYTE_t m4=0, BYTE_t m5=0, BYTE_t m6=0, BYTE_t m7=0);
48
49 void SendSDO(WORD_t idx, BYTE_t subidx, BYTE_t val);
50 void SendSDO(WORD_t idx, BYTE_t subidx, WORD_t val);
51 void SendSDO(WORD_t idx, BYTE_t subidx, LWORD_t val);
52
53 void SendSDO(WORD_t idx, BYTE_t val);
54 void SendSDO(WORD_t idx, WORD_t val);
55 void SendSDO(WORD_t idx, LWORD_t val=0);
56
57 void SendNMT(BYTE_t cmd);
58
59 void RequestSDO(WORD_t idx, BYTE_t subidx=0);
60
61 void WaitForNextPdo1();
62 void WaitForNextPdo2();
63 void WaitForNextPdo3();
64 void WaitForNextPdo4();
65
66 void WaitForSdos();
67 void WaitForSdo(WORD_t idx, BYTE_t subidx=0);
68
69 void EnableCanMsg(BYTE_t fcode);
70};
71
72#endif
Note: See TracBrowser for help on using the repository browser.