<< "' " << std::endl;
return fopen(SVR_DB_FILE_NAME, mode);
}
- OCPersistentStorage gps {client_open, fread, fwrite, fclose, unlink };
+ OCPersistentStorage gps {client_open, fread, fwrite, fclose, unlink, NULL, NULL };
// Callbacks
OCEntityHandlerResult entityHandler(std::shared_ptr<OCResourceRequest> /*request*/)
{
}
+#ifdef WITH_CLOUD
+ void onObserve(const HeaderOptions, const OCRepresentation&, const int&, const int&)
+ {
+ }
+#endif
+
void directPairHandler(std::shared_ptr<OCDirectPairing> /*dev*/, OCStackResult /*res*/)
{
}
delete[] deviceInfo.deviceName;
DeleteStringLL(deviceInfo.types);
delete[] deviceInfo.specVersion;
- delete[] deviceInfo.dataModleVersion;
+ DeleteStringLL(deviceInfo.dataModelVersions);
}
void DuplicateString(char ** targetString, std::string sourceString)
OCResourcePayloadAddStringLL(&deviceInfo.types, "oic.wk.d");
OCResourcePayloadAddStringLL(&deviceInfo.types, "oic.d.tv");
DuplicateString(&deviceInfo.specVersion, "mySpecVersion");
- DuplicateString(&deviceInfo.dataModleVersion, "myDataModleVersion");
+ deviceInfo.dataModelVersions = nullptr;
+ OCResourcePayloadAddStringLL(&deviceInfo.dataModelVersions, "myDataModelVersions");
EXPECT_EQ(OC_STACK_OK, OCPlatform::registerDeviceInfo(deviceInfo));
EXPECT_NO_THROW(DeleteDeviceInfo(deviceInfo));
}
EXPECT_EQ(OC_STACK_OK, OCPlatform::unsubscribePresence(presenceHandle));
}
+#ifdef WITH_CLOUD
+ // SubscribeDevicePresence Test
+ TEST(SubscribeDevicePresenceTest, DISABLED_SubscribeDevicePresenceWithValidParameters)
+ {
+ std::string hostAddress = "192.168.1.2:5000";
+ OCPlatform::OCPresenceHandle presenceHandle = nullptr;
+ std::vector<std::string> di;
+
+ EXPECT_EQ(OC_STACK_OK, OCPlatform::subscribeDevicePresence(presenceHandle,
+ hostAddress, di, CT_DEFAULT, &onObserve));
+ }
+
+ TEST(SubscribeDevicePresenceTest, SubscribeDevicePresenceWithNullHost)
+ {
+ OCPlatform::OCPresenceHandle presenceHandle = nullptr;
+ std::vector<std::string> di;
+
+ EXPECT_ANY_THROW(OCPlatform::subscribeDevicePresence(presenceHandle,
+ nullptr, di, CT_DEFAULT, &onObserve));
+ }
+
+ TEST(SubscribeDevicePresenceTest, SubscribeDevicePresenceWithNullOnObserve)
+ {
+ std::string hostAddress = "192.168.1.2:5000";
+ OCPlatform::OCPresenceHandle presenceHandle = nullptr;
+ std::vector<std::string> di;
+
+ EXPECT_ANY_THROW(OCPlatform::subscribeDevicePresence(presenceHandle,
+ hostAddress, di, CT_DEFAULT, NULL));
+ }
+
+ TEST(SubscribeDevicePresenceTest, DISABLED_UnsubscribePresenceWithValidHandle)
+ {
+ std::string hostAddress = "192.168.1.2:5000";
+ OCPlatform::OCPresenceHandle presenceHandle = nullptr;
+ std::vector<std::string> di;
+
+ EXPECT_EQ(OC_STACK_OK, OCPlatform::subscribeDevicePresence(presenceHandle,
+ hostAddress, di, CT_DEFAULT, &onObserve));
+ EXPECT_EQ(OC_STACK_OK, OCPlatform::unsubscribePresence(presenceHandle));
+ }
+#endif
+
TEST(FindDirectPairingTest, FindDirectPairingNullCallback)
{
EXPECT_ANY_THROW(OCPlatform::findDirectPairingDevices(1, nullptr));