17 #ifndef ENDPOINTREGISTRATIONMANAGER_HPP_
18 #define ENDPOINTREGISTRATIONMANAGER_HPP_
25 #include <unordered_map>
35 struct UserAttachRequest;
36 struct EndpointAttachResponse;
37 struct EndpointDetachResponse;
38 struct UserAttachNotification;
39 struct UserDetachNotification;
53 virtual void attachUser(
const std::string& userExternalId
54 ,
const std::string& userAccessToken
57 virtual void attachUser(
const std::string& userExternalId
58 ,
const std::string& userAccessToken
59 ,
const std::string& userVerifierToken
71 virtual void onUserAttach(
const UserAttachResponse& response);
73 virtual void onEndpointsAttach(
const std::vector<EndpointAttachResponse>& endpoints);
74 virtual void onEndpointsDetach(
const std::vector<EndpointDetachResponse>& endpoints);
86 typedef std::atomic_int_fast32_t
RequestId;
95 std::shared_ptr<UserAttachRequest> userAttachRequest_;
96 KAA_MUTEX_DECLARE(userAttachRequestGuard_);
104 KAA_MUTEX_DECLARE(attachEndpointGuard_);
105 KAA_MUTEX_DECLARE(detachEndpointGuard_);
107 std::unordered_map<std::int32_t, std::string> attachEndpointRequests_;
108 std::unordered_map<std::int32_t, std::string> detachEndpointRequests_;
110 std::unordered_map<std::int32_t, IAttachEndpointCallbackPtr> attachEndpointListeners_;
111 std::unordered_map<std::int32_t, IDetachEndpointCallbackPtr> detachEndpointListeners_;
void setTransport(UserTransport *transport)
virtual void onEndpointsDetach(const std::vector< EndpointDetachResponse > &endpoints)
virtual void onCurrentEndpointDetach(const UserDetachNotification &response)
virtual void setAttachStatusListener(IAttachStatusListenerPtr listener)
Sets listener to notify of the current endpoint is attached/detached by another one.
virtual bool isAttachedToUser()
Checks if the current endpoint is already attached to some user.
virtual void attachUser(const std::string &userExternalId, const std::string &userAccessToken, IUserAttachCallbackPtr listener=IUserAttachCallbackPtr())
Attaches the current endpoint to the specifier user. The user verification is carried out by the defa...
EndpointRegistrationManager(IKaaClientStateStoragePtr status)
std::shared_ptr< IDetachEndpointCallback > IDetachEndpointCallbackPtr
virtual void onEndpointsAttach(const std::vector< EndpointAttachResponse > &endpoints)
virtual void onCurrentEndpointAttach(const UserAttachNotification &response)
virtual std::unordered_map< std::int32_t, std::string > getEndpointsToDetach()
std::shared_ptr< IKaaClientStateStorage > IKaaClientStateStoragePtr
std::shared_ptr< IAttachStatusListener > IAttachStatusListenerPtr
virtual void onUserAttach(const UserAttachResponse &response)
std::shared_ptr< IUserAttachCallback > IUserAttachCallbackPtr
The interface to a module which associates endpoints with users.
virtual std::unordered_map< std::int32_t, std::string > getEndpointsToAttach()
virtual UserAttachRequestPtr getUserAttachRequest()
std::shared_ptr< UserAttachRequest > UserAttachRequestPtr
std::shared_ptr< IAttachEndpointCallback > IAttachEndpointCallbackPtr
virtual void attachEndpoint(const std::string &endpointAccessToken, IAttachEndpointCallbackPtr listener=IAttachEndpointCallbackPtr())
Attaches the specified endpoint to the user to which the current endpoint is attached.
virtual void detachEndpoint(const std::string &endpointKeyHash, IDetachEndpointCallbackPtr listener=IDetachEndpointCallbackPtr())
Detaches the specified endpoint from the user to which the current endpoint is attached.