2012-10-05 14:12:52 -04:00
|
|
|
#ifndef RSGXSIFACEIMPL_H
|
|
|
|
#define RSGXSIFACEIMPL_H
|
|
|
|
|
|
|
|
#include "gxs/rsgenexchange.h"
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* The simple idea of this class is to implement the simple interface functions
|
2012-10-15 16:31:56 -04:00
|
|
|
* of gen exchange.
|
|
|
|
* This class provides convenience implementations of:
|
|
|
|
* - Handle msg and group changes (client class must pass changes sent by RsGenExchange to it)
|
|
|
|
* - subscription to groups
|
|
|
|
* - retrieval of msgs and group ids and meta info
|
2012-10-05 14:12:52 -04:00
|
|
|
*/
|
|
|
|
class RsGxsIfaceImpl
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2012-10-15 16:31:56 -04:00
|
|
|
/*!
|
|
|
|
*
|
|
|
|
* @param gxs handle to RsGenExchange instance of service (Usually the service class itself)
|
|
|
|
*/
|
2012-10-05 14:12:52 -04:00
|
|
|
RsGxsIfaceImpl(RsGenExchange* gxs);
|
|
|
|
|
2012-10-15 16:31:56 -04:00
|
|
|
/*!
|
|
|
|
* Gxs services should call this for automatic handling of
|
|
|
|
* changes, send
|
|
|
|
* @param changes
|
|
|
|
*/
|
|
|
|
void receiveChanges(std::vector<RsGxsNotify*>& changes);
|
2012-10-05 14:12:52 -04:00
|
|
|
|
|
|
|
/*!
|
2012-10-15 16:31:56 -04:00
|
|
|
* Checks to see if a change has been received for
|
|
|
|
* for a message or group
|
|
|
|
* @return true if a change has occured for msg or group
|
2012-10-05 14:12:52 -04:00
|
|
|
*/
|
2012-10-15 16:31:56 -04:00
|
|
|
virtual bool updated();
|
2012-10-05 14:12:52 -04:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2012-10-14 14:32:33 -04:00
|
|
|
/*!
|
2012-10-15 16:31:56 -04:00
|
|
|
* The groups changed. \n
|
|
|
|
* class can reimplement to use to tailor
|
|
|
|
* the group actually set for ui notification.
|
|
|
|
* If receivedChanges is not passed RsGxsNotify changes
|
|
|
|
* this function does nothing
|
2012-10-14 14:32:33 -04:00
|
|
|
* @param grpIds
|
|
|
|
*/
|
2012-10-15 16:31:56 -04:00
|
|
|
virtual void groupsChanged(std::list<RsGxsGroupId>& grpIds);
|
2012-10-05 14:12:52 -04:00
|
|
|
|
2012-10-14 14:32:33 -04:00
|
|
|
/*!
|
2012-10-15 16:31:56 -04:00
|
|
|
* The msg changed. \n
|
|
|
|
* class can reimplement to use to tailor
|
|
|
|
* the msg actually set for ui notification.
|
|
|
|
* If receivedChanges is not passed RsGxsNotify changes
|
|
|
|
* this function does nothing
|
2012-10-14 14:32:33 -04:00
|
|
|
* @param msgs
|
|
|
|
*/
|
2012-10-15 16:31:56 -04:00
|
|
|
virtual void msgsChanged(std::map<RsGxsGroupId,
|
2012-10-05 14:12:52 -04:00
|
|
|
std::vector<RsGxsMessageId> >& msgs);
|
|
|
|
|
2012-10-15 16:31:56 -04:00
|
|
|
/*!
|
|
|
|
* @return handle to token service for this GXS service
|
|
|
|
*/
|
2012-10-05 14:12:52 -04:00
|
|
|
RsTokenService* getTokenService();
|
|
|
|
|
2012-10-14 14:32:33 -04:00
|
|
|
/* Generic Lists */
|
|
|
|
|
|
|
|
/*!
|
2012-10-15 16:31:56 -04:00
|
|
|
* Retrieve list of group ids associated to a request token
|
2012-10-14 14:32:33 -04:00
|
|
|
* @param token token to be redeemed for this request
|
|
|
|
* @param groupIds the ids return for given request token
|
|
|
|
* @return false if request token is invalid, check token status for error report
|
|
|
|
*/
|
2012-10-05 14:12:52 -04:00
|
|
|
bool getGroupList(const uint32_t &token,
|
|
|
|
std::list<RsGxsGroupId> &groupIds);
|
2012-10-14 14:32:33 -04:00
|
|
|
|
|
|
|
/*!
|
2012-10-15 16:31:56 -04:00
|
|
|
* Retrieves list of msg ids associated to a request token
|
2012-10-14 14:32:33 -04:00
|
|
|
* @param token token to be redeemed for this request
|
|
|
|
* @param msgIds the ids return for given request token
|
|
|
|
* @return false if request token is invalid, check token status for error report
|
|
|
|
*/
|
2012-10-05 14:12:52 -04:00
|
|
|
bool getMsgList(const uint32_t &token,
|
|
|
|
GxsMsgIdResult& msgIds);
|
|
|
|
|
2012-10-14 14:32:33 -04:00
|
|
|
/*!
|
|
|
|
* @param token token to be redeemed for group summary request
|
|
|
|
* @param groupInfo the ids returned for given request token
|
|
|
|
* @return false if request token is invalid, check token status for error report
|
|
|
|
*/
|
2012-10-05 14:12:52 -04:00
|
|
|
bool getGroupSummary(const uint32_t &token,
|
|
|
|
std::list<RsGroupMetaData> &groupInfo);
|
|
|
|
|
2012-10-14 14:32:33 -04:00
|
|
|
/*!
|
|
|
|
* @param token token to be redeemed for message summary request
|
|
|
|
* @param msgInfo the message metadata returned for given request token
|
|
|
|
* @return false if request token is invalid, check token status for error report
|
|
|
|
*/
|
2012-10-05 14:12:52 -04:00
|
|
|
bool getMsgSummary(const uint32_t &token,
|
|
|
|
GxsMsgMetaMap &msgInfo);
|
|
|
|
|
2012-10-14 14:32:33 -04:00
|
|
|
/*!
|
|
|
|
* subscribes to group, and returns token which can be used
|
|
|
|
* to be acknowledged to get group Id
|
|
|
|
* @param token token to redeem for acknowledgement
|
|
|
|
* @param grpId the id of the group to subscribe to
|
|
|
|
*/
|
2012-10-15 16:31:56 -04:00
|
|
|
virtual bool subscribeToGroup(uint32_t& token, const RsGxsGroupId& grpId, bool subscribe);
|
2012-10-14 14:32:33 -04:00
|
|
|
|
2012-10-05 14:12:52 -04:00
|
|
|
/*!
|
|
|
|
* This allows the client service to acknowledge that their msgs has
|
|
|
|
* been created/modified and retrieve the create/modified msg ids
|
|
|
|
* @param token the token related to modification/create request
|
|
|
|
* @param msgIds map of grpid->msgIds of message created/modified
|
|
|
|
* @return true if token exists false otherwise
|
|
|
|
*/
|
|
|
|
bool acknowledgeMsg(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* This allows the client service to acknowledge that their grps has
|
|
|
|
* been created/modified and retrieve the create/modified grp ids
|
|
|
|
* @param token the token related to modification/create request
|
|
|
|
* @param msgIds vector of ids of groups created/modified
|
|
|
|
* @return true if token exists false otherwise
|
|
|
|
*/
|
|
|
|
bool acknowledgeGrp(const uint32_t& token, RsGxsGroupId& grpId);
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
RsGenExchange* mGxs;
|
2012-10-15 16:31:56 -04:00
|
|
|
|
|
|
|
std::vector<RsGxsGroupChange*> mGroupChange;
|
|
|
|
std::vector<RsGxsMsgChange*> mMsgChange;
|
|
|
|
|
|
|
|
RsMutex mGxsIfaceMutex;
|
2012-10-05 14:12:52 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // RSGXSIFACEIMPL_H
|