|
S60 3rd Edition SDK for Symbian OS Example Applications Guide |
00001 /* 00002 * ============================================================================== 00003 * Name : ChatBtAdvertiser.h 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 #ifndef CHATBTSERVICEADVERTISER_H 00017 #define CHATBTSERVICEADVERTISER_H 00018 00019 // INCLUDES 00020 #include <e32base.h> 00021 #include <btsdp.h> 00022 #include <StringLoader.h> 00023 00024 #include "ChatBtServiceAdvertiser.h" 00025 00026 // CLASS DECLARATIONS 00027 00028 /** 00029 * CChatBtServiceAdvertiser 00030 * Advertises a service in the SDP database. 00031 */ 00032 class CChatBtServiceAdvertiser : public CBase 00033 { 00034 public: // Destructor 00035 00036 /** 00037 * ~CChatBtServiceAdvertiser 00038 * Destroy the object, close all open handles and remove 00039 * the advertised service. 00040 */ 00041 virtual ~CChatBtServiceAdvertiser(); 00042 00043 public: // New functions 00044 /** 00045 * StartAdvertisingL 00046 * Start the advertising of this service 00047 * @param aPort the port being used by the service 00048 */ 00049 void StartAdvertisingL( TInt aPort ); 00050 00051 /** 00052 * StopAdvertisingL 00053 * Stop advertising this service. Remove the record 00054 * from the sdp database 00055 */ 00056 void StopAdvertisingL(); 00057 00058 /** 00059 * IsAdvertising 00060 * Does the SDP database contain a record for this service 00061 * @return ETrue whether the service is being advertised 00062 */ 00063 TBool IsAdvertising(); 00064 00065 /** 00066 * UpdateAvailabilityL 00067 * Update the service availability field of the service record 00068 * @param aIsAvailable ETrue is the service is not busy. 00069 */ 00070 void UpdateAvailabilityL( TBool aIsAvailable ); 00071 00072 protected: // New functions 00073 00074 /** 00075 * CChatBtServiceAdvertiser 00076 * Construct this object 00077 */ 00078 CChatBtServiceAdvertiser(); 00079 00080 /** 00081 * BuildProtocolDescriptionL 00082 * Builds the protocol description 00083 * @param aProtocolDescriptor the protocol descriptor 00084 * @param aPort the service port 00085 */ 00086 virtual void BuildProtocolDescriptionL( 00087 CSdpAttrValueDES* aProtocolDescriptor, TInt aPort ) = 0; 00088 00089 /** 00090 * ServiceClass 00091 * @return the service class 00092 */ 00093 virtual TInt ServiceClass() = 0; 00094 00095 /** 00096 * ServiceName 00097 * @return the service name 00098 */ 00099 virtual const TDesC& ServiceName() = 0; 00100 00101 /** 00102 * ServiceDescription 00103 * @return the service description 00104 */ 00105 virtual const TDesC& ServiceDescription() = 0; 00106 00107 private: // Function from base classes 00108 00109 /** 00110 * ConnectL 00111 * Connect to the SDP database 00112 */ 00113 void ConnectL(); 00114 00115 private: // data 00116 00117 /** 00118 * iSdpSession 00119 * a handle to the SDP session 00120 */ 00121 RSdp iSdpSession; 00122 00123 /** 00124 * iSdpDatabase 00125 * a connection to the SDP database 00126 */ 00127 RSdpDatabase iSdpDatabase; 00128 00129 /** 00130 * iRecord 00131 * the record handle of the service record for this server 00132 */ 00133 TSdpServRecordHandle iRecord; 00134 00135 /** 00136 * iRecordState 00137 * the current record state - change number 00138 */ 00139 TInt iRecordState; 00140 00141 /** 00142 * iIsConnected 00143 * has a connection been made to the SDP Database 00144 */ 00145 TBool iIsConnected; 00146 }; 00147 00148 #endif // CHATBTSERVICEADVERTISER_H 00149 00150 // End of File
|
© Nokia 2006 |