def __init__(self, logData=None, logColor=Colors.Foreground.Green): ''' * logData -- The LogData object * logColor -- The color to use for the Logger ''' # Create a logger just for the options loading if logData is None: logData = LogData() self.__log = logData.get("PluginTester", color=logColor) # Parse the siri proxy configuration options object options = Options(logData) options.parse(argv, Files.ConfigFile) # Set the callback for the iPhone, and Server connections Server.Callback = self.iPhoneCallback Server.Callback = self.serverCallback # Create the connection manager, and connect the iPhone and # Server connections to it connectionManager = ConnectionManager(logData) connectionManager.connect(iPhone) connectionManager.connect(Server) # Grab an instance to the plugin manager self.__pluginManager = PluginManager(connectionManager, logData)
def __init__(self, name, direction, logger, logColor=Colors.Foreground.White): ''' * name -- The name of this Connection * direction -- The direction of the data coming into this Connection * logger -- The logger for this Connection * logColor -- The log color for this Connection ''' self.__direction = direction # Connect this connection to the connection manager self.__connectionManager = ConnectionManager(logger) self.__connectionManager.connect(self) # Grab an instance to the plugin manager self.__pluginManager = PluginManager(self.__connectionManager, logger) # If no logger is given, be sure to create it if logger is None: logger = LogData(name) self.log = logger.get(name, color=logColor) self.__logger = logger self.__compStream = zlib.compressobj() self.__zipStream = zlib.decompressobj() self.__processedHeaders = False self.__consumedAce = False self.__inputBuffer = "" self.__outputBuffer = "" self.__unzippedInput = "" self.__unzippedOutput = "" self.ssled = False self.__lastRefId = None self.__blockRestOfSession = False self.otherConnection = None # Starts in line mode self.__mode = Modes.Line