Exemplo n.º 1
0
 def test_modules(self):
     result = positioning.modules()
     counter = 0
     for entry in result:
         if entry in result:
             counter += 1
     self.failUnlessEqual(counter, 4, "List of available modules erroneous")
Exemplo n.º 2
0
        def f():
            if self.positioner:
                self.positioner.close()
                self.positioner = None
            try:
                from pytwink import Positioner

                modlist = positioning.modules()
                module_id = None
                for entry in modlist:
                    if entry["name"] == u"Network based" and \
                       entry["available"]:
                        module_id = entry["id"]
                        break
                if not module_id:
                    raise "no network positioning module"

                updatetimeout = 15000000
                maxupdateage =  30000000
                self.positioner = Positioner(module_id, updatetimeout, maxupdateage)
                self.positioner.ask_position(self._positioner_done)
                return
            except:
                self._send_card()

            self.active = True
def set_module():
    modules = positioning.modules()
    positioning.select_module(modules[2]["id"])
    print "Starting position feed again- withspecific module."
    print positioning.position(course=1,
                               satellites=1,
                               callback=cb,
                               interval=1000000,
                               partial=1)
Exemplo n.º 4
0
 def Update(self):
     positioning.select_module(positioning.default_module())
     positioning.set_requestors([{"type":"service", 
                          "format":"application",
                          "data":"GpsLocProvider"}])  
     
     # open log file
     if(self.logmode):
         self.FILE = open(self.logpath, "w+")
         self.FILE.write("LOGFILE START:\r")
         self.FILE.write("GPS Modules detected:\r")
         self.FILE.write(str(positioning.modules()))
         self.FILE.write("Using default: " + str(positioning.default_module()) + "\r")
    
     global keep_scanning
     
     while keep_scanning: 
         # get current location, compare to old current location
         newLoc = self.getCurrentLocation()
         if newLoc['lat'] != newLoc['lat']: # if we got a "NaN" response from positioning, this will abort and try again
         	continue
         # if no(or little) change, don't do anything
         #latDif = math.fabs(newLoc["lat"] - self.current_location["lat"])
         #lngDif = math.fabs(newLoc["lng"] - self.current_location["lng"])
         # if latDif < 0.0001 or lngDif < .001:
         #     print "Haven't moved far enough.  Cancelling update."
         #self.current_location = newLoc
         
         #self.nearbyLock.signal()
         self.addPOIs(self.get_nearby_locations(self.current_location["lat"], self.current_location["lng"]))
            
         self.actives = self.get_active_list()
         if len(self.actives) != 0:
             self.newActives = 1
         else:
         	self.newActives = 0
             	
    #     for poi in actives:
     #        self.GUI.location_cache.appendLocation(poi)       
      #       self.GUI.notifyOfNewLocation(poi["name"])
             
       #  print "Update in :" + str(time.clock() - initialTime) + " ms."       
                        
         if self.logmode:                 
         	self.FILE.flush()
         e32.ao_yield()
         e32.ao_sleep(5)
     
     if self.logmode:
     	self.FILE.write("Total GPS scans performed: " + str(self.total_scans) + "\r")
     	self.FILE.write("Avg time per scan: " + str(self.total_scan_time / self.total_scans) + "\r")
     	self.FILE.close()
     print "Update thread done."
Exemplo n.º 5
0
 def choose_module(self):
     """
     You may use this method to select another positioning module
     to use. The ID of the selected module is returned, or None if
     no selection was made. Use "use_module" to try and take the
     selected module into use.
     """
     mlist = [ m for m in positioning.modules() if m["available"] ]
     names = [ unicode(m["name"]) for m in mlist ]
     index = appuifw.popup_menu(names, u'Select technology')
     if index is None:
         return None
     tech = mlist[index]
     module_id = tech["id"]
     return module_id
Exemplo n.º 6
0
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import positioning

# 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
Exemplo n.º 7
0
 def modules():
   return positioning.modules()
Exemplo n.º 8
0
import e32
import positioning

modlist = positioning.modules()
print(repr(modlist))

module_id = None
for entry in modlist:
    if entry["name"] == u"Network based" and \
       entry["available"]:
        module_id = entry["id"]
        break

if not module_id:
    print "no suitable module"
else:
    from pytwink import Positioner

    updatetimeout = 15000000
    maxupdateage =  30000000
    positioner = Positioner(module_id, updatetimeout, maxupdateage)

    myLock = e32.Ao_lock()

    def cb(errCode):
        print repr(errCode)
        if not errCode:
            print repr(positioner.get_position())
        myLock.signal()

    try:
Exemplo n.º 9
0
def get_modules():
    print "\n\n***available modules***"
    t.add(u"\n\n***available modules***")
    modules = positioning.modules()
    print 'modules:', modules
    t.add(unicode("\n\nmodules: " + str(modules)))
Exemplo n.º 10
0
def get_modules():
    print "\n\n***available modules***"
    t.add(u"\n\n***available modules***")
    modules = positioning.modules()
    print 'modules:', modules
    t.add( unicode( "\n\nmodules: " + str(modules) ) )