在武大快做一个月了,为了生存。“生存”,这次描述的是它的本义。
import MOD
import MDM
import SER
from SMS import *
from GPIOFunc import *
from Phone import *
from Config import *
#OK
def MainLoop():
SER.send(‘Starting program…n’)
InitGPIO()
InitSMS()
InitPhoneNumber()
while 1:
SER.send(‘loop…’)
keypressed = QueryPhoneButtonPressed()
# Make Call
if(keypressed == KEY_CALL_1):
MakePhoneCall(1)
elif(keypressed == KEY_CALL_2):
MakePhoneCall(2)
elif(keypressed == KEY_CALL_3):
MakePhoneCall(3)
elif(keypressed == KEY_CALL_ALARM): # Maybe we need to treat this specially. BUT later 😉
MakePhoneCall(4)
# How to determine that ‘ A CALL COMES! ‘ ???????????
# Code to detect coming call goes here….
# TE Can notify the user there is a call in HARDWARE Way. So, not my concern!
SER.send(‘Test if there is a coming calln’)
if(QueryPhoneCall() == CALL_ON):
SER.send(‘Got a call!n’)
# Answer Call
if(keypressed == KEY_CALL_ANSWER):
SER.send(‘Answer call Key pressed’)
AnswerPhoneCall()
elif(keypressed == KEY_CALL_END):
SER.send(‘User Refused answering the calln’)
EndPhoneCall()
SER.send(‘Trying to Config Devicen’)
if(QuerySMS()==SMS_NEW):
CofigureDevice()
SER.send(‘..endn’)
MOD.sleep(1)
return
武大的事情有一些眉目了,挺舒服的。
日子过的有些混乱,但我正在逐渐将混乱条理,有成效了,很好。