* central entrance to the stack.
*/
-#ifndef __OCPLATFORM_IMPL_H
-#define __OCPLATFORM_IMPL_H
+#ifndef OC_PLATFORM_IMPL_H_
+#define OC_PLATFORM_IMPL_H_
#include <map>
#include "OCResourceRequest.h"
#include "OCResourceResponse.h"
#include "OCRepresentation.h"
+#include "OCDirectPairing.h"
+
+#ifdef WITH_CLOUD
+#include "OCAccountManager.h"
+#endif
#include "oc_logger.hpp"
private:
static PlatformConfig& globalConfig();
public:
- static void Configure(const PlatformConfig& config);
+ static OCStackResult Configure(const PlatformConfig& config);
static OCPlatform_impl& Instance();
OCConnectivityType connectivityType, FindCallback resourceHandler,
QualityOfService QoS);
+ OCStackResult findResource(const std::string& host, const std::string& resourceURI,
+ OCConnectivityType connectivityType, FindCallback resourceHandler,
+ FindErrorCallback errorHandler);
+
+ OCStackResult findResource(const std::string& host, const std::string& resourceURI,
+ OCConnectivityType connectivityType, FindCallback resourceHandler,
+ FindErrorCallback errorHandler, QualityOfService QoS);
+
+ OCStackResult findResourceList(const std::string& host, const std::string& resourceURI,
+ OCConnectivityType connectivityType, FindResListCallback resourceHandler,
+ QualityOfService QoS);
+
+ OCStackResult findResourceList(const std::string& host, const std::string& resourceURI,
+ OCConnectivityType connectivityType, FindResListCallback resourceHandler,
+ FindErrorCallback errorHandler, QualityOfService Qos);
+
OCStackResult getDeviceInfo(const std::string& host, const std::string& deviceURI,
OCConnectivityType connectivityType, FindDeviceCallback deviceInfoHandler);
OCConnectivityType connectivityType, FindDeviceCallback deviceInfoHandler,
QualityOfService QoS);
+ OCStackResult getPlatformInfo(const std::string& host, const std::string& platformURI,
+ OCConnectivityType connectivityType, FindPlatformCallback platformInfoHandler);
+
+ OCStackResult getPlatformInfo(const std::string& host, const std::string& platformURI,
+ OCConnectivityType connectivityType, FindPlatformCallback platformInfoHandler,
+ QualityOfService QoS);
+
+ /**
+ * API for Device Discovery
+ *
+ * @param host Host IP Address. If null or empty, Multicast is performed.
+ * @param deviceURI Uri containing address to the virtual device in C Stack
+ * ("/oic/d")
+ * @param deviceInfoHandler device discovery callback
+ * @param QualityOfService the quality of communication
+ * @return Returns ::OC_STACK_OK if success.
+ * @note OCStackResult is defined in ocstack.h.
+ */
+ OCStackResult getDeviceInfo(const std::string& host, const std::string& deviceURI,
+ FindDeviceCallback deviceInfoHandler);
+ OCStackResult getDeviceInfo(const std::string& host, const std::string& deviceURI,
+ FindDeviceCallback deviceInfoHandler, QualityOfService QoS);
+
+ /**
+ * API for Platform Discovery
+ *
+ * @param host Host IP Address. If null or empty, Multicast is performed.
+ * @param platformURI Uri containing address to the virtual platform in C Stack
+ * ("/oic/p")
+ * @param platformInfoHandler platform discovery callback
+ * @param QualityOfService the quality of communication
+ * @return Returns ::OC_STACK_OK if success.
+ * @note OCStackResult is defined in ocstack.h.
+ */
+ OCStackResult getPlatformInfo(const std::string& host, const std::string& platformURI,
+ FindPlatformCallback platformInfoHandler);
+ OCStackResult getPlatformInfo(const std::string& host, const std::string& platformURI,
+ FindPlatformCallback platformInfoHandler, QualityOfService QoS);
+
+ OCStackResult setPropertyValue(OCPayloadType type, const std::string& tag, const std::string& value);
+ OCStackResult setPropertyValue(OCPayloadType type, const std::string& tag, const std::vector<std::string>& value);
+ OCStackResult getPropertyValue(OCPayloadType type, const std::string& tag, std::string& value);
+
/**
* This API registers a resource with the server
- * NOTE: This API applies to server side only.
+ * @note This API applies to server side only.
*
- * @param resourceHandle - Upon successful registration, resourceHandle will be filled
- * @param resourceURI - The URI of the resource. Example: "a/light". See NOTE below
- * @param resourceTypeName - The resource type. Example: "light"
- * @param resourceInterface - The resource interface (whether it is collection etc).
- * @param entityHandler - entity handler callback.
- * @param resourceProperty - indicates the property of the resource. Defined in ocstack.h.
+ * @param resourceHandle Upon successful registration, resourceHandle will be filled
+ * @param resourceURI The URI of the resource. Example: "a/light". See NOTE below
+ * @param resourceTypeName The resource type. Example: "light"
+ * @param resourceInterface The resource interface (whether it is collection etc).
+ * @param entityHandler entity handler callback.
+ * @param resourceProperty indicates the property of the resource. Defined in ocstack.h.
* setting resourceProperty as OC_DISCOVERABLE will allow Discovery of this resource
* setting resourceProperty as OC_OBSERVABLE will allow observation
* settings resourceProperty as OC_DISCOVERABLE | OC_OBSERVABLE will allow both discovery
* and observation
*
- * @return OCStackResult return value of this API. Returns OC_STACK_OK if success.
- * NOTE: "a/light" is a relative URI.
+ * @return Returns ::OC_STACK_OK if success.
+ * @note "a/light" is a relative URI.
* Above relative URI will be prepended (by core) with a host IP + namespace "oc"
* Therefore, fully qualified URI format would be //HostIP-Address/namespace/relativeURI"
* Example, a relative URI: 'a/light' will result in a fully qualified URI:
- * //192.168.1.1/oc/a/light"
+ * //192.168.1.1/oic/a/light"
* First parameter can take a relative URI and core will take care of preparing the fully
* qualified URI OR
* first parameter can take fully qualified URI and core will take that as is for further
* operations
- * NOTE: OCStackResult is defined in ocstack.h.
+ * @note OCStackResult is defined in ocstack.h.
*/
OCStackResult registerResource(OCResourceHandle& resourceHandle,
std::string& resourceURI,
OCStackResult registerResource(OCResourceHandle& resourceHandle,
const std::shared_ptr<OCResource> resource);
+ /**
+ * This API registers all the device specific information
+ *
+ * @param deviceInfo Structure containing all the device related information
+ *
+ * @return Returns ::OC_STACK_OK if success
+ * @note OCDeviceInfo is defined in OCStack.h
+ */
OCStackResult registerDeviceInfo(const OCDeviceInfo deviceInfo);
+ /**
+ * This API registers all the platform specific information
+ *
+ * @param platformInfo Structure containing all the platform related information
+ *
+ * @return Returns ::OC_STACK_OK if success
+ * @note OCPlatformInfo is defined in OCStack.h
+ */
+ OCStackResult registerPlatformInfo(const OCPlatformInfo platformInfo);
+
OCStackResult setDefaultDeviceEntityHandler(EntityHandler entityHandler);
OCStackResult unregisterResource(const OCResourceHandle& resourceHandle) const;
SubscribeCallback presenceHandler);
OCStackResult unsubscribePresence(OCPresenceHandle presenceHandle);
+#ifdef WITH_CLOUD
+ OCStackResult subscribeDevicePresence(OCPresenceHandle& presenceHandle,
+ const std::string& host,
+ const std::vector<std::string>& di,
+ OCConnectivityType connectivityType,
+ ObserveCallback callback);
+#endif
+
OCResource::Ptr constructResourceObject(const std::string& host, const std::string& uri,
OCConnectivityType connectivityType, bool isObservable,
const std::vector<std::string>& resourceTypes,
const std::vector<std::string>& interfaces);
OCStackResult sendResponse(const std::shared_ptr<OCResourceResponse> pResponse);
+ std::weak_ptr<std::recursive_mutex> csdkLock();
+
+ OCStackResult findDirectPairingDevices(unsigned short waittime,
+ GetDirectPairedCallback callback);
+ OCStackResult getDirectPairedDevices(GetDirectPairedCallback callback);
+
+ OCStackResult doDirectPairing(std::shared_ptr<OCDirectPairing> peer, OCPrm_t pmSel,
+ const std::string& pinNumber,
+ DirectPairingCallback resultCallback);
+#ifdef WITH_CLOUD
+ OCAccountManager::Ptr constructAccountManagerObject(const std::string& host,
+ OCConnectivityType connectivityType);
+#endif // WITH_CLOUD
+
+#ifdef TCP_ADAPTER
+ OCStackResult findKeepAliveResource(std::string host, KeepAliveCallback resultCallback);
+ OCStackResult sendKeepAliveRequest(std::string host, const OCRepresentation& rep,
+ KeepAliveCallback resultCallback);
+#endif
+ OCStackResult getDeviceId(OCUUIdentity *myUuid);
+
+ OCStackResult setDeviceId(const OCUUIdentity *myUuid);
+
+ OCStackResult stop();
+ OCStackResult start();
private:
PlatformConfig m_cfg;
+ OCMode m_modeType;
private:
std::unique_ptr<WrapperFactory> m_WrapperInstance;
}
#endif //__OCPLATFORM_IMPL_H
-
-
-