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.
Private Member Functions | |
---|---|
RCbs (const RCbs &) | |
TBool | IsServerStarted () |
TInt | StartServer () |
RCbs & | operator= (const RCbs &) |
Inherited Enumerations | |
---|---|
RHandleBase:TAttributes | |
RSessionBase:TAttachMode |
Private Attributes | |
---|---|
TBool | iConnected |
RCbsSettings | iSettings |
RCbsTopicCollection | iTopicCollection |
RCbsTopicList | iTopicList |
RCbsTopicMessages | iTopicMessages |
Inherited Attributes | |
---|---|
RHandleBase::iHandle |
IMPORT_C TInt | AddTopic | ( | TCbsTopic & | aTopic | ) |
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.
TCbsTopic & aTopic | Contains the information of the new topic. On return, aTopic also contains the topic handle. |
IMPORT_C TInt | ChangeTopicHotmarkStatus | ( | TCbsTopicNumber | aNumber, |
TBool | aNewStatus | |||
) |
Changes topic hotmark status.
TCbsTopicNumber aNumber | Number of the topic |
TBool aNewStatus | New hotmark status |
IMPORT_C TInt | ChangeTopicNameAndNumber | ( | TCbsTopicNumber | aOldNumber, |
TCbsTopicNumber | aNewNumber, | |||
const TCbsTopicName & | aName | |||
) |
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
TCbsTopicNumber aOldNumber | Number of the topic to be changed |
TCbsTopicNumber aNewNumber | Number to be given for the topic |
const TCbsTopicName & aName | Name to be given for the topic |
IMPORT_C TInt | ChangeTopicSubscriptionStatus | ( | TCbsTopicNumber | aNumber, |
TBool | aNewStatus | |||
) |
Changes topic subscription status.
TCbsTopicNumber aNumber | Number of the topic |
TBool aNewStatus | New subscription status |
IMPORT_C TInt | 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.
IMPORT_C TBool | Connected | ( | ) | const |
Returns ETrue if CbsServer session has been established.
IMPORT_C TInt | DeleteMessage | ( | const TCbsMessageHandle & | aHandle | ) |
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() .
const TCbsMessageHandle & aHandle | It is handle to the message. |
IMPORT_C TInt | DeleteTopic | ( | TCbsTopicNumber | aNumber | ) |
Deletes an existing topic.
TCbsTopicNumber aNumber | Number of the topic to be deleted |
IMPORT_C TInt | FindMessageByHandle | ( | const TCbsMessageHandle & | aHandle, |
TCbsMessage & | aMessage | |||
) |
Finds a message by given handle.
const TCbsMessageHandle & aHandle | Handle to the message. |
TCbsMessage & aMessage | Return: contains the message information. |
IMPORT_C TInt | FindTopicByNumber | ( | TCbsTopicNumber | aNumber, |
TCbsTopic & | aTopic | |||
) |
Finds the topic by the given number.
Return values: KErrNone Topic returned in parameter aTopic. KErrNotFound Topic was not found.
TCbsTopicNumber aNumber | Number of the topic |
TCbsTopic & aTopic | Return: contains the topic information |
IMPORT_C void | GetHotmarkedMessageHandle | ( | TCbsMessageHandle & | aMessage | ) |
Returns the handle to the latest hotmarked message that has been received after the system has started up.
TCbsMessageHandle & aMessage | Handle to the message |
IMPORT_C void | GetLanguages | ( | TCbsSettingsLanguages & | aLanguages | ) |
Returns the preferred languages in aLanguages.
TCbsSettingsLanguages & aLanguages | The method returns the languages in this parameter. |
IMPORT_C TInt | GetLatestTopicNumber | ( | TCbsTopicNumber & | aNumber | ) |
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.
TCbsTopicNumber & aNumber | Returns: number of the topic last added |
IMPORT_C TInt | GetMessage | ( | TCbsTopicNumber | aNumber, |
TInt | aIndex, | |||
TCbsMessage & | aMessage | |||
) |
Returns message information.
Return codes: KErrNotFound Topic or message not found. KErrNone aMessage contains the message information.
TCbsTopicNumber aNumber | Number of the topic |
TInt aIndex | Index to the message in topic. |
TCbsMessage & aMessage | Returns: the message information |
IMPORT_C TInt | GetMessageContents | ( | const TCbsMessageHandle & | aHandle, |
TDes & | aBuffer | |||
) |
Returns the message contents.
const TCbsMessageHandle & aHandle | It is handle to the message. |
TDes & aBuffer | It will contain the contents (as much as it fits). |
IMPORT_C TInt | GetMessageCount | ( | TCbsTopicNumber | aNumber, |
TInt & | aCount | |||
) |
Returns the total amount of messages the topic contains.
Return codes: KErrNotFound Invalid handle. KErrNone aCount contains the number of messages in topic
TCbsTopicNumber aNumber | Number of the topic. |
TInt & aCount | Number of messages in given topic. |
IMPORT_C TInt | GetMessageIndexByHandle | ( | const TCbsMessageHandle & | aHandle, |
TInt & | aIndex | |||
) |
Returns the index of a message with given handle in topic.
Result code KErrNotFound indicates that no message was found with the given handle.
const TCbsMessageHandle & aHandle | Handle of the message |
TInt & aIndex | Return: index of the message in message topic |
IMPORT_C TInt | GetNewTopicsCount | ( | TInt & | aCount | ) |
Returns the number of topics added since last GetNewTopicsCount() by the topic detection feature.
TInt & aCount | It will contain the amount of new topics. |
IMPORT_C TInt | GetNextAndPrevMessageHandle | ( | const TCbsMessageHandle & | aCurrentMsgHandle, |
TCbsMessageHandle & | aPrevMsgHandle, | |||
TCbsMessageHandle & | aNextMsgHandle, | |||
TInt & | aPosition | |||
) |
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.
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 |
IMPORT_C TInt | GetNextAndPrevTopicNumber | ( | const TCbsTopicNumber & | aCurrentTopicNumber, |
TCbsTopicNumber & | aPrevTopicNumber, | |||
TCbsTopicNumber & | aNextTopicNumber, | |||
TInt & | aPosition | |||
) |
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.
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. |
IMPORT_C void | GetReceptionStatus | ( | TBool & | aStatus | ) |
Returns the reception status in aStatus, which is ETrue if the reception is on. Otherwise it is EFalse.
TBool & aStatus | The method returns the reception status in this parameter. |
IMPORT_C TInt | GetTopic | ( | const TInt | aIndex, |
TCbsTopic & | aTopic | |||
) |
Returns information about a topic from the topic list.
Return values: KErrArgument Topic was not found.
Rest of return values indicate a file error.
IMPORT_C void | GetTopicCount | ( | TInt & | aCount | ) |
Returns the total amount of topics the topic list contains.
TInt & aCount | It will contain the total amount of topics. |
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.
TBool & aStatus | The method returns the topic detection status in this parameter. |
IMPORT_C void | GetUnreadMessageCount | ( | TInt & | aCount | ) |
Returns the total amount of unread messages.
TInt & aCount | Return: number of unread messages |
IMPORT_C TBool | HasNextCollectionTopic | ( | ) |
Returns ETrue, if there is a topic not accessed with NextTopic()
IMPORT_C TInt | LockMessage | ( | const TCbsMessageHandle & | aHandle | ) |
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.
const TCbsMessageHandle & aHandle | It is handle to the message to be locked. |
IMPORT_C TInt | NextCollectionTopic | ( | TCbsTopicInfo & | aInfo | ) |
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().
TCbsTopicInfo & aInfo | The topic information will be stored here. |
IMPORT_C void | NotifyOnTopicListEvent | ( | TRequestStatus & | aStatus, |
const TInt | aRequested, | |||
TCbsTopicListEvent & | aEvent, | |||
TCbsTopicNumber & | aNumber | |||
) |
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.
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. |
IMPORT_C void | NotifyOnTopicListEventCancel | ( | ) |
Cancels the pending notify request.
IMPORT_C void | NotifySettingsChanged | ( | TRequestStatus & | aStatus, |
TCbsSettingsEvent & | aEvent | |||
) |
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.
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. |
IMPORT_C void | NotifySettingsChangedCancel | ( | ) |
Cancels the request to notify the client.
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).
IMPORT_C TInt | ReadMessage | ( | const TCbsMessageHandle & | aHandle | ) |
Sets the message as read.
const TCbsMessageHandle & aHandle | It is handle to the message to be set read. |
IMPORT_C TInt | SaveMessage | ( | const TCbsMessageHandle & | aHandle | ) |
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.
const TCbsMessageHandle & aHandle | Handle to the message to be saved. |
IMPORT_C TInt | SetLanguages | ( | const TCbsSettingsLanguages & | aLanguages | ) |
Changes the preferred languages to aLanguages.
const TCbsSettingsLanguages & aLanguages | It contains the new preferred languages. |
IMPORT_C TInt | SetReceptionStatus | ( | TBool | aStatus | ) |
Changes the reception status to aStatus.
TBool aStatus | It contains the new reception status. |
IMPORT_C TInt | SetTopicDetectionStatus | ( | TBool | aStatus | ) |
Changes the topic detection status to aStatus.
TBool aStatus | It contains the new topic detection status. |
IMPORT_C void | StartCollectionBrowsing | ( | ) |
Resets the iterator. Must be called prior any call to HasNextTopic() or NextTopic()!
IMPORT_C TVersion | Version | ( | ) | const |
Returns the version of CbsClient.
CbsServer and CbsClient must be of same version.
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.