Rev 738 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 738 | Rev 746 | ||
|---|---|---|---|
| 1 | ########################################################### |
1 | ########################################################### |
| 2 | # |
2 | # |
| 3 | # The default implementation of the packet handler |
3 | # The default implementation of the packet handler |
| 4 | # |
4 | # |
| 5 | ########################################################### |
5 | ########################################################### |
| 6 | from CanPktHandlerBase import CanPktHandlerBase |
6 | from CanPktHandlerBase import CanPktHandlerBase |
| 7 | from CanPkt import CanPkt |
7 | from CanPkt import CanPkt |
| 8 | 8 | ||
| 9 | class CanPktHandler1(CanPktHandlerBase): |
9 | class CanPktHandler1(CanPktHandlerBase): |
| 10 | 10 | ||
| 11 | daemonCfg = None |
11 | daemonCfg = None |
| 12 | 12 | ||
| 13 | def __init__ (self, daemonCfg): |
13 | def __init__ (self, daemonCfg): |
| 14 | self.daemonCfg = daemonCfg |
14 | self.daemonCfg = daemonCfg |
| 15 | 15 | ||
| 16 | def input(self, strdata): |
16 | def input(self, strdata): |
| 17 | """Make data buffer into CanPkt and do early discard check """ |
17 | """Make data buffer into CanPkt and do early discard check """ |
| 18 | """Call all filters in chain """ |
18 | """Call all filters in chain """ |
| 19 | 19 | ||
| 20 | if len(strdata) < 2: |
20 | if len(strdata) < 2: |
| 21 | return |
21 | return |
| 22 | if strdata[0:3] != 'PKT': |
22 | if strdata[0:3] != 'PKT': |
| 23 | return |
23 | return |
| 24 | 24 | ||
| - | 25 | # print strdata |
|
| 25 | pkt = CanPkt.stringToCanPkt(self, strdata) |
26 | pkt = CanPkt.stringToCanPkt(self, strdata) |
| - | 27 | # print 'incoming: ' + pkt.toString() |
|
| 26 | 28 | ||
| 27 | for filter in self.daemonCfg.filterChain: |
29 | for filter in self.daemonCfg.filterChain: |
| 28 | fObj = self.daemonCfg.filterCfg.filterModules[filter] |
30 | fObj = self.daemonCfg.filterCfg.filterModules[filter] |
| 29 | fObj.filter(pkt, fObj.__ASSOCIATED_SPACES__) |
31 | fObj.filter(pkt, fObj.__ASSOCIATED_SPACES__) |
| 30 | 32 | ||
| 31 | 33 | ||
| 32 | def output(self, data): |
34 | def output(self, data): |
| 33 | pass |
35 | pass |
| 34 | 36 | ||