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,61 @@
/*
* 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 "drivers/qemu/qemu_serial.h"
#include "drivers/qemu/qemu_settings.h"
#include "kernel/event_loop.h"
#include "pebble_errors.h"
#include "system/logging.h"
#include <bluetooth/init.h>
#include <bluetooth/qemu_transport.h>
#include <stdlib.h>
// ----------------------------------------------------------------------------------------
static void prv_set_connected_cb(void *context) {
qemu_transport_set_connected(true);
}
// ----------------------------------------------------------------------------------------
void bt_driver_init(void) {
// We need the QEMU serial driver
qemu_serial_init();
bt_lock_init();
}
bool bt_driver_start(BTDriverConfig *config) {
// The first time the stack starts, use the QemuSetting_DefaultConnected setting.
// Subsequent times, always auto-connect when the stack starts.
static bool s_should_auto_connect = false;
// Have KernelMain set us to connected once the event loop starts up, this gives enough time
// for the launcher to init its app message callbacks
if (s_should_auto_connect || qemu_setting_get(QemuSetting_DefaultConnected)) {
launcher_task_add_callback(prv_set_connected_cb, NULL);
s_should_auto_connect = true;
}
return true;
}
void bt_driver_stop(void) {
qemu_transport_set_connected(false);
}
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,172 @@
/*
* 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 "kernel/event_loop.h"
#include "kernel/events.h"
#include "kernel/pbl_malloc.h"
#include "services/common/comm_session/session_transport.h"
#include "system/passert.h"
#include "system/logging.h"
#include "comm/bt_lock.h"
#include "drivers/qemu/qemu_serial.h"
#include "drivers/qemu/qemu_serial_private.h"
#include "util/math.h"
#include <bluetooth/qemu_transport.h>
#include <string.h>
typedef struct {
CommSession *session;
} QemuTransport;
// -----------------------------------------------------------------------------------------
// Static Variables (protected by bt_lock)
//! The CommSession that the QEMU transport is managing.
//! Currently there's only one for the System session.
static QemuTransport s_transport;
// -----------------------------------------------------------------------------------------
// bt_lock() is held by caller
static void prv_send_next(Transport *transport) {
CommSession *session = s_transport.session;
PBL_ASSERTN(session);
size_t bytes_remaining = comm_session_send_queue_get_length(session);
if (bytes_remaining == 0) {
return;
}
const size_t temp_buffer_size = MIN(bytes_remaining, QEMU_MAX_DATA_LEN);
uint8_t *temp_buffer = kernel_malloc_check(temp_buffer_size);
while (bytes_remaining) {
const size_t bytes_to_copy = MIN(bytes_remaining, temp_buffer_size);
comm_session_send_queue_copy(session, 0 /* start_offset */, bytes_to_copy, temp_buffer);
qemu_serial_send(QemuProtocol_SPP, temp_buffer, bytes_to_copy);
comm_session_send_queue_consume(session, bytes_to_copy);
bytes_remaining -= bytes_to_copy;
}
kernel_free(temp_buffer);
}
// -----------------------------------------------------------------------------------------
// bt_lock() is held by caller
static void prv_reset(Transport *transport) {
PBL_LOG(LOG_LEVEL_INFO, "Unimplemented");
}
static void prv_granted_kernel_main_cb(void *ctx) {
ResponsivenessGrantedHandler granted_handler = ctx;
granted_handler();
}
static void prv_set_connection_responsiveness(
Transport *transport, BtConsumer consumer, ResponseTimeState state, uint16_t max_period_secs,
ResponsivenessGrantedHandler granted_handler) {
PBL_LOG(LOG_LEVEL_INFO, "Consumer %d: requesting change to %d for %" PRIu16 "seconds",
consumer, state, max_period_secs);
// it's qemu, our request to bump the speed is always granted!
if (granted_handler) {
launcher_task_add_callback(prv_granted_kernel_main_cb, granted_handler);
}
}
static CommSessionTransportType prv_get_type(struct Transport *transport) {
return CommSessionTransportType_QEMU;
}
//! Defined in session.c
extern void comm_session_set_capabilities(
CommSession *session, CommSessionCapability capability_flags);
// -----------------------------------------------------------------------------------------
void qemu_transport_set_connected(bool is_connected) {
bt_lock();
const bool transport_is_connected = (s_transport.session);
if (transport_is_connected == is_connected) {
bt_unlock();
return;
}
static const TransportImplementation s_qemu_transport_implementation = {
.send_next = prv_send_next,
.reset = prv_reset,
.set_connection_responsiveness = prv_set_connection_responsiveness,
.get_type = prv_get_type,
};
bool send_event = true;
if (is_connected) {
s_transport.session = comm_session_open((Transport *) &s_transport,
&s_qemu_transport_implementation,
TransportDestinationHybrid);
if (!s_transport.session) {
PBL_LOG(LOG_LEVEL_ERROR, "CommSession couldn't be opened");
send_event = false;
}
// Give it the appropriate capabilities
const CommSessionCapability capabilities = CommSessionRunState |
CommSessionInfiniteLogDumping |
CommSessionVoiceApiSupport |
CommSessionAppMessage8kSupport;
comm_session_set_capabilities(s_transport.session, capabilities);
} else {
comm_session_close(s_transport.session, CommSessionCloseReason_UnderlyingDisconnection);
s_transport.session = NULL;
}
if (send_event) {
PebbleEvent e = {
.type = PEBBLE_BT_CONNECTION_EVENT,
.bluetooth = {
.connection = {
.state = (s_transport.session) ? PebbleBluetoothConnectionEventStateConnected
: PebbleBluetoothConnectionEventStateDisconnected
}
}
};
event_put(&e);
}
bt_unlock();
}
// -----------------------------------------------------------------------------------------
bool qemu_transport_is_connected(void) {
return (s_transport.session != NULL);
}
// -----------------------------------------------------------------------------------------
// Handle incoming Qemu-SPP packet data
void qemu_transport_handle_received_data(const uint8_t *data, uint32_t length) {
bt_lock();
if (!s_transport.session) {
PBL_LOG(LOG_LEVEL_ERROR, "Received QEMU serial data, but session not connected!");
goto unlock;
}
comm_session_receive_router_write(s_transport.session, data, length);
unlock:
bt_unlock();
}

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

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

