📄 bluetooth.cpp.svn-base
字号:
/*
============================================================================================
Name : Bluetooth.cpp
Author : BluetoothAPI is a initiative of Embedded LAB - http://www.embedded.ufcg.edu.br/
OpenC/SymbianC++ - http://efforts.embedded.ufcg.edu.br/symbiancpp
Version :
Copyright : This file is part of BluetoothAPI.
BluetoothAPI is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
BluetoothAPI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with BluetoothAPI. If not, see <http://www.gnu.org/licenses/>.
Description : Bluetooth.cpp implementation
===========================================================================================
*/
#include "Bluetooth.h"
#include "StringUtils.h"
using namespace std;
EXPORT_C BluetoothAPI* BluetoothAPI::Create(BluetoothAPIListener *aListener)
{
BluetoothAPI* self = new BluetoothAPI(aListener);
return self;
}
BluetoothAPI::BluetoothAPI(BluetoothAPIListener *aListener)
{
User::LeaveIfError(iSocketServ.Connect());
iBTDeviceDiscovery = CBlueToothDeviceDiscovery::NewL(this);
APIListener = aListener;
}
EXPORT_C void BluetoothAPI::SearchDevices()
{
iBTDeviceDiscovery->StartDeviceDiscoveryL(iSocketServ);
}
EXPORT_C BluetoothAPI::~BluetoothAPI()
{
iSocketServ.Close();
if ( iBTDeviceDiscovery )
{
delete iBTDeviceDiscovery;
iBTDeviceDiscovery = NULL;
}
}
void BluetoothAPI::HandleBTDeviceDiscoveryCompleteL( RBTDeviceDataArray iDeviceDataList )
{
int numDev = iDeviceDataList.Count();
DeviceList.clear();
for (int i = 0; i < numDev; i++){
BTDeviceData Aux;
TBuf<32> iAux;
tbufC16tochar(iDeviceDataList[i]->iDeviceName, Aux.devName);
Aux.RfCommServicePort = iDeviceDataList[i]->iRfCommServicePort;
iDeviceDataList[i]->iDeviceAddr.GetReadable(iAux);
tbufC16tochar(iAux, Aux.devAdr);
DeviceList.push_back(Aux);
}
APIListener->DevicesDiscoverFinished( DeviceList );
}
EXPORT_C vector<BTDeviceData> BluetoothAPI::FoundDevicesList(){
return DeviceList;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -