Exemple #1
0
 /// <summary>
 /// Updates the manifest from the command and force AU
 /// </summary>
 /// <param name="cmd"></param>
 private void AutoUpdateCheckNow(GetCommandResponse cmd)
 {
     if (cmd.parameters.manifest != null)
     {
         AutoUpdate.ManifestUrl = cmd.parameters.manifest;
         AutoUpdate.Enabled     = true;
         AutoUpdate.CheckNow();
     }
 }
Exemple #2
0
        /// <summary>
        /// Applies the server's command on the client
        /// </summary>
        /// <param name="cmd"></param>
        private void ApplyDeviceCommand(GetCommandResponse cmd)
        {
            if (cmd == null)
            {
                return;
            }

            switch (cmd.name)
            {
            case "reboot":
                //For a reboot, we first notify the server, and then reboot the device
                _cloudApi.UpdateCommand(new SharedObjects.UpdateCommandRequets(SharedObjects.CommandStatus.done, "Rebooting device"));
                ControlSystemLib.RebootControlSystem();
                break;

            case "dump":
                //Report dump to server
                _cloudApi.SendDump(_cSysLib.GenerateDeviceDump());
                _cloudApi.UpdateCommand(new SharedObjects.UpdateCommandRequets(SharedObjects.CommandStatus.done, "Dump sent succesfully"));
                break;

            case "upgrade":
                //For Crestron control systems, and other Crestron devices, we use autoupdate.
                AutoUpdateCheckNow(cmd);
                _cloudApi.UpdateCommand(new SharedObjects.UpdateCommandRequets(SharedObjects.CommandStatus.done, "Initiated auto-update"));
                break;

            default:
                //Unknown command
                ErrorLog.Error("Unknown command type");

                //Notify the server that we have failed to complete the command
                _cloudApi.UpdateCommand(new SharedObjects.UpdateCommandRequets(SharedObjects.CommandStatus.failed, "Unknown command"));
                break;
            }
        }