⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 btdiscoverer.h

📁 Series_60_DP_1_0_2_0_Thread_And_Active_Objects_Example_v1_0 Symbian os S60线程与活动对象实例
💻 H
字号:
/*
* ============================================================================
*  Name     : CBTDiscoverer from BTDiscoverer.h
*  Part of  : ThreadAO
*  Created  : 12.1.2005 by Forum Nokia
*  Description:
*     Bluetooth class that searches for BT devices. Analyses names and 
*	  addresses of the devices. Converts 48-bit bluetooth address to 
*	  hexadecimal.
*  Version  : 1.0
*  Copyright: Nokia Corporation
* ============================================================================
*/

#ifndef __BT_DISCOVERER_H__
#define __BT_DISCOVERER_H__

//INCLUDES
#include <e32base.h>
#include <btsdp.h> 
#include <e32std.h>
#include <btextnotifiers.h> // TBTDeviceResponseParamsPckg
#include <bt_sock.h>
#include <BTDevice.h>
#include <es_sock.h> //RHostResolver
#include <badesca.h>


const TInt KBTDeviceLength = 40;
const TInt KBTDeviceAddress = 40; 

// FORWARD DECLARATIONS
class CSharedIntermediator;

// CLASS DECLARATION

/**
*  CBTDiscoverer Finds bluetooth devices. 
*/
class CBTDiscoverer: public CActive
	{
public:
	
/*!
 * NewL()
 * 
 * discussion Create new CBTDiscoverer object
 * param aSMediator Pointer to CSharedMediator.
 * return a pointer to the created instance of CBTDiscoverer
 */
    static CBTDiscoverer* NewL(CSharedIntermediator* aSMediator);
    
/*!
 * NewLC() 
 */
    static CBTDiscoverer* NewLC(CSharedIntermediator* aSMediator);

/*!
 * ~CBTDiscoverer()
 *
 * Destructor.
 */
	~CBTDiscoverer(void);
        
   // From CActive
   void RunL();
   TInt RunError(TInt aError);
   void DoCancel();

 /*!
 * void StartDiscoveringDevicesL()
 *
 * discussion Find all bluetooth devices in the vicinity.
 */
   void StartDiscoveringDevicesL();

 /*!
 * void RefreshDevices();
 *
 * discussion Refresh the Bluetooth device search. Do the search again. 		  
 */
   void RefreshDevices();
    
/*!
 * CArrayPtrFlat< HBufC >* GetNames()
 *
 * discussion Get Bluetooth device names.
 * return a pointer to list.
 */
   CArrayPtrFlat< HBufC >* GetNames();

 /*!
 * RArray<HBufC*>* GetDeviceAddress()
 *
 * discussion Get Bluetooth device addresses.
 * return a pointer to list.
 */
   RArray<HBufC*>* GetDeviceAddress();

private: // Basic two-phase Symbian OS constructors

/*!
 * CBTDiscoverer();
 *
 * Constructor.
 */
	CBTDiscoverer(CSharedIntermediator* aSMediator);

/*!
 * ConstructL()
 */
	void ConstructL();
	
private: //functions

/*!
 * void PushListL()
 *
 * discussion Get Bluetooth device addresses.
 * param aNamEntry name of the device.
 */
	void PushListL(TNameEntry& aNameEntry); 

/*!
 * void TransformSockAddress()
 *
 * discussion Transform TInquirySockAddr.		  
 * param aInquirySockAddr address to be transformed.
 */
	void TransformSockAddress(TInquirySockAddr& aInquirySockAddr);
	
private: // member data

	// Socket addresses
	RArray<TInquirySockAddr>* iInqSockAddrArray; 

	// BT addresses in format XX-XX-XX-XX-XX-XX  
	RArray<HBufC*>* iDeviceAddress;

	// Device names
	CArrayPtrFlat< HBufC >* iDeviceNames;
	
	// Handle to the socket server 
	RSocketServ iSocketServer; 

	// Provides an interface to host name resolution services
	RHostResolver iHostResolver; 

	// Socket address class used for remote device inquiries
	TInquirySockAddr iSockAddr; 

	// Contains the results of name queries.
	TNameEntry iNameEntry; 

	// Shared class that transmits data between main thread and thread one
	CSharedIntermediator* iSMediator;
	};

#endif // __BT_DISCOVERER_H__ 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -