亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区软件| 日韩午夜在线影院| 亚洲精品成人悠悠色影视| 国产又黄又大久久| 91精品久久久久久久91蜜桃| 一区二区三区在线播放| 国产成人高清视频| 2017欧美狠狠色| 天堂av在线一区| 欧美日韩中文一区| 一区二区欧美在线观看| 一本大道久久a久久精二百| 久久久久久久国产精品影院| 蜜桃91丨九色丨蝌蚪91桃色| 欧美日韩一区二区欧美激情| 亚洲精品一卡二卡| 99久久精品情趣| 国产精品国产三级国产aⅴ入口 | 亚洲国产精品激情在线观看| 日韩不卡一区二区| 7777精品伊人久久久大香线蕉的 | 成人免费在线观看入口| 国产成人综合网站| 国产午夜精品美女毛片视频| 国产精品自拍网站| 日本一二三四高清不卡| 成人午夜免费视频| 国产精品国产三级国产| av一区二区三区| 亚洲欧美一区二区不卡| 91亚洲精华国产精华精华液| 亚洲日本在线看| 91久久精品一区二区| 一区二区三区视频在线看| 欧美亚洲国产一区二区三区va | 欧美国产一区视频在线观看| 国产成人精品午夜视频免费| 国产精品丝袜一区| 91色婷婷久久久久合中文| 一区二区国产盗摄色噜噜| 日本久久一区二区三区| 婷婷一区二区三区| 26uuuu精品一区二区| 国产精品91一区二区| 国产精品毛片无遮挡高清| 成人av电影免费在线播放| 亚洲人xxxx| 欧美精品亚洲二区| 国产一区二区在线观看免费 | 亚洲二区在线视频| 在线播放91灌醉迷j高跟美女| 视频一区欧美精品| www成人在线观看| 99精品国产视频| 天涯成人国产亚洲精品一区av| 欧美裸体bbwbbwbbw| 国产一区在线观看视频| 亚洲欧美另类小说视频| 91精品国产乱码久久蜜臀| 国产精品一区三区| 亚洲一区二区三区激情| 欧美成人精精品一区二区频| www.欧美日韩| 青青青伊人色综合久久| 国产精品麻豆视频| 欧美精品第一页| 成a人片亚洲日本久久| 日日夜夜精品视频免费| 国产精品美女久久久久aⅴ| 欧美精品乱码久久久久久| 高清不卡一二三区| 亚洲国产成人av好男人在线观看| 欧美精品一区二区三区四区 | 国产亚洲成av人在线观看导航| 色综合激情五月| 麻豆成人久久精品二区三区红| 国产精品福利一区| 日韩精品影音先锋| 在线中文字幕一区| 黄色资源网久久资源365| 亚洲综合清纯丝袜自拍| 国产日韩欧美电影| 精品久久久久一区二区国产| 色综合天天视频在线观看| 国产原创一区二区| 日本视频在线一区| 香蕉影视欧美成人| 亚洲精品国产品国语在线app| 久久婷婷成人综合色| 欧美美女直播网站| 欧美性感一区二区三区| 国产精品一区免费在线观看| 奇米影视一区二区三区小说| 亚洲高清免费观看高清完整版在线观看 | 天堂影院一区二区| 亚洲美女一区二区三区| 国产精品动漫网站| 国产精品日日摸夜夜摸av| 久久久蜜桃精品| xvideos.蜜桃一区二区| 欧美一区二区三区在线电影| 欧美日本在线观看| 欧美日韩一区久久| 欧美日本乱大交xxxxx| 91看片淫黄大片一级在线观看| 国产99久久久久久免费看农村| 裸体在线国模精品偷拍| 日韩av电影免费观看高清完整版 | 国产精品久久久久久亚洲毛片| 久久先锋影音av| 久久久国际精品| www欧美成人18+| 久久青草欧美一区二区三区| 久久色在线视频| 国产亚洲成aⅴ人片在线观看| 国产日韩精品一区二区三区| 日本一二三四高清不卡| 亚洲视频电影在线| 一个色在线综合| 日日夜夜精品免费视频| 老司机午夜精品99久久| 国产一区二区精品久久| 成人午夜伦理影院| 一本大道久久精品懂色aⅴ| 91高清视频免费看| 在线综合+亚洲+欧美中文字幕| 日韩一区二区三区在线| 久久久蜜桃精品| 亚洲三级免费观看| 日韩精品一二三| 国产乱码精品一区二区三| www.久久久久久久久| 色88888久久久久久影院野外| 777午夜精品视频在线播放| 精品国产乱码久久久久久夜甘婷婷| 久久久精品国产免费观看同学| 亚洲色图19p| 日本成人超碰在线观看| 国产精品 日产精品 欧美精品| 91麻豆精东视频| 日韩无一区二区| 国产日韩精品一区二区三区| 亚洲色图欧美激情| 久久国产精品露脸对白| 成人激情黄色小说| 欧美一区午夜精品| 综合激情网...| 美女视频黄a大片欧美| 91在线精品一区二区三区| 欧美理论在线播放| 国产精品三级视频| 日韩福利电影在线| aaa欧美色吧激情视频| 欧美一级欧美三级| 一区二区三区自拍| 91在线观看下载| 制服丝袜中文字幕一区| 中文字幕乱码久久午夜不卡| 丝袜脚交一区二区| www.日韩大片| 久久亚洲综合av| 调教+趴+乳夹+国产+精品| 成人免费视频一区| 精品黑人一区二区三区久久| 亚洲欧美偷拍卡通变态| 国产高清亚洲一区| 日韩三级视频在线看| 亚洲成人免费av| 91蝌蚪porny九色| 国产精品伦理一区二区| 极品少妇一区二区| 欧美丰满一区二区免费视频| 中文字幕永久在线不卡| 国产精品自拍毛片| 精品国产区一区| 日本aⅴ免费视频一区二区三区| 91麻豆免费看| 久久久精品免费免费| 麻豆成人av在线| 日韩亚洲电影在线| 三级欧美在线一区| 欧美性xxxxxxxx| 亚洲最大成人综合| av亚洲精华国产精华精华| 久久九九久精品国产免费直播| 麻豆freexxxx性91精品| 欧美一区二区国产| 日韩精品国产欧美| 69堂精品视频| 日韩精品一二三区| 337p亚洲精品色噜噜噜| 日韩 欧美一区二区三区| 91麻豆精品国产自产在线| 丝袜美腿亚洲一区| 欧美一级片在线看| 久久草av在线| 久久婷婷一区二区三区| 懂色av一区二区三区蜜臀 |