# Path: pysiriproxy/constants.py
# class Directions:
#     '''The Directions class contains several properties which are used to
#     indicate which direction data is entering the system.
# 
#     '''
# 
#     From_Server = "From_Server"
#     '''The From_Server property indicates that data was received from Apple's
#     server.
# 
#     '''
# 
#     From_iPhone = "From_iPhone"
#     '''The From_iPhone property indicates that data was received from the
#     iPhone.
# 
#     '''


from pysiriproxy.constants import Directions
from pyamp.logging import LogData, Colors

class ConnectionManager:
    '''The ConnectionManager object managers incoming connection
    directions and provides the ability to forward data between them.

    It allows a connection direction to be connected to an opposite
    connection direction which allows data to be forwarded from the
    direction to the connected direction.

    '''
    # Implement the borg pattern
    __shared_state = {}

    def __init__(self, logger=None):
        '''
        * logger -- The logger

        '''
        self.__dict__ = self.__shared_state

        # If the manager has not been initialized, then initialize it
        if getattr(self, "_initialized", False) == False:
            # Create a map of directions to connection objects
            self._connections = {
                Directions.From_iPhone: None,
                Directions.From_Server: None,
                }

            # Map incoming direction, to its forwarding direction
            self._forwardMap = {

# Path: pysiriproxy/constants.py
# class Directions:
#     '''The Directions class contains several properties which are used to
#     indicate which direction data is entering the system.
# 
#     '''
# 
#     From_Server = "From_Server"
#     '''The From_Server property indicates that data was received from Apple's
#     server.
# 
#     '''
# 
#     From_iPhone = "From_iPhone"
#     '''The From_iPhone property indicates that data was received from the
#     iPhone.
# 
#     '''


# Path: pysiriproxy/connections/manager.py
from pysiriproxy.constants import Directions
from pyamp.logging import LogData, Colors


class ConnectionManager:
    '''The ConnectionManager object managers incoming connection
    directions and provides the ability to forward data between them.

    It allows a connection direction to be connected to an opposite
    connection direction which allows data to be forwarded from the
    direction to the connected direction.

    '''
    # Implement the borg pattern
    __shared_state = {}

    def __init__(self, logger=None):
        '''
        * logger -- The logger

        '''
        self.__dict__ = self.__shared_state

        # If the manager has not been initialized, then initialize it
        if getattr(self, "_initialized", False) == False:
            # Create a map of directions to connection objects
            self._connections = {
                Directions.From_iPhone: None,
                Directions.From_Server: None,
                }

            # Map incoming direction, to its forwarding direction
            self._forwardMap = {

                Directions.From_iPhone: Directions.From_Server,