+ if (!m_dataFromConfigXML) {
+ on_widget_init_proc *onWidgetInitProc =
+ reinterpret_cast<on_widget_init_proc *>(
+ dlsym(dlHandle, PLUGIN_WIDGET_INIT_PROC_NAME));
+
+ if (NULL == onWidgetInitProc) {
+ dlclose(dlHandle);
+ LogError("Failed to read onWidgetInit symbol" << filename);
+ ThrowMsg(Exceptions::PluginLibraryError, "Library error");
+ }
+
+ // obtain feature -> dev-cap mapping
+ feature_mapping_interface_t mappingInterface = { NULL, NULL, NULL };
+ (*onWidgetInitProc)(&mappingInterface);
+
+ if (!mappingInterface.featGetter || !mappingInterface.release ||
+ !mappingInterface.dcGetter)
+ {
+ LogError("Failed to obtain mapping interface from .so");
+ ThrowMsg(Exceptions::PluginLibraryError, "Library error");
+ }
+
+ feature_mapping_t* devcapMapping = mappingInterface.featGetter();
+
+ LogDebug("Getting mapping from features to device capabilities");
+
+ for (size_t i = 0; i < devcapMapping->featuresCount; ++i) {
+ PluginMetafileData::Feature feature;
+ feature.m_name = devcapMapping->features[i].feature_name;
+
+ LogDebug("Feature: " << feature.m_name);
+
+ const devcaps_t* dc =
+ mappingInterface.dcGetter(
+ devcapMapping,
+ devcapMapping->features[i].
+ feature_name);
+
+ LogDebug("device=cap: " << dc);
+
+ if (dc) {
+ LogDebug("devcaps count: " << dc->devCapsCount);
+
+ for (size_t j = 0; j < dc->devCapsCount; ++j) {
+ LogDebug("devcap: " << dc->deviceCaps[j]);
+ feature.m_deviceCapabilities.insert(dc->deviceCaps[j]);
+ }
+ }
+
+ m_pluginInfo.m_featureContainer.insert(feature);
+ }
+
+ mappingInterface.release(devcapMapping);
+ }
+