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