add position to sim info

This commit is contained in:
2022-03-02 09:54:15 +01:00
parent 54287f70c9
commit 4563929881
4 changed files with 23 additions and 11 deletions
+3 -1
View File
@@ -65,8 +65,10 @@ class ModemPool:
response = str(self._send_command(cmd, ser))
ccid_group = re.search("[0-9F]+", response)
ccid = ccid_group.group(0)
sim_position = index + 1
position = (slot_position - 1) * 15 + sim_position
if phone_number:
self._db_manager.save_sim_info(SimInfoPojo(phone=phone_number, ccid=ccid))
self._db_manager.save_sim_info(SimInfoPojo(phone=phone_number, ccid=ccid, position=position))
# write the number to sim card's phonebook
cmd = f'AT+CPBW={self.phone_number_position},\"{phone_number}\"\r'
self._send_command(cmd, ser, wait_time_in_s=2)