3
* $Id: dicomcustomassociation.h 4848 2012-04-18 09:43:41Z carlos $
6
* Copyright 2008-10 MetaEmotion S.L. All rights reserved.
7
* http://ginkgo-cadx.com
9
* This file is licensed under LGPL v3 license.
10
* See License.txt for details
17
#include "dicomassociation.h"
19
#include <api/dicom/imodelodicom.h>
20
#include <main/controllers/dcmtk/dicomservers.h>
21
#include <main/controllers/dcmtk/dicomnetwork.h>
22
#include <api/controllers/ipacscontroller.h>
24
#include <dcmtk/ofstd/ofstream.h>
25
#include <dcmtk/ofstd/ofstring.h> /* for class OFString */
30
class CustomEventHandler
35
virtual ~CustomEventHandler() {}
37
/** handles an N-EVENT-REPORT-RQ message. This method is called
38
* from CustomAssociation whenever an event report is received.
39
* The event message, information and status detail elements must be copied
40
* if they should remain valid after the end of this method call.
41
* The event handler can react on the event message in any implementation
42
* dependent way, e.g. display the event on-screen.
43
* @param eventMessage the N-EVENT-REPORT-RQ message
44
* @param eventInformation event information dataset. May be NULL if no event information available.
45
* @param statusDetail status detail dataset. ay be NULL if no status detail available.
46
* @return the status code to be sent back as part of the N-EVENT-REPORT-RSP message, usually STATUS_Success.
48
virtual DIC_US handleEvent(
49
T_DIMSE_N_EventReportRQ& eventMessage,
50
DcmDataset *eventInformation,
51
DcmDataset *statusDetail)=0;
54
class CustomAssociation : public Association, public GIL::DICOM::ICustomAssociation {
60
CustomAssociation(void* connectionKey, const std::string& ambitolog, GNC::IProxyNotificadorProgreso* pNotificadorProgreso = NULL);
62
virtual ~CustomAssociation();
64
virtual bool Connect(const std::string& serverId, const std::string& local_aet);
66
virtual bool createRQ( const std::string& sopclassUID, const std::string& sopinstanceUID, const GIL::DICOM::TipoJerarquia& attributeListIn, int& status, GnkPtr<GIL::DICOM::TipoJerarquia>& attributeListOut);
67
virtual bool setRQ( const std::string& sopclassUID, const std::string& sopinstanceUID, const GIL::DICOM::TipoJerarquia& modificationList, int& status, GnkPtr<GIL::DICOM::TipoJerarquia>& attributeListOut);
68
virtual bool getRQ( const std::string& sopclassUID, const std::string& sopinstanceUID, const int *attributeIdentifierList, unsigned long numShorts, int& status, GnkPtr<GIL::DICOM::TipoJerarquia>& attributeListOut);
69
virtual bool actionRQ( const std::string& sopclassUID, const std::string& sopinstanceUID, int actionTypeID, const GIL::DICOM::TipoJerarquia& actionInformation, int& status, GnkPtr<GIL::DICOM::TipoJerarquia>& attributeListOut);
70
virtual bool deleteRQ( const std::string& sopclassUID, const std::string& sopinstanceUID, int& status);
72
virtual bool releaseAssociation();
73
virtual bool abortAssociation();
76
void dumpNMessage(T_DIMSE_Message &msg, DcmItem *dataset, OFBool outgoing);
77
OFCondition sendNRequest( T_ASC_PresentationContextID presId, T_DIMSE_Message &request, DcmDataset *rqDataSet, T_DIMSE_Message &response, DcmDataset* &statusDetail, DcmDataset* &rspDataset);
78
T_ASC_PresentationContextID findAcceptedPC(const char *sopclassuid);
83
CONDITION Connect(DicomServer* server, const std::string& local_aet);
84
OFCondition createRQ(const char *sopclassUID, OFString& sopinstanceUID, DcmDataset *attributeListIn, Uint16& status, DcmDataset* &attributeListOut);
85
OFCondition setRQ( const char *sopclassUID, const char *sopinstanceUID, DcmDataset *modificationList, Uint16& status, DcmDataset* &attributeListOut);
86
OFCondition getRQ( const char *sopclassUID, const char *sopinstanceUID, const Uint16 *attributeIdentifierList, ssize_t numShorts, Uint16& status, DcmDataset* &attributeListOut);
87
OFCondition actionRQ( const char *sopclassUID, const char *sopinstanceUID, Uint16 actionTypeID, DcmDataset *actionInformation, Uint16& status, DcmDataset* &actionReply);
88
OFCondition deleteRQ( const char *sopclassUID, const char *sopinstanceUID, Uint16& status);
89
OFCondition releaseAssociation();
90
OFCondition abortAssociation();
93
void addPresentationContext(const std::string& sopClass, const std::list<std::string>& transferSyntaxes);
98
void Gnk2Dcmtk(const GIL::DICOM::TipoJerarquia& base, DcmDataset* query);
101
GIL::DICOM::DCMTK::Network* Net;
102
std::string ambitolog;
105
GNC::IProxyNotificadorProgreso* m_pNotificadorProgreso;
107
virtual void OnAddPresentationContext(T_ASC_Parameters* params);
109
T_ASC_PresentationContextID presId;
113
T_DIMSE_BlockingMode blockMode;
115
/// the current event handler. Can be NULL.
116
CustomEventHandler *eventHandler;