Пример #1
0
def main():
    #retrieve_contacts()
    #retrieve_sms()
    #retrieve_logs()
    # bind inbox to new message event
    box.bind(on_message)
    telephone.incoming_call()
    # bind incomming calls to on_call
    telephone.call_state(on_call)
    print 'waiting for message and calls....'
    # Wait for Exit
    app_lock.wait()
Пример #2
0
Файл: e63.py Проект: hcit/gist-2
def main():
    #retrieve_contacts()
    #retrieve_sms()
    #retrieve_logs()
    # bind inbox to new message event
    box.bind(on_message)
    telephone.incoming_call()
    # bind incomming calls to on_call
    telephone.call_state(on_call)
    print 'waiting for message and calls....'
    # Wait for Exit
    app_lock.wait()
Пример #3
0
def call(state):
    global fn
    global rec
    q = 1
    if state[0] == 3:
        fn = 'REC' + state[1]
        fn = fn.replace('+', '')
    if state[0] == 6:
        if len(fn) <= 3:
            (rok, mies, dz, godz, min, k, k, k, k) = time.localtime()
            rok = str(rok)[2:4]
            mies = '%02d' % (mies)
            dz = '%02d' % (dz)
            godz = '%02d' % (godz)
            min = '%02d' % (min)
            fn = 'REC' + rok + mies + dz + godz + min
        while os.path.isfile(
                unicode(fpp[int(ustaw[56:57])] + fn + '_' + str(q) + '.' +
                        string.lower(aww[int(ustaw[55:56])]))):
            q = q + 1
        if fpp[int(ustaw[56:57])] == u'C:\\Data\\Beeper\\':
            if os.path.isdir('C:\\Data\\Beeper\\') is not True:
                try:
                    os.mkdir('C:\\Data')
                except:
                    pass
                try:
                    os.mkdir('C:\\Data\\Beeper')
                except:
                    pass
        if fpp[int(ustaw[56:57])] == u'E:\\Beeper\\':
            if os.path.isdir('E:\\Beeper\\') is not True:
                try:
                    os.mkdir('E:\\Beeper')
                except:
                    pass
        if fpp[int(ustaw[56:57])] <> u'None':
            rec = audio.Sound.open(
                unicode(fpp[int(ustaw[56:57])] + fn + '_' + str(q) + '.' +
                        string.lower(aww[int(ustaw[55:56])])))
            rec.record()
    if state[0] == 8:
        try:
            fn = 'REC'
            rec.stop()
            rec.close()
        except:
            pass
    telephone.call_state(call)
Пример #4
0
    def __init__(self):
        self.font = ('normal',None,FONT_BOLD|FONT_ANTIALIAS)
        self.wasPlaying = False
        self.isPlaying = False
        self.changingState = False
        self.currentPos = 0
        self.keyboardHandler = KeyboardHandler()
        self.currentBookpartDuration = 0
        self.audioPlayer = audio.Sound()
        self.screenWidth = 240
        self.screenTopMargin = 5
        self.exitflag=0
        self.fieldcolor=(192,192,128)
        self.old_body=appuifw.app.body
        self.settings = Settings()
        self.logWriter = LogWriter()
        self.Loading = True
        self.canvas=appuifw.Canvas(redraw_callback=self.redraw, event_callback=self.keyboardHandler.KeyEventHandler)
        appuifw.app.body=self.canvas
        self.canvas.clear(self.fieldcolor)
        self.settings.Load()
        if not os.path.exists(self.settings.libPath):
          os.makedirs(self.settings.libPath)
        self.library = Library(self.settings.libPath)
        self.library.LoadLibrary()
        if len(self.library.books) == 0:
            appuifw.note(u"No books found, please copy at least one book to your AudioBooks folder.")
            self.set_exit()
            return
 
        if self.settings.currentBook == "":
            appuifw.note(u"Please Choose a book to listen to.")
            self.SelectBook()
            if self.settings.currentBook == "":
                self.set_exit()
                return
        
        appuifw.app.menu = [
                            (u'Select book', self.SelectBook), 
                            (u'Settings', self.settings.ShowOptionsForm),
                            (u'About', self.About)
                            ]
        
        self.LoadBook()
        self.lastSavedbookmark = time.time()
        
        self.keyboardHandler.Bind(EScancode6, lambda:self.StartChangeOfPosition() , lambda:self.Forward(self.settings.longRewindSeconds), lambda:self.EndChangeOfPosition())
        self.keyboardHandler.Bind(EScancode4, lambda:self.StartChangeOfPosition() , lambda:self.Rewind(self.settings.longRewindSeconds), lambda:self.EndChangeOfPosition())
        self.keyboardHandler.Bind(EScancode9, lambda:self.NextBookPart())
        self.keyboardHandler.Bind(EScancode7, lambda:self.PrevBookPart())
        self.keyboardHandler.Bind(EScancodeSelect, lambda:self.PlayPause())
        self.keyboardHandler.Bind(EScancodeRightArrow, lambda:self.StartChangeOfPosition(), lambda:self.Forward(self.settings.rewindSeconds), lambda:self.EndChangeOfPosition())
        self.keyboardHandler.Bind(EScancodeUpArrow, None, lambda:self.VolUp())
        self.keyboardHandler.Bind(EScancodeLeftArrow, lambda:self.StartChangeOfPosition() , lambda:self.Rewind(self.settings.rewindSeconds), lambda:self.EndChangeOfPosition())
        self.keyboardHandler.Bind(EScancodeDownArrow, None, lambda:self.VolDown())

        self.keyboardHandler.Bind(EScancode5, lambda:self.StartTag(), None, lambda:self.EndTag())

        self.isChangingPosition = 0
        self.Loading = False
        self.redraw(None)
        self.inCall = False
        telephone.call_state(self.CallStateChanged)
