syncmlfw/common/obex/obexclient/inc/NSmlBTServiceSearcher.h
changeset 0 b497e44ab2fc
child 25 b183ec05bd8c
equal deleted inserted replaced
-1:000000000000 0:b497e44ab2fc
       
     1 /*
       
     2 * Copyright (c) 2002 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:  SyncML Obex client
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __NSMLBTSERVICESEARCHER_H__
       
    20 #define __NSMLBTSERVICESEARCHER_H__
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <bttypes.h>
       
    24 #include <btextnotifiers.h>
       
    25 #include <e32std.h>
       
    26 
       
    27 #include "NSmlSdpAttributeParser.h"
       
    28 #include "NSmlSdpAttributeNotifier.h"
       
    29 #include "Btconninfo.h"
       
    30 
       
    31 /** BTServiceSearcher application panic codes */
       
    32 enum TBTServiceSearcherPanics 
       
    33     {
       
    34     EBTServiceSearcherNextRecordRequestComplete = 1,
       
    35     EBTServiceSearcherAttributeRequestResult,
       
    36     EBTServiceSearcherAttributeRequestComplete,
       
    37     EBTServiceSearcherInvalidControlIndex,
       
    38     EBTServiceSearcherProtocolRead,
       
    39     EBTServiceSearcherAttributeRequest,
       
    40     EBTServiceSearcherSdpRecordDelete
       
    41     };
       
    42 
       
    43 inline void Panic(TBTServiceSearcherPanics aReason)
       
    44     { 
       
    45     User::Panic(_L("ServiceSearcher"), aReason);
       
    46     }
       
    47 
       
    48 
       
    49 class CNSmlBTServiceSearcher : public CBase,
       
    50                            public MSdpAgentNotifier,
       
    51                            public MSdpAttributeNotifier
       
    52     {
       
    53 public:
       
    54     virtual ~CNSmlBTServiceSearcher();
       
    55     void SelectDeviceByDiscoveryL( TRequestStatus& aObserverRequestStatus );
       
    56     void FindServiceL( TRequestStatus& iObserverRequestStatus );
       
    57 
       
    58     const TBTDevAddr& BTDevAddr();
       
    59 
       
    60     const TBTDeviceResponseParams& ResponseParams();
       
    61 
       
    62 protected:
       
    63     CNSmlBTServiceSearcher( const TBTConnInfo& aBTConnInfo );
       
    64     virtual void Finished( TInt aError = KErrNone );
       
    65     virtual TBool HasFinishedSearching() const;
       
    66     TBool HasFoundService() const;
       
    67 
       
    68 protected: // abstract methods
       
    69     virtual const TSdpAttributeParser::TSdpAttributeList& ProtocolList() const = 0;
       
    70     virtual void FoundElementL( TInt aKey, CSdpAttrValue& aValue ) = 0;
       
    71 
       
    72 public: // from MSdpAgentNotifier
       
    73     void NextRecordRequestComplete( TInt aError, TSdpServRecordHandle aHandle, TInt aTotalRecordsCount );
       
    74     void AttributeRequestResult( TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID, CSdpAttrValue* aAttrValue );
       
    75     void AttributeRequestComplete( TSdpServRecordHandle aHandle, TInt aError );
       
    76 
       
    77 private:
       
    78     void NextRecordRequestCompleteL( TInt aError, TSdpServRecordHandle aHandle, TInt aTotalRecordsCount );
       
    79     void AttributeRequestResultL( TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID, CSdpAttrValue* aAttrValue );
       
    80     void AttributeRequestCompleteL( TSdpServRecordHandle, TInt aError );
       
    81 
       
    82 private:
       
    83     TRequestStatus* iStatusObserver;    
       
    84     TBool iIsDeviceSelectorConnected;
       
    85     RNotifier iDeviceSelector;
       
    86     TBTDeviceResponseParamsPckg iResponse;
       
    87     CSdpAgent* iAgent;
       
    88     CSdpSearchPattern* iSdpSearchPattern;
       
    89     TBool iHasFoundService;
       
    90 	TBTConnInfo iBTConnInfo;
       
    91     };
       
    92 
       
    93 #endif // __NSMLBTSERVICESEARCHER_H__
       
    94