comparison Plugins/Samples/Basic/Plugin.c @ 1145:0479d02c6778

Plugins can retrieve the path to Orthanc and to its configuration file
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 11 Sep 2014 13:06:16 +0200
parents d9c27f9f1a51
children d49505e377e3
comparison
equal deleted inserted replaced
1144:fef79a477e09 1145:0479d02c6778
246 246
247 247
248 ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* c) 248 ORTHANC_PLUGINS_API int32_t OrthancPluginInitialize(OrthancPluginContext* c)
249 { 249 {
250 OrthancPluginMemoryBuffer tmp; 250 OrthancPluginMemoryBuffer tmp;
251 char info[1024]; 251 char info[1024], *s;
252 252
253 context = c; 253 context = c;
254 OrthancPluginLogWarning(context, "Sample plugin is initializing"); 254 OrthancPluginLogWarning(context, "Sample plugin is initializing");
255 255
256 /* Check the version of the Orthanc core */ 256 /* Check the version of the Orthanc core */
263 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER); 263 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER);
264 OrthancPluginLogError(context, info); 264 OrthancPluginLogError(context, info);
265 return -1; 265 return -1;
266 } 266 }
267 267
268 /* Print some information about Orthanc */
268 sprintf(info, "The version of Orthanc is '%s'", context->orthancVersion); 269 sprintf(info, "The version of Orthanc is '%s'", context->orthancVersion);
269 OrthancPluginLogInfo(context, info); 270 OrthancPluginLogWarning(context, info);
270 271
272 s = OrthancPluginGetOrthancPath(context);
273 sprintf(info, " Path to Orthanc: %s", s);
274 OrthancPluginLogWarning(context, info);
275 OrthancPluginFreeString(context, s);
276
277 s = OrthancPluginGetOrthancDirectory(context);
278 sprintf(info, " Directory of Orthanc: %s", s);
279 OrthancPluginLogWarning(context, info);
280 OrthancPluginFreeString(context, s);
281
282 s = OrthancPluginGetConfigurationPath(context);
283 sprintf(info, " Path to configuration file: %s", s);
284 OrthancPluginLogWarning(context, info);
285 OrthancPluginFreeString(context, s);
286
287 /* Register the callbacks */
271 OrthancPluginRegisterRestCallback(context, "/(plu.*)/hello", Callback1); 288 OrthancPluginRegisterRestCallback(context, "/(plu.*)/hello", Callback1);
272 OrthancPluginRegisterRestCallback(context, "/plu.*/image", Callback2); 289 OrthancPluginRegisterRestCallback(context, "/plu.*/image", Callback2);
273 OrthancPluginRegisterRestCallback(context, "/plugin/instances/([^/]+)/info", Callback3); 290 OrthancPluginRegisterRestCallback(context, "/plugin/instances/([^/]+)/info", Callback3);
274 OrthancPluginRegisterRestCallback(context, "/instances/([^/]+)/preview", Callback4); 291 OrthancPluginRegisterRestCallback(context, "/instances/([^/]+)/preview", Callback4);
275 OrthancPluginRegisterRestCallback(context, "/plugin/create", CallbackCreateDicom); 292 OrthancPluginRegisterRestCallback(context, "/plugin/create", CallbackCreateDicom);