if (m_observeState)
{
OC_LOG(ERROR, TAG, "Resource is already being observed!");
+ SIM_LOG(ILogger::ERROR, "[URI: " << getURI() << "] Resource is already being observed!")
+
throw SimulatorException(SIMULATOR_ERROR, "Resource is already being observed!");
}
[](const OC::HeaderOptions & headerOptions, const OC::OCRepresentation & ocRep,
const int errorCode, const int sqNum, std::string id, ObserveNotificationCallback callback)
{
- SIM_LOG(ILogger::INFO, "Observe response received..." << "\n" << getPayloadString(ocRep));
+ SIM_LOG(ILogger::INFO, "Response received for OBSERVE request."
+ << "\n" << getPayloadString(ocRep))
SimulatorResourceModel resourceModel = SimulatorResourceModel::build(ocRep);
callback(id, static_cast<SimulatorResult>(errorCode), resourceModel, sqNum);
if (OC_STACK_OK != ocResult)
throw SimulatorException(static_cast<SimulatorResult>(ocResult), OC::OCException::reason(ocResult));
- SIM_LOG(ILogger::INFO, "OBSERVE request sent");
+ SIM_LOG(ILogger::INFO, "[URI: " << getURI() << "] Sent OBSERVE request.")
}
catch (OC::OCException &e)
{
if (OC_STACK_OK != ocResult)
{
OC_LOG(ERROR, TAG, "Cancelling observe failed!");
+ SIM_LOG(ILogger::INFO, "[URI: " << getURI() << "] Sending OBSERVE cancel request failed!")
+
throw SimulatorException(static_cast<SimulatorResult>(ocResult),
OC::OCException::reason(ocResult));
}
- SIM_LOG(ILogger::INFO, "OBSERVE CANCEL request sent");
+ SIM_LOG(ILogger::INFO, "[URI: " << getURI() << "] Sent OBSERVE cancel request.")
}
catch (OC::OCException &e)
{
if (SIMULATOR_OK != result)
{
OC_LOG(ERROR, TAG, "Failed to send GET request!");
+ SIM_LOG(ILogger::ERROR, "[URI: " << getURI() << "] Failed to send GET request!")
+
throw SimulatorException(result, "Failed to send GET request!");
}
}
if (SIMULATOR_OK != result)
{
OC_LOG(ERROR, TAG, "Failed to send GET request!");
+ SIM_LOG(ILogger::ERROR, "[URI: " << getURI() << "] Failed to send GET request!")
+
throw SimulatorException(result, "Failed to send GET request!");
}
}
if (SIMULATOR_OK != result)
{
OC_LOG(ERROR, TAG, "Failed to send GET request!");
+ SIM_LOG(ILogger::ERROR, "[URI: " << getURI() << "] Failed to send GET request!")
+
throw SimulatorException(result, "Failed to send GET request!");
}
}
if (SIMULATOR_OK != result)
{
OC_LOG(ERROR, TAG, "Failed to send PUT request!");
+ SIM_LOG(ILogger::ERROR, "[URI: " << getURI() << "] Failed to send PUT request!")
+
throw SimulatorException(result, "Failed to send PUT request!");
}
}
if (SIMULATOR_OK != result)
{
OC_LOG(ERROR, TAG, "Failed to send PUT request!");
+ SIM_LOG(ILogger::ERROR, "[URI: " << getURI() << "] Failed to send PUT request!")
+
throw SimulatorException(result, "Failed to send PUT request!");
}
}
if (SIMULATOR_OK != result)
{
OC_LOG(ERROR, TAG, "Failed to send PUT request!");
+ SIM_LOG(ILogger::ERROR, "[URI: " << getURI() << "] Failed to send PUT request!")
+
throw SimulatorException(result, "Failed to send PUT request!");
}
}
if (SIMULATOR_OK != result)
{
OC_LOG(ERROR, TAG, "Failed to send POST request!");
+ SIM_LOG(ILogger::ERROR, "[URI: " << getURI() << "] Failed to send POST request!")
+
throw SimulatorException(result, "Failed to send POST request!");
}
}
if (SIMULATOR_OK != result)
{
OC_LOG(ERROR, TAG, "Failed to send POST request!");
+ SIM_LOG(ILogger::ERROR, "[URI: " << getURI() << "] Failed to send POST request!")
+
throw SimulatorException(result, "Failed to send POST request!");
}
}
if (SIMULATOR_OK != result)
{
OC_LOG(ERROR, TAG, "Failed to send POST request!");
+ SIM_LOG(ILogger::ERROR, "[URI: " << getURI() << "] Failed to send POST request!")
+
throw SimulatorException(result, "Failed to send POST request!");
}
}