ncdengine/debuglogger/obex/inc/btservicesearcher.h
changeset 0 ba25891c3a9e
child 25 7333d7932ef7
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __BTSERVICESEARCHER_H__
       
    20 #define __BTSERVICESEARCHER_H__
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <bttypes.h>
       
    24 #include <btextnotifiers.h>
       
    25 
       
    26 #include "SdpAttributeParser.h"
       
    27 #include "SdpAttributeNotifier.h"
       
    28 
       
    29 
       
    30 /*! 
       
    31   @class CBTServiceSearcher
       
    32   
       
    33   @discussion Searches for a service on a remote machine
       
    34   */
       
    35 
       
    36 class CBTServiceSearcher : public CBase,
       
    37                            public MSdpAgentNotifier,
       
    38                            public MSdpAttributeNotifier
       
    39     {
       
    40 public:
       
    41 /*!
       
    42   @function ~CBTServiceSearcher
       
    43   
       
    44   @discussion Destroy the object and release all memory objects
       
    45   */
       
    46     ~CBTServiceSearcher();
       
    47 
       
    48 
       
    49 /*!
       
    50   @function Cancel
       
    51   
       
    52   @discussion Cancel any outstanding requests    
       
    53   */
       
    54   void Cancel();
       
    55 
       
    56 /*!
       
    57   @function SelectDeviceByDiscoveryL
       
    58   
       
    59   @discussion Select a device
       
    60   @param aObserverRequestStatus the observer that is to be notified when the device selection is complete
       
    61   */
       
    62     void SelectDeviceByDiscoveryL(TRequestStatus& aObserverRequestStatus);
       
    63     
       
    64 /*!
       
    65   @function FindServiceL
       
    66   
       
    67   @discussion Find a service on the specified device
       
    68   @param aObserverRequestStatus the observer that is to be notified when the service search is complete
       
    69   */    
       
    70     void FindServiceL(TRequestStatus& iObserverRequestStatus);
       
    71 
       
    72 /*!
       
    73   @function BTDevAddr
       
    74   
       
    75   @result the bluetooth device address
       
    76   */    
       
    77     const TBTDevAddr& BTDevAddr();
       
    78 
       
    79 /*!
       
    80   @function ResponseParams
       
    81   
       
    82   @result Information about the device selected by the user
       
    83   */
       
    84     const TBTDeviceResponseParams& ResponseParams();
       
    85 
       
    86 protected:
       
    87 /*!
       
    88   @function CBTServiceSearcher
       
    89   
       
    90   @discussion Constructs this object
       
    91   */
       
    92     CBTServiceSearcher();
       
    93 
       
    94 /*!
       
    95   @function Finished
       
    96   
       
    97   @discussion The search has finished. Notify the observer that the process is complete.
       
    98   */
       
    99     virtual void Finished(TInt aError = KErrNone);
       
   100 
       
   101 /*!
       
   102   @function HasFinishedSearching
       
   103   
       
   104   @discussion Is the instance still wanting to search.
       
   105   @result EFalse if the instance wants searching to continue.
       
   106   */
       
   107     virtual TBool HasFinishedSearching() const;
       
   108 
       
   109 /*!
       
   110   @function HasFoundService
       
   111   
       
   112   @result ETrue if a service has been found
       
   113   */
       
   114     TBool HasFoundService() const;
       
   115 
       
   116 protected: // abstract methods
       
   117 
       
   118 /*!
       
   119   @function ProtocolList
       
   120   
       
   121   @discussion The list of Protocols required by the service.
       
   122   */
       
   123     virtual const TSdpAttributeParser::TSdpAttributeList& ProtocolList() const = 0;
       
   124 
       
   125 /*!
       
   126   @function ServiceClass
       
   127   
       
   128   @discussion The service class to search for
       
   129   @result the service class UUID
       
   130   */
       
   131     virtual const TUUID& ServiceClass() const = 0;
       
   132 
       
   133 /*!
       
   134   @function FoundElementL
       
   135   
       
   136   @discussion Read the data element
       
   137   @param aKey a key that identifies the element
       
   138   @param aValue the data element
       
   139   */
       
   140     virtual void FoundElementL(TInt aKey, CSdpAttrValue& aValue) = 0;
       
   141 
       
   142 public: // from MSdpAgentNotifier
       
   143 /*!
       
   144   @function NextRecordRequestComplete
       
   145   
       
   146   @discussion Process the result of the next record request
       
   147   @param aError the error code
       
   148   @param aHandle the handle of the service record
       
   149   @param aTotalRecordsCount the total number of matching service records
       
   150   */
       
   151     void NextRecordRequestComplete(TInt aError, TSdpServRecordHandle aHandle, TInt aTotalRecordsCount);
       
   152 
       
   153 /*!
       
   154   @function AttributeRequestResult
       
   155   
       
   156   @discussion Process the next attribute requested
       
   157   @param aHandle the handle of the service record
       
   158   @param aAttrID the id of the attribute
       
   159   @parma aAttrValue the value of the attribute
       
   160   */
       
   161     void AttributeRequestResult(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID, CSdpAttrValue* aAttrValue);
       
   162 
       
   163 /*!
       
   164   @function AttributeRequestComplete
       
   165   
       
   166   @discussion Process the arrtibute request completion
       
   167   @param aHandle the handle of the service record
       
   168   @param aError the error code
       
   169   */
       
   170     void AttributeRequestComplete(TSdpServRecordHandle aHandle, TInt aError);
       
   171 
       
   172 private:
       
   173 
       
   174 /*!
       
   175   @function NextRecordRequestCompleteL
       
   176   
       
   177   @discussion Process the result of the next record request
       
   178   @param aError the error code
       
   179   @param aHandle the handle of the service record
       
   180   @param aTotalRecordsCount the total number of matching service records
       
   181   */
       
   182     void NextRecordRequestCompleteL(TInt aError, TSdpServRecordHandle aHandle, TInt aTotalRecordsCount);
       
   183 
       
   184 /*!
       
   185   @function AttributeRequestResultL
       
   186   
       
   187   @discussion Process the next attribute requested
       
   188   @param aHandle the handle of the service record
       
   189   @param aAttrID the id of the attribute
       
   190   @parma aAttrValue the value of the attribute
       
   191   */
       
   192     void AttributeRequestResultL(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID, CSdpAttrValue* aAttrValue);
       
   193 
       
   194 /*!
       
   195   @function AttributeRequestCompleteL
       
   196   
       
   197   @discussion Process the arrtibute request completion
       
   198   @param aHandle the handle of the service record
       
   199   @param aError the error code
       
   200   */
       
   201     void AttributeRequestCompleteL(TSdpServRecordHandle, TInt aError);
       
   202 
       
   203 private:
       
   204     /*! @var iStatusObserver pointer to the request status observer */
       
   205     TRequestStatus* iStatusObserver;
       
   206     
       
   207     /*! @var iIsDeviceSelectorConnected is the device selector connected ? */
       
   208     TBool iIsDeviceSelectorConnected;
       
   209 
       
   210     /*! @var iDeviceSelector a handle to the bluetooth device selector notifier */
       
   211     RNotifier iDeviceSelector;
       
   212 
       
   213     /*! @var iResponse the response of the device selection */
       
   214     TBTDeviceResponseParamsPckg iResponse;
       
   215 
       
   216     /*! @var iAgent a connetction to the SDP client */
       
   217     CSdpAgent* iAgent;
       
   218 
       
   219     /*! @var iSdpSearchPattern a search pattern */
       
   220     CSdpSearchPattern* iSdpSearchPattern;
       
   221 
       
   222     /*! @var iHasFoundService has the service been found ? */
       
   223     TBool iHasFoundService;
       
   224 
       
   225     };
       
   226 
       
   227 #endif // __BTSERVICESEARCHER_H__
       
   228