interfaces.py :  » Web-Services » Shtoom » shtoom-0.2 » shtoom » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Web Services » Shtoom 
Shtoom » shtoom 0.2 » shtoom » interfaces.py
# Copyright (C) 2004 Anthony Baxter

from twisted.python.components import Interface


class UI(Interface):
    """ This interface describes the user interface calls that can be
        invoked by the Application. Note that "user interface" does not
        necessarily mean some sort of graphical interface - for instance
        a conferencing server's UI would be a programmatic thing.
    """

    def debugMessage(self, message):
        """ A debugging message.
        """

    def statusMessage(self, message):
        """ Displays a status message. This will typically replace any
            previous status message.
        """

    def getString(self, message):
        """ Prompt the user for information, with the prompt 'message'
            returns a Deferred
        """

    def callConnected(self, cookie):
        """ The call identified by 'cookie' has been connected
        """

    def callDisconnected(self, cookie, reason):
        """ The call identified by 'cookie' has been disconnected. 'reason'
            gives a short text description for the call failure.
        """

    def incomingCall(self, description, cookie, defresp):
        """ An incoming call (described by text 'description') has arrived.

            The UI should call defresp.callback() to accept the call,
            and defresp.errback() to reject it.

            The Application will call 'callConnected()' when the call
            is setup, or callDisconnected() if the call could not be
            established.
        """

class SIP(Interface):
    """ This describes the interface to the SIP layer that the Application
        uses. 
    """

    def placeCall(self, sipURL):
        """ Place a call to URL 'sipURL'.
        """

class RTP(Interface):
    """ This describes the interface to the RTP layer used by the Application
    """

    def __init__(self, cookie):
        """ Create an RTP instance. The RTP object should use the 'cookie'
            for calls back into the Application (to request data, for instance)
        """
    def createRTPSocket(self, fromIP, withSTUN):
        """ Create the RTP socket. Use 'fromIP' as this end's IP address
            (note that it may be a different address to the system's - it's
            the externally visible address, as reported by STUN. If 
            withSTUN is true, use STUN to discover the external port numbers
            for RTP/RTCP
        """

    def getVisibleAddress(self):
        """ Returns the IP address for this end of the RTP connection.
        """

    def startSendingAndReceiving(self):
        """ Start the timer loop that delivers and receives packets.
        """

    def stopSendingAndReceiving(self):
        """ Stop the timer loop that delivers and receives packets.
        """

    def startDTMF(self, digit):
        """ Start sending digit 'digit'
        """

    def stopDTMF(self, digit):
        """ Stop sending digit 'digit'
        """

    

class AddressBook(Interface):
    """ Address Book interface
    """

    def browseAddressBook(self, query=None):
        """ Pop up the address book, with an optional 'query' (a string
            to begin the browsing).

            Returns a Deferred, the callback of which will be called with
            a string (the URI to call), or the errback if they select nothing
        """

    def addEntryToAddressBook(self, uri):
        """ Pop up the address book to add the URI 'uri' (a string).
        """

class StunPolicy(Interface):
    """ A STUNPolicy decides when STUN is applied """

    def checkStun(self, localip, remoteip):
        """ return True/False for whether STUN should apply """
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.