Пример #1
0
    def __init__(self):
        """Initialise the bentv_ui class - reads the configuration file
        and initialises the screen and GPIO monitor"""
        print "bentv.__init__()"
        configPath = "%s/%s" % (os.path.dirname(
            os.path.realpath(__file__)), self.configFname)
        print configPath
        self.cfg = ConfigUtil(configPath, self.configSection)

        self.debug = self.cfg.getConfigBool("debug")
        if (self.debug): print "Debug Mode"

        self.debounce_ms = self.cfg.getConfigInt("debounce_ms")
        self.shortpress_ms = self.cfg.getConfigInt("shortpress_ms")

        self.hostname, self.ipaddr = self.getHostName()
        print self.hostname, self.ipaddr
        self.timeDown = 0.0
        self.presetNo = 1
        self.shortPress = False
        self.longPress = False
        self.initScreen()
        self.initGPIO()
        self.UIMode = self.CAMERA_MODE  # Next line changes mode to start in
        # FITDECT_MODE.
        self.changeUIMode()  # Initialises the messages.
Пример #2
0
    def __init__(self):
        """Initialise the bentv_ui class - reads the configuration file
        and initialises the screen and GPIO monitor"""
        print "bentv.__init__()"
        configPath = "%s/%s" % (os.path.dirname(os.path.realpath(__file__)),
                                self.configFname)
        print configPath
        self.cfg = ConfigUtil(configPath,self.configSection)

        self.debug = self.cfg.getConfigBool("debug")
        if (self.debug): print "Debug Mode"
        
        self.hostname, self.ipaddr = self.getHostName()
        print self.hostname, self.ipaddr
        self.presetNo = 1
        self.initScreen()
        self.initGPIO()
Пример #3
0
    def __init__(self, save=False, inFile=None):
        print "benFinder.__init__()"
        print os.path.realpath(__file__)
        configPath = "%s/%s" % (os.path.dirname(
            os.path.realpath(__file__)), self.configFname)
        print configPath
        self.cfg = ConfigUtil(configPath, self.configSection)

        self.debug = self.cfg.getConfigBool("debug")
        if (self.debug): print "Debug Mode"

        self._wkdir = self.cfg.getConfigStr("working_directory")
        if (self.debug): print "working_directory=%s\n" % self._wkdir
        self._tmpdir = self.cfg.getConfigStr("tmpdir")
        if (self.debug): print "tmpdir=%s\n" % self._tmpdir

        # Check if we are running from live kinect or a file.
        if (inFile):
            device = depth.CV_CAP_FILE
        else:
            device = depth.CV_CAP_FREENECT

        # Initialise the captureManager
        self._captureManager = CaptureManager(device,
                                              None,
                                              True,
                                              inFile=inFile)
        self._captureManager.channel = depth.CV_CAP_OPENNI_DEPTH_MAP

        # If we are runnign from a file, use the first frame as the
        # background image.
        if (inFile):
            self.saveBgImg()

        # If we have asked to save the background image, do that, and exit,
        # otherwise initialise the seizure detector.
        if (save):
            self.saveBgImg()
        else:
            self.loadBgImg()
            self.autoBackgroundImg = None
            self._status = self.ALARM_STATUS_OK
            self._ts = TimeSeries(
                tslen=self.cfg.getConfigInt("timeseries_length"))
            self._frameCount = 0
            self._outputFrameCount = 0
            self._nPeaks = 0
            self._ts_time = 0
            self._rate = 0
            self._ws = webServer.benWebServer(self)
            self._ws.setBgImg(
                "%s/%s" %
                (self._tmpdir, self.cfg.getConfigStr("background_depth")))
            self._ws.setChartImg(
                "%s/%s" % (self._tmpdir, self.cfg.getConfigStr("chart_fname")))
            self._ws.setRawImg(
                "%s/%s" %
                (self._tmpdir, self.cfg.getConfigStr("raw_image_fname")))
            self._ws.setMaskedImg(
                "%s/%s" %
                (self._tmpdir, self.cfg.getConfigStr("masked_image_fname")))
            self._ws.setDataFname(
                "%s/%s" % (self._tmpdir, self.cfg.getConfigStr("data_fname")))
            self._ws.setAnalysisResults({})
            webServer.setRoutes(self._ws)
            self.run()