@Override public void onDimseRQ(Association as, PresentationContext pc, Dimse dimse, Attributes cmd, Attributes data) throws IOException { if (dimse != Dimse.N_CREATE_RQ) throw new DicomServiceException(Status.UnrecognizedOperation); Attributes rsp = Commands.mkNCreateRSP(cmd, status); Attributes rspAttrs = IanSCP.this.create(as, cmd, data); as.tryWriteDimseRSP(pc, rsp, rspAttrs); } };
void cancel(PresentationContext pc, int msgId) throws IOException { Attributes cmd = Commands.mkCCancelRQ(msgId); encoder.writeDIMSE(pc, cmd, null); }
public void cget(String cuid, int priority, Attributes data, String tsuid, DimseRSPHandler rspHandler) throws IOException, InterruptedException { PresentationContext pc = pcFor(cuid, tsuid); checkIsSCU(cuid); Attributes cgetrq = Commands.mkCGetRQ(rspHandler.getMessageID(), cuid, priority); invoke(pc, cgetrq, new DataWriterAdapter(data), rspHandler, conn.getRetrieveTimeout(), !conn.isRetrieveTimeoutTotal()); }
public void cfind(String cuid, int priority, Attributes data, String tsuid, DimseRSPHandler rspHandler) throws IOException, InterruptedException { PresentationContext pc = pcFor(cuid, tsuid); checkIsSCU(cuid); Attributes cfindrq = Commands.mkCFindRQ(rspHandler.getMessageID(), cuid, priority); invoke(pc, cfindrq, new DataWriterAdapter(data), rspHandler, conn.getResponseTimeout()); }
public void cmove(String cuid, int priority, Attributes data, String tsuid, String destination, DimseRSPHandler rspHandler) throws IOException, InterruptedException { PresentationContext pc = pcFor(cuid, tsuid); checkIsSCU(cuid); Attributes cmoverq = Commands.mkCMoveRQ(rspHandler.getMessageID(), cuid, priority, destination); invoke(pc, cmoverq, new DataWriterAdapter(data), rspHandler, conn.getRetrieveTimeout(), !conn.isRetrieveTimeoutTotal()); }
@Override public void onDimseRQ(Association as, PresentationContext pc, Dimse dimse, Attributes cmd, Attributes keys) throws IOException { if (dimse != Dimse.C_GET_RQ) throw new DicomServiceException(Status.UnrecognizedOperation); RetrieveTask retrieveTask = calculateMatches(as, pc, cmd, keys); if (retrieveTask != null) as.getApplicationEntity().getDevice().execute(retrieveTask); else as.tryWriteDimseRSP(pc, Commands.mkCGetRSP(cmd, Status.Success)); }
public DimseRSP cecho(String cuid) throws IOException, InterruptedException { FutureDimseRSP rsp = new FutureDimseRSP(nextMessageID()); PresentationContext pc = pcFor(cuid, null); checkIsSCU(cuid); Attributes cechorq = Commands.mkCEchoRQ(rsp.getMessageID(), cuid); invoke(pc, cechorq, null, rsp, conn.getResponseTimeout()); return rsp; }
public void writeDimseRSP(PresentationContext pc, Attributes cmd, Attributes data) throws IOException { DataWriter writer = null; int datasetType = Commands.NO_DATASET; if (data != null) { writer = new DataWriterAdapter(data); datasetType = Commands.getWithDatasetType(); } cmd.setInt(Tag.CommandDataSetType, VR.US, datasetType); encoder.writeDIMSE(pc, cmd, writer); if (!Status.isPending(cmd.getInt(Tag.Status, 0))) { decPerforming(); startIdleTimeout(); } }
@Override public void run() { try { int msgId = rq.getInt(Tag.MessageID, -1); as.addCancelRQHandler(msgId, this); try { while (!canceled && hasMoreMatches()) { Attributes match = adjust(nextMatch()); if (match != null) { int status = optionalKeysNotSupported ? Status.PendingWarning : Status.Pending; as.writeDimseRSP(pc, Commands.mkCFindRSP(rq, status), match); } } int status = canceled ? Status.Cancel : Status.Success; as.writeDimseRSP(pc, Commands.mkCFindRSP(rq, status)); } catch (DicomServiceException e) { Attributes rsp = e.mkRSP(0x8020, msgId); as.writeDimseRSP(pc, rsp, e.getDataset()); } finally { as.removeCancelRQHandler(msgId); close(); } } catch (IOException e) { // handled by Association } }
} else if (Commands.hasDataset(cmd)) { nextPDV(PDVType.DATA, pcid); if (dimse.isRSP()) {
public void cget(String cuid, int priority, Attributes data, String tsuid, DimseRSPHandler rspHandler) throws IOException, InterruptedException { PresentationContext pc = pcFor(cuid, tsuid); checkIsSCU(cuid); Attributes cgetrq = Commands.mkCGetRQ(rspHandler.getMessageID(), cuid, priority); invoke(pc, cgetrq, new DataWriterAdapter(data), rspHandler, conn.getRetrieveTimeout(), !conn.isRetrieveTimeoutTotal()); }
public void cfind(String cuid, int priority, Attributes data, String tsuid, DimseRSPHandler rspHandler) throws IOException, InterruptedException { PresentationContext pc = pcFor(cuid, tsuid); checkIsSCU(cuid); Attributes cfindrq = Commands.mkCFindRQ(rspHandler.getMessageID(), cuid, priority); invoke(pc, cfindrq, new DataWriterAdapter(data), rspHandler, conn.getResponseTimeout()); }
public void cmove(String cuid, int priority, Attributes data, String tsuid, String destination, DimseRSPHandler rspHandler) throws IOException, InterruptedException { PresentationContext pc = pcFor(cuid, tsuid); checkIsSCU(cuid); Attributes cmoverq = Commands.mkCMoveRQ(rspHandler.getMessageID(), cuid, priority, destination); invoke(pc, cmoverq, new DataWriterAdapter(data), rspHandler, conn.getRetrieveTimeout(), !conn.isRetrieveTimeoutTotal()); }
@Override public void onDimseRQ(Association as, PresentationContext pc, Dimse dimse, Attributes cmd, Attributes keys) throws IOException { if (dimse != Dimse.C_GET_RQ) throw new DicomServiceException(Status.UnrecognizedOperation); RetrieveTask retrieveTask = calculateMatches(as, pc, cmd, keys); if (retrieveTask != null) as.getApplicationEntity().getDevice().execute(retrieveTask); else as.tryWriteDimseRSP(pc, Commands.mkCGetRSP(cmd, Status.Success)); }
public DimseRSP cecho(String cuid) throws IOException, InterruptedException { FutureDimseRSP rsp = new FutureDimseRSP(nextMessageID()); PresentationContext pc = pcFor(cuid, null); checkIsSCU(cuid); Attributes cechorq = Commands.mkCEchoRQ(rsp.getMessageID(), cuid); invoke(pc, cechorq, null, rsp, conn.getResponseTimeout()); return rsp; }
public void writeDimseRSP(PresentationContext pc, Attributes cmd, Attributes data) throws IOException { DataWriter writer = null; int datasetType = Commands.NO_DATASET; if (data != null) { writer = new DataWriterAdapter(data); datasetType = Commands.getWithDatasetType(); } cmd.setInt(Tag.CommandDataSetType, VR.US, datasetType); encoder.writeDIMSE(pc, cmd, writer); if (!Status.isPending(cmd.getInt(Tag.Status, 0))) { decPerforming(); startIdleTimeout(); } }
@Override public void run() { try { int msgId = rq.getInt(Tag.MessageID, -1); as.addCancelRQHandler(msgId, this); try { while (!canceled && hasMoreMatches()) { Attributes match = adjust(nextMatch()); if (match != null) { int status = optionalKeysNotSupported ? Status.PendingWarning : Status.Pending; as.writeDimseRSP(pc, Commands.mkCFindRSP(rq, status), match); } } int status = canceled ? Status.Cancel : Status.Success; as.writeDimseRSP(pc, Commands.mkCFindRSP(rq, status)); } catch (DicomServiceException e) { Attributes rsp = e.mkRSP(0x8020, msgId); as.writeDimseRSP(pc, rsp, e.getDataset()); } finally { as.removeCancelRQHandler(msgId); close(); } } catch (IOException e) { // handled by Association } }
} else if (Commands.hasDataset(cmd)) { nextPDV(PDVType.DATA, pcid); if (dimse.isRSP()) {
protected void onNCreateRQ(Association as, PresentationContext pc, Attributes rq, Attributes rqAttrs) throws IOException { Attributes rsp = Commands.mkNCreateRSP(rq, Status.Success); Attributes rspAttrs = create(as, rq, rqAttrs, rsp); as.tryWriteDimseRSP(pc, rsp, rspAttrs); }
void cancel(PresentationContext pc, int msgId) throws IOException { Attributes cmd = Commands.mkCCancelRQ(msgId); encoder.writeDIMSE(pc, cmd, null); }