Пример #1
0
 public CommandProcessor(UnixSocketEndpoint unixEndpoint, WebSocketEndpoint webEndpoint)
 {
     StrategyFactory             = new ProcessingStrategyResolver();
     ResponseGenerator           = new ResponseGenerator(unixEndpoint, webEndpoint);
     webEndpoint.ProcessCommand  = ProcessCommand;
     unixEndpoint.ProcessCommand = ProcessCommand;
 }
Пример #2
0
        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);
        }
Пример #3
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");
        }
Пример #4
0
 public ResponseGenerator(UnixSocketEndpoint unixSocket, WebSocketEndpoint webSocket)
 {
     UnixSocket = unixSocket;
     WebSocket  = webSocket;
 }
Пример #5
0
 public ResponseGenerator(WebSocketEndpoint webSocket)
 {
     WebSocket = webSocket;
 }