Ejemplo n.º 1
0
 public Pv2ServerRxParam(IPv2ServerParamsInterface paramSvc, TParamType param)
 {
     _paramSvc  = paramSvc;
     _param     = param;
     _subscribe = _paramSvc.OnRemoteUpdated
                  .Filter <TParamType, TParamValue, TValue>(param)
                  .Subscribe(this);
     OnNext(_param.GetValue(_paramSvc.Read(_param)));
 }
Ejemplo n.º 2
0
        public static bool ReadBool(this IPv2ServerParamsInterface src, Pv2ParamType param)
        {
            if (param is not Pv2BoolParamType type)
            {
                throw new Exception($"Wrong type: want {nameof(Pv2BoolParamType)}. Got {param.GetType().Name}");
            }
            var paramResult = src.Read(param);

            return(type.GetValue(paramResult));
        }