print cmd
This commit is contained in:
+22
-11
@@ -3,7 +3,7 @@ import time
|
|||||||
|
|
||||||
from pojo.contact_pojo import ContactPojo
|
from pojo.contact_pojo import ContactPojo
|
||||||
|
|
||||||
PACKAGE_NAME = "com.lpa.appointement"
|
PACKAGE_NAME = "com.opera.mini.android"
|
||||||
ACTIVITY_NAME = "MainActivity"
|
ACTIVITY_NAME = "MainActivity"
|
||||||
BROADCAST_ACTION = "com.lpa.appointement.broadcast"
|
BROADCAST_ACTION = "com.lpa.appointement.broadcast"
|
||||||
|
|
||||||
@@ -16,28 +16,39 @@ class Commandor:
|
|||||||
def start_page(self, contact: ContactPojo):
|
def start_page(self, contact: ContactPojo):
|
||||||
# specifying an explicit component name
|
# specifying an explicit component name
|
||||||
self.clear_app_data()
|
self.clear_app_data()
|
||||||
|
cmd = "/Users/panlei/Library/Android/sdk/platform-tools/adb shell am start -n {}/.{} --es \"first_name\" \"{}\" --es \"last_name\" \"{}\" --es \"phone\" \"{}\" --es \"email\" \"{}\" --es \"passport\" \"{}\"".format(
|
||||||
subprocess.call(
|
PACKAGE_NAME, ACTIVITY_NAME, contact.last_name, contact.first_name, "+33{}".format(contact.phone),
|
||||||
"/Users/panlei/Library/Android/sdk/platform-tools/adb shell am start -n {}/.{} --es \"first_name\" \"{}\" --es \"last_name\" \"{}\" --es \"phone\" \"{}\" --es \"email\" \"{}\" --es \"passport\" \"{}\"".format(
|
"{}_{}@gmail.com".format(contact.first_name, contact.last_name), contact.passport)
|
||||||
PACKAGE_NAME, ACTIVITY_NAME, contact.first_name, contact.last_name, contact.phone, "{}_{}@gmail.com".format(contact.first_name,contact.last_name), contact.passport), shell=True)
|
print("cmd is " + cmd)
|
||||||
|
subprocess.call(cmd, shell=True)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def clear_app_data(self):
|
def clear_app_data(self):
|
||||||
subprocess.call("/Users/panlei/Library/Android/sdk/platform-tools/adb shell pm clear {}".format(PACKAGE_NAME), shell=True)
|
subprocess.call("/Users/panlei/Library/Android/sdk/platform-tools/adb shell pm clear {}".format(PACKAGE_NAME),
|
||||||
|
shell=True)
|
||||||
|
|
||||||
def send_otp(self, otp: str):
|
def send_otp(self, otp: str):
|
||||||
subprocess.call(
|
subprocess.call(
|
||||||
"/Users/panlei/Library/Android/sdk/platform-tools/adb shell am broadcast -a {} --es otp \"{}\"".format(BROADCAST_ACTION, otp), shell=True)
|
"/Users/panlei/Library/Android/sdk/platform-tools/adb shell am broadcast -a {} --es otp \"{}\"".format(
|
||||||
|
BROADCAST_ACTION, otp), shell=True)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def reset_air_plan_mode(self):
|
def reset_air_plan_mode(self):
|
||||||
subprocess.call("/Users/panlei/Library/Android/sdk/platform-tools/adb shell settings put global airplane_mode_on 1", shell=True)
|
subprocess.call(
|
||||||
|
"/Users/panlei/Library/Android/sdk/platform-tools/adb shell settings put global airplane_mode_on 1",
|
||||||
|
shell=True)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
subprocess.call("/Users/panlei/Library/Android/sdk/platform-tools/adb shell am broadcast -a android.intent.action.AIRPLANE_MODE", shell=True)
|
subprocess.call(
|
||||||
|
"/Users/panlei/Library/Android/sdk/platform-tools/adb shell am broadcast -a android.intent.action.AIRPLANE_MODE",
|
||||||
|
shell=True)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
subprocess.call("/Users/panlei/Library/Android/sdk/platform-tools/adb shell settings put global airplane_mode_on 0", shell=True)
|
subprocess.call(
|
||||||
|
"/Users/panlei/Library/Android/sdk/platform-tools/adb shell settings put global airplane_mode_on 0",
|
||||||
|
shell=True)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
subprocess.call("/Users/panlei/Library/Android/sdk/platform-tools/adb shell am broadcast -a android.intent.action.AIRPLANE_MODE", shell=True)
|
subprocess.call(
|
||||||
|
"/Users/panlei/Library/Android/sdk/platform-tools/adb shell am broadcast -a android.intent.action.AIRPLANE_MODE",
|
||||||
|
shell=True)
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ from pojo.serial_modem import SerialModem
|
|||||||
from logs.AppLogging import init_logger
|
from logs.AppLogging import init_logger
|
||||||
from utils.message_receiver import MessageReceiver
|
from utils.message_receiver import MessageReceiver
|
||||||
|
|
||||||
OTP_TIMEOUT = 80
|
OTP_TIMEOUT = 130
|
||||||
is_finished = False
|
is_finished = False
|
||||||
commandor = Commandor()
|
commandor = Commandor()
|
||||||
contacts = []
|
contacts = []
|
||||||
@@ -166,7 +166,7 @@ def read_all_the_phone_number():
|
|||||||
|
|
||||||
|
|
||||||
def start_book():
|
def start_book():
|
||||||
slot_number = 1
|
slot_number = 18
|
||||||
slot_sum = 22
|
slot_sum = 22
|
||||||
for i in range(slot_number, slot_sum + 1):
|
for i in range(slot_number, slot_sum + 1):
|
||||||
card_pool.reset()
|
card_pool.reset()
|
||||||
|
|||||||
@@ -15,10 +15,16 @@ class SerialModem():
|
|||||||
self.ccid = ccid
|
self.ccid = ccid
|
||||||
|
|
||||||
def get_ccid(self):
|
def get_ccid(self):
|
||||||
cmd = "AT+CCID\r"
|
cmd = "AT+CCID"
|
||||||
self.modem.connect("0000")
|
self.modem.connect("0000")
|
||||||
print("try to get ccid")
|
print("try to get ccid")
|
||||||
response = self.modem.write(cmd, True)
|
response = self.modem.write(cmd, True)
|
||||||
self.ccid = response[0].split(" ")[1].replace("\"", "")
|
self.ccid = response[0].split(" ")[1].replace("\"", "")
|
||||||
print("The SIM card ccid is:" + self.ccid)
|
print("The SIM card ccid is:" + self.ccid)
|
||||||
print("The SIM phone number is:" + str(self.modem.ownNumber))
|
# print("try to get phone number")
|
||||||
|
# cmd_phone_number = "AT+CPBS=ON"
|
||||||
|
# openBook = self.modem.write(cmd_phone_number, True)
|
||||||
|
# print("response is :" + str(openBook))
|
||||||
|
# cmd_phone_number = "AT+CNUM"
|
||||||
|
# response2 = self.modem.write(cmd_phone_number, True)
|
||||||
|
# print("The SIM phone number is:" + str(response2))
|
||||||
|
|||||||
Reference in New Issue
Block a user