Core Base Classes for the Light Endpoints
Dependents: mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_ethernet ... more
Diff: MBEDToIOCResourceMap.cpp
- Revision:
- 21:cfdaee0a2b50
- Parent:
- 20:f2dbbd852e08
- Child:
- 25:2a001b4f7024
--- a/MBEDToIOCResourceMap.cpp Wed Feb 26 18:59:01 2014 +0000 +++ b/MBEDToIOCResourceMap.cpp Wed Feb 26 21:29:18 2014 +0000 @@ -39,8 +39,12 @@ bool found = false; char *mbed_name = NULL; + // convert if we have a nickname + char *actual_ioc_name = this->convertFromNickName(ioc_name); + + // lookup the IOC name and map it to an MBED (NSP) name for(int i=0;i<NUM_MAPPINGS && !found && this->m_map[i] != NULL;++i) { - if (strcmp(this->m_map[i]->iocName(),ioc_name) == 0) { + if (strcmp(this->m_map[i]->iocName(),actual_ioc_name) == 0) { found = true; mbed_name = this->m_map[i]->mbedName(); } @@ -48,6 +52,21 @@ return mbed_name; } + // convert from an IOC nickname to the actual IOC property name + char *MBEDToIOCResourceMap::convertFromNickName(char *ioc_name) { + char *actual_name = ioc_name; + bool found = false; + + for(int i=0;i<NUM_MAPPINGS && !found && this->m_map[i] != NULL;++i) { + if (strcmp(this->m_map[i]->iocNickName(),ioc_name) == 0) { + found = true; + actual_name = this->m_map[i]->iocName(); + } + } + + return actual_name; + } + // create our map - this MUST match the Resource Mapping found in the gateway mapping database void MBEDToIOCResourceMap::createMap() { int i = 0;