Newer
Older
Import / projects / LGN-IP3870 / t / new / myannapp.py
import socket
import os
import config
import status
import runtime
import time
import utils
import uiconfig, baseui
from setting import setting
from phonedb import phonedb
from vdcisetting import vdci_setting

from basemodel import Stage, EntryStage, SearchStage, ListStage, NotifyStage

from runtime import mmiDebug as MD 
from mmiSoundPath import SP_Context, SP_State, Device
from roxiadebug import *

class MyAnnApp:
	name = 'MyAnnApp'
	
	def __init__(self):
		self.caller = False
		self.with_error = False
		self.myannapp_pid = None
		self.clntSock = None
		self.run_recv_thread = None
		self.edit_show_timer = None
		self.phonebook_show_timer = None
		self.webplay_show_timer = None
		self.mmi_show_timer = None
		self.web_running = False
		self.tel_num = ''
		self.stop_wait_timer = None
		self.check_conn_timer = None
		self.try_connect = 0

	def run_myannapp(self):
		debugLogN("run_myannapp: start")
		try:
			os.unlink(config.myann_socket_path)
		except OSError:
			pass

		self.myannapp_pid = os.fork()
		if self.myannapp_pid == 0:
			try:
				os.execlp('browser-ipc-server','browser-ipc-server')
			except:
				os._exit(1)
		self.clntSock = socket.socket( socket.AF_UNIX, socket.SOCK_STREAM )
		self.clntSock.setblocking( 1 )

		'''
		try_connect = 0
		while try_connect < 20:
			try_connect += 1
			connected = True
			try:
				self.clntSock.connect( config.myann_socket_path )
			except:
				connected = False

			if connected:
				print '** MyAnnApp socket connected! **'
				break
			else: # sock connect error, retry..
				print '** MyAnnApp socket connect failed, retry', try_connect, '**'
				time.sleep(1)

		import evas
		self.run_recv_thread=runtime.evas.input_add(self.clntSock.fileno(),\
				evas.INPUT_READ, self.recv_mesg_thread)

		self.update_browser_info()
		'''
		self.check_conn_timer = utils.Timer(1000, self.check_conn)
		debugLogN("run_myannapp: end")
		return False

	def check_conn(self):
		# LAN+Static case, should send link up to manager.
		self.try_connect += 1
		if self.try_connect > 20:
			debugLogC("MyAnnApp: max trial, connection error")
			return False
			
		try:
			debugLogN("MyAnnApp: try to connect")
			
			connected = True
			try:
				self.clntSock.connect( config.myann_socket_path )
			except:
				connected = False

			if connected:
				debugLogC('** MyAnnApp socket connected! **')
				import evas
				self.run_recv_thread=runtime.evas.input_add(self.clntSock.fileno(),\
						evas.INPUT_READ, self.recv_mesg_thread)

				self.update_browser_info()
				return False
			return True
		except:
			debugLogC("MyAnnApp: exception.")
			return False
		

	def send_mesg(self, event, mesg1='', mesg2='', mesg3='', mesg4='', mesg5='', mesg6='', mesg7='', mesg8='', mesg9='', mesg10=''):

		message = '%d|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|' % (event, mesg1, mesg2, mesg3, mesg4, mesg5, mesg6, mesg7, mesg8, mesg9, mesg10)
		message = '%d|%s' % (len(message), message)

		if config.myann_debug:
			print '#### send:', message

		if self.clntSock != None:
			try:
				self.clntSock.send(message)
			except:
				print 'browser socket exception'
				self.with_error = True


	# msglen | event |data1 | data2 | data3 | data4 | data5 | data6 | data7 | data8 | data9 | data10 |
	def recv_mesg_thread(self, clntSock, type):
		import status
		try:
			mesg = self.clntSock.recv( 1024 )
		except:
			self.with_error = True
			print '[MyAnnApp] recv_mesg_thread_ex error'
			return

		#ex) mesg='11|s|0|0|||||||||'
		if len( mesg ) == 0:	# Disconnected from unix socket
			if self.run_recv_thread != None:
				runtime.evas.input_remove(self.run_recv_thread)
				self.run_recv_thread = None
			self.with_error = True
			return

		if config.myann_debug: print '#### recv:', mesg

		while mesg:	# parse message
			#ex) mesg_len=mesg[:2]
			#ex) mesg_len='11'
			mesg_len = mesg[:mesg.index('|')]	# get size of mesg as string
			#ex) size_len=len('11'), size_len=2
			size_len = len( mesg_len )	# get length of mesg size part
			#ex) mesg_len=11
			mesg_len = int( mesg_len )	# convert mesg size from string to int

			#ex) mesg[3:14], mesg_content='s|0|0||||'
			mesg_content = mesg[mesg.index('|')+1:mesg_len+size_len+1]
			#ex) mesg=mesg[15:], mesg=next packet
			mesg = mesg[mesg_len+size_len+1:]

			self.proc_server_mesg( mesg_content )
				
		return True


	def proc_server_mesg(self,mesg):
		mlist = mesg.split('|')
		_event = mlist[0]
		if len(mlist) > 1:_mesg1 = mlist[1]
		if len(mlist) > 2:_mesg2 = mlist[2]
		if len(mlist) > 3: _mesg3 = mlist[3]
		if len(mlist) > 4: _mesg4 = mlist[4]
		if len(mlist) > 5: _mesg5 = mlist[5]
		if len(mlist) > 6: _mesg6 = mlist[6]
		if len(mlist) > 7: _mesg7 = mlist[7]
		if len(mlist) > 8: _mesg8 = mlist[8]
		if len(mlist) > 9: _mesg9 = mlist[9]
		if len(mlist) > 10: _mesg10 = mlist[10]

		if config.myann_debug: print '[MyAnnApp] ##### _event =', _event

		if config.myann_debug:
			print 'SERVER MSG :',_event
			if len(mlist) > 1: print '_mesg1=', _mesg1
			if len(mlist) > 2: print '_mesg2=', _mesg2
			if len(mlist) > 3: print '_mesg3=', _mesg3
			if len(mlist) > 4: print '_mesg4=', _mesg4
			if len(mlist) > 5: print '_mesg5=', _mesg5
			if len(mlist) > 6: print '_mesg6=', _mesg6
			if len(mlist) > 7: print '_mesg7=', _mesg7
			if len(mlist) > 8: print '_mesg8=', _mesg8
			if len(mlist) > 9: print '_mesg9=', _mesg9
			if len(mlist) > 10: print '_mesg10=', _mesg10

		if runtime.manager.stage.name != 'myann':
			if config.myann_debug: print '[MyAnnApp] ##### not myann stage, but', runtime.manager.stage.name
			if runtime.manager.stage.name == 'callhistory' and int(_event) == config.EVT_MMI_BROWSERSTOP:
				if config.myann_debug: print '[MyAnnApp] ##### receive browserstop on callhistory stage'
				return True
			if not runtime.manager.find_stage('myann'):
				if config.myann_debug: print '[MyAnnApp] ##### not myann stage on backup'
				if int(_event) != config.WEB_VIDEOSTREAM_STOP:
					if config.myann_debug: print '[MyAnnApp] ##### not browser video streaming plug-in stop'							
					return True
		
		if int(_event) == config.EVT_MMI_EDIT:
			print '## browser editor is not handled on mmi'
			return True			

		elif int(_event) == config.EVT_MMI_PHONEBOOK:
			def phonebook_show_cb():
				del(self.phonebook_show_timer)
				self.phonebook_show_timer = None
				active_myann(False)
				return False

			if config.myann_debug:
				print '## browser phonebook search is activated'

			self.send_mesg(config.EVT_APP_PAUSE)
			runtime.SP_context.SP_stereoStopPlayback()

			if phonedb.is_empty():
				def phonebook_empty_cb():
					if config.myann_debug:
						print '## browser phonebook empty is deactivated'
							
					self.send_mesg(config.EVT_APP_RESUME, 1)
					runtime.SP_context.SP_stereoPlayback()
					runtime.manager.back_stage()
					active_myann()
					return False

				runtime.manager.stack_stage(MyAnnNotifyStage(_('Phonebook empty'), uiconfig.baloon_phonebook_icon, phonebook_empty_cb))
			else:			
				runtime.manager.stack_stage(SearchStage(left=_('OK'), right='', myann_flag=True))
			self.phonebook_show_timer = utils.Timer(100, phonebook_show_cb)

		elif int(_event) == config.EVT_MMI_BROWSERSTOP:
			if config.myann_debug:
				print '## browserstop procedure is  complete'

			def mmi_show_cb():
				del(self.mmi_show_timer)
				self.mmi_show_timer = None
				active_myann(False)
				return False
				
			self.mmi_show_timer = utils.Timer(100, mmi_show_cb)	
			runtime.eaHandler.deactivateApplication_browser()			

		elif int(_event) == config.EVT_MMI_MEDIA_PLAY:
			media_filename = _mesg1
			if config.myann_debug:
				print '## browser media play is activated', media_filename

			#if status.video_mode != status.VideoIdle:
			#	if config.myann_debug:
			#		print '## browser media play is canceled by call'
			#	return True

			from eaHandler import EaHandler
			runtime.eaHandler.playMediaFile(EaHandler.BROWSER, media_filename)

		elif int(_event) == config.EVT_MMI_BANKING:
			if config.myann_debug:
				print '## browser banking is activated'

			# dectInuse return
			from mmiSoundPath import SP_Context, SP_State
			from dectHandler import DectCallManager
			baseCallStatus, baseStatus, dectCallStatus, dectStatus = status.getCurrentCallStatus()
			if dectStatus != DectCallManager.IDLE:
				return

			from eaHandler import EaHandler
			runtime.eaHandler.startBANKING(EaHandler.BROWSER)

		elif int(_event) == config.EVT_MMI_COOKIE_UPDATE_REQ:
			if config.myann_debug:
				print '## updating cookie is requested by browser'

			#self.update_browser_cookie(config.WAP_COOKIE_FILE)
			runtime.eaHandler.updateCookiesFromWap(sip=False)

		elif int(_event) == config.EVT_MMI_MESSAGE_CONFIRMED:
			if config.myann_debug:
				print '## message is confirmed by browser'
				
			runtime.vmHandler.playClear()

		# added by yssong(2008.11.05)
		# to show address sync menu
		elif int(_event) == config.EVT_MMI_ADDRESSSYNC:
			if config.myann_debug:
				print '## MyAnn <-- EVT_MMI_ADDRESSSYNC'
			# KA: [20081105] 브라우저 종료 후 sync메뉴로 진입
			def mmi_show_cb():
				del(self.mmi_show_timer)
				self.mmi_show_timer = None
				active_myann(False)
				return False
				
			self.mmi_show_timer = utils.Timer(100, mmi_show_cb)	
			runtime.eaHandler.deactivateApplication_browser()

			from phonebook import AddressStage
			runtime.manager.change_stage(AddressStage)
			runtime.manager.stage.activate(0)
			# KA: [20081105] 브라우저 종료 후 sync메뉴로 진입 ==

		# end of adding(2008.11.05)
				
		elif int(_event) == config.WEB_SET_BG:
			bg_file = _mesg1
			bg_file_name = _mesg1.split('/')[-1]
			if config.myann_debug:
				print '## set_property for bg with', bg_file

			setting.bg_image_file = bg_file.split('/usr/local/lgvp/')[-1]
			#baseui.change_bg(runtime.evas, setting.bg_image_file)
			if runtime.evas.bg_image:
				runtime.evas.bg_image.free()

			bg_file = utils.changefile_gif(bg_file)

			new_bg_file = config.image_background_dir + bg_file_name

			utils.remove_dir(config.image_background_dir)
			utils.file_copy(bg_file, new_bg_file)
			time.sleep(1)	# this is needed for os.access function of next line

			if not os.access(new_bg_file, os.R_OK):
				new_bg_file = config.def_bg

			image = runtime.evas.image(file=new_bg_file)
			utils.image_sized(image, (0,0), (480,272))	#utils.image_center_sized(image, 240, 136, 480, 272)

			runtime.evas.bg_image = image
			runtime.evas.bg_image.hide()
			runtime.evas.bg_image.layer = -80
			
		elif int(_event) == config.WEB_SET_BELL:
			audio_file = _mesg1
			if config.myann_debug:
				print '## set_property for bell with', audio_file
			# KA: [20080527] for test- mmf ring
			setting.mmf_external_ring = ''
			if audio_file.endswith('mmf'):
				setting.mmf_external_ring = audio_file
				os.system('cp \"%s\" /mfs/ram/mmf/ring.mmf'%audio_file)
				audio_file = '/mfs/ram/mmf/ring.mmf'
			# KA: [20080527] for test- mmf ring ==	
			if audio_file.lower().endswith('.amr'):
				utils.player.set_as_ring_cmd(audio_file)
			else:
				setting.external_ring = audio_file

		elif int(_event) == config.WEB_START_CALL:
			dest_number = _mesg1
			if config.myann_debug:
				print '## browser start call', dest_number

			from eaHandler import EaHandler
			if dest_number.startswith('vtel://'):
				if config.myann_debug:
					print '## browser call is videocall'

				dest_number = dest_number[7:]
				#runtime.eaHandler.startVideoCall(EaHandler.BROWSER, dest_number)
				runtime.eaHandler.startWapCall(dest_number, True)

			elif dest_number.startswith('tel://'):
				if config.myann_debug:
					print '## browser call is audiocall'
						
				dest_number = dest_number[6:]
				#runtime.eaHandler.startAudioCall(EaHandler.BROWSER, dest_number)
				runtime.eaHandler.startWapCall(dest_number, False)

			# added by yssong(2008.11.05)
			# In the case of call attemption in Hanglelo service menu,
			# this call should not be stored in call log(requested by KT)
			elif dest_number.startswith('notsavevtel://'):
				if config.myann_debug:
					print '## browser call is videocall(notsaveVtel)'

				dest_number = dest_number[14:]				
				runtime.eaHandler.startWapCall(dest_number, True)

			elif dest_number.startswith('notsavetel://'):
				if config.myann_debug:
					print '## browser call is audiocall(notsaveTel)'
						
				dest_number = dest_number[13:]				
				runtime.eaHandler.startWapCall(dest_number, False)
			# end of adding(2008.11.05)

		elif int(_event) == config.WEB_VIDEOSTREAM_START:
			url = _mesg1
			pos_x = int(_mesg2)
			pos_y = int(_mesg3)
			pos_w = int(_mesg4)
			pos_h = int(_mesg5)
			if config.myann_debug:
				print '## browser video streaming plug-in start'
				print '## url=', url, ', x=', pos_x, ', y=', pos_y, ', w=', pos_w, ', h=', pos_h

			baseCallStatus, baseStatus, dectCallStatus, dectStatus = status.getCurrentCallStatus()
			from dectHandler import DectCallManager
			if dectStatus != DectCallManager.IDLE:
				if config.myann_debug:
					print '## browser video streaming plug-in stop .. dect in use'
				self.send_videostream_start_result(1, '무선단말 사용중')
				return
				
			runtime.eaHandler.startTraffic(url, pos_x, pos_y, pos_w, pos_h)

		elif int(_event) == config.WEB_VIDEOSTREAM_STOP:
			if config.myann_debug:
				print '## browser video streaming plug-in stop'
					
			runtime.eaHandler.stopTraffic()
				
		return True


	def destroy(self):
		import signal
		if self.run_recv_thread != None:
			runtime.evas.input_remove(self.run_recv_thread)
			self.run_recv_thread = None
		try:
			if self.myannapp_pid:
				os.kill(self.myannapp_pid, signal.SIGKILL)
				def clear_myann():
					try:
						os.system( "killall -9 browser-ipc-server" )
						os.waitpid(self.myannapp_pid, 0)
						self.myannapp_pid = None
					except OSError:
						pass
					return False
				runtime.evas.timeout_add( 3000, clear_myann )
		except OSError:
			pass


	def kill_myannapp(self):
		print '## MyAnnApp.kill_myannapp()'
		def killall(name, sig):
			for pid in os.listdir('/proc'):
				cmdline_path = '/proc/%s/cmdline' % pid
				if os.path.exists(cmdline_path):
					try:
						pid = int(pid)
					except ValueError:
						continue

					if open(cmdline_path).read().startswith(name):
						os.kill(pid, sig)


		if self.run_recv_thread != None:
			runtime.evas.input_remove(self.run_recv_thread)
			self.run_recv_thread = None

		while 1:
			if self.myannapp_pid:
				print 'myannapp_pid = ', self.myannapp_pid
				try:
					import signal, time
					os.kill(self.myannapp_pid, signal.SIGKILL)
					mwpid, mret = os.waitpid(self.myannapp_pid, 0)
					print 'mwpid = ', vwpid
					print 'mret = ', vret

					if mwpid == self.myannapp_pid :
						self.myannapp_pid = None
						self.web_running = False
						break
					else :
						print 'killl myann again'
				except:
					self.myannapp_pid = None
					self.web_running = False
					print 'myann kill error?'
					break

		try:
			os.unlink(config.myann_socket_path)
			os.system('rm -rf /tmp/Embider/')
		except:
			print 'exception: myann unlink error -- can proceed...'

			'''
		if self.run_recv_thread != None:
			runtime.evas.input_remove(self.run_recv_thread)
			self.run_recv_thread = None

		if self.myannapp_pid:
			try:
				import signal, time
				os.kill(self.myannapp_pid, signal.SIGKILL)
				os.waitpid(self.myannapp_pid, 0)

				killall('browser-ipc-server', signal.SIGKILL)
			except:
				pass
				
			def hdl_sigchld(signum, frame):  # clean a zombie
				try:
				    	while 1:
						print 'os wait pid 3'    	
					        if os.waitpid(0, os.WNOHANG): raise OSError

				except OSError:
				   	pass

			self.myannapp_pid = None
			self.web_running = False
			signal.signal(signal.SIGCHLD, hdl_sigchld)
			os.unlink(config.myann_socket_path)
			os.system('rm -rf /tmp/Embider/')
			'''

	def is_running(self):
		return self.web_running

	def update_browser_cookie(self, cookie_file):
		try:
			if os.path.exists(cookie_file):
				#print '\n\n>>>>>>> before read %s\n'%cookie_file
				#os.system('cat %s'%cookie_file)
				fd = open(cookie_file, 'r')
				line = fd.readline().strip()
				fd.close()
				if cookie_file == config.SIP_COOKIE_FILE:
					cookie_info = line.split('"')
					cookie = cookie_info[1] + '|' + cookie_info[3]
				else:
					cookie = line
				self.send_mesg(config.WEB_COOKIE_UPDATE_REQ, len(cookie), cookie)
				status.curr_cookie_file = cookie_file
				#print '\n\n>>>>>>> after read %s\n'%cookie_file
				#os.system('cat %s'%cookie_file)
			else:
				#print '\n>>>>>>> error read \n', cookie_file
				return
		except:
			#print '\n>>>>>>> error open \n', cookie_file
			return			

	def send_videostream_start_result(self, result_code, result_text):
		self.send_mesg(config.WEB_VIDEOSTREAM_RESULT, result_code, result_text)	

	def send_message_received(self):
		self.send_mesg(config.EVT_APP_MESSAGE_RECEIVED)	

	def update_browser_pin(self):
		self.send_mesg(config.WEB_PIN_UPDATE_REQ, setting.pin)	

	def update_browser_tel_number(self):
		if self.tel_num != vdci_setting.tel_num:
			self.tel_num = vdci_setting.tel_num
			if config.myann_debug: print '[update_browser_tel_number] ##### tel_num is changed, delete cache'
			try:
				os.system('rm -rf /tmp/Embider/')
			except:
				pass
		self.send_mesg(config.WEB_TELNUM_UPDATE_REQ, vdci_setting.tel_num)

	def update_browser_volume_info(self):
		keytone_index = setting.button_effect_index	# 0 해제 (1~4)
		effect_index = setting.setting_effect_index	# 0 해제 (1~3)
		bg_volume = config.browser_stereo_volume[(setting.stereo_volume-1)]
		keytone_volume = config.keytone[(setting.keytone_volume-1)]
		effect_volume = config.effect_sound[(setting.effect_volume-1)]
		
		self.send_mesg(config.WEB_VOLUME_INFO, bg_volume, keytone_index, keytone_volume, effect_index, effect_volume)


	def update_browser_info(self):
		try:
			os.system('serialno > /tmp/web_serial')
			fp = open('/tmp/web_serial')
			serialnumber = fp.readline().strip()
			fp.close()
		except:
			serialnumber = ""

		try:
			os.system('serialno mac > /tmp/web_mac')
			fp = open('/tmp/web_mac')
			macaddress = fp.readline().strip()
			fp.close()
			macaddress = macaddress.replace(':', '')
		except:
			macaddress = ""

		try:
			p = file("config.cfg",'r')
			t=p.read()
			p.close()

			import re
			t = t.replace(' ','')
			swver = re.search("firmware_version=([0-9.A-Za-z]+)",t).group(1)
			hwver = re.search("hardware_version=([0-9.]+)",t).group(1)

			p = file("/usr/local/lgvp/var/product_model.info",'r')
			t=p.read()
			p.close()
			sharp = t.rfind('#')
			swver = t[sharp+1:]
			
		except:
			hwver = swver = 'not available'

		self.send_mesg(config.WEB_MAC_UPDATE_REQ, macaddress.strip())
		self.send_mesg(config.WEB_VERSION_UPDATE_REQ, swver.strip(), hwver.strip())
		self.send_mesg(config.WEB_SERIALNO_UPDATE_REQ, serialnumber.strip())

	# 브라우저에서 Red를 누르고 ack 이벤트를 기다리는 중 (받으면 브라우저 종료 후 Idle로 돌아가는데)
	# 중간에 call이 와서 IncomingStage로 변경되는 경우
	def redkey_wait(self):
		self.stop_wait_timer = None
	


