{
namespace OCPlatform
{
- void Configure(const PlatformConfig& config)
+ OCStackResult Configure(const PlatformConfig& config)
{
- OCPlatform_impl::Configure(config);
+ return OCPlatform_impl::Configure(config);
+ }
+
+ OCStackResult start()
+ {
+ return OCPlatform_impl::Instance().start();
+ }
+
+ OCStackResult stop()
+ {
+ return OCPlatform_impl::Instance().stop();
}
OCStackResult setDefaultDeviceEntityHandler(EntityHandler entityHandler)
}
OCStackResult notifyAllObservers(OCResourceHandle resourceHandle,
- QualityOfService QoS)
+ QualityOfService QoS)
{
return OCPlatform_impl::Instance().notifyAllObservers(resourceHandle, QoS);
}
}
OCStackResult notifyListOfObservers(OCResourceHandle resourceHandle,
- ObservationIds& observationIds,
- const std::shared_ptr<OCResourceResponse> pResponse)
+ ObservationIds& observationIds,
+ const std::shared_ptr<OCResourceResponse> pResponse)
{
return OCPlatform_impl::Instance().notifyListOfObservers(resourceHandle,
- observationIds, pResponse);
+ observationIds, pResponse);
}
OCStackResult notifyListOfObservers(OCResourceHandle resourceHandle,
- ObservationIds& observationIds,
- const std::shared_ptr<OCResourceResponse> pResponse,
- QualityOfService QoS)
+ ObservationIds& observationIds,
+ const std::shared_ptr<OCResourceResponse> pResponse,
+ QualityOfService QoS)
{
return OCPlatform_impl::Instance().notifyListOfObservers(resourceHandle,
- observationIds, pResponse, QoS);
+ observationIds, pResponse, QoS);
}
-#ifdef CA_INT
OCResource::Ptr constructResourceObject(const std::string& host,
- const std::string& uri, uint8_t connectivityType,
- bool isObservable,
- const std::vector<std::string>& resourceTypes,
- const std::vector<std::string>& interfaces)
+ const std::string& uri,
+ OCConnectivityType connectivityType,
+ bool isObservable,
+ const std::vector<std::string>& resourceTypes,
+ const std::vector<std::string>& interfaces)
{
- return OCPlatform_impl::Instance().constructResourceObject(host, uri, connectivityType,
- isObservable,
- resourceTypes, interfaces);
+ return OCPlatform_impl::Instance().constructResourceObject(host,
+ uri, connectivityType,
+ isObservable,
+ resourceTypes, interfaces);
}
OCStackResult findResource(const std::string& host,
- const std::string& resourceName,
- uint8_t connectivityType,
- FindCallback resourceHandler)
+ const std::string& resourceName,
+ OCConnectivityType connectivityType,
+ FindCallback resourceHandler)
{
return OCPlatform_impl::Instance().findResource(host, resourceName,
- connectivityType, resourceHandler);
+ connectivityType, resourceHandler);
}
OCStackResult findResource(const std::string& host,
- const std::string& resourceName,
- uint8_t connectivityType,
- FindCallback resourceHandler, QualityOfService QoS)
+ const std::string& resourceName,
+ OCConnectivityType connectivityType,
+ FindCallback resourceHandler,
+ QualityOfService QoS)
{
- return OCPlatform_impl::Instance().findResource(host, resourceName, connectivityType,
- resourceHandler, QoS);
+ return OCPlatform_impl::Instance().findResource(host, resourceName,
+ connectivityType, resourceHandler, QoS);
}
- OCStackResult getDeviceInfo(const std::string& host,
- const std::string& deviceURI,
- uint8_t connectivityType,
- FindDeviceCallback deviceInfoHandler)
+ OCStackResult findResource(const std::string& host,
+ const std::string& resourceName,
+ OCConnectivityType connectivityType,
+ FindCallback resourceHandler,
+ FindErrorCallback errorHandler)
{
- return OCPlatform_impl::Instance().getDeviceInfo(host, deviceURI,
- connectivityType, deviceInfoHandler);
+ return OCPlatform_impl::Instance().findResource(host, resourceName,
+ connectivityType, resourceHandler, errorHandler);
}
- OCStackResult getDeviceInfo(const std::string& host,
- const std::string& deviceURI,
- uint8_t connectivityType,
- FindDeviceCallback deviceInfoHandler,
- QualityOfService QoS)
+ OCStackResult findResource(const std::string& host,
+ const std::string& resourceName,
+ OCConnectivityType connectivityType,
+ FindCallback resourceHandler,
+ FindErrorCallback errorHandler,
+ QualityOfService QoS)
{
- return OCPlatform_impl::Instance().getDeviceInfo(host, deviceURI, connectivityType,
- deviceInfoHandler, QoS);
+ return OCPlatform_impl::Instance().findResource(host, resourceName,
+ connectivityType, resourceHandler, errorHandler, QoS);
}
-#else
- OCStackResult getDeviceInfo(const std::string& host,
- const std::string& deviceURI,
- FindDeviceCallback deviceInfoHandler)
+
+ OCStackResult findResourceList(const std::string& host, const std::string& resourceURI,
+ OCConnectivityType connectivityType, FindResListCallback resourceHandler,
+ QualityOfService QoS)
{
- return OCPlatform_impl::Instance().getDeviceInfo(host, deviceURI, deviceInfoHandler);
+ return OCPlatform_impl::Instance().findResourceList(host, resourceURI,
+ connectivityType, resourceHandler, QoS);
+ }
+
+ OCStackResult findResourceList(const std::string& host, const std::string& resourceURI,
+ OCConnectivityType connectivityType, FindResListCallback resourceHandler,
+ FindErrorCallback errorHandler, QualityOfService QoS)
+ {
+ return OCPlatform_impl::Instance().findResourceList(host, resourceURI,
+ connectivityType, resourceHandler, errorHandler, QoS);
}
OCStackResult getDeviceInfo(const std::string& host,
- const std::string& deviceURI,
- FindDeviceCallback deviceInfoHandler,
- QualityOfService QoS)
+ const std::string& deviceURI,
+ OCConnectivityType connectivityType,
+ FindDeviceCallback deviceInfoHandler)
{
return OCPlatform_impl::Instance().getDeviceInfo(host, deviceURI,
- deviceInfoHandler, QoS);
+ connectivityType, deviceInfoHandler);
}
-#endif
- OCStackResult findResource(const std::string& host,
- const std::string& resourceName,
- FindCallback resourceHandler)
+ OCStackResult getDeviceInfo(const std::string& host,
+ const std::string& deviceURI,
+ OCConnectivityType connectivityType,
+ FindDeviceCallback deviceInfoHandler,
+ QualityOfService QoS)
{
-//TODO-CA Revisit this API
-#ifdef CA_INT
- return OCPlatform_impl::Instance().findResource(host, resourceName,
- OC_WIFI | OC_ETHERNET, resourceHandler);
-#else
- return OCPlatform_impl::Instance().findResource(host, resourceName, resourceHandler);
-#endif
+ return OCPlatform_impl::Instance().getDeviceInfo(host, deviceURI, connectivityType,
+ deviceInfoHandler, QoS);
}
- OCStackResult findResource(const std::string& host,
- const std::string& resourceName,
- FindCallback resourceHandler, QualityOfService QoS)
+ OCStackResult getPlatformInfo(const std::string& host,
+ const std::string& platformURI,
+ OCConnectivityType connectivityType,
+ FindPlatformCallback platformInfoHandler)
{
-//TODO-CA Revisit this API
-#ifdef CA_INT
- return OCPlatform_impl::Instance().findResource(host, resourceName,
- OC_WIFI | OC_ETHERNET, resourceHandler, QoS);
-#else
- return OCPlatform_impl::Instance().findResource(host, resourceName,
- resourceHandler, QoS);
-#endif
+ return OCPlatform_impl::Instance().getPlatformInfo(host, platformURI,
+ connectivityType, platformInfoHandler);
}
- OCResource::Ptr constructResourceObject(const std::string& host,
- const std::string& uri,
- bool isObservable,
- const std::vector<std::string>& resourceTypes,
- const std::vector<std::string>& interfaces)
- {
-//TODO-CA Revisit this API
-#ifdef CA_INT
- return OCPlatform_impl::Instance().constructResourceObject(host, uri, isObservable,
- OC_WIFI | OC_ETHERNET, resourceTypes, interfaces);
-#else
- return OCPlatform_impl::Instance().constructResourceObject(host, uri, isObservable,
- resourceTypes, interfaces);
-#endif
+ OCStackResult getPlatformInfo(const std::string& host,
+ const std::string& platformURI,
+ OCConnectivityType connectivityType,
+ FindPlatformCallback platformInfoHandler,
+ QualityOfService QoS)
+ {
+ return OCPlatform_impl::Instance().getPlatformInfo(host, platformURI, connectivityType,
+ platformInfoHandler, QoS);
}
-
OCStackResult registerResource(OCResourceHandle& resourceHandle,
- std::string& resourceURI,
- const std::string& resourceTypeName,
- const std::string& resourceInterface,
- EntityHandler entityHandler,
- uint8_t resourceProperty)
+ std::string& resourceURI,
+ const std::string& resourceTypeName,
+ const std::string& resourceInterface,
+ EntityHandler entityHandler,
+ uint8_t resourceProperty)
{
return OCPlatform_impl::Instance().registerResource(resourceHandle, resourceURI,
- resourceTypeName, resourceInterface,
- entityHandler, resourceProperty);
+ resourceTypeName, resourceInterface,
+ entityHandler, resourceProperty);
}
OCStackResult registerResource(OCResourceHandle& resourceHandle,
- const std::shared_ptr< OCResource > resource)
+ const std::shared_ptr< OCResource > resource)
{
return OCPlatform_impl::Instance().registerResource(resourceHandle, resource);
}
return OCPlatform_impl::Instance().registerDeviceInfo(deviceInfo);
}
+ OCStackResult registerPlatformInfo(const OCPlatformInfo platformInfo)
+ {
+ return OCPlatform_impl::Instance().registerPlatformInfo(platformInfo);
+ }
+
+ OCStackResult setPropertyValue(OCPayloadType type, const std::string& tag, const std::string& value)
+ {
+ return OCPlatform_impl::Instance().setPropertyValue(type, tag, value);
+ }
+
+ OCStackResult setPropertyValue(OCPayloadType type, const std::string& tag, const std::vector<std::string>& value)
+ {
+ return OCPlatform_impl::Instance().setPropertyValue(type, tag, value);
+ }
+
+ OCStackResult getPropertyValue(OCPayloadType type, const std::string& tag, std::string& value)
+ {
+ return OCPlatform_impl::Instance().getPropertyValue(type, tag, value);
+ }
+
OCStackResult unregisterResource(const OCResourceHandle& resourceHandle)
{
return OCPlatform_impl::Instance().unregisterResource(resourceHandle);
}
OCStackResult unbindResource(OCResourceHandle collectionHandle,
- OCResourceHandle resourceHandle)
+ OCResourceHandle resourceHandle)
{
return OCPlatform_impl::Instance().unbindResource(collectionHandle, resourceHandle);
}
OCStackResult unbindResources(const OCResourceHandle collectionHandle,
- const std::vector<OCResourceHandle>& resourceHandles
- )
+ const std::vector<OCResourceHandle>& resourceHandles)
{
return OCPlatform_impl::Instance().unbindResources(collectionHandle, resourceHandles);
}
OCStackResult bindResource(const OCResourceHandle collectionHandle,
- const OCResourceHandle resourceHandle)
+ const OCResourceHandle resourceHandle)
{
return OCPlatform_impl::Instance().bindResource(collectionHandle, resourceHandle);
}
OCStackResult bindResources(const OCResourceHandle collectionHandle,
- const std::vector<OCResourceHandle>& resourceHandles
- )
+ const std::vector<OCResourceHandle>& resourceHandles
+ )
{
return OCPlatform_impl::Instance().bindResources(collectionHandle, resourceHandles);
}
OCStackResult bindTypeToResource(const OCResourceHandle& resourceHandle,
- const std::string& resourceTypeName)
+ const std::string& resourceTypeName)
{
return OCPlatform_impl::Instance().bindTypeToResource(resourceHandle,resourceTypeName);
}
OCStackResult bindInterfaceToResource(const OCResourceHandle& resourceHandle,
- const std::string& resourceInterfaceName)
+ const std::string& resourceInterfaceName)
{
return OCPlatform_impl::Instance().bindInterfaceToResource(resourceHandle,
- resourceInterfaceName);
+ resourceInterfaceName);
}
OCStackResult startPresence(const unsigned int announceDurationSeconds)
return OCPlatform_impl::Instance().stopPresence();
}
-#ifdef CA_INT
OCStackResult subscribePresence(OCPresenceHandle& presenceHandle,
- const std::string& host,
- uint8_t connectivityType,
- SubscribeCallback presenceHandler)
+ const std::string& host,
+ OCConnectivityType connectivityType,
+ SubscribeCallback presenceHandler)
{
return OCPlatform_impl::Instance().subscribePresence(presenceHandle, host,
- connectivityType, presenceHandler);
+ connectivityType, presenceHandler);
}
OCStackResult subscribePresence(OCPresenceHandle& presenceHandle,
- const std::string& host,
- const std::string& resourceType,
- uint8_t connectivityType,
- SubscribeCallback presenceHandler)
+ const std::string& host,
+ const std::string& resourceType,
+ OCConnectivityType connectivityType,
+ SubscribeCallback presenceHandler)
{
return OCPlatform_impl::Instance().subscribePresence(presenceHandle, host,
- resourceType, connectivityType, presenceHandler);
+ resourceType, connectivityType, presenceHandler);
}
-#endif
- OCStackResult subscribePresence(OCPresenceHandle& presenceHandle,
- const std::string& host,
- SubscribeCallback presenceHandler)
+
+ OCStackResult unsubscribePresence(OCPresenceHandle presenceHandle)
{
-//TODO-CA Revisit this API
-#ifdef CA_INT
- return OCPlatform_impl::Instance().subscribePresence(presenceHandle, host,
- OC_WIFI | OC_ETHERNET, presenceHandler);
-#else
- return OCPlatform_impl::Instance().subscribePresence(presenceHandle, host,
- presenceHandler);
-#endif
+ return OCPlatform_impl::Instance().unsubscribePresence(presenceHandle);
}
- OCStackResult subscribePresence(OCPresenceHandle& presenceHandle,
- const std::string& host,
- const std::string& resourceType,
- SubscribeCallback presenceHandler)
+#ifdef WITH_CLOUD
+ OCStackResult subscribeDevicePresence(OCPresenceHandle& presenceHandle,
+ const std::string& host,
+ const std::vector<std::string>& di,
+ OCConnectivityType connectivityType,
+ ObserveCallback callback)
{
-//TODO-CA Revisit this API
-#ifdef CA_INT
- return OCPlatform_impl::Instance().subscribePresence(presenceHandle, host,
- resourceType, OC_WIFI | OC_ETHERNET,
- presenceHandler);
-#else
- return OCPlatform_impl::Instance().subscribePresence(presenceHandle, host,
- resourceType, presenceHandler);
+ return OCPlatform_impl::Instance().subscribeDevicePresence(presenceHandle,
+ host,
+ di,
+ connectivityType,
+ callback);
+ }
#endif
+
+ OCStackResult sendResponse(const std::shared_ptr<OCResourceResponse> pResponse)
+ {
+ return OCPlatform_impl::Instance().sendResponse(pResponse);
}
- OCStackResult unsubscribePresence(OCPresenceHandle presenceHandle)
+ OCStackResult findDirectPairingDevices(unsigned short waittime,
+ GetDirectPairedCallback directPairingHandler)
{
- return OCPlatform_impl::Instance().unsubscribePresence(presenceHandle);
+ return OCPlatform_impl::Instance().findDirectPairingDevices(waittime,
+ directPairingHandler);
}
- OCStackResult sendResponse(const std::shared_ptr<OCResourceResponse> pResponse)
+ OCStackResult getDirectPairedDevices(GetDirectPairedCallback directPairingHandler)
{
- return OCPlatform_impl::Instance().sendResponse(pResponse);
+ return OCPlatform_impl::Instance().getDirectPairedDevices(directPairingHandler);
+ }
+
+ OCStackResult doDirectPairing(std::shared_ptr<OCDirectPairing> peer, OCPrm_t pmSel,
+ const std::string& pinNumber,
+ DirectPairingCallback resultCallback)
+ {
+ return OCPlatform_impl::Instance().doDirectPairing(peer, pmSel,
+ pinNumber, resultCallback);
+ }
+#ifdef WITH_CLOUD
+ OCAccountManager::Ptr constructAccountManagerObject(const std::string& host,
+ OCConnectivityType connectivityType)
+ {
+ return OCPlatform_impl::Instance().constructAccountManagerObject(host,
+ connectivityType);
+ }
+#endif // WITH_CLOUD
+#ifdef TCP_ADAPTER
+ OCStackResult findKeepAliveResource(std::string host, KeepAliveCallback resultCallback)
+ {
+ return OCPlatform_impl::Instance().findKeepAliveResource(host, resultCallback);
+ }
+
+ OCStackResult sendKeepAliveRequest(std::string host, const OCRepresentation& rep,
+ KeepAliveCallback pingHandler)
+ {
+ return OCPlatform_impl::Instance().sendKeepAliveRequest(host, rep, pingHandler);
+ }
+#endif
+
+ OCStackResult getDeviceId(OCUUIdentity *deviceId)
+ {
+ return OCPlatform_impl::Instance().getDeviceId(deviceId);
+ }
+
+ OCStackResult setDeviceId(const OCUUIdentity *deviceId)
+ {
+ return OCPlatform_impl::Instance().setDeviceId(deviceId);
}
} // namespace OCPlatform
} //namespace OC