projects
/
platform
/
upstream
/
iotivity.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Upstream version 0.9.1
[platform/upstream/iotivity.git]
/
resource
/
examples
/
groupserver.cpp
diff --git
a/resource/examples/groupserver.cpp
b/resource/examples/groupserver.cpp
old mode 100755
(executable)
new mode 100644
(file)
index
4cebd44
..
c4b069d
--- a/
resource/examples/groupserver.cpp
+++ b/
resource/examples/groupserver.cpp
@@
-67,20
+67,19
@@
void foundResource(std::shared_ptr< OCResource > resource)
cout << "\tresource Error!" << endl;
}
}
cout << "\tresource Error!" << endl;
}
}
-
- // p_platform.bindResource(resourceHandle, foundResourceHandle);
-
}
}
catch (std::exception& e)
{
}
}
catch (std::exception& e)
{
- std::cout << "
"
<< std::endl;
+ std::cout << "
Exception in foundResource:"<< e.what()
<< std::endl;
}
}
}
}
-int main()
+int main(
int argc, char* argv[]
)
{
{
+ ostringstream requestURI;
+
PlatformConfig config
{ OC::ServiceType::InProc, ModeType::Both, "0.0.0.0", 0, OC::QualityOfService::LowQos };
PlatformConfig config
{ OC::ServiceType::InProc, ModeType::Both, "0.0.0.0", 0, OC::QualityOfService::LowQos };
@@
-101,29
+100,44
@@
int main()
cout << "registerResource is called." << endl;
cout << "registerResource is called." << endl;
- OCPlatform::findResource("", "coap://224.0.1.187/oc/core?rt=core.light", &foundResource);
+ requestURI << OC_MULTICAST_DISCOVERY_URI << "?rt=core.light";
+
+ OCPlatform::findResource("", requestURI.str(),
+ OC_ALL, &foundResource);
+
OCPlatform::bindInterfaceToResource(resourceHandle, GROUP_INTERFACE);
OCPlatform::bindInterfaceToResource(resourceHandle, DEFAULT_INTERFACE);
int selectedMenu;
OCPlatform::bindInterfaceToResource(resourceHandle, GROUP_INTERFACE);
OCPlatform::bindInterfaceToResource(resourceHandle, DEFAULT_INTERFACE);
int selectedMenu;
- while (true)
+ bool isRun = true;
+ while (isRun)
{
{
+ cout << endl << "0 :: Quit 1 :: UNREGISTER RESOURCES\n" << endl;
std::cin >> selectedMenu;
std::cin >> selectedMenu;
-
if (selectedMenu == 1
)
+
switch(selectedMenu
)
{
{
+ case 0:
+ isRun = false;
+ break;
+ case 1:
+ std::cout << "Unregistering resources" << std::endl;
for (unsigned int i = 0; i < resourceHandleVector.size(); ++i)
{
OCPlatform::unregisterResource(resourceHandleVector.at(i));
}
for (unsigned int i = 0; i < resourceHandleVector.size(); ++i)
{
OCPlatform::unregisterResource(resourceHandleVector.at(i));
}
+ break;
+ default:
+ cout << "Invalid option" << endl;
}
}
}
catch (OCException& e)
{
}
}
}
catch (OCException& e)
{
-
+ oclog() << "Exception in main: "<< e.what();
}
return 0;
}
}
return 0;
}
+