public HistoryChange(VariableRef variable, Timestamp start, Timestamp end, HistoryChangeType changeType) { Variable = variable; ChangeStart = start; ChangeEnd = end; ChangeType = changeType; }
public WI_GetLatestTimestampDb(VariableRef variable, Timestamp startInclusive, Timestamp endInclusive, TaskCompletionSource <VTTQ?> promise) { Variable = variable; StartInclusive = startInclusive; EndInclusive = endInclusive; Promise = promise; }
public void Sync(IList <ObjectInfo> allObjects) { var validVarRefs = new HashSet <VariableRef>(); var tEmpty = Timestamp.Empty; foreach (ObjectInfo obj in allObjects) { if (obj.Variables == null || obj.Variables.Length == 0) { continue; } foreach (Variable v in obj.Variables) { VariableRef vref = new VariableRef(obj.ID, v.Name); validVarRefs.Add(vref); if (!map.ContainsKey(vref)) { map[vref] = new VTQ(tEmpty, Quality.Bad, v.DefaultValue); } } } foreach (var entry in map) { VariableRef vref = entry.Key; if (!validVarRefs.Contains(vref)) { validVarRefs.Remove(vref); } } this.allObjects = allObjects; }
public WI_DeleteInterval(VariableRef variable, Timestamp startInclusive, Timestamp endInclusive, TaskCompletionSource <long> promise) { Variable = variable; StartInclusive = startInclusive; EndInclusive = endInclusive; Promise = promise; }
public WI_Modify(VariableRef variable, Variable varDesc, VTQ[] data, ModifyMode mode, TaskCompletionSource <bool> promise) { Variable = variable; VarDesc = varDesc; Data = data; Mode = mode; Promise = promise; }
public WI_Count(VariableRef variable, Timestamp startInclusive, Timestamp endInclusive, QualityFilter filter, TaskCompletionSource <long> promise) { Variable = variable; StartInclusive = startInclusive; EndInclusive = endInclusive; Filter = filter; Promise = promise; }
public override async Task HistorianModify(VariableRef variable, ModifyMode mode, params VTQ[] data) { JObject request = MakeSessionRequest(); request["variable"] = new JRaw(StdJson.ObjectToString(variable)); request["data"] = new JRaw(StdJson.ObjectToString(data)); request["mode"] = new JRaw(StdJson.ValueToString(mode)); await PostJObject("HistorianModify", request); }
public override async Task <long> HistorianDeleteInterval(VariableRef variable, Timestamp startInclusive, Timestamp endInclusive) { JObject request = MakeSessionRequest(); request["variable"] = new JRaw(StdJson.ObjectToString(variable)); request["startInclusive"] = new JRaw(StdJson.ValueToString(startInclusive)); request["endInclusive"] = new JRaw(StdJson.ValueToString(endInclusive)); return(await Post <long>("HistorianDeleteInterval", request)); }
public VTQ GetVarValue(VariableRef varRef) { try { return(map[varRef]); } catch (Exception) { throw new Exception($"No value found for variable reference '{varRef}'."); } }
public override async Task <VTTQ?> HistorianGetLatestTimestampDB(VariableRef variable, Timestamp startInclusive, Timestamp endInclusive) { JObject request = MakeSessionRequest(); request["variable"] = new JRaw(StdJson.ObjectToString(variable)); request["startInclusive"] = new JRaw(StdJson.ValueToString(startInclusive)); request["endInclusive"] = new JRaw(StdJson.ValueToString(endInclusive)); return(await Post <VTTQ?>("HistorianGetLatestTimestampDB", request)); }
public override async Task <VTTQ?> HistorianGetLatestTimestampDB(VariableRef variable, Timestamp startInclusive, Timestamp endInclusive) { var request = MakeSessionRequest <HistorianGetLatestTimestampDBReq>(); request.Variable = variable; request.StartInclusive = startInclusive; request.EndInclusive = endInclusive; return(await Post <VTTQ?>(request)); }
private Channel?GetChannelOrNull(VariableRef v) { try { return(GetChannelOrThrow(v)); } catch (Exception) { return(null); } }
public override async Task <long> HistorianDeleteInterval(VariableRef variable, Timestamp startInclusive, Timestamp endInclusive) { var request = MakeSessionRequest <HistorianDeleteIntervalReq>(); request.Variable = variable; request.StartInclusive = startInclusive; request.EndInclusive = endInclusive; return(await Post <long>(request)); }
public Task <long> DeleteInterval(VariableRef variable, Timestamp startInclusive, Timestamp endInclusive) { var promise = new TaskCompletionSource <long>(); if (CheckPrecondition(promise)) { queue.Post(new WI_DeleteInterval(variable, startInclusive, endInclusive, promise)); } return(promise.Task); }
public Task <long> Count(VariableRef variable, Timestamp startInclusive, Timestamp endInclusive, QualityFilter filter) { var promise = new TaskCompletionSource <long>(); if (CheckPrecondition(promise)) { queue.Post(new WI_Count(variable, startInclusive, endInclusive, filter, promise)); } return(promise.Task); }
public WI_ReadRaw(VariableRef variable, Timestamp startInclusive, Timestamp endInclusive, int maxValues, BoundingMethod bounding, QualityFilter filter, TaskCompletionSource <List <VTTQ> > promise) { Variable = variable; StartInclusive = startInclusive; EndInclusive = endInclusive; MaxValues = maxValues; Bounding = bounding; Filter = filter; Promise = promise; }
public Task <List <VTTQ> > ReadRaw(VariableRef variable, Timestamp startInclusive, Timestamp endInclusive, int maxValues, BoundingMethod bounding, QualityFilter filter) { var promise = new TaskCompletionSource <List <VTTQ> >(); if (CheckPrecondition(promise)) { queue.Post(new WI_ReadRaw(variable, startInclusive, endInclusive, maxValues, bounding, filter, promise)); } return(promise.Task); }
public Task Modify(VariableRef variable, Variable varDesc, VTQ[] data, ModifyMode mode) { var promise = new TaskCompletionSource <bool>(); if (CheckPrecondition(promise)) { queue.Post(new WI_Modify(variable, varDesc, data, mode, promise)); } return(promise.Task); }
public Task <VTTQ?> GetLatestTimestampDb(VariableRef variable, Timestamp startInclusive, Timestamp endInclusive) { var promise = new TaskCompletionSource <VTTQ?>(); if (CheckPrecondition(promise)) { queue.Post(new WI_GetLatestTimestampDb(variable, startInclusive, endInclusive, promise)); } return(promise.Task); }
private Variable CheckExistingVariable(VariableRef variable) { Variable?varDesc = fVarResolver(variable); if (varDesc != null) { return(varDesc); } throw new Exception("Undefined variable: " + variable.ToString()); }
public override async Task <long> HistorianCount(VariableRef variable, Timestamp startInclusive, Timestamp endInclusive, QualityFilter filter = QualityFilter.ExcludeNone) { var request = MakeSessionRequest <HistorianCountReq>(); request.Variable = variable; request.StartInclusive = startInclusive; request.EndInclusive = endInclusive; request.Filter = filter; return(await Post <long>(request)); }
public Task Delete(VariableRef variable) { var promise = new TaskCompletionSource <bool>(); if (CheckPrecondition(promise)) { queue.Post(new WI_Delete(variable, promise)); } return(promise.Task); }
private Variable?GetVariableDescription(VariableRef varRef) { string moduleID = varRef.Object.ModuleID; ModuleState module = modules.FirstOrDefault(m => m.ID == moduleID); if (module == null) { return(null); } return(module.GetVarDescription(varRef)); }
public async Task <long> HistorianCount(VariableRef variable, Timestamp startInclusive, Timestamp endInclusive, QualityFilter filter) { HistoryDBWorker?worker = WorkerByVarRef(variable); if (worker == null) { throw new Exception("Failed to find DB worker for variable " + variable); } CheckExistingVariable(variable); return(await worker.Count(variable, startInclusive, endInclusive, filter)); }
public async Task <List <VTTQ> > HistorianReadRaw(VariableRef variable, Timestamp startInclusive, Timestamp endInclusive, int maxValues, BoundingMethod bounding, QualityFilter filter) { HistoryDBWorker?worker = WorkerByVarRef(variable); if (worker == null) { throw new Exception("Failed to find DB worker for variable " + variable); } CheckExistingVariable(variable); return(await worker.ReadRaw(variable, startInclusive, endInclusive, maxValues, bounding, filter)); }
public void ValidateVariableValuesOrThrow(IList <VariableValue> values) { foreach (VariableValue value in values) { VariableRef varRef = value.Variable; if (!map.ContainsKey(varRef)) { throw new Exception("Invalid variable reference: " + varRef.ToString()); } } }
public Variable?GetVarDescription(VariableRef varRef) { try { string varName = varRef.Name; ObjectInfo objInfo = mapObjects[varRef.Object]; return(objInfo.Variables.First(v => v.Name == varName)); } catch (Exception) { return(null); } }
public override async Task <VTTQ[]> HistorianReadRaw(VariableRef variable, Timestamp startInclusive, Timestamp endInclusive, int maxValues, BoundingMethod bounding) { JObject request = MakeSessionRequest(); request["variable"] = new JRaw(StdJson.ObjectToString(variable)); request["startInclusive"] = new JRaw(StdJson.ValueToString(startInclusive)); request["endInclusive"] = new JRaw(StdJson.ValueToString(endInclusive)); request["maxValues"] = new JRaw(StdJson.ValueToString(maxValues)); request["bounding"] = new JRaw(StdJson.ValueToString(bounding)); return(await Post <VTTQ[]>("HistorianReadRaw", request)); }
private Channel GetOrCreateChannelOrThrow(VariableRef v, Variable varDesc) { if (db.ExistsChannel(v.Object.LocalObjectID, v.Name)) { return(GetChannelOrThrow(v)); } Channel res = db.CreateChannel(new ChannelInfo(v.Object.LocalObjectID, v.Name, varDesc.Type)); mapChannels[v] = res; return(res); }
public override async Task <VTTQs> HistorianReadRaw(VariableRef variable, Timestamp startInclusive, Timestamp endInclusive, int maxValues, BoundingMethod bounding, QualityFilter filter = QualityFilter.ExcludeNone) { var request = MakeSessionRequest <HistorianReadRawReq>(); request.Variable = variable; request.StartInclusive = startInclusive; request.EndInclusive = endInclusive; request.MaxValues = maxValues; request.Bounding = bounding; request.Filter = filter; return(await Post <VTTQs>(request, binaryDeserializer : BinSeri.VTTQ_Serializer.Deserialize)); }