btdevice.cpp

来自「1、手持设备的机器人--服务器端; 2、通过蓝牙通讯;」· C++ 代码 · 共 60 行

CPP
60
字号
/*
 * Copyright (c) 2004-2005 Mobile Robotics
 * http://mobilerobotics.sf.net
 *
 * File: BtDevice.cpp
 * Author: Johan Johanson
 * Date: January 20, 2005
 * Updated: January 20, 2005
 *
 * Description: See BtDevice.h
 *
*/

#include "BtBase.h"
#include "BtDevice.h"

BtDevice::BtDevice() : socket(BtBase::InvalidSocket), accessibility(0), classOfDevice(0)
{
	MemSet((void *)&address, sizeof(BtLibDeviceAddressType), 0);
	MemSet((void *)&friendlyName, sizeof(BtLibFriendlyNameType), 0);
}

BtDevice::~BtDevice()
{
	socket = BtBase::InvalidSocket;
	
	accessibility = 0;
	classOfDevice = 0;
	
	if (friendlyName.name != NULL)
		MemPtrFree(friendlyName.name);
	
	MemSet((void *)&address, sizeof(BtLibDeviceAddressType), 0);
	MemSet((void *)&friendlyName, sizeof(BtLibFriendlyNameType), 0);
}

BtLibSocketRef BtDevice::getSocket()
{
	return socket;
}

BtLibDeviceAddressType *BtDevice::getAddress()
{
	return &address;
}

BtLibFriendlyNameType *BtDevice::getFriendlyName()
{
	return &friendlyName;
}

UInt32 BtDevice::getAccessibility()
{
	return accessibility;
}

UInt32 BtDevice::getClassOfDevice()
{
	return classOfDevice;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?