Commit cf824aea authored by Matteo Quintiliani's avatar Matteo Quintiliani

Added function nmxp_chan_lookupKeyIndex()


git-svn-id: file:///home/quintiliani/svncopy/nmxptool/trunk@126 3cd66e75-5955-46cb-a940-c26e5fc5497d
parent 0374c025
......@@ -72,6 +72,18 @@ int nmxp_chan_match(const char *station_dot_channel, char *pattern);
*/
int nmxp_chan_lookupKey(char* name, NMXP_CHAN_LIST *channelList);
/*! \brief Looks up a channel name in the list using a key
*
* \param key Channel key.
* \param channelList Channel list.
*
* \return Index of channel with key. -1 on error.
*
*/
int nmxp_chan_lookupKeyIndex(uint32_t key, NMXP_CHAN_LIST *channelList);
/*! \brief Looks up a channel name in the list using a key
*
* \param key Channel key.
......
......@@ -121,6 +121,24 @@ int nmxp_chan_lookupKey(char* name, NMXP_CHAN_LIST *channelList)
}
int nmxp_chan_lookupKeyIndex(uint32_t key, NMXP_CHAN_LIST *channelList)
{
int i_chan = 0;
int ret = -1;
i_chan = 0;
while(i_chan < channelList->number && ret == -1)
{
if ( key == channelList->channel[i_chan].key ) {
ret = i_chan;
}
i_chan++;
}
return ret;
}
char *nmxp_chan_lookupName(uint32_t key, NMXP_CHAN_LIST *channelList)
{
int i_chan = 0;
......@@ -143,6 +161,7 @@ char *nmxp_chan_lookupName(uint32_t key, NMXP_CHAN_LIST *channelList)
}
}
NMXP_CHAN_LIST *nmxp_chan_getType(NMXP_CHAN_LIST *channelList, NMXP_DATATYPE dataType) {
NMXP_CHAN_LIST *ret_channelList = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment