![]() |
Diarkis C++Client Library API Document
|
Base class that wraps the IDiarkisSession class for easy use of Session functionality. More...
#include <DiarkisSessionBase.h>
Public Member Functions | |
DiarkisSessionBase () | |
DiarkisSessionBase constructor. More... | |
virtual | ~DiarkisSessionBase () |
DiarkisSessionBase destructor. More... | |
virtual void | SetupUdpSession (const std::shared_ptr< IDiarkisUdp > &udp, const std::shared_ptr< LoggerFactory > &loggerFactory, bool bRetry) |
Set up Session with UDP protocol. More... | |
virtual void | SetupTcpSession (const std::shared_ptr< IDiarkisTcp > &tcp, const std::shared_ptr< LoggerFactory > &loggerFactory, bool bRetry) |
Set up Session with TCP protocol. More... | |
bool | HasSession (uint8_t sessionType) const |
Check if you are joining at least one Session. More... | |
virtual void | SendCreate (uint8_t sessionType, uint8_t maxMembers, uint8_t ttl) |
Create a new Session. More... | |
virtual void | SendInvite (uint8_t sessionType, const char **uids, size_t uidsCount) |
Invite a user to the Session your are currently in. More... | |
virtual void | SendInvite (uint8_t sessionType, const std::vector< std::string > &uids) |
Same as SendInvite(uint8_t, const char**, size_t) More... | |
virtual void | SendInvite (uint8_t sessionType, const char **uids, size_t uidsCount, const uint8_t *message, size_t messageSize) |
Invite a user to the Session you are currently in. More... | |
virtual void | SendInvite (uint8_t sessionType, const std::vector< std::string > &uids, const std::string &message) |
Same as SendInvite(uint8_t, const char**, size_t, const uint8_t*, size_t) More... | |
virtual void | SendInvite (uint8_t sessionType, const char **uids, size_t uidsCount, const char *message) |
Same as SendInvite(uint8_t, const char**, size_t, const uint8_t*, size_t) More... | |
virtual void | SendBroadcast (uint8_t sessionType, const uint8_t *message, size_t messageSize) |
Broadcast a message. More... | |
virtual void | SendBroadcast (uint8_t sessionType, const std::string &message) |
Same as SendBroadcast() More... | |
virtual void | SendBroadcast (uint8_t sessionType, const char *message) |
Same as SendBroadcast() More... | |
virtual void | SendMessageTo (uint8_t sessionType, const char **uids, size_t uidsCount, const uint8_t *message, size_t messageSize) |
Send a message to particular membbers. More... | |
virtual void | SendMessageTo (uint8_t sessionType, const char **uids, size_t uidsCount, const char *message) |
Same as SendMessageTo() More... | |
virtual void | SendMessageTo (uint8_t sessionType, const std::vector< std::string > &memberIDs, const std::string &message) |
Same as SendMessageTo() More... | |
virtual void | SendGetSessionInfoBySessionType (uint8_t sessionType) |
Obtain information about the specified Session. More... | |
virtual void | SendGetSessionInfoBySessionID (const char *sessionID) |
Obtain information about the specified Session. More... | |
virtual void | SendGetSessionInfoBySessionID (const std::string &sessionID) |
Same as SendGetSessionInfoBySessionID() More... | |
Diarkis::StdString | GetSessionID (uint8_t sessionType) const |
Get the Session ID. More... | |
virtual void | SendKick (uint8_t sessionType, const char *userID) |
Kick a Session member. More... | |
virtual void | SendKick (uint8_t sessionType, const std::string &userID) |
Same as SendKick() More... | |
virtual void | SendJoin (uint8_t sessionType, const char *sessionID) |
Join a Session. More... | |
virtual void | SendJoin (uint8_t sessionType, const std::string &sessionID) |
Same as SendJoin() More... | |
virtual void | SendLeave (uint8_t sessionType) |
Leave a Session. More... | |
void | SetUserID (const char *userID) |
Set user ID. More... | |
void | SetUserID (const std::string &userID) |
Same as SendUserID() More... | |
Diarkis::StdString | GetUserID () const |
Get user ID. More... | |
Protected Member Functions | |
virtual void | OnSessionCreateResponse (const DiarkisSessionCreateResponseEventArgs &e) |
Callback event called when the Session is created, event content is the Session ID. More... | |
virtual void | OnSessionInvite (const DiarkisSessionInviteEventArgs &e) |
Callback event called when a user is invited to the Session, event content is the Session ID. More... | |
virtual void | OnSessionJoin (const DiarkisSessionNotificationEventArgs &e) |
Callback event when an a member join the Session, event content is the user ID. More... | |
virtual void | OnSessionLeave (const DiarkisSessionNotificationEventArgs &e) |
Callback event when an a member leave the Session, event content is the user ID. More... | |
virtual void | OnSessionBroadcast (const DiarkisSessionNotificationEventArgs &e) |
Callback event when an a broadcast is received. More... | |
virtual void | OnSessionMessageTo (const DiarkisSessionNotificationEventArgs &e) |
Callback event when an a message is received. More... | |
virtual void | OnSessionInfo (const DiarkisSessionInfoEventArgs &e) |
Callback event called when acquiring information of a participating Session. More... | |
virtual void | OnSessionKick (const DiarkisSessionNotificationEventArgs &e) |
Callback event when kicked out of the Session. More... | |
virtual void | OnSessionInviteResponse (const DiarkisSessionResponseEventArgs &e) |
Callback event when a response is received from the server when SendInvite is sent. More... | |
virtual void | OnSessionKickResponse (const DiarkisSessionResponseEventArgs &e) |
Callback event when a response is received from the server when SendKick is sent. More... | |
virtual void | OnSessionJoinResponse (const DiarkisSessionResponseEventArgs &e) |
Callback event when a response is received from the server when SendJoin is sent. More... | |
virtual void | OnSessionMessageToResponse (const DiarkisSessionResponseEventArgs &e) |
Callback event when a response is received from the server when SendMessageTo is sent. More... | |
virtual void | OnSessionBroadcastResponse (const DiarkisSessionResponseEventArgs &e) |
Callback event when a response is received from the server when SendBroadcast is sent. More... | |
virtual void | OnSessionLeaveResponse (const DiarkisSessionResponseEventArgs &e) |
Callback event when a response is received from the server when SendLeave is sent. More... | |
Protected Attributes | |
std::shared_ptr< IDiarkisUdp > | udp_ |
IDiarkisUdpクラスへのポインタ More... | |
std::shared_ptr< IDiarkisTcp > | tcp_ |
Pointer to IDiarkisTcp class. More... | |
std::shared_ptr< IDiarkisSession > | session_ |
Pointer to IDiarkisSession class. More... | |
std::shared_ptr< IDiarkisLogger > | logger_ |
Pointer to IDiarkisLogger class. More... | |
Diarkis::StdVector< std::function< void()> > | eventUnsubscriptions_ |
List of lambda functions. More... | |
Base class that wraps the IDiarkisSession class for easy use of Session functionality.
DiarkisSessionBase::DiarkisSessionBase | ( | ) |
|
virtual |
DiarkisSessionBase destructor.
|
virtual |
Set up Session with UDP protocol.
Register loggers and callback functions.
[in] | udp | Pointer to IDiarkisUdp class |
[in] | loggerFactory | Pointer to logger class |
[in] | bRetry | Call this function with true when reconnecting after a failed attempt. The first call to this function must be false. |
|
virtual |
Set up Session with TCP protocol.
Register loggers and callback functions.
[in] | tcp | Pointer to IDiarkisTcp class |
[in] | loggerFactory | Pointer to logger class |
[in] | bRetry | Call this function with true when reconnecting after a failed attempt. The first call to this function must be false. |
bool DiarkisSessionBase::HasSession | ( | uint8_t | sessionType | ) | const |
Check if you are joining at least one Session.
|
virtual |
Create a new Session.
Callback events registered with GetCreateEvent() (e.g. OnSessionCreate) will be triggered.
[in] | sessionType | Session type |
[in] | maxMembers | Maximum number of participants in the Session |
[in] | ttl | Duration of the Session in seconds after it is empty. |
|
virtual |
Invite a user to the Session your are currently in.
OnSessionInvite is triggered by the invited user.
[in] | sessionType | Type of Session to invite. |
[in] | uids | List of user IDs to send the invite to |
[in] | uidsCount | Number of UIDs |
|
virtual |
|
virtual |
Invite a user to the Session you are currently in.
OnSessionInvite is triggered by the invited user.
[in] | sessionType | Type of Session to invite. |
[in] | uids | List of user IDs to send the invite to |
[in] | uidsCount | Number of UIDs |
[in] | message | Message to be sent |
[in] | messageSize | Length of the message |
|
virtual |
Same as SendInvite(uint8_t, const char**, size_t, const uint8_t*, size_t)
|
virtual |
Same as SendInvite(uint8_t, const char**, size_t, const uint8_t*, size_t)
|
virtual |
Broadcast a message.
The message is delivered to all members of the Session, including yourself.
[in] | sessionType | Type of Session to send. |
[in] | message | Message to be sent |
[in] | messageSize | Length of the message |
|
virtual |
|
virtual |
Same as SendBroadcast()
|
virtual |
Send a message to particular membbers.
The message is delivered to particular members of the Session.
[in] | sessionType | is the type of the sessionl |
[in] | uids | is the list of user IDs the message will be sent to |
[in] | uidsCount | Number of UIDs |
[in] | message | payload data |
[in] | messageSize | Length of the message |
|
virtual |
Same as SendMessageTo()
|
virtual |
|
virtual |
Obtain information about the specified Session.
The callback event registered with GetSessionInfoEvent (e.g. OnSessionInfo) is triggered.
[in] | sessionType | Type of the Session |
|
virtual |
Obtain information about the specified Session.
The callback event registered with GetSessionInfoEvent (e.g. OnSessionInfo) is triggered.
[in] | sessionID | ID of the Session |
|
virtual |
Diarkis::StdString DiarkisSessionBase::GetSessionID | ( | uint8_t | sessionType | ) | const |
Get the Session ID.
If no Session has been joined the ID is empty.
[in] | sessionType | type of the Session to get ID |
|
virtual |
Kick a Session member.
[in] | sessionType | Session type |
[in] | userID | ID of the user to kick |
|
virtual |
|
virtual |
Join a Session.
[in] | sessionType | Session type |
[in] | sessionID | Session ID |
|
virtual |
|
virtual |
Leave a Session.
[in] | sessionType | Session type |
void DiarkisSessionBase::SetUserID | ( | const char * | userID | ) |
Set user ID.
[in] | userID | user ID |
void DiarkisSessionBase::SetUserID | ( | const std::string & | userID | ) |
Same as SendUserID()
Diarkis::StdString DiarkisSessionBase::GetUserID | ( | ) | const |
Get user ID.
|
protectedvirtual |
Callback event called when the Session is created, event content is the Session ID.
|
protectedvirtual |
Callback event called when a user is invited to the Session, event content is the Session ID.
|
protectedvirtual |
Callback event when an a member join the Session, event content is the user ID.
|
protectedvirtual |
Callback event when an a member leave the Session, event content is the user ID.
|
protectedvirtual |
Callback event when an a broadcast is received.
|
protectedvirtual |
Callback event when an a message is received.
|
protectedvirtual |
Callback event called when acquiring information of a participating Session.
|
protectedvirtual |
Callback event when kicked out of the Session.
|
protectedvirtual |
Callback event when a response is received from the server when SendInvite is sent.
|
protectedvirtual |
Callback event when a response is received from the server when SendKick is sent.
|
protectedvirtual |
Callback event when a response is received from the server when SendJoin is sent.
|
protectedvirtual |
Callback event when a response is received from the server when SendMessageTo is sent.
|
protectedvirtual |
Callback event when a response is received from the server when SendBroadcast is sent.
|
protectedvirtual |
Callback event when a response is received from the server when SendLeave is sent.
|
protected |
IDiarkisUdpクラスへのポインタ
~@japanese
Pointer to IDiarkisUdp class
|
protected |
Pointer to IDiarkisTcp class.
|
protected |
Pointer to IDiarkisSession class.
|
protected |
Pointer to IDiarkisLogger class.
|
protected |
List of lambda functions.