+ OCStackResult OCPlatform_impl::start()
+ {
+ OIC_LOG(INFO, TAG, "start");
+
+ OCStackResult res = OC_STACK_OK;
+ if (OC_CLIENT == m_modeType)
+ {
+ if (OC_STACK_OK != checked_guard(m_client, &IClientWrapper::start))
+ {
+ res = OC_STACK_ERROR;
+ }
+ }
+ else if (OC_SERVER == m_modeType)
+ {
+ if (OC_STACK_OK != checked_guard(m_server, &IServerWrapper::start))
+ {
+ res = OC_STACK_ERROR;
+ }
+ }
+ else if (OC_CLIENT_SERVER == m_modeType || OC_GATEWAY == m_modeType)
+ {
+ if (OC_STACK_OK != checked_guard(m_client, &IClientWrapper::start))
+ {
+ res = OC_STACK_ERROR;
+ }
+
+ if (OC_STACK_OK != checked_guard(m_server, &IServerWrapper::start))
+ {
+ res = OC_STACK_ERROR;
+ }
+ }
+ else
+ {
+ res = OC_STACK_ERROR;
+ }
+
+ return res;
+ }
+
+ OCStackResult OCPlatform_impl::stop()
+ {
+ OIC_LOG(INFO, TAG, "stop");
+
+ OCStackResult res = OC_STACK_OK;
+ if (OC_CLIENT == m_modeType)
+ {
+ if (OC_STACK_OK != checked_guard(m_client, &IClientWrapper::stop))
+ {
+ res = OC_STACK_ERROR;
+ }
+ }
+ else if (OC_SERVER == m_modeType)
+ {
+ if (OC_STACK_OK != checked_guard(m_server, &IServerWrapper::stop))
+ {
+ res = OC_STACK_ERROR;
+ }
+ }
+ else if (OC_CLIENT_SERVER == m_modeType)
+ {
+ if (OC_STACK_OK != checked_guard(m_client, &IClientWrapper::stop))
+ {
+ res = OC_STACK_ERROR;
+ }
+
+ if (OC_STACK_OK != checked_guard(m_server, &IServerWrapper::stop))
+ {
+ res = OC_STACK_ERROR;
+ }
+ }
+ else
+ {
+ res = OC_STACK_ERROR;
+ }
+
+ return res;
+ }
+