Message ID | 20210817001341.10780-1-bernie@allthenticate.net (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [BlueZ] Added GDBusMethod to notify one device of characteristic change | expand |
This is automated email and please do not reply to this email! Dear submitter, Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series: PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=532361 ---Test result--- Test Summary: CheckPatch FAIL 0.73 seconds GitLint PASS 0.11 seconds Prep - Setup ELL PASS 40.55 seconds Build - Prep PASS 0.10 seconds Build - Configure PASS 7.10 seconds Build - Make FAIL 147.60 seconds Make Check FAIL 1.20 seconds Make Distcheck PASS 208.17 seconds Build w/ext ELL - Configure PASS 7.14 seconds Build w/ext ELL - Make FAIL 137.27 seconds Details ############################## Test: CheckPatch - FAIL Desc: Run checkpatch.pl script with rule in .checkpatch.conf Output: Added GDBusMethod to notify one device of characteristic change WARNING:LONG_LINE: line length of 84 exceeds 80 columns #33: FILE: src/gatt-database.c:3619: + DBusMessage *msg, void *user_data) ERROR:CODE_INDENT: code indent should use tabs where possible #33: FILE: src/gatt-database.c:3619: + DBusMessage *msg, void *user_data)$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #33: FILE: src/gatt-database.c:3619: + DBusMessage *msg, void *user_data)$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #35: FILE: src/gatt-database.c:3621: + struct btd_gatt_database *database = user_data;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #36: FILE: src/gatt-database.c:3622: + uint8_t *value = NULL;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #37: FILE: src/gatt-database.c:3623: + int value_len = 0;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #38: FILE: src/gatt-database.c:3624: + DBusMessageIter args;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #39: FILE: src/gatt-database.c:3625: + DBusMessageIter array;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #40: FILE: src/gatt-database.c:3626: + DBusMessage *reply;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #41: FILE: src/gatt-database.c:3627: + bdaddr_t device_bdaddr;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #42: FILE: src/gatt-database.c:3628: + const char *characteristic_path;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #43: FILE: src/gatt-database.c:3629: + const char *client_path;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #44: FILE: src/gatt-database.c:3630: + const char *application_path;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #45: FILE: src/gatt-database.c:3631: + struct svc_match_data match_data;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #46: FILE: src/gatt-database.c:3632: + const char *sender = dbus_message_get_sender(msg);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #47: FILE: src/gatt-database.c:3633: + struct gatt_app *app;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #48: FILE: src/gatt-database.c:3634: + struct external_service *service;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #49: FILE: src/gatt-database.c:3635: + struct external_chrc *chrc;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #50: FILE: src/gatt-database.c:3636: + struct notify notify;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #51: FILE: src/gatt-database.c:3637: + struct device_state *client_state;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #52: FILE: src/gatt-database.c:3638: + struct btd_device *client_device;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #54: FILE: src/gatt-database.c:3640: + if (!dbus_message_iter_init(msg, &args)) {$ WARNING:BRACES: braces {} are not necessary for single statement blocks #54: FILE: src/gatt-database.c:3640: + if (!dbus_message_iter_init(msg, &args)) { + return btd_error_invalid_args(msg); + } ERROR:CODE_INDENT: code indent should use tabs where possible #55: FILE: src/gatt-database.c:3641: + return btd_error_invalid_args(msg);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #55: FILE: src/gatt-database.c:3641: + return btd_error_invalid_args(msg);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #56: FILE: src/gatt-database.c:3642: + }$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #58: FILE: src/gatt-database.c:3644: + if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_OBJECT_PATH) {$ WARNING:BRACES: braces {} are not necessary for single statement blocks #58: FILE: src/gatt-database.c:3644: + if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_OBJECT_PATH) { + return btd_error_invalid_args(msg); + } ERROR:CODE_INDENT: code indent should use tabs where possible #59: FILE: src/gatt-database.c:3645: + return btd_error_invalid_args(msg);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #59: FILE: src/gatt-database.c:3645: + return btd_error_invalid_args(msg);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #60: FILE: src/gatt-database.c:3646: + }$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #61: FILE: src/gatt-database.c:3647: + dbus_message_iter_get_basic(&args, &application_path);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #63: FILE: src/gatt-database.c:3649: + dbus_message_iter_next(&args);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #64: FILE: src/gatt-database.c:3650: + if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_OBJECT_PATH) {$ WARNING:BRACES: braces {} are not necessary for single statement blocks #64: FILE: src/gatt-database.c:3650: + if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_OBJECT_PATH) { + return btd_error_invalid_args(msg); + } ERROR:CODE_INDENT: code indent should use tabs where possible #65: FILE: src/gatt-database.c:3651: + return btd_error_invalid_args(msg);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #65: FILE: src/gatt-database.c:3651: + return btd_error_invalid_args(msg);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #66: FILE: src/gatt-database.c:3652: + }$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #67: FILE: src/gatt-database.c:3653: + dbus_message_iter_get_basic(&args, &client_path);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #69: FILE: src/gatt-database.c:3655: + dbus_message_iter_next(&args);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #70: FILE: src/gatt-database.c:3656: + if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_OBJECT_PATH) {$ WARNING:BRACES: braces {} are not necessary for single statement blocks #70: FILE: src/gatt-database.c:3656: + if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_OBJECT_PATH) { + return btd_error_invalid_args(msg); + } ERROR:CODE_INDENT: code indent should use tabs where possible #71: FILE: src/gatt-database.c:3657: + return btd_error_invalid_args(msg);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #71: FILE: src/gatt-database.c:3657: + return btd_error_invalid_args(msg);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #72: FILE: src/gatt-database.c:3658: + }$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #73: FILE: src/gatt-database.c:3659: + dbus_message_iter_get_basic(&args, &characteristic_path);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #75: FILE: src/gatt-database.c:3661: + dbus_message_iter_next(&args);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #76: FILE: src/gatt-database.c:3662: + if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_ARRAY) {$ WARNING:BRACES: braces {} are not necessary for single statement blocks #76: FILE: src/gatt-database.c:3662: + if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_ARRAY) { + return btd_error_invalid_args(msg); + } ERROR:CODE_INDENT: code indent should use tabs where possible #77: FILE: src/gatt-database.c:3663: + return btd_error_invalid_args(msg);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #77: FILE: src/gatt-database.c:3663: + return btd_error_invalid_args(msg);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #78: FILE: src/gatt-database.c:3664: + }$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #80: FILE: src/gatt-database.c:3666: + dbus_message_iter_recurse(&args, &array);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #81: FILE: src/gatt-database.c:3667: + dbus_message_iter_get_fixed_array(&array, &value, &value_len);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #83: FILE: src/gatt-database.c:3669: + match_data.path = application_path;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #84: FILE: src/gatt-database.c:3670: + match_data.sender = sender;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #85: FILE: src/gatt-database.c:3671: + app = queue_find(database->apps, match_app, &match_data);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #86: FILE: src/gatt-database.c:3672: + if (!app) {$ WARNING:BRACES: braces {} are not necessary for single statement blocks #86: FILE: src/gatt-database.c:3672: + if (!app) { + return btd_error_does_not_exist(msg); + } ERROR:CODE_INDENT: code indent should use tabs where possible #87: FILE: src/gatt-database.c:3673: + return btd_error_does_not_exist(msg);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #87: FILE: src/gatt-database.c:3673: + return btd_error_does_not_exist(msg);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #88: FILE: src/gatt-database.c:3674: + }$ WARNING:LONG_LINE: line length of 84 exceeds 80 columns #90: FILE: src/gatt-database.c:3676: + service = queue_find(app->services, match_service_by_chrc, characteristic_path); WARNING:LEADING_SPACE: please, no spaces at the start of a line #90: FILE: src/gatt-database.c:3676: + service = queue_find(app->services, match_service_by_chrc, characteristic_path);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #91: FILE: src/gatt-database.c:3677: + if(!service) {$ ERROR:SPACING: space required before the open parenthesis '(' #91: FILE: src/gatt-database.c:3677: + if(!service) { WARNING:BRACES: braces {} are not necessary for single statement blocks #91: FILE: src/gatt-database.c:3677: + if(!service) { + return btd_error_does_not_exist(msg); + } ERROR:CODE_INDENT: code indent should use tabs where possible #92: FILE: src/gatt-database.c:3678: + return btd_error_does_not_exist(msg);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #92: FILE: src/gatt-database.c:3678: + return btd_error_does_not_exist(msg);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #93: FILE: src/gatt-database.c:3679: + }$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #95: FILE: src/gatt-database.c:3681: + chrc = queue_find(service->chrcs, match_chrc, characteristic_path);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #96: FILE: src/gatt-database.c:3682: + if(!chrc) {$ ERROR:SPACING: space required before the open parenthesis '(' #96: FILE: src/gatt-database.c:3682: + if(!chrc) { WARNING:BRACES: braces {} are not necessary for single statement blocks #96: FILE: src/gatt-database.c:3682: + if(!chrc) { + return btd_error_agent_not_available(msg); + } ERROR:CODE_INDENT: code indent should use tabs where possible #97: FILE: src/gatt-database.c:3683: + return btd_error_agent_not_available(msg);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #97: FILE: src/gatt-database.c:3683: + return btd_error_agent_not_available(msg);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #98: FILE: src/gatt-database.c:3684: + }$ WARNING:LONG_LINE: line length of 84 exceeds 80 columns #100: FILE: src/gatt-database.c:3686: + client_device = btd_adapter_find_device_by_path(database->adapter, client_path); WARNING:LEADING_SPACE: please, no spaces at the start of a line #100: FILE: src/gatt-database.c:3686: + client_device = btd_adapter_find_device_by_path(database->adapter, client_path);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #101: FILE: src/gatt-database.c:3687: + if (!client_device){$ ERROR:SPACING: space required before the open brace '{' #101: FILE: src/gatt-database.c:3687: + if (!client_device){ WARNING:BRACES: braces {} are not necessary for single statement blocks #101: FILE: src/gatt-database.c:3687: + if (!client_device){ + return btd_error_does_not_exist(msg); + } ERROR:CODE_INDENT: code indent should use tabs where possible #102: FILE: src/gatt-database.c:3688: + return btd_error_does_not_exist(msg);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #102: FILE: src/gatt-database.c:3688: + return btd_error_does_not_exist(msg);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #103: FILE: src/gatt-database.c:3689: + }$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #104: FILE: src/gatt-database.c:3690: + client_state = find_device_state(database,$ ERROR:CODE_INDENT: code indent should use tabs where possible #105: FILE: src/gatt-database.c:3691: + device_get_address(client_device),$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #105: FILE: src/gatt-database.c:3691: + device_get_address(client_device),$ ERROR:CODE_INDENT: code indent should use tabs where possible #106: FILE: src/gatt-database.c:3692: + btd_device_get_bdaddr_type(client_device));$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #106: FILE: src/gatt-database.c:3692: + btd_device_get_bdaddr_type(client_device));$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #107: FILE: src/gatt-database.c:3693: + if (!client_state) {$ WARNING:BRACES: braces {} are not necessary for single statement blocks #107: FILE: src/gatt-database.c:3693: + if (!client_state) { + return btd_error_does_not_exist(msg); + } ERROR:CODE_INDENT: code indent should use tabs where possible #108: FILE: src/gatt-database.c:3694: + return btd_error_does_not_exist(msg);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #108: FILE: src/gatt-database.c:3694: + return btd_error_does_not_exist(msg);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #109: FILE: src/gatt-database.c:3695: + }$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #111: FILE: src/gatt-database.c:3697: + notify.handle = gatt_db_attribute_get_handle(chrc->attrib);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #112: FILE: src/gatt-database.c:3698: + notify.ccc_handle = gatt_db_attribute_get_handle(chrc->ccc);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #113: FILE: src/gatt-database.c:3699: + notify.database = database;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #114: FILE: src/gatt-database.c:3700: + notify.value = value;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #115: FILE: src/gatt-database.c:3701: + notify.len = value_len;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #116: FILE: src/gatt-database.c:3702: + notify.conf = conf_cb;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #118: FILE: src/gatt-database.c:3704: + send_notification_to_device(client_state, ¬ify);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #119: FILE: src/gatt-database.c:3705: + DBG("Notification/Indication sent to %s.", client_path);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #120: FILE: src/gatt-database.c:3706: + return dbus_message_new_method_return(msg);$ ERROR:CODE_INDENT: code indent should use tabs where possible #131: FILE: src/gatt-database.c:3718: + GDBUS_ARGS( {"application", "o" },$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #131: FILE: src/gatt-database.c:3718: + GDBUS_ARGS( {"application", "o" },$ ERROR:SPACING: space prohibited after that open parenthesis '(' #131: FILE: src/gatt-database.c:3718: + GDBUS_ARGS( {"application", "o" }, ERROR:CODE_INDENT: code indent should use tabs where possible #132: FILE: src/gatt-database.c:3719: + { "device", "o" },$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #132: FILE: src/gatt-database.c:3719: + { "device", "o" },$ ERROR:CODE_INDENT: code indent should use tabs where possible #133: FILE: src/gatt-database.c:3720: + { "characteristic_path", "o"},$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #133: FILE: src/gatt-database.c:3720: + { "characteristic_path", "o"},$ ERROR:CODE_INDENT: code indent should use tabs where possible #134: FILE: src/gatt-database.c:3721: + { "value", "ay"}),$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #134: FILE: src/gatt-database.c:3721: + { "value", "ay"}),$ ERROR:CODE_INDENT: code indent should use tabs where possible #135: FILE: src/gatt-database.c:3722: + NULL, notify_characteristic_changed) },$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #135: FILE: src/gatt-database.c:3722: + NULL, notify_characteristic_changed) },$ - total: 22 errors, 93 warnings, 109 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. NOTE: Whitespace errors detected. You may wish to use scripts/cleanpatch or scripts/cleanfile "[PATCH] Added GDBusMethod to notify one device of characteristic" has style problems, please review. NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. ############################## Test: GitLint - PASS Desc: Run gitlint with rule in .gitlint ############################## Test: Prep - Setup ELL - PASS Desc: Clone, build, and install ELL ############################## Test: Build - Prep - PASS Desc: Prepare environment for build ############################## Test: Build - Configure - PASS Desc: Configure the BlueZ source tree ############################## Test: Build - Make - FAIL Desc: Build the BlueZ source tree Output: src/gatt-database.c: In function ‘notify_characteristic_changed’: src/gatt-database.c:3627:14: error: unused variable ‘device_bdaddr’ [-Werror=unused-variable] 3627 | bdaddr_t device_bdaddr; | ^~~~~~~~~~~~~ src/gatt-database.c:3626:18: error: unused variable ‘reply’ [-Werror=unused-variable] 3626 | DBusMessage *reply; | ^~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:9205: src/bluetoothd-gatt-database.o] Error 1 make: *** [Makefile:4147: all] Error 2 ############################## Test: Make Check - FAIL Desc: Run 'make check' Output: src/gatt-database.c: In function ‘notify_characteristic_changed’: src/gatt-database.c:3627:14: error: unused variable ‘device_bdaddr’ [-Werror=unused-variable] 3627 | bdaddr_t device_bdaddr; | ^~~~~~~~~~~~~ src/gatt-database.c:3626:18: error: unused variable ‘reply’ [-Werror=unused-variable] 3626 | DBusMessage *reply; | ^~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:9205: src/bluetoothd-gatt-database.o] Error 1 make: *** [Makefile:10436: check] Error 2 ############################## Test: Make Distcheck - PASS Desc: Run distcheck to check the distribution ############################## Test: Build w/ext ELL - Configure - PASS Desc: Configure BlueZ source with '--enable-external-ell' configuration ############################## Test: Build w/ext ELL - Make - FAIL Desc: Build BlueZ source with '--enable-external-ell' configuration Output: src/gatt-database.c: In function ‘notify_characteristic_changed’: src/gatt-database.c:3627:14: error: unused variable ‘device_bdaddr’ [-Werror=unused-variable] 3627 | bdaddr_t device_bdaddr; | ^~~~~~~~~~~~~ src/gatt-database.c:3626:18: error: unused variable ‘reply’ [-Werror=unused-variable] 3626 | DBusMessage *reply; | ^~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:9205: src/bluetoothd-gatt-database.o] Error 1 make: *** [Makefile:4147: all] Error 2 --- Regards, Linux Bluetooth
diff --git a/src/gatt-database.c b/src/gatt-database.c index 99c95f2d6..08609d3a4 100644 --- a/src/gatt-database.c +++ b/src/gatt-database.c @@ -3615,6 +3615,97 @@ static DBusMessage *manager_unregister_app(DBusConnection *conn, return dbus_message_new_method_return(msg); } +static DBusMessage *notify_characteristic_changed(DBusConnection *conn, + DBusMessage *msg, void *user_data) +{ + struct btd_gatt_database *database = user_data; + uint8_t *value = NULL; + int value_len = 0; + DBusMessageIter args; + DBusMessageIter array; + DBusMessage *reply; + bdaddr_t device_bdaddr; + const char *characteristic_path; + const char *client_path; + const char *application_path; + struct svc_match_data match_data; + const char *sender = dbus_message_get_sender(msg); + struct gatt_app *app; + struct external_service *service; + struct external_chrc *chrc; + struct notify notify; + struct device_state *client_state; + struct btd_device *client_device; + + if (!dbus_message_iter_init(msg, &args)) { + return btd_error_invalid_args(msg); + } + + if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_OBJECT_PATH) { + return btd_error_invalid_args(msg); + } + dbus_message_iter_get_basic(&args, &application_path); + + dbus_message_iter_next(&args); + if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_OBJECT_PATH) { + return btd_error_invalid_args(msg); + } + dbus_message_iter_get_basic(&args, &client_path); + + dbus_message_iter_next(&args); + if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_OBJECT_PATH) { + return btd_error_invalid_args(msg); + } + dbus_message_iter_get_basic(&args, &characteristic_path); + + dbus_message_iter_next(&args); + if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_ARRAY) { + return btd_error_invalid_args(msg); + } + + dbus_message_iter_recurse(&args, &array); + dbus_message_iter_get_fixed_array(&array, &value, &value_len); + + match_data.path = application_path; + match_data.sender = sender; + app = queue_find(database->apps, match_app, &match_data); + if (!app) { + return btd_error_does_not_exist(msg); + } + + service = queue_find(app->services, match_service_by_chrc, characteristic_path); + if(!service) { + return btd_error_does_not_exist(msg); + } + + chrc = queue_find(service->chrcs, match_chrc, characteristic_path); + if(!chrc) { + return btd_error_agent_not_available(msg); + } + + client_device = btd_adapter_find_device_by_path(database->adapter, client_path); + if (!client_device){ + return btd_error_does_not_exist(msg); + } + client_state = find_device_state(database, + device_get_address(client_device), + btd_device_get_bdaddr_type(client_device)); + if (!client_state) { + return btd_error_does_not_exist(msg); + } + + notify.handle = gatt_db_attribute_get_handle(chrc->attrib); + notify.ccc_handle = gatt_db_attribute_get_handle(chrc->ccc); + notify.database = database; + notify.value = value; + notify.len = value_len; + notify.conf = conf_cb; + + send_notification_to_device(client_state, ¬ify); + DBG("Notification/Indication sent to %s.", client_path); + return dbus_message_new_method_return(msg); +} + static const GDBusMethodTable manager_methods[] = { { GDBUS_ASYNC_METHOD("RegisterApplication", GDBUS_ARGS({ "application", "o" }, @@ -3623,6 +3714,12 @@ static const GDBusMethodTable manager_methods[] = { { GDBUS_ASYNC_METHOD("UnregisterApplication", GDBUS_ARGS({ "application", "o" }), NULL, manager_unregister_app) }, + { GDBUS_ASYNC_METHOD("NotifyCharacteristicChanged", + GDBUS_ARGS( {"application", "o" }, + { "device", "o" }, + { "characteristic_path", "o"}, + { "value", "ay"}), + NULL, notify_characteristic_changed) }, { } };