def test_get_vidpid_by_machine(self): expectedRep2 = (0x23C1, 0xB015) expectedRep = (0x23C1, 0xD314) expectedMighty = (0x23C1, 0xB404) rep = makerbot_driver.get_vid_pid_by_name('The Replicator') rep2 = makerbot_driver.get_vid_pid_by_name('The Replicator 2') mighty = makerbot_driver.get_vid_pid_by_name('MightyBoard') self.assertEqual(expectedRep2, rep2) self.assertEqual(expectedRep, rep) self.assertEqual(expectedMighty, mighty)
def test_get_vidpid_by_machine(self): expectedRep2 = (0x23C1, 0xB015) expectedRep = (0x23C1, 0xD314) expectedMighty = (0x23C1, 0xB404) rep = makerbot_driver.get_vid_pid_by_name('The Replicator') rep2 = makerbot_driver.get_vid_pid_by_name('The Replicator 2') mighty = makerbot_driver.get_vid_pid_by_name('MightyBoard') self.assertEqual(expectedRep2, rep2) self.assertEqual(expectedRep, rep) self.assertEqual(expectedMighty, mighty)
def get_profile_regex(self, machine_setup_dict): """ Decision tree for machine decisions. @param dict machine_setup_dict: A dictionary containing information about the connected machine @return str """ regex = None #First check for VID/PID matches if 'vid' in machine_setup_dict and 'pid' in machine_setup_dict: regex = self.get_profile_regex_has_vid_pid(machine_setup_dict) if '.*Replicator2' == regex: #if the pid does not belong to the legacy Rep2's then no toolcount #inquiry is necessary, return the Rep2 regex if(makerbot_driver.get_vid_pid_by_name('The Replicator 2')[1] == machine_setup_dict['pid']): pass elif regex and machine_setup_dict.get('tool_count', 0) == 2: regex = regex + 'X' elif machine_setup_dict.get('tool_count', 0) != 1: regex = None elif '.*Replicator2X' == regex: pass else: if regex and machine_setup_dict.get('tool_count', 0) == 1: regex = regex + 'Single' elif regex and machine_setup_dict.get('tool_count', 0) == 2: regex = regex + 'Dual' else: regex = None return regex
def get_profile_regex(self, machine_setup_dict): """ Decision tree for machine decisions. @param dict machine_setup_dict: A dictionary containing information about the connected machine @return str """ regex = None #First check for VID/PID matches if 'vid' in machine_setup_dict and 'pid' in machine_setup_dict: regex = self.get_profile_regex_has_vid_pid(machine_setup_dict) if '.*Replicator2' == regex: #if the pid does not belong to the legacy Rep2's then no toolcount #inquiry is necessary, return the Rep2 regex if (makerbot_driver.get_vid_pid_by_name('The Replicator 2')[1] == machine_setup_dict['pid']): pass elif regex and machine_setup_dict.get('tool_count', 0) == 2: regex = regex + 'X' elif machine_setup_dict.get('tool_count', 0) != 1: regex = None elif '.*Replicator2X' == regex: pass else: if regex and machine_setup_dict.get('tool_count', 0) == 1: regex = regex + 'Single' elif regex and machine_setup_dict.get('tool_count', 0) == 2: regex = regex + 'Dual' else: regex = None return regex