Hello folks,
I encountered a problem with observation of some arbitrary resource -- once I
OC::OCResource::observe() a resource and then cancel the observation via
OC:OCResource::cancelObserve(), I start getting OC_STACK_UNAUTHORIZED_REQ
from various calls.
This issue can be reproduced, for example, with aircondition sample; just apply
this patch:
diff --git a/cloud/samples/client/airconditioner/aircon_controller.cpp
b/cloud/samples/client/airconditioner/aircon_controller.cpp
index 2235b44..e87866c 100644
--- a/cloud/samples/client/airconditioner/aircon_controller.cpp
+++ b/cloud/samples/client/airconditioner/aircon_controller.cpp
@@ -217,6 +217,12 @@ void getCollectionResource(const HeaderOptions &,
QueryParamsMap query;
g_binaryswitchResource->observe(ObserveType::Observe, query,
&onObserve);
+
+ if (g_binaryswitchResource->cancelObserve() != OC_STACK_OK)
+ std::cerr << "Failed to cancel observation of binary switch
resource" << std::endl;
+
+ if (g_binaryswitchResource->observe(ObserveType::Observe, query,
&onObserve) != OC_STACK_OK)
+ std::cerr << "Failed to observe a binary switch resource" <<
std::endl;
}
if (it->getResourceTypes().at(0).compare("x.samsung.firmware") == 0)
With the example modified in attached way, you won't be able to control the
binary switch anymore:
POST response: 46
Thank you very much for any feedback and help!
--
thanks and regards,
Peter Hatina