Пример #1
0
    def pack(self, addr, values, counter):
        values_thing = []
        for name, value in values.items():
            if name not in self.sig_names:
                self.sig_names[name] = ffi.new("char[]", name)

            values_thing.append({'name': self.sig_names[name], 'value': value})

        values_c = ffi.new("SignalPackValue[]", values_thing)

        return libdbc.canpack_pack(self.packer, addr, len(values_thing),
                                   values_c, counter)
Пример #2
0
    def pack(self, addr, values):
        # values: [(signal_name, signal_value)]

        values_thing = []
        for name, value in values:
            if name not in self.sig_names:
                self.sig_names[name] = ffi.new("char[]", name)

            values_thing.append({'name': self.sig_names[name], 'value': value})

        values_c = ffi.new("SignalPackValue[]", values_thing)

        return libdbc.canpack_pack(self.packer, addr, len(values_thing),
                                   values_c)
Пример #3
0
    def pack(self, addr, values, counter):
        values_thing = []
        for name, value in values.iteritems():
            if name not in self.sig_names:
                self.sig_names[name] = ffi.new("char[]", name)

            values_thing.append({'name': self.sig_names[name], 'value': value})

        print("definition pack in packer.py values_things")
        print(values_thing)
        values_c = ffi.new("SignalPackValue[]", values_thing)
        print("packer.py values_c under pack")
        print(values_c)

        return libdbc.canpack_pack(self.packer, addr, len(values_thing),
                                   values_c, counter)