You Are Here:

Community: Developer Discussion Boards

#1 Old e32dbm and GPS - 2008-12-13, 01:02

Join Date: Nov 2008
Posts: 139
widetech1
Offline
Regular Contributor
hi,

help,

I have a problem, I have an application that uses a two-class that reads data from GPS and another that creates a database using the module e32dbm, the idea is to read GPS data and store them in the database, when I run the application in Emulator works fine, but when I run into the N95 does not create a database on the specified drive
Code:
import positioning
import socket
import appuifw
import time
import e32
import thread
import sysinfo

class LocationEngine:

  def __init__(self):

    self._tracking = True
    self.r = None
    self.year = None
    self.month = None
    self.date = None
    self.hour = None
    self.imei = sysinfo.imei()
    self.service = True
    self.conn = True
    self.app_lock = e32.Ao_lock()
    self.lock = thread.allocate_lock()
    self.db = StorageData()

  def startTracking(self):
    positioning.set_requestors([{"type":"service", "format":"application","data":"WifeTracker"}])
    positioning.position(course=1,satellites=1, callback = self.locationCallback)

  def pruebaThread(self):
    self.startTracking()

  def DateandTime(self):

    self.year = str(time.localtime()[0])[2:4]
    self.month = time.localtime()[1]
    self.date = time.localtime()[2]
    self.hour = time.localtime()[3]
    m = str(time.localtime()[4])
    if(len(m) == 1):
       minutes = "0"+m
    else:
       minutes = m
    s = str(time.localtime()[5])
    if(len(s) == 1):
      self.seconds = "0"+s
    else:
      self.seconds = s
    dates = self.year+str(self.month)+str(self.date)+str(self.hour)+str(minutes)+str(self.seconds)
    return dates

  def locationCallback(self,event):

    lock = thread.allocate_lock()
    lock.acquire()
    e32.ao_sleep(1)
    position = event['position']
    course = event['course']
    satellites=event['satellites']
    posTuple = (position['latitude'], position['longitude'],position['altitude'])
    velocidad = course['speed']
    rumbo = course['heading']
    date = satellites['time']
    la,lo,al = posTuple
    lat = '>R4'+','+self.DateandTime()+','+str("%.5f"%la)+','+str("%.5f"%lo)+','+str("%.5f"%velocidad)+','+str("%.5f"%rumbo)+','+self.imei+'<'
    lock.release()
    e32.ao_sleep(5)
    y = lat.encode('UTF-8')
####Here stores data in the database 
    self.db.write_db(y)
    #print lat
    #self.db.write_db(y)

import e32dbm

DB_FILE=u"c:\\mydatabase.db"

class StorageData:

  def write_db(self,a):
    d = e32dbm.open(DB_FILE,"cf")
    d[u"datas"] = a

loc = LocationEngine()
loc.pruebaThread()
thanks
Reply With Quote

#2 Old Re: e32dbm and GPS - 2008-12-14, 15:37

Join Date: Jan 2004
Posts: 369
Location: Helsinki
Send a message via Skype™ to miohtama
miohtama's Avatar
miohtama
Offline
Regular Contributor
Quote:
Originally Posted by widetech1 View Post
hi,

help,

I have a problem, I have an application that uses a two-class that reads data from GPS and another that creates a database using the module e32dbm, the idea is to read GPS data and store them in the database, when I run the application in Emulator works fine, but when I run into the N95 does not create a database on the specified drive
Certain directories on Symbian are protected and private.


Mikko Ohtamaa
Twinapex Research
http://www.twinapex.com
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
[anounce] Tracker.py GPS mapping application hurenkam Python 85 2009-05-13 11:38

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia