📄 btcon_appui.cpp
字号:
/*****************************************************************************
COPYRIGHT All rights reserved Sony Ericsson Mobile Communications AB 2005.
The software is the copyrighted work of Sony Ericsson Mobile Communications AB.
The use of the software is subject to the terms of the end-user license
agreement which accompanies or is included with the software. The software is
provided "as is" and Sony Ericsson specifically disclaim any warranty or
condition whatsoever regarding merchantability or fitness for a specific
purpose, title or non-infringement. No warranty of any kind is made in
relation to the condition, suitability, availability, accuracy, reliability,
merchantability and/or non-infringement of the software provided herein.
*****************************************************************************/
// BTCon_AppUi.cpp
//
//
#include "BTCon_AppUi.h"
#include "BTCon_AppView.h"
#include "BTCon_MsgClient.h"
#include "BTCon_MsgServer.h"
_LIT(KServerTransportName,"RFCOMM");
_LIT(KDisconectFirst, "Busy, disconnect first");
void CBTConAppUi::ConstructL()
{
CQikAppUi::ConstructL();
iAppView = CBTConAppView::NewL(ClientRect());
this->AddToStackL(iAppView);
iWorkAsType = ENoneSelected;
iClient = CMsgClient::NewL(iAppView);
iServer = CMsgServer::NewL(iAppView);
}
CBTConAppUi::~CBTConAppUi()
{
if(iAppView)
{
RemoveFromStack(iAppView);
delete iAppView;
}
if(iClient)
delete iClient;
if(iServer)
delete iServer;
}
void CBTConAppUi::SendMsgL(const TDesC& aMsg)
{
if(iWorkAsType == EWorkAsClient)
iClient->SendMsgL(aMsg);
if(iWorkAsType == EWorkAsServer)
iServer->SendMsgL(aMsg);
}
void CBTConAppUi::HandleCommandL(TInt aCommand)
{
switch (aCommand)
{
#if defined(__WINS__)
case EBTConCmdStartServer :
case EBTConCmdConnectClient :
case EBTConCmdDisonnect :
iAppView->UpdateEditText(_L("Not for emulator"));
break;
#else
case EBTConCmdStartServer :
{
if( iServer->IsStarted() || iWorkAsType == EWorkAsClient )
{
iEikonEnv->InfoMsg(KDisconectFirst);
}
else
{
iWorkAsType = EWorkAsServer;
iAppView->SetMyName(_L("Server"));
iServer->ConnectL();
}
}
break;
case EBTConCmdConnectClient :
{
if( iClient->IsStarted() || iWorkAsType == EWorkAsServer )
{
iEikonEnv->InfoMsg(KDisconectFirst);
}
else
{
iWorkAsType = EWorkAsClient;
iAppView->SetMyName(_L("Client"));
iClient->ConnectL();
}
}
break;
case EBTConCmdDisonnect :
{
if(iWorkAsType == EWorkAsServer)
iServer->Disconnect(ETrue);
if(iWorkAsType == EWorkAsClient)
iClient->Disconnect(ETrue);
iWorkAsType = ENoneSelected;
iAppView->SetMyName(_L("Hello"));
}
break;
#endif;
case EBTConCmdClearList :
iAppView->ClearList();
break;
// Exit the application. The call is implemented by the UI framework.
case EEikCmdExit:
Exit();
break;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -