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

📄 bluetoothdevicesearcher.h

📁 qaSDQDaca<FCSASDAVCASC SDVFDSVDF
💻 H
字号:
 /*
============================================================================================
 Name		: BluetoothDeviceSearcher.h
 Author	    : BluetoothAPI is a initiative of Embedded LAB - http://www.embedded.ufcg.edu.br/
 			  OpenC/SymbianC++ - http://efforts.embedded.ufcg.edu.br/symbiancpp	
 Version	 :
 Copyright   : This file is part of BluetoothAPI.
               Bluetooth is free software: you can redistribute it and/or modify
               it under the terms of the GNU Lesser General Public License as published by
               the Free Software Foundation, either version 3 of the License, or
               (at your option) any later version.

               BluetoothAPI is distributed in the hope that it will be useful,
               but WITHOUT ANY WARRANTY; without even the implied warranty of
               MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
               GNU Lesser General Public License for more details.

               You should have received a copy of the GNU Lesser General Public License
               along with BluetoothAPI. If not, see <http://www.gnu.org/licenses/>.
 
 Description : BluetoothDeviceSearcher.h implementation
===========================================================================================
*/

#ifndef BLUETOOTHDEVICESEARCHER_H
#define BLUETOOTHDEVICESEARCHER_H

#include <es_sock.h> //THostDataName
#include <bttypes.h> //TBTDevAddr
#include <bt_sock.h> //TInquirySockAddr

#include <e32base.h>	// For CActive, link against: euser.lib

struct TBTDeviceData
	{
	THostName iDeviceName;
	TBTDevAddr iDeviceAddr;
	TUint iRfCommServicePort;
	};

typedef RPointerArray<TBTDeviceData> RBTDeviceDataArray;

class MBTDeviceSearcherObserver
	{
	public:
		virtual void HandleBTDeviceSearchCompleteL( RBTDeviceDataArray )=0;
	};


class CBluetoothDeviceSearcher : public CActive
{
public:
	// Cancel and destroy
	~CBluetoothDeviceSearcher();
	
	void StartDeviceSearcherL(RSocketServ& aSocketServ);

	// Two-phased constructor.
	static CBluetoothDeviceSearcher* NewL(MBTDeviceSearcherObserver* aObserver);

	// Two-phased constructor.
	static CBluetoothDeviceSearcher* NewLC(MBTDeviceSearcherObserver* aObserver);

public: // New functions
	// Function for making the initial request
	void StartL( /*TTimeIntervalMicroSeconds32 aDelay*/ );
	RBTDeviceDataArray DeviceDataList(){ return iDeviceDataList; };

private:
	// C++ constructor
	CBluetoothDeviceSearcher(MBTDeviceSearcherObserver* aObserver);
	
	// Second-phase constructor
	void ConstructL();
	
private: // From CActive
	// Handle completion
	void RunL();
	
	// How to cancel me
	void DoCancel();
	
	// Override to handle leaves from RunL(). Default implementation causes
	// the active scheduler to panic.
	TInt RunError( TInt aError );

private:
	enum TBlueTooth_DeviceDiscoveryState
	{
		EError			// Error condition
	};

private:
	MBTDeviceSearcherObserver* iBTDeviceSearcherObserver;
	RHostResolver iHostResolver;
	TInquirySockAddr iInquirySockAddr;
	TNameEntry iNameEntry;
	RBTDeviceDataArray iDeviceDataList;
	TBool SearchFlag;
};

#endif // BLUETOOTHDEVICESEARCHER_H

⌨️ 快捷键说明

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