bluetoothcommsprofiles/btpan/inc/panhelper.h
changeset 0 29b1cd4cb562
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @note PAN helper server client API
       
    19  @internalTechnology
       
    20 */
       
    21 
       
    22 #ifndef PANHELPER_H
       
    23 #define PANHELPER_H
       
    24 
       
    25 #include <e32std.h>
       
    26 #include <e32base.h>
       
    27 #include <es_sock.h>
       
    28 #include <bt_sock.h>
       
    29 #include "pancommon.h"
       
    30 #include "panprog.h"
       
    31 
       
    32 
       
    33 namespace PanHelper
       
    34 {
       
    35 
       
    36 _LIT(KPanHelperName, "PANHelper");
       
    37 
       
    38 enum TPanHelperPanic
       
    39 /**
       
    40 Panic helper server panic codes
       
    41 @internalComponent
       
    42 */
       
    43 	{
       
    44 	EInvalidIapId,
       
    45 	ENullSdpAttrValue,								//< The SDP query returned a NULL SDP attribute value record
       
    46 	ESecondQueryWhileFirstStillActive, //< A second SDP query was initiated while the first was still active
       
    47 	};
       
    48 
       
    49 void PanHelperPanic(TPanHelperPanic aPanicCode);
       
    50 
       
    51 /** 
       
    52 Flags for support of various roles
       
    53 @see TPanDeviceRolesList
       
    54 @internalComponent
       
    55 */
       
    56 //@{
       
    57 const TUint KPanDeviceRolesListNone	  = 0x00;
       
    58 const TUint KPanDeviceRolesListPanU   = 0x01;
       
    59 const TUint KPanDeviceRolesListPanGn  = 0x02;
       
    60 const TUint KPanDeviceRolesListPanNap = 0x04;
       
    61 const TUint KPanDeviceRolesListAll	  = KPanDeviceRolesListPanU | KPanDeviceRolesListPanGn | KPanDeviceRolesListPanNap;
       
    62 //@}
       
    63 
       
    64 NONSHARABLE_CLASS(TPanDeviceRolesList)
       
    65 /**
       
    66 PAN roles array, to provide an easy way of passing around which roles a remote device supports
       
    67 @internalTechnology
       
    68 @released
       
    69 */
       
    70 	{	
       
    71 public:
       
    72 
       
    73 	IMPORT_C TPanDeviceRolesList();
       
    74 	
       
    75 	IMPORT_C TBool SupportsU() const;
       
    76 	IMPORT_C TBool SupportsGn() const;
       
    77 	IMPORT_C TBool SupportsNap() const;
       
    78 	
       
    79 	IMPORT_C void SetSupportsU();
       
    80 	IMPORT_C void SetSupportsU(TBool aSupportsU);
       
    81 	IMPORT_C void SetSupportsGn();
       
    82 	IMPORT_C void SetSupportsGn(TBool aSupportsGn);
       
    83 	IMPORT_C void SetSupportsNap();
       
    84 	IMPORT_C void SetSupportsNap(TBool aSupportsNap);
       
    85 
       
    86 	IMPORT_C TBool IsSupported(TBluetoothPanRole aPanRole) const;
       
    87 
       
    88 private:
       
    89 	TInt iSupportedRoles;
       
    90 	};
       
    91 	
       
    92 NONSHARABLE_CLASS(TPanDeviceWorthTryingRolesList)
       
    93 /**
       
    94 PAN roles array, to provide an easy way of passing around which roles are worth trying with a remote device
       
    95 @internalTechnology
       
    96 @released
       
    97 */
       
    98 	{	
       
    99 public:
       
   100 
       
   101 	IMPORT_C TPanDeviceWorthTryingRolesList();
       
   102 
       
   103 	IMPORT_C TBool IsWorthTryingU() const;
       
   104 	IMPORT_C TBool IsWorthTryingGn() const;
       
   105 	IMPORT_C TBool IsWorthTryingNap() const;
       
   106 	
       
   107 	IMPORT_C void SetWorthTrying(TBluetoothPanRole aPanRole, TBool aWorthTrying);
       
   108 
       
   109 	IMPORT_C void SetWorthTryingU();
       
   110 	IMPORT_C void SetWorthTryingU(TBool aWorthTryingU);
       
   111 	IMPORT_C void SetWorthTryingGn();
       
   112 	IMPORT_C void SetWorthTryingGn(TBool aWorthTryingGn);
       
   113 	IMPORT_C void SetWorthTryingNap();
       
   114 	IMPORT_C void SetWorthTryingNap(TBool aWorthTryingNap);
       
   115 
       
   116 	IMPORT_C TBool IsWorthTryingARole(TBluetoothPanRole aPanRole) const;
       
   117 	IMPORT_C void ResetWorthTryingRoles();
       
   118 
       
   119 private:
       
   120 	TInt iWorthTryingRoles;
       
   121 	};
       
   122 	
       
   123 	
       
   124 class CPanHelperRemoteSdpQuerier;
       
   125 NONSHARABLE_CLASS(RPanRemoteSdpQuerier) 
       
   126 /**
       
   127 Client side of PAN SDP query engine, for looking up SDP records on remote devices
       
   128 @internalTechnology
       
   129 @released
       
   130 */
       
   131 	{
       
   132 public:
       
   133 	IMPORT_C TInt Open();
       
   134 	IMPORT_C void Close();
       
   135 		
       
   136 	IMPORT_C TInt Query(const TBTDevAddr& aAddr, TDes8& aSupportedRemoteRoles, TRequestStatus& aStatus);
       
   137 	IMPORT_C void CancelQuery();
       
   138 
       
   139 private:
       
   140 	CPanHelperRemoteSdpQuerier* iSdpQuerier;
       
   141 	};
       
   142 	
       
   143 class CPanHelperDeviceDiscoverer;
       
   144 NONSHARABLE_CLASS(RPanRemoteDeviceDiscoverer) 
       
   145 /**
       
   146 Client side of remote device discovery engine, for discovering which devices are around us and
       
   147 selecting one from the supplied list
       
   148 @internalTechnology
       
   149 @released
       
   150 */
       
   151 	{
       
   152 public:
       
   153 	IMPORT_C TInt Open();
       
   154 	IMPORT_C void Close();
       
   155 		
       
   156 	IMPORT_C void FindDevice(TDesC& aDeviceAddrList, TDes8& aDeviceAddr, TRequestStatus& aStatus);
       
   157 	IMPORT_C void CancelFindDevice();
       
   158 
       
   159 private:
       
   160 	CPanHelperDeviceDiscoverer* iDeviceDiscoverer;
       
   161 	};
       
   162 	
       
   163 } // PanHelper
       
   164 
       
   165 #endif // PANHELPER_H