📄 btconnectionbase.cpp
字号:
/* Copyright (c) 2002, Nokia Mobile Phones. All rights reserved */
#include "BTConnectionBase.h"
#include "Log.h"
CBTConnectionBase::CBTConnectionBase(MLog& aLog)
: CActive(CActive::EPriorityStandard),
iLog(aLog)
{
CActiveScheduler::Add(this);
}
CBTConnectionBase::~CBTConnectionBase()
{
}
void CBTConnectionBase::WriteDataSyncL(TDesC8& aData)
{
if (IsActive())
{
iLog.LogL(_L8("WriteDataSyncL, error still reading! "), iStatus.Int());
User::Leave(KErrInUse);
}
// TODO: Use RSocket::Write() to write data on the connection socket
// Hint: iDataSocket is the connected socket, iStatus should be used also.
// TODO: Wait until this has finished
// Hint: Use User::WaitForRequest()
// TODO: Check the error code using iStatus.Int()
// and leave if there has been an error
}
void CBTConnectionBase::ReadDataL()
{
if (IsActive())
{
User::Leave(KErrInUse);
}
// TODO: Read some data from the connected socket
// Hint: Use RSocket::RecvOneOrMore() - iBuffer should receive the length
// iLen can be used to get the length (redundant)
// no flags are needed (0).
SetActive();
}
void CBTConnectionBase::ReadDataL(TInt aLength)
{
if (IsActive())
{
User::Leave(KErrInUse);
}
if (aLength > iBuffer.MaxLength())
{
User::Leave(KErrOverflow);
}
iBuffer.SetLength(aLength);
iDataSocket.Read(iBuffer, iStatus);
SetActive();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -