Mercurial > hg > orthanc
comparison Plugins/Samples/Basic/Plugin.c @ 3216:c9a71eb4edcf
fix basic plugin sample
author | s.jodogne@gmail.com |
---|---|
date | Tue, 12 Feb 2019 17:27:33 +0100 |
parents | d9e3d3340918 |
children | cac5a3ddd441 |
comparison
equal
deleted
inserted
replaced
3215:4924972bce77 | 3216:c9a71eb4edcf |
---|---|
316 { | 316 { |
317 OrthancPluginLogError(context, "Instance has no reception date, should never happen!"); | 317 OrthancPluginLogError(context, "Instance has no reception date, should never happen!"); |
318 } | 318 } |
319 | 319 |
320 json = OrthancPluginEncodeDicomWebXml(context, | 320 json = OrthancPluginEncodeDicomWebXml(context, |
321 OrthancPluginGetInstanceData(context, instance), | 321 OrthancPluginGetInstanceData(context, instance), |
322 OrthancPluginGetInstanceSize(context, instance), | 322 OrthancPluginGetInstanceSize(context, instance), |
323 DicomWebBinaryCallback); | 323 DicomWebBinaryCallback); |
324 if (first) | 324 if (first) |
325 { | 325 { |
326 printf("[%s]\n", json); | 326 printf("[%s]\n", json); |
327 first = 0; /* Only print the first DICOM instance */ | 327 first = 0; /* Only print the first DICOM instance */ |
328 } | 328 } |
335 | 335 |
336 ORTHANC_PLUGINS_API OrthancPluginErrorCode OnChangeCallback(OrthancPluginChangeType changeType, | 336 ORTHANC_PLUGINS_API OrthancPluginErrorCode OnChangeCallback(OrthancPluginChangeType changeType, |
337 OrthancPluginResourceType resourceType, | 337 OrthancPluginResourceType resourceType, |
338 const char* resourceId) | 338 const char* resourceId) |
339 { | 339 { |
340 char info[1024]; | |
341 | |
340 OrthancPluginMemoryBuffer tmp; | 342 OrthancPluginMemoryBuffer tmp; |
341 memset(&tmp, 0, sizeof(tmp)); | 343 memset(&tmp, 0, sizeof(tmp)); |
342 | 344 |
343 char info[1024]; | |
344 sprintf(info, "Change %d on resource %s of type %d", changeType, | 345 sprintf(info, "Change %d on resource %s of type %d", changeType, |
345 (resourceId == NULL ? "<none>" : resourceId), resourceType); | 346 (resourceId == NULL ? "<none>" : resourceId), resourceType); |
346 OrthancPluginLogWarning(context, info); | 347 OrthancPluginLogWarning(context, info); |
347 | 348 |
348 switch (changeType) | 349 switch (changeType) |
423 | 424 |
424 | 425 |
425 ORTHANC_PLUGINS_API void RefreshMetrics() | 426 ORTHANC_PLUGINS_API void RefreshMetrics() |
426 { | 427 { |
427 static unsigned int count = 0; | 428 static unsigned int count = 0; |
428 OrthancPluginSetMetricsValue(context, "sample_counter", count++, OrthancPluginMetricsType_Default); | 429 OrthancPluginSetMetricsValue(context, "sample_counter", |
430 (float) (count++), OrthancPluginMetricsType_Default); | |
429 } | 431 } |
430 | 432 |
431 | 433 |
432 ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* c) | 434 ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* c) |
433 { | 435 { |