|
S60 3rd Edition SDK for Symbian OS Example Applications Guide |
00001 /* 00002 * ============================================================================== 00003 * Name : ChatServiceAdverticer.cpp 00004 * Part of : Chat 00005 * Interface : 00006 * Description : 00007 * Version : 00008 * 00009 * Copyright (c) 2005-2006 Nokia Corporation. 00010 * This material, including documentation and any related 00011 * computer programs, is protected by copyright controlled by 00012 * Nokia Corporation. 00013 * ============================================================================== 00014 */ 00015 00016 // INCLUDE FILES 00017 #include <bt_sock.h> 00018 #include <StringLoader.h> 00019 #include <ChatEx.rsg> 00020 00021 #include "ChatServiceAdvertiser.h" 00022 #include "ChatProtocolConstants.h" 00023 00024 00025 // ============================ MEMBER FUNCTIONS ============================== 00026 00027 // ---------------------------------------------------------------------------- 00028 // CChatServiceAdvertiser::NewL() 00029 // Two-phased constructor. 00030 // ---------------------------------------------------------------------------- 00031 // 00032 CChatServiceAdvertiser* CChatServiceAdvertiser::NewL() 00033 { 00034 CChatServiceAdvertiser* self = CChatServiceAdvertiser::NewLC(); 00035 CleanupStack::Pop( self ); 00036 return self; 00037 } 00038 00039 // ---------------------------------------------------------------------------- 00040 // CChatServiceAdvertiser::NewLC() 00041 // Two-phased constructor. 00042 // ---------------------------------------------------------------------------- 00043 // 00044 CChatServiceAdvertiser* CChatServiceAdvertiser::NewLC() 00045 { 00046 CChatServiceAdvertiser* self = new ( ELeave ) CChatServiceAdvertiser(); 00047 CleanupStack::PushL( self ); 00048 self->ConstructL(); 00049 return self; 00050 } 00051 00052 // ---------------------------------------------------------------------------- 00053 // CChatServiceAdvertiser::CChatServiceAdvertiser() 00054 // Constructor. 00055 // ---------------------------------------------------------------------------- 00056 // 00057 CChatServiceAdvertiser::CChatServiceAdvertiser() 00058 { 00059 // No implementation required 00060 } 00061 00062 // ---------------------------------------------------------------------------- 00063 // CChatServiceAdvertiser::~CChatServiceAdvertiser() 00064 // Destructor. 00065 // ---------------------------------------------------------------------------- 00066 // 00067 CChatServiceAdvertiser::~CChatServiceAdvertiser() 00068 { 00069 delete iServiceName; 00070 delete iServiceDescription; 00071 } 00072 00073 // ---------------------------------------------------------------------------- 00074 // CChatServiceAdvertiser::ConstructL() 00075 // Perform second phase construction of this object. 00076 // ---------------------------------------------------------------------------- 00077 // 00078 void CChatServiceAdvertiser::ConstructL() 00079 { 00080 iServiceName = StringLoader::LoadL ( R_CHAT_SERVICE_NAME ); 00081 iServiceDescription = StringLoader::LoadL ( R_CHAT_SERVICE_DESCRIPTION ); 00082 } 00083 00084 // ----------------------------------------------------------------------------- 00085 // CMessageServiceAdvertiser::BuildProtocolDescriptionL() 00086 // Builds the protocol description. 00087 // ----------------------------------------------------------------------------- 00088 // 00089 void CChatServiceAdvertiser 00090 ::BuildProtocolDescriptionL( CSdpAttrValueDES* aProtocolDescriptor, TInt aPort ) 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 } 00109 00110 // ---------------------------------------------------------------------------- 00111 // CChatServiceAdvertiser::ServiceName() 00112 // ---------------------------------------------------------------------------- 00113 // 00114 const TDesC& CChatServiceAdvertiser::ServiceName() 00115 { 00116 return *iServiceName; 00117 } 00118 00119 // ---------------------------------------------------------------------------- 00120 // CChatServiceAdvertiser::ServiceDescription() 00121 // ---------------------------------------------------------------------------- 00122 // 00123 const TDesC& CChatServiceAdvertiser::ServiceDescription() 00124 { 00125 return *iServiceDescription; 00126 } 00127 00128 // ---------------------------------------------------------------------------- 00129 // CChatServiceAdvertiser::ServiceClass() 00130 // ---------------------------------------------------------------------------- 00131 // 00132 TInt CChatServiceAdvertiser::ServiceClass() 00133 { 00134 return KServiceClass; 00135 } 00136 00137 // End of File
|
© Nokia 2006 |