當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。