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

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

?? gdpbt.cpp

?? 《SymbianOSC手機應用開發》源碼
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
// gdpbt.cpp
//
// Bluetooth implentation of GDP
//
// Copyright (c) 2000-2002 Symbian Ltd.  All rights reserved

#include <btmanclient.h>
#include <gdp.h>
#include "gdpbt.h"
#include <ImplementationProxy.h>
#include <ecom.h>


// Beep then wait a second before carrying on...
#define HIGHBEEP //User::Beep(990,250000); User::After(2000000);
#define BEEP //User::Beep(330,250000); User::After(2000000);
#define SLOW_DEBUG_PRINT(text) //User::InfoPrint(text); User::After(2000000);
#define DEBUG_PRINT(text) //User::InfoPrint(text); User::After(500000);

/**************** GdpBTComms ****************/

CGdpBTComms::CGdpBTComms()
	{
	}

CGdpBTComms::~CGdpBTComms()
	{
	REComSession::DestroyedImplementation(iDtor_ID_Key);
		// Delete all the things we created in OpenL()
	delete iSender;
	delete iReceiver;
	delete iResMan;
	}

CGdpSession* CGdpBTComms::NewL()
	{
	return new (ELeave) CGdpBTComms();
	}


void CGdpBTComms::OpenL(MGdpPacketHandler* aHandler)
	{
DEBUG_PRINT(_L("Entering CGdpBTComms::OpenL"));
	// Make sure we haven't already got a sender; if we do, Panic!
	__ASSERT_ALWAYS(iSender == NULL, GdpUtil::Fault(GdpUtil::EProtocolAlreadyOpen));
	// Create a new Resource manager...
	iResMan = new(ELeave) CGdpBTResourceManager();
	// ...and open it - no params, it just stores info for us
	// 5 beeps in here
	iResMan->OpenL(); 
BEEP
	// Create a new Sender...
	iSender = new(ELeave) CGdpBTSender(*iResMan);
	// ...and open it - no params as it just sends whatever is passed to it
BEEP
	iSender->OpenL(*aHandler);	//Inform handler of successful send
BEEP
	// Create a new Receiver...
	iReceiver = new(ELeave) CGdpBTReceiver(*iResMan);
	// ...and open it - needs to know where to put packets it receives
BEEP
	iReceiver->OpenL(*aHandler);	// route packets up to the handler passed to us
BEEP
DEBUG_PRINT(_L("Leaving CGdpBTComms::OpenL"));
	}


void CGdpBTComms::SendL(const TDesC8& aToAddress, const TDesC8& aData)
// Sends info received from GSDP out to the other Bluetooth device
// specified by the address passed in
	{
	//Make sure we've got the sender set up before we use it...
	__ASSERT_ALWAYS(iSender != NULL, GdpUtil::Fault(GdpUtil::EProtocolNotOpen));
	//...to send the message to the specified address
	iSender->SendL(aToAddress, aData);
	}

TInt CGdpBTComms::ReceiveAll()
//
// Do Nothing! IR uses async. notifications to receive
//
	{
	// Make sure we've got a receiver - is this neccessaruy??? doesn't hurt...
	__ASSERT_ALWAYS(iReceiver != NULL, GdpUtil::Fault(GdpUtil::EProtocolNotOpen));
	return KErrNone;
	}

TInt CGdpBTComms::GetMaxPacketLength() const
	{
	return KGdpBTMaxPacketLength;
	// We should check LMP frame size, if there
	// were any chance we would otherwise exceed it.
	}

TBool CGdpBTComms::IsNetworked() const
	{
	return ETrue; // Uses addressing so is in effect, networked
	}


/**************** GdpBTStateMachine ****************/

CGdpBTStateMachine::CGdpBTStateMachine(CGdpBTResourceManager& aResMan)
: CGdpStateMachine(EPriorityStandard), iResMan(aResMan)	
	{
	}


/**************** GdpBTSender ****************/

#pragma warning(disable:4355) // Disable "C4355: 'this' used in member initialization". 

CGdpBTSender::CGdpBTSender(CGdpBTResourceManager& aResMan)
	// Initialise the parent state machine
	: CGdpBTStateMachine(aResMan),
	// Make sure our member states know who owns them
	iConnectState(*this),
	iWriteState(*this)
	{
	}

