projects/positioning/app/src/main/java/io/v/positioning/ble/BleAdvertiser.java
/**
     * @return time advertisement was successfully sent or 0 on failure
     * */
@return time advertisement was successfully sent or 0 on failure
@return time advertisement was successfully sent or 0 on failure
public long startAdvertising(BleData data, int timeout) {
        this.mData = data;
        this.mTimeout = timeout;
        AdvertiseData ad = getAdvertiseData();
        long mTimeDataSent = System.nanoTime();
        mBleAdvertiser.startAdvertising(getAdvertiseSettings(), ad,
                getAdvertiseData(), mAdvertiseCallback);
        Log.d(TAG, "Data advertised: " + mData.toString() + " at time: " + mTimeDataSent);
        try{
            return advertisementSentWaiter.take();
        } catch (InterruptedException e) {
            Log.e(TAG, "Advertisement timed out.");
            return 0;
        }
    }
public long startAdvertising ( BleData data , int timeout ) { this . mData = data ; this . mTimeout = timeout ; AdvertiseData ad = getAdvertiseData ( ) ; long mTimeDataSent = System . nanoTime ( ) ; mBleAdvertiser . startAdvertising ( getAdvertiseSettings ( ) , ad , getAdvertiseData ( ) , mAdvertiseCallback ) ; Log . d ( TAG , "Data advertised: " + mData . toString ( ) + " at time: " + mTimeDataSent ) ; try { return advertisementSentWaiter . take ( ) ; } catch ( InterruptedException e ) { Log . e ( TAG , "Advertisement timed out." ) ; return 0 ; } }
@return time advertisement was successfully sent or 0 on failure
@return time advertisement was successfully sent or 0 on failure
// waiting for the notification from on a successful callback ...