comparison Plugins/Samples/Basic/Plugin.c @ 1651:2e692c83e2f3

improved custom error login
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 25 Sep 2015 17:29:39 +0200
parents 9f34ebfaf2c9
children 5360cdba70d8
comparison
equal deleted inserted replaced
1650:9f34ebfaf2c9 1651:2e692c83e2f3
23 #include <string.h> 23 #include <string.h>
24 #include <stdio.h> 24 #include <stdio.h>
25 25
26 static OrthancPluginContext* context = NULL; 26 static OrthancPluginContext* context = NULL;
27 27
28 static OrthancPluginErrorCode c1; 28 static OrthancPluginErrorCode customError;
29 29
30 30
31 ORTHANC_PLUGINS_API int32_t Callback1(OrthancPluginRestOutput* output, 31 ORTHANC_PLUGINS_API int32_t Callback1(OrthancPluginRestOutput* output,
32 const char* url, 32 const char* url,
33 const OrthancPluginHttpRequest* request) 33 const OrthancPluginHttpRequest* request)
214 214
215 ORTHANC_PLUGINS_API OrthancPluginErrorCode CallbackCreateDicom(OrthancPluginRestOutput* output, 215 ORTHANC_PLUGINS_API OrthancPluginErrorCode CallbackCreateDicom(OrthancPluginRestOutput* output,
216 const char* url, 216 const char* url,
217 const OrthancPluginHttpRequest* request) 217 const OrthancPluginHttpRequest* request)
218 { 218 {
219 return c1;
220
221 const char* pathLocator = "\"Path\" : \""; 219 const char* pathLocator = "\"Path\" : \"";
222 char info[1024]; 220 char info[1024];
223 char *id, *eos; 221 char *id, *eos;
224 OrthancPluginMemoryBuffer tmp; 222 OrthancPluginMemoryBuffer tmp;
225 223
403 401
404 /* Play with PUT by defining a new target modality. */ 402 /* Play with PUT by defining a new target modality. */
405 sprintf(info, "[ \"STORESCP\", \"localhost\", 2000 ]"); 403 sprintf(info, "[ \"STORESCP\", \"localhost\", 2000 ]");
406 OrthancPluginRestApiPut(context, &tmp, "/modalities/demo", info, strlen(info)); 404 OrthancPluginRestApiPut(context, &tmp, "/modalities/demo", info, strlen(info));
407 405
408 c1 = OrthancPluginRegisterErrorCode(context, 4, 402, "Hello world"); 406 customError = OrthancPluginRegisterErrorCode(context, 4, 402, "Hello world");
409 407
410 return 0; 408 return 0;
411 } 409 }
412 410
413 411