def recharge(): selection = appuifw.selection_list(rechargechoice, search_field=1) if (selection == 0): try: x = appuifw.query(u"Enter coupon amount", "number") y = appuifw.query(u"Enter the recharge serial number", "number") z = encrypt(y) rechargeamt.append(x) rechargeno.append(z) appuifw.note(u"Your recharge coupon stored in encrypted from", "conf") except: appuifw.note(u"Invalid entry", "error") if (selection == 1): if has_items(rechargeamt): b = 0 for i in rechargeamt: a = [u"%d" % (rechargeamt[b])] b = b + 1 selection1 = appuifw.selection_list(a, search_field=1) z = appuifw.query(u"Enter your password to decrypt", 'number') if (z != password): appuifw.note(u"Wrong password") if (z == password): a = '*141#' b = str(rechargeno[selection1]) c = '#' a = a + b + c telephone.dial(a) appuifw.note(u"Recharged successfully with amount %d" % (rechargeamt[selection1])) rechargeamt.remove(rechargeamt[selection1]) rechargeno.remove(rechargeno[selection1])
def do_dial(attributes): print ">> do_dial: " + unicode(attributes["number"]) result = u'cmd=dial&status=' global new_call try: # clear previous call request from pys60 if new_call == 1: telephone.hang_up() new_call = 0; number = unicode(attributes["number"]) number = number.replace(" ", "").replace("-", "") # hide dialer app e32.start_exe(u'ailaunch.exe', u'') # dial number telephone.dial(number) new_call = 1 result += u'0' except: print "** unable to dial number: " + repr(sys.exc_info()) result += u'1' return result
def test_log_calls(self): telephone.dial(self.PHONENUMBER2) e32.ao_sleep(self.SLEEP) telephone.hang_up() result = logs.calls(mode='out') self.assert_((len(result) and result[0]['direction'] == u'Outgoing' and result[0]['description'] == u'Voice call' and result[0]['number'] == self.PHONENUMBER2), "log of outgoing calls not proper")
def Dial(contact=''): contact_name = contact contact = contactName2Number(contact) if contact == '': contact = str(raw_input('Please enter the number: ')) if contact != '': print 'Dialing to '+ str(contact_name + ' <' + contact + '>') telephone.dial(contact.strip()) print '------------------------'
def loop(): global duration M = [u"OFF",u"ON"] index= appuifw.selection_list(choices=M, search_field=1) if index==0: duration = 0 if index==1: duration = 6 telephone.dial(str(number)) #make call
def query(): global num, n, m, end, state if state != "idle": telephone.hang_up() num = appuifw.query(u"Enter Number", "text", u"+91") n = appuifw.query(u"How Many Times?", "number") if num: if n: n = n - 1 m = n telephone.dial(num)
def call(): global n,num,i,m,state if n>0: n=n-1 globalui.global_note(u"Missed Calls Done:"+str(m-n)) telephone.dial(num) else: ch=globalui.global_query(u"Want to Give more missed calls to:\n"+str(num)+u" ?") if ch: n=m+1 call()
def query(): global num,n,m,end,state if state!="idle": telephone.hang_up() num=appuifw.query(u"Enter Number","text",u"+91") n=appuifw.query(u"How Many Times?","number") if num: if n: n=n-1 m=n telephone.dial(num)
def test_outgoing_call(): sleep_during_call = 8 sleep_after_call = 4 print "Making a phone call.." telephone.dial(phone_number) e32.ao_sleep(sleep_during_call) print "Hanging up the call.." telephone.hang_up() e32.ao_sleep(sleep_after_call) print "Test completed successfully."
def call(): global n, num, i, m, state if n > 0: n = n - 1 globalui.global_note(u"Missed Calls Done:" + str(m - n)) telephone.dial(num) else: ch = globalui.global_query(u"Want to Give more missed calls to:\n" + str(num) + u" ?") if ch: n = m + 1 call()
def test_log_data(self): global start_t global end_t start_t = time.mktime(time.gmtime()) telephone.dial(self.PHONENUMBER1) e32.ao_sleep(self.SLEEP) telephone.hang_up() end_t = time.mktime(time.gmtime()) result = logs.log_data(type='call', start_log=0, num_of_logs=1, mode='out') self.failUnlessEqual(result[0]['number'], self.PHONENUMBER1, 'log_data API returns erroneous values')
def check_call(): global call_timer if not config.get("call","enable",0): return if time.time() - call_timer < config.get("call","interval",3600): return call_timer = time.time() for number in config.get("call","numbers").split(): telephone.dial(number) e32.ao_sleep(15) try: telephone.hang_up() except: pass e32.ao_sleep(5)
def fall(): global app_lock, contact_name, contact_number, victim_name,\ victim_address, data, prev audio.say("Dialling %s now" % contact_name) telephone.dial(contact_number) e32.ao_sleep(7) #7 sec delay for someone to answer for i in range(2, -1, -1): audio.say("This is an automated message. A fall has been detected.\ Please assist %s at address %s. \ This message will repeat %d more times" \ % (victim_name, victim_address, i) ) telephone.hang_up() data = ( 40, 40, 40 ) #reset values so as not to trigger again prev = data app_lock.signal() #unlock the main loop
def eval_msg(msg): global app_lock msg = msg.strip() print "eval:", repr(msg) command, param = msg.split(';') param = param.split(',') if command == "0x1C": send_msg(command + ':%s' % "ok") telephone.dial(param[0]) elif command == "0x1D": telephone.hang_up() send_msg(command + ':%s' % "ok") elif command == "1": pass else: send_msg(command + ':%s' % "invalid command")
def loop(): global duration M = [u"Hello",u"Play a song",u"Love you",u"I'm busy .. c ya later",u"I will call you later",u"cheers..",u"how are you",u"fine absolutely",u"have a good day",u"regards",u"i will c you later",u"i'm free ..",u"i'm sleeping",u"hi",u"Shup up"] index= appuifw.selection_list(choices=M, search_field=1) if index==0: duration = 0 elif index==1: duration = 3 elif index==2: duration = 6 elif index==3: duration = 9 elif index==4: duration = 12 elif index==5: duration = 15 elif index==6: duration = 18 elif index==7: duration = 21 elif index==8: duration = 24 elif index==9: duration = 27 elif index==10: duration = 30 elif index==11: duration = 33 elif index==12: duration = 36 elif index==13: duration = 39 elif index==14: duration = 42 telephone.dial(str(number)) #make call
import telephone, e32 telephone.dial('+1412345602') e32.ao_sleep(10) telephone.hang_up()
def handle_call(self): telefone = self.telefones[self.get_current_telefone()] telephone.dial(telefone)
# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # test_telephone.py # import e32 import telephone NUMBER2DIAL = "+3581234567" # Insert number here SLEEP = 7 telephone.dial(NUMBER2DIAL) e32.ao_sleep(SLEEP) telephone.hang_up() e32.ao_sleep(SLEEP) telephone.dial(NUMBER2DIAL) e32.ao_sleep(SLEEP) telephone.hang_up()
import telephone import e32 import appuifw import time number = 8146010177 #Enter the number you want to call duration = appuifw.query(u"Enter the Durations",'number')#Enter the time telephone.dial(str(number)) #make call #define the handler function start_time=0.0 end_time=0.0 def handle_hang_up(status): #test if the call was complete if status[0] == telephone.EStatusConnected: print "\nConnected" end_time=time.clock() print time.clock() diff = end_time-start_time print diff e32.ao_sleep(float(duration), telephone.hang_up) elif status[0] == telephone.EStatusConnecting: print "\nConnecting" start_time=time.clock() print time.clock()
import contacts, appuifw, telephone name = appuifw.query(u'Call to', 'text') db = contacts.open() entries = db.find(name) names = [] for item in entries: names.append(item.title) if names: index = appuifw.selection_list(names, search_field=0) num = entries[index].find('mobile_number') if num: telephone.dial(num[0].value) else: appuifw.note(u'Missing mobile phone number', 'error') else: appuifw.note(u'No matches', 'error')
import e32 import telephone f=open('e:\\QDial.txt','r') number = f.readline().decode('utf-8') telephone.dial(number)
def dialing(): number = u"+1234566" telephone.dial(number) main_menu_setup()
import telephone, e32 telephone.dial("10086") #拨打10086 e32.ao_sleep(5) telephone.hang_up() #挂机 import messaging def cn(x): return x.decode("utf8") messaging.sms_send("10086", "1") #发送1到10086 messaging.sms_send("10086", cn("你好"), encoding="USC2") #发送“你好”到10086 messaging.mms_send("10086", cn("你好!"), attachment="e:\\1.jpg") #发彩信给10086,内容为“你好”,附件路径为“e:\\1.jpg”
def wait(self): while True: data = self.fis.readline() parts = data.split(NUM_END_HEADER) header = int(parts[0]) message = str(parts[1], "utf8") message_parts = message.split(NUM_SEPERATOR) if header != NUM_PARTIAL_MESSAGE and self.__partialMessage: message = self.__partialMessage + message self.__partialMessage = "" if header == NUM_PARTIAL_MESSAGE: self.__partialMessage += message elif header == NUM_HELLO_REQUEST: self.send(NUM_HELLO_REPLY) elif header == NUM_SYSINFO_REQUEST: full = bool(int(message_parts[0])) self.sendSysinfo(full) elif header == NUM_LOCATION_REQUEST: self.sendLocation() elif header == NUM_DIAL: try: telephone.dial(message_parts[0]) except: pass elif header == NUM_HANGUP: try: telephone.hang_up() except: pass elif header == NUM_CONTACTS_REQUEST_HASH_ALL: self.sendContactHash() elif header == NUM_CONTACTS_REQUEST_HASH_SINGLE: self.sendContactHashSingle() elif header == NUM_CONTACTS_REQUEST_COUNT: self.send(NUM_CONTACTS_REPLY_COUNT, len(self.contactDb)) elif header == NUM_CONTACTS_REQUEST_CONTACT: key = int(message_parts[0]) try: contact = self.contactDb[key] self.sendContact(contact) except: self.send(NUM_CONTACTS_REPLY_CONTACT_NOT_FOUND) elif header == NUM_CONTACTS_REQUEST_CONTACTS_ALL: self.sendAllContacts() elif header == NUM_CONTACTS_ADD: contact = self.contactDb.add_contact() contact.commit() self.send(NUM_CONTACTS_ADD_REPLY_ID, contact.id) elif header == NUM_CONTACTS_DELETE: id = int(message) if id in list(self.contactDb.keys()): del self.contactDb[id] elif header == NUM_CONTACTS_CHANGE_ADDFIELD: id = int(message_parts[0]) type = str(message_parts[1]) location = str(message_parts[2]) value = str(message_parts[3]) self.modifyContact("add", id, type, location, value) elif header == NUM_CONTACTS_CHANGE_REMOVEFIELD: id = int(message_parts[0]) type = str(message_parts[1]) location = str(message_parts[2]) value = str(message_parts[3]) self.modifyContact("remove", id, type, location, value) elif header == NUM_CALENDAR_REQUEST_COUNT: self.sendCalendarCount() elif header == NUM_CALENDAR_REQUEST_HASH_ALL: self.sendCalendarHash() # elif (header == NUM_CALENDAR_REQUEST_HASH_SINGLE): # self.sendCalendarHashSingle() elif header == NUM_CALENDAR_REQUEST_ENTRY: key = int(message_parts[0]) try: entry = self.calendarDb[key] self.sendCalendarEntry(entry) except: self.send(NUM_CALENDAR_REPLY_ENTRY_NOT_FOUND) elif header == NUM_CALENDAR_REQUEST_ENTRIES_ALL: self.sendAllCalendarEntries() elif header == NUM_CALENDAR_ENTRY_DELETE: id = int(message) try: del self.calendarDb[id] except RuntimeError: # no such entry pass elif (header == NUM_CALENDAR_ENTRY_CHANGE or header == NUM_CALENDAR_ENTRY_ADD): if header == NUM_CALENDAR_ENTRY_CHANGE: id = int(message_parts[0]) elif header == NUM_CALENDAR_ENTRY_ADD: type = str(message_parts[0]) content = str(message_parts[1]) location = str(message_parts[2]) # start = float(message_parts[3]) if message_parts[3] else 0 if message_parts[3]: start = float(message_parts[3]) else: start = 0.0 # end = float(message_parts[4]) if message_parts[4] else None if message_parts[4]: end = float(message_parts[4]) else: end = None replication = str(message_parts[5]) # alarm = float(message_parts[6]) if message_parts[6] else None if message_parts[6]: alarm = float(message_parts[6]) else: alarm = None priority = int(message_parts[7]) repeat_type = str(message_parts[8]) repeat_days = str(message_parts[9]) repeat_exceptions = str(message_parts[10]) # repeat_start = float(message_parts[11]) if message_parts[11] else 0 if message_parts[11]: repeat_start = float(message_parts[11]) else: repeat_start = 0.0 # repeat_end = float(message_parts[12]) if message_parts[12] else None if message_parts[12]: repeat_end = float(message_parts[12]) else: repeat_end = None # repeat_interval = int(message_parts[13]) if message_parts[13] else 1 if message_parts[13]: repeat_interval = int(message_parts[13]) else: repeat_interval = 1 if header == NUM_CALENDAR_ENTRY_CHANGE: self.modifyCalendarEntry( id, content, location, start, end, replication, alarm, priority, repeat_type, repeat_days, repeat_exceptions, repeat_start, repeat_end, repeat_interval, ) elif header == NUM_CALENDAR_ENTRY_ADD: self.addCalendarEntry( type, content, location, start, end, replication, alarm, priority, repeat_type, repeat_days, repeat_exceptions, repeat_start, repeat_end, repeat_interval, ) elif header == NUM_MESSAGE_REQUEST: lastId = int(message_parts[0]) self.sendAllMessages(lastId) elif header == NUM_MESSAGE_REQUEST_ONE: lastId = int(message_parts[0]) self.sendOneMessage(lastId) elif header == NUM_MESSAGE_REQUEST_UNREAD: self.sendUnreadMessages() elif header == NUM_MESSAGE_REQUEST_LIST: self.sendMessagesList() elif header == NUM_MESSAGE_REQUEST_COUNT: self.sendMessagesCount() elif header == NUM_MESSAGE_SEND_REQUEST: name = str(message_parts[0]) phone = str(message_parts[1]) enc = str(message_parts[2]) msg = str(message_parts[3]).decode("string_escape") self.sendMessage(name, phone, enc, msg) elif header == NUM_SET_READ: id = int(message_parts[0]) state = bool(message_parts[1]) self.setRead(id, state) elif header == NUM_MESSAGE_DELETE: id = int(message_parts[0]) self.messageDelete(id) elif header == NUM_SCREENSHOT: self.sendScreenshot() elif header == NUM_QUIT: self.send(NUM_QUIT) break