Initialize serial port communication

parent 981f368f
...@@ -2,6 +2,15 @@ from penguidom import imodules ...@@ -2,6 +2,15 @@ from penguidom import imodules
from zope.interface import implements from zope.interface import implements
from twisted.plugin import IPlugin from twisted.plugin import IPlugin
from twisted.internet.serialport import SerialPort
from twisted.protocols.basic import LineReceiver
from twisted.internet import reactor
class ParadoxProtocol(LineReceiver):
def lineReceived(self, line):
print line
class Paradox(object): class Paradox(object):
...@@ -10,4 +19,8 @@ class Paradox(object): ...@@ -10,4 +19,8 @@ class Paradox(object):
def initialize(self, callback, logger): def initialize(self, callback, logger):
self.log = logger self.log = logger
self.core = callback self.core = callback
self.port = SerialPort(ParadoxProtocol(), '/dev/ttyUSB0', reactor)
logger.info("Plugin initialized") logger.info("Plugin initialized")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment