예제 #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
    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()
    while True:
        try:
            connection.open()

            ecu_packet = connection.init(1)
            tcu_packet = connection.init(2)

            if ecu_packet == None or tcu_packet == None:
                PM.log("Can't get initial data", log_id)
예제 #3
0
	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()
	while True:
		try:
			connection.open()
		
			ecu_packet = connection.init(1)
			tcu_packet = connection.init(2)
						
			if ecu_packet == None or tcu_packet == None:
				PM.log("Can't get initial data", log_id)
예제 #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()

    if csv_file:
예제 #5
0
    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()

    if len(sys.argv) > 1 and sys.argv[1] == "demo":
        connection = PMDemoConnection()
    elif platform.system() == "Linux":
        connection = PMConnection()
    else:
        connection = PMDemoConnection()

    while True: