亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? bluetoothchatappui.cpp

?? 通過藍牙進行聊天; 通過藍牙進行聊天;通過藍牙進行聊天
?? CPP
字號:
/**
*
* @brief Definition of CBluetoothChatAppUi
*
* Copyright (c) EMCC Software Ltd 2003
* @version 1.0
*/

// Class include
#include "BluetoothChatAppUi.h"

// System includes
#include <AknGlobalNote.h>
#include <AknNoteWrappers.h>
#include <AknQueryDialog.h>
#include <AknWaitDialog.h>
#include <BluetoothChat.rsg>		// R_BLUETOOTHCHAT_DIALOG
#include <eikmenup.h>
#include <stringloader.h>		// StringLoader

// User includes
#include "BluetoothChatDialog.h"	// CBluetoothChatDialog
#include "BluetoothChat.hrh"		// commands
#include "BluetoothDeviceSearcher.h"	// CBluetoothDeviceSearcher
#include "BluetoothServiceSearcher.h"	// CBluetoothServiceSearcher
#include "BluetoothClient.h"		// CBluetoothClient
#include "BluetoothServer.h"		// CBluetoothServer


// Constants
const TInt KFormattedMessagePrefixLength = 10;
_LIT(KFormattedMessagePrefix, "Message:\n");
const TInt KServerCleanupDelayMicroSeconds = 4000000;


// ================= MEMBER FUNCTIONS =======================

/**
* Symbian OS 2nd phase constructor.
* Constructs and executes the application's dialog,
* setting itself as the dialog's MOP parent, and adds it to the control
* stack.
*
* Creates an instance of the Bluetooth Client and Server
*
* @param none
* @return none
*/
void CBluetoothChatAppUi::ConstructL()
	{
	BaseConstructL();
	iAppDialog = new (ELeave) CBluetoothChatDialog;
	iAppDialog->SetMopParent(this);
	iAppDialog->ExecuteLD(R_BLUETOOTHCHAT_DIALOG);
	AddToStackL(iAppDialog);

	iClient = CBluetoothClient::NewL(*this);
	iServer = CBluetoothServer::NewL(*this);
	}

/**
* Destructor.
* Removes the application's dialog from the stack and deletes it.
*
* Deletes the Bluetooth Client and Server, and message buffer
*
*/
CBluetoothChatAppUi::~CBluetoothChatAppUi()
	{
	if (iAppDialog)
		{
		RemoveFromStack(iAppDialog);
		delete iAppDialog;
		}

	delete iWaitDialog;

	delete iClient;
	delete iServer;

	delete iMessage;
	}

/**
* Dynamic Menu Construction
*
* Restricts options available to the User via the Menu
* Performs checks on the state of the Client and Server to see what should be offered
*
* @param aResourceId
* @param @aMenuPane
* @return none
*/
void CBluetoothChatAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
	{
	if (aResourceId == R_BLUETOOTHCHAT_MENU_PANE)
		{
		if (iClient->IsConnected() || iServer->IsConnected())
			{
			aMenuPane->SetItemDimmed(EBluetoothChatConnect, ETrue);
			aMenuPane->SetItemDimmed(EBluetoothChatReceive, ETrue);
			if (iClient->IsConnected())
				{
				aMenuPane->SetItemDimmed(EBluetoothChatStopReceive, ETrue);
				}
			if (!iClient->AvailableToSend() && !iServer->AvailableToSend())
				{
				aMenuPane->SetItemDimmed(EBluetoothChatSend, ETrue);
				}
			}
		else
			{
			aMenuPane->SetItemDimmed(EBluetoothChatStopReceive, ETrue);
			aMenuPane->SetItemDimmed(EBluetoothChatSend, ETrue);
			}
		}
	}

/**
* From CEikAppUi, takes care of command handling.
*
* @param aCommand command to be handled
* @return none
*/
void CBluetoothChatAppUi::HandleCommandL(TInt aCommand)
	{
	switch (aCommand)
		{
		case EBluetoothChatConnect:
			{
			FindRemoteDeviceL();
			break;
			}

		case EBluetoothChatReceive:
			{
			StartReceivingL();
			break;
			}

		case EBluetoothChatStopReceive:
			{
			iServer->StopL();
			break;
			}

		case EBluetoothChatSend:
			{
			if (ComposeMessageL())
				{
				if (iClient->AvailableToSend())
					{
					iClient->Send(*iMessage);
					}
				else if (iServer->AvailableToSend())
					{
					iServer->Send(*iMessage);
					}
				}
			break;
			}

		case EEikCmdExit:
			{
			Exit();
			break;
			}

		default:
			break;
		}
	}

/**
* Begin Client side communication.
*
* Find a Device
* Find Service on device and obtain Port information
* Pass to the Client to form a connection
* @param none
* @return none
*/
void CBluetoothChatAppUi::FindRemoteDeviceL()
	{
	iDeviceSearcher = CBluetoothDeviceSearcher::NewL(*this);
	iDeviceSelectionResponse = new (ELeave) TBTDeviceResponseParamsPckg();
	iDeviceSearcher->SelectDeviceL(*iDeviceSelectionResponse);
	}

void CBluetoothChatAppUi::DeviceFoundL(TInt result)
	{
	delete iDeviceSearcher;	// delete and cleanup
	iDeviceSearcher = 0;

	if (result == KErrNone)
		{
		TInt port = 0;
		CBluetoothServiceSearcher* serviceSearcher = CBluetoothServiceSearcher::NewLC(port);
		TInt serviceFound = serviceSearcher->FindServiceL((*iDeviceSelectionResponse)().BDAddr());
		CleanupStack::PopAndDestroy( serviceSearcher );

		if (serviceFound == KErrNone)
			{
			iClient->ConnectToServerL((*iDeviceSelectionResponse)().BDAddr(), port);
			}
		else
			{
			CAknGlobalNote* globalNote = CAknGlobalNote::NewLC();
			HBufC* warning = StringLoader::LoadLC(R_SERVICE_NOT_FOUND);
			globalNote->ShowNoteL(EAknGlobalWarningNote, *warning);
			CleanupStack::PopAndDestroy(globalNote);
			CleanupStack::PopAndDestroy(warning);

			// Permit clean up of Bluetooth server connection
			User::After(TTimeIntervalMicroSeconds32(KServerCleanupDelayMicroSeconds));
			}
		}

	delete iDeviceSelectionResponse;
	iDeviceSelectionResponse = 0;
	}

/**
* Begin Server side communication.
*
* Starts Server - this will start the server and configure the security settings
*
* @param none
* @return none
*/
void CBluetoothChatAppUi::StartReceivingL()
	{
	iServer->StartServerL();
	}


/**
* React to completion of server startup.
*
* Starts advertising on server
* Display a dialog box with the option to cancel this listening process
*
* @param none
* @return none
*/
void CBluetoothChatAppUi::ServerStartedL()
	{

	// start the server's advertiser.
	iServer->StartAdvertisingL();

	// display a dialog to allow a user to cancel listening if required.
	delete iWaitDialog;
	iWaitDialog = NULL;
	iWaitDialog = new (ELeave) CAknWaitDialog(NULL, ETrue);
	HBufC* waitingMessage = StringLoader::LoadLC(R_WAITING_MESSAGE);
	iWaitDialog->SetTextL(*waitingMessage);
	CleanupStack::PopAndDestroy(waitingMessage);
	TInt retVal = iWaitDialog->ExecuteLD(R_BLUETOOTH_CONNECTION_WAIT_DIALOG);
	iWaitDialog = NULL;

	if (retVal != EAknSoftkeyDone)
		{
		// User has cancelled this connection process
		iServer->StopL();
		}

	}


/**
* Connection Made.
*
* Server - Remove the Cancel dialog
* Client - Provide feedback that a connection has been made
* @param none
* @return none
*/
void CBluetoothChatAppUi::ConnectedL()
	{
	if (iWaitDialog)
		{
		iWaitDialog->ProcessFinishedL();
		iWaitDialog = NULL;
		}

	if (iClient->IsConnected())
		{
		CAknInformationNote* infoDialog = new (ELeave) CAknInformationNote();
		HBufC* message = StringLoader::LoadLC(R_CONNECTED);
		infoDialog->ExecuteLD(*message);
		CleanupStack::PopAndDestroy(message);
		}
	}

/**
* Provides a UI Text Query Dialog requesting message to be sent.
*
* @param none
* @return true if message was composed by user
*/
TBool CBluetoothChatAppUi::ComposeMessageL()
	{
	TBool retVal = EFalse;

	delete iMessage;
	iMessage = NULL;
	iMessage = HBufC::NewL(KMaxMessageLength);
	TPtr message = iMessage->Des();

	HBufC* titleBuf = StringLoader::LoadLC(R_CHAT_TITLE);
	CAknTextQueryDialog* messageDialog = new (ELeave) CAknTextQueryDialog(message, *titleBuf, CAknTextQueryDialog::ENoTone);
	CleanupStack::PopAndDestroy(titleBuf);
	messageDialog->SetMaxLength(KMaxMessageLength);

	if (messageDialog->ExecuteLD(R_BLUETOOTH_CHAT_MESSAGE_DIALOG))
		{
		retVal = ETrue;
		}

	return retVal;
	}

