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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? 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

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
777久久久精品| 日韩视频免费观看高清完整版在线观看 | 国产一区二区三区国产| 一二三区精品福利视频| 欧美精品一区二区不卡 | 91久久人澡人人添人人爽欧美| 亚洲成a人v欧美综合天堂下载 | 成人精品高清在线| 日韩av电影天堂| 亚洲猫色日本管| 久久久久国产精品厨房| 337p亚洲精品色噜噜噜| 色久综合一二码| 丁香激情综合国产| 热久久一区二区| 一区二区三区欧美日韩| 中文字幕电影一区| 久久综合九色综合久久久精品综合| 欧美中文字幕一区二区三区亚洲| 成人午夜看片网址| 精品无码三级在线观看视频| 亚洲小说欧美激情另类| 一色桃子久久精品亚洲| 久久先锋资源网| 日韩一级精品视频在线观看| 欧美午夜精品一区二区蜜桃| 色综合天天综合网天天看片| 国产盗摄精品一区二区三区在线| 日本最新不卡在线| 午夜欧美2019年伦理| 亚洲自拍偷拍av| 亚洲色欲色欲www在线观看| 国产欧美日韩亚州综合| 久久九九99视频| 精品对白一区国产伦| 日韩小视频在线观看专区| 宅男在线国产精品| 欧美日韩国产在线观看| 韩日欧美一区二区三区| 欧美精品一区二区三区在线播放| 欧美午夜不卡在线观看免费| 一本到高清视频免费精品| 91视频.com| 9i看片成人免费高清| 91污片在线观看| 在线观看av一区| 在线观看欧美精品| 欧美群妇大交群的观看方式| 在线影视一区二区三区| 欧美日韩一区国产| 91精品久久久久久久91蜜桃| 3d成人h动漫网站入口| 91精品国产日韩91久久久久久| 欧美电影一区二区三区| 日韩欧美综合在线| 2023国产精品自拍| 国产精品毛片大码女人| 亚洲精品国产a久久久久久| 亚洲成人免费看| 久久99精品久久久久久国产越南| 国产一区二区影院| 成人激情小说网站| 在线精品视频免费播放| 91精品视频网| 久久久久久日产精品| 一区二区中文视频| 亚洲成av人片观看| 国产在线视频一区二区三区| 成人免费毛片片v| 日本韩国视频一区二区| 欧美精品电影在线播放| 久久先锋影音av鲁色资源| 中文字幕色av一区二区三区| 亚洲国产一区视频| 久久草av在线| 色综合天天综合在线视频| 69久久夜色精品国产69蝌蚪网| 欧美不卡一区二区| 自拍av一区二区三区| 日韩va亚洲va欧美va久久| 成人一级黄色片| 欧美日韩一区二区在线观看视频| 久久婷婷国产综合国色天香 | 精品少妇一区二区三区在线播放| 国产三级久久久| 午夜激情久久久| 国产成人精品亚洲日本在线桃色| 91精品办公室少妇高潮对白| 日韩欧美一级片| 日韩理论片中文av| 韩国精品主播一区二区在线观看 | 99久久精品免费观看| 日韩视频免费观看高清完整版在线观看| 久久久久久9999| 午夜精品久久久| 国产成人精品免费| 欧美一区二区三区日韩| 国产精品久久久久7777按摩| 青青草国产成人av片免费| 91视频一区二区三区| 精品电影一区二区| 视频一区二区中文字幕| gogogo免费视频观看亚洲一| 日韩欧美一区中文| 亚洲一区二区综合| 岛国精品一区二区| 日韩你懂的电影在线观看| 夜夜嗨av一区二区三区中文字幕| 国产麻豆成人传媒免费观看| 777a∨成人精品桃花网| 一区二区三区四区av| 成人黄色大片在线观看| 精品久久免费看| 日本女优在线视频一区二区| 色菇凉天天综合网| 国产精品视频一二| 国产一区二区不卡在线| 日韩欧美高清dvd碟片| 偷拍一区二区三区| 欧美在线短视频| 亚洲精品菠萝久久久久久久| 成人不卡免费av| 亚洲国产成人自拍| 国产成人在线免费| 久久综合久久久久88| 九九久久精品视频| 日韩欧美电影在线| 美腿丝袜在线亚洲一区| 91精品国产欧美一区二区18| 午夜av区久久| 欧美精品丝袜久久久中文字幕| 亚洲国产视频一区| 日本精品裸体写真集在线观看| 亚洲少妇中出一区| 色婷婷综合久色| 伊人夜夜躁av伊人久久| 99国产精品久| 亚洲欧美一区二区三区久本道91 | 日本亚洲三级在线| 4438x亚洲最大成人网| 丝袜脚交一区二区| 欧美一区二区三区四区五区| 人人狠狠综合久久亚洲| 日韩一区二区三区在线视频| 免费在线观看精品| 精品久久久久99| 国产一区不卡在线| 国产精品色哟哟网站| 99麻豆久久久国产精品免费| 亚洲美腿欧美偷拍| 欧美蜜桃一区二区三区| 日本亚洲视频在线| xnxx国产精品| 成人av午夜影院| 亚洲欧美视频在线观看视频| 欧美在线视频全部完| 日韩和欧美一区二区三区| 欧美xxxx老人做受| 不卡视频免费播放| 午夜国产不卡在线观看视频| 精品国产亚洲在线| 9i在线看片成人免费| 天涯成人国产亚洲精品一区av| 欧美mv日韩mv| av中文字幕一区| 日本三级亚洲精品| 国产亚洲精品资源在线26u| 91性感美女视频| 蜜臀av性久久久久蜜臀aⅴ流畅 | 日韩一区二区三区在线| 国产精选一区二区三区| 亚洲精品第1页| 精品国产一区二区精华| 91影视在线播放| 蜜桃av一区二区| 17c精品麻豆一区二区免费| 91精品国产乱| 成人高清视频免费观看| 亚洲国产日韩综合久久精品| 波多野结衣中文字幕一区| 亚洲免费观看在线观看| 欧美一二三四在线| 顶级嫩模精品视频在线看| 亚洲一区二区三区在线看 | 久久这里只精品最新地址| 国产老女人精品毛片久久| 亚洲一区在线视频| 日韩精品一区在线| 91在线观看美女| 精彩视频一区二区三区| 综合精品久久久| 日韩一级大片在线观看| 91在线观看成人| 日本色综合中文字幕| 国产精品午夜在线| 国产不卡在线一区| 日韩国产精品久久久久久亚洲| 久久精品在线观看| 精品视频在线免费看| 成人免费毛片片v|