List of usage examples for android.os ParcelUuid fromString
public static ParcelUuid fromString(String uuid)
From source file:Main.java
public static AdvertiseData makeAdvertiseData(String message) { while (message.length() < 9) { message += " "; }//from w ww . java2 s .c o m byte[] data = message.substring(2).getBytes(); ParcelUuid pu = ParcelUuid .fromString("0000" + asHex(message.substring(0, 2).getBytes()) + "-0000-1000-8000-00805F9B34FB"); AdvertiseData.Builder builder = new AdvertiseData.Builder(); builder.addServiceData(pu, data); builder.addServiceUuid(pu); return builder.build(); }
From source file:Main.java
/** * Obtains a ParcelUuid from Short style value. * * @param uuidShortValue the Short style UUID value. * @return an UUID instance.// w w w. j a va 2 s . co m */ @NonNull public static ParcelUuid parcelFromShortValue(final int uuidShortValue) { return ParcelUuid.fromString( "0000" + String.format("%04X", uuidShortValue & 0xffff) + "-0000-1000-8000-00805F9B34FB"); }
From source file:io.v.android.impl.google.discovery.plugins.ble.Driver.java
public synchronized void startScan(String[] uuids, String baseUuid, String maskUuid, ScanHandler handler) { if (mScanHandler != null) { throw new IllegalStateException("scan already started"); }//from w w w . j a v a 2 s . c o m ImmutableSet.Builder<UUID> builder = ImmutableSet.builder(); if (uuids != null) { for (String uuid : uuids) { builder.add(UUID.fromString(uuid)); } } mScanUuids = builder.build(); mScanBaseUuid = ParcelUuid.fromString(baseUuid); mScanMaskUuid = ParcelUuid.fromString(maskUuid); mScanHandler = handler; if (mEnabled) { startScanning(); } }