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


Java DeviceClass类代码示例

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


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

示例1: deviceDiscovered

import javax.bluetooth.DeviceClass; //导入依赖的package包/类
public void deviceDiscovered(RemoteDevice btDevice, DeviceClass btClass) {
if(btDevice.getBluetoothAddress().startsWith(SPHERO_IEEE_OUI)) {
	System.out.println("Found a Sphero nearby!");
	Sphero s = null;
	try {
		s = new Sphero(btDevice.getBluetoothAddress(), btDevice.getFriendlyName(false), Sphero.SPP_DEFAULT_CHANNEL);
	} catch (IOException e) {
		s = new Sphero(btDevice.getBluetoothAddress(), "Unknown", 1);
	}
	System.out.println(s.getBluetoothAddress() + "  " + s.getFriendlyName());
       spherosDiscovered.add(s);
} else {
	System.out.println("Found some other Bluetooth device.");
}
		
  }
 
开发者ID:jdelacroix,项目名称:sphero-bluecove,代码行数:17,代码来源:SpheroDiscovery.java

示例2: printRemoteDevice

import javax.bluetooth.DeviceClass; //导入依赖的package包/类
public static void printRemoteDevice(RemoteDevice dev, DeviceClass devClass) {
	try {
		System.out.println("Print Remote Device " + dev.getBluetoothAddress());
		System.out.println("Name: " + dev.getFriendlyName(false));
		System.out.println("Auth: " + dev.isAuthenticated() + " Encrypted: " + dev.isEncrypted() + " Trusted: " + dev.isTrustedDevice());

		if (devClass != null) {
			System.out.println("MajorDevice:"
					+ majorToName(devClass.getMajorDeviceClass()));
			System.out.println("MinorDevice:"
					+ minorToName(devClass.getMajorDeviceClass(),
					devClass.getMinorDeviceClass()));
			System.out.println("ServiceClass:");
			String[] str = Util.majorServiceToName(devClass.getServiceClasses());
			for (int i = 0; i < str.length; i++) {
				System.out.println("  " + str[i]);
			}
		}
	} catch (IOException e) {
	}
}
 
开发者ID:cli,项目名称:worldmap-classic,代码行数:22,代码来源:Util.java

示例3: printLocalDevice

import javax.bluetooth.DeviceClass; //导入依赖的package包/类
public static void printLocalDevice(LocalDevice dev) {
	System.out.println("Print Local Device " + dev.getBluetoothAddress());
	System.out.println("Name: " + dev.getFriendlyName());
	DeviceClass devClass = dev.getDeviceClass();
	if (devClass != null) {
		System.out.println("MajorDevice:"
				+ majorToName(devClass.getMajorDeviceClass()));
		System.out.println("MinorDevice:"
				+ minorToName(devClass.getMajorDeviceClass(),
				devClass.getMinorDeviceClass()));
		System.out.println("ServiceClass:");
		String[] str = Util.majorServiceToName(devClass.getServiceClasses());
		for (int i = 0; i < str.length; i++) {
			System.out.println("  " + str[i]);
		}
	}

}
 
开发者ID:cli,项目名称:worldmap-classic,代码行数:19,代码来源:Util.java

示例4: deviceDiscovered

import javax.bluetooth.DeviceClass; //导入依赖的package包/类
@Override
public void deviceDiscovered(RemoteDevice device, DeviceClass deviceClass) {
	UUID[] uuids = new UUID[] {new UUID(uuid, false)};
	// Try to discover the services associated with the UUID
	try {
		discoveryAgent.searchServices(null, uuids, device, this);
		searches.incrementAndGet();
	} catch (BluetoothStateException e) {
		if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
	}
}
 
开发者ID:rafjordao,项目名称:Nird2,代码行数:12,代码来源:InvitationListener.java

示例5: deviceDiscovered

import javax.bluetooth.DeviceClass; //导入依赖的package包/类
public void deviceDiscovered( RemoteDevice btDevice, DeviceClass cod )
{
	Value dValue = Value.create();
	dValue.getFirstChild( "address" ).setValue( btDevice.getBluetoothAddress() );
	try {
		dValue.getFirstChild( "name" ).setValue( btDevice.getFriendlyName( true ) );
	} catch( IOException e ) {}
	value.getChildren( "device" ).add( dValue );
}
 
