# Path: pysiriproxy/objects/baseObject.py
# class SiriObject:
#     '''The SiriObject class encapsulates the base functionality for all
#     object being sent to the iPhone or to Apple's web server.
# 
#     .. note:: This class is meant to be subclassed to provide the
#               implementation for a specific object.
# 
#     '''
# 
#     ProtocolVersion = "2.0"
#     '''The identifier which indicates the version of the protocol.'''
#   
#     def __init__(self, className, group):
#         '''
#         * className -- The class name for the object
#         * group -- The group name for the object
# 
#         '''
#         self.__class = className
#         self.__group = group
# 
#         self.__refId = None
#         self.__aceId = None
#         self.__version = None
# 
#     def setNonNoneArguments(self, argumentNames, localVars):
#         '''Takes a list of strings which represent names of input variables and
#         sets properties of the same name on the current object if the value of
#         the argument is not None.
# 
#         * argumentNames -- The list of argument names to set
#         * localVars -- The local variables
# 
#         '''
#         for argName in argumentNames:
#             # Get the value of the local argument
#             argValue = localVars.get(argName)
# 
#             # Only set the argument if its value is not None
#             if argValue is not None:
#                 setattr(self, argName, argValue)
#   
#     def toDict(self):
#         '''Convert this object into a Python dictionary.'''
#         dictionary = {
#             Keys.Class: self.__class,
#             Keys.Group: self.__group,
#             Keys.Properties: {},
#             }
#       
#         # Store the refId, aceId, and version values if we have one
#         if self.__refId is not None:
#             dictionary[Keys.RefId] = self.__refId
#         if self.__aceId is not None:
#             dictionary[Keys.AceId] = self.__aceId
#         if self.__version is not None:
#             dictionary[Keys.Version] = self.__version
# 
#         # Traverse all of the object's properties to add them each to
#         # the output dictionary object
#         for key, item in self.__getProperties().iteritems():
#             # Determine how to handle the current property type
#             if type(item) == type(list()):
#                 itemList = []
# 
#                 # Convert all the items in the list to a dictionary, and keep
#                 # only the properties that are successfully converted
#                 for val in item:
#                     try:
#                         val = val.toDict()
#                     except:
#                         pass
#                     itemList.append(val)
# 
#                 dictionary[Keys.Properties][key] = itemList
#             else:
#                 # Attempt to conver the current property into a dictionary
#                 try:
#                     item = item.toDict()
#                 except:
#                     pass
# 
#                 dictionary[Keys.Properties][key] = item
# 
#         return dictionary
# 
#     def makeRoot(self, refId=None, aceId=None):
#         '''Make the SiriObject the root object.
# 
#         * refId -- The refId for this object
#         * aceId -- The aceId for this object
# 
#         '''
#         self.setRefId(refId)
#         self.setAceId(aceId)
# 
#         # Only the root object has a version entry
#         self.__version = self.ProtocolVersion
# 
#     def setRefId(self, refId=None):
#         '''Set the ref id for this object.
# 
#         * refId -- The refId for this object
# 
#         '''
#         self.__refId = refId if refId is not None else self.__randomRefId()
# 
#     def setAceId(self, aceId=None):
#         '''Set the ace id for this object.
# 
#         * aceId -- The aceId for this object
# 
#         '''
#         self.__aceId = aceId if aceId is not None else self.__randomAceId()
# 
#     def __getProperties(self):
#         '''Get all of the properties for this SiriObject.'''
#         return dict((k, p) for k, p in self.__dict__.iteritems() \
#                         if not k.startswith("_"))
# 
#     @classmethod
#     def __randomRefId(cls):
#         '''Create a random refId.'''
#         return str(uuid4()).upper()
# 
#     @classmethod
#     def __randomAceId(cls):
#         '''Create a random aceId.'''
#         return str(uuid4())
# 
#     @classmethod
#     def isArgumentList(cls, obj):
#         '''Determine if the given object is a list of arguments, or not.
# 
#         * obj -- The object
#         
#         '''
#         return not SiriObject.isSiriObject(obj) and type(obj) == type(tuple())
# 
#     @classmethod
#     def isSiriObject(cls, obj):
#         '''Determine if the given object is a SiriObject, or not.
# 
#         * obj -- The object
#         
#         '''
#         return isinstance(obj, SiriObject)


from pysiriproxy.objects.baseObject import SiriObject
requests to be sent to the iPhone.

