class CMcn : public CBase |
Client must first connect to the server and then register a MCbsMcnObserver-derived class to receive notifications when MCN messages are received from the network.
Registration to CbsServer is not required to retrieve the current cell info message.
In the example below, the client has implemented the class MCbsMcnObserver in class CCbsMcnObserver. First, the client establishes a session with CbsServer. The subscribed topics are specified with a CMcnTopicArray instance.
Example:
// Establish the session. CMcn* session = CMcn::NewL() ; CleanupStack::PushL( session );
// Specify topics with CMcnTopicArray . CMcnTopicArray* topics = CMcnTopicArray::NewL() ; topics->AddCbTopicL( 50 ); // District info (cell info) topics->AddCbTopicL( 0 ); // CB index messages
// Register. Parameter observer is an instance of CCbsMcnObserver. session->RegisterL( observer, topics ); delete topics;
// Get current MCN state. TMcnMessage mcnInfo; TInt result( session->GetCellInfo( mcnInfo ) ); if ( result != KErrNone ) { // mcnInfo contains the current MCN message. }
// Observer's CellInfoChanged() gets called if MCN state changes. // Note that the active scheduler must be running here.
// Terminate session. session->Unregister( observer ); CleanupStack::PopAndDestroy() ; // session, gets closed when deleted
Public Member Functions | |
---|---|
~CMcn () | |
IMPORT_C TInt | GetCellInfo ( TDes &) |
IMPORT_C TInt | GetInfoMessage ( TDes &, TInt ) |
IMPORT_C CMcn * | NewL () |
IMPORT_C void | RegisterL ( MCbsMcnObserver *, const CMcnTopicArray &) |
IMPORT_C void | Unregister ( MCbsMcnObserver *) |
Private Member Functions | |
---|---|
CMcn () | |
CMcn (const CMcn &) | |
void | ConstructL () |
void | RelayMessage ( TCbsMcnMessage &) |
CMcn & | operator= (const CMcn &) |
Private Attributes | |
---|---|
CCbsMcnListener * | iMcnListener |
CArrayPtrFlat < MCbsMcnObserver > * | iObservers |
RCbsMcnSession | iSession |
IMPORT_C TInt | GetCellInfo | ( | TDes & | aMcnMessage | ) | const |
Retrieves the current MCN message (Cell Info, topic 050) from CBS server. A new MCN message always overwrites the previous one in CBS server, no buffering is done. Note that this function may be only used to retrieve cell info messages.
Return codes: KErrNone aMcnMessage contains the current, valid MCN message. KErrNotFound CbsServer has not yet received a MCN message. Content of aMcnMessage must be ignored.
TDes & aMcnMessage | Returns the current MCN message. |
IMPORT_C TInt | GetInfoMessage | ( | TDes & | aInfoMessage, |
TInt | aTopicNumber | |||
) | const |
Retrieves the current info message (e.g. HomeZone, topic 221) from CBS server. A new info message always overwrites the previous one in CBS server, no buffering is done. Note that this function may be only used to retrieve cell info messages.
Return codes: KErrNone aInfoMessage contains the current, valid info message. KErrNotFound CbsServer has not yet received a info message. Content of aInfoMessage must be ignored.
IMPORT_C CMcn * | NewL | ( | ) | [static] |
Instantiates new CMcn object and establishes a session with CBS server.
If connecting to CBS server fails, the function leaves with the leave code of RSessionBase::CreateSession() .
Active scheduler has to be installed prior to calling this function.
IMPORT_C void | RegisterL | ( | MCbsMcnObserver * | aObserver, |
const CMcnTopicArray & | aArray | |||
) |
Registers an observer to CBS server. The observer is notified when a MCN message is received from the network. The caller is also required to provide an array containing numbers of subscribed topics.
Parameter aArray may contain topic number entry duplicates. Topics may be in any order.
Leave codes indicate an error accessing EPOC Telephony Sever. In this case, the leave code is the same returned by EPOC Telephony Sever.
MCbsMcnObserver * aObserver | Observer implemented by the client |
const CMcnTopicArray & aArray | List of relayed topics |
void | RelayMessage | ( | TCbsMcnMessage & | aMcnMessage | ) | [private] |
Relays aMcnMessage to the registered observers. Used by a friend class CCbsMcnListener instance
TCbsMcnMessage & aMcnMessage | Received CB message from CbsServer |
IMPORT_C void | Unregister | ( | MCbsMcnObserver * | aObserver | ) |
Unregisters a previously registered MCN observer clearing any topic subscriptions of this client in CBS server.
Panics if the observer specified was not registered.
MCbsMcnObserver * aObserver | Observer implemented by the client |
CCbsMcnListener * | iMcnListener | [private] |
Own: Active object responsible for responding to server-initiated notification indicating that a message has arrived from the CbsServer.
CArrayPtrFlat < MCbsMcnObserver > * | iObservers | [private] |
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.