/**
* Display the message received from remote device.
* @param aMessage the message received
* @return none
*/
void CBluetoothChatAppUi::DataReceivedL(const TDesC& aMessage)
	{
	TBuf<KMaxMessageLength + KFormattedMessagePrefixLength> formattedMessage;
	formattedMessage.Append(KFormattedMessagePrefix);
	formattedMessage.Append(aMessage);
	CAknQueryDialog* queryDialog = new (ELeave) CAknQueryDialog(formattedMessage, CAknQueryDialog::ENoTone);

	if (queryDialog->ExecuteLD(R_BLUETOOTH_CHAT_REPLY_DIALOG) == EBluetoothReply)
		{
		HandleCommandL(EBluetoothChatSend);
		}
	}

/**
* Provide UI feedback of errors occured during communication
* @param aErrorCode code repesenting the error that occured
*/
void CBluetoothChatAppUi::HandleErrorL(TInt aErrorCode)
	{
	HBufC* message;

	switch (aErrorCode)
		{
		case (KErrDisconnected):
		case (KErrAbort):
			{
			message = StringLoader::LoadLC(R_DISCONNECTED);
			break;
			}

		case (KErrNotReady):
			{
			message = StringLoader::LoadLC(R_CONNECTION_LOST);
			break;
			}

		case (KErrCouldNotConnect):
			{
			message = StringLoader::LoadLC(R_COULD_NOT_CONNECT);
			break;
			}

		default:
			{
			message = StringLoader::LoadLC(R_UNKNOWN_ERROR);
			break;
			}
		}

	CAknWarningNote* errorDialog = new (ELeave) CAknWarningNote();
	errorDialog->ExecuteLD(*message);
	CleanupStack::PopAndDestroy(message);
	}