'''


class _RequestCompleted(SiriObject):
    '''The _RequestCompleted object notifies the iPhone that the current 
    request can be completed.

    '''
    def __init__(self, callbacks=None):
        '''
        * callbacks -- The list of callbacks

        '''
        SiriObject.__init__(self, "RequestCompleted", "com.apple.ace.system")
        self.callbacks = [] if callbacks is None else callbacks


class _StartRequest(SiriObject):
    '''The _StartRequest object signifies that a request is being started.

    '''
    def __init__(self, utterance="Testing", handsFree=False, proxyOnly=False):
        '''
        * utterance -- The utterance to perform
        * handsFree -- True if in hands free mode, False otherwise
        * proxyOnly -- True if proxy only mode, False otherwise

        '''

# Path: pysiriproxy/objects/baseObject.py
# class SiriObject:
#     '''The SiriObject class encapsulates the base functionality for all
#     object being sent to the iPhone or to Apple's web server.
# 
#     .. note:: This class is meant to be subclassed to provide the
#               implementation for a specific object.
# 
#     '''
# 
#     ProtocolVersion = "2.0"
#     '''The identifier which indicates the version of the protocol.'''
#   
#     def __init__(self, className, group):
#         '''
#         * className -- The class name for the object
#         * group -- The group name for the object
# 
#         '''
#         self.__class = className
#         self.__group = group
# 
#         self.__refId = None
#         self.__aceId = None
#         self.__version = None
# 
#     def setNonNoneArguments(self, argumentNames, localVars):
#         '''Takes a list of strings which represent names of input variables and
#         sets properties of the same name on the current object if the value of
#         the argument is not None.
# 
#         * argumentNames -- The list of argument names to set
#         * localVars -- The local variables
# 
#         '''
#         for argName in argumentNames:
#             # Get the value of the local argument
#             argValue = localVars.get(argName)
# 
#             # Only set the argument if its value is not None
#             if argValue is not None:
#                 setattr(self, argName, argValue)
#   
#     def toDict(self):
#         '''Convert this object into a Python dictionary.'''
#         dictionary = {
#             Keys.Class: self.__class,
#             Keys.Group: self.__group,
#             Keys.Properties: {},
#             }
#       
#         # Store the refId, aceId, and version values if we have one
#         if self.__refId is not None:
#             dictionary[Keys.RefId] = self.__refId
#         if self.__aceId is not None:
#             dictionary[Keys.AceId] = self.__aceId
#         if self.__version is not None:
#             dictionary[Keys.Version] = self.__version
# 
#         # Traverse all of the object's properties to add them each to
#         # the output dictionary object
#         for key, item in self.__getProperties().iteritems():
#             # Determine how to handle the current property type
#             if type(item) == type(list()):
#                 itemList = []
# 
#                 # Convert all the items in the list to a dictionary, and keep
#                 # only the properties that are successfully converted
#                 for val in item:
#                     try:
#                         val = val.toDict()
#                     except:
#                         pass
#                     itemList.append(val)
# 
#                 dictionary[Keys.Properties][key] = itemList
#             else:
#                 # Attempt to conver the current property into a dictionary
#                 try:
#                     item = item.toDict()
#                 except:
#                     pass
# 
#                 dictionary[Keys.Properties][key] = item
# 
#         return dictionary
# 
#     def makeRoot(self, refId=None, aceId=None):
#         '''Make the SiriObject the root object.
# 
#         * refId -- The refId for this object
#         * aceId -- The aceId for this object
# 
#         '''
#         self.setRefId(refId)
#         self.setAceId(aceId)
# 
#         # Only the root object has a version entry
#         self.__version = self.ProtocolVersion
# 
#     def setRefId(self, refId=None):
#         '''Set the ref id for this object.
# 
#         * refId -- The refId for this object
# 
#         '''
#         self.__refId = refId if refId is not None else self.__randomRefId()
# 
#     def setAceId(self, aceId=None):
#         '''Set the ace id for this object.
# 
#         * aceId -- The aceId for this object
# 
#         '''
#         self.__aceId = aceId if aceId is not None else self.__randomAceId()
# 
#     def __getProperties(self):
#         '''Get all of the properties for this SiriObject.'''
#         return dict((k, p) for k, p in self.__dict__.iteritems() \
#                         if not k.startswith("_"))
# 
#     @classmethod
#     def __randomRefId(cls):
#         '''Create a random refId.'''
#         return str(uuid4()).upper()
# 
#     @classmethod
#     def __randomAceId(cls):
#         '''Create a random aceId.'''
#         return str(uuid4())
# 
#     @classmethod
#     def isArgumentList(cls, obj):
#         '''Determine if the given object is a list of arguments, or not.
# 
#         * obj -- The object
#         
#         '''
#         return not SiriObject.isSiriObject(obj) and type(obj) == type(tuple())
# 
#     @classmethod
#     def isSiriObject(cls, obj):
#         '''Determine if the given object is a SiriObject, or not.
# 
#         * obj -- The object
#         
#         '''
#         return isinstance(obj, SiriObject)


# Path: pysiriproxy/objects/requests.py
from pysiriproxy.objects.baseObject import SiriObject

requests to be sent to the iPhone.

'''


class _RequestCompleted(SiriObject):
    '''The _RequestCompleted object notifies the iPhone that the current 
    request can be completed.

    '''
    def __init__(self, callbacks=None):
        '''
        * callbacks -- The list of callbacks

        '''
        SiriObject.__init__(self, "RequestCompleted", "com.apple.ace.system")
        self.callbacks = [] if callbacks is None else callbacks


class _StartRequest(SiriObject):
    '''The _StartRequest object signifies that a request is being started.

    '''
    def __init__(self, utterance="Testing", handsFree=False, proxyOnly=False):
        '''
        * utterance -- The utterance to perform
        * handsFree -- True if in hands free mode, False otherwise
        * proxyOnly -- True if proxy only mode, False otherwise

        '''

        SiriObject.__init__(self, "StartRequest", "com.apple.ace.system")