plugins: Fix assignment of prefered keys

New keyword in plugin.cfg: key=<key>
* key=red
* key=green
* key=yellow
* key=blue
* key=auto

If entry is missing key is auto-assigned


Origin commit data
------------------
Branch: ni/coolstream
Commit: c0a0cdb221
Author: vanhofen <vanhofen@gmx.de>
Date: 2014-11-07 (Fri, 07 Nov 2014)

Origin message was:
------------------
- plugins: Fix assignment of prefered keys

New keyword in plugin.cfg: key=<key>
* key=red
* key=green
* key=yellow
* key=blue
* key=auto

If entry is missing key is auto-assigned


------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2014-11-07 12:17:29 +01:00
parent 8d64978b13
commit d7e583f7c8
2 changed files with 20 additions and 5 deletions

View File

@@ -199,7 +199,7 @@ bool CPlugins::parseCfg(plugin *plugin_data)
{};
plugin_data->index = sindex++;
plugin_data->key = 0; //CRCInput::RC_nokey
plugin_data->key = CRCInput::RC_nokey;
#if 0
plugin_data->fb = false;
plugin_data->rc = false;
@@ -232,9 +232,9 @@ bool CPlugins::parseCfg(plugin *plugin_data)
{
plugin_data->index = atoi(parm);
}
else if (cmd == "pluginversion")
else if (cmd == "key")
{
plugin_data->key = atoi(parm);
plugin_data->key = getPluginKey(parm);
}
else if (cmd == "name")
{
@@ -571,3 +571,17 @@ CPlugins::i_type_t CPlugins::getPluginIntegration(int integration)
return I_TYPE_DISABLED;
}
}
neutrino_msg_t CPlugins::getPluginKey(std::string key)
{
if (key == "red")
return CRCInput::RC_red;
else if (key == "green")
return CRCInput::RC_green;
else if (key == "yellow")
return CRCInput::RC_yellow;
else if (key == "blue")
return CRCInput::RC_blue;
else /* (key == "auto") */
return CRCInput::RC_nokey;
}