Merge branch 'master' into feature/mailer

This commit is contained in:
2022-03-08 11:53:36 +01:00
7 changed files with 37 additions and 15 deletions
+9 -5
View File
@@ -91,12 +91,16 @@ class ModemPool:
def _send_command(self, cmd: str, ser, wait_time_in_s: int = 0) -> bytes:
ser.write(cmd.encode())
msg = ser.read(100)
count = 0
while 'OK' not in str(msg) and count < wait_time_in_s:
time.sleep(1)
count = count + 1
msg = None
try:
msg = ser.read(100)
count = 0
while 'OK' not in str(msg) and count < wait_time_in_s:
time.sleep(1)
count = count + 1
msg = ser.read(100)
except Exception as exc:
print(exc)
# msg = ser.read(100)
print(msg)
return msg
+14 -2
View File
@@ -1,4 +1,5 @@
import subprocess
import time
from pojo.contact_pojo import ContactPojo
@@ -29,9 +30,20 @@ class Commandor:
"adb shell am broadcast -a {} --es otp \"{}\"".format(BROADCAST_ACTION, otp), shell=True)
pass
def reset_air_plan_mode(self):
subprocess.call("adb shell settings put global airplane_mode_on 1", shell=True)
time.sleep(1)
subprocess.call("adb shell am broadcast -a android.intent.action.AIRPLANE_MODE", shell=True)
time.sleep(1)
subprocess.call("adb shell settings put global airplane_mode_on 0", shell=True)
time.sleep(1)
subprocess.call("adb shell am broadcast -a android.intent.action.AIRPLANE_MODE", shell=True)
time.sleep(5)
if __name__ == '__main__':
commandor = Commandor()
contact = ContactPojo("0649614591", "E24183897", "LIU", "Yusi", "AZEER", "lei-pan@outlook.com")
commandor.start_page(contact)
# contact = ContactPojo("0649614591", "E24183897", "LIU", "Yusi", "AZEER", "lei-pan@outlook.com")
# commandor.start_page(contact)
commandor.reset_air_plan_mode()
# commandor.send_otp("262353")
BIN
View File
Binary file not shown.
+5 -4
View File
@@ -65,8 +65,9 @@ class DataManager:
doc_ref = self._db.collection(document_name).document(result.id)
doc_ref.set(result.to_firestore_dict())
else:
doc_ref = self._db.collection(ERROR_COLLECTION_NAME).document(result.phone)
doc_ref.set(result.to_firestore_dict())
if len(result.phone) > 0:
doc_ref = self._db.collection(ERROR_COLLECTION_NAME).document(result.phone)
doc_ref.set(result.to_firestore_dict())
def save_timeout_contact(self, contact: ContactPojo):
doc_ref = self._db.collection(TIMEOUT).document(str(contact.phone))
@@ -132,6 +133,6 @@ class DataManager:
if __name__ == '__main__':
# params.firebase_store_manager.upload_contact_list_to_cloud()
# params.firebase_store_manager.save_to_excel()
params.firebase_store_manager.save_to_excel()
# params.firebase_store_manager.clear_all_sim_info()
print(params.firebase_store_manager.get_mail_list())
# print(params.firebase_store_manager.get_mail_list())
+3 -1
View File
@@ -1,8 +1,10 @@
import logging
import definitions
def init_logger():
logging.basicConfig(filename="appointment.log",
logging.basicConfig(filename=definitions.ROOT_DIR + "/appointment.log",
filemode='a',
format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s',
datefmt='%D:%H:%M:%S',
+4 -3
View File
@@ -80,6 +80,7 @@ def create_modem_for_port(port: str) -> Union[SerialModem, None]:
def timeout_occurred(serial_modem: SerialModem):
firebase_store_manager.save_timeout_contact(serial_modem.contact)
oracle_log_sender.send_log(str(serial_modem.phone_number), type=LOG_APPOINTMENT_TIMEOUT)
commandor.reset_air_plan_mode()
def start_to_handle_sms(serial_modem: SerialModem):
@@ -161,8 +162,8 @@ def start_listen():
def read_all_the_phone_number():
params.oracle_log_sender.send_log(msg="SIM卡自检开始", subject=LOG_SUBJECT_EVENT, type=LOG_SUBJECT_EVENT)
slot_number = 1
slot_sum = 31
# card_pool.switch_to_slot(3)
slot_sum = 30
# card_pool.switch_to_slot(29)
firebase_store_manager.clear_all_sim_info()
for i in range(slot_number, slot_sum + 1):
card_pool.reset()
@@ -175,7 +176,7 @@ def read_all_the_phone_number():
def start_book():
slot_number = 1
slot_sum = 29
slot_sum = 30
for i in range(slot_number, slot_sum + 1):
card_pool.reset()
print("will switch to " + str(i))
+2
View File
@@ -0,0 +1,2 @@
#!/bin/zsh
/Users/panlei/Documents/worksapce/appointment_modem_pool/venv/bin/python3 /Users/panlei/Documents/worksapce/appointment_modem_pool/main.py