From ebfe1be31d29cf7150aa4cd0fa20a4e3e9d26ba1 Mon Sep 17 00:00:00 2001 From: Idefix2020 Date: Mon, 21 Aug 2023 18:24:10 +0200 Subject: [PATCH 1/2] Add support for Brightness characteristic --- src/common/hk_chrs_properties.c | 2 +- src/stacks/ble/hk_uuids.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/common/hk_chrs_properties.c b/src/common/hk_chrs_properties.c index 8389b34..e166ed0 100644 --- a/src/common/hk_chrs_properties.c +++ b/src/common/hk_chrs_properties.c @@ -160,6 +160,7 @@ uint16_t hk_chrs_properties_get_prop(hk_chr_types_t chr_type) return HK_CHR_PROP_SUPPORTS_READ; case HK_CHR_ON: + case HK_CHR_BRIGHTNESS: return HK_CHR_PROP_SUPPORTS_SECURE_READS | HK_CHR_PROP_SUPPORTS_SECURE_WRITES | HK_CHR_PROP_NOTIFIES_EVENTS_CONNECTED_STATE @@ -226,7 +227,6 @@ uint16_t hk_chrs_properties_get_prop(hk_chr_types_t chr_type) case HK_CHR_SERVICE_LABEL_NAMESPACE: case HK_CHR_ACCESSORY_FLAGS: case HK_CHR_COLOR_TEMPERATURE: - case HK_CHR_BRIGHTNESS: case HK_CHR_ROTATION_DIRECTION: case HK_CHR_CURRENT_HORIZONTAL_TILT_ANGLE: case HK_CHR_CURRENT_VERTICAL_TILT_ANGLE: diff --git a/src/stacks/ble/hk_uuids.c b/src/stacks/ble/hk_uuids.c index 631bd40..5409bda 100644 --- a/src/stacks/ble/hk_uuids.c +++ b/src/stacks/ble/hk_uuids.c @@ -64,6 +64,9 @@ void hk_uuids_to_name(const ble_uuid128_t *uuid, char str[40]) case HK_CHR_ON: sprintf(str, "ON"); break; + case HK_CHR_BRIGHTNESS: + sprintf(str, "BRIGHTNESS"); + break; case HK_CHR_SERIAL_NUMBER: sprintf(str, "SERIAL_NUMBER"); break; From cecf357cabdea8a4fd6d53dfe5f56485138324a3 Mon Sep 17 00:00:00 2001 From: Idefix2020 Date: Fri, 9 Aug 2024 22:09:51 +0200 Subject: [PATCH 2/2] Add support for several rollershutter characteristics --- src/common/hk_chrs_properties.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/hk_chrs_properties.c b/src/common/hk_chrs_properties.c index e166ed0..d90658f 100644 --- a/src/common/hk_chrs_properties.c +++ b/src/common/hk_chrs_properties.c @@ -161,6 +161,7 @@ uint16_t hk_chrs_properties_get_prop(hk_chr_types_t chr_type) case HK_CHR_ON: case HK_CHR_BRIGHTNESS: + case HK_CHR_TARGET_POSITION: return HK_CHR_PROP_SUPPORTS_SECURE_READS | HK_CHR_PROP_SUPPORTS_SECURE_WRITES | HK_CHR_PROP_NOTIFIES_EVENTS_CONNECTED_STATE @@ -168,6 +169,8 @@ uint16_t hk_chrs_properties_get_prop(hk_chr_types_t chr_type) | HK_CHR_PROP_SUPPORTS_BROADCAST_NOTIFY; case HK_CHR_MOTION_DETECTED: + case HK_CHR_POSITION_STATE: + case HK_CHR_CURRENT_POSITION: return HK_CHR_PROP_SUPPORTS_SECURE_READS | HK_CHR_PROP_NOTIFIES_EVENTS_CONNECTED_STATE | HK_CHR_PROP_NOTIFIES_EVENTS_DISCONNECTED_STATE @@ -196,17 +199,14 @@ uint16_t hk_chrs_properties_get_prop(hk_chr_types_t chr_type) case HK_CHR_BATTERY_LEVEL: case HK_CHR_CARBON_MONOXIDE_DETECTED: case HK_CHR_CONTACT_SENSOR_STATE: - case HK_CHR_CURRENT_POSITION: case HK_CHR_LEAK_DETECTED: case HK_CHR_OCCUPANCY_DETECTED: - case HK_CHR_POSITION_STATE: case HK_CHR_PROGRAMMABLE_SWITCH_EVENT: case HK_CHR_SMOKE_DETECTED: case HK_CHR_STATUS_FAULT: case HK_CHR_STATUS_JAMMED: case HK_CHR_STATUS_LOW_BATTERY: case HK_CHR_STATUS_TAMPERED: - case HK_CHR_TARGET_POSITION: case HK_CHR_SECURITY_SYSTEM_ALARM_TYPE: case HK_CHR_CHARGING_STATE: case HK_CHR_CARBON_DIOXIDE_DETECTED: