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

Method loadIcon

lib/MultiIconPlugin/src/MultiIconPlugin.cpp:309–345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

307}
308
309bool MultiIconPlugin::loadIcon(uint8_t slotId, FileMgrService::FileId fileId)
310{
311 bool isSuccessful = false;
312
313 if (_MultiIconPlugin::View::MAX_ICON_SLOTS > slotId)
314 {
315 MutexGuard<MutexRecursive> guard(m_mutex);
316 IconSlot& iconSlot = m_slots[slotId];
317 String iconFullPath;
318
319 iconSlot.fileId = fileId;
320 iconSlot.hasSlotChanged = true;
321 m_hasTopicSlotsChanged = true;
322
323 if (FileMgrService::FILE_ID_INVALID == iconSlot.fileId)
324 {
325 m_view.clearIcon(slotId);
326 }
327 else if (false == FileMgrService::getInstance().getFileFullPathById(iconFullPath, iconSlot.fileId))
328 {
329 LOG_WARNING("Unknown file id %u.", iconSlot.fileId);
330 m_view.clearIcon(slotId);
331 }
332 else if (false == m_view.loadIcon(slotId, iconFullPath))
333 {
334 LOG_ERROR("Icon not found: %s", iconFullPath.c_str());
335 }
336 else
337 {
338 ;
339 }
340
341 isSuccessful = true;
342 }
343
344 return isSuccessful;
345}
346
347void MultiIconPlugin::clearIcon(uint8_t slotId)
348{

Callers 1

startMethod · 0.45

Calls 3

getFileFullPathByIdMethod · 0.80
c_strMethod · 0.80
clearIconMethod · 0.45

Tested by

no test coverage detected