Line | |
---|
1 |
|
---|
2 | #ifndef __CANSUBSCRIPTION_H__
|
---|
3 | #define __CANSUBSCRIPTION_H__
|
---|
4 |
|
---|
5 | #include <QMultiHash>
|
---|
6 |
|
---|
7 | #include "CanGatewayConfig.h"
|
---|
8 | #include "CanDecoderBase.h"
|
---|
9 |
|
---|
10 | #include "structure/structureCanCarmen.h"
|
---|
11 |
|
---|
12 |
|
---|
13 | template <class T> class QList;
|
---|
14 | //template <class T, class R> class QMultiHash;
|
---|
15 |
|
---|
16 | namespace pacpus {
|
---|
17 |
|
---|
18 | class CANGATEWAY_API CanSubscription
|
---|
19 | {
|
---|
20 | public:
|
---|
21 | CanSubscription() { subscribers_.clear();}
|
---|
22 | virtual ~CanSubscription() {}
|
---|
23 |
|
---|
24 | // return true if the subscription of the component to the specified can ID list succeeds, false else
|
---|
25 | // warning: it is possible that some <Component*,id> pairs have been registered and other not.
|
---|
26 | bool subscribe(const CanDecoderBase* who, const QList<int>& canId);
|
---|
27 |
|
---|
28 | // TODO
|
---|
29 | bool unsubscribe(const CanDecoderBase* who, const QList<int>& canId);
|
---|
30 |
|
---|
31 | // TODO
|
---|
32 | //QList<int> getSubscription(const ComponentBase* who) {};
|
---|
33 |
|
---|
34 | bool dispatchCanFrame(const TimestampedCanFrame & message);
|
---|
35 |
|
---|
36 | private:
|
---|
37 | // list of subscribers, we provide them can data
|
---|
38 | // structure of the hash: key is the can ID and value is the pointer to the subscribed component
|
---|
39 | QMultiHash<int, CanDecoderBase *> subscribers_;
|
---|
40 |
|
---|
41 | };
|
---|
42 |
|
---|
43 | }
|
---|
44 |
|
---|
45 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.