当前位置: 首页>>代码示例>>Java>>正文


Java DiscoveryListener.deviceDiscovered方法代码示例

本文整理汇总了Java中javax.bluetooth.DiscoveryListener.deviceDiscovered方法的典型用法代码示例。如果您正苦于以下问题:Java DiscoveryListener.deviceDiscovered方法的具体用法?Java DiscoveryListener.deviceDiscovered怎么用?Java DiscoveryListener.deviceDiscovered使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.bluetooth.DiscoveryListener的用法示例。


在下文中一共展示了DiscoveryListener.deviceDiscovered方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: runDeviceInquiry

import javax.bluetooth.DiscoveryListener; //导入方法依赖的package包/类
public int runDeviceInquiry(DeviceInquiryThread startedNotify, int accessCode, DiscoveryListener listener)
		throws BluetoothStateException {
	try {
		int discType = runDeviceInquiryImpl(startedNotify, accessCode, listener);
		if (discType == DiscoveryListener.INQUIRY_COMPLETED) {
			// Report found devices if any not reported
			Hashtable previouslyFound = (Hashtable) deviceDiscoveryListenerFoundDevices.get(listener);
			if (previouslyFound != null) {
				Vector reported = (Vector) deviceDiscoveryListenerReportedDevices.get(listener);
				for (Enumeration en = previouslyFound.keys(); en.hasMoreElements();) {
					RemoteDevice remoteDevice = (RemoteDevice) en.nextElement();
					if (reported.contains(remoteDevice)) {
						continue;
					}
					reported.addElement(remoteDevice);
					Integer deviceClassInt = (Integer) previouslyFound.get(remoteDevice);
					DeviceClass deviceClass = new DeviceClass(deviceClassInt.intValue());
					listener.deviceDiscovered(remoteDevice, deviceClass);
					// If cancelInquiry has been called
					if (!deviceDiscoveryListeners.contains(listener)) {
						return DiscoveryListener.INQUIRY_TERMINATED;
					}
				}
			}
		}
		return discType;
	} finally {
		deviceDiscoveryListeners.removeElement(listener);
		deviceDiscoveryListenerFoundDevices.remove(listener);
		deviceDiscoveryListenerReportedDevices.remove(listener);
	}
}
 
开发者ID:empeeoh,项目名称:bluecove-osx,代码行数:33,代码来源:BluetoothStackToshiba.java

示例2: deviceDiscoveredCallback

import javax.bluetooth.DiscoveryListener; //导入方法依赖的package包/类
public void deviceDiscoveredCallback(DiscoveryListener listener, long deviceAddr, int deviceClass,
		String deviceName, boolean paired) {
	// Copied directly from WIDCOMM driver
	DebugLog.debug("deviceDiscoveredCallback deviceName", deviceName);
	if (!deviceDiscoveryListeners.contains(listener)) {
		return;
	}
	// Update name if name retrieved
	RemoteDevice remoteDevice = RemoteDeviceHelper.createRemoteDevice(this, deviceAddr, deviceName, paired);
	Vector reported = (Vector) deviceDiscoveryListenerReportedDevices.get(listener);
	if (reported == null || (reported.contains(remoteDevice))) {
		return;
	}
	// See -Dbluecove.inquiry.report_asap=false
	Hashtable previouslyFound = (Hashtable) deviceDiscoveryListenerFoundDevices.get(listener);
	if (previouslyFound != null) {
		Integer deviceClassInt = (Integer) previouslyFound.get(remoteDevice);
		if (deviceClassInt == null) {
			previouslyFound.put(remoteDevice, new Integer(deviceClass));
		} else if (deviceClass != 0) {
			previouslyFound.put(remoteDevice, new Integer(deviceClass));
		}
	} else {
		DeviceClass cod = new DeviceClass(deviceClass);
		reported.addElement(remoteDevice);
		DebugLog.debug("deviceDiscoveredCallback address", remoteDevice.getBluetoothAddress());
		DebugLog.debug("deviceDiscoveredCallback deviceClass", cod);
		listener.deviceDiscovered(remoteDevice, cod);
	}
}
 
开发者ID:empeeoh,项目名称:bluecove-osx,代码行数:31,代码来源:BluetoothStackToshiba.java

示例3: deviceDiscoveredCallback

import javax.bluetooth.DiscoveryListener; //导入方法依赖的package包/类
public void deviceDiscoveredCallback(DiscoveryListener listener, long deviceAddr, int deviceClass,
		String deviceName, boolean paired) {
	DebugLog.debug("deviceDiscoveredCallback", deviceName);
	RemoteDevice remoteDevice = RemoteDeviceHelper.createRemoteDevice(this, deviceAddr, deviceName, paired);
	if ((currentDeviceDiscoveryListener == null) || (currentDeviceDiscoveryListener != listener)) {
		return;
	}
	listener.deviceDiscovered(remoteDevice, new DeviceClass(deviceClass));
}
 
开发者ID:empeeoh,项目名称:bluecove-osx,代码行数:10,代码来源:BluetoothStackBlueSoleil.java


注:本文中的javax.bluetooth.DiscoveryListener.deviceDiscovered方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。