+ def readConfigurationFile(self):
+ try:
+ self.dbg('readConfigurationFile started')
+ self.checkForConfigFile()
+ f = open(self.configDir+self.configFile, 'r')
+ raw_set = f.readline().rsplit(';')
+ self.visual = raw_set[0] in ('y')
+ self.sound = raw_set[1] in ('y')
+ self.vibration = raw_set[2] in ('y')
+ self.interval = float(raw_set[3].replace(',','.'))
+ self.dbg('visual='+str(self.visual)+' sound='+str(self.sound)+' vibration='+str(self.vibration)+' interval='+str(self.interval))
+ f.close()
+
+ # read sound config file
+ f = open(self.configDir+self.configSoundFile, 'r')
+ line = f.readline()
+ # check if specific missed call, SMS or common sound was defined in config file
+ if line.strip():
+ self.soundCall = line.strip()
+ self.dbg('soundCall changed to: '+self.soundCall)
+ line = f.readline()
+ if line.strip():
+ self.soundSMS = line.rstrip()
+ self.dbg('soundSMS changed to: '+self.soundSMS)
+ line = f.readline()
+ if line.strip():
+ self.soundBoth = line.strip()
+ self.dbg('soundBoth changed to: '+self.soundBoth)
+ line = f.readline()
+ if line.strip():
+ self.volume = float(line.strip())
+ self.dbg('volume changed to: '+self.volume)
+ f.close()
+ except:
+ os.remove(self.configDir+self.configFile)
+ os.remove(self.configDir+self.configSoundFile)
+ self.checkForConfigFile()
+
+ def playSound(self):
+ self.dbg('playSound started')
+ profiled = dbus.Interface(dbus.SessionBus().get_object("com.nokia.profiled", "/com/nokia/profiled"), "com.nokia.profiled")
+ mce = dbus.Interface(dbus.SystemBus().get_object("com.nokia.mce", "/com/nokia/mce/request"), "com.nokia.mce.request")
+ if self.sound and profiled.get_value("", "ringing.alert.type") != "silent":
+ # Create the player_name sink
+ if self.msgType == "Call" and profiled.get_value("", "ringing.alert.volume") != "0":
+ self.dbg('play soundCall:' + self.soundCall)
+ Playbin2().play(self.soundCall, self.volume)
+ elif self.msgType == "SMS" and profiled.get_value("", "sms.alert.volume") != "0":
+ self.dbg('play soundSMS:' + self.soundSMS)
+ Playbin2().play(self.soundSMS, self.volume)
+ elif self.msgType == "Both":
+ self.dbg('play soundBoth:' + self.soundBoth)
+ Playbin2().play(self.soundBoth, self.volume)
+ else:
+ Playbin2().play(self.soundFile, self.volume)
+
+ if self.vibration and profiled.get_value("", "vibrating.alert.enabled") == "On":
+ self.dbg('vibrate:')
+ mce.req_vibrator_pattern_activate("PatternIncomingCall")
+ time.sleep(0.5);
+ mce.req_vibrator_pattern_deactivate("PatternIncomingCall")
+ return True
+
+ def loadImages(self):
+ self.dbg('loadImages started')