RCbs Class Reference
class RCbs : public RSessionBase |
This represents the client-side session to the cbs server.
Every client must have an instance of the class to be able to communicate with the server.
Note that both client and server must use the same versions of the API. Otherwise the server will terminate the client process.
-
The server does not buffer events. This must be taken into account when using notifications.
-
There can only be one pending notification request per subsession object. The behaviour is undefined, if you try to make several for only one subsession.
Public Member Functions |
---|
| RCbs() |
| ~RCbs() |
IMPORT_C TInt | AddTopic(TCbsTopic &) |
IMPORT_C TInt | ChangeTopicHotmarkStatus(TCbsTopicNumber, TBool) |
IMPORT_C TInt | ChangeTopicNameAndNumber(TCbsTopicNumber, TCbsTopicNumber, const TCbsTopicName &) |
IMPORT_C TInt | ChangeTopicSubscriptionStatus(TCbsTopicNumber, TBool) |
IMPORT_C void | Close() |
IMPORT_C TInt | Connect() |
IMPORT_C TBool | Connected() |
IMPORT_C TInt | DeleteAllTopics() |
IMPORT_C TInt | DeleteMessage(const TCbsMessageHandle &) |
IMPORT_C TInt | DeleteTopic(TCbsTopicNumber) |
IMPORT_C TInt | FindMessageByHandle(const TCbsMessageHandle &, TCbsMessage &) |
IMPORT_C TInt | FindTopicByNumber(TCbsTopicNumber, TCbsTopic &) |
IMPORT_C void | GetHotmarkedMessageHandle(TCbsMessageHandle &) |
IMPORT_C void | GetLanguages(TCbsSettingsLanguages &) |
IMPORT_C TInt | GetLatestTopicNumber(TCbsTopicNumber &) |
IMPORT_C TInt | GetMessage(TCbsTopicNumber, TInt, TCbsMessage &) |
IMPORT_C TInt | GetMessageContents(const TCbsMessageHandle &, TDes &) |
IMPORT_C TInt | GetMessageCount(TCbsTopicNumber, TInt &) |
IMPORT_C TInt | GetMessageIndexByHandle(const TCbsMessageHandle &, TInt &) |
IMPORT_C TInt | GetNewTopicsCount(TInt &) |
IMPORT_C TInt | GetNextAndPrevMessageHandle(const TCbsMessageHandle &, TCbsMessageHandle &, TCbsMessageHandle &, TInt &) |
IMPORT_C TInt | GetNextAndPrevTopicNumber(const TCbsTopicNumber &, TCbsTopicNumber &, TCbsTopicNumber &, TInt &) |
IMPORT_C void | GetReceptionStatus(TBool &) |
IMPORT_C TInt | GetTopic(const TInt, TCbsTopic &) |
IMPORT_C void | GetTopicCount(TInt &) |
IMPORT_C void | GetTopicDetectionStatus(TBool &) |
IMPORT_C void | GetUnreadMessageCount(TInt &) |
IMPORT_C TBool | HasNextCollectionTopic() |
IMPORT_C TInt | LockMessage(const TCbsMessageHandle &) |
IMPORT_C TInt | NextCollectionTopic(TCbsTopicInfo &) |
IMPORT_C void | NotifyOnTopicListEvent(TRequestStatus &, const TInt, TCbsTopicListEvent &, TCbsTopicNumber &) |
IMPORT_C void | NotifyOnTopicListEventCancel() |
IMPORT_C void | NotifySettingsChanged(TRequestStatus &, TCbsSettingsEvent &) |
IMPORT_C void | NotifySettingsChangedCancel() |
IMPORT_C TInt | NumberOfUnreadHotmarkedMessages() |
IMPORT_C TInt | ReadMessage(const TCbsMessageHandle &) |
IMPORT_C TInt | SaveMessage(const TCbsMessageHandle &) |
IMPORT_C TInt | SetLanguages(const TCbsSettingsLanguages &) |
IMPORT_C TInt | SetReceptionStatus(TBool) |
IMPORT_C TInt | SetTopicDetectionStatus(TBool) |
IMPORT_C void | Shutdown() |
IMPORT_C void | StartCollectionBrowsing() |
IMPORT_C TVersion | Version() |
Inherited Functions |
---|
| RHandleBase::Attributes()const |
| RHandleBase::BTraceId()const |
| RHandleBase::DoExtendedClose() |
| RHandleBase::Duplicate(const RThread &,TOwnerType) |
| RHandleBase::FullName()const |
| RHandleBase::FullName(TDes &)const |
| RHandleBase::Handle()const |
| RHandleBase::HandleInfo(THandleInfo *) |
| RHandleBase::Name()const |
| RHandleBase::NotifyDestruction(TRequestStatus &) |
| RHandleBase::Open(const TFindHandleBase &,TOwnerType) |
| RHandleBase::OpenByName(const TDesC &,TOwnerType,TInt) |
| RHandleBase::RHandleBase() |
| RHandleBase::RHandleBase(TInt) |
| RHandleBase::SetHandle(TInt) |
| RHandleBase::SetHandleNC(TInt) |
| RSessionBase::CreateSession(RServer2,const TVersion &) |
| RSessionBase::CreateSession(RServer2,const TVersion &,TInt) |
| RSessionBase::CreateSession(RServer2,const TVersion &,TInt,TIpcSessionType,const TSecurityPolicy *,TRequestStatus *) |
| RSessionBase::CreateSession(const TDesC &,const TVersion &) |
| RSessionBase::CreateSession(const TDesC &,const TVersion &,TInt) |
| RSessionBase::CreateSession(const TDesC &,const TVersion &,TInt,TIpcSessionType,const TSecurityPolicy *,TRequestStatus *) |
| RSessionBase::CreateSession(const TDesC &,const TVersion &,TInt,TRequestStatus *) |
| RSessionBase::Open(RMessagePtr2,TInt,TOwnerType) |
| RSessionBase::Open(RMessagePtr2,TInt,const TSecurityPolicy &,TOwnerType) |
| RSessionBase::Open(TInt,TOwnerType) |
| RSessionBase::Open(TInt,const TSecurityPolicy &,TOwnerType) |
| RSessionBase::Send(TInt)const |
| RSessionBase::Send(TInt,const TIpcArgs &)const |
| RSessionBase::SendReceive(TInt)const |
| RSessionBase::SendReceive(TInt,TRequestStatus &)const |
| RSessionBase::SendReceive(TInt,const TIpcArgs &)const |
| RSessionBase::SendReceive(TInt,const TIpcArgs &,TRequestStatus &)const |
| RSessionBase::SetReturnedHandle(TInt) |
| RSessionBase::SetReturnedHandle(TInt,RHandleBase &) |
| RSessionBase::SetReturnedHandle(TInt,const TSecurityPolicy &) |
| RSessionBase::ShareAuto() |
| RSessionBase::ShareProtected() |
Constructor & Destructor Documentation
RCbs(const RCbs &)
RCbs | ( | const RCbs & | | ) | [private] |
Member Functions Documentation
AddTopic(TCbsTopic &)
Adds a new topic. The handle assigned to the topic will be returned in aTopic.
Return values: KErrNone Topic was successfully added. KErrAlreadyExists A topic of the same number already exists in DB KErrArgument Topic number given was not in a proper range. KErrDiskFull Topic not added - FFS out of space
Note that the number of the new topic must be unused.
Parameters
TCbsTopic & aTopic | Contains the information of the new topic. On return, aTopic also contains the topic handle. |
ChangeTopicHotmarkStatus(TCbsTopicNumber, TBool)
Changes topic hotmark status.
ChangeTopicNameAndNumber(TCbsTopicNumber, TCbsTopicNumber, const TCbsTopicName &)
Changes the name and number of the existing topic.
Note that the changing fails in case there is another topic with the new topic number. It also fails if the topic is protected.
Return values: KErrNone Topic name and number successfully changed. KErrDiskFull Topic information not changed - FFS out of space
ChangeTopicSubscriptionStatus(TCbsTopicNumber, TBool)
Changes topic subscription status.
Close()
Closes the session to the server.
Connect()
Creates connection to the server.
Note that the method must be called before calling any other methods. The method returns an error code and, therefore, the caller is responsible of checking that everything went just fine.
Connected()
IMPORT_C TBool | Connected | ( | ) | const |
Returns ETrue if CbsServer session has been established.
DeleteAllTopics()
IMPORT_C TInt | DeleteAllTopics | ( | ) | |
DeleteMessage(const TCbsMessageHandle &)
Deletes an existing message.
Note that it does not care a lot about the status of the message.
Please check also the description of LockMessage().
DeleteTopic(TCbsTopicNumber)
Deletes an existing topic.
FindMessageByHandle(const TCbsMessageHandle &, TCbsMessage &)
Finds a message by given handle.
FindTopicByNumber(TCbsTopicNumber, TCbsTopic &)
Finds the topic by the given number.
Return values: KErrNone Topic returned in parameter aTopic. KErrNotFound Topic was not found.
GetHotmarkedMessageHandle(TCbsMessageHandle &)
Returns the handle to the latest hotmarked message that has been received after the system has started up.
GetLanguages(TCbsSettingsLanguages &)
Returns the preferred languages in aLanguages.
GetLatestTopicNumber(TCbsTopicNumber &)
Returns the number of the topic which was last added to topic list.
Note: if a topic list cache is maintained by the client (as CBS UI application does), this function has to be called BEFORE calling GetTopicCount() and GetTopic() to make sure that no topic is added in between GetTopic() and GetLatestTopicHandle() calls. If this happens, GetLatestTopicHandle() will return a handle to a topic that is not cached client-side.
Return codes: KErrNone aNumber is a valid topic number. KErrNotFound No topic added since server start, aNumber is not valid.
GetMessage(TCbsTopicNumber, TInt, TCbsMessage &)
Returns message information.
Return codes: KErrNotFound Topic or message not found. KErrNone aMessage contains the message information.
GetMessageContents(const TCbsMessageHandle &, TDes &)
Returns the message contents.
Parameters
const TCbsMessageHandle & aHandle | It is handle to the message. |
TDes & aBuffer | It will contain the contents (as much as it fits). |
GetMessageCount(TCbsTopicNumber, TInt &)
Returns the total amount of messages the topic contains.
Return codes: KErrNotFound Invalid handle. KErrNone aCount contains the number of messages in topic
GetMessageIndexByHandle(const TCbsMessageHandle &, TInt &)
Returns the index of a message with given handle in topic.
Result code KErrNotFound indicates that no message was found with the given handle.
Parameters
const TCbsMessageHandle & aHandle | Handle of the message |
TInt & aIndex | Return: index of the message in message topic |
GetNewTopicsCount(TInt &)
IMPORT_C TInt | GetNewTopicsCount | ( | TInt & | aCount | ) | |
Returns the number of topics added since last GetNewTopicsCount() by the topic detection feature.
Parameters
TInt & aCount | It will contain the amount of new topics. |
GetNextAndPrevMessageHandle(const TCbsMessageHandle &, TCbsMessageHandle &, TCbsMessageHandle &, TInt &)
Returns the handles of messages that precede and succeed the given message in server-side list of topic messages.
Topic is resolved from the given message handle
If the given handle specifies the first message in topic, aPosition has ECbsHead bit up. If the given handle specifies the last message in topic, aPosition has ECbsTail bit up.
Return code values: KErrNone aPrevMsgHandle, aNextMsgHandle and aPosition contain valid values. KErrNotFound aCurrentMsgHandle specified a message that was not found.
Parameters
const TCbsMessageHandle & aCurrentMsgHandle | Handle that specifies the message whose surroundings are returned |
TCbsMessageHandle & aPrevMsgHandle | Returns: handle of message preceding the given message |
TCbsMessageHandle & aNextMsgHandle | Returns: handle of message succeeding the given topic |
TInt & aPosition | Returns: position of current topic in list |
GetNextAndPrevTopicNumber(const TCbsTopicNumber &, TCbsTopicNumber &, TCbsTopicNumber &, TInt &)
Returns the numbers of topics that precede and succeed the given topic in server-side topic list.
If the given topic is the first topic in list, aPosition has ECbsHead bit up. If the given topic is the last topic in list, aPosition has ECbsTail bit up.
Return code values: KErrNone aPrevTopicNumber, aNextTopicNumber and aPosition contain valid values. KErrNotFound aCurrentTopicNumber specified a topic that was not on topic list.
Parameters
const TCbsTopicNumber & aCurrentTopicNumber | Number that specifies the topic whose surroundings are returned |
TCbsTopicNumber & aPrevTopicNumber | Returns: number of topic preceding the given topic |
TCbsTopicNumber & aNextTopicNumber | Returns: number of topic succeeding the given topic |
TInt & aPosition | Returns: position of current topic in list. |
GetReceptionStatus(TBool &)
IMPORT_C void | GetReceptionStatus | ( | TBool & | aStatus | ) | |
Returns the reception status in aStatus, which is ETrue if the reception is on. Otherwise it is EFalse.
Parameters
TBool & aStatus | The method returns the reception status in this parameter. |
GetTopic(const TInt, TCbsTopic &)
Returns information about a topic from the topic list.
Return values: KErrArgument Topic was not found.
Rest of return values indicate a file error.
Parameters
const TInt aIndex | It is the index to the topic. |
TCbsTopic & aTopic | It will contain the topic information. |
GetTopicCount(TInt &)
IMPORT_C void | GetTopicCount | ( | TInt & | aCount | ) | |
Returns the total amount of topics the topic list contains.
Parameters
TInt & aCount | It will contain the total amount of topics. |
GetTopicDetectionStatus(TBool &)
IMPORT_C void | GetTopicDetectionStatus | ( | TBool & | aStatus | ) | |
Returns the topic detection status in aStatus, which is ETrue if the detection is on. Otherwise it is EFalse.
Parameters
TBool & aStatus | The method returns the topic detection status in this parameter. |
GetUnreadMessageCount(TInt &)
IMPORT_C void | GetUnreadMessageCount | ( | TInt & | aCount | ) | |
Returns the total amount of unread messages.
Parameters
TInt & aCount | Return: number of unread messages |
HasNextCollectionTopic()
IMPORT_C TBool | HasNextCollectionTopic | ( | ) | |
Returns ETrue, if there is a topic not accessed with NextTopic()
IsServerStarted()
TBool
| IsServerStarted | ( | ) | [private] |
Checks if the server is already started.
LockMessage(const TCbsMessageHandle &)
Locks the message.
Note that a single topic messages subsession can have at most one locked message.
Message can be unlocked by trying to lock a null message. Locked message will also be automatically unlocked when subsession is closed. If a message is locked, then it will not be deleted from the database. Thus, deleting a message or trying to delete a topic that contains such a message will fail.
Locking a message does not prevent to save the message nor read the message.
NextCollectionTopic(TCbsTopicInfo &)
Returns the next topic in the topic collection skipping all topics with a topic number matching a topic already listed in the current topic list. This function will return KErrNotFound if the collection is tried to access beyond the end of the list. Otherwise the error code will be the same returned by GetTopicInfo().
NotifyOnTopicListEvent(TRequestStatus &, const TInt, TCbsTopicListEvent &, TCbsTopicNumber &)
Requests the server to notify the client whenever an event occurs that changes the information of the topics.
Note that the client may select what kind of events it is interested in. Note also that there can be at most one pending request per instance of the class.
Parameters
TRequestStatus & aStatus | The variable that the server will modify whenever an event occurs. |
const TInt aRequested | Events the client is interested in |
TCbsTopicListEvent & aEvent | Indicates the variable that will contain the type of event that occured. |
TCbsTopicNumber & aNumber | Indicates the variable that will contain the topic number that was changed in event. |
NotifyOnTopicListEventCancel()
IMPORT_C void | NotifyOnTopicListEventCancel | ( | ) | |
Cancels the pending notify request.
NotifySettingsChanged(TRequestStatus &, TCbsSettingsEvent &)
Requests the server to notify the client whenever any settings will be changed.
Note that for each subsession only one this kind of request can be pending. Each client is responsible of assuring this.
Parameters
TRequestStatus & aStatus | It is the variable that the server will modify whenever an event occurs. |
TCbsSettingsEvent & aEvent | The server will store the type of occurred event to this variable. |
NotifySettingsChangedCancel()
IMPORT_C void | NotifySettingsChangedCancel | ( | ) | |
Cancels the request to notify the client.
NumberOfUnreadHotmarkedMessages()
IMPORT_C TInt | NumberOfUnreadHotmarkedMessages | ( | ) | |
Returns the number of unread messages in hotmarked topics.
This function is to used by the client when deciding whether the message or topic list view should be opened to display a hotmarked message(s).
ReadMessage(const TCbsMessageHandle &)
Sets the message as read.
SaveMessage(const TCbsMessageHandle &)
Saves a message (the saved message won't be deleted to make room for new messages).
Return codes: KErrNone Message is saved. KErrGeneral Message not saved -- total maximum of saved messages reached. KErrNotFound Message not saved -- no message associated with the given handle. KErrDiskFull Message not saved -- FFS out of space.
SetLanguages(const TCbsSettingsLanguages &)
Changes the preferred languages to aLanguages.
SetReceptionStatus(TBool)
IMPORT_C TInt | SetReceptionStatus | ( | TBool | aStatus | ) | |
Changes the reception status to aStatus.
Parameters
TBool aStatus | It contains the new reception status. |
SetTopicDetectionStatus(TBool)
IMPORT_C TInt | SetTopicDetectionStatus | ( | TBool | aStatus | ) | |
Changes the topic detection status to aStatus.
Parameters
TBool aStatus | It contains the new topic detection status. |
Shutdown()
IMPORT_C void | Shutdown | ( | ) | const |
Forces the server to shut down.
StartCollectionBrowsing()
IMPORT_C void | StartCollectionBrowsing | ( | ) | |
Resets the iterator. Must be called prior any call to HasNextTopic() or NextTopic()!
StartServer()
TInt
| StartServer | ( | ) | [private] |
Version()
Returns the version of CbsClient.
CbsServer and CbsClient must be of same version.
Member Data Documentation
TBool
iConnected
TBool
| iConnected | [private] |
RCbsTopicCollection
iTopicCollection
RCbsTopicMessages
iTopicMessages
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.