How to use the choochoo.fit.decode.Msg function in choochoo

To help you get started, we’ve selected a few choochoo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github andrewcooke / choochoo / choochoo / fit / decode.py View on Github external
tmp = CRC[checksum & 0xf]
        checksum = (checksum >> 4) & 0xfff
        checksum = checksum ^ tmp ^ CRC[(byte >> 4) & 0xf]
    if checksum != reference:
        raise Exception('Bad checksum (%04x / %04x)' % (checksum, reference))


class Msg(namedtuple('MsgTuple', 'definition data timestamp')):

    __slots__ = ()

    def parse(self):
        return self.definition.message.parse(self.data, self.definition, self.timestamp)


class DataMsg(Msg): pass


class TimedMsg(Msg): pass


class Header:

    __slots__ = ('__byte')

    def __init__(self, byte):
        self.__byte = byte

    def is_timestamp(self):
        return self.__byte & 0x80

    def is_definition(self):
github andrewcooke / choochoo / choochoo / fit / decode.py View on Github external
if checksum != reference:
        raise Exception('Bad checksum (%04x / %04x)' % (checksum, reference))


class Msg(namedtuple('MsgTuple', 'definition data timestamp')):

    __slots__ = ()

    def parse(self):
        return self.definition.message.parse(self.data, self.definition, self.timestamp)


class DataMsg(Msg): pass


class TimedMsg(Msg): pass


class Header:

    __slots__ = ('__byte')

    def __init__(self, byte):
        self.__byte = byte

    def is_timestamp(self):
        return self.__byte & 0x80

    def is_definition(self):
        return self.__byte & 0x40

    def local_type(self):