mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Merge remote-tracking branch 'nearby/main' into apply-upstream
# Conflicts: # MODULE.bazel # connections/implementation/mediums/ble_v2.cc # internal/platform/implementation/BUILD
This commit is contained in:
@@ -119,7 +119,7 @@ void BleV2Socket::BleInputStream::NotifyClose() {
|
||||
}
|
||||
|
||||
// BleOutputStream implementation
|
||||
Exception BleV2Socket::BleOutputStream::Write(const ByteArray& data) {
|
||||
Exception BleV2Socket::BleOutputStream::Write(absl::string_view data) {
|
||||
absl::MutexLock lock(&mutex_);
|
||||
if (closed_) {
|
||||
return {Exception::kIo};
|
||||
@@ -154,9 +154,9 @@ void BleV2Socket::BleOutputStream::SetWriteCallback(WriteCallback callback) {
|
||||
}
|
||||
|
||||
void BleV2Socket::SetGattServer(
|
||||
std::unique_ptr<api::ble_v2::GattServer> gatt_server,
|
||||
const api::ble_v2::GattCharacteristic& rx_char,
|
||||
const api::ble_v2::GattCharacteristic& tx_char) {
|
||||
std::unique_ptr<api::ble::GattServer> gatt_server,
|
||||
const api::ble::GattCharacteristic& rx_char,
|
||||
const api::ble::GattCharacteristic& tx_char) {
|
||||
absl::MutexLock lock(&mutex_);
|
||||
|
||||
if (closed_) {
|
||||
@@ -170,7 +170,7 @@ void BleV2Socket::SetGattServer(
|
||||
|
||||
// Set up write callback to use GATT server notifications
|
||||
output_stream_.SetWriteCallback(
|
||||
[this](const ByteArray& data) -> bool {
|
||||
[this](absl::string_view data) -> bool {
|
||||
absl::MutexLock lock(&mutex_);
|
||||
if (!gatt_server_) {
|
||||
LOG(ERROR) << "GATT server not available for write";
|
||||
@@ -200,9 +200,9 @@ void BleV2Socket::SetGattServer(
|
||||
}
|
||||
|
||||
void BleV2Socket::SetGattClient(
|
||||
std::unique_ptr<api::ble_v2::GattClient> gatt_client,
|
||||
const api::ble_v2::GattCharacteristic& rx_char,
|
||||
const api::ble_v2::GattCharacteristic& tx_char) {
|
||||
std::unique_ptr<api::ble::GattClient> gatt_client,
|
||||
const api::ble::GattCharacteristic& rx_char,
|
||||
const api::ble::GattCharacteristic& tx_char) {
|
||||
absl::MutexLock lock(&mutex_);
|
||||
|
||||
if (closed_) {
|
||||
@@ -216,7 +216,7 @@ void BleV2Socket::SetGattClient(
|
||||
|
||||
// Set up write callback to use GATT client writes
|
||||
output_stream_.SetWriteCallback(
|
||||
[this](const ByteArray& data) -> bool {
|
||||
[this](absl::string_view data) -> bool {
|
||||
absl::MutexLock lock(&mutex_);
|
||||
if (!gatt_client_) {
|
||||
LOG(ERROR) << "GATT client not available for write";
|
||||
@@ -232,7 +232,7 @@ void BleV2Socket::SetGattClient(
|
||||
std::string data_str(data.data(), data.size());
|
||||
bool success = gatt_client_->WriteCharacteristic(
|
||||
tx_char_, data_str,
|
||||
api::ble_v2::GattClient::WriteType::kWithoutResponse);
|
||||
api::ble::GattClient::WriteType::kWithoutResponse);
|
||||
|
||||
if (!success) {
|
||||
LOG(WARNING) << "Failed to write to TX characteristic";
|
||||
|
||||
Reference in New Issue
Block a user