Subversion Repositories HomeAutomation

Rev

Rev 612 | Blame | Compare with Previous | Last modification | View Log | SVN | RSS feed

  1. #!/usr/bin/python
  2.  
  3. import uncen
  4. import can
  5.  
  6. class Job( uncen.UncenJob ):
  7.     name = "Can Bridge"
  8.     version = "0.01"
  9.     listen = True
  10.  
  11.     def __init__( self, core, args ):
  12.         self.job_init( core )
  13.  
  14.     def close( self ):
  15.         self.job_close()
  16.  
  17.     def getstatus( self ):
  18.         return "running"
  19.  
  20.     def termcmd( self, args ):
  21.         cmd = args.pop(0)
  22.         if cmd == "add":
  23.             try:
  24.                 jid = args[0]
  25.                 self.can_connect( jid )
  26.             except:
  27.                 self.core.term.write( "Error connecting" )
  28.         elif cmd == "list":
  29.             self.core.term.write( "Job      - Job name" )
  30.             for cid in self.can_connections:
  31.                 jid = self.can_connections[cid]
  32.                 job = self.core.job_get( jid )
  33.                 self.core.term.write( "%8s - %s" % (self.core.job_name(jid), job.name) )
  34.  
  35. # callbacks
  36.     def can_recieve( self, scid, canp ):
  37.         cids = self.can_connections.keys()
  38.         for cid in cids:
  39.             if scid != cid:
  40.                 self.can_send(cid, canp)
  41.  
  42.     def can_accept( self, sjid, cid ):
  43.         return True
  44.