ctkDicomHostService.cpp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*=============================================================================
  2. Library: CTK
  3. Copyright (c) German Cancer Research Center,
  4. Division of Medical and Biological Informatics
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. =============================================================================*/
  15. #include "ctkDicomHostService.h"
  16. #include "ctkDicomServicePrivate.h"
  17. #include "ctkDicomAppHostingTypesHelper.h"
  18. ctkDicomHostService::ctkDicomHostService(ushort port, QString path):
  19. d(new ctkDicomServicePrivate(port, path)), service(port, path)
  20. {
  21. }
  22. ctkDicomHostService::~ctkDicomHostService()
  23. {
  24. }
  25. QString ctkDicomHostService::generateUID()
  26. {
  27. //Q_D(ctkDicomService);
  28. const QtSoapType& result = d->askHost("generateUID", NULL);
  29. QString resultUID = ctkDicomSoapUID::getUID(result);
  30. return resultUID;
  31. }
  32. QString ctkDicomHostService::getOutputLocation(const QStringList& preferredProtocols)
  33. {
  34. //Q_D(ctkDicomHostService);
  35. QtSoapStruct* input = dynamic_cast<QtSoapStruct*>(
  36. new ctkDicomSoapArrayOfStringType("string","preferredProtocols", preferredProtocols));
  37. const QtSoapType& result = d->askHost("getOutputLocation", input);
  38. QString resultString = result.value().toString();
  39. return resultString;
  40. }
  41. QRect ctkDicomHostService::getAvailableScreen(const QRect& preferredScreen)
  42. {
  43. //Q_D(ctkDicomService);
  44. QtSoapStruct* input = new ctkDicomSoapRectangle("preferredScreen", preferredScreen);
  45. const QtSoapType& result = d->askHost("getAvailableScreen", input);
  46. QRect resultRect = ctkDicomSoapRectangle::getQRect(result);
  47. qDebug() << "x:" << resultRect.x() << " y:" << resultRect.y();
  48. return resultRect;
  49. }
  50. void ctkDicomHostService::notifyStateChanged(ctkDicomAppHosting::State state)
  51. {
  52. //Q_D(ctkDicomService);
  53. QtSoapType* input = new ctkDicomSoapState("newState", state); // spec would be "state", java has "newState" FIX JAVA/STANDARD
  54. d->askHost("notifyStateChanged", input);
  55. }
  56. void ctkDicomHostService::notifyStatus(const ctkDicomAppHosting::Status& status)
  57. {
  58. //Q_D(ctkDicomService);
  59. QtSoapStruct* input = new ctkDicomSoapStatus("status", status);
  60. d->askHost("notifyStatus", input);
  61. }
  62. // Exchange methods
  63. bool ctkDicomHostService::notifyDataAvailable(ctkDicomAppHosting::AvailableData data, bool lastData)
  64. {
  65. return service.notifyDataAvailable(data, lastData);
  66. }
  67. QList<ctkDicomAppHosting::ObjectLocator>* ctkDicomHostService::getData(
  68. QList<QUuid> objectUUIDs,
  69. QList<QString> acceptableTransferSyntaxUIDs,
  70. bool includeBulkData)
  71. {
  72. return service.getData(objectUUIDs, acceptableTransferSyntaxUIDs, includeBulkData);
  73. }
  74. void ctkDicomHostService::releaseData(QList<QUuid> objectUUIDs)
  75. {
  76. service.releaseData(objectUUIDs);
  77. }