Import of the watch repository from Pebble

This commit is contained in:
Matthieu Jeanson 2024-12-12 16:43:03 -08:00 committed by Katharine Berry
commit 3b92768480
10334 changed files with 2564465 additions and 0 deletions

View file

@ -0,0 +1,24 @@
/*
* 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 "comm/ble/gap_le_advert.h"
#include <bluetooth/adv_reconnect.h>
const GAPLEAdvertisingJobTerm *bt_driver_adv_reconnect_get_job_terms(size_t *num_terms_out) {
*num_terms_out = 0;
return NULL;
}

View file

@ -0,0 +1,47 @@
/*
* 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 <bluetooth/bt_driver_advert.h>
void bt_driver_advert_advertising_disable(void) {
}
bool bt_driver_advert_is_connectable(void) {
return false;
}
bool bt_driver_advert_client_get_tx_power(int8_t *tx_power) {
return false;
}
void bt_driver_advert_set_advertising_data(const BLEAdData *ad_data) {
}
bool bt_driver_advert_advertising_enable(uint32_t min_interval_ms, uint32_t max_interval_ms,
bool enable_scan_resp) {
return false;
}
bool bt_driver_advert_client_has_cycled(void) {
return false;
}
void bt_driver_advert_client_set_cycled(bool has_cycled) {
}
bool bt_driver_advert_should_not_cycle(void) {
return false;
}

View file

@ -0,0 +1,43 @@
/*
* 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 <bluetooth/analytics.h>
#include <bluetooth/bluetooth_types.h>
#include <stdbool.h>
#include <stdint.h>
#include "comm/ble/gap_le_connection.h"
bool bt_driver_analytics_get_connection_quality(const BTDeviceInternal *address,
uint8_t *link_quality_out, int8_t *rssi_out) {
return false;
}
bool bt_driver_analytics_collect_ble_parameters(const BTDeviceInternal *addr,
LEChannelMap *le_chan_map_res) {
return false;
}
void bt_driver_analytics_external_collect_chip_specific_parameters(void) {
}
void bt_driver_analytics_external_collect_bt_chip_heartbeat(void) {
}
bool bt_driver_analytics_get_conn_event_stats(SlaveConnEventStats *stats) {
return false; // Info not available
}

View file

@ -0,0 +1,24 @@
/*
* 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 <bluetooth/bonding_sync.h>
#include <bluetooth/sm_types.h>
void bt_driver_handle_host_added_bonding(const BleBonding *bonding) {
}
void bt_driver_handle_host_removed_bonding(const BleBonding *bonding) {
}

View file

@ -0,0 +1,32 @@
/*
* 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 <bluetooth/classic_connect.h>
void bt_driver_classic_disconnect(const BTDeviceAddress* address) {
}
bool bt_driver_classic_is_connected(void) {
return false;
}
bool bt_driver_classic_copy_connected_address(BTDeviceAddress* address) {
return false;
}
bool bt_driver_classic_copy_connected_device_name(char nm[BT_DEVICE_NAME_BUFFER_SIZE]) {
return false;
}

View file

@ -0,0 +1,47 @@
/*
* 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 <bluetooth/bt_test.h>
void bt_driver_test_start(void) {
}
void bt_driver_test_enter_hci_passthrough(void) {
}
void bt_driver_test_handle_hci_passthrough_character(char c, bool *should_context_switch) {
}
bool bt_driver_test_enter_rf_test_mode(void) {
return true;
}
void bt_driver_test_set_spoof_address(const BTDeviceAddress *addr) {
}
void bt_driver_test_stop(void) {
}
bool bt_driver_test_selftest(void) {
return true;
}
bool bt_driver_test_mfi_chip_selftest(void) {
return false;
}
void bt_driver_core_dump(BtleCoreDump type) {
}

View file

@ -0,0 +1,34 @@
/*
* 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 "bluetooth/bt_driver_comm.h"
#include "kernel/event_loop.h"
#include <stdbool.h>
static void prv_send_job(void *data) {
CommSession *session = (CommSession *)data;
bt_driver_run_send_next_job(session, true);
}
bool bt_driver_comm_schedule_send_next_job(CommSession *session) {
launcher_task_add_callback(prv_send_job, session);
return true; // we croak if a task cannot be scheduled on KernelMain
}
bool bt_driver_comm_is_current_task_send_next_task(void) {
return launcher_task_is_current_task();
}

View file

@ -0,0 +1,20 @@
/*
* 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 <bluetooth/connectability.h>
void bt_driver_classic_update_connectability(void) {
}

View file

@ -0,0 +1,21 @@
/*
* 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 <bluetooth/features.h>
bool bt_driver_supports_bt_classic(void) {
return false;
}

View file

@ -0,0 +1,21 @@
/*
* 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 "bluetooth/gap_le_connect.h"
int bt_driver_gap_le_disconnect(const BTDeviceInternal *peer_address) {
return 0;
}

View file

@ -0,0 +1,24 @@
/*
* 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 "bluetooth/gap_le_device_name.h"
void bt_driver_gap_le_device_name_request(const BTDeviceInternal *connection) {
}
void bt_driver_gap_le_device_name_request_all(void) {
}

View file

@ -0,0 +1,27 @@
/*
* 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 "bluetooth/gap_le_scan.h"
bool bt_driver_start_le_scan(bool active_scan, bool use_white_list_filter, bool filter_dups,
uint16_t scan_interval_ms, uint16_t scan_window_ms) {
return true;
}
bool bt_driver_stop_le_scan(void) {
return true;
}

View file

@ -0,0 +1,24 @@
/*
* 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 <inttypes.h>
#include <bluetooth/gatt.h>
void bt_driver_gatt_respond_read_subscription(uint32_t transaction_id, uint16_t response_code) {
}
void bt_driver_gatt_send_changed_indication(uint32_t connection_id, const ATTHandleRange *data) {
}

View file

@ -0,0 +1,35 @@
/*
* 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 <bluetooth/gatt.h>
#include <bluetooth/bluetooth_types.h>
#include <inttypes.h>
// -------------------------------------------------------------------------------------------------
// Gatt Client Discovery API calls
BTErrno bt_driver_gatt_start_discovery_range(
const GAPLEConnection *connection, const ATTHandleRange *data) {
return 0;
}
BTErrno bt_driver_gatt_stop_discovery(GAPLEConnection *connection) {
return 0;
}
void bt_driver_gatt_handle_discovery_abandoned(void) {
}

View file

@ -0,0 +1,40 @@
/*
* 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 <bluetooth/gatt.h>
#include <btutil/bt_device.h>
BTErrno bt_driver_gatt_write_without_response(GAPLEConnection *connection,
const uint8_t *value,
size_t value_length,
uint16_t att_handle) {
return 0;
}
BTErrno bt_driver_gatt_write(GAPLEConnection *connection,
const uint8_t *value,
size_t value_length,
uint16_t att_handle,
void *context) {
return 0;
}
BTErrno bt_driver_gatt_read(GAPLEConnection *connection,
uint16_t att_handle,
void *context) {
return 0;
}

View 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 <bluetooth/hrm_service.h>
bool bt_driver_is_hrm_service_supported(void) {
return false;
}
void bt_driver_hrm_service_handle_measurement(const BleHrmServiceMeasurement *measurement,
const BTDeviceInternal *permitted_devices,
size_t num_permitted_devices) {
}

View file

@ -0,0 +1,40 @@
/*
* 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 <bluetooth/id.h>
#include <bluetooth/bluetooth_types.h>
#include <string.h>
void bt_driver_id_set_local_device_name(const char device_name[BT_DEVICE_NAME_BUFFER_SIZE]) {
}
void bt_driver_id_copy_local_identity_address(BTDeviceAddress *addr_out) {
memset(addr_out, 0xAA, sizeof(*addr_out));
}
void bt_driver_set_local_address(bool allow_cycling,
const BTDeviceAddress *pinned_address) {
}
void bt_driver_id_copy_chip_info_string(char *dest, size_t dest_size) {
strncpy(dest, "QEMU", dest_size);
}
bool bt_driver_id_generate_private_resolvable_address(BTDeviceAddress *address_out) {
*address_out = (BTDeviceAddress) {};
return true;
}

View file

@ -0,0 +1,40 @@
/*
* 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 "comm/bt_lock.h"
#include "kernel/event_loop.h"
#include "pebble_errors.h"
#include "system/logging.h"
#include <bluetooth/init.h>
#include <stdlib.h>
// ----------------------------------------------------------------------------------------
void bt_driver_init(void) {
bt_lock_init();
}
bool bt_driver_start(BTDriverConfig *config) {
return true;
}
void bt_driver_stop(void) {
}
void bt_driver_power_down_controller_on_boot(void) {
// no-op
}

View file

@ -0,0 +1,25 @@
/*
* 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 <inttypes.h>
#include <stdbool.h>
void hc_endpoint_logging_set_level(uint8_t level) {
}
bool hc_endpoint_logging_get_level(uint8_t *level) {
return false;
}

View file

@ -0,0 +1,23 @@
/*
* 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 <bluetooth/pairability.h>
void bt_driver_le_pairability_set_enabled(bool enabled) {
}
void bt_driver_classic_pairability_set_enabled(bool enabled) {
}

View file

@ -0,0 +1,21 @@
/*
* 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 <bluetooth/pairing_confirm.h>
void bt_driver_pairing_confirm(const PairingUserConfirmationCtx *ctx,
bool is_confirmed) {
}

View file

@ -0,0 +1,23 @@
/*
* 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 <bluetooth/pebble_pairing_service.h>
void bt_driver_pebble_pairing_service_handle_status_change(const GAPLEConnection *connection) {
}
void bt_driver_pebble_pairing_service_handle_gatt_mtu_change(const GAPLEConnection *connection) {
}

View file

@ -0,0 +1,37 @@
/*
* 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 <stdint.h>
#include <stdbool.h>
void bt_driver_reconnect_pause(void) {
}
void bt_driver_reconnect_resume(void) {
}
void reconnect_set_interval(uint16_t new_interval) {
}
void bt_driver_reconnect_try_now(bool ignore_paused) {
}
void bt_driver_reconnect_reset_interval(void) {
}
void bt_driver_reconnect_notify_platform_bitfield(uint32_t platform_bitfield) {
// Don't care
}

View file

@ -0,0 +1,25 @@
/*
* 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 "bluetooth/responsiveness.h"
#include "bluetooth/gap_le_connect.h"
#include <inttypes.h>
bool bt_driver_le_connection_parameter_update(
const BTDeviceInternal *addr, const BleConnectionParamsUpdateReq *req) {
return true;
}

View file

@ -0,0 +1,23 @@
/*
* 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 <stdint.h>
// FIXME: PBL-21106
// Figure out what to do for our app_comm_get_sniff_interval() sniff API
uint32_t sys_app_comm_get_sniff_interval(void) {
return 0;
}

View file

@ -0,0 +1,20 @@
from resources.types.resource_definition import ResourceDefinition
from resources.types.resource_object import ResourceObject
def configure(conf):
pass
def build(bld):
sources = bld.path.ant_glob('**/*.c')
bld.stlib(source=sources,
target='bt_driver',
defines=['FILE_LOG_COLOR=LOG_COLOR_BLUE'],
use=[
'fw_includes',
'freertos',
'root_includes',
])
# vim:filetype=python