changeset 70:e673eadccf7d

wrapping OrthancPluginSetStableStatus
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 21 Aug 2025 16:29:37 +0200
parents dcd69fbcc34b
children ae9124e7edee
files CodeGeneration/CustomFunctions.json Plugin/Plugin.cpp
diffstat 2 files changed, 48 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/CodeGeneration/CustomFunctions.json	Thu Aug 21 16:16:46 2025 +0200
+++ b/CodeGeneration/CustomFunctions.json	Thu Aug 21 16:29:37 2025 +0200
@@ -75,5 +75,33 @@
     "return_sdk_class" : "byte[]",
     "return_sdk_signature" : "[B",
     "since_sdk" : [ 1, 12, 8 ]
+  },
+
+  {
+    "comment" : "New in release 2.0",
+    "c_function" : "OrthancPluginCustom_SetStableStatus",
+    "sdk_functions" : [ "OrthancPluginSetStableStatus" ],
+    "documentation" : {
+      "description" : [ "Change the Stable status of a resource" ],
+      "args" : {
+        "resourceId" : "The identifier of the resource.",
+        "stableStatus" : "The new stable status."
+      },
+      "return" : "A Boolean indicating whether the status has changed (true) or not (false) during the execution of this command."
+    },
+    "args" : [
+      {
+        "sdk_name" : "resourceId",
+        "sdk_type" : "const char *"
+      },
+      {
+        "sdk_name" : "stableStatus",
+        "sdk_type" : "enumeration",
+        "sdk_enumeration" : "OrthancPluginStableStatus"
+      }
+    ],
+    "return_sdk_type" : "bool",
+    "since_sdk" : [ 1, 12, 9 ]
   }
+
 ]
--- a/Plugin/Plugin.cpp	Thu Aug 21 16:16:46 2025 +0200
+++ b/Plugin/Plugin.cpp	Thu Aug 21 16:29:37 2025 +0200
@@ -535,6 +535,26 @@
 #endif
 
 
+#if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 9)
+bool OrthancPluginCustom_SetStableStatus(OrthancPluginContext* context,
+                                         const char* resourceId,
+                                         OrthancPluginStableStatus stableStatus)
+{
+  uint8_t statusHasChanged = false;
+  OrthancPluginErrorCode code = OrthancPluginSetStableStatus(context, &statusHasChanged, resourceId, stableStatus);
+
+  if (code == OrthancPluginErrorCode_Success)
+  {
+    return statusHasChanged;
+  }
+  else
+  {
+    throw std::runtime_error(JavaEnvironment::GetRuntimeErrorMessage(context, code));
+  }
+}
+#endif
+
+
 extern "C"
 {
   ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* context)