示例#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");
        }
 public ResponseGenerator(UnixSocketEndpoint unixSocket, WebSocketEndpoint webSocket)
 {
     UnixSocket = unixSocket;
     WebSocket  = webSocket;
 }
 public ResponseGenerator(WebSocketEndpoint webSocket)
 {
     WebSocket = webSocket;
 }