def test_format_data_in_get_position(self):
        reprap_makerbot_protocol = ReprapMakerbotProtocol(driver=ReprapMakerbotDriver(), do_checksum=True)

        cmd_format = "<BBBIB"
        cmd = struct.pack(cmd_format, 213, 10, 129, 3568, 13)

        obs_data = reprap_makerbot_protocol._format_data_in(cmd)
Esempio n. 2
0
    def test_format_data_in_get_position(self):
        reprap_makerbot_protocol = ReprapMakerbotProtocol(
            driver=ReprapMakerbotDriver(), do_checksum=True)

        cmd_format = "<BBBIB"
        cmd = struct.pack(cmd_format, 213, 10, 129, 3568, 13)

        obs_data = reprap_makerbot_protocol._format_data_in(cmd)
    def test_format_data_out_get_firmware_info(self):
        reprap_makerbot_protocol = ReprapMakerbotProtocol(driver=ReprapMakerbotDriver(), do_checksum=True)
        cmd = struct.pack("<B", 0)
        cmd_size = struct.calcsize("<B")
        payload = (cmd, cmd_size)

        obs_data = reprap_makerbot_protocol._format_data_out("\x01")
        exp_data = "\xd5\x01\x01\xd2"# d5 1 1 5e 
        self.assertEquals(obs_data, exp_data)
    def test_format_data_out_shutdown(self):
        reprap_makerbot_protocol = ReprapMakerbotProtocol(driver=ReprapMakerbotDriver(), do_checksum=True)
        cmd = struct.pack("<B", 7)
        cmd_size = struct.calcsize("<B")
        payload = (cmd, cmd_size)

        obs_data = reprap_makerbot_protocol._format_data_out(payload)
        truc = struct.unpack("<BB%isB" % cmd_size, obs_data)
        exp_data = "\xd5\x01\x07\xf7"
        self.assertEquals(obs_data, exp_data)
Esempio n. 5
0
    def test_format_data_out_get_firmware_info(self):
        reprap_makerbot_protocol = ReprapMakerbotProtocol(
            driver=ReprapMakerbotDriver(), do_checksum=True)
        cmd = struct.pack("<B", 0)
        cmd_size = struct.calcsize("<B")
        payload = (cmd, cmd_size)

        obs_data = reprap_makerbot_protocol._format_data_out("\x01")
        exp_data = "\xd5\x01\x01\xd2"  # d5 1 1 5e
        self.assertEquals(obs_data, exp_data)
Esempio n. 6
0
    def test_format_data_out_shutdown(self):
        reprap_makerbot_protocol = ReprapMakerbotProtocol(
            driver=ReprapMakerbotDriver(), do_checksum=True)
        cmd = struct.pack("<B", 7)
        cmd_size = struct.calcsize("<B")
        payload = (cmd, cmd_size)

        obs_data = reprap_makerbot_protocol._format_data_out(payload)
        truc = struct.unpack("<BB%isB" % cmd_size, obs_data)
        exp_data = "\xd5\x01\x07\xf7"
        self.assertEquals(obs_data, exp_data)