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

📄 bluetoothreqhandler.cpp

📁 蓝牙开发例子拉拉拉拉 蓝牙开发例子拉拉拉拉
💻 CPP
字号:
/*
============================================================================
 Name        : BluetoothReqHandler.cpp
 Author      : 
 Version     :
 Copyright   : Your copyright notice
 Description : Simple AO example to make an async request to the server.
============================================================================
*/

#include "BluetoothServer.h"
#include "BluetoothReqHandler.h"
#include "BluetoothClient.pan"

CBluetoothReqHandler* CBluetoothReqHandler::NewL()
	{
	CBluetoothReqHandler* self = NewLC();
	CleanupStack::Pop(self);
	return self;
	}

CBluetoothReqHandler* CBluetoothReqHandler::NewLC()
	{
	CBluetoothReqHandler* self = new(ELeave) CBluetoothReqHandler();
	CleanupStack::PushL(self);
	self->ConstructL();
	return self;
	}

CBluetoothReqHandler::CBluetoothReqHandler() : CActive(EPriorityStandard)
	{
	}

void CBluetoothReqHandler::ConstructL()
	{
	CActiveScheduler::Add(this);
	User::LeaveIfError(iSession.Connect());
	}

CBluetoothReqHandler::~CBluetoothReqHandler()
	{
	Cancel();
	iSession.Close();
	}

void CBluetoothReqHandler::RequestTime()
	{
	if(!IsActive())
		{
		iSession.RequestTime(iTime, iStatus);
		SetActive();
		}
	}

void CBluetoothReqHandler::CancelRequest()
	{
	Cancel();
	}

void CBluetoothReqHandler::RunL()
	{
	switch (iStatus.Int())
		{
		case EBluetoothServRequestTimeComplete:
			break;
		case KErrCancel:
			break;
		case KErrNotReady:
		default:
			User::Panic(KBluetoothClient, EBadState);
		}
	CActiveScheduler::Stop(); // This stops the example.
	}

void CBluetoothReqHandler::DoCancel()
	{
	iSession.CancelRequestTime();
	}

TTime CBluetoothReqHandler::Time() const
	{
	return iTime;
	}

⌨️ 快捷键说明

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