×
Namespaces

Variants
Actions
(Difference between revisions)

Archived:Alarm at specified cell id using PySymbian

From Nokia Developer Wiki
Jump to: navigation, search
vvsnaresh (Talk | contribs)
(wiki link added)
croozeus (Talk | contribs)
Line 1: Line 1:
 
[[Category:Python]][[Category:Code Examples]][[Category:Location Based Services]]
 
[[Category:Python]][[Category:Code Examples]][[Category:Location Based Services]]
'''Problem Faced'''
+
==Overview==
  
You are travelling in train and you know the "destination's cell id", but you want to sleep for while. Just enter the cell id of the destination and you will be woke up by the alarm.
+
Sometimes, it happens that you are traveling in a train and know the "destination's cell id", but want to sleep for while. Just enter the cell id of the destination and you will be woken up by the alarm.
  
----
+
==Proposed Solution==
 
+
'''Solution by Shubhendra Singh'''
+
 
   
 
   
 
Just use this code, it will trigger alarm as soon as cell id of the location matches with the cell id you input,
 
Just use this code, it will trigger alarm as soon as cell id of the location matches with the cell id you input,

Revision as of 11:38, 2 February 2009

Overview

Sometimes, it happens that you are traveling in a train and know the "destination's cell id", but want to sleep for while. Just enter the cell id of the destination and you will be woken up by the alarm.

Proposed Solution

Just use this code, it will trigger alarm as soon as cell id of the location matches with the cell id you input,

import appuifw,e32,location
from graphics import *
from audio import *
abc=0
f = 'Z:\\Nokia\\Sounds\\Digital\\Alarm.mid' # Could be changed, this is what you will hear
data=appuifw.query(u"enter the cell id","number")
 
while abc == 0:
xyz=location.gsm_location()
if(xyz[3] == data):
abc=1
s = Sound.open(f)
s.play(KMdaRepeatForever) # Alarm will play until Network is available.
 
 
def quit():
s.stop()
app_lock.signal()
appuifw.app.set_exit()
 
def handle_redraw(rect):
canvas.blit(img)
 
 
canvas=appuifw.Canvas(event_callback=None, redraw_callback=handle_redraw)
appuifw.app.body=canvas
appuifw.app.title = u"location Mode"
appuifw.app.exit_key_handler = quit # Press "Quit" to quit application.
app_lock = e32.Ao_lock()
app_lock.wait()

Related Wiki Links

How to get info on cell location

84 page views in the last 30 days.