Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 46ff4e6f authored by Wei Wang's avatar Wei Wang
Browse files

APIs for BLE scan, scan filter, batch scan, onFound/onLost and multiple

advertising.

Change-Id: I1655eb9cffa890b6fe38108bf51078662e90bc03
parent a8f5c7b2
Loading
Loading
Loading
Loading
+32 −0
Original line number Original line Diff line number Diff line
@@ -497,6 +497,34 @@ public final class BluetoothAdapter {
      }
      }
    }
    }


    /**
     * Returns a {@link BluetoothLeAdvertiser} object for Bluetooth LE Advertising operations.
     */
    public BluetoothLeAdvertiser getBluetoothLeAdvertiser() {
        // TODO: Return null if this feature is not supported by hardware.
        try {
            IBluetoothGatt iGatt = mManagerService.getBluetoothGatt();
            return new BluetoothLeAdvertiser(iGatt);
        } catch (RemoteException e) {
            Log.e(TAG, "failed to get BluetoothLeAdvertiser, error: " + e);
            return null;
        }
    }

    /**
     * Returns a {@link BluetoothLeScanner} object for Bluetooth LE scan operations.
     */
    public BluetoothLeScanner getBluetoothLeScanner() {
        // TODO: Return null if BLE scan is not supported by hardware.
        try {
            IBluetoothGatt iGatt = mManagerService.getBluetoothGatt();
            return new BluetoothLeScanner(iGatt);
        } catch (RemoteException e) {
            Log.e(TAG, "failed to get BluetoothLeScanner, error: " + e);
            return null;
        }
    }

    /**
    /**
     * Interface for BLE advertising callback.
     * Interface for BLE advertising callback.
     *
     *
@@ -2024,6 +2052,10 @@ public final class BluetoothAdapter {
            }
            }
        }
        }


        @Override
        public void onMultiAdvertiseCallback(int status) {
            // no op
        }
        /**
        /**
         * Callback reporting LE ATT MTU.
         * Callback reporting LE ATT MTU.
         * @hide
         * @hide
+9 −1
Original line number Original line Diff line number Diff line
@@ -583,6 +583,14 @@ public final class BluetoothGatt implements BluetoothProfile {
                        + state + " status=" + status);
                        + state + " status=" + status);
            }
            }


            /**
             * @hide
             */
            @Override
            public void onMultiAdvertiseCallback(int status) {
                // no op.
            }

            /**
            /**
             * Callback invoked when the MTU for a given connection changes
             * Callback invoked when the MTU for a given connection changes
             * @hide
             * @hide
+19 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2014 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.bluetooth;

parcelable BluetoothLeAdvertiseScanData.AdvertisementData;
 No newline at end of file
+649 −0

File added.

Preview size limit exceeded, changes collapsed.

+19 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2014 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.bluetooth;

parcelable BluetoothLeAdvertiser.Settings;
 No newline at end of file
Loading