# GLOBALS -------------------------------------------------------------------- SparqEE.glob_debug = 5 #Override global debug print level def debug(str): SparqEE.debug_print( str, SparqEE.debug["DEBUG"] ) def debug2(cmd, ret): debug(cmd) debug( "---> CMD RET --->: " + str(ret) ) debug( "---> BUFFER --->" + SparqEE.buffer ) #----------------------------------------------------------------------------- try: SparqEE.cmd_setup() #set-up shield GPIO SparqEE.cmd_power() #power on SparqEE.cmd_connection() #check cellular connection # +12223334444 #BASIC SMS ret = SparqEE.at_sms("+"+num, sms) debug2 ("STATUS", ret) #----------------------------------------------------------------------------- SparqEE.debug_print( "***END***", SparqEE.debug["WARNING"] ) SparqEE.cmd_cleanup() #clean-up shield GPIO except: SparqEE.debug_print( "***END (exception)***", SparqEE.debug["CRITICAL"] ) SparqEE.cmd_cleanup() #clean-up shield GPIO
# GLOBALS -------------------------------------------------------------------- SparqEE.glob_debug = 5 #Override global debug print level def debug(str): SparqEE.debug_print( str, SparqEE.debug["DEBUG"] ) def debug2(cmd, ret): debug(cmd) debug( "---> CMD RET --->: " + str(ret) ) debug( "---> BUFFER --->" + SparqEE.buffer ) #----------------------------------------------------------------------------- try: SparqEE.cmd_setup() SparqEE.cmd_connection() #check cellular connection debugFile=open("/home/pi/RaspPrel/log/smsLog","a+") # SparqEE.at_cmgsMem() sms=SparqEE.at_readAllSms() # test=sms.split("+CMGL") # print("Printing sms:"+sms) retour=sms.split('+CMGL') # retour= [ v for v in retour if not v.startswith("at")] # print("retour="+retour[0]+ "taille=" + str(len(retour))) cmp=1 ret=-1 #gotNum=False #gotMsg=False print("Taille retour="+str(len(retour)))