Ejemplo n.º 1
0
        public void RunFunction(string function)
        {
            function = function.ToLower();

            switch (function)
            {
            case "LightAI":
            case "lightai":
                MQTT_send("Pi3", myfunction.LightAI(SmartHomeController._databaseController.database.homes[CurrentHomeIP]._currentRoom.lumen));
                ServerLog("Sending message to Pi3, Action: Light Control");
                break;

            case "SHdata":
                shdata = new SHdata(CurrentHomeIP);
                break;

            case "AcAndroid":
            case "acandroid":
                if (!SmartHomeController._databaseController.database.homes[CurrentHomeIP]._currentRoom.AutoAC)
                {
                    SmartHomeController._databaseController.database.homes[CurrentHomeIP]._currentRoom.ACinit();
                    ServerLog("room: " + CurrentHomeIP + ", AC has initialed.");
                }
                else
                {
                    ServerLog("Changing room " + CurrentHomeIP + ", Action: AC Control");
                }
                SmartHomeController._databaseController.database.homes[CurrentHomeIP]._currentRoom.RunAC();
                break;

            default:
                throw new NotImplementedException("Function not implement, or input function is incorrect");
            }
        }
Ejemplo n.º 2
0
        public static void InitialSmartHome()
        {
            _serverLog          = UpdateLog;
            _apiManager         = new APImanager(_serverLog);
            _databaseController = new DatabaseController();

            _accountManager     = new AccountManager();
            _emailSender        = new EmailSender();
            _guiManager         = new GUImanager();
            _functionController = new FunctionController();
            /*************test********************/
            shdata = new SHdata("xuebo");
            /*************************************/
        }