{
assert(min <= max);
- int input;
+ int input = 0;
std::cin >> input;
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
- if (!std::cin.fail() && min <= input && input <= max) return input;
+ if (!std::cin.fail() && min <= input && input <= max)
+ {
+ return input;
+ }
std::cin.clear();
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
const auto width = (items.size() + 1) / 10 + 1;
- for(size_t i = 0; i < items.size(); ++i)
+ for (size_t i = 0; i < items.size(); ++i)
{
displayItem(width, i + 1, items[i]);
}
{
int selected = processUserInput(1, items.size() + 1) - 1;
- if(selected == static_cast<int>(items.size())) throw CloseApp();
+ if (selected == static_cast<int>(items.size()))
+ {
+ throw CloseApp();
+ }
onSelected(items[selected]);
}
std::cout << "\tattributes is empty" << std::endl;
}
- for(const auto& attr : attributes)
+ for (const auto& attr : attributes)
{
printAttribute(attr.key(), attr.value());
}
}
std::cout << "\t" << name << " : " << std::endl;
- for(const auto& item : elements)
+ for (const auto& item : elements)
{
std::cout << item << " ";
}
void printUri(const std::string& uri)
{
- if(uri.empty())
+ if (uri.empty())
{
std::cout << "\turi is empty" << std::endl;
}
const auto& children = rep.getChildren();
- if(children.empty())
+ if (children.empty())
{
std::cout << "\tchildren is empty" << std::endl;
}
else
{
int cnt = 0;
- for(const auto& child : children)
+ for (const auto& child : children)
{
std::cout << "========================================================" << std::endl;
std::cout << ++cnt << " chlid" << std::endl;
{
std::cout << "onResourceStateChanged callback" << std::endl;
- switch(resourceState)
+ switch (resourceState)
{
case ResourceState::NONE:
std::cout << "\tState changed to : NOT_MONITORING" << std::endl;
}
}
-void onCacheUpdated(const RCSResourceAttributes& attributes)
+void onCacheUpdated(const RCSResourceAttributes& attributes, int eCode)
{
- std::cout << "onCacheUpdated callback" << std::endl;
+ std::cout << "onCacheUpdated callback : " << eCode << std::endl;
printAttributes(attributes);
}
void stopCaching()
{
- if(!g_selectedResource->isCaching())
+ if (!g_selectedResource->isCaching())
{
std::cout << "\tCaching not started..." << std::endl;
return;
switch (processUserInput(RESOURCE_TEMP, RESOURCE_LIGHT))
{
- case RESOURCE_TEMP:
- g_attrKey = "Temperature";
- return RESOURCE_TYPE_TEMP;
- case RESOURCE_LIGHT:
- g_attrKey = "Brightness";
- return RESOURCE_TYPE_LIGHT;
+ case RESOURCE_TEMP:
+ {
+ g_attrKey = "Temperature";
+ return RESOURCE_TYPE_TEMP;
+ }
+ case RESOURCE_LIGHT:
+ {
+ g_attrKey = "Brightness";
+ return RESOURCE_TYPE_LIGHT;
+ }
}
throw std::logic_error("unreachable");
std::string address;
- if(std::cin.peek() != '\n') std::cin >> address;
+ if (std::cin.peek() != '\n')
+ {
+ std::cin >> address;
+ }
return address.empty() ? RCSAddress::multicast() : RCSAddress::unicast(address);
}
auto discoveryTask = RCSDiscoveryManager::getInstance()->discoverResourceByType(address,
resourceType, onResourceDiscovered);
- while(processUserInput() != 1);
+ while (processUserInput() != 1);
discoveryTask->cancel();
}
handleItems(discoveryMenuItems);
- if (g_discoveredResources.empty()) throw std::runtime_error("No resource found!");
+ if (g_discoveredResources.empty())
+ {
+ throw std::runtime_error("No resource found!");
+ }
g_currentRun = runResourceSelection;
}