Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def saveLastScan():
- date = int(time.time())
- droid.prefPutValue("smsLastScan", date, "datestamp")
- return date
- def getLastScan():
- date = droid.prefGetValue("smsLastScan", "datestamp")
- if (date.result == None):
- date2 = int(time.mktime(datetime.datetime(2000, 1, 1).timetuple()))
- return date2
- else:
- return date.result
- def warehouseStringToDict(b):
- a = b.split(";")
- if len(a) != 5 :
- return None
- if a[0] != "WarehouseData":
- return None
- if (a[1].isdigit() == False):
- return None
- try:
- float(a[3])
- float(a[4])
- except ValueError:
- return None
- asd = {"id" : a[1]}
- asd["name"] = a[2]
- asd["lat"] = a[3]
- asd["lon"] = a[4]
- return asd
- def scanMessages(lastScanInteger):
- sms = droid.smsGetMessages(False)
- for i in sms.result:
- if (int(i["date"]) > lastScanInteger):
- if warehouseStringToDict(i["body"]) != None:
- malls.append(warehouseStringToDict(i["body"]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement