const int SUCCESS_RESPONSE = 0;
std::shared_ptr<OCResource> curResource;
+std::mutex resourceLock;
int observe_count()
{
// Callback to found resources
void foundResource(std::shared_ptr<OCResource> resource)
{
+ std::lock_guard<std::mutex> lock(resourceLock);
if(curResource)
{
std::cout << "Found another resource, ignoring"<<std::endl;
int main(int argc, char* argv[]) {
- ostringstream requestURI;
+ std::ostringstream requestURI;
OCConnectivityType connectivityType = OC_WIFI;
if(argc == 2)
try
{
std::size_t inputValLen;
- int optionSelected = stoi(argv[1], &inputValLen);
+ int optionSelected = std::stoi(argv[1], &inputValLen);
if(inputValLen == strlen(argv[1]))
{
std::cout << "Invalid connectivity type selected. Using default WIFI" << std::endl;
}
}
- catch(exception& e)
+ catch(std::exception& e)
{
std::cout << "Invalid input argument. Using WIFI as connectivity type" << std::endl;
}
}catch(OCException& e)
{
- //log(e.what());
+ oclog() << "Exception in main: "<< e.what();
}
return 0;
}
+