def startService(self):
root = resource.Resource()
root.putChild('', web.Index(self))
root.putChild('api', web.API(self))
root.putChild("static", File(FilePath('jaguar/resources/static').path))
site = server.Site(root, logPath='jaguar-access.log')
reactor.listenTCP(80, site)
gpio.setmode(gpio.BCM)
self.sr.setup()
yield self.sr.clear()
yield utils.wait(1)
yield self.sr.shiftOut(reduce(lambda x, y: x | y, self.red))
self.btnGreen.setup()
self.btnRed.setup()
self.pwrGood.setup()
self.atxOn.setup()
for n in self.nodes:
n.setup()
yield utils.wait(1)
if self.atxOn.state == gpio.LOW:
yield self.powerGood(gpio.LOW)
self.t = task.LoopingCall(self.loop)
self.t.start(5.0)
评论列表
文章目录