www.youthsprouts.blogspot.com
Mobile location information
mcc = Mobile Country Code
mnc = Mobile Network Code
lac = Location Area Code
cellid = Cell Id
mcc and mnc is the same wherever you are.
Normally, you would collect some data of your location
and match it with lac/cellid. Then later you can guess
your location from current lac/cellid.
CODE :
import location
mcc, mnc, lac, cellid = location.gsm_location()
# lac, cellid can be used to guess your location
SEND SMS FROM NOKIA Series 60
import messaging
messaging.sms_send(number, text)
Sending file via bluetooth
Python for series 60 enables many fun bluetooth stuff.
from socket import *
a = '00:10:60:ab:25:6f'
bt_obex_discover(a) # found at port 3
f = u'C:\\Nokia\\Startermonlog.txt'
bt_obex_send_file(a, 3, f)
__
EXCLUSIVE SEARCH FROM +++++GOOGLE++++
GOOD LINKS TO REFFER
RELATED POSTS
YOUTHSPROUTS

Today and Tomorrow is Ours
find more topics here
Thursday, April 17, 2008
Mobile location information
PyS60: Bluetooth GPS polling class
www.youthsprouts.blogspot.com
Threaded approach for reading NMEA data from a bluetooth GPS
import thread, socket
class BTGPSPoller(object):
def __init__(self, address):
address, services = socket.bt_discover(address)
self.target = (address, services.values()[0])
self.active = True
self.connected = False
self.lock = thread.allocate_lock()
self.sentances = list()
def connect(self):
if not self.connected:
thread.start_new_thread(self.run, ())
def run(self):
print "BTGPSPoller thread activated"
try:
conn = socket.socket(socket.AF_BT, socket.SOCK_STREAM)
conn.connect(self.target)
self.connected = True
except:
print "Unable to connect"
if self.connected:
try:
to_gps = conn.makefile("r", 0)
except:
print "Failure calling conn.makefile()"
while self.active:
#e32.ao_sleep(1)
msg = None
try:
msg = to_gps.readline()
if not msg == None and msg.startswith("$GPGGA"):
gps_data = msg.split(",")
if not gps_data[2] == "":
self.lock.acquire()
self.sentances.append(msg)
if len(self.sentances) > 10:
self.sentances.pop(0)
self.lock.release()
except:
self.active = False
try:
to_gps.close()
conn.close()
self.connected = False
print "Closed and disconnected"
except:
self.connected = False
print "Unable to close"
def disconnect(self):
self.active = False
print "Disconnecting from GPS"
def getSentances(self):
self.lock.acquire()
l = self.sentances[:]
self.lock.release()
return l
__
Labels: codes, computers, gps, internet, networking, phones, Technology, wireless, world