Merge branch 'master' of bitbucket.org:panleicim/appointement_modem_pool
This commit is contained in:
+3
-1
@@ -12,16 +12,18 @@ from pojo.ReserveResultPojo import PublishType
|
|||||||
|
|
||||||
# Log subjects
|
# Log subjects
|
||||||
LOG_SUBJECT_EVENT = "EVENT"
|
LOG_SUBJECT_EVENT = "EVENT"
|
||||||
|
LOG_SUBJECT_SMS = "SMS"
|
||||||
|
SUBJECT_SIM_INFO = "sim_card"
|
||||||
# Log type
|
# Log type
|
||||||
TYPE_EVENT_CHECK_RESULTS = "EVENT_CHECK_RESULTS"
|
TYPE_EVENT_CHECK_RESULTS = "EVENT_CHECK_RESULTS"
|
||||||
TYPE_EVENT_RESET_ALL_SIM_CARDS = "EVENT_RESET_ALL_SIM_CARDS"
|
TYPE_EVENT_RESET_ALL_SIM_CARDS = "EVENT_RESET_ALL_SIM_CARDS"
|
||||||
TYPE_EVENT_CHANGE_SLOT = "EVENT_CHANGE_SLOT"
|
TYPE_EVENT_CHANGE_SLOT = "EVENT_CHANGE_SLOT"
|
||||||
|
TYPE_SMS_RECEIVED = "TYPE_SMS_RECEIVED"
|
||||||
LOG_ERROR = "ERROR"
|
LOG_ERROR = "ERROR"
|
||||||
LOG_TYPE_INFO = "INFO"
|
LOG_TYPE_INFO = "INFO"
|
||||||
LOG_APPOINTMENT_ERROR = "APPOINTMENT_ERROR"
|
LOG_APPOINTMENT_ERROR = "APPOINTMENT_ERROR"
|
||||||
LOG_APPOINTMENT_TIMEOUT = "TIMEOUT"
|
LOG_APPOINTMENT_TIMEOUT = "TIMEOUT"
|
||||||
LOG_APPOINTMENT_SUCCESS = "SUCCESS"
|
LOG_APPOINTMENT_SUCCESS = "SUCCESS"
|
||||||
SUBJECT_SIM_INFO = "sim_card"
|
|
||||||
|
|
||||||
|
|
||||||
class LogSender:
|
class LogSender:
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ import params
|
|||||||
from modems.ModemPool import ModemPool
|
from modems.ModemPool import ModemPool
|
||||||
from modems.card_pool import CardPool
|
from modems.card_pool import CardPool
|
||||||
from commandor import Commandor
|
from commandor import Commandor
|
||||||
from logs.LogSender import LOG_APPOINTMENT_TIMEOUT, LOG_SUBJECT_EVENT, TYPE_EVENT_RESET_ALL_SIM_CARDS
|
from logs.LogSender import LOG_APPOINTMENT_TIMEOUT, LOG_SUBJECT_EVENT, TYPE_EVENT_RESET_ALL_SIM_CARDS, LOG_SUBJECT_SMS, \
|
||||||
|
TYPE_SMS_RECEIVED
|
||||||
from params import MODEM_POOL_PORTS, CARD_POOL_PORT, firebase_store_manager, oracle_log_sender
|
from params import MODEM_POOL_PORTS, CARD_POOL_PORT, firebase_store_manager, oracle_log_sender
|
||||||
from pojo.ReserveResultPojo import ReserveResultPojo
|
from pojo.ReserveResultPojo import ReserveResultPojo
|
||||||
from utils.excel_reader import ExcelHelper
|
from utils.excel_reader import ExcelHelper
|
||||||
@@ -42,7 +43,6 @@ def send_command(cmd: str, ser, wait_time_in_s: int = 0) -> bytes:
|
|||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
count = count + 1
|
count = count + 1
|
||||||
msg = ser.read(100)
|
msg = ser.read(100)
|
||||||
# msg = ser.read(100)
|
|
||||||
print(msg)
|
print(msg)
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
@@ -93,6 +93,8 @@ def handle_sms(sms):
|
|||||||
u'== SMS message received ==\nFrom: {0}\nTime: {1}\nMessage:\n{2}\n'.format(sms.number, sms.time, sms.text))
|
u'== SMS message received ==\nFrom: {0}\nTime: {1}\nMessage:\n{2}\n'.format(sms.number, sms.time, sms.text))
|
||||||
# extract the otp number
|
# extract the otp number
|
||||||
date = str(sms.time)[0:10]
|
date = str(sms.time)[0:10]
|
||||||
|
msg = "phone:{}, sms:{}".format(sms.number, sms.text)
|
||||||
|
params.oracle_log_sender.send_log(msg=msg, subject=LOG_SUBJECT_SMS, type=TYPE_SMS_RECEIVED)
|
||||||
if date == str(datetime.date.today()):
|
if date == str(datetime.date.today()):
|
||||||
logger.info("this sms is for today")
|
logger.info("this sms is for today")
|
||||||
if "rendez-vous" in sms.text:
|
if "rendez-vous" in sms.text:
|
||||||
@@ -182,7 +184,7 @@ def start_book():
|
|||||||
if modem.contact:
|
if modem.contact:
|
||||||
logger.info("contact found for this ccid")
|
logger.info("contact found for this ccid")
|
||||||
signal = modem.modem.signalStrength
|
signal = modem.modem.signalStrength
|
||||||
logger.info("信号强度: "+str(signal))
|
logger.info("信号强度: " + str(signal))
|
||||||
commandor.start_page(modem.contact)
|
commandor.start_page(modem.contact)
|
||||||
start_to_handle_sms(modem)
|
start_to_handle_sms(modem)
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
@@ -197,4 +199,3 @@ if __name__ == '__main__':
|
|||||||
start_listen()
|
start_listen()
|
||||||
start_book()
|
start_book()
|
||||||
# card_pool.switch_to_slot(12)
|
# card_pool.switch_to_slot(12)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user