bluegpsclientsession.cpp
来自「S60系统下的蓝牙GPS连接程序 包括client和server端的连接方式」· C++ 代码 · 共 106 行
CPP
106 行
/*****************************************************************************
COPYRIGHT All rights reserved Sony Ericsson Mobile Communications AB 2003.
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.
*****************************************************************************/
// number of message slots.
const TUint kDefaultMessageSlots=4;
/*
****************************************************************
* CBlueGPSClientSession - the session b/w server & client
*
****************************************************************
*/
CBlueGPSClientSession::CBlueGPSClientSession()
{
}
// Connect to the server - default number of message slots is four
TInt CBlueGPSClientSession::Connect()
{
TInt r = StartThread();
if ( r == KErrNone)
r = CreateSession( KBlueGPSServerName, Version(), kDefaultMessageSlots );
return(r);
}
// Return the version number
TVersion CBlueGPSClientSession::Version(void) const
{
return( TVersion(KBlueGPSServerMajorVersionNumber,
KBlueGPSServerMinorVersionNumber,
KBlueGPSServerBuildVersionNumber));
}
// Close the session; makes call to server which deletes the object container and object index
// for this session
void CBlueGPSClientSession::Close()
{
RHandleBase::Close();
}
// Used by infoUpdater to receive new GPS info
TBlueGPSInfo CBlueGPSClientSession::GetGPSInfo()
{
TBlueGPSInfo info;
TPckg<TBlueGPSInfo> infoPkg( info );
TAny *p[KMaxMessageArguments];
p[0] = (TAny *)&infoPkg;
TInt err = SendReceive( EBlueGPSServerGetGPSInfo, &p[0] );
if( err == KErrNone )
info = infoPkg();
return info;
}
void CBlueGPSClientSession::ConnectToDevice()
{
TAny *p[KMaxMessageArguments];
SendReceive( EBlueGPSServerConnect, &p[0] );
}
// FFF
void CBlueGPSClientSession::DisconnectDevice()
{
TAny *p[KMaxMessageArguments];
SendReceive( EBlueGPSServerDisconnect, &p[0] );
}
// Tell the server that user has chosen a new device
void CBlueGPSClientSession::NewDevice( )
{
TAny *p[KMaxMessageArguments];
SendReceive( EBlueGPSServerNewDevice, &p[0] );
}
// To get connection status from the server, used in HandleCommandL
TBool CBlueGPSClientSession::GetConnectStatus()
{
TBool connect = EFalse;
TPckgBuf<TBool> pckg(connect);
TAny *p[KMaxMessageArguments];
p[0]= &pckg;
SendReceive( EBlueGPSServerConnectStatus, &p[0] );
connect = pckg();
return connect;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?