Subversion Repositories HomeAutomation

Rev

Rev 746 | Rev 750 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 746 Rev 748
Line 3... Line 3...
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
 
-
 
9
class SpacePort():
-
 
10
   
-
 
11
    filterSpaces = {}
-
 
12
   
-
 
13
    def __init__ (self, filterSpaces):
-
 
14
        for fs in filterSpaces:
-
 
15
            self.filterSpaces[fs.name] = fs
-
 
16
   
-
 
17
    def runAll(self, args):
-
 
18
        for fs in filterSpaces.values():
-
 
19
            relatedSpaces = s.__RELATED_SPACES__
-
 
20
            fs.run(relatedSpaces, args)
-
 
21
   
-
 
22
    def run(self, spaceName, args):
-
 
23
        filtersSpaces[spaceName].run(args)
8
 
24
 
9
class CanPktHandler1(CanPktHandlerBase):
25
class CanPktHandler1(CanPktHandlerBase):
10
   
26
   
11
    daemonCfg = None
27
    daemonCfg = None
12
   
28
   
Line 26... Line 42...
26
        pkt = CanPkt.stringToCanPkt(self, strdata)
42
        pkt = CanPkt.stringToCanPkt(self, strdata)
27
#        print 'incoming: ' + pkt.toString()
43
#        print 'incoming: ' + pkt.toString()
28
 
44
 
29
        for filter in self.daemonCfg.filterChain:
45
        for filter in self.daemonCfg.filterChain:
30
            fObj = self.daemonCfg.filterCfg.filterModules[filter]
46
            fObj = self.daemonCfg.filterCfg.filterModules[filter]
31
            fObj.filter(pkt, fObj.__ASSOCIATED_SPACES__)
47
            sp = SpacePort(fObj.__ASSOCIATED_SPACES__)
-
 
48
            fObj.filter('', pkt, sp) # FIXME: use if name
32
   
49
 
33
   
50
 
34
    def output(self, data):
51
    def output(self, data):
35
        pass
52
        pass