focus_myann = False

def active_myann(active = True):
	global focus_myann
	focus_myann = active

	if active:
		if config.myann_debug:
			print '## active_myann'			
		os.system('fbtop 2')
	else:
		if config.myann_debug:
			print '## deactive_myann'
		os.system('fbtop 1')


def is_active_myann():
	global focus_myann

	if focus_myann:
		return True
	else:
		return False


class MyAnnStage(Stage):
	name = 'myann'
	def __init__(self, goto_url='', endCall=False):
		if config.myann_debug:
			print '## MyAnnStage is activated'

		runtime.myannapp.web_running = True			
		icon = uiconfig.baloon_setting_voip_icon
		message = _('Please wait...')
		self.ui = baseui.NotifyUI(message, icon)
		self.wait_stop_timer = None
		self.mmi_show_timer = None
		self.stop_event = False

		# 브라우저 start 시에 Red키를 5초간 제한한다.
		self.redPreventTimer = utils.Timer(5000, self.discard_red)
		
		if not runtime.eaHandler.isAppInUse():
			runtime.myannapp.update_browser_pin()
			runtime.myannapp.update_browser_tel_number()
			runtime.myannapp.update_browser_volume_info()
			runtime.myannapp.send_mesg(config.EVT_APP_START, goto_url)
			runtime.SP_context.SP_stereoPlayback()

	def discard_red(self):
		self.redPreventTimer = None	

	def handle_key(self, key):
		if config.myann_debug:
			print '## MyAnnStage handle_key', key
		if ((key == config.Red) and (not self.stop_event)):
			if self.redPreventTimer:
				print '## MyAnnStage discard_red'
				return True
		
			if config.myann_debug:
				print '## MyAnnStage is deactivated by Red'

			def wait_stop_cb():
				print '## MyAnnStage .. wait_stop_cb()'
			
				#def mmi_show_cb():
				#	del(self.mmi_show_timer)
				#	self.mmi_show_timer = None
				#	active_myann(False)
				#	return False
					
				del(self.wait_stop_timer)
				self.wait_stop_timer = None
				
				runtime.myannapp.kill_myannapp()
				runtime.myannapp = None
				runtime.myannapp = MyAnnApp()
				runtime.myannapp.run_myannapp()
				if status.curr_cookie_file:
					runtime.myannapp.update_browser_cookie(status.curr_cookie_file)
				
				#self.mmi_show_timer = utils.Timer(100, mmi_show_cb)
				active_myann(False)
				runtime.eaHandler.deactivateApplication_browser()
				
				return False

			runtime.vmHandler.playClear()
			runtime.myannapp.send_mesg(config.EVT_APP_STOP)
			#runtime.SP_context.SP_stereoStopPlayback()
			self.wait_stop_timer = utils.Timer(5000, wait_stop_cb)
			self.stop_event = True
			
		elif key == config.OffHook or key == config.Green or key == config.Video:
			if config.myann_debug:
				print 'MyAnnStage outgoing call start ..', key
			currentApplication = runtime.eaHandler.getDestination().getName()
			if currentApplication == 'MMSC':
				runtime.eaHandler.startCallWithoutNumber('MMSC', key)
			elif currentApplication == 'BROWSER':
				runtime.eaHandler.startCallWithoutNumber('BROWSER', key)
				
		return True
		
	def destroy(self):
		self.wait_stop_timer = None
		self.mmi_show_timer = None
		self.stop_event = False
		runtime.myannapp.web_running = False
		Stage.destroy(self)
		#active_myann(False)

	
class MyAnnNotifyStage(NotifyStage):
	name = 'myannnotify'
	def __init__(self, message, icon, cb):
		NotifyStage.__init__(self, message, icon, cb)