1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-30 00:00:11 +01:00
VILLASnode/contrib/python/s2ss/msg.py

24 lines
No EOL
491 B
Python

from . import ts
class Message:
"""Parsing a S2SS from a file (not a UDP package!!)"""
def __init__(self, ts, values, source = None):
self.source = source
self.ts = ts
self.values = values
@classmethod
def parse(self, line, source = None):
csv = line.split()
t = ts.Timestamp.parse(csv[0])
v = map(float, csv[1:])
return Message(t, v, source)
def __str__(self):
return '%s %s' % (self.ts, self.values)
def __cmp__(self, other):
return cmp(self.ts, other.ts)