def __init__(self): self.a = sl4a.sl4a() self.f = None self.conf = ConfigParser.ConfigParser() self.conf.read(self.CONFILE) self.stop = False self.sound = True self.repeat = False
# Create: 2012-07-27 20:55 import sl4a import os, sys from datetime import datetime # feel free to change encoding for your locale encoding = 'gb18030' # number to contact map contacts = {} # name to fp map sms_fp = {} a = sl4a.sl4a() def getContact(number, smsid=0): global a, contacts if contacts.has_key(number): return contacts[number] try: r = a.queryContent('content://contacts/phones/filter/' + number) contacts[number] = r[0] return r[0] except: return {'name': 'sms_%d' % smsid, 'number': number} def getSmsFp(contact):
def __init__(self): self.a = sl4a.sl4a()
# DroidFacade.py # misc droid function wrapper # # Author: Alex.wang # Create: 2012-11-13 01:49 # # Update: 2013-05-19 04:11 import warnings from base64 import b64encode, b64decode from sl4a import sl4a, sl4aError from DroidConstants import SENSOR_ALL, BLUETOOTH_UUID, INBOX, CATEGORY_DEFAULT _a = sl4a() class Event: '''Wrapper functions for EventFacade (http://www.mithril.com.au/android/doc/EventFacade.html)''' def __init__(self, droid, **handler): assert isinstance(droid, sl4a) self.droid = droid self._handler = {} self._loop = True for e, h in handler.iteritems(): self.reg(e, h) def clear(self): '''Clears all events from the event buffer''' self.droid.eventClearBuffer()
import sl4a import os, sys from datetime import datetime # feel free to change encoding for your locale encoding = 'gb18030' # number to contact map contacts = {} # name to fp map sms_fp = {} a = sl4a.sl4a() def getContact(number, smsid = 0): global a, contacts if contacts.has_key(number): return contacts[number] try: r = a.queryContent('content://contacts/phones/filter/' + number) contacts[number] = r[0] return r[0] except: return {'name': 'sms_%d' % smsid, 'number': number} def getSmsFp(contact):