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

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

?? bluetoothchatappui.cpp

?? 《基于symbian os的手機開發與應用》
?? 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一区二区三区免费野_久草精品视频
zzijzzij亚洲日本少妇熟睡| 国产精品一区在线观看你懂的| 国产欧美日韩激情| 欧美www视频| 久久夜色精品一区| 国产视频一区在线观看| 国产欧美一区视频| 国产精品毛片a∨一区二区三区| 久久久777精品电影网影网 | 欧美日韩综合在线| 欧洲一区在线观看| 欧美人动与zoxxxx乱| 日韩免费看的电影| 久久久久免费观看| 国产精品黄色在线观看| 亚洲精品视频观看| 天堂精品中文字幕在线| 激情综合网av| 波多野结衣视频一区| 日本韩国一区二区| 欧美一区二区视频在线观看| 精品久久人人做人人爱| 欧美激情资源网| 一区二区三区视频在线看| 亚洲国产一区二区三区| 免费视频最近日韩| 国产精品资源在线看| 91蜜桃婷婷狠狠久久综合9色| 欧美午夜精品理论片a级按摩| 日韩一二三四区| 国产精品视频在线看| 亚洲一区二区三区四区的| 日韩不卡一区二区三区| av不卡免费在线观看| 欧美亚洲精品一区| 欧美不卡在线视频| 亚洲综合免费观看高清完整版 | 欧美一级理论片| 欧美国产一区二区在线观看 | 美女视频免费一区| 成人h动漫精品| 日韩一卡二卡三卡| 亚洲三级小视频| 九色|91porny| 欧美亚洲一区二区在线观看| 2024国产精品视频| 亚洲电影中文字幕在线观看| 国产成人亚洲综合a∨猫咪| 欧美视频一区二区在线观看| 久久久久国产精品人| 亚洲成av人片一区二区三区| 成人国产亚洲欧美成人综合网| 9191精品国产综合久久久久久| 国产精品日韩成人| 国产精品1024| 欧美一区二区播放| 亚洲第一成年网| 99久久精品99国产精品| 久久久精品综合| 狂野欧美性猛交blacked| 欧美日韩国产一区二区三区地区| 中文字幕欧美一| 成人网在线播放| 国产亚洲欧洲997久久综合| 另类的小说在线视频另类成人小视频在线 | 亚洲免费av观看| 99久久综合精品| 欧美激情中文不卡| 国产麻豆日韩欧美久久| 日韩视频在线一区二区| 日本特黄久久久高潮| 欧美三级视频在线观看| 亚洲一二三专区| 精品视频1区2区| 亚洲高清免费观看| 欧美日韩在线播放三区| 亚洲午夜免费福利视频| 欧美日韩在线播放| 丝瓜av网站精品一区二区 | 日韩欧美一区二区不卡| 丝袜美腿成人在线| 久久精品免视看| 国产精品夜夜嗨| 欧美激情在线一区二区三区| 懂色av中文一区二区三区| 国产欧美一区二区精品忘忧草| 国产一区二区在线视频| 久久久久久久久久电影| 丰满放荡岳乱妇91ww| 中文字幕乱码亚洲精品一区| 97久久精品人人做人人爽50路| 亚洲婷婷国产精品电影人久久| 91免费观看视频在线| 亚洲国产精品影院| 精品少妇一区二区三区视频免付费 | 蜜臂av日日欢夜夜爽一区| 日韩一区二区高清| 国产福利一区二区三区在线视频| 国产午夜精品一区二区三区嫩草 | 国产成人免费高清| 亚洲欧美国产三级| 欧美老肥妇做.爰bbww| 国产自产v一区二区三区c| 欧美激情一区二区三区四区| 色综合久久久久综合体桃花网| 日韩中文字幕麻豆| 久久精品视频免费| 欧美亚洲尤物久久| 国产真实乱偷精品视频免| 亚洲天天做日日做天天谢日日欢 | 国产亚洲成av人在线观看导航 | 欧美aⅴ一区二区三区视频| 久久影院电视剧免费观看| 99久久精品免费观看| 人妖欧美一区二区| 国产精品福利av| 日韩一区二区电影| 在线影院国内精品| 国产成人亚洲综合a∨婷婷| 午夜视频在线观看一区二区 | 蜜臀久久99精品久久久久久9| 国产欧美一区二区精品忘忧草 | 国产福利一区二区三区| 亚洲小少妇裸体bbw| 国产片一区二区| 日韩欧美中文一区二区| 在线观看一区二区精品视频| 国产麻豆成人精品| 青草av.久久免费一区| 五月婷婷久久综合| 综合电影一区二区三区 | 国产精品一区二区久激情瑜伽| 亚洲一区二区不卡免费| 国产精品视频观看| 久久久精品2019中文字幕之3| 欧美亚洲自拍偷拍| 色综合夜色一区| 成人在线综合网| 国产精品亚洲视频| 国产麻豆欧美日韩一区| 黑人巨大精品欧美黑白配亚洲| 一区二区三区精密机械公司| 亚洲品质自拍视频网站| 中文字幕日韩一区| 中文字幕五月欧美| 1024国产精品| 亚洲视频免费观看| 中文字幕亚洲欧美在线不卡| 中文子幕无线码一区tr| 国产精品视频一二三| 国产日韩av一区| 国产欧美一区二区精品忘忧草| 久久免费精品国产久精品久久久久| 日韩免费观看高清完整版 | 亚洲一级片在线观看| 亚洲午夜av在线| 三级成人在线视频| 理论电影国产精品| 国产精品一二三| 91在线视频18| 精品视频资源站| 91精品在线麻豆| 2019国产精品| 日韩一区中文字幕| 一区二区三区日韩精品| 亚洲大尺度视频在线观看| 日韩av中文字幕一区二区| 男人的天堂亚洲一区| 国产精品99久久久久久宅男| 懂色av一区二区夜夜嗨| 91在线国内视频| 欧美日韩精品欧美日韩精品 | 国产精品视频一区二区三区不卡| 国产精品午夜春色av| 亚洲三级电影全部在线观看高清| 亚洲另类春色国产| 日本美女一区二区| 成人永久aaa| 欧美日韩一卡二卡三卡| 日韩美女视频在线| 国产精品理论片| 天堂影院一区二区| 国产一区二区主播在线| 色中色一区二区| 日韩欧美在线不卡| 中文字幕av一区二区三区| 亚洲成在人线在线播放| 国产成人综合在线| 欧美视频中文字幕| 久久精品亚洲乱码伦伦中文 | 欧美剧情电影在线观看完整版免费励志电影| 欧美日韩欧美一区二区| 国产清纯美女被跳蛋高潮一区二区久久w | 日本不卡一二三区黄网| 成人毛片老司机大片| 欧美日韩另类一区| 国产精品久久久爽爽爽麻豆色哟哟| 亚洲国产sm捆绑调教视频 | 一本到三区不卡视频| 日韩午夜激情av|