def main(): modem = m590() modem.init() checkIfModuleFrozen() setUpPin() while True: checkIfModuleFrozen() # while True: # speak("Enter a Phone number") # phoneNumber = enterPhoneNumber() # if len(phoneNumber) > 13 or len(phoneNumber) < 10: # print len(phoneNumber) # print "Error. Try entering your number in one of the following formatts::" + "\n" + "0637165118 +33637165118 or 0033637165118" # continue # else: # speak("Sending to " + phoneNumber) # break phoneNumber = "0637165118" #message = raw_input("Enter Message::\n") speak("Enter your message") print ("Enter message.\n") message = enterMessage() #SEND SMS print ("Sending text..") speak("Sending text") modem.send_sms(phoneNumber, message) response = m590.ser.readlines(None) if response[0].decode() == "\n": speak("Sent!") print ("Sent!") else: speak("error") print (response) #READ ALL SMS #modem.read_sms(4) #print modem.SMS modem.deinit()
def main(): modem = m590() modem.init() vibrate() checkIfModuleFrozen() setUpPin() outgoingCall = False incomingCall = False runProgram = True response1 = "" response2 = "" response3 = "" response4 = "" response5 = "" response6 = "" response7 = "" response8 = "" response9 = "" response10 = "" while runProgram: # if keyboard.is_pressed('space'): # runProgram = False #response = m590.ser.readlines(2) #changed monday morning response = m590.ser.readlines() print (response) ringing = False #added monday morning if len(response) > 1: if response[1] == "NO CARRIER\r\n": outgoingCall = False incomingCall = False ringing = False while len(response) > 1 and (ringing == True or response[1] == "RING\r\n"): response = m590.ser.readlines() #changed monday morning ringing = True #changed monday morning if not GPIO.input(pad1): m590.ser.write("ata\r") response = m590.ser.readlines() #changed monday morning print(response) print ("picking up call") incomingCall = True ringing = False #added monday morning break elif not GPIO.input(pad3): m590.ser.write("ata\r") time.sleep(0.5) m590.ser.write("ath\r") response = m590.ser.readlines() #changed monday morning print(response) print ("Rejecting Call - THIS END") incomingCall = False ringing = False #added monday morning break response10 = response9 response9 = response8 response8 = response7 response7 = response6 response6 = response5 response5 = response4 response4 = response3 response3 = response2 response2 = response1 response1 = response print("response1: " + str(response1)) print("response2: " + str(response2)) print("response3: " + str(response3)) print("response4: " + str(response4)) print("response5: " + str(response5)) print("response6: " + str(response6)) print("response7: " + str(response7)) vibrate() if (len(response1) > 1 and response1[1] == "RING\r\n") or (len(response2) > 1 and response2[1] == "RING\r\n") or (len(response3) > 1 and response3[1] == "RING\r\n") or (len(response4) > 1 and response4[1] == "RING\r\n") or (len(response5) > 1 and response5[1] == "RING\r\n") or (len(response6) > 1 and response6[1] == "RING\r\n") or (len(response7) > 1 and response7[1] == "RING\r\n") or (len(response8) > 1 and response8[1] == "RING\r\n") or (len(response9) > 1 and response9[1] == "RING\r\n") or (len(response10) > 1 and response10[1] == "RING\r\n"): ringing = True else: ringing = False #added monday morning if not GPIO.input(pad1) and (ringing == False) and (outgoingCall == False) and (incomingCall == False): #changed monday morning print ("placing call") m590.ser.write("atd" + phoneNumber +";\r") response = m590.ser.readlines() #changed monday morning print (response) outgoingCall = True while outgoingCall == True or incomingCall == True: if not GPIO.input(pad3): m590.ser.write("ath\r") response = m590.ser.readlines() #changed monday morning print(response) print ("hanging up - THIS END") outgoingCall = False incomingCall = False # elif keyboard.is_pressed('space'): # runProgram = False response = m590.ser.readlines() #changed monday morning if len(response) > 0: if response[1] == "NO CARRIER\r\n": m590.ser.write("ath\r") response = m590.ser.readlines() #changed monday morning print(response) print ("hanging up - OTHER END") outgoingCall = False incomingCall = False #is this needed????????????????????????????????????????????????????????????????????? elif response[0] == "NO CARRIER\r\n": m590.ser.write("ath\r") response = m590.ser.read(None) print(response) print ("hanging up - OTHER END") outgoingCall = False incomingCall = False modem.deinit()
def main(): modem = m590() modem.init() checkIfModuleFrozen() setUpPin() outgoingCall = False incomingCall = False runProgram = True while runProgram: if keyboard.is_pressed('space'): runProgram = False #response = m590.ser.readlines(2) #changed monday morning response = m590.ser.readlines() print(response) ringing = False #added monday morning if len(response) > 1: if response[1] == "NO CARRIER\r\n": outgoingCall = False incomingCall = False ringing = False while response[1] == "RING\r\n": ringing = True #changed monday morning if keyboard.is_pressed('1'): m590.ser.write("ata\r") response = m590.ser.readlines() #changed monday morning print(response) print("picking up call") incomingCall = True break elif keyboard.is_pressed('0'): m590.ser.write("ata\r") time.sleep(0.5) m590.ser.write("ath\r") response = m590.ser.readlines() #changed monday morning print(response) print("Rejecting Call - THIS END") incomingCall = False break ringing = False #added monday morning if keyboard.is_pressed('1') and (ringing == False) and ( outgoingCall == False) and (incomingCall == False): #changed monday morning print("placing call") m590.ser.write("atd" + phoneNumber + ";\r") response = m590.ser.readlines() #changed monday morning print(response) outgoingCall = True while outgoingCall == True or incomingCall == True: if keyboard.is_pressed('0'): m590.ser.write("ath\r") response = m590.ser.readlines() #changed monday morning print(response) print("hanging up - THIS END") outgoingCall = False incomingCall = False elif keyboard.is_pressed('space'): runProgram = False response = m590.ser.readlines() #changed monday morning if len(response) > 0: if response[1] == "NO CARRIER\r\n": m590.ser.write("ath\r") response = m590.ser.readlines() #changed monday morning print(response) print("hanging up - OTHER END") outgoingCall = False incomingCall = False #is this needed????????????????????????????????????????????????????????????????????? elif response[0] == "NO CARRIER\r\n": m590.ser.write("ath\r") response = m590.ser.read(None) print(response) print("hanging up - OTHER END") outgoingCall = False incomingCall = False modem.deinit()
def main(): modem = m590() modem.init() checkIfModuleFrozen() setUpPin() while True: checkIfModuleFrozen() while True: speak("Entrer un numéro français de téléphone portable.") phoneNumber = enterPhoneNumber() # phoneNumber = "0637165118" if len(phoneNumber) < 10: print len(phoneNumber) speak("Numéro de téléphone trop court. Essayer encore.") print ("Error. Too Short") continue elif len(phoneNumber) == 10 and (phoneNumber[:2] != "06" and phoneNumber[:2] != "07"): speak("Les numéros francais de téléphone portable commencent soit par un 06, soit par un 07. Essayer encore.") print ("Error. Not French.") print(phoneNumber[:2]) continue elif len(phoneNumber) == 13 and (phoneNumber[:5] != "00336" and phoneNumber[:5] != "00337"): speak("Les numéros francais de téléphone portable commencent soit par un 00336, soit par un 00337. Essayer encore.") print ("Error. Not French.") print(phoneNumber[:5]) continue elif len(phoneNumber) == 12: print len(phoneNumber) speak("Numéro de téléphone trop long. les numéros de téléphone commencent par un 06 ou un 07 et doivent seulement avoir 10 caractères. Essayer encore.") print ("Error. Too Short") continue elif len(phoneNumber) > 13: print len(phoneNumber) speak("Numéro de téléphone trop long. Essayer encore.") print ("Error. Too Short") continue else: speak("Envoi à" + phoneNumber) break #message = raw_input("Enter Message::\n") speak("Ecrire votre message.") print ("Enter message.\n") message = enterMessage() #SEND SMS print ("Sending text.") speak("Envoi message.") modem.send_sms(phoneNumber, message) # time.sleep(1) # response = m590.ser.readlines(None) # print (response) # if response == "": # speak("Error!") # print (response) # elif response[0] == "\n": # speak("Sent!") # print ("Sent!") # else: # speak("error") # print (response) allOn() allOff() modem.deinit()
def main(): modem = m590() modem.init() checkIfModuleFrozen() setUpPin() outgoingCall = False incomingCall = False runProgram = True ringing = False file = open('responses.txt', 'a') while runProgram: if keyboard.is_pressed('space'): runProgram = False # response = m590.ser.read(30) # time.sleep(0.5) while True: if m590.ser.inWaiting() > 0: break if keyboard.is_pressed('1'): break time.sleep(0.05) response = m590.ser.read(30) print("1" + response + "1") while response[2:6] == "RING": print("f**k yes2") if keyboard.is_pressed('1'): m590.ser.write("ata\r") print("picking up call") incomingCall = True break elif keyboard.is_pressed('0'): m590.ser.write("ath\r") print("Rejecting Call - THIS END") outgoingCall = False incomingCall = False break if keyboard.is_pressed('1') and (outgoingCall == False and incomingCall == False): print("placing call") m590.ser.write("atd" + phoneNumber + ";\r") outgoingCall = True callConnected = True while outgoingCall: while True: if m590.ser.inWaiting() > 0: break if keyboard.is_pressed('0'): outgoingCall = False break time.sleep(0.05) response = m590.ser.read(30) print("2" + response + "2") if response[2:12] == "NO CARRIER": print("f**k yes3") outgoingCall = False # while outgoingCall == True or incomingCall == True: # if keyboard.is_pressed('0'): # m590.ser.write("ath\r") # response = m590.ser.read(None) # print(response) # print ("hanging up - THIS END") # outgoingCall = False # incomingCall = False # elif keyboard.is_pressed('space'): # runProgram = False # response = m590.ser.read(None) # if len(response) > 0: # if response[1] == "NO CARRIER\r\n": # m590.ser.write("ath\r") # response = m590.ser.read(None) # print(response) # print ("hanging up - OTHER END") # outgoingCall = False # incomingCall = False # elif response[0] == "NO CARRIER\r\n": # m590.ser.write("ath\r") # response = m590.ser.read(None) # print(response) # print ("hanging up - OTHER END") # outgoingCall = False # incomingCall = False modem.deinit()
#end of definintion od speak function for text to speach letter = "" message = "" number = "" numberstring = "" number_kris = "0033637165118" response = "" pin = "" speak("Initialising Modem & Checking pin") print "Initialising Modem & Checking PIN.." modem = m590() modem.init() while True: m590.ser.write("at+cpin?\r") response = m590.ser.readlines(None) print response if response[2] == "+CPIN: READY\r\n" or response[1] == "+CPIN: READY\r\n": print "pin okay. let's go." speak("pin okay. let's go.") break elif response[2] == "+CPIN: SIM PIN\r\n": pin = raw_input("Enter your SIM's PIN code::\n") m590.ser.write("at+cpin=\"" + pin + "\"\r") time.sleep(0.5)
def main(): modem = m590() modem.init() checkIfModuleFrozen() setUpPin() while True: checkIfModuleFrozen() while True: speak("Enter a french mobile phone number") phoneNumber = enterPhoneNumber() # phoneNumber = "0637165118" if len(phoneNumber) < 10: print len(phoneNumber) speak("Phone number too short. Try again.") print("Error. Too Short") continue elif len(phoneNumber) == 10 and (phoneNumber[:2] != "06" and phoneNumber[:2] != "07"): speak( "French mobile numbers begin with either 06 or 07. Try again." ) print("Error. Not French.") print(phoneNumber[:2]) continue elif len(phoneNumber) == 13 and (phoneNumber[:5] != "00336" and phoneNumber[:5] != "00337"): speak( "French mobile numbers begin with either 00336 or 00367. Try again." ) print("Error. Not French.") print(phoneNumber[:5]) continue elif len(phoneNumber) == 12: print len(phoneNumber) speak( "Phone number too long. Phone numbers starting with 06 or 07 should only be 10 digits. Try again." ) print("Error. Too Short") continue elif len(phoneNumber) > 13: print len(phoneNumber) speak("Phone number too long. Try again.") print("Error. Too Short") continue else: speak("Sending to " + phoneNumber) break #message = raw_input("Enter Message::\n") speak("Enter your message") print("Enter message.\n") message = enterMessage() #SEND SMS print("Sending text..") speak("Sending text") modem.send_sms(phoneNumber, message) # time.sleep(1) # response = m590.ser.readlines(None) # print (response) # if response == "": # speak("Error!") # print (response) # elif response[0] == "\n": # speak("Sent!") # print ("Sent!") # else: # speak("error") # print (response) allOn() allOff() modem.deinit()