Explorar o código

Added getData and notifyAvailableData to exampleHost

Benoit Bleuze %!s(int64=14) %!d(string=hai) anos
pai
achega
f802eede56

+ 26 - 0
Applications/ctkExampleHost/ctkHostAppExampleWidget.cpp

@@ -140,4 +140,30 @@ void ctkHostAppExampleWidget::placeholderResized()
 void ctkHostAppExampleWidget::appStateChanged(ctkDicomAppHosting::State state)
 {
   ui->statusLabel->setText(ctkDicomSoapState::toStringValue(state));
+  if (state == ctkDicomAppHosting::IDLE)
+  {
+    ctkDicomAppHosting::AvailableData data;
+    ctkDicomAppHosting::Patient patient;
+    patient.name = "John Doe";
+    patient.id = "0000";
+    patient.assigningAuthority = "authority";
+    patient.sex = "male";
+    patient.birthDate = "today";
+    patient.objectDescriptors = QList<ctkDicomAppHosting::ObjectDescriptor>();
+
+    ctkDicomAppHosting::ObjectDescriptor ourObjectDescriptor;
+    ourObjectDescriptor.descriptorUUID = QUuid("{11111111-1111-1111-1111-111111111111}");
+    ourObjectDescriptor.mimeType = "text/plain";
+    ourObjectDescriptor.classUID = "lovelyClass";
+    ourObjectDescriptor.transferSyntaxUID = "transSyntaxUId";
+    ourObjectDescriptor.modality = "modMod";
+
+    data.objectDescriptors =  QList<ctkDicomAppHosting::ObjectDescriptor>();
+    data.objectDescriptors.append (ourObjectDescriptor);
+    data.patients = QList<ctkDicomAppHosting::Patient>();
+    data.patients.append (patient);
+
+    bool reply = host->getDicomAppService()->notifyDataAvailable (data,true);
+    qDebug() << "  notifyDataAvailable(1111) returned: " << reply;
+  }
 }

+ 25 - 2
Plugins/org.commontk.dah.examplehost/ctkExampleDicomHost.cpp

@@ -109,9 +109,32 @@ QList<ctkDicomAppHosting::ObjectLocator> ctkExampleDicomHost::getData(
     QList<QString> acceptableTransferSyntaxUIDs,
     bool includeBulkData)
 {
-  Q_UNUSED(objectUUIDs)
-  Q_UNUSED(acceptableTransferSyntaxUIDs)
   Q_UNUSED(includeBulkData)
+  Q_UNUSED(acceptableTransferSyntaxUIDs)
+
+  //stupid test: only works with one uuid
+  QList<ctkDicomAppHosting::ObjectLocator> locators;
+  QUuid uuid;
+  QUuid testUuid("{11111111-1111-1111-1111-111111111111}");
+  foreach(uuid, objectUUIDs)
+  {
+    //stupid test: only works with one uuid
+    if (uuid == testUuid)
+    {
+      ctkDicomAppHosting::ObjectLocator objectLocator;
+      objectLocator.locator = QUuid();
+      objectLocator.source = QUuid();
+      //need to filter transfert syntax with acceptable ones
+      objectLocator.transferSyntax = "transSyntaxUId";
+      objectLocator.length = 0;
+      objectLocator.offset = 0;
+      objectLocator.URI = "testFile.txt";
+      locators.append (objectLocator);
+    }
+
+    return locators;
+  }
+
   return QList<ctkDicomAppHosting::ObjectLocator>();
 }
 void ctkExampleDicomHost::releaseData(QList<QUuid> objectUUIDs)