string g_accesstoken;
string g_host;
-OC::OCResource::Ptr g_binaryswitchResource;
+OC::OCResource::Ptr g_binaryswitchResource = nullptr;
void printRepresentation(OCRepresentation rep)
{
void turnOnOffSwitch(bool toTurn)
{
+ if (g_binaryswitchResource == nullptr)
+ {
+ cout << "Binary switch not found" << endl;
+ return;
+ }
+
OCRepresentation binarySwitch;
binarySwitch.setValue("value", toTurn);