service.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:tinyjaguar 作者: calston 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号