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

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

?? bluetoothchatappui.cpp

?? 一個學習Symbian很好的例子
?? 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一区二区三区免费野_久草精品视频
亚洲精品免费播放| av网站一区二区三区| 精品污污网站免费看| 中文字幕制服丝袜一区二区三区| 久久av中文字幕片| 日韩一级欧美一级| 热久久久久久久| 欧美tickling挠脚心丨vk| 狂野欧美性猛交blacked| 日韩免费视频一区| 国产精品1区2区3区| 久久久久青草大香线综合精品| 国产原创一区二区三区| 国产欧美一区二区三区在线老狼| 不卡av在线免费观看| 亚洲精品一二三区| 欧美麻豆精品久久久久久| 日韩av不卡一区二区| 精品福利在线导航| 成人影视亚洲图片在线| 一区视频在线播放| 欧美日韩综合一区| 国内久久精品视频| 中文字幕一区视频| 欧美日韩免费在线视频| 久久99国产乱子伦精品免费| 亚洲国产成人午夜在线一区 | 亚洲制服丝袜在线| 在线不卡免费欧美| 国产酒店精品激情| 一区二区日韩av| 欧美电影免费观看高清完整版在线观看 | 亚洲国产精品激情在线观看| 91色porny蝌蚪| 日韩av在线发布| 国产精品视频免费看| 欧美日韩另类一区| 国产suv精品一区二区883| 亚洲精品视频在线看| 日韩免费视频一区二区| 97se亚洲国产综合自在线观| 日本aⅴ免费视频一区二区三区| 国产精品久久一卡二卡| 91精品国产综合久久久久久久| 国产精品99久久久久久久vr| 亚洲综合图片区| 国产日本一区二区| 欧美精品一卡二卡| 99视频精品在线| 九色综合国产一区二区三区| 亚洲美女免费视频| 2014亚洲片线观看视频免费| 欧美午夜电影网| 成人一区二区三区| 免费av网站大全久久| 亚洲欧美日韩中文字幕一区二区三区 | 处破女av一区二区| 蜜臀av亚洲一区中文字幕| 中文字幕综合网| 国产网站一区二区三区| 欧美美女网站色| 91色九色蝌蚪| 粉嫩13p一区二区三区| 日本不卡的三区四区五区| 亚洲男帅同性gay1069| 国产日韩精品一区二区三区在线| 91麻豆精品国产自产在线| 一本久久a久久精品亚洲| 国产福利一区二区三区视频在线 | 日韩精品一区二区在线观看| 欧美午夜片在线看| 91老师片黄在线观看| 成人天堂资源www在线| 久久99久久精品| 日本欧美一区二区三区| 午夜国产精品一区| 一级做a爱片久久| 亚洲欧洲www| 国产精品看片你懂得| 国产偷国产偷亚洲高清人白洁| 日韩精品一区二区在线| 日韩欧美国产wwwww| 欧美一区二区三区免费观看视频| 欧美日韩激情在线| 欧美日韩国产天堂| 欧美色图激情小说| 欧美午夜电影一区| 欧美影院一区二区三区| 在线影院国内精品| 欧美探花视频资源| 欧美男女性生活在线直播观看| 欧美亚洲免费在线一区| 欧洲av一区二区嗯嗯嗯啊| 在线视频你懂得一区| 欧美在线免费观看视频| 欧美系列一区二区| 欧美女孩性生活视频| 91精品蜜臀在线一区尤物| 制服丝袜激情欧洲亚洲| 欧美一区二区三区在线观看视频 | 欧美在线观看视频在线| 在线观看三级视频欧美| 欧美日韩一区二区三区四区| 9191成人精品久久| 日韩欧美成人激情| 国产日韩亚洲欧美综合| 国产精品不卡在线| 亚洲国产精品一区二区久久| 视频一区二区三区入口| 精品一区二区三区免费视频| 国产激情一区二区三区四区| 成+人+亚洲+综合天堂| 日本韩国欧美在线| 欧美女孩性生活视频| 精品国产百合女同互慰| 国产精品午夜春色av| 亚洲一区二区三区中文字幕| 视频在线在亚洲| 国产精品一卡二卡| 色视频成人在线观看免| 777午夜精品免费视频| 精品国产一区二区亚洲人成毛片| 国产日韩精品视频一区| 亚洲精品国产无套在线观| 日韩av中文字幕一区二区| 成人国产在线观看| 欧美日韩黄色一区二区| 亚洲精品一区二区三区四区高清| 国产精品久久综合| 美女视频免费一区| av亚洲精华国产精华精华| 7777精品伊人久久久大香线蕉 | 在线不卡一区二区| 久久在线观看免费| 亚洲精品国产高清久久伦理二区| 免费成人深夜小野草| 成人h版在线观看| 7777精品伊人久久久大香线蕉| 国产肉丝袜一区二区| 亚洲妇熟xx妇色黄| 国产ts人妖一区二区| 91精品国产一区二区人妖| 国产精品黄色在线观看| 日韩**一区毛片| 91亚洲永久精品| 久久伊人中文字幕| 婷婷亚洲久悠悠色悠在线播放| 国产999精品久久| 91精品国产综合久久蜜臀| 一区在线播放视频| 国产精品99久久久久久久vr| 91麻豆精品91久久久久久清纯| 欧美高清在线一区二区| 免费av成人在线| 欧美日韩免费观看一区三区| 国产精品国产成人国产三级| 麻豆国产精品一区二区三区| 色偷偷成人一区二区三区91| 久久精品人人爽人人爽| 日本亚洲欧美天堂免费| 欧美最猛性xxxxx直播| 国产精品美女久久久久av爽李琼| 午夜视频一区二区三区| 97国产一区二区| 国产精品乱子久久久久| 国产一区在线观看麻豆| 91精品中文字幕一区二区三区| 一区二区三区中文在线观看| 成人一区在线观看| 久久久99精品久久| 国产综合一区二区| 日韩欧美资源站| 日本不卡视频在线| 91精品国产色综合久久ai换脸| 亚洲一区自拍偷拍| 色婷婷精品久久二区二区蜜臂av| 国产精品久久久久影院老司| 国产福利一区二区三区视频在线 | 99在线精品观看| 国产精品久久久久久久第一福利 | 日本福利一区二区| 中文字幕视频一区二区三区久| 国产成人综合在线| 久久久电影一区二区三区| 极品少妇xxxx偷拍精品少妇| 日韩免费观看高清完整版在线观看| 午夜精品福利一区二区蜜股av| 欧美日本不卡视频| 男女激情视频一区| 日韩欧美电影一区| 国内国产精品久久| 亚洲国产精品t66y| www.爱久久.com| 亚洲色图视频网站| 在线免费观看视频一区| 亚洲一区二区视频在线| 欧美精选一区二区| 久久国产日韩欧美精品| 久久免费电影网| 成人av影视在线观看|