comparison Plugins/Samples/Basic/Plugin.c @ 1040:d06186cdc502

check plugin version in samples
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 17 Jul 2014 13:04:02 +0200
parents 5a5a4890ffca
children 2c49b7dffcec
comparison
equal deleted inserted replaced
1039:5a5a4890ffca 1040:d06186cdc502
132 const char* pathLocator = "\"Path\" : \""; 132 const char* pathLocator = "\"Path\" : \"";
133 OrthancPluginMemoryBuffer tmp; 133 OrthancPluginMemoryBuffer tmp;
134 char info[1024]; 134 char info[1024];
135 char *id, *eos; 135 char *id, *eos;
136 136
137 char error[256]; 137 context = c;
138 OrthancPluginLogWarning(context, "Sample plugin is initializing");
139
140 /* Check the version of the Orthanc core */
138 if (OrthancPluginCheckVersion(c) == 0) 141 if (OrthancPluginCheckVersion(c) == 0)
139 { 142 {
140 sprintf(error, "Your version of Orthanc (%s) must be above %d.%d.%d to run this plugin", 143 sprintf(info, "Your version of Orthanc (%s) must be above %d.%d.%d to run this plugin",
141 c->orthancVersion, 144 c->orthancVersion,
142 ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER, 145 ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER,
143 ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER, 146 ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER,
144 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER); 147 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER);
145 OrthancPluginLogError(context, error); 148 OrthancPluginLogError(context, info);
146 return -1; 149 return -1;
147 } 150 }
148
149 context = c;
150 OrthancPluginLogWarning(context, "Sample plugin is initializing");
151 151
152 sprintf(info, "The version of Orthanc is '%s'", context->orthancVersion); 152 sprintf(info, "The version of Orthanc is '%s'", context->orthancVersion);
153 OrthancPluginLogInfo(context, info); 153 OrthancPluginLogInfo(context, info);
154 154
155 OrthancPluginRegisterRestCallback(context, "/(plu.*)/hello", Callback1); 155 OrthancPluginRegisterRestCallback(context, "/(plu.*)/hello", Callback1);