コード例 #1
0
    def prepare_3_parse_logger_definition(self):
        self.prepare_2_init_connection()
        parser = PMXmlParser()

        self._parameters = parser.parse("logger_METRIC_EN_v263.xml")

        self._parameters = sorted(self._parameters, key=lambda x: x.get_id(), reverse=True)

        self.assertIsNotNone(self._parameters)
        self.assertEqual(len(self._parameters), 716)
コード例 #2
0
    devices = map(InputDevice, list_devices())
    eventX = ""
    for dev in devices:
        if dev.name == "ADS7846 Touchscreen":
            eventX = dev.fn

    os.environ["SDL_FBDEV"] = "/dev/fb1"
    os.environ["SDL_MOUSEDRV"] = "TSLIB"
    os.environ["SDL_MOUSEDEV"] = eventX

    screen = PMScreen()
    log_id = PM.log('Application started')

    screen.render()

    parser = PMXmlParser()

    supported_parameters = []

    if os.path.isfile("data/data.pkl"):
        input = open("data/data.pkl", "rb")
        defined_parameters = pickle.load(input)
        input.close()
    else:
        defined_parameters = parser.parse("logger_METRIC_EN_v131.xml")
        output = open("data/data.pkl", "wb")
        pickle.dump(defined_parameters, output, -1)
        output.close()

    connection = PMConnection()
    #connection = PMDemoConnection()
コード例 #3
0
ファイル: PMMain.py プロジェクト: borland667/PiMonitor
	devices = map(InputDevice, list_devices())
	eventX = ""
	for dev in devices:
			if dev.name == "ADS7846 Touchscreen":
				eventX = dev.fn

	os.environ["SDL_FBDEV"] = "/dev/fb1"
	os.environ["SDL_MOUSEDRV"] = "TSLIB"
	os.environ["SDL_MOUSEDEV"] = eventX

	screen = PMScreen()
	log_id = PM.log('Application started')
	
	screen.render()
	
	parser = PMXmlParser();

	supported_parameters = []
	
	if os.path.isfile("data/data.pkl"):
		input = open("data/data.pkl", "rb")
		defined_parameters = pickle.load(input)
		input.close()
	else:
		defined_parameters = parser.parse("logger_METRIC_EN_v290.xml")
		output = open("data/data.pkl", "wb")
		pickle.dump(defined_parameters, output, -1)
		output.close()		

	connection = PMConnection()
	#connection = PMDemoConnection()
コード例 #4
0
consoleHandler = logging.StreamHandler(sys.stdout)
consoleHandler.setFormatter(logFormatter)
logger.addHandler(consoleHandler)

logger.setLevel(logging.DEBUG)
foo = PM()
foo.set(logger)

logger.info('Lets do this!')

csv_file = open('/media/datalogs/pimonitor-log/{}.csv'.format(log_and_csv_name_ts), 'w')
writer = csv.writer(csv_file)

# TODO: Maybe pickle the parameters. Does it load faster?
parser = PMXmlParser()
defined_parameters = parser.parse("logger_STD_EN_v336.xml")
logger.info('-----------------------------------------------------------------------')
logger.info('Defined Parameters')
logger.info('-----------------------------------------------------------------------')
for p in defined_parameters:
    logger.info(p.to_string())

connection = PMConnection()
# connection = PMDemoConnection()

def graceful_shutdown(signal, frame):
    logger.info('Got a shutdown signal!')
    if connection:
        connection.close()
コード例 #5
0
        devices = map(InputDevice, list_devices())
        eventX = ""
        for dev in devices:
            print dev.name
            if dev.name == "ft5x_ts":
                eventX = dev.fn

    os.environ["SDL_FBDEV"] = "/dev/fb1"
    os.environ["SDL_MOUSEDRV"] = "TSLIB"
    os.environ["SDL_MOUSEDEV"] = eventX

    screen = PMScreen()
    screen.render()

    parser = PMXmlParser()

    supported_parameters = []

    if os.path.isfile("data/data.pkl"):
        serializedDataFile = open("data/data.pkl", "rb")
        defined_parameters = pickle.load(serializedDataFile)
        serializedDataFile.close()
    else:
        defined_parameters = parser.parse("logger_IMP_EN_v323.xml")
        defined_parameters = sorted(defined_parameters,
                                    key=lambda x: x.get_id(),
                                    reverse=True)
        output = open("data/data.pkl", "wb")
        pickle.dump(defined_parameters, output, -1)
        output.close()