开发者ID:jolie,项目名称:jolie,代码行数:10,代码来源:BluetoothService.java

示例6: deviceDiscovered

import javax.bluetooth.DeviceClass; //导入依赖的package包/类
public void deviceDiscovered(RemoteDevice device, DeviceClass deviceClass) {
	UUID[] uuids = new UUID[] { new UUID(uuid, false) };
	// Try to discover the services associated with the UUID
	try {
		discoveryAgent.searchServices(null, uuids, device, this);
		searches.incrementAndGet();
	} catch(BluetoothStateException e) {
		if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
	}
}
 
开发者ID:kiggundu,项目名称:briar,代码行数:11,代码来源:InvitationListener.java

示例7: deviceDiscovered

import javax.bluetooth.DeviceClass; //导入依赖的package包/类
public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod)
{
    synchronized (currentDevices)
    {
        currentDevices.add(btDevice);
    }
}
 
开发者ID:rhamnett,项目名称:dazzl,代码行数:8,代码来源:MonitoringThreadImpl.java

示例8: deviceDiscovered

import javax.bluetooth.DeviceClass; //导入依赖的package包/类
/**
 * This call back method will be called for each discovered bluetooth devices.
 */
public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod) {
	System.out.println("Device discovered: "+btDevice.getBluetoothAddress());
	//add the device to the vector
	if(!vecDevices.contains(btDevice)){
		vecDevices.addElement(btDevice);
	}
}
 
开发者ID:rhamnett,项目名称:dazzl,代码行数:11,代码来源:BluetoothDeviceDiscovery.java

示例9: deviceDiscovered

import javax.bluetooth.DeviceClass; //导入依赖的package包/类
/**
   * 
   * This method is called by the javax.bluetooth.DiscoveryAgent (agent) whenever a bluetooth device is discovered
   * 
   * @param remoteDevice The device discovered
   * @param deviceClass The device class of the discovered device
   * 
   */
  public void deviceDiscovered(RemoteDevice remoteDevice,DeviceClass deviceClass){

// The device class of the discovered device
int deviceclass = deviceClass.getMajorDeviceClass();
	
if(deviceclass==mobileDeviceClassCode){
	// Adds the discovered device to the devicesFound Vector
	devicesFound.addElement(remoteDevice);
}
  }
 
开发者ID:meisamhe,项目名称:GPLshared,代码行数:19,代码来源:BluetoothServiceDiscovery.java

示例10: deviceDiscovered

import javax.bluetooth.DeviceClass; //导入依赖的package包/类
public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod) {

        // if this bloototh device was found in preknown or
        // cached devices skips it now.
        if (btDevsHash.put(btDevice, btDevice) == null) {
            btDevs.addElement(btDevice);
        }
    }
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:9,代码来源:SelectServiceHandler.java

示例11: deviceDiscovered

import javax.bluetooth.DeviceClass; //导入依赖的package包/类
public void deviceDiscovered(RemoteDevice remoteDevice,
		DeviceClass deviceClass) {
	log("A remote Bluetooth device is discovered:");
	Util.printRemoteDevice(remoteDevice, deviceClass);
	devices.addElement(remoteDevice);
	deviceClasses.addElement(deviceClass);
}
 
开发者ID:cli,项目名称:worldmap-classic,代码行数:8,代码来源:BLUElet.java

示例12: runDeviceInquiry

import javax.bluetooth.DeviceClass; //导入依赖的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

示例13: deviceDiscoveredCallback

import javax.bluetooth.DeviceClass; //导入依赖的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

示例14: deviceDiscoveredCallback

import javax.bluetooth.DeviceClass; //导入依赖的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

示例15: deviceDiscovered

import javax.bluetooth.DeviceClass; //导入依赖的package包/类
public void deviceDiscovered(final RemoteDevice btDevice, DeviceClass cod) {
	if (devicesProcessed.containsKey(btDevice)) {
		return;
	}
	synchronized (serviceSearchDeviceQueue) {
		serviceSearchDeviceQueue.addElement(btDevice);
		serviceSearchDeviceQueue.notifyAll();
	}
}
 
开发者ID:empeeoh,项目名称:bluecove-osx,代码行数:10,代码来源:SelectServiceHandler.java


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