#pragma warning(default:4355) // Turn C4355 back on.

CGdpBTSender::~CGdpBTSender()
	{
	// Close everything down before we die
DEBUG_PRINT(_L("Entering CGdpBTSender::~CGdpBTSender"));
	Close();
DEBUG_PRINT(_L("Leaving CGdpBTSender::~CGdpBTSender"));
	}

void CGdpBTSender::OpenL(MGdpPacketHandler& aHandler)
	{
DEBUG_PRINT(_L("Entering CGdpBTSender::OpenL"));
	// Just reset ourselves, the state machine will take care of the rest
	iHandler = &aHandler;
	Reset();
DEBUG_PRINT(_L("Leaving CGdpBTSender::OpenL"));
	}

void CGdpBTSender::Close()
	{
	// Cancel any outstanding requests...
	Cancel();
	// ...and then close the socket down
	iWriteSocket.Close();
	}

void CGdpBTSender::SendL(const TDesC8& aAddress, const TDesC8& aData)
	{

	TLex8 lex(aAddress);
	lex.Mark();
	if (!(lex.Get() == '0' && lex.Get() == 'x'))
		lex.UnGetToMark();

	TInt64 addr;
	User::LeaveIfError(lex.Val(addr, EHex));
	
	iAddr.SetBTAddr(TBTDevAddr(addr));

	// Check the size of the data we're trying to send:
	//   - if it's bigger than the maximum we can store in our member 
	//     variable then call GdpUtil::Fault()
	__ASSERT_ALWAYS(aData.Size() <= iPacket.MaxSize(), GdpUtil::Fault(GdpUtil::EBadSendDescriptor));
	// If the current state is NULL then panic as we're not ready
	__ASSERT_DEBUG(CurrentState() != NULL, GdpUtil::Panic(GdpUtil::ESenderNotReady));
	// If we're already waiting for another packet to be sent, we can't 
	// send another one but we don't leave, we just quietly drop the
	// overflow packet and quit this send
	if (IsActive())
		return;	
	// We're still here so it's OK to send the packet.
	iPacket.Copy(aData); // Buffer packet until needed
	// Set the number of retries to the maximum allowed
	iRetries = KGdpBTSendRetries;
	ReEnterCurrentState(); // Kick us off again but remain connected...
	}

CGdpStateMachine::TState* CGdpBTSender::ErrorOnStateEntry(TInt /*aError*/)
//
// Failed to init a request. Can't really help it: Give up!
//
	{
	Reset();
	return NULL; // Give up
	}

CGdpStateMachine::TState* CGdpBTSender::ErrorOnStateExit(TInt /*aError*/)
//
// Request failed -- reset and re-enter current state if appropriate, 
// decrementing number of retries so we don't continuously retry
//
	{
	Reset();
	if (--iRetries < 0)
		return NULL;
	return CurrentState();
	}

void CGdpBTSender::Reset()
	{
DEBUG_PRINT(_L("Entering CGdpBTSender::Reset"));
	// Start the state machine off in the 'connect' state.
	// N.B. Was Discover State for GDP-IR but there's not one in BT implementation
	// and as we need a fully operational SDP to do what IrDA did with the 'query' 
	// state we've skipped that one too
	SetNextState(&iConnectState);
DEBUG_PRINT(_L("Leaving CGdpBTSender::Reset"));
	}

/**************** GdpBTSender State transitions ****************/

CGdpBTSender::TSenderState::TSenderState(CGdpBTSender& aSender)
// Just set the sender to be whatever was passed in
: iSender(aSender)
	{
	}

CGdpStateMachine::TState* CGdpBTSender::TSenderState::ErrorL(TInt aCode)
//
// Sender default -- leave, giving the error code.
//
	{
	User::Leave(aCode);
	return NULL; // Never actually hit
	}

//--------------- Sender Connect State ---------------//

CGdpBTSender::TConnectState::TConnectState(CGdpBTSender& aSender)
: TSenderState(aSender)
	{
	}

