try to test performance

This commit is contained in:
2022-04-17 19:28:38 +02:00
parent 0b422b9de9
commit d848ec9194
3 changed files with 42 additions and 40 deletions
+5 -5
View File
@@ -20,6 +20,7 @@ class ModemPool:
self._port_list = port_list
self._serial_list = []
self._excel_helper = ExcelHelper()
self.contacts = self._excel_helper.read_contacts("/contact_all.xlsx")
self._log_sender = oracle_log_sender
self._db_manager = firebase_store_manager
@@ -33,8 +34,8 @@ class ModemPool:
# may encontre exception here, multi-access to serial port
time.sleep(2)
self._send_command("AT+CFUN=1,1\r", ser)
# wait for 20 second, so that the modem can init all the sims
time.sleep(20)
# wait for 10 second, so that the modem can init all the sims
time.sleep(10)
def _generate_error_msg(self, slot_position, index, error: SIMError):
msg = "slot({}) SIM({}), error:{}".format(slot_position, index + 1,
@@ -49,15 +50,14 @@ class ModemPool:
position = (slot_position - 1) * len(self._port_list) + sim_position
# unlock sim
unlock_cmd = 'AT+CPIN="{0}\r"'.format("0000")
self._send_command(unlock_cmd, ser, 10)
self._send_command(unlock_cmd, ser, 30)
cmd = "AT+CCID\r"
response = str(self._send_command(cmd, ser))
ccid_group = re.search("[0-9F]+", response)
ccid = ccid_group.group(0)
operator = check_operator(ccid)
if operator == Operator.SFR or operator == Operator.CHINA_TELECOM:
contacts = self._excel_helper.read_contacts("/contact_all.xlsx")
contact = [contact for contact in contacts if
contact = [contact for contact in self.contacts if
contact.ccid.replace("F", "") == ccid.replace("F", "")]
if len(contact) > 0:
phone_number = contact[0].phone