Пример #1
0
        internal static HomeOS.Hub.Platform.Contracts.IModuleState V2C(VModuleState view)
        {
            if (view == null)
                return null;

            if (!System.Runtime.Remoting.RemotingServices.IsObjectOutOfAppDomain(view) &&
                (view.GetType().Equals(typeof(ModuleStateC2V))))
            {
                return ((ModuleStateC2V)(view)).GetSourceContract();
            }
            else
            {
                return new ModuleStateV2C(view);
            }
        }
Пример #2
0
 public override void Update(VModuleState s)
 {
     _contract.Update(ModuleStateAdapter.V2C(s));
 }
Пример #3
0
 public ModuleStateV2C(VModuleState view)
 {
     _view = view;
 }
Пример #4
0
        public void UpdateState(VModule module , VModuleState state )
        {

       //     Console.WriteLine("*** PLATFORM HAS UPDATED THE STATE of "+module.GetInfo().BinaryName()+" with secret "+module.Secret()+" to "+state.GetSimpleState());
          
            ResultCode result = new ResultCode();
            if (runningModules.ContainsKey(module)) // This will check if the module exists in runningModules AND the secrets match
            {
                lock (this)
                {
                    if (!runningModulesStates.ContainsKey(module)) // updating the first time. must be an "EnterStart" state
                    {
                        runningModulesStates[module] = state;
                    }
                    else
                    {
                        runningModulesStates[module].Update(state);
                    }
                    result = ResultCode.Success;
                }
            }
            else
            {
                result = ResultCode.ModuleNotFound;
            }


            if (result == ResultCode.Success  )
            {
          //      logger.Log(this + " updated state of module {0} to {1} ",  module.ToString(), ((ModuleState.SimpleState)state.GetSimpleState()).ToString());
            }
            else
            {
                logger.Log(this + " got invalid state update: {0} from module {1}", state.GetSimpleState().ToString(), module.ToString());
            }

        }
Пример #5
0
 public abstract void Update(VModuleState s);
Пример #6
0
 public abstract void Update(VModuleState s);
Пример #7
0
 //***
 public void UpdateState(VModule module, VModuleState state)
 {
     _contract.UpdateState(ModuleAdapter.V2C(module), ModuleStateAdapter.V2C(state));
 }