Exemple #1
0
def updateDial(currentTimeMs):
    global timeFirstPulse, timeLastPulse, timeLastStart, dialing, currentNumber, lastDigit, hookStatus, calling
    if (currentTimeMs - timeLastStart > 300
            and currentTimeMs - timeLastPulse > 200):
        if (pinDialStart.value() == 1 and dialing == False):
            dialing = True
            lastDigit = -1
            timeLastStart = currentTimeMs
        elif (pinDialStart.value() == 0 and dialing == True
              and lastDigit >= 0):
            dialing = False
            lastDigit = lastDigit + 1
            if (lastDigit >= 10):
                lastDigit = lastDigit - 10
            # check the digit
            digitDurationMs = timeLastPulse - timeFirstPulse
            durationBasedLastDigit = digitByDuration(digitDurationMs)
            # DURATION based digit is much more RELIABLE !  (all interrupts/callback code for not much... :) )
            currentNumber = currentNumber + str(durationBasedLastDigit)
            timeLastStart = currentTimeMs
            print("Dialled DIGIT: " + str(lastDigit))
            if (lastDigit != durationBasedLastDigit):
                print(" !!!! Digit mismatch. From duration: " +
                      str(durationBasedLastDigit) + " / " +
                      str(digitDurationMs) + "ms")

            print("# " + currentNumber)
            ugfx.area(5, 90, 120, 20, ugfx.WHITE)
            ugfx.text(5, 90, currentNumber, ugfx.RED)

    #returns 0=ready, 2=unknown, 3=ringing, 4=call in progress
    # after 3 secs from starting a number, take whatever we have and try dialing
    if ((not calling) and hookStatus and sim800.getstatus() == 0
            and len(currentNumber) > 0
            and currentTimeMs - timeLastStart > 3000):
        calling = True
        ugfx.area(120, 90, 240, 20, ugfx.WHITE)
        ugfx.text(120, 90, "Calling...", ugfx.RED)
        print("Calling... " + str(currentNumber))
        sim800.call(currentNumber)
Exemple #2
0
"""Phone app for baic calling functions
"""
___name___ = "Phone"
___license___ = "MIT"
___dependencies___ = ["app", "dialogs", "sim800", "ugfx_helper"]
___categories___ = ["System"]
___bootstrapped___ = True

from app import *
from dialogs import *
import ugfx
import ugfx_helper
import sim800

ugfx_helper.init()
ugfx.clear()

sim800.poweron()

notocall = prompt_text("Number to call:")

if (notocall):
    sim800.call(notocall)
Exemple #3
0
def makecall():
    notocall = prompt_text("Number to call:")
    if (notocall):
        sim800.call(notocall)
Exemple #4
0
def makecall():
    notocall = prompt_text("Number to call:", numeric=True)
    if (notocall):
        sim800.call(notocall)