void CGdpBTSender::TConnectState::EnterL()
	{
DEBUG_PRINT(_L("Entering CGdpBTSender::TConnectState::EnterL"));

	// What are we going to attempt to connect to?
	TProtocolDesc& desc = iSender.iResMan.ProtocolDesc();

	// Close the socket, just in case it's already open
	iSender.iWriteSocket.Close();
	
	// Now open the socket according to what the Resource Manager told us
	User::LeaveIfError(
		iSender.iWriteSocket.Open (iSender.iResMan.SocketServer(), 
							  desc.iAddrFamily, 
							  desc.iSockType, 
							  desc.iProtocol)
					   );

	// Use this hard-coded port num for GDP
	// GDP will be port 11, 1 = SDP, 3 = RFCOMM, etc
	iSender.iAddr.SetPort(0x000b);	
	
	// Send the connect request out of the socket!
	iSender.iWriteSocket.Connect(iSender.iAddr, iSender.iStatus);
	// and wait until we're connected...
	iSender.SetActive();
DEBUG_PRINT(_L("Leaving CGdpBTSender::TConnectState::EnterL"));
	}

CGdpStateMachine::TState* CGdpBTSender::TConnectState::CompleteL()
	{
	// The connect worked, so now we want to write same data 
	//  - go into the write state
	return &(iSender.iWriteState);
	}

void CGdpBTSender::TConnectState::Cancel()
	{
	// Cancel any connect requests for the socket
	iSender.iWriteSocket.CancelConnect();
	}

//--------------- Sender Write State ---------------//

CGdpBTSender::TWriteState::TWriteState(CGdpBTSender& aSender)
: TSenderState(aSender)
	{
	}

void CGdpBTSender::TWriteState::EnterL()
	{
	// Initiate a write...
	iSender.iWriteSocket.Write(iSender.iPacket, iSender.iStatus);
	// and wait...
	iSender.SetActive();
	}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品国产免费| 国产欧美一区二区精品久导航 | 亚洲女爱视频在线| 99久久精品久久久久久清纯| 亚洲综合视频在线观看| 国产精品美女久久久久av爽李琼| 在线播放日韩导航| 亚洲国产va精品久久久不卡综合| 色综合天天性综合| 裸体健美xxxx欧美裸体表演| 毛片不卡一区二区| 色激情天天射综合网| 国产人妖乱国产精品人妖| 麻豆一区二区三| 欧美性猛交xxxxxx富婆| 亚洲少妇中出一区| 风间由美一区二区av101| 日韩欧美高清在线| 蜜臀av一级做a爰片久久| www.亚洲免费av| 亚洲人成网站在线| 亚洲午夜精品网| 色综合久久中文综合久久牛| 中日韩av电影| 国产成人精品免费网站| 精品第一国产综合精品aⅴ| 免费在线观看日韩欧美| 欧美日韩高清一区二区不卡| 亚洲在线免费播放| 在线观看国产精品网站| 伊人夜夜躁av伊人久久| 亚洲大型综合色站| 日本成人超碰在线观看| 在线观看成人免费视频| 一区二区三区四区乱视频| 99在线热播精品免费| 国产精品欧美精品| 色综合色狠狠综合色| 亚洲精品久久7777| 欧美三级电影在线观看| 免费成人av在线| 精品精品国产高清a毛片牛牛| 理论电影国产精品| 久久伊99综合婷婷久久伊| 国产传媒日韩欧美成人| 国产精品久久久久久妇女6080 | 91国在线观看| 亚洲欧洲日产国产综合网| 成人黄色av电影| 亚洲影院久久精品| 欧美一级欧美三级| 国产高清不卡一区| 亚洲精品视频一区| 69久久夜色精品国产69蝌蚪网| 日本一区中文字幕| 欧美激情在线看| 欧美亚洲丝袜传媒另类| 热久久久久久久| 久久精品视频一区二区三区| 一本色道久久加勒比精品| 日韩精品午夜视频| 国产蜜臀97一区二区三区| 欧美日韩一区视频| 国产成人在线视频网址| 五月婷婷激情综合网| 国产欧美日韩麻豆91| 欧美日韩你懂的| 国产丶欧美丶日本不卡视频| 一区二区三区电影在线播| 日韩精品资源二区在线| 91原创在线视频| 久久99久国产精品黄毛片色诱| 18欧美亚洲精品| 26uuu精品一区二区| 欧美日韩视频在线一区二区| 高清不卡一区二区| 免费日韩伦理电影| 一区二区三区四区高清精品免费观看| 日韩欧美国产系列| 欧美这里有精品| 成人久久视频在线观看| 经典一区二区三区| 亚洲韩国一区二区三区| 国产精品久久久久毛片软件| 日韩视频中午一区| 欧美日韩国产欧美日美国产精品| 成人理论电影网| 久久99精品国产麻豆婷婷洗澡| 亚洲国产成人av网| 综合电影一区二区三区| 中文字幕乱码一区二区免费| 欧美刺激午夜性久久久久久久| 欧洲亚洲精品在线| 99久久国产综合色|国产精品| 韩国av一区二区三区在线观看| 日韩中文字幕91| 亚洲成人资源在线| 亚洲一区二区三区四区五区中文 | 久久久久久毛片| 91精品国产aⅴ一区二区| 欧美午夜视频网站| 欧美午夜电影一区| 日本韩国一区二区三区视频| 99在线精品视频| 99这里都是精品| av成人老司机| av中文一区二区三区| 波多野结衣的一区二区三区| 国产成人综合亚洲91猫咪| 国产一区二区导航在线播放| 国精产品一区一区三区mba桃花| 日本免费在线视频不卡一不卡二| 日本美女一区二区三区| 久久99在线观看| 国产在线一区二区| 国产成人在线视频免费播放| 大陆成人av片| 色久综合一二码| 欧美日韩一区二区三区高清| 欧美人与禽zozo性伦| 91精品国产入口| 日韩精品一区二区三区在线观看| 精品福利av导航| 欧美激情一区不卡| 亚洲欧美日韩电影| 午夜视黄欧洲亚洲| 蜜臀av性久久久久蜜臀av麻豆| 国产最新精品精品你懂的| 国产河南妇女毛片精品久久久 | 亚洲黄色免费网站| 亚洲精品老司机| 日韩成人av影视| 经典三级视频一区| 97久久精品人人爽人人爽蜜臀 | 色综合夜色一区| 在线观看视频一区二区欧美日韩| 欧美日韩免费观看一区三区| 欧美电视剧免费观看| 国产精品视频看| 亚洲国产精品久久人人爱| 久久国产尿小便嘘嘘| 大胆亚洲人体视频| 欧美性大战久久| 国产性天天综合网| 夜夜揉揉日日人人青青一国产精品| 亚洲观看高清完整版在线观看| 美女性感视频久久| 日韩高清一区二区| 蜜臀91精品一区二区三区| 秋霞成人午夜伦在线观看| 久久99精品久久久久| 色综合久久中文综合久久97| 4438x亚洲最大成人网| 日本一二三不卡| 亚洲成av人片一区二区梦乃| 国产一区二区在线观看免费| 色琪琪一区二区三区亚洲区| 日韩精品一区二区在线| 一区二区三区高清不卡| 国产精品主播直播| 欧美日韩精品一区视频| 日本一区二区动态图| 日韩国产精品大片| 99精品欧美一区| 日韩欧美国产一区在线观看| 亚洲欧美日韩一区二区| 国产一区二区三区四区五区美女 | 国产一区二区三区精品欧美日韩一区二区三区 | 欧美性一级生活| 久久综合一区二区| 天天操天天干天天综合网| 99re在线视频这里只有精品| 日韩女优制服丝袜电影| 午夜精品爽啪视频| caoporn国产一区二区| 精品久久一区二区| 日韩国产欧美在线播放| 欧洲一区在线观看| 亚洲蜜臀av乱码久久精品| 国产精品66部| 久久这里只有精品6| 麻豆高清免费国产一区| 欧美日韩国产高清一区二区三区| 亚洲蜜臀av乱码久久精品蜜桃| 99在线视频精品| 中文字幕一区三区| 成人黄色电影在线| 国产精品丝袜一区| 国产成a人亚洲精品| 久久蜜臀精品av| 国产呦精品一区二区三区网站| 欧美一区二区黄| 免播放器亚洲一区| 欧美一三区三区四区免费在线看| 亚洲成人免费电影| 欧美日韩一区二区三区免费看| 亚洲国产va精品久久久不卡综合| 欧美午夜理伦三级在线观看| 亚洲已满18点击进入久久| 精品视频在线看|