|
Nokia N97 SDK Example Applications Guide |
#include <ChatServiceAdvertiser.h>
Inheritance diagram for CChatServiceAdvertiser:

Definition at line 30 of file ChatServiceAdvertiser.h.
Public Member Functions |
|
| virtual | ~CChatServiceAdvertiser () |
| void | StartAdvertisingL (TInt aPort) |
| void | StopAdvertisingL () |
| TBool | IsAdvertising () |
| void | UpdateAvailabilityL (TBool aIsAvailable) |
Static Public Member Functions |
|
| static CChatServiceAdvertiser * | NewL () |
| static CChatServiceAdvertiser * | NewLC () |
Protected Member Functions |
|
| void | BuildProtocolDescriptionL (CSdpAttrValueDES *aProtocolDescriptor, TInt aPort) |
| TInt | ServiceClass () |
| const TDesC & | ServiceName () |
| const TDesC & | ServiceDescription () |
Private Member Functions |
|
| CChatServiceAdvertiser () | |
| void | ConstructL () |
Private Attributes |
|
| HBufC * | iServiceName |
| HBufC * | iServiceDescription |
|
|
~CChatServiceAdvertiser() Destroy the object and release all memory objects. Close any open sockets Definition at line 67 of file ChatServiceAdvertiser.cpp. References iServiceDescription, and iServiceName. 00068 { 00069 delete iServiceName; 00070 delete iServiceDescription; 00071 }
|
|
|
CChatServiceAdvertiser() Constructs this object Definition at line 57 of file ChatServiceAdvertiser.cpp. Referenced by NewLC().
|
|
|
NewL() Create a CChatServiceAdvertiser object
Definition at line 32 of file ChatServiceAdvertiser.cpp. References NewLC(). Referenced by CChatBt::ConstructL(). 00033 { 00034 CChatServiceAdvertiser* self = CChatServiceAdvertiser::NewLC(); 00035 CleanupStack::Pop( self ); 00036 return self; 00037 }
|
|
|
NewLC() Create a CChatServiceAdvertiser object, which will draw itself to aRect.
Definition at line 44 of file ChatServiceAdvertiser.cpp. References CChatServiceAdvertiser(). Referenced by NewL(). 00045 { 00046 CChatServiceAdvertiser* self = new ( ELeave ) CChatServiceAdvertiser(); 00047 CleanupStack::PushL( self ); 00048 self->ConstructL(); 00049 return self; 00050 }
|
|
||||||||||||
|
BuildProtocolDescriptionL() Builds the protocol description
Implements CChatBtServiceAdvertiser. Definition at line 90 of file ChatServiceAdvertiser.cpp. 00091 { 00092 TBuf8<1> channel; 00093 channel.Append( ( TChar )aPort ); 00094 00095 aProtocolDescriptor 00096 ->StartListL() 00097 ->BuildDESL() 00098 ->StartListL() // Details of lowest level protocol 00099 ->BuildUUIDL( KL2CAP ) 00100 ->EndListL() 00101 00102 ->BuildDESL() 00103 ->StartListL() 00104 ->BuildUUIDL( KRFCOMM ) 00105 ->BuildUintL( channel ) 00106 ->EndListL() 00107 ->EndListL(); 00108 }
|
|
Implements CChatBtServiceAdvertiser. Definition at line 132 of file ChatServiceAdvertiser.cpp.
|
|
Implements CChatBtServiceAdvertiser. Definition at line 114 of file ChatServiceAdvertiser.cpp. References iServiceName. 00115 { 00116 return *iServiceName; 00117 }
|
|
Implements CChatBtServiceAdvertiser. Definition at line 123 of file ChatServiceAdvertiser.cpp. References iServiceDescription. 00124 { 00125 return *iServiceDescription; 00126 }
|
|
|
ConstructL() 2nd phase construction of this object Definition at line 78 of file ChatServiceAdvertiser.cpp. References iServiceDescription, and iServiceName. 00079 { 00080 iServiceName = StringLoader::LoadL ( R_CHAT_SERVICE_NAME ); 00081 iServiceDescription = StringLoader::LoadL ( R_CHAT_SERVICE_DESCRIPTION ); 00082 }
|
|
|
StartAdvertisingL Start the advertising of this service
Definition at line 75 of file ChatBtServiceAdvertiser.cpp. References CChatBtServiceAdvertiser::BuildProtocolDescriptionL(), CChatBtServiceAdvertiser::ConnectL(), CChatBtServiceAdvertiser::iIsConnected, CChatBtServiceAdvertiser::iRecord, CChatBtServiceAdvertiser::IsAdvertising(), CChatBtServiceAdvertiser::iSdpDatabase, CChatBtServiceAdvertiser::ServiceClass(), CChatBtServiceAdvertiser::ServiceDescription(), CChatBtServiceAdvertiser::ServiceName(), and CChatBtServiceAdvertiser::StopAdvertisingL(). Referenced by CChatBt::StartL(). 00076 { 00077 if ( IsAdvertising() ) 00078 { 00079 // could be advertising on a different port 00080 StopAdvertisingL(); 00081 } 00082 if ( ! iIsConnected ) 00083 { 00084 ConnectL(); 00085 } 00086 iSdpDatabase.CreateServiceRecordL( ServiceClass(), iRecord ); 00087 00088 // add a Protocol to the record 00089 CSdpAttrValueDES* vProtocolDescriptor = CSdpAttrValueDES::NewDESL( NULL ); 00090 CleanupStack::PushL( vProtocolDescriptor ); 00091 00092 BuildProtocolDescriptionL( vProtocolDescriptor,aPort ); 00093 00094 iSdpDatabase.UpdateAttributeL( iRecord, KSdpAttrIdProtocolDescriptorList, 00095 *vProtocolDescriptor ); 00096 00097 CleanupStack::PopAndDestroy( vProtocolDescriptor ); 00098 00099 // Add a name to the record 00100 iSdpDatabase.UpdateAttributeL( iRecord, 00101 KSdpAttrIdBasePrimaryLanguage + 00102 KSdpAttrIdOffsetServiceName, 00103 ServiceName() ); 00104 00105 // Add a description to the record 00106 iSdpDatabase.UpdateAttributeL( iRecord, 00107 KSdpAttrIdBasePrimaryLanguage + 00108 KSdpAttrIdOffsetServiceDescription, 00109 ServiceDescription() ); 00110 00111 }
|
|
|
StopAdvertisingL Stop advertising this service. Remove the record from the sdp database Definition at line 146 of file ChatBtServiceAdvertiser.cpp. References CChatBtServiceAdvertiser::iRecord, CChatBtServiceAdvertiser::IsAdvertising(), and CChatBtServiceAdvertiser::iSdpDatabase. Referenced by CChatBtServiceAdvertiser::StartAdvertisingL(), CChatBt::StopL(), and CChatBtServiceAdvertiser::~CChatBtServiceAdvertiser(). 00147 { 00148 if ( IsAdvertising() ) 00149 { 00150 iSdpDatabase.DeleteRecordL( iRecord ); 00151 iRecord = 0; 00152 } 00153 }
|
|
|
IsAdvertising Does the SDP database contain a record for this service
Definition at line 160 of file ChatBtServiceAdvertiser.cpp. References CChatBtServiceAdvertiser::iRecord. Referenced by CChatBtServiceAdvertiser::StartAdvertisingL(), CChatBtServiceAdvertiser::StopAdvertisingL(), CChatBt::StopL(), and CChatBtServiceAdvertiser::~CChatBtServiceAdvertiser(). 00161 { 00162 return iRecord != 0; 00163 }
|
|
|
UpdateAvailabilityL Update the service availability field of the service record
Definition at line 118 of file ChatBtServiceAdvertiser.cpp. References CChatBtServiceAdvertiser::iRecord, CChatBtServiceAdvertiser::iRecordState, and CChatBtServiceAdvertiser::iSdpDatabase. Referenced by CChatBt::RunL(), and CChatBt::StartL(). 00119 { 00120 TUint state; 00121 if ( aIsAvailable ) 00122 { 00123 state = 0xFF; // Fully unused 00124 } 00125 else 00126 { 00127 state = 0x00; // Fully used -> can't connect 00128 } 00129 00130 // Update the availibility attribute field 00131 iSdpDatabase.UpdateAttributeL( iRecord, 00132 KSdpAttrIdServiceAvailability, 00133 state ); 00134 00135 // Mark the record as changed - by increasing its state number (version) 00136 iSdpDatabase.UpdateAttributeL( iRecord, 00137 KSdpAttrIdServiceRecordState, 00138 ++iRecordState ); 00139 }
|
|
|
iServiceName Owned by CChatServiceAdvertiser Definition at line 108 of file ChatServiceAdvertiser.h. Referenced by ConstructL(), ServiceName(), and ~CChatServiceAdvertiser(). |
|
|
iServiceDescription Owned by CChatServiceAdvertiser Definition at line 114 of file ChatServiceAdvertiser.h. Referenced by ConstructL(), ServiceDescription(), and ~CChatServiceAdvertiser(). |
|
© Nokia 2009 |