MCPcopy Create free account
hub / github.com/BlueAndi/Pixelix / getSlotIdFromTopic

Method getSlotIdFromTopic

lib/MultiIconPlugin/src/MultiIconPlugin.cpp:421–440  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

419}
420
421bool MultiIconPlugin::getSlotIdFromTopic(uint8_t& slotId, const String& topic) const
422{
423 bool isSuccessful = false;
424 int32_t indexBeginSlotId = topic.lastIndexOf("/");
425
426 if (0 <= indexBeginSlotId)
427 {
428 String slotIdStr = topic.substring(indexBeginSlotId + 1);
429 uint8_t slotIdTmp;
430 bool statusSlotId = Util::strToUInt8(slotIdStr, slotIdTmp);
431
432 if (true == statusSlotId)
433 {
434 slotId = slotIdTmp;
435 isSuccessful = true;
436 }
437 }
438
439 return isSuccessful;
440}
441
442/******************************************************************************
443 * External Functions

Callers

nothing calls this directly

Calls 2

lastIndexOfMethod · 0.80
substringMethod · 0.80

Tested by

no test coverage detected