Ejemplo n.º 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);
            }
        }
Ejemplo n.º 2
0
 public override void Update(VModuleState s)
 {
     _contract.Update(ModuleStateAdapter.V2C(s));
 }
Ejemplo n.º 3
0
 public ModuleStateV2C(VModuleState view)
 {
     _view = view;
 }
Ejemplo n.º 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());
            }

        }
Ejemplo n.º 5
0
 public abstract void Update(VModuleState s);
Ejemplo n.º 6
0
 public abstract void Update(VModuleState s);
Ejemplo n.º 7
0
 //***
 public void UpdateState(VModule module, VModuleState state)
 {
     _contract.UpdateState(ModuleAdapter.V2C(module), ModuleStateAdapter.V2C(state));
 }