Bedre variabelnavn
This commit is contained in:
parent
c717f723b6
commit
6df94a2f0d
14
mtrlog.py
14
mtrlog.py
@ -23,13 +23,13 @@ class MtrLogFormatter:
|
|||||||
'"%s"' % datetime_extracted.strftime('%d.%m.%y %H:%M:%S.000'))
|
'"%s"' % datetime_extracted.strftime('%d.%m.%y %H:%M:%S.000'))
|
||||||
log_line.append(
|
log_line.append(
|
||||||
'"%02d.%02d.%02d %02d:%02d:%02d.%03d"' % (
|
'"%02d.%02d.%02d %02d:%02d:%02d.%03d"' % (
|
||||||
msg.timestamp_day(),
|
msg.day(),
|
||||||
msg.timestamp_month(),
|
msg.month(),
|
||||||
msg.timestamp_year(),
|
msg.year(),
|
||||||
msg.timestamp_hours(),
|
msg.hours(),
|
||||||
msg.timestamp_minutes(),
|
msg.minutes(),
|
||||||
msg.timestamp_seconds(),
|
msg.seconds(),
|
||||||
msg.timestamp_milliseconds()))
|
msg.milliseconds()))
|
||||||
log_line.append('%06d' % msg.card_id())
|
log_line.append('%06d' % msg.card_id())
|
||||||
log_line.append('%04d' % 0) # skipped product week
|
log_line.append('%04d' % 0) # skipped product week
|
||||||
log_line.append('%04d' % 0) # skipped product year
|
log_line.append('%04d' % 0) # skipped product year
|
||||||
|
28
mtrreader.py
28
mtrreader.py
@ -170,25 +170,25 @@ class MtrStatusMessage:
|
|||||||
def mtr_id(self):
|
def mtr_id(self):
|
||||||
return int.from_bytes(self.message_bytes[6:8], 'little')
|
return int.from_bytes(self.message_bytes[6:8], 'little')
|
||||||
|
|
||||||
def timestamp_year(self):
|
def year(self):
|
||||||
return int.from_bytes(self.message_bytes[8:9], 'little')
|
return int.from_bytes(self.message_bytes[8:9], 'little')
|
||||||
|
|
||||||
def timestamp_month(self):
|
def month(self):
|
||||||
return int.from_bytes(self.message_bytes[9:10], 'little')
|
return int.from_bytes(self.message_bytes[9:10], 'little')
|
||||||
|
|
||||||
def timestamp_day(self):
|
def day(self):
|
||||||
return int.from_bytes(self.message_bytes[10:11], 'little')
|
return int.from_bytes(self.message_bytes[10:11], 'little')
|
||||||
|
|
||||||
def timestamp_hours(self):
|
def hours(self):
|
||||||
return int.from_bytes(self.message_bytes[11:12], 'little')
|
return int.from_bytes(self.message_bytes[11:12], 'little')
|
||||||
|
|
||||||
def timestamp_minutes(self):
|
def minutes(self):
|
||||||
return int.from_bytes(self.message_bytes[12:13], 'little')
|
return int.from_bytes(self.message_bytes[12:13], 'little')
|
||||||
|
|
||||||
def timestamp_seconds(self):
|
def seconds(self):
|
||||||
return int.from_bytes(self.message_bytes[13:14], 'little')
|
return int.from_bytes(self.message_bytes[13:14], 'little')
|
||||||
|
|
||||||
def timestamp_milliseconds(self):
|
def milliseconds(self):
|
||||||
return int.from_bytes(self.message_bytes[14:16], 'little')
|
return int.from_bytes(self.message_bytes[14:16], 'little')
|
||||||
|
|
||||||
def battery_status(self):
|
def battery_status(self):
|
||||||
@ -214,25 +214,25 @@ class MtrDataMessage:
|
|||||||
def mtr_id(self):
|
def mtr_id(self):
|
||||||
return int.from_bytes(self.message_bytes[6:8], 'little')
|
return int.from_bytes(self.message_bytes[6:8], 'little')
|
||||||
|
|
||||||
def timestamp_year(self):
|
def year(self):
|
||||||
return int.from_bytes(self.message_bytes[8:9], 'little')
|
return int.from_bytes(self.message_bytes[8:9], 'little')
|
||||||
|
|
||||||
def timestamp_month(self):
|
def month(self):
|
||||||
return int.from_bytes(self.message_bytes[9:10], 'little')
|
return int.from_bytes(self.message_bytes[9:10], 'little')
|
||||||
|
|
||||||
def timestamp_day(self):
|
def day(self):
|
||||||
return int.from_bytes(self.message_bytes[10:11], 'little')
|
return int.from_bytes(self.message_bytes[10:11], 'little')
|
||||||
|
|
||||||
def timestamp_hours(self):
|
def hours(self):
|
||||||
return int.from_bytes(self.message_bytes[11:12], 'little')
|
return int.from_bytes(self.message_bytes[11:12], 'little')
|
||||||
|
|
||||||
def timestamp_minutes(self):
|
def minutes(self):
|
||||||
return int.from_bytes(self.message_bytes[12:13], 'little')
|
return int.from_bytes(self.message_bytes[12:13], 'little')
|
||||||
|
|
||||||
def timestamp_seconds(self):
|
def seconds(self):
|
||||||
return int.from_bytes(self.message_bytes[13:14], 'little')
|
return int.from_bytes(self.message_bytes[13:14], 'little')
|
||||||
|
|
||||||
def timestamp_milliseconds(self):
|
def milliseconds(self):
|
||||||
return int.from_bytes(self.message_bytes[14:16], 'little')
|
return int.from_bytes(self.message_bytes[14:16], 'little')
|
||||||
|
|
||||||
def packet_num(self):
|
def packet_num(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user