~ubuntu-branches/ubuntu/trusty/ginkgocadx/trusty

« back to all changes in this revision

Viewing changes to src/cadxcore/main/controllers/dcmtk/dicomservice.cpp

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2013-07-21 11:58:53 UTC
  • mfrom: (7.2.1 sid)
  • Revision ID: package-import@ubuntu.com-20130721115853-44e7n1xujqglu78e
Tags: 3.4.0.928.29+dfsg-1
* New upstream release [July 2013]
  + new B-D: "libjsoncpp-dev".
  + new patch "unbundle-libjsoncpp.patch" to avoid building bundled
    "libjsoncpp-dev".
  + new patch "fix-wx.patch" to avoid FTBFS due to missing
    "-lwx_gtk2u_html-2.8".
* Removed unnecessary versioned Build-Depends.
* Removed obsolete lintian override.
* Reference get-orig-source implementation for orig.tar clean-up and
  DFSG-repackaging.
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
#include <api/controllers/icontroladorlog.h>
14
14
#include <api/internationalization/internationalization.h>
15
15
#include <main/controllers/controladorlog.h>
16
 
#include <main/controllers/controladorcomandos.h>
 
16
#include <main/controllers/commandcontroller.h>
17
17
#include <main/controllers/configurationcontroller.h>
18
18
#include <commands/incomingdicomassociationcommand.h>
19
19
#include "dicomservice.h"
73
73
 
74
74
GIL::DICOM::Service::~Service() {
75
75
        // drop an existing association on shutdown     
 
76
        GNC::GCS::ILocker lock(lockerRunning);
76
77
        m_pNotificadorProgreso = NULL;
77
78
}
78
79
 
79
80
CONDITION GIL::DICOM::Service::Start() {
80
 
 
 
81
        GNC::GCS::ILocker lock(lockerRunning);
81
82
        m_WantToStop = false;
82
 
#ifdef _WIN32
83
 
        WORD wVersionRequested;
84
 
        WSADATA wsaData;
85
 
 
86
 
        wVersionRequested = MAKEWORD(1, 1);
87
 
 
88
 
        WSAStartup(wVersionRequested, &wsaData);
89
 
#endif
90
83
 
91
84
        CONDITION cond;
92
85
 
104
97
                        return EC_IllegalParameter;
105
98
        }
106
99
 
 
100
        if (cond.bad()) {
 
101
                LOG_ERROR(ambitolog, "Unable to initialize network, check port " << m_acceptorPort << " is not in use" );
 
102
                return cond;
 
103
        }
 
104
 
107
105
        if (m_pTLSLayer != NULL) {
108
106
                delete m_pTLSLayer;
109
107
        }
159
157
        CONDITION cond = EC_Normal;
160
158
        OFString temp_str;
161
159
 
162
 
        while (!m_WantToStop && cond.good())
163
 
        {
164
 
                cond = acceptAssociation();
165
 
        }
166
 
 
167
 
        cond = ASC_dropNetwork(&m_pNet);
168
 
 
169
 
#if defined(_WINDOWS)
170
 
        WSACleanup();
171
 
#endif
172
 
 
173
 
        if (cond.bad())
174
 
        {
175
 
                LOG_ERROR(ambitolog, DimseCondition::dump(temp_str, cond));
176
 
                return NULL;
 
160
 
 
161
        GNC::GCS::ILocker lock(lockerRunning);
 
162
        try {
 
163
                while (!m_WantToStop && cond.good())
 
164
                {
 
165
                        cond = acceptAssociation();
 
166
                }
 
167
 
 
168
                cond = ASC_dropNetwork(&m_pNet);
 
169
 
 
170
                if (cond.bad())
 
171
                {
 
172
                        LOG_ERROR(ambitolog, DimseCondition::dump(temp_str, cond));
 
173
                        return NULL;
 
174
                }
 
175
        } catch (...) {
 
176
                LOG_ERROR("DicomService", "Dicom service terminated with exceptions");
177
177
        }
178
178
 
179
179
        return 0;
184
184
{
185
185
        
186
186
 
187
 
        T_ASC_Association *assoc;
 
187
        T_ASC_Association *assoc = NULL;
188
188
        OFCondition cond;
189
189
        OFString sprofile;
190
190
        OFString temp_str;
206
206
        {
207
207
                char buf[BUFSIZ];
208
208
 
209
 
                LOG_INFO(ambitolog, _Std("Association Received"));
210
 
 
 
209
                LOG_INFO(ambitolog, _Std("Association received"));
211
210
                LOG_DEBUG(ambitolog, _Std("Parameters:") << std::endl << ASC_dumpParameters(temp_str, assoc->params, ASC_ASSOC_RQ).c_str());
212
211
 
213
212
                const GIL::DICOM::SOPClassMap& scps = GIL::DICOM::Conformance::GetScpSOPClasses();
270
269
                                LOG_ERROR(ambitolog, DimseCondition::dump(temp_str, cond).c_str());
271
270
                                goto cleanup;
272
271
                        }
273
 
                        LOG_INFO(ambitolog, _Std("Association Acknowledged (Max Send PDV: ") << assoc->sendPDVLength << _Std(")"));
 
272
                        LOG_DEBUG(ambitolog, _Std("Association Acknowledged (Max Send PDV: ") << assoc->sendPDVLength << _Std(")"));
274
273
                        if (ASC_countAcceptedPresentationContexts(assoc->params) == 0) {
275
 
                                LOG_INFO(ambitolog, _Std(" but no valid presentation contexts"));
 
274
                                LOG_WARN(ambitolog, _Std("No valid presentation contexts"));
276
275
                        }
277
276
                        // dump the presentation contexts which have been accepted/refused 
278
277
                        LOG_DEBUG(ambitolog, ASC_dumpParameters(temp_str, assoc->params, ASC_ASSOC_AC).c_str());
285
284
                        }
286
285
 
287
286
                        GADAPI::PACS::IncomingDicomAssociationCommandParams* pCmdParams = new GADAPI::PACS::IncomingDicomAssociationCommandParams(assoc);
288
 
 
289
 
 
290
 
                        GNC::GCS::IControladorComandos::Instance()->ProcessAsync( cmdName, new GADAPI::PACS::IncomingDicomAssociationCommand(pCmdParams, cmdName), this);
 
287
                        GNC::GCS::ICommandController::Instance()->ProcessAsync( cmdName, new GADAPI::PACS::IncomingDicomAssociationCommand(pCmdParams, cmdName), this);
 
288
 
291
289
                        return cond;
292
290
                }
293
291
        }
313
311
 
314
312
void GIL::DICOM::Service::Stop() {
315
313
 
316
 
        GNC::GCS::IControladorComandos::Instance()->AbortarComandosDeOwner(this);
 
314
        GNC::GCS::ICommandController::Instance()->AbortarComandosDeOwner(this);
317
315
        m_WantToStop = true;
318
316
 
319
317
        if (m_pNet != NULL && m_pNet->network != NULL) {