const std::string gResourceTypeName = "core.res";
const std::string gResourceInterface = DEFAULT_INTERFACE;
const uint8_t gResourceProperty = OC_DISCOVERABLE | OC_OBSERVABLE;
- OCResourceHandle resourceHandle;
+ OCResourceHandle gResourceHandle;
//OCPersistent Storage Handlers
static FILE* client_open(const char *path, const char *mode)
OCResourceHandle RegisterResource(std::string uri, std::string type, std::string iface)
{
EXPECT_EQ(OC_STACK_OK, OCPlatform::registerResource(
- resourceHandle, uri, type,
+ gResourceHandle, uri, type,
iface, entityHandler, gResourceProperty));
- return resourceHandle;
+ return gResourceHandle;
}
OCResourceHandle RegisterResource(std::string uri, std::string type)
{
EXPECT_EQ(OC_STACK_OK, OCPlatform::registerResource(
- resourceHandle, uri, type,
+ gResourceHandle, uri, type,
gResourceInterface, entityHandler, gResourceProperty));
- return resourceHandle;
+ return gResourceHandle;
}
OCResourceHandle RegisterResource(std::string uri)
{
EXPECT_EQ(OC_STACK_OK, OCPlatform::registerResource(
- resourceHandle, uri, gResourceTypeName,
+ gResourceHandle, uri, gResourceTypeName,
gResourceInterface, entityHandler, gResourceProperty));
- return resourceHandle;
+ return gResourceHandle;
}
OCResourceHandle RegisterResource(std::string uri, OCTpsSchemeFlags resourceTpsTypes)
{
EXPECT_EQ(OC_STACK_OK, OCPlatform::registerResource(
- resourceHandle, uri, gResourceTypeName,
+ gResourceHandle, uri, gResourceTypeName,
gResourceInterface, entityHandler, gResourceProperty,
resourceTpsTypes));
- return resourceHandle;
+ return gResourceHandle;
}
TEST(ConfigureTest, ConfigureInvalidModeType)
std::string uri = "/a/light69";
std::string type = "core.light";
- uint8_t gResourceProperty = 0;
+ uint8_t resourceProperty = 0;
EXPECT_NO_THROW(OCPlatform::registerResource(
- resourceHandle, uri, type,
- gResourceInterface, entityHandler, gResourceProperty));
+ gResourceHandle, uri, type,
+ gResourceInterface, entityHandler, resourceProperty));
}
TEST(ConfigureTest, ConfigureClient)
// We should not allow empty URI.
std::string emptyStr = "";
- EXPECT_ANY_THROW(OCPlatform::registerResource(resourceHandle, emptyStr, emptyStr,
+ EXPECT_ANY_THROW(OCPlatform::registerResource(gResourceHandle, emptyStr, emptyStr,
emptyStr, entityHandler, gResourceProperty));
}
std::string uri = "/a/light6";
std::string type = "core.light";
- uint8_t gResourceProperty = 0;
+ uint8_t resourceProperty = 0;
EXPECT_EQ(OC_STACK_OK, OCPlatform::registerResource(
- resourceHandle, uri, type,
- gResourceInterface, entityHandler, gResourceProperty));
+ gResourceHandle, uri, type,
+ gResourceInterface, entityHandler, resourceProperty));
}
TEST(RegisterResourceTest, RegisterWithTpsType)
std::string uri = "/a/light7";
std::string type = "core.light";
- uint8_t gResourceProperty = 0;
+ uint8_t resourceProperty = 0;
EXPECT_EQ(OC_STACK_OK, OCPlatform::registerResource(
- resourceHandle, uri, type,
- gResourceInterface, entityHandler, gResourceProperty , OC_COAP));
+ gResourceHandle, uri, type,
+ gResourceInterface, entityHandler, resourceProperty, OC_COAP));
}
TEST(RegisterResourceTest, RegisterWithTpsTypeAll)
std::string uri = "/a/light8";
std::string type = "core.light";
- uint8_t gResourceProperty = 0;
+ uint8_t resourceProperty = 0;
EXPECT_EQ(OC_STACK_OK, OCPlatform::registerResource(
- resourceHandle, uri, type,
- gResourceInterface, entityHandler, gResourceProperty, OC_ALL));
+ gResourceHandle, uri, type,
+ gResourceInterface, entityHandler, resourceProperty, OC_ALL));
}
#ifdef TCP_ADAPTER
TEST(RegisterResourceTest, RegisterWithTpsTypeBitComb)
std::string uri = "/a/light9";
std::string type = "core.light";
- uint8_t gResourceProperty = 0;
+ uint8_t resourceProperty = 0;
EXPECT_EQ(OC_STACK_OK, OCPlatform::registerResource(
- resourceHandle, uri, type,
- gResourceInterface, entityHandler, gResourceProperty, (OCTpsSchemeFlags)(OC_COAP || OC_COAP_TCP)));
+ gResourceHandle, uri, type,
+ gResourceInterface, entityHandler, resourceProperty, (OCTpsSchemeFlags)(OC_COAP || OC_COAP_TCP)));
}
#endif