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


Java RemoteDevice.getBluetoothAddress方法代码示例

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


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

示例1: serviceSearchCompleted

import javax.bluetooth.RemoteDevice; //导入方法依赖的package包/类
@Override
public void serviceSearchCompleted(int arg0, int arg1) {
	
	Map<String, ServiceRecord> ports = new HashMap<String, ServiceRecord>();
	
	for (Entry<RemoteDevice, ServiceRecord[]> entry : services.entrySet()) {
		RemoteDevice remoteDevice = entry.getKey();
		ServiceRecord service = findService(entry.getValue());
		if (service != null) {
			String name = "noname";
			try {
				name = remoteDevice.getFriendlyName(false);
			} catch (Exception e) {
			}

			name += " " + remoteDevice.getBluetoothAddress();
			ports.put(name, service);
		}
	}
	
	bluetoothConnection.setPorts(ports);
	
       synchronized (lock) {
           lock.notify();
       }
}
 
开发者ID:Ardulink,项目名称:Ardulink-1,代码行数:27,代码来源:ArdulinkDiscoveryListener.java

示例2: run

import javax.bluetooth.RemoteDevice; //导入方法依赖的package包/类
@Override
State run() {
	if (candidates.isEmpty()) return states.startInquiry();

	CandidateDevice current = candidates.pop();
	RemoteDevice btDevice = current.btDevice;
	String btAddress = btDevice.getBluetoothAddress();

	final String name;
	try {
		name = btDevice.getFriendlyName(false);
	} catch (IOException e) {
		return states.identificationRejected(btAddress);
	}

	if (!isWiiRemote(name)) {
		return states.identifiedAsNonWiiRemote(btAddress);
	}

	return states.openControlPipe(btAddress);
}
 
开发者ID:awvalenti,项目名称:bauhinia,代码行数:22,代码来源:IdentifyNextDeviceState.java

示例3: remoteDevice2BluetoothDevice

import javax.bluetooth.RemoteDevice; //导入方法依赖的package包/类
private BluetoothDevice remoteDevice2BluetoothDevice(RemoteDevice device)
{
    String address;
    String name;

    address = device.getBluetoothAddress();
    try
    {
        name = device.getFriendlyName(false);
    }
    catch (IOException e)
    {
        name = UNKNOWN_NAME;
    }

    return new BluetoothDeviceImpl(address, name);
}
 
开发者ID:rhamnett,项目名称:dazzl,代码行数:18,代码来源:MonitoringThreadImpl.java

示例4: deviceDiscovered

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

示例5: toBluetoothDevice

import javax.bluetooth.RemoteDevice; //导入方法依赖的package包/类
/**
 * transforms a {@link RemoteDevice} object from the bluecove API to our own datastructure for bluetooth devices
 * 
 * @param btDevice the device coming from the bluecove API
 * @return an instance of our own bluetooth device data structure
 */
private static BluetoothDevice toBluetoothDevice(RemoteDevice btDevice) {
	String address = btDevice.getBluetoothAddress();
	String friendlyName = "";
	try {
		friendlyName = btDevice.getFriendlyName(false);
	} catch (IOException e) {
		// no friendly name accessible, let's ignore that
	}
	boolean paired = btDevice.isTrustedDevice();
	return new BluetoothDevice(address, friendlyName, paired);
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:18,代码来源:BTDeviceDiscoveryService.java

示例6: getNodeAddress

import javax.bluetooth.RemoteDevice; //导入方法依赖的package包/类
/**
   * 
   * This method returns the node address.
   *
   * @param input String "localNode" to retreive the address of the local device. 
   * A ServiceRecord or StreamConnection object to retreive the address of a 
   * remote device.
   * 
   * @return The node network address.
   * @throws IOException 
   */
  public String getNodeAddress(Object input) throws IOException{      
  		
// Checks whether the input is a String and the String equals "localnode".
// If so the address of the LocalDevice is returned.
if(input.getClass().isInstance(new String())){
	String inputString = (String)input;
	// Make sure that we won't get any UPPER/lower case problems
	inputString.toLowerCase();
	if(inputString.equals("localnode"))return LocalDevice.getLocalDevice().getBluetoothAddress();
}
  	
      // Input type is object because superclass cannot relate to ServiceRecord which is a bluetooth specific class.
      // This method is valid either the input type is ServiceRecord or StreamConnection.
      RemoteDevice remoteDevice = null;
      try{
          ServiceRecord serviceRecord = (ServiceRecord) input;
          remoteDevice = serviceRecord.getHostDevice();            
      }catch(ClassCastException cce1){
          // Could not cast the input object to ServiceRecord. Trying streamConnection instead ;-)
          try{
              StreamConnection streamConnection = (StreamConnection) input;            
              remoteDevice = RemoteDevice.getRemoteDevice(streamConnection);
          }catch(ClassCastException cce2){
              //This will only happen if the input object type is wrong
              log.logException("BluetoothNetwork.getNodeAddress()",cce2,false);
          }catch(IOException ioe){
              log.logException("BluetoothNetwork.getNodeAddress()",ioe,false);
              throw ioe;
          }            
      }
      return remoteDevice.getBluetoothAddress();
  }
 
开发者ID:meisamhe,项目名称:GPLshared,代码行数:44,代码来源:BluetoothNetwork.java


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