/// <summary> /// Parse commands /// </summary> protected override void conn_CommandReceived(DICOMConnection conn, PDATACommands command, DICOMData cmdDICOM, DICOMData dataDICOM) { switch (command) { case PDATACommands.CMOVERSP: logger.Log(LogLevel.Info, "Received C-MOVE-RSP"); CommandStatus status = (CommandStatus)(ushort)cmdDICOM[DICOMTags.Status].Data; ushort remaining = (ushort)cmdDICOM[DICOMTags.NumberOfRemainingSubOps].Data; ushort completed = (ushort)cmdDICOM[DICOMTags.NumberOfCompletedSubOps].Data; ushort failed = (ushort)cmdDICOM[DICOMTags.NumberOfFailedSubOps].Data; ushort warning = (ushort)cmdDICOM[DICOMTags.NumberOfWarningSubOps].Data; if (MoveUpdate != null) { MoveUpdate(this, remaining, completed, failed, warning); } if (remaining == 0) { conn.SendReleaseRQ(); } break; default: logger.Log(LogLevel.Warning, "Unhandled P-DATA Command Type: " + command + "..."); break; } }
/// <summary> /// Parse commands /// </summary> protected override void conn_CommandReceived(DICOMConnection conn, PDATACommands command, DICOMData cmdDICOM, DICOMData dataDICOM) { switch (command) { case PDATACommands.CFINDRSP: logger.Log(LogLevel.Info, "Received C-FIND-RSP"); CommandStatus status = (CommandStatus)(ushort)cmdDICOM[DICOMTags.Status].Data; if (status == CommandStatus.Pending_AllOptionalKeysReturned || status == CommandStatus.Pending_SomeOptionalKeysNotReturned) { findResponse.AddResponseRow(dataDICOM); } else if (status == CommandStatus.Success) { if (FindResponse != null) { FindResponse(this, findResponse); } conn.SendReleaseRQ(); } else { logger.Log(LogLevel.Error, "Unhandled C-FIND-RSP Status Type: " + status + "..."); } break; default: logger.Log(LogLevel.Warning, "Unhandled P-DATA Command Type: " + command + "..."); break; } }
/// <summary> /// Process commands /// </summary> protected override void conn_CommandReceived(DICOMConnection conn, PDATACommands command, DICOMData cmdDICOM, DICOMData dataDICOM) { switch (command) { case PDATACommands.CSTORERSP: logger.Log(LogLevel.Info, "Received C-STORE-RSP"); CommandStatus status = (CommandStatus)(ushort)cmdDICOM[DICOMTags.Status].Data; if (status == CommandStatus.Success) { completed++; } else if (status == CommandStatus.Warning_DuplicateInvocation || status == CommandStatus.Warning_DuplicateSOPInstance) { warned++; } else { failed++; } if (SendUpdate != null) { SendUpdate(this, (ushort)sendQueue.Count, completed, warned, failed); } SendNextImage(); break; default: logger.Log(LogLevel.Warning, "Unhandled P-DATA Command Type: " + command + "..."); break; } }
/// <summary> /// Parses commands. /// </summary> protected override void conn_CommandReceived(DICOMConnection conn, PDATACommands command, DICOMData cmdDICOM, DICOMData dataDICOM) { switch (command) { case PDATACommands.CECHORSP: logger.Log(LogLevel.Info, "Received C-ECHO-RSP"); conn.SendReleaseRQ(); break; default: logger.Log(LogLevel.Warning, "Unhandled P-DATA Command Type: " + command + "..."); break; } }
/// <summary> /// This function must be overridden to provide handling of received P-DATA commands. /// </summary> /// <param name="conn">The DICOMConnection in question.</param> /// <param name="command">The P-DATA command ID.</param> /// <param name="cmdDICOM">The command DICOM set of the P-DATA command.</param> /// <param name="dataDICOM">The data DICOM set of the P-DATA command, if any. Null if no data set contained in the command.</param> protected abstract void conn_CommandReceived(DICOMConnection conn, PDATACommands command, DICOMData cmdDICOM, DICOMData dataDICOM);
private void conn_CommandReceived(DICOMConnection conn, PDATACommands command, DICOMData cmdDICOM, DICOMData dataDICOM) { switch (command) { case PDATACommands.CECHORQ: conn.LogLine(LogLevel.Info, "Received C-ECHO-RQ"); conn.SendCECHORSP(); break; case PDATACommands.CSTORERQ: conn.LogLine(LogLevel.Info, "Received C-STORE-RQ"); //Add source AE title to image dataDICOM[DICOMTags.SourceApplicationEntityTitle].Data = conn.CallingAE; if (StoreRequest != null) { StoreRequest(conn, dataDICOM); } else { conn.SendCSTORERSP(CommandStatus.Success); } break; case PDATACommands.CSTORERSP: conn.LogLine(LogLevel.Info, "Received C-STORE-RSP"); break; case PDATACommands.CFINDRQ: conn.LogLine(LogLevel.Info, "Received C-FIND-RQ"); if (FindRequest != null) { QRResponseData response = FindRequest(conn, new QRRequestData(cmdDICOM, dataDICOM)); conn.SendCFINDRSP(response); } else { conn.SendCFINDRSP(null, CommandStatus.Success); } break; case PDATACommands.CGETRQ: conn.LogLine(LogLevel.Info, "Received C-GET-RQ"); if (GetRequest != null) { QRResponseData response = GetRequest(conn, new QRRequestData(cmdDICOM, dataDICOM)); conn.StartGetResponse(response); } else { conn.SendCGETRSP((ushort)cmdDICOM[DICOMTags.MessageID].Data, CommandStatus.Success, 0, 0, 0, 0); } break; case PDATACommands.CMOVERQ: conn.LogLine(LogLevel.Info, "Received C-MOVE-RQ"); if (MoveRequest != null) { string newAE = cmdDICOM[DICOMTags.MoveDestination].Display.Trim(); ApplicationEntity entity = null; if (EntityLookup != null) { entity = EntityLookup(newAE); } if (entity != null) { QRResponseData response = MoveRequest(conn, new QRRequestData(cmdDICOM, dataDICOM)); conn.StartMoveResponse(entity, response); } else { conn.LogLine(LogLevel.Warning, "No entity found for the MOVE request: " + newAE); conn.SendCMOVERSP(CommandStatus.Error_ProcessingFailure, 0, 0, 0, 0); } } else { conn.SendCMOVERSP(CommandStatus.Error_ProcessingFailure, 0, 0, 0, 0); } break; case PDATACommands.NGETRQ: conn.LogLine(LogLevel.Info, "Received N-GET-RQ"); // No idea what we're supposed to do with these yet conn.SendNGETRSP(CommandStatus.Refused_SOPClassNotSupported, null); break; default: conn.LogLine(LogLevel.Warning, "Unhandled P-DATA Command Type: " + command + "..."); break; } }