From d4c31bcbbe2f8b6d2e6c45203193745f9cb2a41b Mon Sep 17 00:00:00 2001 From: petter <39340152+petterhs@users.noreply.github.com> Date: Wed, 27 Jan 2021 13:45:06 +0100 Subject: add mute button and functionality for call notification + new button icons --- src/components/ble/AlertNotificationService.cpp | 13 +++++++++++++ src/components/ble/AlertNotificationService.h | 4 +++- 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'src/components') diff --git a/src/components/ble/AlertNotificationService.cpp b/src/components/ble/AlertNotificationService.cpp index 5fb8338b..0639119c 100644 --- a/src/components/ble/AlertNotificationService.cpp +++ b/src/components/ble/AlertNotificationService.cpp @@ -118,3 +118,16 @@ void AlertNotificationService::RejectIncomingCall() { ble_gattc_notify_custom(connectionHandle, eventHandle, om); } + +void AlertNotificationService::MuteIncomingCall() { + auto response = IncomingCallResponses::Mute; + auto *om = ble_hs_mbuf_from_flat(&response, 1); + + uint16_t connectionHandle = systemTask.nimble().connHandle(); + + if (connectionHandle == 0 || connectionHandle == BLE_HS_CONN_HANDLE_NONE) { + return; + } + + ble_gattc_notify_custom(connectionHandle, eventHandle, om); +} \ No newline at end of file diff --git a/src/components/ble/AlertNotificationService.h b/src/components/ble/AlertNotificationService.h index 612a8a32..caad7a2b 100644 --- a/src/components/ble/AlertNotificationService.h +++ b/src/components/ble/AlertNotificationService.h @@ -29,10 +29,12 @@ namespace Pinetime { void AcceptIncomingCall(); void RejectIncomingCall(); + void MuteIncomingCall(); enum class IncomingCallResponses : uint8_t { Reject = 0x00, - Answer = 0x01 + Answer = 0x01, + Mute = 0x02 }; private: -- cgit v1.2.3