# -*- encoding: koi8-r -*-
import runtime, config, status
from setting import setting
#import sms
import utils, os
import time, ntptime
dspg = runtime.dspg
from mms_net_define import *
import errorcode
from model import IdleStage, IncomingStage, \
IncomingMissedCallNoCIDStage, ConnectedStage, \
CallTerminatedStage, MissedIncomingCallStage, \
CallingStage, OffHookStage, CallBarringStage, CallLimitedStage, \
VideoCallTerminatedStage,EnblockEditStage, \
DirectVideoCallingStage, \
DirectAudioCallingStage, \
AudioCallTerminatedStage, AudioCallConnectingStage, \
VideoCallImpossibleStage, VideoCallConnectingStage, \
VideoCallConnectedStage, AudioCallConnectedStage, \
ServiceNotAvailableStage, CallProhibitStage, \
HandsFreeNotifyStage, IncomingSMSStage_KT, RegiNotifyStage, InUseByDectStage
from basemodel import Stage, NotifyStage, YesNoStage
from phonesetting import PhoneSettingNotifyStage
from options import CallHoldStage, \
TwoCallOneHoldStage, SecondCallConnectingStage, \
OptionsIPStage, SecondCallConnectingStage, HangupStage, \
CallTransferNotifyStage, SecondCallEnblockEditStage, \
SecondIncomingCallStage, DialSecondCallStage, \
ErrorResultNotifyStage, BackToConnectedStage, BackToHoldStage, \
ReleaseHoldBackToConnectedStage, IncomingDisconnectedStage, \
NotifyMessageBackToOneCallStage, NotifyMessageBackToTwoCallStage, \
DisconnectNotifyStage
from tdeservice import CallForwardingStage, DoNotDisturbStage, \
CallerIDBlockingStage, CallerIDUnblockingStage, \
SpeedDial8Stage, SpeedDial8SettingStage, \
MWINotifyStage, SupervisionConnectedStage
from phonebook import ItemOptionStage, DetailDialStage
from videosetting import SnapshotStage
#ka...wizard 2007.04.23
from configuration import InitDirectionStage
from roxiadebug import *
from runtime import mmiDebug as MD
import baseui
import profile
from runtime import mmiDebug as MD
from mmiSoundPath import SP_State, Device, SP_Context
from mmedia import Mmedia
import initconf
import rss, provision
tempnoti = \
'\x04\x06\x37\x61\x70\x70\x6C\x69\x63\x61\
\x74\x69\x6F\x6E\x2F\x76\x6E\x64\x2E\x77\
\x61\x70\x2E\x6D\x6D\x73\x2D\x6D\x65\x73\
\x73\x61\x67\x65\x00\x45\x6E\x63\x6F\x64\
\x69\x6E\x67\x2D\x76\x65\x72\x73\x69\x6F\
\x6E\x00\x31\x2E\x31\x00\xAF\x84\x8C\x82\
\x98\x32\x30\x30\x35\x30\x37\x30\x38\x31\
\x32\x31\x35\x31\x31\x39\x34\x34\x31\x32\
\x30\x39\x38\x39\x34\x34\x39\x00\x8D\x91\
\x8A\x80\x88\x06\x80\x04\x42\xF5\x32\xE0\
\x89\x0B\x80\x39\x31\x37\x34\x34\x30\x38\
\x31\x36\x00\x86\x81\x8E\x01\x64\x83\x68\
\x74\x74\x70\x3A\x2F\x2F\x6D\x65\x6E\x73\
\x61\x6A\x65\x6D\x6D\x73\x2E\x74\x65\x6C\
\x65\x66\x6F\x6E\x69\x63\x61\x2E\x65\x73\
\x3A\x31\x39\x30\x38\x30\x2F\x6D\x6D\x31\
\x2F\x72\x65\x63\x2F\x6D\x6D\x73\x2D\x32\
\x30\x30\x35\x30\x37\x30\x38\x31\x32\x31\
\x35\x31\x31\x39\x34\x34\x31\x32\x30\x39\
\x38\x39\x34\x34\x39\x00'
#Roxia Begin smyook 06.05.09
class ManagerNotifyStage(NotifyStage):
def __init__(self, message, icon=None, cb=None):
if not icon:
icon = uiconfig.baloon_phone_setting_icon
NotifyStage.__init__(self, message, icon, cb)
def show(self):
NotifyStage.show(self)
runtime.day.hide()
def destroy(self):
status.critical_entered = True
NotifyStage.destroy(self)
#Roxia End smyook
class YesNo_IgnoreKey(Stage):
def __init__(self, yesno_msg, icon, yes_cb, no_cb):
self.ui = baseui.YesNoUI('', yesno_msg, icon)
self.yes_cb = yes_cb
self.no_cb = no_cb
def handle_key(self, key):
if key == config.Menu1: self.yes_cb()
elif key == config.Menu2: self.no_cb()
elif key == config.Red: self.no_cb()
return True
def destroy(self):
Stage.destroy(self)
class LinkMonitor:
# shchun: linkmonitor is responsible for network recovery.
def __init__(self):
debugLogN('START LinkMonitor')
self.net_monitor_timer = None
self.background = True
# ka...2008.06.24:
#self.restart_net_monitor(True)
self.toTimer = None
# do not call do monitor too often. at least config.net_monitor_cooling_time
self.coolTimer = None # do monitor cooltime...
self.monitorBusyFlag = False
self.net_monitor_timer_foreground = None
def restart_net_monitor(self, callnow=False, background=True):
debugLogN('LinkMonitor.restart_net_monitor background(%d)'%background)
if not background:
self.net_monitor_timer_foreground = utils.Timer(config.net_monitor_cooling_time, self.do_monitor, False)
self.net_monitor_timer = None
return
if self.net_monitor_timer_foreground:
debugLogN('skip: LinkMonitor.Foreground')
return
if callnow:
self.do_monitor()
self.net_monitor_timer = utils.Timer(config.net_monitor_interval, self.do_monitor, True)
def stop_net_monitor(self):
debugLogN('LinkMonitor.stop_net_monitor')
self.net_monitor_timer = None
def update_idlemsg(self):
debugLogN('linkmonitor.update_idlemsg')
try:
stage = runtime.manager.find_stage('idle', True)
if stage:
stage.ui.update_my_number()
except:
print 'except : update idlemsg'
def dhcp_timeout_cb(self):
debugLogN('Link Monitor - dhcp timeout')
if status.network_status == status.NetOk:
debugLogN('skip: DHCP already Ok')
self.restart_net_monitor()
return False
# LINK CHECK
if profile.profile.get_profile() == 1: # LAN
if not runtime.peek_lanlink():
debugLogN('skip: DHCP timeout : linkmonitor : eth link down')
return
message=errorcode.msg_W104 # same with M301
errorcode.set_idle_errmsg(message, 'W104')
self.update_idlemsg()
#MMW 2008.0622 network error message to dect
utils.send_VP_net_status_to_DCT('W104')
#end of MMW
status.set_netstatus(status.NetNotAvailable)
status.set_regstatus(0)
status.set_register_mode(status.NotRegistered)
runtime.manager.vdci_deregister_kill(delay_msec=1000)
self.restart_net_monitor()
def dhcp_success(self):
self.toTimer = None
debugLogN('dhcp success')
#errorcode.set_idle_errmsg('')
errorcode.set_idle_errmsg('', delay_msec=2000, refresh=True)
def dhcp_start(self):
debugLogN('linkmonitor.dhcp_start(): called')
if profile.profile.get_profile() == 1:
debugLogN('key link up: dhcp start')
os.system('eth0_start&')
#message= errorcode.msg_W103 # same with M301
message=errorcode.msg_M102 # same with M301
errorcode.set_idle_errmsg(message)
self.update_idlemsg()
self.toTimer = utils.Timer(config.dhcp_timeout_lan, self.dhcp_timeout_cb)
else:
os.system('wifi_dhcp&')
message= errorcode.msg_W103 # same with M301
#message= errorcode.msg_M102 # same with M301
errorcode.set_idle_errmsg(message)
self.update_idlemsg()
self.toTimer = utils.Timer(config.dhcp_timeout_wifi, self.dhcp_timeout_cb)
self.restart_net_monitor()
def set_do_monitor_cool_flag(self):
self.monitorBusyFlag = True
self.coolTimer = utils.Timer(config.net_monitor_cooling_time, self.del_do_monitor_cool_flag)
debugLogN('Do Monitor: BUSY-FLAG: ON')
def del_do_monitor_cool_flag(self):
self.coolTimer = None
self.monitorBusyFlag = False
debugLogN('Do Monitor: BUSY-FLAG: OFF')
return False
def do_monitor(self, background=False, force=False):
# shchun: temporary soln, arp per 1 min
#
# if profile.profile.get_profile() == 1: # LAN
# print 'do_arp()'
# import phonesetting
# ipaddress, netmask, gateway, dnsaddr1, dnsaddr2 = phonesetting.getNetworkInfo()
# cmd = '/bin/busybox arping -f -c 5 -s %s -I eth0 %s&'%(ipaddress, gateway)
# os.system(cmd)
#try:
debugLogN('Do Monitor: Net(%d) Reg(%d/%d) Back/PingChk/isBusy/Force(%d/%d/%d/%d)'%(status.network_status, status.get_register_mode(), status.get_regstatus(), background,status.get_need_ping_chk_flag(), self.monitorBusyFlag, force))
if (not background) and self.net_monitor_timer_foreground :
debugLogN('\treset foreground timer')
self.net_monitor_timer_foreground = None
runtime.manager.linkmonitor.restart_net_monitor()
if self.monitorBusyFlag:
debugLogN('Do Monitor: END:skip: BUSY - Back(%d)'%background)
if background:
return True
else:
runtime.manager.linkmonitor.restart_net_monitor(background=False)
if profile.profile.get_profile() == 1 and not runtime.peek_lanlink():
debugLogN('skip: lan link down - no dialog')
pass
elif status.network_status in (status.NetNotAvailable, status.NetLinkOk):
runtime.manager.change_stage(initconf.ResumeInitDummy)
elif status.network_status == status.NetOk and status.get_regstatus() == 0:
runtime.manager.change_stage(initconf.AutoRegisteringStageDummy)
return True
self.set_do_monitor_cool_flag()
self.background = background
if not force:
#stage_name = runtime.manager.stage.get_name()
#if stage_name in ( 'init ipnetwork' ,'reinit ipnetwork' , 'autoregistering', 'vcheck stage', 'download stage', 'download copy stage', 'download update stage'):
# debugLogC('Do Monitor: END:skip: stage(%s)'%stage_name)
# return True
if runtime.manager.stage.domonitor_forbidden == True:
debugLogN('Do Monitor: END:skip: domonitor_forbidden')
return True
# ÀÌ¹Ì µî·Ï¿¡ ¼º°øÇÑ °æ¿ì
if status.get_regstatus() == 1:
debugLogN('Do Monitor: END: skip already registered')
return True
if status.network_status in (status.NetNotAvailable, status.NetLinkOk):
if runtime.manager.stage.get_name() in ('idle', 'reinit ipnetwork dummy', 'auto registering dummy') and not background:
#runtime.manager.change_stage(initconf.InitIpNetworks)
runtime.manager.change_stage(initconf.ResumeInit)
else:
if profile.profile.get_profile() == 1:
if not runtime.peek_lanlink():
#LinkDownÀÎ °æ¿ì¹Ç·Î return
debugLogN('Do Monitor: END: skip: lan link down')
return True
debugLogN('Do Monitor - eth0_start')
# patch: when non-dhcp there is no ip changed key
if profile.lan_profile.get_dhcp():
# dhcp
os.system('eth0_start &')
self.toTimer = utils.Timer(config.dhcp_timeout_lan, self.dhcp_timeout_cb)
else:
os.system('eth0_start') # eth0_start as foreground when static IP.
# static ip
#status.set_netstatus(status.NetOk)
status.set_netstatus(status.NetIPOk)
self.del_do_monitor_cool_flag()
self.do_monitor(self.background)
#MMW 2008.0622 network error message to dect
if runtime.dectCallManager.isSubcribedDect():
# print 'link up to DCT !!!!!!!!!!!!!!!!!!!!!!!'
runtime.dectCallManager.sendLinkUpReport()
#end of MMW
else:
# 7/3 when net fail, do link down....
# so recover can be start link is down...
#if not runtime.peek_wifilink():
# #LinkDownÀÎ °æ¿ì¹Ç·Î return
# debugLogC('skip: wifi link down')
# return True
debugLogN('Do Monitor: wifi_reconnect - foreground')
os.system('wifi_reconnect')
#os.system('wifi_reconnect')
## patch: when non-dhcp wireless there is no ip changed key
#if profile.wifi_profile.get_dhcp():
# self.toTimer = utils.Timer(config.dhcp_timeout, self.dhcp_timeout_cb)
#else:
# status.set_netstatus(status.NetOk)
# self.do_monitor(self.background)
elif status.network_status == status.NetIPOk:
def success_cb():
self.del_do_monitor_cool_flag()
self.do_monitor(self.background)
if config.NTP_CODE_ENABLE:
runtime.manager.ntp_run()
runtime.manager.ARP_request(success_cb=success_cb, background=background)
elif status.network_status == status.NetOk and status.get_regstatus() == 0:
import phonesetting
#stage = phonesetting.AutoRegisteringStage(dereg_first=False)
#stage = RegisteringIdleStage(True)
self.toTimer = None
#if config.NTP_CODE_ENABLE:
# runtime.manager.ntp_run()
#if runtime.manager.stage.get_name() in ('idle', 'init ipnetwork'):
if not self.background:
# foreground
stage = phonesetting.AutoRegisteringStage()
runtime.manager.stack_stage(stage)
debugLogN('Do Monitor:TRY register foreground')
else:
need_ping_check = status.get_need_ping_chk_flag()
debugLogN('NEED-PING-CHK: %d'%need_ping_check)
if need_ping_check:
# ok
def success_cb():
debugLogN('PING-OK')
status.set_need_ping_chk_flag(False)
phonesetting.vdci_reload()
debugLogN('ICMP check: OK')
# shchun: remove redundency - when vdci_reload reg will be done.
# if runtime.manager.check_settings():
# stage = phonesetting.AutoRegisteringStage()
# #stage = RegisteringIdleStage()
# runtime.manager.stack_stage(stage)
# fail - pass
def fail_cb():
debugLogN('PING-FAIL - Link monitor fail_cb')
runtime.manager.do_netchk_fail_cb() # not possible
# debugLogC('PING-FAIL: reinit Network')
# status.set_netstatus(status.NetNotAvailable)
#
# if profile.profile.get_profile() == 1:
# debugLogC('\teth0_stop - disable')
# #os.system('eth0_stop')
# else:
# debugLogC('\twifi_temp_stop')
# os.system('wifi_temp_stop')
runtime.manager.ICMP_request_disabled(success_cb=success_cb, fail_cb=fail_cb, background=True)
debugLogN('Do Monitor: END: need ping check')
return True
# background
# ka...2008.06.24: vdci_setting°ªÀÌ ¾ø´Â °æ¿ì¿¡´Â reload ÇÏÁö ¾Ê´Â´Ù.
#if runtime.manager.check_settings():
# phonesetting.vdci_reload()
# #runtime.vdci_startup()
# debugLogC('Do Monitor: TRY register background')
#debugLogC('network status: register fail: skip')
# network check + ok ½Ã registration ½Ãµµ.
#debugLogC('do_netchk: ICMP check')
#err_msg =errorcode.msg_W110
#def success_cb():
# debugLogC('ICMP check: OK')
# if runtime.manager.check_settings():
# stage = phonesetting.AutoRegisteringStage()
# runtime.manager.stack_stage(stage)
#runtime.manager.ICMP_request(success_cb=success_cb, background=background)
elif status.network_status == status.NetOk and status.get_regstatus() == 1:
debugLogN('skip: ok')
#except:
# print 'except : linkmonitor'
self.update_idlemsg()
debugLogN('Do Monitor: END: Gracefully')
return True
class Manager:
def __init__(self, stage=None):
runtime.evas.handle_key = self.handle_key
debugLogC('****** WELCOME TO IP 3870 ******')
debugLogN('START_OF_MANAGER__INIT__ is_restart(%d)'%status.is_restart)
self.wifi_auth_notified = 0
self.link_timer = None
self.lastkeys = []
# for local call
if setting.urlPolicy == 0:
config.local_test_flag = True
else:
config.local_test_flag = False
# for local call ==
self.back = []
if status.is_restart:
self.stage = stage or initconf.ResumeInit()
else:
self.stage = stage or initconf.InitIpNetworks()
self.hook_timer = None
self.long_key_tag = None
self.sac3_timer = None
self.ntp_timer = None
self.dst_timer = None
#self.dst_rollback_completed = False
self.key_is_down = False
self.pressed_key = None
self.interrupt_queued = False
self.key_queue = []
self.network_initialized = False
self.sac3_retry = 0
self.call_sac3_retry = 0
self.init_timer_flag = False
self.keypadLightTag = None
self.dhcp_timer = None
status.LanConnected = False
self.show_lan_disconnected = False
self.new_rtp = ''
self.old_rtp = ''
self.rtp_timer = None
self.tag_register_in_boot = None
self.stage.show()
runtime.evas.render_now()
self.snmpd = None
self.in_night_mode = False
self.nm_so_chk_timer = None
status.set_netstatus(status.NetNotAvailable)
self.linkmonitor = LinkMonitor()
# provision 2008.12.23
if config.Provision_enable == True:
self.provision_manager = provision.ProvisionManager()
if config.Rss_enable == True :
self.rss_manager = rss.RSS_manager()
self.cur_ipaddr = None
self.vdci_dereg_timer = None
#runtime.evas.idle_add(self.post_init)
os.system('fb0top 1')
self.post_init()
debugLogN('END_OF_MANAGER__INIT__')
if profile.profile.get_profile() == 1:
if runtime.peek_lanlink():
#debugLogN('INIT : send eth link up')
self.link_timer = utils.Timer(200, self.send_linkup)
def send_linkup(self):
# LAN+Static case, should send link up to manager.
try:
debugLogN("manager.py: send_link up")
runtime.manager.handle_key(True, config.key_link_up)
return False
except:
debugLogN("manager.py: send_link up error, try again")
return True
def post_init(self):
# additional initialization job after __init__()
# start shchun
debugLogN('START_OF_MANAGER_POST_INIT__')
# KA: [20071006] TI IMS Codec Priority
# no codec selected yet
setting.audio_codec_selected_index = config.no_audio_codec_selected_index
setting.video_codec_selected_index = config.no_video_codec_selected_index
# all codecs are available
setting.audio_codec_list_index = config.all_audio_codec_list_index
setting.video_codec_list_index = config.all_video_codec_list_index
#self.audio_codec = '0:1:3:2:5:11'
#self.video_codec = '10:7:14:11:11:11'
from vdcisetting import vdci_setting
audio_codec_setup = vdci_setting.audio_codec
video_codec_setup = vdci_setting.video_codec
audio_index = 0
video_index = 0
while audio_codec_setup != '':
#print 'audio_codec=', audio_codec_setup
if audio_codec_setup.count(':') > 0: # more than 1
next_codec, audio_codec_setup = audio_codec_setup.split(':',1)
else:
next_codec = audio_codec_setup
audio_codec_setup = ''
#print 'next=',next_codec
#print 'audio_codec=', audio_codec_setup
if next_codec in config.audio_codec_list and next_codec != config.codec_value_for_None:
setting.audio_codec_selected_index.pop() # pop from back.
setting.audio_codec_selected_index.insert(audio_index, (str(config.audio_codec_list.index(next_codec)))) # insert at front
setting.audio_codec_list_index.pop(setting.audio_codec_list_index.index(str(config.audio_codec_list.index(next_codec))))
audio_index = audio_index + 1
#print 'setting.audio_codec_selected_index=', setting.audio_codec_selected_index
#print 'setting.audio_codec_list_index=', setting.audio_codec_list_index
while video_codec_setup != '':
#print 'video_codec=', video_codec_setup
if video_codec_setup.count(':') > 0: # more than 1
next_codec, video_codec_setup = video_codec_setup.split(':',1)
else:
next_codec = video_codec_setup
video_codec_setup = ''
#print 'next=',next_codec
#print 'video_codec=', video_codec_setup
if next_codec in config.video_codec_list and next_codec != config.codec_value_for_None:
setting.video_codec_selected_index.pop()
setting.video_codec_selected_index.insert(video_index, (str(config.video_codec_list.index(next_codec))))
setting.video_codec_list_index.pop(setting.video_codec_list_index.index(str(config.video_codec_list.index(next_codec))))
video_index = video_index + 1
# KA: [20071006] TI IMS Codec Priority ==
# default volume settings
runtime.SP_context.goIdleState()
setting.init_time()
if not config.dual_audio_volume:
setting.set_volume(setting.audio_volume)
setting.reset_lang()
# KA: [20080424] PPPoE
#import error
#self.errir = error.Error()
# KA: [20080424] PPPoE ==
import os.path
#self.boot_start_processor = True
setting.reset_screen_saver_timer()
status.screensaver_activated = False
#import bluetoothapp
#if runtime.btapp == None:
# runtime.btapp = bluetoothapp.BTApp()
#runtime.btapp.run_btapp()
import mmiDebug
if runtime.mmiDebug == None:
runtime.mmiDebug = mmiDebug.MmiDebug()
MD.mmiTrace('INIT DECT HANDLER >>>>>>>>>>>>>>>>>>>>>>>>')
import dectHandler
if runtime.dectHandler == None:
runtime.dectHandler = dectHandler.DectHandler()
if runtime.dectCallManager == None:
runtime.dectCallManager = dectHandler.DectCallManager(1)
# KA: [20080414] dect base reset ½Ã »óŸ¦ ¾Ë·ÁÁÖ±â À§ÇØ
self.set_bootinfo('0')
# yylee for night mode
self.in_night_mode = False
self.handle_lighting()
if not self.in_night_mode:
self.set_brightness(setting.brightness-1)
if setting.nightmode_enable == 1:
self.start_nightmode_timer()
# KA: [0080409] testmodeÀÎ °æ¿ì VDCI »ì¸®Áö ¾Ê°í, DHCPµµ µ¹¸®Áö ¾Ê´Â´Ù.
#if utils.is_test_mode():
# return
MD.mmiTrace('INIT VM HANDLER >>>>>>>>>>>>>>>>>>>>>>>>')
import vmHandler
if runtime.vmHandler == None:
runtime.vmHandler = vmHandler.VmHandler()
MD.mmiTrace('INIT External Application HANDLER >>>>>>>>>>>>>>>>>>>>>>>>')
import eaHandler
if runtime.eaHandler == None:
runtime.eaHandler = eaHandler.EaHandler()
MD.mmiTrace('INIT TRAP HANDLER >>>>>>>>>>>>>>>>>>>>>>>>')
import trapManager
if runtime.trapHandler == None:
runtime.trapHandler = trapManager.TrapHandler()
print '## start_myannapp ..'
import myannapp
if runtime.myannapp == None:
#if os.path.exists('/usr/local/lgvp/Embider/'):
# os.system("rm -rf /usr/local/lgvp/Embider/")
runtime.myannapp = myannapp.MyAnnApp()
runtime.myannapp.run_myannapp()
if runtime.mmedia == None:
runtime.mmedia = Mmedia()
self.wifi_check()
debugLogN('END_OF_MANAGER_POST_INIT__')
# KA: [20080527] for test- mmf ring
#setting.external_ring = config.def_melody
# KA: [20080527] for test- mmf ring ==
def wifi_check(self):
ret = os.system("wltest")
if ret == 0:
status.wifi_test = True
else:
status.wifi_test = False
def make_dhcp_try_by_event(self):
#os.system('stop_dhcpclient eth0')
# eth0_stopÀº interface¸¦ down ½ÃŲ´Ù... »ç¿ëÄ¡ ¸»¾Æ¾ß ÇÑ´Ù.
#self.dhcp_timer_kill()
os.system('eth0_start&')
def arp_request(self): # obselete
if config.local_test_flag:
return True
if profile.lan_profile.gateway:
#result = os.system('busybox arping -c 1 %s'%(profile.lan_profile.gateway))
result = os.system('ping -c 1 %s'%(profile.lan_profile.gateway))
if result == 0: # success 0 / fail 1
return True
return False
# KA: [20080520] wireless lan error check
def ICMP_request(self, success_cb=None, fail_cb=None, errmsg= errorcode.msg_W110, errcode='W110', background=True):
if config.local_test_flag:
if success_cb:
debugLogN('local test PING pass')
if success_cb:
success_cb()
return
def check_request():
# ping check count
import status
status.dnsPingCount = True
#result = os.system('busybox arping -c 1 %s'%(profile.lan_profile.gateway))
# DONE: DNS should be configurable value
from profile import dns_profile
cmd = '/usr/local/bin/pingcheck %s'%dns_profile.dns1
#cmd = 'ping2 -A -c 2 -w 3 %s'%dns_profile.dns1 # longer wait time.
#cmd = 'ping2 -A -c 2 -w 3 %s'%dns_profile.dns1 # longer wait time.
#cmd = 'ping2 -A -c 2 -w 2 %s'%dns_profile.dns1 # ping twice per KT request
#cmd = 'ping2 -A -c 2 -w 2 168.126.63.1' # ping to KT dns, hard code
result = os.system(cmd) # -- 168.126.63.1
debugLogN('PING to (%s), result(%d) cmd(%s)'%(dns_profile.dns1, result, cmd))
if result == 0: # success 0 / fail 1
return True
else:
return False
# LINK CHECK
if profile.profile.get_profile() == 1: # LAN
if not runtime.peek_lanlink():
debugLogN('skip: PING eth link down')
return
# shchun : wifi is no problem..... skip
#else: # WiFi
# if not runtime.peek_wifilink():
# debugLogN('INIT : send eth link down')
# return
import uiconfig
if not check_request():
# PING fail
def restart_networks_cb():
debugLogN('PING fail reinit: restart_networks_cb()')
# if in call
#self.stop_call(IdleStage)
import status
status.set_netstatus(status.NetNotAvailable)
runtime.manager.change_stage(IdleStage, True)
#os.system('killall python')
#stage = initconf.ReInitIpNetworks
#runtime.manager.change_stage(stage, True)
#errorcode.set_idle_errmsg(errmsg, errcode)
if background:
if fail_cb:
fail_cb()
else:
restart_networks_cb()
else:
if fail_cb:
stage = NotifyStage(errmsg, icon = uiconfig.video_call_connect_icon, cb=fail_cb)
else:
stage = NotifyStage(errmsg, icon = uiconfig.video_call_connect_icon, cb=restart_networks_cb)
runtime.manager.stack_stage(stage)
#runtime.manager.change_stage(stage, True)
#runtime.evas.render_now()
else:
# PING success.
import status
status.set_netstatus(status.NetOk)
if success_cb:
debugLogN('PING success, next')
success_cb()
return
# KA: [20080520] wireless lan error check
def ICMP_request_disabled(self, success_cb=None, fail_cb=None, errmsg= errorcode.msg_W110, errcode='W105', background=True):
import status
status.set_netstatus(status.NetOk)
debugLogN('ICMP_request disabled: success always')
if success_cb:
success_cb()
return
# shchun : KT spec always changes before holiday. Hope this is last.
# Sometime ally and enemy are same word.
def ARP_request(self, success_cb=None, fail_cb=None, errmsg= errorcode.msg_W105 , errcode='W105', background=True):
if config.local_test_flag:
import status
status.set_netstatus(status.NetOk)
if success_cb:
debugLogN('ARP-TEST: local test pass')
success_cb()
return
if profile.profile.get_profile() == 1: # LAN
if not runtime.peek_lanlink():
debugLogN('skip: ARP request - eth link down')
return
if len(profile.lan_profile.gateway) == 0 or len(profile.lan_profile.ipaddress) == 0:
debugLogN('ARP-TEST(LAN): no gateway or ipaddress')
if success_cb:
success_cb()
return
else: # WIFI
if len(profile.wifi_profile.gateway) == 0 or len(profile.wifi_profile.ipaddress) == 0:
debugLogN('ARP-TEST(WIFI): no gateway or ipaddress')
if success_cb:
success_cb()
return
def check_request():
import status
#result = os.system('busybox arping -c 1 %s'%(profile.lan_profile.gateway))
# DONE: consider wifi profile.
if profile.profile.get_profile() == 1: # LAN
cmd = '/bin/busybox arping -f -c 5 -s %s -I eth0 %s'%(profile.lan_profile.ipaddress, profile.lan_profile.gateway)
else: # WIFI
cmd = '/bin/busybox arping -f -c 5 -s %s -I wlan0 %s'%(profile.wifi_profile.ipaddress, profile.wifi_profile.gateway)
result = os.system(cmd) # -- 168.126.63.1
print 'cmd=', cmd
if profile.profile.get_profile() == 1: # LAN
debugLogN('ARP to (%s), result(%d), cmd(%s)'%(profile.lan_profile.gateway, result, cmd))
else:
debugLogN('ARP to (%s), result(%d), cmd(%s)'%(profile.wifi_profile.gateway, result, cmd))
#os.system('/sbin/ifconfig') # debug
if result == 0: # success 0 / fail 1 - since gw should be available... it is oppisite compare to ping test.
return True
else:
return False
import uiconfig
if not check_request():
# ARP fail
def restart_networks_cb():
debugLogN('ARP fail reinit: restart_networks_cb()')
import status
if profile.profile.get_profile() == 1: # LAN
#status.set_netstatus(status.NetOk)
status.set_netstatus(status.NetNotAvailable)
#MMW 2008.0622 network error message to dect
utils.send_VP_net_status_to_DCT('M302')
status.set_regstatus(0)
status.set_register_mode(status.NotRegistered)
errorcode.set_idle_errmsg(errmsg, errcode)
runtime.manager.linkmonitor.update_idlemsg()
status.set_need_ping_chk_flag(True)
stage = runtime.manager.find_stage('init ipnetwork', True)
stage2 = runtime.manager.find_stage('reinit ipnetwork', True)
if stage or stage2:
runtime.manager.change_stage(IdleStage, True)
print 'no init ipnetwork stage, just return'
return
#end of MMW
else:
status.set_netstatus(status.NetNotAvailable)
debugLogN('\twifi_temp_stop')
os.system('wifi_temp_stop')
#MMW 2008.0622 network error message to dect
utils.send_VP_net_status_to_DCT('W105')
#end of MMW
status.set_regstatus(0)
status.set_register_mode(status.NotRegistered)
errorcode.set_idle_errmsg(errmsg, errcode)
runtime.manager.linkmonitor.update_idlemsg()
#runtime.manager.change_stage(IdleStage, True)
stage = runtime.manager.find_stage('init ipnetwork', True)
stage2 = runtime.manager.find_stage('reinit ipnetwork', True)
if stage or stage2:
runtime.manager.change_stage(IdleStage, True)
print 'no init ipnetwork stage, just return'
return
if background:
if fail_cb:
fail_cb()
else:
restart_networks_cb()
else:
if fail_cb:
stage = NotifyStage(errmsg, icon = uiconfig.video_call_connect_icon, cb=fail_cb)
else:
stage = NotifyStage(errmsg, icon = uiconfig.video_call_connect_icon, cb=restart_networks_cb)
runtime.manager.stack_stage(stage)
else:
# ARP success.
import status
status.set_netstatus(status.NetOk)
if success_cb:
debugLogN('ARP success, next')
success_cb()
return
def rtp_check(self):
if config.local_test_flag:
return
debugLogN('RTP Checking')
# ÅëÈÁß LAN/WiFi disconnected»óÅÂÀ̸é rtp üũÇÏÁö ¾Ê´Â´Ù.
cur_profile = profile.profile.get_profile()
def check_data():
result = os.system('cat /proc/sys/ept/rtpstats > /tmp/rtp_data')
return result
def check_file():
new_rtp = ''
if check_data() == 0:
for line in file('/tmp/rtp_data'):
# 16 / 3 - 3°³
data = line.split('\t')
new_rtp = data[2] + data[18] + data[34]
else:
print 'ka...##### check_data fail='
return new_rtp
def check_data_retry():
if status.phone_status == status.Disconnected:
self.rtp_timer = None
return False
try:
self.new_rtp = check_file()
if int(self.old_rtp) != int(self.new_rtp):
self.old_rtp = self.new_rtp
return True # 5Ãʸ¶´Ù retry
else:
self.rtp_timer = None
#self.ICMP_request()
#import uiconfig
#stage = NotifyStage(_('W110 3 request fail'), icon = uiconfig.video_call_connect_icon)
#runtime.manager.stack_stage(stage)
#runtime.evas.render_now()
debugLogC('RTP runout error')
# per agreed, shchun, ka.....
# - do not skip rtp runout evenif ip network is not available.
if (cur_profile == 1 and not runtime.peek_lanlink()) or \
(cur_profile == 2 and not runtime.peek_wifilink()):
debugLogN('skip-rtp-check: link is down.')
return False
#¼º°øÀÎ °æ¿ì¿¡´Â ´Ù½Ã rtp_checkÇϵµ·Ï
def success_cb():
self.rtp_check()
# shchun : plz consider if rtp is always runout but ping is ok. If the peer is on error this can easily happen.
# the phone will continously ping to dns.
# shchun : per KT request - no need to hangup, (Mr Lim)
debugLogN('ping success - do nothing.')
#runtime.manager.handle_key(True, config.Red)
return
runtime.manager.do_network_check(success_cb=success_cb)
return False
except:
debugLogC('RTP fil check error')
return True # 5Ãʸ¶´Ù retry
self.new_rtp =''
self.old_rtp =''
self.rtp_timer = None
self.old_rtp = self.new_rtp = check_file()
self.rtp_timer = utils.Timer(7000, check_data_retry)
# KA: [20080520] wireless lan error check ==
def do_network_check(self, success_cb=None):
import initconf
# shchun : delay ping check by 10 sec, proc after stop call
debugLogN('DO_NETWORK_CHECK ping check NOW')
def icmp_check():
cur_profile = profile.profile.get_profile()
if cur_profile == 1: # lan
err_msg = errorcode.msg_M901
err_code = 'M901'
else:
err_msg = errorcode.msg_W110
err_code = 'W110'
def fail_cb():
cur_profile = profile.profile.get_profile()
if cur_profile == 1: # lan
err_msg = errorcode.msg_M901
err_code = 'M901'
else:
err_msg = errorcode.msg_W110
err_code = 'W110'
cur_profile = profile.profile.get_profile()
#status.set_need_ping_chk_flag(True)
errorcode.set_idle_errmsg(err_msg, code=err_code)
utils.send_VP_net_status_to_DCT('W110')
if status.video_mode != status.VideoIdle:
debugLogN('HANG UP - do_network_check')
runtime.manager.handle_key(True, config.Red)
status.set_netstatus(status.NetNotAvailable)
status.set_regstatus(0)
status.set_register_mode(status.NotRegistered)
if cur_profile == 1: # lan
status.set_need_ping_chk_flag(True)
elif cur_profile == 2: # wifi
debugLogN('\twifi_temp_stop')
os.system('wifi_temp_stop')
#time.sleep(1)
self.vdci_deregister_kill(delay_msec=1000)
debugLogN('Restart APP - disable') # per agreed : ryu, hyo
#os.system('sync')
#time.sleep(0.2)
#os.system('killall python')
debugLogN('do_network_check: ICMP check')
runtime.manager.ICMP_request(errmsg=err_msg,errcode=err_code, fail_cb=fail_cb, success_cb=success_cb)
#runtime.tag_icmp_check = utils.Timer(1* 1000, icmp_check)
icmp_check()
def do_netchk_fail_cb_504(self):
debugLogN('do_netchk_fail_cb()')
err_msg = ''
cur_profile = profile.profile.get_profile()
if cur_profile == 1: # lan
if not runtime.peek_lanlink():
debugLogN('skip: do_netchk_fail_cb - eth link down')
return
elif profile.lan_profile.get_dhcp():
err_msg = errorcode.msg_M901
utils.send_VP_net_status_to_DCT('M901')
else:
err_msg = errorcode.msg_M901
utils.send_VP_net_status_to_DCT('M901')
elif cur_profile == 2: # wifi
if profile.wifi_profile._name == 'MegaAP':
err_msg = errorcode.msg_W106
utils.send_VP_net_status_to_DCT('W106')
else:
err_msg = errorcode.msg_W107
utils.send_VP_net_status_to_DCT('W107')
# KA: [20080713] CALL Áß¿¡ ERROR´Â HangUPÀ¸·Î stage Á¤¸®ÈÄ kill VDCIApp
if status.video_mode != status.VideoIdle:
debugLogC('HANG UP - do_netchk_fail_cb')
runtime.manager.handle_key(True, config.Red)
#utils.Timer(3000, runtime.manager.vdci_deregister_kill)
# KA: [20080713] CALL Áß¿¡ ERROR´Â HangUPÀ¸·Î stage Á¤¸®ÈÄ kill VDCIApp ==
self.vdci_kill()
errorcode.set_idle_errmsg(err_msg)
runtime.manager.linkmonitor.update_idlemsg()
status.set_netstatus(status.NetNotAvailable)
status.set_regstatus(0)
status.set_register_mode(status.NotRegistered)
if cur_profile == 1: # lan
status.set_need_ping_chk_flag(True)
elif cur_profile == 2: # wifi
debugLogN('\twifi_temp_stop')
os.system('wifi_temp_stop')
runtime.manager.linkmonitor.restart_net_monitor()
def do_netchk_fail_cb(self):
debugLogN('do_netchk_fail_cb()')
err_msg = ''
cur_profile = profile.profile.get_profile()
if cur_profile == 1: # lan
# BMT 2nd : temporary...
#if runtime.idle_errmsg == errorcode.msg_M101:
# # if LAN is unplugged, do not change error mesg
# return
if not runtime.peek_lanlink():
debugLogN('skip: do_netchk_fail_cb - eth link down')
return
elif profile.lan_profile.get_dhcp():
#err_msg= errorcode.msg_M301
err_msg = errorcode.msg_M901
#errorcode.set_idle_errmsg(err_msg)
#MMW 2008.0622 network error message to dect
utils.send_VP_net_status_to_DCT('M901')
#end of MMW
else:
#err_msg = errorcode.msg_M302
err_msg = errorcode.msg_M901
#errorcode.set_idle_errmsg(err_msg)
#MMW 2008.0622 network error message to dect
#utils.send_VP_net_status_to_DCT('M302')
utils.send_VP_net_status_to_DCT('M901')
#end of MMW
elif cur_profile == 2: # wifi
#if profile.wifi_profile.essid == 'KT_SoIP':
if profile.wifi_profile._name == 'MegaAP':
err_msg = errorcode.msg_W106
#errorcode.set_idle_errmsg(err_msg)
#MMW 2008.0622 network error message to dect
utils.send_VP_net_status_to_DCT('W106')
#end of MMW
else:
err_msg = errorcode.msg_W107
#errorcode.set_idle_errmsg(err_msg)
#MMW 2008.0622 network error message to dect
utils.send_VP_net_status_to_DCT('W107')
#end of MMW
# KA: [20080713] CALL Áß¿¡ ERROR´Â HangUPÀ¸·Î stage Á¤¸®ÈÄ kill VDCIApp
if status.video_mode != status.VideoIdle:
debugLogC('HANG UP - do_netchk_fail_cb')
runtime.manager.handle_key(True, config.Red)
#utils.Timer(3000, runtime.manager.vdci_deregister_kill)
# KA: [20080713] CALL Áß¿¡ ERROR´Â HangUPÀ¸·Î stage Á¤¸®ÈÄ kill VDCIApp ==
#time.sleep(1)
self.vdci_deregister_kill(delay_msec=1000)
#self.vdci_kill(delay_msec=1000)
errorcode.set_idle_errmsg(err_msg)
runtime.manager.linkmonitor.update_idlemsg()
status.set_netstatus(status.NetNotAvailable)
status.set_regstatus(0)
status.set_register_mode(status.NotRegistered)
if cur_profile == 1: # lan
status.set_need_ping_chk_flag(True)
elif cur_profile == 2: # wifi
debugLogC('\twifi_temp_stop')
os.system('wifi_temp_stop')
runtime.manager.linkmonitor.restart_net_monitor()
# debugLogN('disable: go to idle...')
#runtime.manager.change_stage(IdleStage, True)
def do_netchk(self, background=True):
import initconf
# shchun : delay ping check by 1 sec, proc after stop call
debugLogN('do_netchk: ping check after (1) sec')
def icmp_check():
debugLogN('do_netchk: ICMP check')
err_msg = errorcode.msg_W110
debugLogN('do_netchk: ICMP check')
runtime.manager.ICMP_request(errmsg=err_msg, fail_cb=self.do_netchk_fail_cb, background=background)
runtime.tag_icmp_check = utils.Timer(1000, icmp_check)
def start_dhcpclient_bg(self, waiting_time_ms=500): # obselete
# start shchun: remove status.on_profile_changing
#if status.on_profile_changing == True:
# # ÇÁ·ÎÆÄÀÏ º¯°æ Áß, ¿Ã¶ó¿Â event´Â ¹«½Ã.
# roxia_trace('### DISCARD EVENT!!!')
# return
if profile.profile.get_profile() == 1:
self.start_dhcpclient_LAN(waiting_time_ms)
# eicho add 06.09.06
def set_renewal_dhcp(self): # obselete
print '#######################'
print '### func. set_renewal_dhcp ###'
os.system('date')
if profile.profile.get_profile() == 1:
self.start_dhcpclient_LAN(500)
else:
return False
def start_dhcpclient_LAN(self, waiting_time_ms=30000): # obselete
self.dhcp_timer_kill()
self.kill_check_dhcp_res()
import phonesetting
# if waiting_time_ms == 0:
# waiting_time_ms = 60*1000
self.dhcp_timer = utils.Timer(config.dhcp_min, phonesetting.dhcp_client1_ex)
# KA: [20080401] wifi DHCP
def start_dhcpclient_WIFI(self): # obselete
self.dhcp_timer_kill()
import phonesetting
self.dhcp_timer = utils.Timer(config.dhcp_min, phonesetting.dhcp_client2_ex)
# KA: [20080401] wifi DHCP ==
def kill_check_dhcp_res(self): # obselete
if self.check_dhcp_res != None:
del(self.check_dhcp_res)
self.check_dhcp_res = None
def after_dhcp_succ(self): # obselete
if profile.profile.get_profile() == 2:
return
# KA: 20080422] arping check-Static IPÀΰæ¿ì ifconfig eth0 UPÈÄ¿¡
#if profile.lan_profile.dhcp == 'no':
if not self.arp_request():
import uiconfig
stage = NotifyStage(_('ARP request fail'), icon = uiconfig.video_call_connect_icon)
runtime.manager.change_stage(stage)
runtime.evas.render_now()
#self.boot_start_processor = False
# start shchun: remove status.on_profile_changing
#status.on_profile_changing = False
return
# KA: 20080422] arping check-Static IPÀΰæ¿ì ifconfig eth0 UPÈÄ¿¡ ==
'''
if self.boot_start_processor:
roxia_trace( '### SUCCESS getting IP (in case of BOOTING) ###')
# KA: [20080503] new register error code
#rom vdcisetting import vdci_setting
#f vdci_setting.tel_num:
runtime.evas.timeout_add(500, self.register_in_boot)
#else:
# def noti_telnum_empty():
# self.show_no_telnum()
#
# self.start_vdciapp()
# runtime.evas.timeout_add(500, self.noti_telnum_empty)
if config.enable_sac3 :
self.start_sac3_timer()
if config.NTP_CODE_ENABLE and self.network_initialized:
self.ntp_run()
self.boot_start_processor = False
else:
'''
#roxia_trace( '### SUCCESS getting IP (in case of non BOOTING) / is_on_profilechange=', status.on_profile_changing)
#self.init_vdciapp()
#self.start_vdciapp()
from vdcisetting import vdci_setting
if vdci_setting.tel_num:
#print '### status.profile_changing = ', status.profile_changing
import phonesetting
#stage = phonesetting.AutoRegisteringStage(dereg_first=False)
#stage = RegisteringIdleStage(True)
stage = phonesetting.AutoRegisteringStage()
runtime.manager.change_stage(stage)
else:
self.start_vdciapp()
self.show_no_telnum()
# start shchun: remove status.profile_changing
#if status.profile_changing==True:
# status.profile_changing = False
if config.NTP_CODE_ENABLE and self.network_initialized:
self.ntp_run()
def cb_release_change_profile():
# start shchun: remove status.on_profile_changing
#status.on_profile_changing = False
pass
self.release_change_profile = utils.Timer(5000, cb_release_change_profile)
if self.dhcp_renewal_time >= 500:
print '### manager: make timer for DHCP_RENEWAL!!!:', self.dhcp_renewal_time
#self.set_renewal_dhcp(waiting_time_ms=self.dhcp_renewal_time)
#self.dhcp_timer = utils.Timer(self.dhcp_renewal_time, self.set_renewal_dhcp)
def set_dhcp_revdci_deregister_killnewal_time(self, time_value): # obselete
self.dhcp_renewal_time = time_value
def release_change_profile_tmr(self): # obselete
if self.release_change_profile:
del(self.release_change_profile)
self.release_change_profile = None
def vdci_deregister_kill(self, delay_msec = 0):
debugLogN('vdci_deregister_kill called: delay(%d)'%delay_msec)
def do_kill():
debugLogN('do_kill')
if runtime.vdciapp:
runtime.vdciapp.req_deregister()
time.sleep(2)
runtime.vdciapp.kill_vdciapp()
runtime.vdciapp = None
if delay_msec > 0:
self.vdci_dereg_timer = utils.Timer(delay_msec, do_kill)
else:
do_kill()
def vdci_kill(self, delay_msec = 0):
debugLogN('vdci_deregister_kill called: delay(%d)'%delay_msec)
def do_kill():
debugLogN('do_kill')
if runtime.vdciapp:
runtime.vdciapp.kill_vdciapp()
runtime.vdciapp = None
if delay_msec > 0:
self.vdci_dereg_timer = utils.Timer(delay_msec, do_kill)
else:
do_kill()
#### eicho end.
#Roxia Begin smyook 06.06.27
def dhcp_timer_kill(self):
if self.dhcp_timer:
del(self.dhcp_timer)
self.dhcp_timer = None
#Roxia End smyook
def ntp_kill_apptimer(self): # obselete
return
def ntp_restart_apptimer(self): # obselete
# not used in IP3870
'''
if setting.agenda_time and setting.agenda_date:
from alarm import agenda_activate
if not setting.register_agenda(agenda_activate):
#setting.agenda_delete()
### eicho 10.24
setting.agenda_disable()
'''
return
def ntp_24runCB(self):
# shchun: restructuring
# ntp will be run in 'idle'... stage... otherwise delay 30 second...
self.ntp_timer_remove()
debugLogN('NTP: ntp_24runCB called')
if self.stage.name in ('idle', 'networktimestage', 'missed_incomingcall' , 'MWINotify'):
self.ntp_update()
stage = runtime.manager.find_stage('idle', True)
if stage:
stage.ui.update_calendar()
return
else:
# if not idle. ntp delay to : ntp_delay_retry_interval
debugLogN('NTP: ntp_24runCB will be called in(%d)sec - not idle'%(config.ntp_delay_retry_interval/1000))
self.ntp_timer_remove()
self.ntp_timer = utils.Timer(config.ntp_delay_retry_interval, self.ntp_24runCB)
def ntp_timer_remove(self):
if self.ntp_timer:
del(self.ntp_timer)
self.ntp_timer = None
def ntp_get_server_time(self):
ntp_server_addr = setting.get_ntpserver()
if ntp_server_addr:
cmd= '/usr/local/bin/runntp %s &'%ntp_server_addr
debugLogN('NTP: RUN : cmd(%s)'%cmd)
os.system(cmd)
self.ntp_timer = utils.Timer(config.ntp_fail_retry_interval, self.proc_ntp_fail)
return True
else:
debugLogN('NTP: NO SERVER CHECK /usr/local/lgvp/ntp.cfg')
return False
#Roxia Begin jhbang 06.04.25
# def dst_update(self, adjust_hour): # obselete
#
# if adjust_hour > 0 or (adjust_hour < 0 and self.dst_rollback_completed == False):
# if config.ntp_debug:
# print '[ntp] summer time adjust. ', adjust_hour
#
# result, cur_ntptime = ntptime.load_ntptime()
# ntptime.save_ntptime(cur_ntptime + (adjust_hour *3600))
#
# if adjust_hour < 0:
# self.dst_rollback_completed = True
# if config.ntp_debug:
# print '[ntp] dst cancelled by force'
#
# self.dst_timer = None
# #status.date_time_ready = old_date_ready
# return False
#Roxia End jhbang
def ntp_update(self):
status.ntp_running = True
result = self.ntp_get_server_time()
# status.ntp_running = False # background ....
# if result:
# self.dst_rollback_completed = False
return result
#Roxia End jhbang
def ntp_dayrun(self): # obelete
debugLogN('ntp_dayrun')
pass
# self.ntp_timer_remove()
## self.ntp_timer = utils.Timer(24*60*config.min, self.ntp_24runCB)
# if status.date_time_ready:
# self.ntp_timer = utils.Timer(60*config.min, self.ntp_24runCB)
# else:
# self.ntp_timer = utils.Timer(config.min, self.ntp_24runCB)
def ntp_run(self):
if not setting.ntp_enable:
return False
self.ntp_timer_remove()
if config.NTP_CODE_ENABLE:
self.ntp_update()
#self.ntp_dayrun()
def register_in_boot(self):
#self.init_vdciapp()
import uiconfig
from vdcisetting import vdci_setting
cur_profile = profile.profile.get_profile()
debugLogC('RUN: REGISTER_IN_BOOT cur_profile(%d), status.\LanConnected(%d) status.wifi_connected(%d)'%(cur_profile, status.LanConnected, status.wifi_connected))
def success_cb():
if self.check_settings():
stage = RegisteringIdleStage()
#elif not vdci_setting.tel_num:
# debugLogC('SET_TIMER: self.noti_telnum_empty in (%d) sec'%(1000/1000))
# runtime.evas.timeout_add(1000, self.noti_telnum_empty)
# return
else:
#msg = _('Please use after register to server')
msg = _('Please, subscribe first')
stage = ManagerNotifyStage(msg, icon = uiconfig.video_call_connect_icon)
# shchun : set idle mesg
errorcode.set_idle_errmsg(_('Please, subscribe first'))
runtime.manager.linkmonitor.update_idlemsg()
# end shchun
if runtime.vdciapp:
runtime.vdciapp.kill_vdciapp()
# start shchun: remove status.on_profile_changing
#status.on_profile_changing = False
runtime.manager.change_stage(stage, True)
# message disp
err_msg = ''
if cur_profile == 1: # lan
if profile.lan_profile.get_dhcp():
#err_msg = errorcode.msg_M301
err_msg = errorcode.msg_M901
else:
#err_msg = errorcode.msg_M302
err_msg = errorcode.msg_M901
elif cur_profile == 2: # wifi
#if profile.wifi_profile.essid == 'KT_SoIP':
if profile.wifi_profile._name == 'MegaAP':
err_msg = errorcode.msg_W106
else:
err_msg = errorcode.msg_W107
self.ICMP_request_disabled(success_cb,errmsg=err_msg)
return
def proc_ntp_fail(self):
debugLogC('NTP: NTP_FAIL: ntp_24runCB will be called in(%d)sec'%(config.ntp_fail_retry_interval/1000))
ntptime.set_ntpadjust() # if fail, use previous success data...
self.ntp_timer_remove()
self.ntp_timer = utils.Timer(config.ntp_fail_retry_interval, self.ntp_24runCB)
status.ntp_running = False
setting.current_time = int(ntptime.ntime())
setting.save()
if runtime.manager.stage.get_name() == 'idle':
runtime.manager.stage.update_calendar()
# eicho add warning. 129 in NB 06.10.20
def start_alarm(self):
# download installÀÌ ƒP³ª°í rebootÇÑ µÚ, auto-configuration Çϱâ Àü¿¡.
print 'start_alarm'
import status
status.restore_status()
## eicho 06.07.04
def start_vdciapp(self):
'''
from vdcisetting import vdci_setting
if vdci_setting.tel_num:
'''
import vdciapp
status.videocall_dimension = setting.video_dimension
if runtime.vdciapp == None:
runtime.vdciapp = vdciapp.VDCIApp()
runtime.vdciapp.run_vdciapp()
time.sleep(1)
runtime.vdci_startup()
def init_vdciapp(self):
import vdciapp
status.videocall_dimension = setting.video_dimension
if runtime.vdciapp == None:
runtime.vdciapp = vdciapp.VDCIApp()
runtime.vdciapp.run_vdciapp()
def noti_telnum_empty(self):
import uiconfig
stage = NotifyStage(_('The telephone number of VoIP is not formed.'), uiconfig.video_call_connect_icon, None, 3000)
self.change_stage(stage)
status.critical_entered = True
#status.on_profile_changing = False
def on_network_initialized(self):
self.network_initialized = True
from vdcisetting import vdci_setting
if status.video_mode != status.VideoIdle:
debugLogN('skip: on_network_initialized, in call')
return
# Jun13: move snmpd.
debugLogN('on_network_initialized: prefix_set (%d)'%(setting.prefix_set))
if status.get_need_ping_chk_flag():
debugLogN('skip: on_network_initialized, need ping chk')
runtime.manager.linkmonitor.del_do_monitor_cool_flag()
runtime.manager.linkmonitor.do_monitor(background=True, force=True)
return True
debugLogC('SET_TIMER: self.register_in_boot in (%d) msec'%(1000/1000))
self.tag_register_in_boot = runtime.evas.timeout_add(1000, self.register_in_boot)
# ka...2008.06.24: move to register_in_boot
#self.init_vdciapp()
#runtime.vdci_startup()
#if status.is_restart:
# return True
if config.NTP_CODE_ENABLE:
self.ntp_run()
def proc_keypad_light(self):
keypadLightFile = open('/proc/sys/lvp3870/key_led', 'w')
keypadLightFile.write('1')
keypadLightFile.close()
def keypadLightOff():
self.keypadLightTag = None
keypadLightFile = open('/proc/sys/lvp3870/key_led', 'w')
keypadLightFile.write('0')
keypadLightFile.close()
self.keypadLightTag = utils.Timer(config.keypad_led_on_time, keypadLightOff)
def handle_key(self, down, key):
roxia_event('manager.handle_key(), stage=', self.stage.get_name(), 'down=', down, 'key=', key)
# shchun : do key pad light only if key is tangible
if key not in (config.key_link_up, config.key_link_down, config.key_wifi_link_up, config.key_wifi_link_down, config.key_ip_changed, config.key_wifi_auth_fail, config.key_ntp_success, config.key_ntp_fail ):
self.proc_keypad_light()
setting.reset_screen_saver_timer()
if status.MMI_KEY_BLOCK:
if key in (config.key_ip_changed, config.key_wifi_link_down, config.key_wifi_link_up, \
config.key_link_up, config.key_link_down, \
config.key_wifi_auth_fail, config.key_ntp_success, config.key_ntp_fail):
pass
else:
if not runtime.eaHandler.isAppInUse():
runtime.mmiDebug.mmiTrace('KEY BLOCKED : return VM CLEAR??')
return
# KA:[20081002] BaseÈ£ Áß BANKING½ÇÇà
#destination = runtime.eaHandler.getForeground().getName()
#if destination == 'BANKING' and \
# (runtime.manager.find_stage('AudioCallConnected') or \
# runtime.manager.stage.get_name() == 'AudioCallConnected'):
# if key == config.Red and down:
# runtime.manager.back_stage('AudioCallConnected')
# #runtime.manager.stage.handle_key(config.Red)
# elif key in (config.OnHook, config.OffHook, config.Green) and down:
# runtime.manager.back_stage('AudioCallConnected')
# else:
# return True
#KA:[20081002] BaseÈ£ Áß BANKING½ÇÇà ==
#else:
runtime.mmiDebug.mmiTrace('KEY BLOCKED : return VM Activated')
if key == config.Red and down:
runtime.vmHandler.VM_REDKEY_PRESSED()
elif key == config.Red and not down:
runtime.vmHandler.VM_REDKEY_RELEASED()
return True
# kakim: sms_notify destory
if status.mms_notify_exist and down:
if key in (config.OffHook, config.OnHook, config.Green):
runtime.manager.stage.SMS_Notify_free()
elif key == config.TS1_OFF_HOOK:
pass
else:
runtime.manager.stage.SMS_Notify_free()
return True
# hcryoo : KT ½ºÆå¿¡ ¸Â°Ô ÀÏ´Ü EnblockEditStage·Î ¿Å±è. : OK - shchun
# shchun dhcp restructure
if key ==config.key_ip_changed and down: # profile changeÁß¿¡´Â °¢°¢ÀÇ Stage¿¡¼ ó¸®
debugLogC('IP_CHANGED: cur_profile(%d) profname(%s), dhcp(%s)'%(profile.profile.get_profile(),profile.wifi_profile._name, profile.wifi_profile.dhcp))
runtime.manager.linkmonitor.restart_net_monitor()
# do not change mmi stage on running browser
curr_stage_name = runtime.manager.stage.get_name()
if ((curr_stage_name == 'myann') or (runtime.manager.find_stage('myann'))):
print "[manager] do nothing on running browser"
return
cur_profile = profile.profile.get_profile()
# check if dhcp ip changed...
t_ipaddr = None
if (cur_profile == 1 and profile.lan_profile.dhcp == 'yes' ):
t_ipaddr = utils.get_address('eth')[0][1]
elif (cur_profile == 2 and profile.wifi_profile.dhcp == 'yes' ):
t_ipaddr = utils.get_address('wlan')[0][1]
if t_ipaddr and self.cur_ipaddr and t_ipaddr != self.cur_ipaddr:
debugLogC('DHCP_IP_CHANGED!!!: (%s) --> (%s) - RESTART APP'%(t_ipaddr, self.cur_ipaddr))
os.system('sync')
time.sleep(0.2)
os.system('killall QtPythonUI')
return True
else :
self.cur_ipaddr = t_ipaddr
#debugLogC('DHCP_IP_CHANGED: IP(%s)'%(self.cur_ipaddr))
# shchun : regardless dhcp or not ip change will be happen.
if (cur_profile == 1 and profile.lan_profile.dhcp == 'yes' ) or \
(cur_profile == 2 and profile.wifi_profile.dhcp == 'yes' ):
#if status.network_status in (status.NetLinkOk): # expected.
if status.network_status in (status.NetLinkOk, status.NetNotAvailable): # expected.
#status.set_netstatus(status.NetIPOk)
debugLogN('ip_change: skip net test')
status.set_netstatus(status.NetOk)
if status.get_regstatus() == 1:
debugLogN('link up --> vdci')
runtime.vdci_LinkUp()
return
from profile import dns_profile
dns_profile.load()
#errorcode.set_idle_errmsg('')
errorcode.set_idle_errmsg('', delay_msec=2000, refresh=False)
runtime.manager.linkmonitor.update_idlemsg()
if config.NTP_CODE_ENABLE:
runtime.manager.ntp_run()
# comment out by shchun - if dhcp lease time is frequent, this happens too much
# elif status.network_status == status.NetOk:
# debugLogC('ipchanged: link up --> vdci')
# runtime.vdci_LinkUp()
# return
else: # not expected - we will have multiple ip_chnaged due to dhcp internal retry
debugLogN('IP_CHANGED: discarded cur_status(%d)'%status.network_status)
return
stage = runtime.manager.find_stage('init ipnetwork', True)
stage2 = runtime.manager.find_stage('reinit ipnetwork', True)
if stage:
stage.dhcp_success()
elif stage2:
stage2.dhcp_success()
else:
runtime.manager.linkmonitor.dhcp_success()
# background dhcp stop
runtime.manager.linkmonitor.toTimer = None
self.on_network_initialized()
return
elif key == config.key_wifi_link_down and down:
debugLogC('WIFI_DOWN_KEY: cur_profile(%d)'%profile.profile.get_profile())
# do not change mmi stage on running browser
#curr_stage_name = runtime.manager.stage.get_name()
#if ((curr_stage_name == 'myann') or (runtime.manager.find_stage('myann'))):
# print "[manager] do nothing on running browser"
# return
if profile.profile.get_profile() == 2:
# profile changeÁß¿¡´Â À̺¥Æ® ¹«½Ã -- ½ÇÁ¦ WIFI Link DownÀÎ °æ¿ì´Ù. ifconfig down »óÅÂ
debugLogN('link down --> vdci')
runtime.vdci_LinkDown()
#status.set_need_ping_chk_flag(True) # WIFI_PING_CHECK - Flags...
runtime.vmHandler.ERR_NETWORK_LINE_OUT()
if status.video_mode != status.VideoIdle:
debugLogN('HANG UP - link down')
runtime.manager.handle_key(True, config.Red)
#else:
# # QA requested when link down go to idle stage.
# if runtime.manager.stage.get_name() != 'idle':
# runtime.manager.change_stage(IdleStage, True)
if status.get_regstatus() == 1:
message = errorcode.msg_W109
errorcode.set_idle_errmsg(message)
#MMW 2008.07.02 to change registration to not registered
# if runtime.dectCallManager.isSubcribedDect():
# runtime.dectCallManager.unregisterstatusReport()
#end of MMW
#MMW 2008.0622 network error message to dect
utils.send_VP_net_status_to_DCT('W109')
#end of MMW
status.set_netstatus(status.NetNotAvailable)
status.wifi_connected = False
# TO IMPROVE : delay 1 sec
os.system('killall -9 snmptrap')
status.set_regstatus(0)
status.set_register_mode(status.NotRegistered)
if runtime.manager.stage.get_name() == 'idle':
runtime.manager.stage.ui.update_register()
# DHCP
#if profile.wifi_profile.dhcp == 'yes':
if runtime.vdciapp:
runtime.vdciapp.kill_vdciapp()
runtime.vdciapp = None
def post_cb():
stage = runtime.manager.find_stage('idle', True)
if stage:
stage.ui.update_my_number()
runtime.manager.back_stage()
import uiconfig
#runtime.manager.stack_stage(NotifyStage(_('check wifi connection'), uiconfig.baloon_setting_system_network_wireless_icon))
#err_msg =initconf.euckr2utf8(errorcode.msg_W109)
#runtime.manager.stack_stage(NotifyStage(err_msg, uiconfig.baloon_setting_system_network_wireless_icon, cb=post_cb))
#errorcode.set_idle_errmsg(err_msg)
#MMW 2008.0622 network error message to dect
#block W109
'''
from dectHandler import DectCallManager
dectStatus = runtime.dectCallManager.getDectStatus()
if dectStatus == DectCallManager.CONNECTED:
runtime.dectCallManager.serverStopCall()
if runtime.dectCallManager.isSubcribedDect():
runtime.dectCallManager.sendLinkDownReport()
'''
#end of MMW
return
# start shchun: remove status.on_profile_changing
elif key == config.key_wifi_link_up and down:
debugLogC('WIFI_UP_KEY: cur_profile(%d) profname(%s), dhcp(%s)'%(profile.profile.get_profile(),profile.wifi_profile._name, profile.wifi_profile.dhcp))
# do not change mmi stage on running browser
#curr_stage_name = runtime.manager.stage.get_name()
#if ((curr_stage_name == 'myann') or (runtime.manager.find_stage('myann'))):
# print "[manager] do nothing on running browser"
# return
if profile.profile.get_profile() == 2:
status.set_netstatus(status.NetLinkOk)
# profile changeÁß¿¡´Â À̺¥Æ® ¹«½Ã -- ½ÇÁ¦ WIFI Link Up ÀÎ °æ¿ì´Ù. ifconfig UP »óÅÂ
status.wifi_connected = True
runtime.trapHandler.linkUpTrap()
runtime.vmHandler.ERR_NETWORK_LINE_IN()
#MMW 2008.0622 network error message to dect
# KT lim want to show just wifi connecting before register
# if runtime.dectCallManager.isSubcribedDect():
# print 'wifi link up to DCT !!!!!!!!!!!!!!!!!!!!!!!'
# runtime.dectCallManager.sendLinkUpReport()
#end of MMW
stage = runtime.manager.find_stage('init ipnetwork', True)
stage2 = runtime.manager.find_stage('reinit ipnetwork', True)
if stage:
stage.link_up()
elif stage2:
stage2.link_up()
#else:
# print 'ka......LINK UP after booting'
# if runtime.vdciapp:
# return
runtime.manager.linkmonitor.restart_net_monitor()
if profile.wifi_profile.dhcp == 'yes':
stage = runtime.manager.find_stage('init ipnetwork', True)
stage2 = runtime.manager.find_stage('reinit ipnetwork', True)
if stage:
stage.dhcp_start()
elif stage2:
stage2.dhcp_start()
else:
#os.system('wifi_dhcp &')
runtime.manager.linkmonitor.dhcp_start()
return
elif profile.wifi_profile.dhcp == 'no':
status.set_netstatus(status.NetIPOk)
#status.set_netstatus(status.NetOk)
def success_cb():
# IP alloc trap - wifi static.
#os.system('ipexpire_noti.sh 0 0 0 &')
self.on_network_initialized()
return
runtime.manager.ARP_request(success_cb=success_cb)
else:
pass
return
# KA: [20080402] NEW WIFI ==
#if key == config.key_link_up and status.LanConnected == False and down:
elif key == config.key_link_up and down:
#if self.link_timer:
# self.link_timer = None
# # ping ÇØº¸°í ÀÌ»óÇϸé Àç½ÃÀÛ.
# self.do_network_check()
status.LanConnected = True
runtime.manager.linkmonitor.restart_net_monitor()
print 'ERROR_MSG', errorcode.get_idle_errmsg(), errorcode.msg_M101
if errorcode.get_idle_errmsg() == errorcode.msg_M101:
#message= errorcode.msg_Wait # same with M301
message= errorcode.msg_M102# same with M301
errorcode.set_idle_errmsg(message)
runtime.manager.linkmonitor.update_idlemsg()
debugLogC('ETH_LINK_UP, status.LanConnected(%d)'%(status.LanConnected))
# do not change mmi stage on running browser
#curr_stage_name = runtime.manager.stage.get_name()
#if ((curr_stage_name == 'myann') or (runtime.manager.find_stage('myann'))):
# print "[manager] do nothing on running browser"
# return
#if status.LanConnected == False:
if profile.profile.get_profile() == 1:
runtime.vmHandler.ERR_NETWORK_LINE_IN()
if status.get_regstatus() == 1:
# dhcp case ... Jul03 by shchun
if profile.lan_profile.dhcp == 'no':
def success_cb():
if config.NTP_CODE_ENABLE:
runtime.manager.ntp_run()
if runtime.manager.stage.get_name() == 'user information':
debugLogN('skip: REG - user information stage')
return
debugLogN('key link up: link up--> vdci')
runtime.vdci_LinkUp()
runtime.manager.ARP_request(success_cb=success_cb)
else:
runtime.manager.linkmonitor.dhcp_start()
return
status.set_netstatus(status.NetLinkOk)
if runtime.dectCallManager.isSubcribedDect():
runtime.dectCallManager.sendLinkUpReport()
runtime.trapHandler.linkUpTrap()
if status.network_status in (status.NetLinkOk, status.NetNotAvailable):
# ka...2008.06.24: ½ÇÁ¦ IP»ì¸° ÈÄ vdci¸¦ »ì¸®µµ·Ï
#self.start_vdciapp() # VDCI°¡ ¾øÀ¸¸é, »ì¸®°í startup ÇÑ´Ù.
#if config.NTP_CODE_ENABLE and self.network_initialized:
# self.ntp_run()
#if len(runtime.idle_errmsg) > 0:
# errorcode.set_idle_errmsg('')
# runtime.manager.linkmonitor.update_idlemsg()
stage = runtime.manager.find_stage('init ipnetwork', True)
stage2 = runtime.manager.find_stage('reinit ipnetwork', True)
if stage:
stage.link_up()
elif stage2:
stage2.link_up()
#else:
# print 'ka......LINK UP after booting'
# if runtime.vdciapp:
# return
if profile.lan_profile.dhcp == 'yes':
status.LanConnected = True
#self.make_dhcp_try_by_event()
# mod_shchun
#os.system('eth0_start&')
runtime.manager.linkmonitor.restart_net_monitor()
if runtime.manager.stage.get_name() == 'idle':
runtime.manager.stage.ui.update_register()
runtime.evas.render_now()
stage = runtime.manager.find_stage('init ipnetwork', True)
stage2 = runtime.manager.find_stage('reinit ipnetwork', True)
if stage:
stage.dhcp_start()
elif stage2:
stage2.dhcp_start()
else:
#os.system('eth0_start&')
runtime.manager.linkmonitor.dhcp_start()
else: #interface is fixed by manual.
# change LAN-connected icon.
status.LanConnected = True
if runtime.manager.stage.get_name() == 'idle':
runtime.manager.stage.ui.update_register()
runtime.evas.render_now()
# KA: [20080420] new register
os.system('eth0_start') # eth0_start as foreground when static IP.
status.set_netstatus(status.NetIPOk)
#status.set_netstatus(status.NetOk)
def success_cb():
debugLogN('key link up: link up --> vdci - @arp_success_cb')
runtime.vdci_LinkUp()
self.on_network_initialized()
runtime.manager.ARP_request(success_cb=success_cb)
elif key == config.key_link_down and down:
debugLogC('### ETH_LINK_DOWN videomode(%d)'%status.video_mode)
# do not change mmi stage on running browser
#curr_stage_name = runtime.manager.stage.get_name()
#if ((curr_stage_name == 'myann') or (runtime.manager.find_stage('myann'))):
# print "[manager] do nothing on running browser"
# return
if profile.profile.get_profile() == 1:
debugLogN('link down --> vdci')
runtime.vdci_LinkDown()
runtime.vmHandler.ERR_NETWORK_LINE_OUT()
#status.set_need_ping_chk_flag(True)
if status.video_mode != status.VideoIdle:
debugLogN('HANG UP - lan link down')
runtime.manager.handle_key(True, config.Red)
else:
# QA requested when link down go to idle stage.
# NEW : remove exceptions.... per RND-QA agreement.
if runtime.eaHandler.isAppInUse():
#currentApplication = runtime.eaHandler.getDestination().getName()
#if currentApplication == 'MMSC':
# runtime.eaHandler.startCallWithoutNumber('MMSC', key)
#elif currentApplication == 'BROWSER':
# runtime.eaHandler.startCallWithoutNumber('BROWSER', key)
pass
else:
curr_stage_name = runtime.manager.stage.get_name()
if curr_stage_name != 'idle':
setting.stop_slideshow()
runtime.manager.change_stage(IdleStage, True)
stage = runtime.manager.find_stage('init ipnetwork', True)
stage2 = runtime.manager.find_stage('reinit ipnetwork', True)
err_msg = errorcode.msg_M101
errorcode.set_idle_errmsg(err_msg)
runtime.manager.linkmonitor.update_idlemsg()
if stage or stage2:
runtime.manager.change_stage(IdleStage, True)
print 'no init ipnetwork stage, just return'
return
# shchun : keep link up... when link down.
status.set_netstatus(status.NetNotAvailable)
# TO IMPROVE : delay 1 sec
os.system('killall -9 snmptrap')
print 'change status.lanconnected = false'
status.LanConnected = False
message = errorcode.msg_M101
#errorcode.set_idle_errmsg(message)
#MMW 2008.0622 network error message to dect
utils.send_VP_net_status_to_DCT('M101')
#end of MMW
if runtime.manager.stage.get_name() == 'idle':
runtime.manager.stage.ui.update_register()
from dectHandler import DectCallManager
dectStatus = runtime.dectCallManager.getDectStatus()
if dectStatus == DectCallManager.CONNECTED:
runtime.dectCallManager.serverStopCall()
if runtime.dectCallManager.isSubcribedDect():
runtime.dectCallManager.sendLinkDownReport()
self.link_timer = None
elif key == config.key_wifi_auth_fail and down:
if self.wifi_auth_notified > 0:
self.wifi_auth_notified = self.wifi_auth_notified - 1
print 'skip: key_wifi_auth_fail', self.wifi_auth_notified
return True
self.wifi_auth_notified = 30
import uiconfig
debugLogC('Status: key wifi auth fail.')
# do recovery procedure...
message = errorcode.msg_W102
errorcode.set_idle_errmsg(message)
runtime.manager.change_stage(IdleStage, True)
#MMW 2008.0622 network error message to dect
utils.send_VP_net_status_to_DCT('W102')
#end of MMW
#stage = NotifyStage(message, icon = uiconfig.video_call_connect_icon)
#runtime.manager.stack_stage(stage)
return True
elif key == config.key_ntp_success and down:
debugLogC('NTP: NTP_SUCCESS: ntp_24runCB will be called in(%d)sec'%(config.ntp_success_retry_interval/1000))
ntptime.set_ntpadjust()
self.ntp_timer_remove()
status.date_time_ready = True
self.ntp_timer = utils.Timer(config.ntp_success_retry_interval, self.ntp_24runCB)
status.ntp_running = False
setting.current_time = int(ntptime.ntime())
setting.save()
if runtime.manager.stage.get_name() == 'idle':
runtime.manager.stage.update_calendar()
elif key == config.key_ntp_fail and down:
debugLogC('NTP: fail key')
self.proc_ntp_fail()
elif key == config.VideoMute and down:
debugLogC('*Status: Net(%d), Reg(%d/%d), Wprof/Pingchk/isBusy(%s/%d/%d)'%(status.network_status, status.get_register_mode(), status.get_regstatus(), profile.wifi_profile._name, status.get_need_ping_chk_flag(), runtime.manager.linkmonitor.monitorBusyFlag ))
debugLogN('*IDLE_MSG: %20s'%initconf.utf82euckr(runtime.idle_errmsg))
debugLogN('*CUR_STAGE: %s, BACK:'%runtime.manager.stage.get_name(), runtime.manager.back)
debugLogC('*NTP: running(%d)'%status.ntp_running)
#self.ntp_update() # for debug
if self.interrupt_queued:
roxia_event('self.interrupt_queued TRUE')
self.key_queue.append((down, key))
return
#setting.reset_screen_saver_timer()
if status.screensaver_activated:
if key == config.OffHook:
status.screensaver_activated_byhook = True
else:
if config.key_debug:
print 'Manager:handle_key(), lcd is off now...key ignore'
status.screensaver_activated = False
return
status.screensaver_activated = False
if utils.is_dtmf(key):
roxia_event('manager.handle_key(), is_dtmf() TRUE, dtmf key=', key, 'down=', down)
if down:
if not self.handle_dtmf(key[1]):
self.stage.handle_key(key)
return True
# editing, last_key
if not status.editing and not down and status.last_key != key:
if config.key_debug:
print 'Up: but key is not last pressed key', 'key:', key, 'last:', status.last_key
return
runtime.mmiDebug.mmiTodo('CHECK sending_dtmf')
#if key == config.Menu2:
if key == 'CLR':
roxia_event('manager.handle_key(), press *CLR*')
# handle long key
if down:
def long_key():
if config.key_debug:
print 'generate Long CLR key'
self.stage.handle_key(config.LongMenu2)
self.long_key_tag = None
return False
self.long_key_tag = utils.Timer(config.long_key_interval, long_key)
else:
self.long_key_tag = None
# KA: [20080506] long key ó¸® -speed dialing
if key in '0123456789#*' and (self.stage.name == 'idle' or self.stage.name == 'enblock edit'):
if down:
self.pressed_key = key
def long_key():
if config.key_debug:
print 'generate Long key'
#print 'ka...............LONG + self.pressed_key=', 'Long' + self.pressed_key
self.stage.handle_key('Long' + self.pressed_key)
self.reset_longkey()
return False
self.long_key_tag = utils.Timer(config.long_key_interval, long_key)
else:
#down = True
self.reset_longkey()
# KA: [20080506] long key ó¸® -speed dialing
if not down:
return True
status.last_key = key
if key in '0123456789#*' and self.stage.name == 'idle':
pass
elif key in '0123456789#*' and self.stage.name == 'enblock edit':
pass
#elif key in '0123456789#*' and self.stage.name == 'enblock edit':
# if runtime.SP_context.isKeyTonePlaying():
# utils.player.play_keytone(key)
else:
utils.player.play_keytone(key)
ret = self.stage.handle_key(key)
if ret:
return
if key == config.OffHook:
status.missed_call_count = 0
self.handle_offhook()
elif key == config.Green:
roxia_event('manager.handle_key(), press *Green*')
# KA: 20071123] KT DEMO CallHistory/CallLog ¹ß½Å
status.videocall_byuser = False
self.handle_green()
# KA: 20071123] KT DEMO ==
elif key == config.Red:
roxia_event('manager.handle_key(), press *Red*')
self.handle_red()
elif key == config.Video:
if status.phone_status in (status.Disconnected, status.Dialing):
if runtime.manager.stage.get_name() == 'incoming':
return
roxia_event('manager.handle_key(), press *Video*')
status.videocall_byuser = True
self.handle_green(isvideokey=True)
#elif down and key in ('Left', 'Right', 'Up', 'Down', '*', '#') and runtime.manager.stage.get_name =='Calculator':
elif key in ('Left', 'Right', 'Up', 'Down', '*', '#') and runtime.manager.stage.get_name() =='Calculator':
#self.proc_keypad_light()
self.stage.handle_key(self,key,down)
return
def reset_longkey(self):
self.pressed_key = None
self.long_key_tag = None
def handle_hook_event(self, hook):
roxia_event('manager.handle_hook_event(), hook=' + hook)
def onhook_timeout():
#ÃæºÐÇÑ ½Ã°£µ¿¾È OnHook »óÅ¿´´Ù
if config.key_debug:
print '[On Hook: timeout]'
roxia_trace('stage='+self.stage.get_name())
if not self.stage.handle_key(config.OnHook):
roxia_trace('manager.handle_hook_event(), run handle_onhook()')
self.handle_onhook()
del(self.hook_timer)
self.hook_timer = None
return False
if hook == config.OnHook:
# Àüȱ⸦ ³õ¾Ò´Ù
if config.key_debug:
print '[On Hook]'
if status.phone_hook:
return True
self.hook_timer = utils.Timer(config.onhook_interval, onhook_timeout)
status.phone_hook = True
else:
# Àüȱ⸦ ´Ù½Ã µé¾ú´Ù
if self.hook_timer:
# ºü¸¥ ½Ã°£¿¡ Àüȸ¦ ²÷¾ú´Ù ´Ù½Ã µë. Hook Flash¸¦ º¸³½´Ù
if config.key_debug:
print 'On Hook -> Off Hook audio state', status.modem_audio_state
if status.modem_audio_state != status.IDLE:
def send_flash():
if status.phone_status != status.PPPConnected :
if profile.ip_mode == 0:
try:
dspg.send_dtmf('R', False)
if status.dial_number:
status.set_dial_number(status.dial_number + 'R')
if status.dial_number and runtime.manager.stage.get_name() == 'connected':
runtime.manager.stage.update_number()
except:
pass
status.hook_flash_tag = 0
return False
if not status.hook_flash_tag:
if status.video_mode != status.VideoConnected:
status.hook_flash_tag = runtime.evas.idle_add(send_flash)
self.hook_timer = None
else:
#ÀÏÁ¤½Ã°£ÈÄ ´Ù½Ã Àüȱ⸦ µé¾ú´Ù
if config.key_debug:
print '[Off Hook]'
status.missed_call_count = 0
if not status.phone_hook:
return
if not self.stage.handle_key(config.OffHook):
self.handle_offhook()
status.phone_hook = False
def handle_call_action(self, key):
roxia_event('manager.handle_call_action(), key=', key)
if status.ring_count >= 1:
# IncomingȸéÀ¸·Î ¹Ù²î±âÀü¿¡ Green/OffHook۸¦ ´·¶´Ù.
self.cid_waiter = 0
self.change_stage(IncomingStage, True)
self.stage.handle_key(key)
return
status.dtmf_overlap_mode = False
self.change_stage(EnblockEditStage, True)
# eicho modify 06.04.12
def handle_call_action_old(self, key):
roxia_event('manager.handle_call_action(), key=', key)
if status.ring_count >= 1:
# IncomingȸéÀ¸·Î ¹Ù²î±âÀü¿¡ Green/OffHook۸¦ ´·¶´Ù.
self.cid_waiter = 0
self.change_stage(IncomingStage, True)
self.stage.handle_key(key)
return
if status.editing_phone_number_index >= 0:
#assert not status.dial_number
# eicho add 06.04.12
if status.screensaver_activated_byhook :
status.screensaver_activated_byhook = False
#print 'eicho))) BLOCKING CALL during SCREENSAVER!!! (1)'
else:
index = status.editing_phone_number_index
status.editing_phone_number_index = -1
from phonedb import phonedb
item = phonedb.get_item(index)
if item[1] and item[2]:
if profile.ip_mode == 0:
self.change_stage(OffHookStage, True)
else:
status.dtmf_overlap_mode = False
self.change_stage(EnblockEditStage, True)
self.stack_stage(DetailDialStage(item, call_only=True))
return
number = item[1] or item[2] # number or mobile
if number:
self.start_call(number)
return
else:
pass
# eicho end.
elif status.emergency_call_number:
# eicho modify 06.04.12
if status.screensaver_activated_byhook == False:
self.start_call(status.emergency_call_number)
status.emergency_call_number = None
return
status.screensaver_activated_byhook = False
elif status.calldb_editing_index >= 0:
#assert not status.dial_number
# eicho add 06.04.12
if status.screensaver_activated_byhook :
status.screensaver_activated_byhook = False
else:
import calldb
detail = calldb.get_detail(status.calldb_editing_type, status.calldb_editing_index)
number = detail.number
if number and number not in ('P', 'O'):
self.start_call(number)
return
'''
import calldb
detail = calldb.get_detail(status.calldb_editing_type, status.calldb_editing_index)
number = detail.number
if number and number not in ('P', 'O'):
print 'eicho))) STEP 7 ------------'
self.start_call(number)
return
'''
# eicho end.
elif status.dial_number:
if profile.ip_mode == 0:
self.start_call(status.dial_number)
else:
pass
return
if profile.ip_mode == 0:
if status.videocall_byuser == True:
status.dtmf_overlap_mode = False
stage = EnblockEditStage()
self.change_stage(stage, True)
else:
self.change_stage(OffHookStage, True)
else:
status.dtmf_overlap_mode = False
stage = EnblockEditStage()
self.change_stage(stage, True)
def handle_green(self, isvideokey=False):
roxia_event('manager.handle_green()')
if not status.get_regstatus_mmi():
import uiconfig
stage = RegiNotifyStage(_('Please use after register to server'), uiconfig.baloon_call_log_icon)
runtime.manager.change_stage(stage, True)
return True
# playing ÁßÀÏ °æ¿ì¿¡´Â player ¸¦ ¸ÕÀú stop ½ÃŲ´Ù.
if utils.player.playing() and \
status.videocall_mode == status.VideoCallDisconnected and \
status.phone_status == status.Disconnected:
if profile.ip_mode != 0 and status.modem_audio_state == status.HS:
pass
else:
utils.player.stop()
import uiconfig
from dectHandler import DectCallManager
dectStatus = runtime.dectCallManager.getDectStatus()
if dectStatus != DectCallManager.IDLE:
spkOffHook = runtime.SP_context.SPK_OffHook()
if spkOffHook.next():
spkOffHook.next()
runtime.SP_context.speaker.setStatus(Device.OFF_HOOK)
runtime.SP_context.setBaseStatus(SP_Context.BUSY)
runtime.SP_context.speaker.setTone(config.PLAY_BUSY_TONE)
runtime.SP_context.SP_stereoStopPlayback()
runtime.SP_context.dect1.clearTone()
stage = InUseByDectStage()
runtime.manager.change_stage(stage)
else:
import calldb, callhistory
missed_lists = calldb.get_list('missed')
dialed_lists = calldb.get_list('dialed')
received_lists = calldb.get_list('received')
if (len(missed_lists) == 0) and (len(dialed_lists) == 0) and (len(received_lists) == 0):
stage = NotifyStage(_('Empty call history'), uiconfig.baloon_call_log_icon)
runtime.manager.change_stage(stage, True)
return
runtime.manager.change_stage(callhistory.CallHistoryStage('recent'), True)
# menu surfing only in IDLE SP state
'''
MD.mmiTrace('consider menu surfing at phonebook in SPK or HS mode')
runtime.mmedia.unload()
runtime.SP_context.goIdleState()
time.sleep(0.5)
spkOffHook = runtime.SP_context.SPK_OffHook()
if spkOffHook.next(): # function callable
spkOffHook.next() # speak off
runtime.SP_context.speaker.setStatus(Device.OFF_HOOK)
from dectHandler import DectCallManager
dectStatus = runtime.dectCallManager.getDectStatus()
if dectStatus == DectCallManager.IDLE:
#if key == config.Green:
runtime.SP_context.setBaseCallStatus(SP_Context.OUTGOING_AUDIO)
#elif key == config.Video:
# runtime.SP_context.setBaseCallStatus(SP_Context.OUTGOING_VIDEO)
runtime.SP_context.setBaseStatus(SP_Context.DIALING)
runtime.SP_context.speaker.setTone(config.PLAY_DIAL_TONE)
MD.mmiTrace('SET BASE IN USE by SPK OFF HOOK ***')
runtime.manager.handle_call_action(config.Green)
else:
runtime.SP_context.setBaseStatus(SP_Context.BUSY)
runtime.SP_context.speaker.setTone(config.PLAY_BUSY_TONE)
runtime.SP_context.dect1.clearTone()
stage = InUseByDectStage()
runtime.manager.change_stage(stage)
'''
def handle_green_old(self, isvideokey=False):
roxia_event('manager.handle_green()')
# playing ÁßÀÏ °æ¿ì¿¡´Â player ¸¦ ¸ÕÀú stop ½ÃŲ´Ù.
if utils.player.playing() and \
status.videocall_mode == status.VideoCallDisconnected and \
status.phone_status == status.Disconnected:
if profile.ip_mode != 0 and status.modem_audio_state == status.HS:
pass
else:
utils.player.stop()
import model
# idle »óÅ¿¡¼ Green ¹öưÀ» ´·¶À½
if status.modem_audio_state == status.IDLE:
roxia_event('status.IDLE -> *status.SPK*')
if 0:
self.emergency_save_green()
else:
if status.save_callback_other:
self.emergency_save_other()
status.set_modem_audio_state(status.SPK)
if profile.ip_mode == 0: # pstn
dspg.set_state(dspg.ST_SPK_OFFHK)
else:
dspg.set_state(dspg.ST_V_SPK_OFFHK_LPLAY)
self.handle_call_action(config.Green)
elif status.modem_audio_state == status.HS and not isvideokey:
roxia_event('*status.HS*')
self.stack_stage(model.HandsFreeNotifyStage)
return
elif status.modem_audio_state == status.SPK:
roxia_event('*status.SPK*')
if profile.ip_mode == 1 and status.video_mode == status.VideoIdle:
dspg.set_state(dspg.ST_V_SPK_OFFHK_LPLAY)
self.handle_call_action(config.Green)
else:
if config.key_debug:
print 'Green: but audio state: ', status.modem_audio_state
def handle_red(self):
roxia_trace('manager.handle_red()')
# hcryoo : [20070419_1]
if runtime.manager.stage.get_name() == 'VideoCallRequest' or \
runtime.manager.stage.get_name() == 'VideoCallRequested' or\
runtime.manager.stage.get_name() == 'VideoCallRequestForCallTrading' or \
runtime.manager.stage.get_name() == 'VideoCallRequestedForCallTrading':
# hcryoo : [20070419_1]==
if profile.ip_mode == 0: # pstn
runtime.manager.back_stage('Connected')
else:
runtime.manager.back_stage('AudioCallConnected')
runtime.manager.stage.end_call_by_red()
elif runtime.manager.stage.get_name() == 'VideoCallConnecting':
runtime.manager.stage.end_call()
#elif status.videocall_mode == status.VideoCallConnected:
# if runtime.manager.stage.get_name() != 'VideoCallConnected':
# if (len(self.back) > 1 or (len(self.back) == 1 and self.back[0].name != 'idle')):
# # backÀÌ ¾Æ´Ï°í ±âÁ¸ stage°¡ ¿©·¯°³ ½×¿©ÀÖ´Â °æ¿ì
# self.back_stage()
# return
# runtime.manager.back_stage('VideoCallConnected')
# runtime.manager.stage.end_call_by_red()
else:
self.back_stage('idle')
def queue_interrupt(self):
intr = status.interrupt_key
status.interrupt_key = ''
self.interrupt_queued = True
self.key_queue = [(True, intr)]
def cb():
self.interrupt_queued = False
for down, key in self.key_queue:
self.handle_key(down, key)
self.key_queue = []
runtime.evas.idle_add(cb)
def emergency_save(self):
message, icon = status.save_callback()
if not message:
return
import uiconfig
stage = NotifyStage(message, icon)
# RHC / [20061013_1] : Àü½ÂÈ¿ ¼±ÀÓ ¼öÁ¤ »çÇ×
# start shchun : QE 6_9 , email-emergency save
self.stack_stage(stage)
# end shchun
# RHC / [20061013_1]--
runtime.evas.render_now()
time.sleep(3)
def emergency_save_other(self):
message, icon = status.save_callback_other()
if not message:
return
import uiconfig
stage = NotifyStage(message, icon)
# RHC / [20061013_1] : Àü½ÂÈ¿ ¼±ÀÓ ¼öÁ¤ »çÇ×
# start shchun : QE 6_9 , email-emergency save
self.stack_stage(stage)
# end shchun
# RHC / [20061013_1]--
runtime.evas.render_now()
time.sleep(3)
def emergency_save_offhook(self):
try:
message2, icon2, yesno = status.save_callback2()
if not message2:
raise TypeError
except:
runtime.manager.back_stage()
if '0' in open('/proc/driver/hook_sense').read():
status.set_modem_audio_state(status.HS)
# vpark begin 06.02.08
if profile.ip_mode == 0:
dspg.set_state(dspg.ST_HS_OFFHK)
else:
dspg.set_state(dspg.ST_V_HS_OFFHK_LPLAY)
# vpark end 06.02.08
self.handle_call_action(config.OffHook)
else:
runtime.manager.back_stage()
return
def yes_cb():
from ppp import g_pppclosing
from mms_net_sendstage import g_MMSWork
if g_MMSWork and g_pppclosing:
return
else:
g_MMSWork = False
g_pppclosing = False
if status.save_callback_stage:
callback=runtime.manager.find_stage(status.save_callback_stage)
message, icon= callback.save_callback()
else:
message, icon = status.save_callback()
class Notify_IgnoreKey(Stage):
agenda_forbidden = True
def __init__(self, message, icon):
self.ui = baseui.NotifyUI(message, icon)
def destroy():
if '0' in open('/proc/driver/hook_sense').read():
status.set_modem_audio_state(status.HS)
# vpark begin 06.02.08
if profile.ip_mode == 0:
dspg.set_state(dspg.ST_HS_OFFHK)
else:
dspg.set_state(ddspg.ST_V_HS_OFFHK_LPLAY)
# vpark end 06.02.08
runtime.manager.handle_call_action(config.OffHook)
else:
runtime.manager.back_stage()
return False
self.cb = destroy
def run_cb():
self.destroy_tag = 0
self.cb()
import uiconfig
self.destroy_tag = utils.Timer(uiconfig.notify_duration, run_cb)
def handle_key(self, key):
return True
def destroy(self):
Stage.destroy(self)
self.destroy_tag=0
if message:
stage=Notify_IgnoreKey(message, icon)
self.change_stage(stage)
runtime.evas.render_now()
time.sleep(3)
if '0' in open('/proc/driver/hook_sense').read():
status.set_modem_audio_state(status.HS)
# vpark begin 06.02.08
if profile.ip_mode == 0:
dspg.set_state(dspg.ST_HS_OFFHK)
else:
dspg.set_state(dspg.ST_V_HS_OFFHK_LPLAY)
# vpark end 06.02.08
dspg.set_state(dspg.ST_HS_OFFHK)
self.handle_call_action(config.OffHook)
else:
runtime.manager.back_stage('idle')
def no_cb():
from ppp import g_pppclosing
from mms_net_sendstage import g_MMSWork
if g_MMSWork and g_pppclosing:
return
else:
g_MMSWork = False
g_pppclosing = False
runtime.manager.back_stage()
if '0' in open('/proc/driver/hook_sense').read():
status.set_modem_audio_state(status.HS)
# vpark begin 06.02.08
if profile.ip_mode == 0:
dspg.set_state(dspg.ST_HS_OFFHK)
else:
dspg.set_state(dspg.ST_V_HS_OFFHK_LPLAY)
# vpark end 06.02.08
self.handle_call_action(config.OffHook)
else:
runtime.manager.back_stage('idle')
stage=YesNo_IgnoreKey(yesno, icon2, yes_cb, no_cb)
self.stack_stage(stage)
runtime.evas.render_now()
def emergency_save_green(self):
try:
message2, icon2, yesno = status.save_callback2()
if not message2 or not icon2 or not yesno:
raise TypeError
except:
status.set_modem_audio_state(status.SPK)
# vpark begin 06.02.08
if profile.ip_mode == 0:
dspg.set_state(dspg.ST_SPK_OFFHK)
else:
dspg.set_state(dspg.ST_V_SPK_OFFHK_LPLAY)
# vpark end 06.02.08
self.handle_call_action(config.Green)
return
def yes_cb():
from ppp import g_pppclosing
from mms_net_sendstage import g_MMSWork
if g_MMSWork and g_pppclosing:
return
else:
g_MMSWork = False
g_pppclosing = False
if status.save_callback_stage:
callback=runtime.manager.find_stage(status.save_callback_stage)
message, icon= callback.save_callback()
else:
message, icon = status.save_callback()
if message:
stage=NotifyStage(message, icon)
self.change_stage(stage)
runtime.evas.render_now()
time.sleep(3)
if '0' in open('/proc/driver/hook_sense').read():
status.set_modem_audio_state(status.HS)
# vpark begin 06.02.08
if profile.ip_mode == 0:
dspg.set_state(dspg.ST_HS_OFFHK)
else:
dspg.set_state(dspg.ST_V_HS_OFFHK_LPLAY)
# vpark end 06.02.08
self.handle_call_action(config.OffHook)
else:
status.set_modem_audio_state(status.SPK)
# vpark begin 06.02.08
if profile.ip_mode == 0:
dspg.set_state(dspg.ST_SPK_OFFHK)
else:
dspg.set_state(dspg.ST_V_SPK_OFFHK_LPLAY)
# vpark end 06.02.08
self.handle_call_action(config.Green)
def no_cb():
from ppp import g_pppclosing
from mms_net_sendstage import g_MMSWork
if g_MMSWork and g_pppclosing:
return
else:
g_MMSWork = False
g_pppclosing = False
if '0' in open('/proc/driver/hook_sense').read():
status.set_modem_audio_state(status.HS)
# vpark begin 06.02.08
if profile.ip_mode == 0:
dspg.set_state(dspg.ST_HS_OFFHK)
else:
dspg.set_state(dspg.ST_V_HS_OFFHK_LPLAY)
# vpark end 06.02.08
self.handle_call_action(config.OffHook)
else:
status.set_modem_audio_state(status.SPK)
# vpark begin 06.02.08
if profile.ip_mode == 0:
dspg.set_state(dspg.ST_SPK_OFFHK)
else:
dspg.set_state(dspg.ST_V_SPK_OFFHK_LPLAY)
# vpark end 06.02.08
self.handle_call_action(config.Green)
stage=YesNo_IgnoreKey(yesno, icon2, yes_cb, no_cb)
self.stack_stage(stage)
runtime.evas.render_now()
def handle_offhook(self):
utils.print_hw_debug('OFF-HOOK')
if not status.get_regstatus_mmi():
import uiconfig
stage = RegiNotifyStage(_('Please use after register to server'), uiconfig.baloon_call_log_icon)
runtime.manager.change_stage(stage, True)
return True
runtime.mmedia.unload()
runtime.SP_context.handset.setStatus(Device.OFF_HOOK)
hsOffHook = runtime.SP_context.HS_OffHook()
if hsOffHook.next():
hsOffHook.next()
from dectHandler import DectCallManager
dectStatus = runtime.dectCallManager.getDectStatus()
if dectStatus == DectCallManager.IDLE:
# default ¹ß½ÅÀ» ¹»·Î Çϳª ?
MD.mmiTrace('SET BASE IN USE by HS OFF HOOK ***')
runtime.SP_context.setBaseCallStatus(SP_Context.OUTGOING_AUDIO)
runtime.SP_context.setBaseStatus(SP_Context.DIALING)
runtime.SP_context.handset.setTone(config.PLAY_DIAL_TONE)
runtime.SP_context.SP_stereoStopPlayback()
runtime.manager.handle_call_action(config.OffHook)
else:
runtime.SP_context.setBaseStatus(SP_Context.BUSY)
runtime.SP_context.handset.setTone(config.PLAY_BUSY_TONE)
runtime.SP_context.SP_stereoStopPlayback()
runtime.SP_context.dect1.clearTone()
stage = InUseByDectStage()
runtime.manager.change_stage(stage, True)
'''
from dectHandler import DectCallManager
dectStatus = runtime.dectCallManager.getDectStatus()
if dectStatus == DectCallManager.IDLE:
runtime.SP_context.goIdleState()
hsOffHook = runtime.SP_context.HS_OffHook()
if hsOffHook.next():
hsOffHook.next()
runtime.SP_context.handset.setTone(config.PLAY_DIAL_TONE)
self.handle_call_action(config.OffHook)
else:
hsOffHook = runtime.SP_context.HS_OffHook()
if hsOffHook.next():
hsOffHook.next()
runtime.SP_context.setBaseStatus(SP_Context.BUSY)
runtime.SP_context.handset.setTone(config.PLAY_BUSY_TONE)
runtime.SP_context.SP_stereoStopPlayback()
stage = InUseByDectStage()
runtime.manager.change_stage(stage, True)
'''
def handle_offhook__old(self):
utils.print_hw_debug('OFF-HOOK')
# playing ÁßÀÏ °æ¿ì¿¡´Â player ¸¦ ¸ÕÀú stop ½ÃŲ´Ù.
if utils.player.playing() and \
status.videocall_mode == status.VideoCallDisconnected and \
status.phone_status == status.Disconnected and \
profile.profile.get_profile() == 0: # pstn
utils.player.stop()
if status.modem_audio_state == status.IDLE:
if 0:
self.emergency_save_offhook()
else:
if status.save_callback_other:
self.emergency_save_other()
status.set_modem_audio_state(status.HS)
if profile.ip_mode == 1:
dspg.set_state(dspg.ST_V_HS_OFFHK_LPLAY)
else:
dspg.set_state(dspg.ST_HS_OFFHK)
self.handle_call_action(config.OffHook)
elif status.modem_audio_state == status.SPK:
status.set_modem_audio_state(status.HS)
dspg.change_to_handset()
if config.dual_audio_volume:
if runtime.manager.stage.name == 'audio volume':
import phonesetting
runtime.manager.change_stage(phonesetting.AudioVolumeStage)
elif status.modem_audio_state == status.HS:
#assert 0
# eicho modify strange code ... 06.11.01
#status.backup_status()
pass
else:
pass
def handle_onhook(self):
roxia_tracef('status.videocall_mode=%d, status.business_call_status=%d', status.videocall_mode, status.business_call_status)
status.emergency_call_number = None
if profile.ip_mode == 1 and \
status.business_call_status == status.TwoCallOneHold:
runtime.manager.back_stage('TwoCallOneHold')
runtime.manager.stage.end_call_by_onhook()
elif profile.ip_mode == 1 and \
status.business_call_status == status.TwoCallOneDialing:
#ka...slim 2007.05.19 ¾ÆÁ÷ DailNumber°¡ ÀԷµÇÁö ¾ÊÀº °æ¿ì
if not status.dial_number:
runtime.manager.back_stage('DialSecondCall')
runtime.manager.stage.end_call_by_onhook()
else:
runtime.manager.back_stage('SecondCallEnblockEdit')
runtime.manager.stage.end_call_by_onhook()
elif profile.ip_mode == 1 and \
status.business_call_status == status.TwoCallConnected:
runtime.manager.back_stage('CallConference')
runtime.manager.stage.end_both_calls()
elif profile.ip_mode == 1 and \
(status.videocall_mode == status.VideoCallRequested or \
status.videocall_mode == status.VideoCallRequest or \
status.videocall_mode == status.VideoCallRequestForCallTrading or \
status.videocall_mode == status.VideoCallRequestedForCallTrading):
runtime.manager.back_stage('AudioCallConnected')
runtime.manager.stage.end_call_by_onhook()
elif status.videocall_mode == status.VideoCallConnected and \
runtime.manager.stage.get_name() != 'VideoCallConnected' and \
runtime.manager.stage.get_name() != 'AudioCallConnected':
if status.video_mode==status.AudioConnected:
runtime.manager.back_stage('AudioCallConnected')
else:
runtime.manager.back_stage('VideoCallConnected')
runtime.manager.stage.end_call_by_onhook()
elif runtime.manager.stage.get_name() == 'VideoCallRequest' or \
runtime.manager.stage.get_name() == 'VideoCallRequested' or \
runtime.manager.stage.get_name() == 'VideoCallRequestForCallTrading' or \
runtime.manager.stage.get_name() == 'VideoCallRequestedForCallTrading':
runtime.manager.back_stage('AudioCallConnected')
runtime.manager.stage.end_call_by_onhook()
elif runtime.manager.stage.get_name() == 'VideoCallConnecting':
runtime.manager.stage.end_call()
elif status.videocall_mode == status.VideoCallDisconnected and status.video_mode==status.AudioConnected:
runtime.manager.back_stage('AudioCallConnected')
status.video_mode = status.VideoIdle
runtime.manager.stage.end_call_by_onhook()
elif status.modem_audio_state == status.HS:
roxia_trace('*manager.handle_onhook(), modem_audio_state:HS, set IDLE')
utils.print_hw_debug('ON-HOOK')
dspg.dtmf_abort()
status.set_modem_audio_state(status.IDLE)
dspg.set_state(dspg.ST_IDLE)
self.stop_call(IdleStage)
time.sleep(1)
elif status.modem_audio_state == status.SPK:
dspg.dtmf_abort()
status.set_modem_audio_state(status.IDLE)
dspg.set_state(dspg.ST_IDLE)
self.stop_call(IdleStage)
#assert 0
elif status.modem_audio_state == status.IDLE:
status.set_modem_audio_state(status.IDLE)
dspg.set_state(dspg.ST_IDLE)
self.stop_call(IdleStage)
# remove 06.02.10 pass
#assert 0
def handle_onhook_old(self):
roxia_tracef('status.videocall_mode=%d, status.business_call_status=%d', status.videocall_mode, status.business_call_status)
status.emergency_call_number = None
if profile.ip_mode == 1 and \
status.business_call_status == status.TwoCallOneHold:
runtime.manager.back_stage('TwoCallOneHold')
runtime.manager.stage.end_call_by_onhook()
elif profile.ip_mode == 1 and \
status.business_call_status == status.TwoCallOneDialing:
#ka...slim 2007.05.19 ¾ÆÁ÷ DailNumber°¡ ÀԷµÇÁö ¾ÊÀº °æ¿ì
if not status.dial_number:
runtime.manager.back_stage('DialSecondCall')
runtime.manager.stage.end_call_by_onhook()
else:
runtime.manager.back_stage('SecondCallEnblockEdit')
runtime.manager.stage.end_call_by_onhook()
elif profile.ip_mode == 1 and \
status.business_call_status == status.TwoCallConnected:
runtime.manager.back_stage('CallConference')
runtime.manager.stage.end_both_calls()
# hcryoo : [20070419_1]
elif profile.ip_mode == 1 and \
(status.videocall_mode == status.VideoCallRequested or \
status.videocall_mode == status.VideoCallRequest or \
status.videocall_mode == status.VideoCallRequestForCallTrading or \
status.videocall_mode == status.VideoCallRequestedForCallTrading):
# hcryoo : [20070419_1]==
runtime.manager.back_stage('AudioCallConnected')
runtime.manager.stage.end_call_by_onhook()
# eicho add 06.02.10
# PSTN mode. - PSTNTwoCallOneHoldStage
elif profile.ip_mode == 0 and \
status.business_call_status == status.TwoCallOneHold:
roxia_trace('PSTNTwoCallOneHoldStage---1) call end_call_by_onhook')
runtime.manager.back_stage('PSTNTwoCallOneHold')
#tmp_stage = runtime.manager.find_stage('PSTNTwoCallOneHoldStage')
#runtime.manager.change_stage(tmp_stage)
runtime.manager.stage.end_call_by_onhook()
# PSTN mode.- SecondCallEdit
elif profile.ip_mode == 0 and \
status.business_call_status == status.TwoCallOneDialing :
roxia_trace('PSTNSecondCallEnblockEditStage---2) call end_call_by_onhook')
#runtime.manager.back_stage('PSTNSecondCallEnblockEditStage')
runtime.manager.back_stage('PSTNDialSecondCall')
runtime.manager.stage.end_call_by_onhook()
# PSTN mode.- conference
elif profile.ip_mode == 0 and \
status.business_call_status == status.TwoCallConnected:
roxia_trace('PSTNCallConferenceStage---3) call end_both_calls')
runtime.manager.back_stage('PSTNCallConference')
runtime.manager.stage.end_both_calls()
# eicho end.
elif status.videocall_mode == status.VideoCallConnected and \
runtime.manager.stage.get_name() != 'VideoCallConnected' and \
runtime.manager.stage.get_name() != 'AudioCallConnected':
if status.video_mode==status.AudioConnected:
runtime.manager.back_stage('AudioCallConnected')
else:
runtime.manager.back_stage('VideoCallConnected')
runtime.manager.stage.end_call_by_onhook()
# hcryoo : [20070419_1]
elif runtime.manager.stage.get_name() == 'VideoCallRequest' or \
runtime.manager.stage.get_name() == 'VideoCallRequested' or \
runtime.manager.stage.get_name() == 'VideoCallRequestForCallTrading' or \
runtime.manager.stage.get_name() == 'VideoCallRequestedForCallTrading':
# hcryoo : [20070419_1]==
if profile.ip_mode == 0: # pstn
runtime.manager.back_stage('Connected')
else:
runtime.manager.back_stage('AudioCallConnected')
runtime.manager.stage.end_call_by_onhook()
elif runtime.manager.stage.get_name() == 'VideoCallConnecting':
runtime.manager.stage.end_call()
# hcryoo : [20070527_2]
elif status.videocall_mode == status.VideoCallDisconnected and status.video_mode==status.AudioConnected:
runtime.manager.back_stage('AudioCallConnected')
status.video_mode = status.VideoIdle
runtime.manager.stage.end_call_by_onhook()
# hcryoo : [20070527_2]==
elif status.modem_audio_state == status.HS:
roxia_trace('*manager.handle_onhook(), modem_audio_state:HS, set IDLE')
utils.print_hw_debug('ON-HOOK')
dspg.dtmf_abort()
status.set_modem_audio_state(status.IDLE)
dspg.set_state(dspg.ST_IDLE)
self.stop_call(IdleStage)
time.sleep(1)
elif status.modem_audio_state == status.SPK:
dspg.dtmf_abort()
status.set_modem_audio_state(status.IDLE)
dspg.set_state(dspg.ST_IDLE)
self.stop_call(IdleStage)
#assert 0
elif status.modem_audio_state == status.IDLE:
status.set_modem_audio_state(status.IDLE)
dspg.set_state(dspg.ST_IDLE)
self.stop_call(IdleStage)
# remove 06.02.10 pass
#assert 0
#Roxia Begin cmlim 06.06.14
#def kill_ringer(self):
def kill_ringer(self, bmwi=False):
#Roxia End cmlim 06.06.14
if config.ring_debug:
print 'kill ringer'
status.ring_timer = 0
status.ring_count = 0
# answer delay 06.05.17
if profile.ip_mode == 0:
#Roxia Begin cmlim 06.06.14
# eicho modify 06.06.20
#utils.player.stop(bmwi) : stop ringÇÏÁö ¾ÊÀ½.
utils.player.stop(bmwi=bmwi)
#Roxia End cmlim 06.06.14
else:
#utils.player.stop(onTup=True)
#utils.player.stop_ring()
#print "[yylee debug] kill_ringer invoked"
utils.player.stop_ring()
runtime.mmedia.unload()
runtime.SP_context.SP_stereoStopPlayback()
def reject_call(self):
self.cid_waiter = None
self.kill_ringer()
status.caller_number = ''
dspg.set_state(dspg.ST_HS_OFFHK)
time.sleep(1)
dspg.set_state(dspg.ST_IDLE)
self.change_stage(IdleStage)
runtime.evas.render_now()
try:
runtime.modem.write_command('\r')
except:
pass
def answer_call(self):
status.missed_call_count = 0
status.dial_number = ''
self.change_stage(ConnectedStage)
return
try:
runtime.modem.answer()
except:
pass
def stop_call(self, next_stage):
roxia_event('manager.stop_call(), next_stage=', next_stage)
import calldb
if status.waiting:
status.toggle_waiting()
if status.audio_mute:
status.toggle_audio_mute()
roxia_event('manager.stop_call(), dial_number=', status.dial_number, 'caller=', status.caller_number)
if status.dial_number:
if status.call_time > 0:
number = status.dial_number
if number[0] == '*':
number = number[1:]
# ÀüȵµÁß Flash¸¦ ´©¸¥ °æ¿ì ´©¸£±â Àü±îÁö ¹øÈ£¸¸ ÀúÀåÇÑ´Ù.
if number.find('R') >= 0:
number = number.split('R')[0]
# number ¿¡ PABX Äڵ尡 Æ÷ÇԵǾîÀÖÀ¸¸é »©°í call log ³²±â±â
# ´Ü »ç¿ëÀÚÀÇ ÀԷ¿¡ ÀÇÇÑ call ÀÌ ¾Æ´Ò °æ¿ì
if not status.dialed_by_user:
if setting.phone_extension and number.startswith(setting.phone_extension):
number = number[len(setting.phone_extension)+1:]
runtime.mmiDebug.mmiTrace('1status.currentCallDuration = ', status.currentCallDuration)
runtime.mmiDebug.mmiTrace('status.currentCallDuration_copy = ', status.currentCallDuration_copy)
calldb.add_call_log('dialed', number, status.call_time, ntptime.ntime() - status.call_time, 0, 0)
else:
pass
elif status.caller_number:
# hidden callÀÏÁö¶óµµ calldb¿¡ ³Ö¾î³õ´Â´Ù.
if status.call_time > 0:
# Àüȸ¦ ¹ÞÀº °æ¿ì¿¡´Â cid·Î ¹ÞÀº time ÀÌ ÀÖ´Ù¸é
runtime.mmiDebug.mmiTrace('2status.currentCallDuration = ', status.currentCallDuration)
runtime.mmiDebug.mmiTrace('status.currentCallDuration_copy = ', status.currentCallDuration_copy)
calldb.add_call_log('received', status.caller_number, status.received_call_time, ntptime.ntime() - status.call_time,0, 0, status.received_name) #ka...name 2006.10.24
else:
pass
else:
pass
#dspg.dtmf_abort()
if status.phone_status not in (status.Disconnected, status.Dialing):
# ÀÌ¹Ì ²÷¾îÁø »óÅÂÀε¥ ÀÌÂÊÀ¸·Î µé¾î¿Â´Ù. status.Disconnected »óÅ ȮÀÎ
roxia_event('status.phone_status=', status.phone_status)
self.change_stage(CallTerminatedStage('', next_stage), True)
#assert not self.back
else:
# ¾ÆÁ÷ ½ÇÁ¦ dialingÀ» ÇÏÁö¾Ê¾Ò´Ù
self.change_stage(next_stage, True)
runtime.evas.render_now()
# call procedure state variables reset
status.dtmf_overlap_mode = False
status.sending_dtmf = ''
status.received_call_time = None
status.visual_number = ''
roxia_event('Manager.py stop_call: release channel and reset')
status.release_channel()
status.clear_current_call_status()
status.reset_call_status()
#ka...3800 wideband reset 2007.05.12
status.wideband_codec = 0
status.waiting = 0
status.business_option_status = status.NotSelected
status.business_call_status = status.OneCallConnected
status.phone_status = status.Disconnected
status.videocall_mode = status.VideoCallDisconnected
status.WhatFrom = status.from_none
status.indirect_cid = 0
status.special_cid = False
status.videocall_byuser = False
status.received_name = None #ka...name 2006.10.24
def stop_video_call(self, with_error, snmp=False):
roxia_trace('stop_video_call() with error = ', with_error)
isOutgoingCall = False
runtime.SP_context.stopTonePlay()
self.end_tag = None
self.snmp = snmp
status.service_name = ''
status.videocall_mute = status.VideoMuteOff
if status.audio_mute:
status.toggle_audio_mute()
status.waiting = 0
baseCallStatus, baseStatus, dectCallStatus, dectStatus = status.getCurrentCallStatus()
from mmiSoundPath import SP_Context
from dectHandler import DectCallManager
if baseCallStatus in [SP_Context.OUTGOING_VIDEO, SP_Context.OUTGOING_AUDIO]:
isOutgoingCall = True
import calldb
runtime.mmiDebug.mmiTrace('==================================')
runtime.mmiDebug.mmiTrace('status.video_call_time = ', status.video_call_time)
runtime.mmiDebug.mmiTrace('status.dial_number = ', status.dial_number)
runtime.mmiDebug.mmiTrace('status.caller_number = ', status.caller_number)
if status.first_info_number:
if status.first_info_number[0:4] == '*010':
status.first_info_number = status.first_info_number[1:]
if status.second_info_number:
if status.second_info_number[0:4] == '*010':
status.second_info_number = status.second_info_number[1:]
# ¹ß½Å
if status.dial_number:
if status.video_call_time > 0:
number = status.dial_number
if number[0:4] == '*010':
number = number[1:]
vtime = ntptime.ntime() - status.video_call_time
if int(vtime) == 0:
vtime = 1
runtime.mmiDebug.mmiTrace('4status.currentCallDuration = ', status.currentCallDuration)
runtime.mmiDebug.mmiTrace('status.currentCallDuration_copy = ', status.currentCallDuration_copy)
if status.pushVideoAd:
vtime = status.currentCallDuration_copy[0]*60*60 + status.currentCallDuration_copy[1]*60 + status.currentCallDuration_copy[2]
calldb.add_call_log('dialed', number, status.video_call_time, vtime, 0, 0)
else:
calldb.add_call_log('dialed', number, 0, 0, status.video_call_time, vtime)
else:
if status.pushVideoAd:
number = status.dial_number
if number[0:4] == '*010':
number = number[1:]
runtime.mmiDebug.mmiTrace('4-1status.currentCallDuration = ', status.currentCallDuration)
runtime.mmiDebug.mmiTrace('status.currentCallDuration_copy = ', status.currentCallDuration_copy)
atime = status.currentCallDuration_copy[0]*60*60 + status.currentCallDuration_copy[1]*60 + status.currentCallDuration_copy[2]
if atime == 0:
atime = 1
calldb.add_call_log('dialed', number, status.call_time, atime, 0, 0)
if status.serviceStatusType in ['BB']:
if status.dial_number == status.first_info_number:
import calldb
calldb.add_call_log('dialed', status.second_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
else:
import calldb
calldb.add_call_log('dialed', status.first_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.isConferenceCall = False
status.first_info_number = ''
status.second_info_number = ''
status.second_info_call_duration_start = 0
elif status.serviceStatusType in ['BW', 'WB']:
if status.isConferenceCall:
if status.dial_number == status.first_info_number:
import calldb
calldb.add_call_log('dialed', status.second_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
else:
import calldb
calldb.add_call_log('dialed', status.first_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.isConferenceCall = False
else:
if status.dial_number == status.first_info_number:
if status.second_info_call_mode == 0: # audio
import calldb
calldb.add_call_log('received', status.second_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else:
import calldb
calldb.add_call_log('received', status.second_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.second_info_number = ''
status.second_info_call_duration_start = 0
else:
if status.second_info_call_mode == 0: # audio
import calldb
calldb.add_call_log('received', status.first_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else:
import calldb
calldb.add_call_log('received', status.first_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.second_info_number = ''
status.second_info_call_duration_start = 0
elif status.serviceStatusType in ['WR', 'RW']:
if status.dial_number == status.first_info_number:
if status.firstCallType == 1: # audio
import calldb
calldb.add_call_log('dialed', status.second_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
import calldb
calldb.add_call_log('dialed', status.second_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.second_info_number = ''
status.second_info_call_duration_start = 0
else:
if status.firstCallType == 1: # audio
import calldb
calldb.add_call_log('dialed', status.first_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
import calldb
calldb.add_call_log('dialed', status.first_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.second_info_number = ''
status.second_info_call_duration_start = 0
# [20080919_2]: hcryoo : [QE 29099] ÅëȽð£ 339179ºÐÀ¸·Î Ç¥½ÃµÇ´Â ºÎÀç Call Log ÀúÀåµÊ
#else: # ¼ö½Å
elif status.caller_number:
# [20080919_2]: hcryoo : [QE 29099] ÅëȽð£ 339179ºÐÀ¸·Î Ç¥½ÃµÇ´Â ºÎÀç Call Log ÀúÀåµÊ==
if status.AutoAnswering:
status.video_call_time = 0
if status.video_call_time > 0:
vtime = ntptime.ntime() - status.video_call_time
if int(vtime) == 0:
vtime = 1
if status.serviceStatusType in ['BN', 'NB'] and not status.caller_number in [status.first_info_number, status.second_info_number]:
runtime.mmiDebug.mmiTrace('3-2 status.currentCallDuration = ', status.currentCallDuration)
runtime.mmiDebug.mmiTrace('status.currentCallDuration_copy = ', status.currentCallDuration_copy)
if status.first_info_number:
calldb.add_call_log('received', status.first_info_number, status.call_time, ntptime.ntime() - status.call_time, status.video_call_time, vtime)
else:
calldb.add_call_log('received', status.second_info_number, status.call_time, ntptime.ntime() - status.call_time, status.video_call_time, vtime)
else:
runtime.mmiDebug.mmiTrace('3status.currentCallDuration = ', status.currentCallDuration)
runtime.mmiDebug.mmiTrace('status.currentCallDuration_copy = ', status.currentCallDuration_copy)
calldb.add_call_log('received', status.caller_number, status.call_time, ntptime.ntime() - status.call_time, status.video_call_time, vtime)
if status.serviceStatusType in ['BW', 'WB']:
if status.caller_number == status.first_info_number:
if status.second_info_call_mode == 0: # audio
import calldb
calldb.add_call_log('received', status.second_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
import calldb
calldb.add_call_log('received', status.second_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
else:
if status.second_info_call_mode == 0: # audio
import calldb
calldb.add_call_log('received', status.first_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
import calldb
calldb.add_call_log('received', status.first_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.first_info_number = ''
status.second_info_number = ''
status.second_info_call_duration_start = 0
elif status.serviceStatusType in ['BR', 'RB']:
if status.caller_number == status.first_info_number:
if status.second_info_call_mode == 0: # audio
import calldb
calldb.add_call_log('missed', status.second_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
import calldb
calldb.add_call_log('missed', status.second_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
else:
if status.second_info_call_mode == 0: # audio
import calldb
calldb.add_call_log('missed', status.first_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
import calldb
calldb.add_call_log('missed', status.first_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.missed_call_count += 1
# ÇöÀç ½ºÆå »ó missed call message 󸮴 ÇÏÁö ¾ÊÀ½
status.first_info_number = ''
status.second_info_number = ''
status.second_info_call_duration_start = 0
else:
if status.video_call_time == 0:
status.video_call_time = ntptime.ntime()
callLogTime = ntptime.ntime()
runtime.mmiDebug.mmiTrace('3-1status.currentCallDuration = ', status.currentCallDuration)
runtime.mmiDebug.mmiTrace('status.currentCallDuration_copy = ', status.currentCallDuration_copy)
calldb.add_call_log('missed', status.caller_number, 0, 0, status.video_call_time, ntptime.ntime() - status.video_call_time)
status.missed_call_count += 1
# ÀÚµ¿ ÀÀ´ä½Ã ÇÑ±Û À̸§ÀÌ Àß ¸ø º¸¿©Áö´Â ¿À·ù ¼öÁ¤.
if setting.missedCallAlarm:
from phonedb import phonedb
callerNumber = status.caller_number
callerName = phonedb.get_name_by_number(callerNumber)
missedCallAlarmNumber = '%s;%s;%s' % (setting.missedCallAlarmNumber1, setting.missedCallAlarmNumber2, setting.missedCallAlarmNumber3)
if status.video_mode == status.VideoIncoming:
callType = 1
else:
callType = 0
runtime.eaHandler.sendMissedCallAlarm(callType, missedCallAlarmNumber, callerName, callerNumber, 0)
tempName = status.display_caller_name(status.active_call_index)
tempNumber = status.display_caller_number(status.active_call_index)
if runtime.SP_context.isInSession():
if dectStatus == DectCallManager.CONNECTED and baseStatus == SP_Context.IDLE:
runtime.dectCallManager.serverStopCall()
runtime.SP_context.setInSession(False)
elif baseStatus == SP_Context.CONNECTED or baseStatus == SP_Context.RINGING or baseStatus == SP_Context.DIALING:
runtime.SP_context.setBaseCallStatus(SP_Context.IDLE)
runtime.SP_context.setBaseStatus(SP_Context.IDLE)
runtime.SP_context.setInSession(False)
MD.mmiTrace('stop_video_call : CLEAR BASE & DECT:: IN_SESSION')
status.release_channel()
status.clear_current_call_status()
status.reset_call_status()
#ka...3800 wideband reset 2007.05.12
status.wideband_codec = 0
status.waiting = 0
status.business_option_status = status.NotSelected
status.business_call_status = status.OneCallConnected
status.videocall_mode = status.VideoCallDisconnected
status.video_mode = status.VideoIdle
status.phone_status = status.Disconnected
status.WhatFrom = status.from_none
status.indirect_cid = 0
status.special_cid = False
status.videocall_byuser = False
status.video_call_time = 0
else:
MD.mmiTrace('stop_video_call : CLEAR BASE & DECT::NOT IN_SESSION')
status.release_channel()
status.clear_current_call_status()
status.reset_call_status()
#ka...3800 wideband reset 2007.05.12
status.wideband_codec = 0
status.waiting = 0
status.business_option_status = status.NotSelected
status.business_call_status = status.OneCallConnected
status.videocall_mode = status.VideoCallDisconnected
status.video_mode = status.VideoIdle
status.phone_status = status.Disconnected
status.WhatFrom = status.from_none
status.indirect_cid = 0
status.special_cid = False
status.videocall_byuser = False
status.video_call_time = 0
status.setClearCallStatus()
if with_error=='noserv':
stage = ServiceNotAvailableStage()
else:
if status.caller_number:
number = status.caller_number
else:
number = status.dial_number
stage = VideoCallTerminatedStage( with_error, False, tempName, tempNumber, isOutgoingCall) #ka
self.change_stage(stage,True)
#runtime.evas.render_now()
#KA: [20080610] call term test
MD.mmiTrace('stop_video_call::sendCallInfoTrap $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$')
def sendCallInfoTrap():
runtime.trapHandler.callInfoTrap(status.sipResponseCodeForTrap)
status.sipResponseCodeForTrap = None
self.callInfoTrapTimer = None
status.trapChecked = False
DELAYED_SENDING_TRAP_TIME = 1000 #4000
self.callInfoTrapTimer = utils.Timer(DELAYED_SENDING_TRAP_TIME, sendCallInfoTrap)
#KA: [20080610] call term test ==
return False # for timeout
def stop_audio_call(self, with_error, snmp=False):
roxia_trace('manager.stop_audio_call(), run AudioCallTerminatedStage with_error = ', with_error)
#runtime.vdci_stop_tone()
isOutgoingCall = False
runtime.SP_context.stopTonePlay()
self.snmp = snmp
status.service_name = ''
if status.audio_mute:
status.toggle_audio_mute()
status.waiting = 0
def end_process():
if not self.snmp:
if runtime.ppp != None:
runtime.ppp.stop_ppp()
runtime.ppp = None
if runtime.vdciapp != None:
if profile.ip_mode == 0:
runtime.vdciapp.destroy()
runtime.vdciapp = None
return False
def check_playulaw():
if utils.player.pid:
return True
end_process()
return False
if with_error: # if terminated with error, wait playing message is done
self.end_tag = utils.Timer( 1000, check_playulaw )
else: # if terminated with no error, end now.
utils.player.stop_message()
end_process()
import calldb
number = ''
runtime.mmiDebug.mmiTrace('==================================')
runtime.mmiDebug.mmiTrace('status.call_time = ', status.call_time)
runtime.mmiDebug.mmiTrace('status.dial_number = ', status.dial_number)
runtime.mmiDebug.mmiTrace('status.caller_number = ', status.caller_number)
if status.first_info_number:
if status.first_info_number[0:4] == '*010':
status.first_info_number = status.first_info_number[1:]
if status.second_info_number:
if status.second_info_number[0:4] == '*010':
status.second_info_number = status.second_info_number[1:]
if status.dial_number: # ¹ß½Å
caller = True
# eicho modify 06.08.11
number = status.dial_number
if status.call_time > 0:
#number = status.dial_number
# ÀüȵµÁß Flash¸¦ ´©¸¥ °æ¿ì ´©¸£±â Àü±îÁö ¹øÈ£¸¸ ÀúÀåÇÑ´Ù.
if number.find('R') >= 0:
number = number.split('R')[0]
if number[0:4] == '*010':
number = number[1:]
runtime.mmiDebug.mmiTrace('5status.currentCallDuration = ', status.currentCallDuration)
runtime.mmiDebug.mmiTrace('status.currentCallDuration_copy = ', status.currentCallDuration_copy)
calldb.add_call_log('dialed', number, status.call_time,\
ntptime.ntime() - status.call_time, 0, 0)
if status.serviceStatusType in ['BB']:
if status.dial_number == status.first_info_number:
import calldb
calldb.add_call_log('dialed', status.second_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else:
import calldb
calldb.add_call_log('dialed', status.first_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
status.first_info_number = ''
status.second_info_number = ''
status.second_info_call_duration_start = 0
elif status.serviceStatusType in ['BW', 'WB']:
if status.isConferenceCall:
if status.dial_number == status.first_info_number:
import calldb
calldb.add_call_log('dialed', status.second_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else:
import calldb
calldb.add_call_log('dialed', status.first_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else:
if status.dial_number == status.first_info_number:
import calldb
calldb.add_call_log('received', status.second_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else:
import calldb
calldb.add_call_log('received', status.first_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
status.first_info_number = ''
status.second_info_number = ''
status.second_info_call_duration_start = 0
elif status.serviceStatusType in ['WR', 'RW']:
if status.dial_number == status.first_info_number:
if status.firstCallType == 1: # audio
import calldb
calldb.add_call_log('dialed', status.second_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
import calldb
calldb.add_call_log('dialed', status.second_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.second_info_number = ''
status.second_info_call_duration_start = 0
else:
if status.firstCallType == 1: # audio
import calldb
calldb.add_call_log('dialed', status.first_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
import calldb
calldb.add_call_log('dialed', status.first_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.second_info_number = ''
status.second_info_call_duration_start = 0
#elif status.caller_number and status.caller_number not in ('P', 'O'):
# [20080919_2]: hcryoo : [QE 29099] ÅëȽð£ 339179ºÐÀ¸·Î Ç¥½ÃµÇ´Â ºÎÀç Call Log ÀúÀåµÊ
#else: # ¼ö½Å
elif status.caller_number:
# [20080919_2]: hcryoo : [QE 29099] ÅëȽð£ 339179ºÐÀ¸·Î Ç¥½ÃµÇ´Â ºÎÀç Call Log ÀúÀåµÊ==
if status.AutoAnswering:
status.call_time = 0
if status.call_time > 0:
if status.serviceStatusType in ['BN', 'NB'] and not status.caller_number in [status.first_info_number, status.second_info_number]:
runtime.mmiDebug.mmiTrace('6-111 status.currentCallDuration = ', status.currentCallDuration)
runtime.mmiDebug.mmiTrace('status.currentCallDuration_copy = ', status.currentCallDuration_copy)
if status.first_info_number:
calldb.add_call_log('received', status.first_info_number, status.call_time, ntptime.ntime() - status.call_time, 0, 0)
status.caller_number = status.first_info_number
else:
calldb.add_call_log('received', status.second_info_number, status.call_time, ntptime.ntime() - status.call_time, 0, 0)
status.caller_number = status.second_info_number
else:
runtime.mmiDebug.mmiTrace('6status.currentCallDuration = ', status.currentCallDuration)
runtime.mmiDebug.mmiTrace('status.currentCallDuration_copy = ', status.currentCallDuration_copy)
calldb.add_call_log('received', status.caller_number, status.call_time, ntptime.ntime() - status.call_time, 0, 0)
# ¼ö½Å À½¼º È£ÀÇ °æ¿ì¿¡´Â ¼ö½Å½Ã ¹«Á¶°Ç second´Â À½¼º È£À̰í missed ÀÎ °æ¿ì´Â ¿ø·¡ È£ typeÀ» °í·ÁÇÑ´Ù.
if status.serviceStatusType in ['BW', 'WB']:
if status.caller_number == status.first_info_number:
import calldb
calldb.add_call_log('received', status.second_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
'''
if status.second_info_call_mode == 0: # audio
import calldb
calldb.add_call_log('received', status.second_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
import calldb
calldb.add_call_log('received', status.second_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
'''
else:
import calldb
calldb.add_call_log('received', status.first_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
'''
if status.second_info_call_mode == 0: # audio
import calldb
calldb.add_call_log('received', status.first_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
import calldb
calldb.add_call_log('received', status.first_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
'''
status.first_info_number = ''
status.second_info_number = ''
status.second_info_call_duration_start = 0
elif status.serviceStatusType in ['BR', 'RB']:
if status.caller_number == status.first_info_number:
if status.second_info_call_mode == 0: # audio
import calldb
calldb.add_call_log('missed', status.second_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
import calldb
calldb.add_call_log('missed', status.second_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
else:
if status.second_info_call_mode == 0: # audio
import calldb
calldb.add_call_log('missed', status.first_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
import calldb
calldb.add_call_log('missed', status.first_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.missed_call_count += 1
# ÇöÀç ½ºÆå »ó missed call message 󸮴 ÇÏÁö ¾ÊÀ½
status.first_info_number = ''
status.second_info_number = ''
status.second_info_call_duration_start = 0
else:
if status.call_time == 0:
status.call_time = ntptime.ntime()
callLogTime = ntptime.ntime()
runtime.mmiDebug.mmiTrace('7status.currentCallDuration = ', status.currentCallDuration)
runtime.mmiDebug.mmiTrace('status.currentCallDuration_copy = ', status.currentCallDuration_copy)
calldb.add_call_log('missed', status.caller_number, status.call_time, ntptime.ntime() - status.call_time, 0, 0)
status.missed_call_count += 1
# ÀÚµ¿ ÀÀ´ä½Ã ÇÑ±Û À̸§ÀÌ Àß ¸ø º¸¿©Áö´Â ¿À·ù ¼öÁ¤.
if setting.missedCallAlarm:
from phonedb import phonedb
callerNumber = status.caller_number
callerName = phonedb.get_name_by_number(callerNumber)
missedCallAlarmNumber = '%s;%s;%s' % (setting.missedCallAlarmNumber1, setting.missedCallAlarmNumber2, setting.missedCallAlarmNumber3)
if status.video_mode == status.VideoIncoming:
callType = 1
else:
callType = 0
runtime.eaHandler.sendMissedCallAlarm(callType, missedCallAlarmNumber, callerName, callerNumber, 0)
tempName = status.display_caller_name(status.active_call_index)
tempNumber = status.display_caller_number(status.active_call_index)
baseCallStatus, baseStatus, dectCallStatus, dectStatus = status.getCurrentCallStatus()
from mmiSoundPath import SP_Context
from dectHandler import DectCallManager
# [20080903_1] : hcryoo : [QA] ÅëÈ Á¾·á ½Ã ¹ß½ÅÀÌ ¼ö½ÅÇ¥½Ã·Î ¹Ù²ñ
if baseCallStatus in [SP_Context.OUTGOING_AUDIO, SP_Context.OUTGOING_VIDEO] or dectCallStatus == DectCallManager.OUTGOING_AUDIO:
isOutgoingCall = True
# [20080903_1] : hcryoo : [QA] ÅëÈ Á¾·á ½Ã ¹ß½ÅÀÌ ¼ö½ÅÇ¥½Ã·Î ¹Ù²ñ==
if runtime.SP_context.isInSession():
if dectStatus == DectCallManager.CONNECTED:
runtime.dectCallManager.serverStopCall()
runtime.SP_context.setInSession(False)
elif baseStatus == SP_Context.CONNECTED or baseStatus == SP_Context.RINGING or baseStatus == SP_Context.DIALING:
runtime.SP_context.setBaseCallStatus(SP_Context.IDLE)
runtime.SP_context.setBaseStatus(SP_Context.IDLE)
runtime.SP_context.setInSession(False)
baseCallStatus, baseStatus, dectCallStatus, dectStatus = status.getCurrentCallStatus()
MD.mmiTrace('stop_audio_call : CLEAR BASE & DECT ***')
status.release_channel()
status.clear_current_call_status()
status.reset_call_status()
status.wideband_codec = 0
status.waiting = 0
status.business_option_status = status.NotSelected
status.business_call_status = status.OneCallConnected
status.videocall_mode = status.VideoCallDisconnected
status.video_mode = status.VideoIdle
status.phone_status = status.Disconnected
status.WhatFrom = status.from_none
status.indirect_cid = 0
status.special_cid = False
status.videocall_byuser = False
else:
MD.mmiTrace('stop_audio_call : Not in Sessing : CLEAR BASE & DECT')
status.release_channel()
status.clear_current_call_status()
status.reset_call_status()
status.wideband_codec = 0
status.waiting = 0
status.business_option_status = status.NotSelected
status.business_call_status = status.OneCallConnected
status.videocall_mode = status.VideoCallDisconnected
status.video_mode = status.VideoIdle
status.phone_status = status.Disconnected
status.WhatFrom = status.from_none
status.indirect_cid = 0
status.special_cid = False
status.videocall_byuser = False
status.setClearCallStatus()
stage = AudioCallTerminatedStage( with_error, False, tempName, tempNumber, isOutgoingCall)
self.change_stage(stage,True)
#runtime.evas.render_now()
#KA: [20080610] call term test
MD.mmiTrace('stop_audio_call::sendCallInfoTrap $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$')
def sendCallInfoTrap():
runtime.trapHandler.callInfoTrap(status.sipResponseCodeForTrap)
status.sipResponseCodeForTrap = None
self.callInfoTrapTimer = None
status.trapChecked = False
DELAYED_SENDING_TRAP_TIME = 1000 #4000
self.callInfoTrapTimer = utils.Timer(DELAYED_SENDING_TRAP_TIME, sendCallInfoTrap)
#KA: [20080610] call term test ==
return False # for timeout
def ready_for_video_call(self):
runtime.evas.render_now()
status.dtmf_overlap_mode = False
status.service_name = ''
if status.audio_mute:
status.toggle_audio_mute()
status.waiting = 0
runtime.modem.enter_ppp_mode()
runtime.modem.close()
if status.modem_audio_state == status.HS:
dspg.set_state(dspg.ST_V_HS_OFFHK)
elif status.modem_audio_state == status.SPK:
dspg.set_state(dspg.ST_V_SPK_OFFHK)
else:
pass
#assert False
def stop_call_for_video_call(self):
dspg.dtmf_abort()
runtime.evas.render_now()
status.dtmf_overlap_mode = False
status.service_name = ''
if status.audio_mute:
status.toggle_audio_mute()
status.waiting = 0
runtime.modem.enter_ppp_mode()
runtime.modem.close()
if status.special_cid == False:
if status.modem_audio_state == status.HS:
dspg.set_state(dspg.ST_V_HS_OFFHK)
elif status.modem_audio_state == status.SPK:
dspg.set_state(dspg.ST_V_SPK_OFFHK)
# it raised, once user release the call very quickly after send 'D'
else:
pass
#MMW add for dsp and modem ATDT
time.sleep(0.55)
#end of MMW
#assert False
if config.videocall_debug:
print "ON-HOOK COMPLETED: ", ntptime.ntime()
def set_brightness(self, index):
os.system('/bin/echo %s > /proc/sys/lvp3870/dim_control' % config.brightness[index] )
return True
def set_darkness(self, index):
os.system('/bin/echo %s > /proc/sys/lvp3870/dim_control' % config.nightmode_darkness[index] )
return True
def handle_lighting(self):
#print "[yylee debug] handle_lighting start"
if self.stage.get_name()=='nightmode setting':
# ¾ß°£Á¶¸í ¼³Á¤È¸é¿¡¼ ¹à±â Á¶Àý ½Ã ȸé¹à±â ¼³Á¤°ªÀ¸·Î º¸¿©Áö´Â ¹®Á¦ ÇØ°áÀ» À§ÇÔ.
return True
if setting.nightmode_enable == 1:
# nightmode enable but from/to time not set
if setting.nightmode_from_hour == None or \
setting.nightmode_from_min == None or \
setting.nightmode_to_hour == None or \
setting.nightmode_to_min == None:
if self.in_night_mode:
#print "[yylee debug] lighting#1 set brightness level:", setting.brightness
self.set_brightness(setting.brightness - 1)
self.in_night_mode = False
self.stop_nightmode_screenoff_timer()
return True
else:
import time
year,month,day,h,m,ss,w = time.localtime(setting.current_time)[0:7]
cur_time_in_minute = h*60 + m
from_time_in_minute = setting.nightmode_from_hour*60 + setting.nightmode_from_min
to_time_in_minute = setting.nightmode_to_hour*60 + setting.nightmode_to_min
#print '[yylee debug] cur time : %d h %d m' % (h,m)
#print "[yylee debug] cur_time_in_minute:", cur_time_in_minute
#print "[yylee debug] from_time_in_minute:", from_time_in_minute
#print "[yylee debug] to_time_in_minute:", to_time_in_minute
# Nightmode Àû¿ë ½Ã°£ ³» À̸é, set_darkness
if from_time_in_minute < to_time_in_minute:
if cur_time_in_minute >= from_time_in_minute and cur_time_in_minute < to_time_in_minute:
if not self.in_night_mode:
#print "[yylee debug] lighting#2 set darkness level:", setting.nightmode_darkness
self.set_darkness(setting.nightmode_darkness -1)
self.in_night_mode = True
if setting.nightmode_screenoff_enable==1:
self.start_nightmode_screenoff_timer()
else:
#print "[yylee debug] lighting#2 not in night mode"
if setting.nightmode_screenoff_enable==1:
if self.nm_so_chk_timer == None:
self.start_nightmode_screenoff_timer()
#pass
return True
elif from_time_in_minute > to_time_in_minute:
if cur_time_in_minute >= from_time_in_minute or cur_time_in_minute < to_time_in_minute:
if not self.in_night_mode:
#print "[yylee debug] lighting#3 set darkness level:", setting.nightmode_darkness
self.set_darkness(setting.nightmode_darkness - 1)
self.in_night_mode = True
if setting.nightmode_screenoff_enable==1:
self.start_nightmode_screenoff_timer()
else:
#print "[yylee debug] lighting#3 not in night mode"
pass
return True
if self.in_night_mode:
#print "[yylee debug] lighting#4 set brightness level:", setting.brightness
self.set_brightness(setting.brightness - 1)
self.in_night_mode = False
self.stop_nightmode_screenoff_timer()
return True
def start_nightmode_timer(self):
#print 'start_nightmode_timer'
#print "[yylee debug] run nightmode timer"
self.handle_lighting()
t = config.nightmode_check_timer
self.nm_chk_timer = utils.Timer(t, self.start_nightmode_timer)
def stop_nightmode_timer(self):
#print 'stop_nightmode_timer'
self.nm_chk_timer = None
self.stop_nightmode_screenoff_timer()
def start_nightmode_screenoff_timer(self):
#print 'start_nightmode_screenoff_timer'
import utils
if self.nm_so_chk_timer == None:
if utils.check_lcd_on():
self.nm_so_chk_timer = utils.Timer(10000, self.active_nightmode_screenoff)
def stop_nightmode_screenoff_timer(self):
#print 'stop_nightmode_screenoff_timer'
import utils
self.nm_so_chk_timer = None
if not utils.check_lcd_on():
utils.lcd_on()
def active_nightmode_screenoff(self):
#print 'active_nightmode_screenoff'
import utils
self.nm_so_chk_timer = None
if utils.check_lcd_on():
utils.lcd_off()
status.screensaver_activated = True
def handle_dtmf(self, dtmf):
roxia_trace('manager.handle_dtmf(), dtmf:', dtmf, 'phone_status:', status.VoiceConnected, 'videocall_mode:', status.videocall_mode)
# audio call connected »óÅ¿¡¼ video request(dtmp 'C')¸¦ º¸³»·Á°í ÇÔ
if status.CheckRequestDtmf(dtmf) and status.phone_status==status.VoiceConnected:
if status.videocall_mode == status.VideoCallDisconnected:
# logging for snmp
#runtime.log.log("Received DTMF '"+dtmf+"' from caller for video call" )
def cb_change_to_get_video_call_requested():
#eicho add 06.01.17
if status.business_option_status == status.CallConferenceOption:
roxia_trace('# CAN NOT ACCEPT VIDEO CALL - status.business_option_status==status.CallConferenceOption')
return False
if status.business_call_status != status.OneCallConnected :
roxia_trace('# CAN NOT ACCEPT VIDEO CALL - status.business_call_status != status.OneCallConnected')
return False
if self.stage.get_name() == 'VideoCallImpossible':
self.back_stage()
from model import VideoCallRequestedStage
stage = VideoCallRequestedStage
self.stack_stage(stage)
return False
runtime.evas.idle_add(cb_change_to_get_video_call_requested)
elif status.videocall_mode == status.VideoCallRequested:
runtime.evas.idle_add(self.stage.video_call_requested_overlaped)
return True
return False
def handle_cid(self, number):
from ntptime import set_timediff
# RHC / [20061016_1]
#set_timediff(status.received_date+status.received_time)
if status.received_date and status.received_time:
set_timediff(status.received_date+status.received_time)
# RHC / [20061016_1]--
if status.ring_count == 2:
# discard right previous ring ..
# do not quit play rining.. continously ringing.. OK
status.ring_count = 1
status.ring_timer = False
status.ring_guard_timer = None
self.handle_ring()
elif status.ring_count != 1:
#»ó´ë¹æÀÌ ÀüȺ§ÀÌ ¿ï¸®´Ù ²÷¾ú´Âµ¥ ´Ù¸¥ ÀüȰ¡ ¿À´Â °æ¿ì
status.missed_call_count += 1
if status.caller_number:
import calldb
callLogTime = utils.make_call_time()
runtime.mmiDebug.mmiTrace('8status.currentCallDuration = ', status.currentCallDuration)
runtime.mmiDebug.mmiTrace('status.currentCallDuration_copy = ', status.currentCallDuration_copy)
calldb.add_call_log('missed', status.caller_number, callLogTime)
if setting.missedCallAlarm:
from phonedb import phonedb
callerNumber = status.display_caller_number(status.active_call_index)
callerName = phonedb.get_name_by_number(callerNumber)
missedCallAlarmNumber = '%s;%s;%s' % (setting.missedCallAlarmNumber1, setting.missedCallAlarmNumber2, setting.missedCallAlarmNumber3)
runtime.eaHandler.sendMissedCallAlarm(0, missedCallAlarmNumber, callerNumber, callerName, 0)
self.kill_ringer()
if runtime.manager.stage.get_name() == 'incoming':
stage = MissedIncomingCallStage
self.change_stage(stage)
self.handle_ring()
if status.modem_audio_state != status.IDLE:
return
number = number.replace('-', '')
if not number:
return
if number not in ('P', 'O') and not number.isdigit():
return
self.cid_waiter = None
status.special_cid = utils.check_special_nas_number(number)
if profile.ip_mode == 1:
status.special_cid = False
if status.special_cid:
status.special_nas_number = utils.get_special_nas_number(number)
number=' '
# SPECIAL CID Àΰæ¿ì´Â ½ÇÁ¦ CID°¡ ¾ø½À´Ï´Ù.
# CID°¡ ¾øÀ¸¹Ç·Î CALL LOG µµ ÀúÀå ¾ÈÇÕ´Ï´Ù.
status.ring_timer = None
if runtime.manager.stage.get_name() == 'VideoCallConnecting' :
runtime.manager.stage.get_indirvideo_special_cid(True)
else:
self.change_stage(VideoCallConnectingStage(True), True)
return
sc_number = setting.service_center2 + setting.terminal_number
if setting.service_center2 and number.startswith(sc_number):
status.caller_number = number
if len(number) != 1 + len(sc_number):
return True
isrecply = False
isrecord = False
if utils.player.videopid or utils.player.amr:
isrecply = True
if utils.player.videopid_record or utils.player.amr_record:
isrecord = True
utils.player.stop()
if isrecord:
self.stage.timer_stop()
if isrecply:
time.sleep(2)
dspg.set_state(dspg.ST_IDLE)
status.sms_deliver_mode = number[-1]
if config.sms_debug:
print 'sms number:', number
print 'sms deliver mode', status.sms_deliver_mode
if '2' <= status.sms_deliver_mode <= '9' or setting.sms_enable == 0:
if config.sms_debug:
print 'sms: dont answer this call'
return
status.sms_storage_full = False
from smsmanager import smsmgr
status.mms_storage_full = False
from mmsconfig import mms_message_entry_max
from mmsmanager import mmsmgr
if len(smsmgr.received_info) >= config.message_entry_max \
or len(mmsmgr.inbox_info) >= mms_message_entry_max:
if len(mmsmgr.inbox_info) >= mms_message_entry_max:
status.mms_storage_full = True
if config.sms_debug:
print 'Max message exceed!'
if status.sms_deliver_mode == '1':
if config.sms_debug:
print 'sms: dont answer this call'
return
if status.sms_deliver_mode == '0':
status.sms_storage_full = True
try:
runtime.modem.sms_answer_prepare()
except:
import traceback
traceback.print_exc()
runtime.modem.sms_cleanup()
status.caller_number = ''
if config.sms_debug:
print 'sms answer failed'
return
self.kill_ringer()
# for sms notify ring, ring disable ÀÌ ¾Æ´Ñ °æ¿ì¿¡¸¸
if setting.ringing_mode != 1:
if config.sms_debug:
print 'sms notify ring start'
utils.player.play(config.sms_ring, loop=False)
if config.sms_debug:
print 'sms notify ring end'
if config.sms_debug:
print 'incoming sms'
if self.stage.name == 'incoming':
self.back_stage()
self.handle_incoming_sms(isrecord)
status.caller_number = ''
return
else:
status.caller_number = number
if self.stage.name == 'incoming' and number not in ('P', 'O'):
from phonedb import phonedb
caller_name = phonedb.get_name(number)
self.stage.ui.change_caller_number(caller_name)
snapshot = phonedb.get_snapshot(number)
if snapshot and status.special_cid==False:
self.stage.ui.set_avata(snapshot)
self.stage.ui.avata.show()
def remove_stage(self, stageDestory=True):
if config.stage_debug:
print "remove backup stage"
for stage in self.back:
stage.destroy()
self.back = []
def save_idle_stage(self):
# history clearÈÄ¿¡
if config.stage_debug:
print "manager's backup stage", self.back
for s in self.back:
s.destroy()
self.back = []
stage = IdleStage
# backÀ¸·Î IdleÃß°¡
if callable(stage):
stage = stage()
self.back.append(stage)
if config.stage_debug:
print "(save_idle_stage)"
#if isshow:
# stage.show()
#stage.onDoinit()
#stage.oninit()
def change_stage_org(self, stage, clear_history=False):
if runtime.manager.stage.get_name() == 'SupervisionConnected':
runtime.manager.stage.end_supervision()
#assert stage
if clear_history:
if config.stage_debug:
print "manager's backup stage", self.back
for s in self.back:
s.destroy()
self.back = []
elif stage.name == 'idle':
#assert not self.back
pass
self.stage.destroy()
if callable(stage):
stage = stage()
self.stage = stage
if config.stage_debug:
print "(change)", stage, "name='" + stage.name + "'"
stage.show()
stage.oninit()
def change_stage(self, stage, clear_history=False):
#print 'ka....########### stage =', stage, type(stage)
#print 'ka....########### back =', self.back
#print 'ka....########### clear_history =', clear_history
def back_check():
for s in self.back:
if s.get_name() == 'idle':
return True
return False
# historyÃ¼Å©ÇØ¼ IdleStage°¡ ¾ø´Â °æ¿ì
if not back_check() and self.stage.get_name() != 'idle':
#print 'ka....historyÃ¼Å©ÇØ¼ IdleStage°¡ ¾ø´Â °æ¿ì'
# 1. °¡·Á°í ÇÏ´Â Stage°¡ idleÀÎ °æ¿ì »õ·Î ±×·ÁÁØ´Ù.
#if stage.get_name() == 'idle': #################################### ¿ä°Å ³ªÁß¿¡ üũ
# if stage.name == 'idle': #################################### ¿ä°Å ³ªÁß¿¡ üũ
#if stage == IdleStage or stage.get_name() == 'idle':
if stage == IdleStage or stage.name == 'idle':
#print 'ka.......1. °¡·Á°í ÇÏ´Â Stage°¡ idleÀÎ °æ¿ì »õ·Î ±×·ÁÁØ´Ù. '
for s in self.back:
s.destroy()
self.back = []
self.stage.destroy()
if callable(stage):
stage = stage()
self.stage = stage
if config.stage_debug:
print "(change)", stage, "name='" + stage.name + "'"
stage.show()
stage.oninit()
# 2. ´Ù¸¥ Stage·Î ÀüȯÇÏ´Â °æ¿ì
else:
#print 'ka.......2. ´Ù¸¥ Stage·Î ÀüȯÇÏ´Â °æ¿ì '
#assert stage
if clear_history:
if config.stage_debug:
print "manager's backup stage", self.back
for s in self.back:
s.destroy()
self.back = []
self.stage.destroy()
if callable(stage):
stage = stage()
self.stage = stage
if config.stage_debug:
print "(change)", stage, "name='" + stage.name + "'"
stage.show()
stage.oninit()
return
#if runtime.manager.stage.get_name() == 'SupervisionConnected':
# runtime.manager.stage.end_supervision()
# clear_historyÀÇ °æ¿ì¿¡µµ idlestage´Â backÀ¸·Î ³²°ÜµÐ´Ù.
#print 'ka.....#####111 self.stage=', self.stage
#print 'ka....#####222 self.back=', self.back
exist_stage = None
if clear_history:
for s in self.back:
#print 'ka..---s =', s
#print 'ka...s.get_name()=', s.get_name()
if s.get_name() != 'idle':
s.destroy()
else:
exist_stage = s
#print 'ka................exist_stage=', exist_stage
self.back=[]
if exist_stage != None:
self.back.append(exist_stage)
#print 'ka...####### self.back=', self.back
#print 'ka....go to stage.get_name=', stage.get_name()
#print 'ka.......stage.name=', stage.name
#print 'ka.......self.stage.name=', self.stage.name
if stage.name == 'idle': #################################### ¿ä°Å ³ªÁß¿¡ üũ
#print 'ka......go to Idle Stage'
self.back_stage()
else:
#print 'ka......go to Other Stage stack'
# ÇöÀç Stage°¡ IdleÀÎ °æ¿ì¿¡´Â ±×´ë·Î stack
if self.stage.get_name() == 'idle':
self.stack_stage(stage)
else:
self.stage.destroy()
if callable(stage):
stage = stage()
self.stage = stage
if config.stage_debug:
print "(change)", stage, "name='" + stage.name + "'"
stage.show()
stage.oninit()
else:
#print 'ka.....self.stage=', self.stage
#print 'ka.,.....self.stage.name=', self.stage.name
#print 'ka....self.stage.get_name=', self.stage.get_name()
if self.stage.get_name() == 'idle':
self.stack_stage(stage)
else:
self.stage.destroy()
if callable(stage):
stage = stage()
self.stage = stage
if config.stage_debug:
print "(change)", stage, "name='" + stage.name + "'"
stage.show()
stage.oninit()
def stack_again_stage(self):
runtime.manager.back_stage()
def stack_stage(self, stage, isshow=True):
if runtime.manager.stage.get_name() == 'SupervisionConnected':
runtime.manager.stage.end_supervision()
#assert stage
self.stage.hide()
self.back.append(self.stage)
if callable(stage):
stage = stage()
self.stage = stage
#assert stage.name != 'idle'
if config.stage_debug:
print "(stack)", stage, "name='" + stage.name + "'"
if isshow:
stage.show()
stage.oninit()
def queue_backward(self, count):
def back(count):
if config.stage_debug:
print '*********back callback', count
if not count:
return
count -= 1
while self.back and count:
count -= 1
pop = self.back.pop()
pop.destroy()
self.back_stage()
return False
runtime.evas.idle_add(back, count)
def change_language(self):
self.stage.ui.change_language()
for stage in self.back:
stage.ui.change_language()
#### update back widgets
# def change_theme(self):
# try:
# self.stage.ui.change_theme()
# except:
# pass
# for stage in self.back:
# try:
# stage.ui.change_theme()
# except:
# pass
# import uiconfig
# baseui.load_theme(runtime.evas, uiconfig.current_theme)
# start shchun : add include_myself option
def find_stage(self, name, include_myself=False):
if include_myself:
if self.stage.get_name() == name:
return self.stage
if not self.back:
return None
for i in range(len(self.back) -1, -1, -1):
if self.back[i].get_name() == name:
return self.back[i]
return None
# end shchun
def pop_stage(self, name=''):
#assert self.back
if name:
for i in range(len(self.back) -1, -1, -1):
if self.back[i].get_name() == name:
self.back.pop(i)
break
return None
else:
return self.back.pop()
def back_stage(self, name='', isshow=True):
if runtime.manager.stage.get_name() == 'SupervisionConnected' and \
status.supervision_call_on == 1:
runtime.manager.stage.release_supervision()
isidle = False
if name and self.back:
#assert type(name) == type('')
while self.back:
if self.stage.get_name() == name:
break
if config.stage_debug:
print "(back.destroy)", self.stage, "name='" + self.stage.name + "'"
self.stage.destroy()
self.stage = self.pop_stage()
if config.stage_debug:
print "(back)", self.stage, "name='" + name + "'"
if isshow:
self.stage.show()
return
self.stage.destroy()
if self.back:
stage = self.pop_stage()
else:
stage = IdleStage()
isidle = True
self.stage = stage
if config.stage_debug:
print "(back)", stage, "name='" + stage.name + "'"
if isshow or isidle:
stage.show()
def back_activate(self, left=True):
if self.back:
stage = self.back[-1]
if left:
stage.back_activate_menu1()
else:
stage.back_activate_menu2()
def handle_msg_waiting(self):
self.cid_waiter = None
#Roxia Begin cmlim 06.06.14
#self.kill_ringer()
self.kill_ringer(bmwi=True)
#Roxia End cmlim
if self.stage.name == 'idle':
self.stage.handle_msg_waiting()
runtime.evas.render_now()
#Roxia Begin cmlim 06.04.11
elif runtime.manager.stage.get_name() == 'missed_incomingcall':
runtime.manager.stage.handle_msg_waiting()
runtime.evas.render_now()
#Roxia End cmlim 06.04.11
def handle_mwi_waiting(self):
if runtime.manager.stage.get_name() == 'idle':
runtime.manager.stage.handle_mwi_waiting()
runtime.evas.render_now()
#Roxia Begin cmlim 06.04.13
elif runtime.manager.stage.get_name() == 'missed_incomingcall':
runtime.manager.stage.handle_mwi_waiting()
runtime.evas.render_now()
#Roxia End cmlim 06.04.13
if status.phone_status == status.Disconnected and status.mwi_notification_window == 1:
stage = MWINotifyStage
runtime.manager.stack_stage(stage)
def handle_M_Notification_Ind(self, smsSipHandler):
from smtp import M_Notification_Ind_SMS, MmsHeaderHandler, MmsMessageHandler, M_NotifyResp_Ind_SMS
from smsmanager import smsmgr
mNotificationIndSms = M_Notification_Ind_SMS(smsSipHandler)
result = smsmgr.saveReceivedMessage(mNotificationIndSms)
if runtime.manager.stage.get_name() == 'idle':
self.stack_stage(IncomingSMSStage_KT(mNotificationIndSms))
elif runtime.manager.stage.get_name() == 'incoming_sms':
self.change_stage(IncomingSMSStage_KT(mNotificationIndSms))
if result:
# MMS header
mmsHeaderHandler = MmsHeaderHandler()
mmsHeaderHandler.setToName('0428706018')
mmsHeaderHandler.setToDomain('octave.com')
mmsHeaderHandler.setMmsTo(mmsHeaderHandler.makeMmsTo())
mmsHeaderHandler.setDeliveryTime(mmsHeaderHandler.makeTimeStamp())
import mms_net_define
mmsHeaderHandler.setMmsMessageType(mms_net_define.M_NOTIFYRESP_IND)
mmsHeaderHandler.setMmsMessageID(mNotificationIndSms.mmsMessageHandler.mmsHeaderHandler.getMmsMessageID())
mmsHeaderHandler.setMmsStatus(mms_net_define.NOTIFIED)
# make MMS message
self.mmsMessage = MmsMessageHandler(mmsHeaderHandler)
### SEND
self.mNotifyRespIndSms = M_NotifyResp_Ind_SMS(self.mmsMessage)
#self.mSendReqSMS.setTargetUserName(self._dest)
#self.mSendReqSMS.setTargetHostName('ktwibro.net')
self.mNotifyRespIndSms.setSipContentType(mms_net_define.SMS_BUDDY)
self.mNotifyRespIndSms.setSipSubject(mms_net_define.M_NOTIFYRESP_IND)
self.mNotifyRespIndSms.makeSipBodyFile()
self.mNotifyRespIndSms.send()
else:
pass
def handle_incoming_sms(self, isrecord):
if config.sms_debug:
print 'handling_incoming_sms'
from model import SMSReceivingStage
status.incoming_sms = True
from alarm import agenda_activate
bagenda = False
if 'agendaactivatestage' == runtime.manager.stage.get_name():
runtime.manager.back_stage()
bagenda = True
if isrecord:
self.change_stage(SMSReceivingStage)
else:
self.stack_stage(SMSReceivingStage)
if bagenda:
agenda_activate()
runtime.evas.render_now()
smsreceived = False
msgs = []
try:
for m in sms.recv(runtime.modem):
msgs.append(m)
if (SMSMESSASGE == m.bMMSNoti):
smsreceived = True
except:
if config.sms_debug:
import traceback
print traceback.print_exc()
msgs = []
if status.interrupt_key:
self.queue_interrupt()
if config.key_debug:
print 'interupt key', status.interrupt_key
from mmsmanager import mmsmgr
from setting import setting
mmsnotireceived = False
for mmsmsg in msgs:
#SPREE NOTI TEST
if TEST_CTR_NET and not cmp(mmsmsg.contents[0][1], 'MMS'):
print 'MMS NOTI'
mmsmsg.bMMSNoti = True
mmsmsg.contents = tempnoti
if setting.mms_enable and mmsmsg.bMMSNoti:
mmsnotireceived = True
re,er_t = mmsmgr.insert_received_noti(mmsmsg.contents)
if not re:
if 'MemoryError' == er_t:
self.stage.got_error = True
import smsstage
self.change_stage(smsstage.MessageNotify(_('Message Storage Full!')))
return
else:
return
#sms¸¦ ¼ö½Å ¹ÞÀº °æ¿ì¸¸ °Ë»ç.
if status.sms_storage_full and not self.find_stage('sms full'):
import smsstage
self.stage.next_stage = smsstage.SMSFullStage()
self.stage.clear(mmsnotireceived, smsreceived)
return
if not msgs:
self.stage.got_error = True
self.stage.clear(mmsnotireceived, smsreceived)
return
for m in msgs:
from smsmanager import smsmgr
from basemodel import StorageFullError
try:
if (SMSMESSASGE == m.bMMSNoti):
smsmgr.insert_msg(m)
setting.incoming_sms_type = m.type
if len(m.get_pictures()) + len(m.get_melodies()) > 0:
setting.incoming_sms_type = 'ems'
except StorageFullError:
self.stage.got_error = True
import smsstage
self.change_stage(smsstage.MessageNotify(_('SMS Storage Full!')))
return
self.stage.clear(mmsnotireceived, smsreceived)
def is_vip(self):
# CID °¡ ¿ÀÁö ¾Ê´Â °æ¿ì
if not status.caller_number:
return False
from phonedb import phonedb
index = phonedb.find(status.caller_number)
if index >= 0:
item = phonedb.get_item(index)
return item.vip
return False
def handle_missing_call(self):
import calllog
runtime.SP_context.goIdleState()
import calldb
from mmiSoundPath import SP_Context
baseCallStatus, baseStatus, dectCallStatus, dectStatus = status.getCurrentCallStatus()
if baseCallStatus == SP_Context.INCOMING_VIDEO:
runtime.mmiDebug.mmiTrace('9status.currentCallDuration = ', status.currentCallDuration)
runtime.mmiDebug.mmiTrace('status.currentCallDuration_copy = ', status.currentCallDuration_copy)
calldb.add_call_log('missed', status.caller_number, 0, 0, status.video_call_time, ntptime.ntime() - status.video_call_time)
if runtime.dectCallManager.isSubcribedDect():
from dectConfig import MessageCode
runtime.dectCallManager.sendVideophoneStatusReportToDect(MessageCode.VP_STATUS.IDLE)
elif baseCallStatus == SP_Context.INCOMING_AUDIO:
runtime.mmiDebug.mmiTrace('10status.currentCallDuration = ', status.currentCallDuration)
runtime.mmiDebug.mmiTrace('status.currentCallDuration_copy = ', status.currentCallDuration_copy)
calldb.add_call_log('missed', status.caller_number, status.call_time, ntptime.ntime() - status.call_time, 0, 0)
# ºÎÀçÁß SMS
if setting.missedCallAlarm:
from phonedb import phonedb
callerNumber = status.caller_number
callerName = phonedb.get_name_by_number(callerNumber)
missedCallAlarmNumber = '%s;%s;%s' % (setting.missedCallAlarmNumber1, setting.missedCallAlarmNumber2, setting.missedCallAlarmNumber3)
if status.video_mode == status.VideoIncoming:
callType = 1
else:
callType = 0
runtime.eaHandler.sendMissedCallAlarm(callType, missedCallAlarmNumber, callerName, callerNumber, 0)
roxia_event('Manager.py handle_missing_call: release channel and reset')
status.release_channel()
status.reset_call_status()
status.waiting = 0
status.business_option_status = status.NotSelected
status.business_call_status = status.OneCallConnected
status.phone_status = status.Disconnected
status.videocall_mode = status.VideoCallDisconnected
status.supervision_remote = 0
status.videocall_remote_mute = status.VideoMuteOff
status.video_mode = status.VideoIdle
status.WhatFrom = status.from_none
status.indirect_cid = 0
status.special_cid = False
status.videocall_byuser = False
status.setClearCallStatus()
if status.caller_number:
sc_number = setting.service_center2 + setting.terminal_number
if setting.service_center2 and status.caller_number.startswith(sc_number):
if config.sms_debug:
print '*************SMS ring timeout'
#¹ÞÁö¾ÊÀº SMS call
status.caller_number = ''
return
status.missed_call_count += 1
if runtime.eaHandler.isAppInUse():
stage = MissedIncomingCallStage(True)
self.change_stage(stage)
#runtime.eaHandler.endCall()
else:
try:
if '0' in open('/proc/driver/hook_sense').read():
if runtime.vdciapp:
MD.mmiTrace('OFF HOOK START ----------')
hsOffHook = runtime.SP_context.HS_OffHook()
if hsOffHook.next():
hsOffHook.next()
from dectHandler import DectCallManager
dectStatus = runtime.dectCallManager.getDectStatus()
if dectStatus == DectCallManager.IDLE:
runtime.SP_context.handset.setTone(config.PLAY_DIAL_TONE)
else:
runtime.SP_context.handset.setTone(config.PLAY_BUSY_TONE)
from dectHandler import DectCallManager
dectStatus = runtime.dectCallManager.getDectStatus()
self.isShowing = False
if dectStatus == DectCallManager.IDLE:
status.dtmf_overlap_mode = False
stage = EnblockEditStage
else:
stage = InUseByDectStage()
else:
stage = MissedIncomingCallStage
except:
stage = MissedIncomingCallStage
self.change_stage(stage)
return
def handle_second_call_log(self):
import calldb
if status.dial_number:
if status.call_time > 0: # dialed call
'''
# eicho add 06.10.16 must not save dialed log to a call history if call to TdE services.
if status.dialed_TdESupplementary == False:
calldb.add_call_log('dialed', status.dial_number, status.call_time,\
ntptime.ntime() - status.call_time, 0, 0)
# call history ¿¡´Â ³²µÇ, REDIAL¿¡´Â ¹Ý¿µµÇÁö ¸»¾Æ¾ß ÇÑ´Ù. ...
'''
runtime.mmiDebug.mmiTrace('11status.currentCallDuration = ', status.currentCallDuration)
runtime.mmiDebug.mmiTrace('status.currentCallDuration_copy = ', status.currentCallDuration_copy)
calldb.add_call_log('dialed', status.dial_number, status.call_time,\
ntptime.ntime() - status.call_time, 0, 0)
else:
pass
elif status.caller_number:
if status.call_time > 0: # received call
runtime.mmiDebug.mmiTrace('12status.currentCallDuration = ', status.currentCallDuration)
runtime.mmiDebug.mmiTrace('status.currentCallDuration_copy = ', status.currentCallDuration_copy)
calldb.add_call_log('received', status.caller_number, status.call_time, \
ntptime.ntime() - status.call_time, 0, 0)
else: # missed call
status.call_time = ntptime.ntime()
runtime.mmiDebug.mmiTrace('13status.currentCallDuration = ', status.currentCallDuration)
runtime.mmiDebug.mmiTrace('status.currentCallDuration_copy = ', status.currentCallDuration_copy)
status.missed_call_count += 1
if setting.missedCallAlarm:
from phonedb import phonedb
callerNumber = status.display_caller_number(status.active_call_index)
callerName = phonedb.get_name_by_number(callerNumber)
missedCallAlarmNumber = '%s;%s;%s' % (setting.missedCallAlarmNumber1, setting.missedCallAlarmNumber2, setting.missedCallAlarmNumber3)
runtime.eaHandler.sendMissedCallAlarm(0, missedCallAlarmNumber, callerNumber, callerName, 0)
else:
pass
def handle_second_ring(self, bellcore=None):
def ring_timeout_cb():
status.ring_timer = None
self.kill_ringer()
self.handle_missing_call()
return False
self.cid_waiter = None
if profile.ip_mode == 0 and status.special_cid== False:
status.ring_timer = utils.Timer(config.ring_timeout, ring_timeout_cb)
if bellcore:
melody = self.get_melody(bellcore=bellcore)
else:
melody = self.get_melody()
if setting.ringing_mode == 1: # ring disable
# Disable
pass
elif setting.ringing_mode in (0, 2):
if setting.reserved_number_filter and status.caller_number in ('P', 'O'):
pass
else:
if setting.ringing_mode == 2:
# Play for one ring melody
if not setting.vip_filter or self.is_vip():
#utils.player.play(config.for_one_ring_melody, loop=False)
utils.player.play_ring(config.for_one_ring_melody, loop=False)
else:
if not setting.vip_filter or self.is_vip():
#utils.player.play(melody, onTup=True)
utils.player.play_ring(melody)
else:
utils.player.stop(onTup=True)
if status.save_callback:
self.emergency_save()
if status.save_callback_other:
self.emergency_save_other()
if status.phone_status != status.PPPConnected and profile.ip_mode == 0:
self.change_stage(IncomingStage, True)
else:
stage = runtime.manager.find_stage('incomingcall')
if stage:
runtime.manager.back_stage('incomingcall')
def print_local_time(self):
pass
# ring_timeout_guard: guard time is 3 sec. During this time,
# if any ring does not come in, ring_timeout_guard is activated.
def ring_timeout_guard(self):
self.print_local_time()
status.ring_guard_timer = None
status.ring_continuous = True
return False
def handle_newring_by_guardtimer(self):
self.print_local_time()
status.ring_continuous = False
status.ring_timer = None
status.ring_guard_timer = None
status.missed_call_count += 1
if status.caller_number:
import calldb
call_time = utils.make_call_time()
runtime.mmiDebug.mmiTrace('14status.currentCallDuration = ', status.currentCallDuration)
runtime.mmiDebug.mmiTrace('status.currentCallDuration_copy = ', status.currentCallDuration_copy)
calldb.add_call_log('missed', status.caller_number, call_time)
if setting.missedCallAlarm:
from phonedb import phonedb
callerNumber = status.display_caller_number(status.active_call_index)
callerName = phonedb.get_name_by_number(callerNumber)
missedCallAlarmNumber = '%s;%s;%s' % (setting.missedCallAlarmNumber1, setting.missedCallAlarmNumber2, setting.missedCallAlarmNumber3)
runtime.eaHandler.sendMissedCallAlarm(0, missedCallAlarmNumber, callerNumber, callerName, 0)
status.release_channel()
status.reset_call_status()
status.clear_current_call_status()
status.ring_count = 1
self.handle_ring()
# is_new_call: it returns True, if thering_guard_timer is activated.
# it means this ring is new one.
def is_new_call(self):
if status.ring_guard_timer == None :
return False
return True
def timeout_first_ring(self):
status.ring_continuous = False
status.ring_timer = None
self.kill_ringer()
status.release_channel()
status.reset_call_status()
status.clear_current_call_status()
status.ring_count = 0
if runtime.manager.stage.get_name() == 'incoming':
stage = MissedIncomingCallStage
self.change_stage(stage)
elif runtime.manager.stage.get_name() == 'missed_incomingcall' :
pass
elif runtime.manager.stage.get_name() == 'incoming_sms' :
pass
else:
status.set_modem_audio_state(status.IDLE)
dspg.set_state(dspg.ST_IDLE)
runtime.manager.change_stage(IdleStage, True)
return False
def handle_ring(self):
if status.modem_audio_state != status.IDLE:
return
if status.ring_count == 0:
status.special_cid = False
setting.reset_screen_saver_timer()
status.screensaver_activated = False
status.ring_count += 1
## Standard, Disable, First Ring, 1 after, 2 after, 3 after, 4 after
# eicho add 06.03.07 for M.P
utils.print_hw_debug("(RING)")
def ring_timeout_cb():
self.print_local_time()
status.ring_timer = None
self.kill_ringer()
self.handle_missing_call()
return False
if status.ring_count == 1:
status.caller_number = ''
status.ring_timer = utils.Timer(config.ring_timeout+config.cid_wait_timeout, self.timeout_first_ring)
if status.ring_count == 2:
if self.is_new_call() :
self.handle_newring_by_guardtimer()
else:
if status.special_cid == False:
self.handle_second_ring()
status.ring_timer = utils.Timer(config.ring_timeout, ring_timeout_cb)
elif status.ring_count >= 3:
if self.is_new_call() :
self.handle_newring_by_guardtimer()
else:
status.ring_timer = utils.Timer(config.ring_timeout, ring_timeout_cb)
if setting.ringing_mode == 2:
pass
this_time = status.ring_count== setting.ringing_mode
if this_time:
if setting.reserved_number_filter and status.caller_number in ('P', 'O'):
pass
else:
if not setting.vip_filter or self.is_vip():
#utils.player.play(self.get_melody())
utils.player.play_ring(self.get_melody())
# ÇöÀç incoming stage ÀÇ menu1 Àº ºñ¾îÀÖ´Ù.
# play ½ÃÀÛ°ú ÇÔ²² MUTE ·Î ¼¼ÆÃ
if self.stage.name == 'incoming':
self.stage.ui.set_left(_('MUTE'))
else:
pass
def get_melody(self, bellcore=None):
if utils.is_test_mode():
return config.lg_logo_melody
if bellcore:
melody = 'audios/wait/bellcore-dr'+bellcore+'_ulaw.wav'
if os.access(melody, os.R_OK):
return melody
num = status.caller_number
melody = setting.external_ring
from phonedb import phonedb
index = phonedb.find(num)
# phoneDB check
if index >= 0:
item = phonedb.get_item(index)
if item.melody and os.access(item.melody, os.R_OK):# wav, amr, mid
#if not item.melody.lower().endswith('.amr'):
melody = item.melody
#else:
# p_filename = utils.player.change_name_audiowav(item.melody)
# if os.access(p_filename, os.R_OK):
# melody = item.melody
# else:
# if config.roxia_debug: print ' file(%s) is not accessible. delete link' %p_filename
# item.melody=''
# phonedb.save()
else:
# item.melody °¡ ¾ø´Â °æ¿ì, groub bellüũ
from groupdb import groupdb
group_index = item.group
item = groupdb.get_item(int(group_index))
group_bell = item[2]
if group_bell and not group_bell.startswith('/usr/local/lgvp/'):
group_bell = '/usr/local/lgvp/' + group_bell
if group_bell and os.access(group_bell, os.R_OK):
melody = group_bell
else:
melody = setting.external_ring
groupdb.set_melody(int(group_index))
#item.melody=''
#phonedb.save()
else:
melody = setting.external_ring
if melody and os.access(melody, os.R_OK):
return melody
elif setting.external_ring and os.access(setting.external_ring, os.R_OK):
return setting.external_ring
return config.def_melody
def start_call(self, number=None, visible_number=None, video_call=False, notPrefix=False, supplementary=False):
if len(number) > config.max_phone_number:
if profile.ip_mode != 0 or profile.ip_mode == 0 and status.videocall_byuser or\
profile.ip_mode == 0 and video_call:
import options
runtime.manager.stack_stage(options.NotifyMessageBackToOneCallStage(_('Max length exceeded')))
return
if number:
if len(number) > 6:
if not (number[0] in ['0', '1', '*', '#', '+']):
number = setting.prefix + number
status.dial_number = number
if status.videocall_byuser == True:
video_call = True
#runtime.vdci_stop_tone()
runtime.SP_context.stopTonePlay()
self.start_ip_call(status.dial_number, video_call=video_call)
return
#######################################
# ip profile, audio/video call start point
# video_call: true(video), false(audio)
#######################################
def start_ip_call(self, number=None, video_call=False, direct=False, answer_after=False, hostName=None):
status.dial_number = number
roxia_event('----------------------------->>>')
roxia_event('manager.start_ip_call()')
roxia_event('video_mode:', status.video_mode, 'dial_number:', status.dial_number)
roxia_event('register_mode:', status.get_register_mode())
if runtime.vdciapp == None:
roxia_event('vdciapp not running..')
roxia_trace('-----------------------------<<<')
if self.check_call_barring(number, video_call):
stage = CallBarringStage(number)
self.change_stage(stage, True)
return
if setting.out_intlcall_restrict:
if number.startswith('00') or number.startswith('+'):
status.setClearCallStatus()
runtime.SP_context.goIdleState()
stage = CallBarringStage(number)
self.change_stage(stage, True)
return
if setting.out_060_restrict:
if number.startswith('060'):
status.setClearCallStatus()
runtime.SP_context.goIdleState()
stage = CallBarringStage(number)
self.change_stage(stage, True)
return
if video_call == True:
if self.check_limited_number(number):
stage = CallLimitedStage(number)
self.change_stage(stage, True)
return
elif status.dial_number.startswith(config.FAC_HIDE_ID_CODE):
roxia_trace('*** cannot video call in hide number. ip')
stage = CallProhibitStage(_('Cannot make video call with hide number option.'))
self.change_stage(stage, True)
return
# status.VideoError´Â »ç¿ëµÇ°í ÀÖÁö ¾ÊÀ½
'''
if status.video_mode == status.VideoError:
stage = PhoneSettingNotifyStage(_('Connection error occurred'))
self.change_stage(stage, True)
return
elif status.get_register_mode() == status.RegisterError:
stage = PhoneSettingNotifyStage(_('Registration failed'))
self.change_stage(stage, True)
return
elif runtime.vdciapp == None:
# 07.07 »ç¿ëÀÚ¿¡°Ô vdci not load¸¦ º¸¿©ÁÖÁö ¾Ê´Â´Ù. ´ë½Å network condition..
stage = PhoneSettingNotifyStage(_('Check network connection'))
self.change_stage(stage, True)
return
'''
from vdcisetting import vdci_setting
# 1. ±ä±Þ È£ ¹øÈ£ÀÎÁö üũ
# 2. CSCF/SBC proxy 1°³ ÀÌ»ó ¼³Á¤
# 3. µî·Ï ÁßÀÎ °æ¿ì¿¡´Â ½ÃµµÇÏÁö ¾Ê´Â´Ù.
# 4. LAN¼±ÀÌ »ÌÇô ÀÖ´Â °æ¿ì ½ÃµµÇÏÁö ¾Ê´Â´Ù.
# 5. ½ÃµµÈÄ 504¸Þ½ÃÁö ¹ÞÀ¸¸é "¼¹ö¿¡ ¿¬°áÇÒ ¼ö ¾ø½À´Ï´Ù. Àç½ÃµµÇÏ·Á¸é ÅëȹöưÀ» ´©¸£¼¼¿ä"
if runtime.vdciapp == None:
stage = PhoneSettingNotifyStage(_('Check network connection'))
self.change_stage(stage, True)
return True
elif utils.check_emergency(number) and (vdci_setting.tel_num and vdci_setting.auth_pwd) and \
status.get_connection():
if errorcode.get_idle_errmsg() == errorcode.msg_M102 or \
errorcode.get_idle_errmsg() == errorcode.msg_SR103:
stage = PhoneSettingNotifyStage(_('You should register first'))
self.change_stage(stage, True)
status.dial_number = ''
return True
pass
elif status.get_register_mode() == status.NotRegistered and not direct:
roxia_event('manager.start_ip_call(), Not Registered')
stage = PhoneSettingNotifyStage(_('You should register first'))
self.change_stage(stage, True)
status.dial_number = ''
return True
if status.video_mode != status.VideoIdle:
roxia_event('manager.start_ip_call(), videomode NOT VideoIdle')
return
runtime.evas.render_now()
status.dtmf_overlap_mode = False
# dial_number is EMPTY
if not status.dial_number:
import calldb
try:
detail = calldb.get_detail('dialed', 0)
status.dial_number = detail.number
except:
return
setting.voipTermCall = setting.voipTermCall + 1
runtime.mmiDebug.mmiTrace('start_ip_call:setting.voipTermCall = ', setting.voipTermCall)
runtime.mmedia.unload()
runtime.SP_context.setSoundpathVolume()
runtime.SP_context.SP_stereoStopPlayback()
if video_call == True:
stage = DirectVideoCallingStage(status.dial_number, hostName)
else:
stage = DirectAudioCallingStage(status.dial_number, hostName)
self.change_stage(stage, True)
def check_limited_number(self, num):
roxia_trace('manager.check_limited_number(), num=', num)
if not num:
return False
num = num.replace('P', '')
num = num.replace('O', '')
if 'R' in num:
num = num.split('R')[-1]
def get_limited_number():
limited_list = []
try:
for line in file(config.limited_list_file):
line = line.strip()
limited_list.append(line)
except:
pass
return limited_list
if num:
if setting.phone_extension and num.startswith(setting.phone_extension):
num = num[len(setting.phone_extension):]
if num.startswith(config.FAC_HIDE_ID_CODE):
num = num[len(config.FAC_HIDE_ID_CODE):]
limited_list = get_limited_number()
for limited in limited_list:
if limited and num.startswith(limited):
return True
return False
def check_call_barring(self, num, videocall=False):
roxia_trace('manager.check_call_barring(), num=', num)
if videocall == True:
if setting.barring_video_enable == 0:
return False
else:
if setting.barring_voice_enable == 0:
return False
if not num:
return False
num = num.replace('P', '')
num = num.replace('O', '')
if 'R' in num:
num = num.split('R')[-1]
roxia_trace('check_call_barring(), check dial number...')
if num:
if setting.phone_extension and num.startswith(setting.phone_extension):
num = num[len(setting.phone_extension):]
if num.startswith(config.FAC_HIDE_ID_CODE):
num = num[len(config.FAC_HIDE_ID_CODE):]
barrings = setting.call_barring_prefix1, setting.call_barring_prefix2, \
setting.call_barring_prefix3, setting.call_barring_prefix4, \
setting.call_barring_prefix5
for bar in barrings:
if bar and num.startswith(bar):
return True
return False
def handle_snmp_message(self, message, arg=None):
if message == 'text_message_show':
text = arg
import model
self.stack_stage(model.MaintenanceMessageStage(text))
elif message == 'text_message_hide':
self.back_stage()
elif message == 'sip_calling':
if arg:
import model
self.stack_stage(model.VideoCallConnectingStage(snmp=True))
else:
pass
elif message == 'connection_closed':
self.stage.cancel()
else:
pass
#assert False
def set_videocall_mode(self, mode):
roxia_event('set videocall_mode =', mode)
status.videocall_mode = mode
#ka...wizard 2007.04.23
def start_wizard(self):
stage = InitDirectionStage()
runtime.manager.change_stage(stage)
# KA: [20080414] dect base reset ½Ã BASEÀÇ »óŸ¦ ¾Ë·ÁÁÖ±â À§ÇØ
#MMW
# def set_bootinfo(self):
def set_bootinfo(self, value):
# value = 0 ( broadcom is idle)/ 1 ( broadcom is not ready)
#end of MMW
try:
fp = open('/proc/sys/lvp3870/broadcom_dect_idle', 'w')
# fp.write('0')
fp.write(value)
fp.close()
except:
pass
def set_registerinfo(self, value):
# value = 0 (success) / 1 (fail)
try:
fp = open('/proc/sys/lvp3870/broadcom_sip_reg_success', 'w')
fp.write(value)
fp.close()
except:
pass
# KA: [20080414] dect base reset ½Ã BASEÀÇ »óŸ¦ ¾Ë·ÁÁÖ±â À§ÇØ ==
# KA: [20080503] new register error code
def check_settings(self):
from vdcisetting import vdci_setting
import uiconfig
msg = _('Please use after register to server')
# check tel num ------------
if vdci_setting.tel_num:pass
else:
roxia_trace('Check telnum fail')
#stage = NotifyStage(msg, icon = uiconfig.video_call_connect_icon)
#runtime.manager.stack_stage(stage)
return False
# check authentication ------------
#if vdci_setting.auth_name and vdci_setting.auth_pwd:pass
#else:
# roxia_trace('Check authentication fail')
# #stage = NotifyStage(msg, icon = uiconfig.video_call_connect_icon)
# #runtime.manager.stack_stage(stage)
# return False
# domain name ------------
if vdci_setting.domain:pass
else:
roxia_trace('Check domain fail')
#stage = NotifyStage(msg, icon = uiconfig.video_call_connect_icon)
#runtime.manager.stack_stage(stage)
return False
# cscf/sbc address and port
if utils.check_private_range():
# check sbc proxy
if vdci_setting.primary_sbc_addr and vdci_setting.primary_sbc_port:pass
elif vdci_setting.secondary_sbc_addr and vdci_setting.secondary_sbc_port:pass
else:
roxia_trace('Check SBC fail')
#stage = NotifyStage(msg, icon = uiconfig.video_call_connect_icon)
#runtime.manager.stack_stage(stage)
return False
else:
# check public proxy
if vdci_setting.proxy_addr and vdci_setting.proxy_port:pass
elif vdci_setting.backup_proxy_addr and vdci_setting.backup_proxy_addr:pass
else:
roxia_trace('Check CSCF fail')
#stage = NotifyStage(msg, icon = uiconfig.video_call_connect_icon)
#runtime.manager.stack_stage(stage)
return False
return True
def register_failed(self):
roxia_trace('###### common.register_failed() ##########')
status.set_register_mode(status.NotRegistered)
status.set_regstatus(0)
# do not change mmi stage on running browser
curr_stage_name = runtime.manager.stage.get_name()
if ((curr_stage_name == 'myann') or (runtime.manager.find_stage('myann'))):
print "[manager] do nothing on running browser"
return
#msg = _('De-registered.') + '\n' + _('Press the call button if you want register.')
import uiconfig
msg = _('De-registered.\nPress the call button.')
utils.player.play_effect(config.SETTING_FAILED)
stage = RegisterNotifyStage(msg)
runtime.manager.change_stage(stage, True)
runtime.evas.render_now()
# KA: [20080503] new register error code ==
class RegisterNotifyStage(NotifyStage):
def __init__(self, message, cb=None):
import uiconfig
icon = uiconfig.baloon_video_setting_icon
NotifyStage.__init__(self, message, icon, cb, duration=1000)
def destroy(self):
status.critical_entered = True
NotifyStage.destroy(self)
#ºÎÆÃÈÄ Registration
class RegisteringIdleStage(Stage):
name = "idleregistering"
def __init__(self, initialize=False):
debugLogN('RegisteringIdleStage.__init__: start')
import ui
self.ui = ui.VideoCallRegisteringUI()
# ka...2008.06.24:
#runtime.manager.start_vdciapp()
import phonesetting
phonesetting.vdci_reload()
#if initialize:
# ka...2008.06.24 ==
self.tag_register = utils.Timer(config.timeoutRegister, self.register_timeout)
# yylee added to set timer
import alarm
if alarm.alarm_valid():
setting.set_agenda_time(5*1000, alarm.alarm_activate)
debugLogN('RegisteringIdleStage.__init__: end')
def register_sucessed(self):
debugLogN('RegisteringIdleStage.register_sucessed: start')
self.remove_reg_timer()
status.set_need_ping_chk_flag(False)
status.set_register_mode(status.Registered)
if profile.profile.get_profile() == 1: # lan
status.LanConnected = True
message = _('Registration succeeded')
utils.player.play_effect(config.SETTING_SUCCEEDED)
stage = RegisterNotifyStage(message)
runtime.manager.change_stage(stage)
# KA: [20071105] TI IMS subscriber ==
runtime.evas.render_now()
debugLogN('RegisteringIdleStage.register_sucessed: end')
def register_timeout(self):
debugLogN('RegisteringIdleStage.register_timeout')
roxia_event('manager.register_timeout(), Timeout Registeration')
status.set_regstatus(0)
status.set_register_mode(status.NotRegistered)
message = _('Registration failed')
utils.player.play_effect(config.SETTING_FAILED)
stage = RegisterNotifyStage(message)
runtime.manager.change_stage(stage)
runtime.evas.render_now()
def register_failed(self, msg=None):
debugLogN('RegisteringIdleStage.register_failed')
roxia_trace('###### RegisteringIdleStage.register_failed() ##########')
self.remove_reg_timer()
status.set_regstatus(0)
status.set_register_mode(status.NotRegistered)
if not msg:
msg = _('Registration failed')
utils.player.play_effect(config.SETTING_FAILED)
stage = RegisterNotifyStage(msg)
runtime.manager.change_stage(stage)
runtime.evas.render_now()
def remove_reg_timer(self):
if self.tag_register:
del(self.tag_register)
self.tag_register = None
def destroy(self):
debugLogN('RegisteringIdleStage.destroy')
self.remove_reg_timer()
Stage.destroy(self)
# start shchun: remove status.on_profile_changing
#status.on_profile_changing = False
def handle_key(self, key):
debugLogN('RegisteringIdleStage.handle_key')
#if key == config.Menu2 or key == config.Red:
if key == config.Menu4 or key == config.Red:
status.critical_entered = True
runtime.manager.back_stage()
return True
elif key == config.Green:
debugLogN('skip: Green - RegisteringIdleStage')
return True
else:
return False