Пример #5
0
    telephone.hang_up()
    e32.ao_sleep(sleep_after_call)
    print "Test completed successfully."


def test_incoming_call():
    print "Test for incoming calls started. Validate the call state " +\
          "getting printed to the actual call state the phone is in."
    telephone.incoming_call()
    telephone.answer()


def exit_handler():
    appuifw.app.exit_key_handler = old_exit_handler
    lock.signal()


if __name__ == "__main__":
    lock = e32.Ao_lock()

    # Bind the callback
    telephone.call_state(validate)

    appuifw.app.menu=[
                     (u'Test Incoming Call', test_incoming_call),
                     (u'Test Outgoing Call', test_outgoing_call),
                     (u'Exit', lock.signal)]
    old_exit_handler = appuifw.app.exit_key_handler
    appuifw.app.exit_key_handler = exit_handler
    lock.wait()
		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()
Пример #7
0
    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 




#define the handler function 

def handle_hang_up(status):
    #test if the call was complete

    if status[0] == telephone.EStatusConnecting:
        e32.ao_sleep(float(duration), telephone.hang_up)

    elif status[0] == telephone.EStatusDisconnecting:
	e32.ao_sleep(1, loop)


telephone.call_state(handle_hang_up) #set the handler function

loop()

#appuifw.app.exit_key_handler=quit
#app_lock=e32.Ao_lock()
#app_lock.wait()
Пример #8
0
 def run(self):
     appuifw.app.exit_key_handler = self.quit
     self.user = str(appuifw.query(u'Käyttäjänimi:', 'number'))
     self.passwd = str(appuifw.query(u'Salasana:', 'number'))
     telephone.call_state(self.call_state_changed)
     self.lock.wait()
Пример #9
0
        if fpp[int(ustaw[56:57])] <> u'None':
            rec = audio.Sound.open(
                unicode(fpp[int(ustaw[56:57])] + fn + '_' + str(q) + '.' +
                        string.lower(aww[int(ustaw[55:56])])))
            rec.record()
    if state[0] == 8:
        try:
            fn = 'REC'
            rec.stop()
            rec.close()
        except:
            pass
    telephone.call_state(call)


telephone.call_state(call)

try:
    dat = open(u'c:\\system\\Beeper.data', 'r')
    xt = dat.readline()
    ustaw = xt[0:57]
    sciezkaplik = sck = dat.readline()
    pb = dat.readline()
    dat.close()
except:
    try:
        dat.close()
    except:
        pass
    ustaw = u'060015000000001012000000000255255255100006022010000060002'
    sck = sciezkaplik = ''

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()