def get_module_info(): print "\n***detailed module info***" t.add(u"\n\n***detailed module info***") module_id = 270526858 #module_id = 270526860 positioning.select_module(module_id) print "module_info(270526858):", positioning.module_info(module_id) t.add( unicode( "\n\nmodule_info(270526858): " + str(positioning.module_info(module_id)) ) )
def get_module_info(): print "\n***detailed module info***" t.add(u"\n\n***detailed module info***") module_id = 270526858 #module_id = 270526860 positioning.select_module(module_id) print "module_info(270526858):", positioning.module_info(module_id) t.add( unicode("\n\nmodule_info(270526858): " + str(positioning.module_info(module_id))))
def open(self, id=None): self.id = id if id == None: id = positioning.default_module() self.id = id self.info = positioning.module_info(self.id) self.name = PositioningProvider.name + " using " + self.info["name"] # HACK ALERT: undocumented, but otherwise bluetooth stays open! if e32.pys60_version < '1.4.5': positioning._positioner=positioning._pos_serv.positioner(self.id) else: positioning.select_module(self.id) positioning.set_requestors([{"type":"service", "format":"application", "data":"test_app"}]) positioning.position(course=True, satellites=True, callback=self.__callback, interval=int(self.interval*1.0E6), partial=True) self.ok = True
# SYMBIAN_UID = 0xE1000121 # information about available positioning modules print "***available modules***" print positioning.modules() print "" # id of the default positioning module print "***default module***" print positioning.default_module() print "" # detailed information about the default positioning module print "***detailed module info***" print positioning.module_info(positioning.default_module()) print "" # set requestors. # at least one requestor must be set before requesting the position. # the last requestor must always be service requestor # (whether or not there are other requestors). positioning.set_requestors([{ "type": "service", "format": "application", "data": "test_app" }]) # get the position. # note that the first position()-call may take a long time # (because of gps technology).
def test_module_info(self): module_data = positioning.module_info(270526858) self.failUnlessEqual(module_data, gps_data['module_details'], "Module data not matching")
os.makedirs(log_dir) logfile = os.path.join(log_dir, 'fpp_RawData_CMRI_'+date+'.csv') fout = open(logfile, 'a') media = "e:\\videos\\noti.mid" try: snd = aud.Sound.open(media) #print 'Sound ready!' except: print 'Oops! NOT available: %s!' % media print print 'IMEI:%s\nUserAgent:%s' % (imei, uagent) mod = pos.default_module() # A-GPS as first time fixer pos.select_module(mod) modinfo = pos.module_info(mod) print '%s:%s,QoD:%s' % (modinfo['name'],modinfo['id'],modinfo['status']['data_quality']) try: # set_requestors() must follows select_module() pos.set_requestors([{"type":"service","format":"application","data":"test_app"}]) gpsdict = pos.position(satellites=True) except: print 'Oops! GPS failed!' pos.stop_position() sys.exit(1) mod -= 2 pos.select_module(mod) # Built-in GPS modinfo = pos.module_info(mod) pos.set_requestors([{"type":"service","format":"application","data":"test_app"}])
def module_gui_name(self): return positioning.module_info(self.module_id)["name"]
import positioning import time import httplib, urllib print "Init Program" print "" print "Default Module:" print positioning.default_module() print "" positioning.select_module(positioning.default_module()) print "Detailed Module Info:" print "" print positioning.module_info(positioning.default_module()) print "GPS Data:" print "" positioning.set_requestors([{"type":"service","format":"application","data":"test_app"}]) while 1: data = positioning.position(course=1,satellites=1) la,lo = data['position']['latitude'],data['position']['longitude'] gps_coords = urllib.urlencode({'device': 'N6730C', 'lat':str(la),'lng':str(lo)}) headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"} conn = httplib.HTTPConnection("mobile-real-map.appspot.com:80") conn.request("POST", "/up", gps_coords, headers) response = conn.getresponse() data = response.read() conn.close() print "here is %s \n"%str(la) time.sleep(30)
os.makedirs(log_dir) logfile = os.path.join(log_dir, 'fpp_RawData_CMRI_' + date + '.csv') fout = open(logfile, 'a') media = "e:\\videos\\noti.mid" try: snd = aud.Sound.open(media) #print 'Sound ready!' except: print 'Oops! NOT available: %s!' % media print print 'IMEI:%s\nUserAgent:%s' % (imei, uagent) mod = pos.default_module() # A-GPS as first time fixer pos.select_module(mod) modinfo = pos.module_info(mod) print '%s:%s,QoD:%s' % (modinfo['name'], modinfo['id'], modinfo['status']['data_quality']) try: # set_requestors() must follows select_module() pos.set_requestors([{ "type": "service", "format": "application", "data": "test_app" }]) gpsdict = pos.position(satellites=True) except: print 'Oops! GPS failed!' pos.stop_position() sys.exit(1)