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

Definition at line 29 of file ChatServiceSearcher.h.
Public Member Functions |
|
| virtual | ~CChatServiceSearcher () |
| TInt | Port () |
| void | SelectDeviceByDiscoveryL (TRequestStatus &aObserverRequestStatus) |
| void | FindServiceL (TRequestStatus &aObserverRequestStatus) |
| const TBTDevAddr & | BTDevAddr () |
| const TBTDeviceResponseParams & | ResponseParams () |
| void | NextRecordRequestComplete (TInt aError, TSdpServRecordHandle aHandle, TInt aTotalRecordsCount) |
| void | AttributeRequestResult (TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID, CSdpAttrValue *aAttrValue) |
| void | AttributeRequestComplete (TSdpServRecordHandle aHandle, TInt aError) |
Static Public Member Functions |
|
| static CChatServiceSearcher * | NewL (MLog &aLog) |
| static CChatServiceSearcher * | NewLC (MLog &aLog) |
Protected Member Functions |
|
| const TUUID & | ServiceClass () const |
| virtual void | FoundElementL (TInt aKey, CSdpAttrValue &aValue) |
| RArray< TChatSdpAttributeParser::TChatSdpAttributeNode > & | ProtocolList () |
| virtual void | Finished (TInt aError=KErrNone) |
| virtual TBool | HasFinishedSearching () const |
| TBool | HasFoundService () const |
Private Member Functions |
|
| CChatServiceSearcher (MLog &aLog) | |
| void | ConstructL () |
Private Attributes |
|
| TUUID | iServiceClass |
| TInt | iPort |
| RArray< TChatSdpAttributeParser::TChatSdpAttributeNode > | iProtocolArray |
|
|
~CMessageServiceSearcher() Destroy the object and release all memory objects. Definition at line 66 of file ChatServiceSearcher.cpp. References iProtocolArray. 00067 { 00068 iProtocolArray.Close(); 00069 }
|
|
|
CChatServiceSearcher() Constructs this object
Definition at line 54 of file ChatServiceSearcher.cpp. Referenced by NewLC(). 00055 : CChatBtServiceSearcher( aLog ), 00056 iServiceClass( KServiceClass ), 00057 iPort( -1 ) 00058 { 00059 }
|
|
|
NewLC() Create a CChatServiceSearcher object
Definition at line 41 of file ChatServiceSearcher.cpp. References CChatServiceSearcher(). Referenced by NewL(). 00042 { 00043 CChatServiceSearcher* self = new ( ELeave ) CChatServiceSearcher( aLog ); 00044 CleanupStack::PushL( self ); 00045 self->ConstructL(); 00046 return self; 00047 }
|
|
|
Port() Retrieve the port on which the service is installed
Definition at line 159 of file ChatServiceSearcher.cpp. References iPort. Referenced by CChatBt::ConnectToServerL(). 00160 { 00161 return iPort; 00162 }
|
|
Implements CChatBtServiceSearcher. Definition at line 86 of file ChatServiceSearcher.cpp. References iServiceClass. 00087 { 00088 return iServiceClass; 00089 }
|
|
||||||||||||
|
FoundElementL() Read the data element
Implements CChatBtServiceSearcher. Definition at line 147 of file ChatServiceSearcher.cpp. References iPort. 00148 { 00149 __ASSERT_ALWAYS( aKey == static_cast<TInt>( KRfcommChannel ), 00150 Panic( EChatBtServiceSearcherProtocolRead ) ); 00151 iPort = aValue.Uint(); 00152 }
|
|
Implements CChatBtServiceSearcher. Definition at line 97 of file ChatServiceSearcher.cpp. References TChatSdpAttributeParser::TChatSdpAttributeNode::SetCommand(), TChatSdpAttributeParser::TChatSdpAttributeNode::SetType(), and TChatSdpAttributeParser::TChatSdpAttributeNode::SetValue(). 00098 { 00099 TChatSdpAttributeParser::TChatSdpAttributeNode attrib; 00100 attrib.SetCommand( TChatSdpAttributeParser::ECheckType ); 00101 attrib.SetType( ETypeDES ); 00102 iProtocolArray.Append( attrib ); 00103 00104 attrib.SetCommand( TChatSdpAttributeParser::ECheckType ); 00105 attrib.SetType( ETypeDES ); 00106 iProtocolArray.Append( attrib ); 00107 00108 attrib.SetCommand( TChatSdpAttributeParser::ECheckValue ); 00109 attrib.SetType( ETypeUUID ); 00110 attrib.SetValue( KL2CAP ); 00111 iProtocolArray.Append( attrib ); 00112 00113 attrib.SetCommand( TChatSdpAttributeParser::ECheckEnd ); 00114 iProtocolArray.Append( attrib ); 00115 00116 attrib.SetCommand( TChatSdpAttributeParser::ECheckType ); 00117 attrib.SetType( ETypeDES ); 00118 iProtocolArray.Append( attrib ); 00119 00120 attrib.SetCommand( TChatSdpAttributeParser::ECheckValue ); 00121 attrib.SetType( ETypeUUID ); 00122 attrib.SetValue( KRFCOMM ); 00123 iProtocolArray.Append( attrib ); 00124 00125 attrib.SetCommand( TChatSdpAttributeParser::EReadValue ); 00126 attrib.SetType( ETypeUint ); 00127 attrib.SetValue( KRfcommChannel ); 00128 iProtocolArray.Append( attrib ); 00129 00130 attrib.SetCommand( TChatSdpAttributeParser::ECheckEnd ); 00131 iProtocolArray.Append( attrib ); 00132 00133 attrib.SetCommand( TChatSdpAttributeParser::ECheckEnd ); 00134 iProtocolArray.Append( attrib ); 00135 00136 attrib.SetCommand( TChatSdpAttributeParser::EFinished ); 00137 iProtocolArray.Append( attrib ); 00138 00139 return iProtocolArray; 00140 }
|
|
|
ConstructL() Performs second phase construction of this object Definition at line 76 of file ChatServiceSearcher.cpp.
|
|
|
SelectDeviceByDiscoveryL() Select a device
Definition at line 59 of file ChatBtServiceSearcher.cpp. References CChatBtServiceSearcher::iDeviceSelector, CChatBtServiceSearcher::iIsDeviceSelectorConnected, CChatBtServiceSearcher::iResponse, CChatBtServiceSearcher::iSelectionFilter, and CChatBtServiceSearcher::ServiceClass(). Referenced by CChatBt::ConnectL(). 00061 { 00062 if ( ! iIsDeviceSelectorConnected ) 00063 { 00064 User::LeaveIfError( iDeviceSelector.Connect() ); 00065 iIsDeviceSelectorConnected = ETrue; 00066 } 00067 00068 00069 iSelectionFilter().SetUUID( ServiceClass() ); 00070 00071 iDeviceSelector.StartNotifierAndGetResponse( 00072 aObserverRequestStatus, 00073 KDeviceSelectionNotifierUid, 00074 iSelectionFilter, 00075 iResponse ); 00076 }
|
|
|
FindServiceL() Find a service on the specified device
Definition at line 83 of file ChatBtServiceSearcher.cpp. References CChatBtServiceSearcher::BTDevAddr(), CChatBtServiceSearcher::iAgent, CChatBtServiceSearcher::iHasFoundService, CChatBtServiceSearcher::iResponse, CChatBtServiceSearcher::iSdpSearchPattern, CChatBtServiceSearcher::iStatusObserver, and CChatBtServiceSearcher::ServiceClass(). Referenced by CChatBt::RunL(). 00084 { 00085 if ( !iResponse().IsValidBDAddr() ) 00086 { 00087 User::Leave( KErrNotFound ); 00088 } 00089 iHasFoundService = EFalse; 00090 00091 // delete any existing agent and search pattern 00092 delete iSdpSearchPattern; 00093 iSdpSearchPattern = NULL; 00094 00095 delete iAgent; 00096 iAgent = NULL; 00097 00098 iAgent = CSdpAgent::NewL( *this, BTDevAddr() ); 00099 00100 iSdpSearchPattern = CSdpSearchPattern::NewL(); 00101 00102 iSdpSearchPattern->AddL( ServiceClass() ); 00103 // return code is the position in the list that the UUID is inserted at 00104 // and is intentionally ignored 00105 00106 iAgent->SetRecordFilterL( *iSdpSearchPattern ); 00107 00108 iStatusObserver = &aObserverRequestStatus; 00109 00110 iAgent->NextRecordRequestL(); 00111 }
|
|
Definition at line 289 of file ChatBtServiceSearcher.cpp. References CChatBtServiceSearcher::iResponse. Referenced by CChatBt::ConnectToServerL(), and CChatBtServiceSearcher::FindServiceL(). 00290 { 00291 return iResponse().BDAddr(); 00292 }
|
|
Definition at line 299 of file ChatBtServiceSearcher.cpp. References CChatBtServiceSearcher::iResponse. Referenced by CChatBt::RunL(). 00300 { 00301 return iResponse(); 00302 }
|
|
|
Finished() The search has finished. Notify the observer that the process is complete. Definition at line 265 of file ChatBtServiceSearcher.cpp. References CChatBtServiceSearcher::HasFoundService(), and CChatBtServiceSearcher::iStatusObserver. Referenced by CChatBtServiceSearcher::AttributeRequestCompleteL(), and CChatBtServiceSearcher::NextRecordRequestCompleteL(). 00266 { 00267 if ( aError == KErrNone && !HasFoundService() ) 00268 { 00269 aError = KErrNotFound; 00270 } 00271 User::RequestComplete( iStatusObserver, aError ); 00272 }
|
|
|
HasFinishedSearching() Is the instance still wanting to search.
Definition at line 279 of file ChatBtServiceSearcher.cpp. Referenced by CChatBtServiceSearcher::AttributeRequestCompleteL().
|
|
Definition at line 309 of file ChatBtServiceSearcher.cpp. References CChatBtServiceSearcher::iHasFoundService. Referenced by CChatBtServiceSearcher::Finished(). 00310 { 00311 return iHasFoundService; 00312 }
|
|
||||||||||||||||
|
NextRecordRequestComplete() Process the result of the next record request
Definition at line 118 of file ChatBtServiceSearcher.cpp. References CChatBtServiceSearcher::NextRecordRequestCompleteL(). 00122 { 00123 TRAPD( error, 00124 NextRecordRequestCompleteL( aError, aHandle, aTotalRecordsCount ) ); 00125 00126 if ( error != KErrNone ) 00127 { 00128 Panic( EChatBtServiceSearcherNextRecordRequestComplete ); 00129 } 00130 }
|
|
||||||||||||||||
|
AttributeRequestResult() Process the next attribute requested
Definition at line 174 of file ChatBtServiceSearcher.cpp. References CChatBtServiceSearcher::AttributeRequestResultL(). 00178 { 00179 TRAPD( error, AttributeRequestResultL( aHandle, aAttrID, aAttrValue ) ); 00180 if ( error != KErrNone ) 00181 { 00182 Panic( EChatBtServiceSearcherAttributeRequestResult ); 00183 } 00184 // Delete obsolete local atribute pointer. 00185 delete aAttrValue; 00186 aAttrValue = NULL; 00187 }
|
|
||||||||||||
|
AttributeRequestComplete() Process the arrtibute request completion
Definition at line 218 of file ChatBtServiceSearcher.cpp. References CChatBtServiceSearcher::AttributeRequestCompleteL(). 00220 { 00221 TRAPD( error, AttributeRequestCompleteL( aHandle, aError ) ); 00222 if ( error != KErrNone ) 00223 { 00224 Panic( EChatBtServiceSearcherAttributeRequestComplete ); 00225 } 00226 }
|
|
|
iServiceClass the service class UUID to search for Definition at line 110 of file ChatServiceSearcher.h. Referenced by ServiceClass(). |
|
|
iPort the port number that the remote service is installed Definition at line 116 of file ChatServiceSearcher.h. Referenced by FoundElementL(), and Port(). |
|
|
iProtocolArray the attribute list Definition at line 122 of file ChatServiceSearcher.h. Referenced by ~CChatServiceSearcher(). |
|
© Nokia 2009 |