// End of File

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美大胆人体bbbb| 色哟哟精品一区| 人妖欧美一区二区| 亚洲一区二区欧美日韩| 一区二区三区精品在线| 一区二区三区加勒比av| 亚洲精品乱码久久久久久久久| 中文一区一区三区高中清不卡| 欧美va天堂va视频va在线| 精品国产成人在线影院| 国产亚洲成aⅴ人片在线观看| 久久免费看少妇高潮| 久久看人人爽人人| 欧美成人vr18sexvr| 久久综合九色综合久久久精品综合| 日韩美女一区二区三区四区| 国产亚洲综合av| 亚洲精品国产视频| 调教+趴+乳夹+国产+精品| 国产在线播放一区二区三区| 9久草视频在线视频精品| 欧美三区在线视频| 国产欧美日产一区| 天天色图综合网| 972aa.com艺术欧美| 7777精品伊人久久久大香线蕉| 久久久蜜桃精品| 亚洲视频免费在线观看| 日韩av在线发布| 欧美影院一区二区| 国产蜜臀av在线一区二区三区| 亚洲第一福利一区| 91同城在线观看| 亚洲国产精品v| 久久激五月天综合精品| 欧美放荡的少妇| 亚洲午夜久久久| 在线免费观看日本一区| 一色桃子久久精品亚洲| 国产激情一区二区三区| 久久久夜色精品亚洲| 日本vs亚洲vs韩国一区三区| 欧美一级片在线观看| 久久久久综合网| 国产成人精品www牛牛影视| 日韩免费电影一区| 国产一区福利在线| 久久精品一区蜜桃臀影院| 国产乱色国产精品免费视频| 精品久久人人做人人爰| 精品一区二区三区免费视频| 欧美成人一区二区三区片免费 | 处破女av一区二区| 国产精品久久久久久久久免费桃花 | 欧美国产综合一区二区| 国产美女娇喘av呻吟久久| 国产精品乱码人人做人人爱 | 精品理论电影在线| av不卡一区二区三区| 亚洲午夜久久久久久久久电影网 | 免费成人在线观看视频| 精品免费日韩av| 色悠悠亚洲一区二区| 日本美女一区二区| 国产精品美女久久久久aⅴ| 欧洲激情一区二区| 韩国女主播一区| 亚洲精品免费电影| 精品国产免费久久| 欧美色爱综合网| av亚洲精华国产精华精华| 日韩精品亚洲专区| 亚洲欧洲综合另类| 久久综合99re88久久爱| 欧美日韩在线观看一区二区| 国产成人综合在线播放| 视频一区免费在线观看| 国产精品成人在线观看| 国产蜜臀97一区二区三区 | 91精品啪在线观看国产60岁| 粉嫩欧美一区二区三区高清影视| 国产精品国产三级国产三级人妇| 在线亚洲高清视频| 午夜欧美一区二区三区在线播放| 99久久精品免费| 香蕉成人啪国产精品视频综合网| 97久久精品人人做人人爽| 日韩理论片在线| 日本道免费精品一区二区三区| 一区二区在线观看不卡| 欧洲日韩一区二区三区| 久草中文综合在线| 欧美国产成人精品| 91视视频在线观看入口直接观看www| 日韩美女精品在线| 日韩欧美一区二区三区在线| 国产一区二区毛片| 欧美国产精品专区| 在线观看不卡一区| 国产一区二区剧情av在线| 亚洲天堂久久久久久久| 91麻豆精品国产91久久久久久| 久久精工是国产品牌吗| 一区二区三区在线观看动漫| 精品国产青草久久久久福利| 日本大香伊一区二区三区| 精品中文字幕一区二区| 玉米视频成人免费看| 国产亚洲一区二区三区四区 | 国产福利精品导航| 亚洲成人中文在线| 久久精品人人爽人人爽| 欧美在线制服丝袜| 91免费视频网址| va亚洲va日韩不卡在线观看| 日韩成人精品在线观看| 亚洲午夜精品网| 亚洲午夜三级在线| 一区二区在线观看免费| 亚洲欧洲制服丝袜| 亚洲美女偷拍久久| 亚洲综合色噜噜狠狠| 亚洲精品美腿丝袜| 亚洲在线中文字幕| 亚洲综合久久av| 偷拍亚洲欧洲综合| 奇米777欧美一区二区| 极品少妇一区二区三区精品视频 | 调教+趴+乳夹+国产+精品| 亚洲国产综合视频在线观看| 国产精品传媒入口麻豆| 1024国产精品| 午夜久久久久久久久| 免费高清在线一区| 成人av网站大全| 欧美日韩免费不卡视频一区二区三区| 91久久人澡人人添人人爽欧美| 欧美日韩国产一区二区三区地区| 欧美精品日韩一本| 国产精品午夜免费| 亚洲国产婷婷综合在线精品| 久久疯狂做爰流白浆xx| 成人午夜电影小说| 日韩欧美精品三级| 有码一区二区三区| 国产一区二区三区综合| 色综合 综合色| 欧美第一区第二区| 日韩电影网1区2区| 国产99久久久久久免费看农村| 91麻豆成人久久精品二区三区| 精品88久久久久88久久久| 亚洲欧美日韩国产一区二区三区| 麻豆视频一区二区| 欧美伦理影视网| 亚洲成av人片一区二区梦乃| 成人av在线电影| 亚洲国产精品ⅴa在线观看| 国产乱淫av一区二区三区| 日韩一级黄色片| 婷婷综合在线观看| 欧美一区二区三区视频免费| 亚洲免费观看高清完整版在线观看熊| 国产剧情av麻豆香蕉精品| 欧美成人a∨高清免费观看| 性做久久久久久| 欧美一区二区在线视频| 日韩黄色在线观看| 日韩视频免费观看高清完整版在线观看 | 欧美色窝79yyyycom| 亚洲午夜精品久久久久久久久| 91福利在线免费观看| 视频一区二区欧美| 久久综合色婷婷| 成人av在线一区二区三区| 日韩美女精品在线| 欧美日韩不卡在线| 久久国产婷婷国产香蕉| 欧美国产综合一区二区| 欧美亚一区二区| 狠狠色丁香婷婷综合| 国产精品久久久久影视| 欧美性猛交一区二区三区精品| 午夜精品久久久久| 精品动漫一区二区三区在线观看 | 免费观看在线综合| 国产精品久久精品日日| 777色狠狠一区二区三区| 韩国精品主播一区二区在线观看 | 久久久亚洲综合| 欧洲av在线精品| 成人性色生活片| 久久不见久久见免费视频1| 一区二区三区中文字幕在线观看| 91精品国产综合久久久久| 色婷婷精品大视频在线蜜桃视频| 国产专区欧美精品| 蜜臀av国产精品久久久久| 日韩伦理av电影| 怡红院av一区二区三区|