private IMongoCollection <PumpEvent> GetCollection(HistoryDataTypeEnum historyDataType) { string collectionname = $"{eventCollectionName}{historyDataType.ToString()}"; var coll = _db.GetCollection <PumpEvent>(collectionname); return(coll); }
private async Task StartReadHistoryInfoAsync(HistoryDataTypeEnum historytype, CancellationToken cancelToken) { Logger.LogInformation($"ReadHistoryInfo: {historytype.ToString()}"); await StartCommunicationStandardResponse(Session.GetReadHistoryInfo(historytype), cancelToken); if (Session.PumpDataHistory.MultiPacketHandlers.Count(e => e.ReadInfoResponse.HistoryDataType == historytype) == 0) { throw new Exception("Error reading historyInfo"); } }
private async Task StartReadHistoryAsync(HistoryDataTypeEnum historytype, CancellationToken cancelToken) { Logger.LogInformation($"ReadHistory: {historytype.ToString()}"); int expectedSize = this.Session.PumpDataHistory.GetSize(historytype); CommunicationBlock communicationBlock = new CommunicationBlock(); communicationBlock.Request = Session.GetReadHistory(historytype, expectedSize); communicationBlock.ExpectedResponses.Add(new SendMessageResponsePattern()); communicationBlock.ExpectedResponses.Add(new RecieveMessageResponsePattern()); communicationBlock.ExpectedResponses.Add(new RecieveMessageResponsePattern()); communicationBlock.ExpectedResponses.Add(new RecieveMessageResponsePattern()); await StartCommunication(communicationBlock, cancelToken); }
public AstmStart GetReadHistoryInfo(HistoryDataTypeEnum historyDataType) { try { if (this.PumpTime != null && this.PumpTime.OffSet.Length == 4) { int lastRtc = GetLastRtc(historyDataType); Logger.LogInformation($"Getting history for {historyDataType.ToString()} from {this.PumpTime.GetDateTime(BitConverter.GetBytes(lastRtc)).ToString()}"); AstmStart msg = GetPumpEnvelope(AstmSendMessageType.READ_HISTORY_INFO_REQUEST); ((PumpEnvelope)((MedtronicMessage2)msg.Message2).Message).Message.Message = new ReadHistoryInfoRequest(lastRtc, historyDataType); return(msg); } } catch (Exception) { throw; } return(null); }