public static void WriteBool(this IPv2ServerParamsInterface src, Pv2ParamType param, bool value) { if (param is not Pv2BoolParamType type) { throw new Exception($"Wrong type: want {nameof(Pv2BoolParamType)}. Got {param.GetType().Name}"); } src.Write(param, (_, v) => type.SetValue(v, value)); }
public static void WriteUInt(this IPv2ServerParamsInterface src, Pv2ParamType param, uint value) { if (param is not Pv2UIntParamType uintType) { throw new Exception($"Wrong type: want {nameof(Pv2UIntParamType)}. Got {param.GetType().Name}"); } src.Write(param, (type, v) => uintType.SetValue(v, value)); }
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))); }
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)); }
public static void CreateParams(out IPv2ClientParamsInterface clientParams, out IPv2ServerParamsInterface serverParams, IEnumerable <Pv2ParamType> paramsList) { var cfg = new InMemoryConfiguration(); var server = CreateServer(out var port); var client = CreateClient(port); clientParams = new Pv2ClientParamsInterface(client, Pv2CfgDescriptionEmptyStore.Default, cfg); serverParams = new Pv2ServerParamsInterface(server, cfg, paramsList); WaitUntilConnect(client); }