-
Notifications
You must be signed in to change notification settings - Fork 2
/
missed-call-dabster.py
165 lines (137 loc) · 4.1 KB
/
missed-call-dabster.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#To use this app, just press up arrow key to start your first call making(give the phone number and the number of times)
#To force reset in case it starts giving errors, press down arrow key
#Use the RED colored END key to terminate it in between the miss call process is going on
#Thats it, what else do you expect from a miss call software???(do write to us, may be we'll implement)
import telephone,appuifw,key_codes,e32,globalui,keycapture
def newphonestate (stateInformation):
global msg
newState = stateInformation[0]
if newState == telephone.EStatusUnknown: s_unknown()
elif newState == telephone.EStatusIdle: s_idle()
elif newState == telephone.EStatusDialling:s_dialing()
elif newState == telephone.EStatusRinging: s_ringing(stateInformation[1])
elif newState == telephone.EStatusAnswering: s_answering()
elif newState == telephone.EStatusConnecting: s_connecting()
elif newState == telephone.EStatusConnected: s_connected()
elif newState == telephone.EStatusReconnectPending: s_reconnectPending()
elif newState == telephone.EStatusDisconnecting: s_disconnecting()
elif newState == telephone.EStatusHold: s_hold()
elif newState == telephone.EStatusTransferring: s_transferring()
elif newState == telephone.EStatusTransferAlerting: s_transferAlerting()
print "The phone has changed states."
print " ",msg
# Begin defining call states
def s_unknown():
global msg,state
state="unknown"
telephone.hang_up()
msg = "The new state is unknown"
def s_idle():
global msg,state
state="idle"
call()
msg = "The phone is idle"
def s_dialing():
global msg,state
state="unknown"
msg = "The Phone is dialing"
def s_ringing(in_num):
global msg,state
state="unknown"
telephone.hang_up()
msg = "The new phone is ringing, call is from %s " % in_num
def s_answering():
global msg,state
state="unknown"
telephone.hang_up()
msg = "A call is being answered"
def s_connecting():
global msg,state
state="unknown"
telephone.hang_up()
msg = "A call is connecting"
def s_connected():
global msg,state
state="unknown"
telephone.hang_up()
msg="A call has been connected"
def s_reconnectPending():
global msg,state
state="unknown"
telephone.hang_up()
msg="The channel has been lost and a reconnect is being attempted"
def s_disconnecting():
global msg,state
state="dc"
telephone.hang_up()
msg="A call is being disconnected"
def s_hold():
global msg,state
state="unknown"
telephone.hang_up()
msg="A call is being placed on hold"
def s_transferring():
global msg,state
state="unknown"
telephone.hang_up()
msg = "A call is being transferred"
def s_transferringAlerting():
global msg,state
state="unknown"
telephone.hang_up()
msg = "The phone is alerting the remote phone about a transferred call"
# end of definition of call states
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 quit():
global state
app_lock.signal()
if state!="idle":
telephone.hang_up()
capturer.stop()
def stop(anti_freeze=None):
global n,state
if anti_freeze!=None:
telephone.hang_up()
n=0
def key_capture(key):
global end
globalui.global_note(u"Miss calls termination detected")
end=1
stop(1)
end=0
state="idle"
capturer = keycapture.KeyCapturer(key_capture)
capturer.keys = (key_codes.EKeyNo,)
capturer.start()
i=appuifw.InfoPopup()
telephone.call_state(newphonestate)
canvas=appuifw.Canvas()
appuifw.app.body=canvas
canvas.bind(key_codes.EKeyUpArrow,query)
canvas.bind(key_codes.EKeyDownArrow,stop)
appuifw.app.title=u"Miss Call Dabster by Gagan"
appuifw.app.exit_key_handler=quit
app_lock=e32.Ao_lock()
#telephone.dial(num)
app_lock.wait()