[tuxdroid-svn] r5926 - software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/execut
Status: Beta
Brought to you by:
ks156
|
From: jerome <c2m...@c2...> - 2009-12-03 12:51:53
|
Author: jerome
Date: 2009-12-03 13:30:56 +0100 (Thu, 03 Dec 2009)
New Revision: 5926
Modified:
software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/plugin-skype.py
Log:
* Added base plugin.
Modified: software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/plugin-skype.py
===================================================================
--- software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/plugin-skype.py 2009-12-03 12:30:16 UTC (rev 5925)
+++ software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/plugin-skype.py 2009-12-03 12:30:56 UTC (rev 5926)
@@ -21,24 +21,26 @@
*'''
__author__ = "Conan Jerome"
-__appname__ = "Python gadget skype"
+__appname__ = "Python skype plugin"
__version__ = "0.0.4"
__date__ = "2009/06/16"
__license__ = "GPL"
-
+
+import os
import sys
sys.path.append(os.environ['TUXDROID_SERVER_PYTHON_UTIL'])
+import time
import threading
-import utils
-import errors
import connector
-import communicator
+from communicator import SynchroniousCommands, AsynchroniousCommands
+from errors import EquipmentException, UnavailableContactException, UserNotFindException
+from utils import StringUtils
from util.SimplePlugin.SimplePluginConfiguration import SimplePluginConfiguration
from util.SimplePlugin.SimplePlugin import SimplePlugin
- class SkypePluginConfiguration(SimplePluginConfiguration):
+class SkypePluginConfiguration(SimplePluginConfiguration):
'''
Skype plugin configuration.
'''
@@ -74,8 +76,6 @@
Skype plugin base class.
'''
- canRun = True
-
#Skype client - api objects.
synchronious = None
asynchronious = None
@@ -113,61 +113,113 @@
'''
#Api ready and connected so creatin other commands objects.
self.synchronious = SynchroniousCommands(self.connectorObj)
+
+ #Setting Tux Droid as audio peripheral.
+
+ if not self.synchronious.isTuxDroidAudioCard():
+ if not self.synchronious.setAudioCards():
+ self.throwNotification("start")
+ self.throwMessage('An error occured trying to set Tux Droid as audio card.')
+ self.throwNotification("stop")
+
+ #Initializing contacts list.
+ #self.connectorObj.getContacts()
+
#Setting asynchronious obj.
self.asynchronious = AsynchroniousCommands(self.connectorObj)
#Setting events.
- asynchronious.OnIncomingMessage = self.OnChatMessage
- asynchronious.OnAvailableEmoticon = self.OnEmoticon
- asynchronious.OnAvailableTTSSentence = self.OnTTS
+ self.asynchronious.OnIncomingMessage = self.OnChatMessage
+ self.asynchronious.OnAvailableEmoticon = self.OnEmoticon
+ self.asynchronious.OnAvailableTTSSentence = self.OnTTS
- asynchronious.OnIncomingCallRefused = self.OnIncomingRefused
- asynchronious.OnIncomingCall = self.OnIncomingCall
- asynchronious.OnIncomingFinished = self.OnIncomingFinished
+ self.asynchronious.OnIncomingCallRefused = self.OnIncomingRefused
+ self.asynchronious.OnIncomingCall = self.OnIncomingCall
+ self.asynchronious.OnIncomingFinished = self.OnIncomingFinished
- asynchronious.OnOutgoingCallRefused = self.OnOutgoingRefused
- asynchronious.OnOutgoingCall = self.OnOutgoingCall
- asynchronious.OnOutgoingFinished = self.OnOutgoingFinished
+ self.asynchronious.OnOutgoingCallRefused = self.OnOutgoingRefused
+ self.asynchronious.OnOutgoingCall = self.OnOutgoingCall
+ self.asynchronious.OnOutgoingFinished = self.OnOutgoingFinished
+
+ def OnIncomingRefused(self, contactHandle):
+ '''
+ '''
+ pass
+
+ def OnIncomingCall(self, contactHandle):
+ '''
+ '''
+ pass
+
+
+ def OnIncomingFinished(self, contactHandle):
+ '''
+ '''
+ pass
+
+
+ def OnOutgoingRefused(self, contactHandle):
+ '''
+ '''
+ pass
+
+
+ def OnOutgoingCall(self, contactHandle):
+ '''
+ '''
+ pass
+
+
+ def OnOutgoingFinished(self, contactHandle):
+ '''
+ '''
+ pass
+
+
def OnChatMessage(self, contactHandle):
'''
Event that notify of incoming chat message.
'''
- pass
+ self.throwNotification("start")
+ #contactTTS = self.synchronious.getTTSName(contactHandle)
+ self.throwMessage('You have a message from {0}', contactHandle)
+ self.throwNotification("stop")
def OnEmoticon(self, attName):
'''
Event that notify of incoming emoticon.
'''
- pass
+ self.throwNotification("start")
+ self.throwActuation("playAttitune", attName)
+ self.throwNotification("stop")
def OnTTS(self, sentence):
'''
Event that notify a tts sentence to be said by Tux Droid.
'''
- pass
+ self.throwNotification("start")
+ self.throwMessage(sentence)
+ self.throwNotification("stop")
- def OnincomingRefused
-
def mainloop(self):
'''
Run main loop.
'''
- while self.canRun:
- sleep(2.0)
+ while 1:
+ time.sleep(2.0)
def onPluginStop(self):
'''
OnPluginStop event.
'''
- self.canrun = False
- if self.connectorObj is not None:
+ if self.connectorObj != None:
self.connectorObj.stop()
@@ -175,4 +227,4 @@
if __name__ == "__main__":
plugin = SkypePlugin()
plugin.boot(sys.argv[1:], SkypePluginConfiguration())
-
\ No newline at end of file
+
|