- Added headers to all the source files
- Create a skeleton for the report
- Create a list of evaluations we want to do
- Natasha will do evaluation GPS range while driving
- Anand will do evaluation of GPS range for walking
- Natasha will test BT scanning for different amount of bluetooth locations
- Evaluation of battery life
- with program running and with no reception
- with program running and no reception
- with no running program and reception
- with no running program and no reception
Wednesday, June 4, 2008
Meeting minutes
Monday, June 2, 2008
Saturday, May 31, 2008
Wednesday, May 21, 2008
Monday, May 19, 2008
File Directory
We have a place to put all the source files now.
http://csgsc.cs.ucla.edu/~loCal/LoCal/
Sunday, May 18, 2008
Updates
Db Interface:
- Updated that getLocations(int uid,char type) and getAllLocations(uid) will be returning LocationList object now
Output: LocationList
- Not sure how to handle updates?
- is there a way to do an exception handling?
- can we have getters and setters for location objects?
- how to access getType for subloc?
- Written methods:
+LocationList getLocations(uid,type)
+LocationList getAllLocations(uid)
+Location getLocation(lid,uid)
+- addLocation
+- addEvent
+- getEvent
some notes
Some things I learned:
- Python e32db auto incremented value starts with 0
- e23db doesn't support joins
- python doesn't support switch statement but it does have lambda like in scheme
Wednesday, May 14, 2008
supported sql on the phone (e32db)
# 'SELECT' is the most popular SQL
SELECT select-list FROM table-name [ WHERE search-condition ] [ ORDER BY sort-order ]
# 3 search condition types: compare, like, null
# DML : INSERT, DELETE, UPDATE
INSERT INTO table-name [ ( column-identifier,… ) ] VALUES ( column-value,… )
DELETE FROM table-name [ WHERE search-condition ]
UPDATE table-name SET update-column,… [ WHERE search-condition ]
# DDL : Work with the schema
CREATE TABLE table-name (column-definition,…)
DROP TABLE table-name
ALTER TABLE table-name { ADD add-column-set [ DROP drop-column-set ] | DROP drop-column-set }
CREATE [ UNIQUE ] INDEX index-name ON table-name ( sort-specification,… )
DROP INDEX index-name FROM table-name
Plus a few column types (not all of them)
['BIT', 'INTEGER', 'COUNTER', 'BIGINT', 'FLOAT',
'TIMESTAMP', 'VARCHAR(n)', 'LONG VARCHAR']
# COUNTER is an auto-incremented unsigned integer
Tuesday, May 13, 2008
LoCal Tests and UI Coding
Today I hard coded a WiFi location and several GPS locations using the Location objects I created. As I walked to Ackerman for dinner, different locations were in range. So that test is confirm at least for WiFi and GPS. The GPS is a lot more accurate than I thought!
I also started messing around with UI coding. I created to Form objects that can handle adding of Locations. There are probably a few other ways we can handle this to, so this remains to be discussed. Code is too long to post here. Will post later.
Time for home.
Beginning to Code
I started to code as well. I've been writing a LoCalTools.py file and a LoCalObjects.py file.
The first file contains random functions that could be useful for us. For example, so far there is a function to check for the existence of an AP, a function to returns all APs in the area, and a function calculating the meter distance between two GPS coords.
The second file contains all the LoCal objects for the phone. Everything inherits from a LoCalObject class. This class just has an id. I'm thinking we could also have each of these objects inherit from LoCalXMLObject as well. Python supports multiple inheritance. The base XML class can provide base toXML() and fromXML() methods and base XML tag attributes (i.e. tagname, attributes). If set up properly, we should only have to write one toXML function and have sub classes set a few attributes to handle their own type. For example:
class BaseXML:
def __init__ (self):
self.tagname = 'NoName'
self.attr = []
self.children = []
def toXML (self):
val = '<'+self.tagName+' '
for i in self.attr:
val = val + i['name'] + '=\'' +\
str(i['val']) + '\' '
val = val + '>'
for c in self.children:
val = val + c.toXML()
val = val + ''
return val
class MyTag (BaseXML):
def __init__ (self):
self.tagname = 'MyTag'
self.attr.append({'name':'counter','val':0})
The above code is just an example. There are probably some typos. When we find a nice central location to put files, I'll link it. Goodnight.
Monday, May 12, 2008
Meeting minutes:
- Came up with the structure of db interface
- Came up with skeleton for all the objects
Notes:
- make sure we append E:/python to the path in our projects
import sys
__exec_path = "E:\\Python\\"
sys.path.append(__exec_path)
- on login get all the data from the server and reload it on the phone's db.
- on logout,dont clean up
- user pref will be a dictionary
Pitfalls:
- user has to login (need authentication)
- if the phone's battery will die, the program will not work
- if the connection will die during logout, the user will use the data.
Workout:
for logout: create a new table for the Queue that stores all the ids that were not send to the server.
Phone db
ok. so i figured out how to create database and run queries using the phone db.
There are 3 files.
db.py -- class object for querying db.
db_schema.py - file that needs to be run once for creating the db. The db has to be stored in root directory (E:/Python)
db_testing.py - examples on how to run queries
This is a db_testing.py:
# Change __exec_path to the path of your python script dir
__exec_path = "E:\\Python\\"
dbname = "loCal_db"
import sys
sys.path.append(__exec_path)
from db import db
# Opens E:\\Python\loCal_db.db
mydb = db(__exec_path+dbname+'.db')
########insert statement
mydb.query("insert into location_list values (15,1,'note here','w',0)")
######different select statement
row = mydb.select_row('SELECT * FROM location_list')
print "select one row",str(row)
rows= mydb.select_all('SELECT * FROM location_list')
print "all rows:"
for r in rows:
print str(r)
print ""
print ""
rows = mydb.select_all('select * from location_list where uid=2')
print "all rows for second user"
for r in rows:
print str(r)
print ""
print ""
rows = mydb.select_col('select name from location_list')
print "all names"
for r in rows:
print str(r)
print ""
print ""
GPS Distance
Just found and tested a GPS distance calculator. It returns the distance in meters. The arguments are two dictionaries that each contain a 'lat' key with value decimal degree and a 'long' key with value decimal degree. The code:
import math
RADIUS = 6378700 #radius of earth in meters
#test gps values (don't need these)
#the distance between them should be just under 1600m
gps1 = {'lat':34.150350, 'long':-118.427360}
gps2 = {'lat':34.150367, 'long':-118.410729}
def gpsDistance (gpsA, gpsB):
"""
Computes the distance between two lat/long points.
The formula uses radians, so degrees must be
converted to radians first. RADIUS is the
radius of the surface of the earth in the units
we want.
FORMULA:
r * arccos[sin(lat1/57.2958) * sin(lat2/57.2958) +
cos(lat1/57.2958) * cos(lat2/57.2958) * cos(lon2/57.2958 -lon1/57.2958)]
"""
radianScale = math.pi / 180.0
lat1rad = gpsA['lat']*radianScale
lat2rad = gpsB['lat']*radianScale
lon1rad = gpsA['long']*radianScale
lon2rad = gpsB['long']*radianScale
part1 = math.sin(lat1rad) * math.sin(lat2rad)
part2 = math.cos(lat1rad) * math.cos(lat2rad) *\
math.cos(lon2rad-lon1rad)
return RADIUS * math.acos(part1 + part2)
Friday, May 9, 2008
PyS60 XML Parsing
Obviously, a big part of the project will involve parsing XML in Python. This can easily be done in 'normal' Python but Mobile Python does not come with any XML parsing packages. The only one I've found so far is cElementTree.
Downloaded here: http://ssalmine.googlepages.com/somepys60extensions
The desktop version here: http://effbot.org/zone/celementtree.htm
Anything else out there?
UPDATE: pexpat (or something like that) was recommended. Haven't tried it yet.
Wednesday, May 7, 2008
Some useful links
A collection of extension modules for S60:
http://wiki.opensource.nokia.com/projects/PyS60_extensions
http://cyke64.googlepages.com/
To get a .sis file signed
https://www.symbiansigned.com/app/page/public/openSignedOnline.do
How to use SQL on S60
http://wiki.forum.nokia.com/index.php/How_to_use_SQL
Code examples for S60
http://wiki.forum.nokia.com/index.php/Category:Python#Code_Examples_for_Python
Tuesday, May 6, 2008
WLanTools
Anand and I just tried wlantools to check for a certain AP's MAC address. We had the program loop every 10 seconds and check all the MAC addresses it found. We set it to the Grad Lab's AP's MAC address and walked around the 3rd floor. It worked. The code we used:
import wlantools, e32
while 1:
b=0
a=wlantools.scan(False)
for i in a:
if i['BSSID']==u'00:1C:57:89:BB:20':
b=1
if b==1:
print "Inside"
else:
print "Outside"
e32.ao_sleep(10)
Monday, May 5, 2008
While talking with Kostas:
XML:
- LoCal node will always have a userid attribute except for the first request from client to server. First request will have login information and server will respond with userid.
- Add/update/delete nodes in the request from a client will be wrapped in sync node. If sync node is empty then server will only sync. If sync is not empty, child actions will be handled first.
- For handling lost connection we'll need to have try catch blocks.
- We need to sit down and write out all possible communications between client/server before starting to code
- We can start coding by creating classes for handling xml parsing and db queries.
XML parsers for php:
http://us3.php.net/xml
http://www.criticaldevelopment.net/xml/doc.php
UPDATE (5:21pm): [by Kostas] also all item lists need to be wrapped in <itemlist>
Sunday, May 4, 2008
Wifi module
- Goto http://www-rp.lip6.fr/~berger/pys60_exts/ and click the last link : wlantools-PyS60_1_4_1_3rdEdFP1-unsigned.sis
- Get the file signed and install it on your phone.
- Use import wlantools to import the module and wlantools.scan() to get a dictionary of information about the wlan you are using. The BSSID element gives us the unique identifier that we need for the WLAN.
How to sign and use unsigned .sis files
For security reasons, Nokia decided that modules in S60 cannot directly be used on multiple phones . Instead for each phone the module needs to be signed with the phone's IMEI. Here are the steps to get a module signed :
- First go to: https://www.symbiansigned.com/app/page/public/openSignedOnline.do
- Fill up the application information form:
- IMEI no of the phone ( found by typing in *#06# on the phone )
- Your email id
- Upload the unsigned module (will be a .sis file)
- Select all the capabilities, don't bother to find out which ones are the ones required
- Write the code, sign the document and submit the form
- An email will be sent to your email id, asking you to confirm that you want the file signed.
- After you confirm, another email will be sent to you when the file is signed. Download this file.
- Now download this file to the phone
- Go to file manager on the phone, find the file and open it to install it on the phone.
- Install it to the phone's internal memory and ignore the warning.
- And you're done, the module is installed on your phone. You can import and use this module as any other inbuilt module.
More stuff about the design
For logout:
- Store userid on the local db. This way we dont need to delete records during logouts and/or logins.
Saturday, May 3, 2008
Logo Request
So we are thinking a logo something like this (yes yes, unnecessary, but awesome):
- two eyes
- one of the eyes has the pupil or the pupil & iris replaced by a radar blip screen (the circular green/black sweep)
- and behind the eyes is one of those day by day calendars that you rip pages from being flipped through. not with a hand, just on its own
Friday, May 2, 2008
Architecture
This is the first draft of the basic architecture of the LoCal system. On the server side, we have PHP being queried and connecting to an SQL server. On the client side, we have Python scripts and C++ wrapped in Python accessing the Internet, Bluetooth, WiFi, GPS, and the Phone's built in DB. All communication is done through our LoCalXML.
P.S. Why is all the best academic work done in the middle of the night? :)
Thursday, May 1, 2008
XML Schema
LoCal is going to use XML for communication between server and clients (phones). I just wrote the first "official" schema v0.1!! Still needs to be discussed. Can be found at: http://docs.google.com/Doc?id=dcg2bwzv_37tv2nt7fd
UPDATE (5-2-08): New LoCalXML schema posted. v0.2: http://docs.google.com/Doc?id=dcg2bwzv_38f7vbv9hc
Wednesday, April 30, 2008
Meeting minutes
Meeting minutes:
- Came up with the project name: LoCal
- Wrote short description for the project wiki
- Created our awesome blog. Thinking if we need a website or we can use wiki for it.
- Test Verification
- Bluetooth devices can be checked in they are in range based on its mac address even if devices are s not exposed
- If python is running in the background we can play the sound (alert users with a sound)
- To do: Need to figure out how to switch back to python to show the dialog box
- Anand took a nap
- Had a usual conversation about google vs everything else
First Post
Yay!!!!!!!!!!!!!!!! We opened our new blog for our awesome project. I am so exciting even though we are using google. :)