58
src/bluetooth-fw/wscript Normal file
View file

@ -0,0 +1,58 @@
import os
import sys
import waflib.Logs
from waflib.Configure import conf
@conf
def uses_dialog_bluetooth(ctx):
return 'da14681' in ctx.env.bt_controller
def _recurse(ctx):
if ctx.env.bt_controller == 'cc2564x':
# TODO: replace with real FW
ctx.recurse('stub')
elif ctx.uses_dialog_bluetooth():
# TODO: replace with real FW
ctx.recurse('stub')
elif ctx.env.bt_controller == 'qemu':
ctx.recurse('qemu')
else:
ctx.fatal('Invalid bt controller {}'.format(ctx.env.bt_controller))
def options(opt):
opt.add_option('--bt_controller', action='store', default=None,
help='Override Bluetooth controller to build for',
choices=['da14681-01', 'da14681-00', 'cc2564x', 'qemu'])
def configure(conf):
prev_variant = conf.variant
prev_env = conf.env
if conf.options.bt_controller:
bt = conf.options.bt_controller
conf.env.bt_controller = bt
else:
# If option wasn't specified, assume main wscript has set env.bt_controller.
# Act as if the option was set, so recurse'd wscripts can use the option.
conf.options.bt_controller = conf.env.bt_controller
waflib.Logs.pprint('CYAN', 'Using Bluetooth controller: {}'
.format(conf.env.bt_controller))
_recurse(conf)
conf.variant = prev_variant
conf.env = prev_env
def build(bld):
prev_env = bld.env
_recurse(bld)
bld.env = prev_env
# vim:filetype=python