mirror of
https://github.com/google/pebble.git
synced 2025-07-20 13:04:47 -04:00
Import of the watch repository from Pebble
This commit is contained in:
commit
3b92768480
10334 changed files with 2564465 additions and 0 deletions
60
src/libbtutil/include/btutil/bt_device.h
Normal file
60
src/libbtutil/include/btutil/bt_device.h
Normal file
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <bluetooth/bluetooth_types.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
//! Creates a BTDevice given its address.
|
||||
//! @param address The address to use
|
||||
//! @param is_random Specify true if the address is a random address, or false
|
||||
//! if it is the real BD_ADDR of the device.
|
||||
//! @return The created BTDevice
|
||||
BTDevice bt_device_init_with_address(BTDeviceAddress address, bool is_random);
|
||||
|
||||
//! Gets the address of the device.
|
||||
//! @param device The device for which to get the address.
|
||||
//! @return The address of the device.
|
||||
BTDeviceAddress bt_device_get_address(BTDevice device);
|
||||
|
||||
//! Compares two Bluetooth device addresses.
|
||||
//! @return true if the addresses are equal, false if they are not or if one
|
||||
//! or both addresses were NULL.
|
||||
bool bt_device_address_equal(const BTDeviceAddress *addr1,
|
||||
const BTDeviceAddress *addr2);
|
||||
|
||||
//! Compares the address with an all-zero (invalid) address.
|
||||
//! @return true if the address is NULL or all-zeroes.
|
||||
bool bt_device_address_is_invalid(const BTDeviceAddress *addr);
|
||||
|
||||
//! Compares two BTDeviceInternal structs.
|
||||
//! @return true if the devices refer to the same device, false if they refer
|
||||
//! to different devices or if one or both devices were NULL.
|
||||
bool bt_device_internal_equal(const BTDeviceInternal *device1_int,
|
||||
const BTDeviceInternal *device2_int);
|
||||
|
||||
//! Compares two Bluetooth devices.
|
||||
//! @return true if the devices refer to the same device, false if they refer
|
||||
//! to different devices or if one or both devices were NULL.
|
||||
bool bt_device_equal(const BTDevice *device1, const BTDevice *device2);
|
||||
|
||||
//! Tests whether the device is a valid device.
|
||||
//! This function is meant to be used together with APIs that return a BTDevice,
|
||||
//! for example ble_service_get_device().
|
||||
//! @return true if the device appears to be invalid, false if it does not.
|
||||
bool bt_device_is_invalid(const BTDevice *device);
|
33
src/libbtutil/include/btutil/bt_uuid.h
Normal file
33
src/libbtutil/include/btutil/bt_uuid.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <util/uuid.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
//! Expands a 16-bit UUID to its 128-bit equivalent, using the Bluetooth base
|
||||
//! UUID (0000xxxx-0000-1000-8000-00805F9B34FB).
|
||||
//! @param uuid16 The 16-bit value from which to derive the 128-bit UUID.
|
||||
//! @return Uuid structure containing the final UUID.
|
||||
Uuid bt_uuid_expand_16bit(uint16_t uuid16);
|
||||
|
||||
//! Expands a 32-bit UUID to its 128-bit equivalent, using the Bluetooth base
|
||||
//! UUID (xxxxxxxx-0000-1000-8000-00805F9B34FB).
|
||||
//! @param uuid32 The 32-bit value from which to derive the 128-bit UUID.
|
||||
//! @return Uuid structure containing the final UUID.
|
||||
Uuid bt_uuid_expand_32bit(uint32_t uuid32);
|
26
src/libbtutil/include/btutil/sm_util.h
Normal file
26
src/libbtutil/include/btutil/sm_util.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct SMPairingInfo SMPairingInfo;
|
||||
typedef struct SM128BitKey SM128BitKey;
|
||||
|
||||
bool sm_is_pairing_info_equal_identity(const SMPairingInfo *a, const SMPairingInfo *b);
|
||||
|
||||
bool sm_is_pairing_info_empty(const SMPairingInfo *p);
|
||||
|
||||
bool sm_is_pairing_info_irk_not_used(const SM128BitKey *irk_key);
|
Loading…
Add table
Add a link
Reference in a new issue