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


Java BluetoothAdapter.checkBluetoothAddress方法代码示例

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


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

示例1: connect

import android.bluetooth.BluetoothAdapter; //导入方法依赖的package包/类
@ReactMethod
public void connect(String peripheralUUID, Callback callback) {
	Log.d(LOG_TAG, "Connect to: " + peripheralUUID );

	synchronized(peripherals) {
		Peripheral peripheral = peripherals.get(peripheralUUID);
		Log.e(LOG_TAG, "peripheral " + peripheral);
		if (peripheral == null) {
			if (peripheralUUID != null) {
				peripheralUUID = peripheralUUID.toUpperCase();
			}
			if (BluetoothAdapter.checkBluetoothAddress(peripheralUUID)) {
				BluetoothDevice device = bluetoothAdapter.getRemoteDevice(peripheralUUID);
				peripheral = new Peripheral(device, reactContext);
				peripherals.put(peripheralUUID, peripheral);
			} else {
				callback.invoke("Invalid peripheral uuid");
				return;
			}
		}
		peripheral.connect(callback, reactContext!=null?getCurrentActivity():context);
	}
}
 
开发者ID:lenglengiOS,项目名称:react-native-blue-manager,代码行数:24,代码来源:BleManager.java

示例2: isValidBluetoothAddress

import android.bluetooth.BluetoothAdapter; //导入方法依赖的package包/类
private static boolean isValidBluetoothAddress(String address) {
	return !StringUtils.isNullOrEmpty(address)
			&& BluetoothAdapter.checkBluetoothAddress(address)
			&& !address.equals(FAKE_BLUETOOTH_ADDRESS);
}
 
开发者ID:rafjordao,项目名称:Nird2,代码行数:6,代码来源:AndroidUtils.java

示例3: setDeviceAddress

import android.bluetooth.BluetoothAdapter; //导入方法依赖的package包/类
/**
 * Set filter on device address.
 *
 * @param deviceAddress The device Bluetooth address for the filter. It needs to be in the
 *                      format of "01:02:03:AB:CD:EF". The device address can be validated using
 *                      {@link BluetoothAdapter#checkBluetoothAddress}.
 * @throws IllegalArgumentException If the {@code deviceAddress} is invalid.
 */
public Builder setDeviceAddress(String deviceAddress) {
    if (deviceAddress != null && !BluetoothAdapter.checkBluetoothAddress(deviceAddress)) {
        throw new IllegalArgumentException("invalid device address " + deviceAddress);
    }
    mDeviceAddress = deviceAddress;
    return this;
}
 
开发者ID:Twelvelines,项目名称:AndroidMuseumBleManager,代码行数:16,代码来源:ScanFilterCompat.java

示例4: addDeviceAddress

import android.bluetooth.BluetoothAdapter; //导入方法依赖的package包/类
/**
 * Add a MAC address to the filter list and enables filtering of events by device MAC address.
 *
 * @param address device mac address. If the address is not valid {@link IllegalArgumentException}
 *                will be thrown.
 *
 * @return this builder instance.
 */
public ScanBuilder addDeviceAddress(String address) {
    if (!BluetoothAdapter.checkBluetoothAddress(address)) {
        throw new IllegalArgumentException("Invalid address:" + address);
    }
    scannerConfiguration.addDeviceAddress(address);
    return null;
}
 
开发者ID:inovait,项目名称:neatle,代码行数:16,代码来源:ScanBuilder.java

示例5: isMacValid

import android.bluetooth.BluetoothAdapter; //导入方法依赖的package包/类
/**
 * Validates a MAC address.
 *
 * @param mac the mac address to validate
 * @return true if it's a valid address, otherwise false
 */
public static boolean isMacValid(@NonNull String mac) {
    return BluetoothAdapter.checkBluetoothAddress(mac.toUpperCase());
}
 
开发者ID:inovait,项目名称:neatle,代码行数:10,代码来源:Neatle.java


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