public CommandProcessor(UnixSocketEndpoint unixEndpoint, WebSocketEndpoint webEndpoint) { StrategyFactory = new ProcessingStrategyResolver(); ResponseGenerator = new ResponseGenerator(unixEndpoint, webEndpoint); webEndpoint.ProcessCommand = ProcessCommand; unixEndpoint.ProcessCommand = ProcessCommand; }
protected override void OnStop() { log.Info("Stopping SmartHomeDaemon..."); UnixSocketEndpoint.Close(); WebSocketEndpoint.Close(); log.Info("SmartHomeDaemon was stopped"); try { if (File.Exists("/tmp/SmartHomeServer.exe.lock")) { File.Delete("/tmp/SmartHomeServer.exe.lock"); } } catch (Exception ex) { log.Error(ex.Message); } Environment.Exit(0); }
protected override void OnStart(string[] args) { log.Info("Starting SmartHomeDaemon..."); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(OnUnhandledException); WebSocketEndpoint = new WebSocketEndpoint(); #if WINDEBUG CommandProcessor = new CommandProcessor(WebSocketEndpoint); #else UnixSocketEndpoint = new UnixSocketEndpoint(); CommandProcessor = new CommandProcessor(UnixSocketEndpoint, WebSocketEndpoint); UnixSocketEndpoint.Open(); #endif WebSocketEndpoint.Open(); log.Info("SmartHomeDaemon was started"); }
public ResponseGenerator(UnixSocketEndpoint unixSocket, WebSocketEndpoint webSocket) { UnixSocket = unixSocket; WebSocket = webSocket; }
public ResponseGenerator(WebSocketEndpoint webSocket) { WebSocket = webSocket; }