ctkDicomHostService.cpp 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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_p.h"
  16. #include <ctkDicomAppHostingTypesHelper.h>
  17. //----------------------------------------------------------------------------
  18. ctkDicomHostService::ctkDicomHostService(ushort port, QString path)
  19. : ctkDicomExchangeService(port, path)
  20. {
  21. }
  22. //----------------------------------------------------------------------------
  23. ctkDicomHostService::~ctkDicomHostService()
  24. {
  25. }
  26. //----------------------------------------------------------------------------
  27. QString ctkDicomHostService::generateUID()
  28. {
  29. const QtSoapType& result = submitSoapRequest("GenerateUID", NULL);
  30. QString resultUID = ctkDicomSoapUID::getUID(result);
  31. return resultUID;
  32. }
  33. //----------------------------------------------------------------------------
  34. QString ctkDicomHostService::getOutputLocation(const QStringList& preferredProtocols)
  35. {
  36. QtSoapStruct* input = dynamic_cast<QtSoapStruct*>(
  37. new ctkDicomSoapArrayOfStringType("string","preferredProtocols", preferredProtocols));
  38. const QtSoapType& result = submitSoapRequest("GetOutputLocation", input);
  39. QString resultString = result.value().toString();
  40. return resultString;
  41. }
  42. //----------------------------------------------------------------------------
  43. QRect ctkDicomHostService::getAvailableScreen(const QRect& preferredScreen)
  44. {
  45. QtSoapStruct* input = new ctkDicomSoapRectangle("preferredScreen", preferredScreen);
  46. const QtSoapType& result = submitSoapRequest("GetAvailableScreen", input);
  47. QRect resultRect = ctkDicomSoapRectangle::getQRect(result);
  48. qDebug() << "x:" << resultRect.x() << " y:" << resultRect.y();
  49. return resultRect;
  50. }
  51. //----------------------------------------------------------------------------
  52. void ctkDicomHostService::notifyStateChanged(ctkDicomAppHosting::State state)
  53. {
  54. QtSoapType* input = new ctkDicomSoapState("state", state); // spec would be "state", java has "newState" FIX JAVA/STANDARD
  55. submitSoapRequest("NotifyStateChanged", input);
  56. }
  57. //----------------------------------------------------------------------------
  58. void ctkDicomHostService::notifyStatus(const ctkDicomAppHosting::Status& status)
  59. {
  60. //Q_D(ctkDicomService);
  61. QtSoapStruct* input = new ctkDicomSoapStatus("status", status);
  62. submitSoapRequest("NotifyStatus", input);
  63. }
  64. //----------------------------------------------------------------------------
  65. // Exchange methods
  66. //----------------------------------------------------------------------------
  67. bool ctkDicomHostService::notifyDataAvailable(const ctkDicomAppHosting::AvailableData& data, bool lastData)
  68. {
  69. return ctkDicomExchangeService::notifyDataAvailable(data, lastData);
  70. }
  71. //----------------------------------------------------------------------------
  72. QList<ctkDicomAppHosting::ObjectLocator> ctkDicomHostService::getData(
  73. const QList<QUuid>& objectUUIDs,
  74. const QList<QString>& acceptableTransferSyntaxUIDs,
  75. bool includeBulkData)
  76. {
  77. return ctkDicomExchangeService::getData(objectUUIDs, acceptableTransferSyntaxUIDs, includeBulkData);
  78. }
  79. //----------------------------------------------------------------------------
  80. void ctkDicomHostService::releaseData(const QList<QUuid>& objectUUIDs)
  81. {
  82. ctkDicomExchangeService::releaseData(objectUUIDs);
  83. }