summaryrefslogtreecommitdiff
path: root/client/gatt.c
Commit message (Collapse)AuthorAgeFilesLines
* client: Allow gatt.select-attribute to work with local attributesLuiz Augusto von Dentz2022-12-061-63/+235
| | | | | | | | | | | | | | | | | | This allows gatt.select-attribute local to select from the registered attributes: [bluetooth]# gatt.select-attribute local /org/bluez/app/service0/chrc0 [/org/bluez/app/service0/chrc0]# gatt.write 0x01 [CHG] Attribute /org/bluez/app/service0/chrc0 (%UUID) written [/org/bluez/app/service0/chrc0]# gatt.read 01 . [/org/bluez/app/service0/chrc0]# gatt.select-attribute local /org/bluez/app/service0/chrc1 [/org/bluez/app/service0/chrc1]# gatt.write 0x01 [CHG] Attribute /org/bluez/app/service0/chrc1 (%UUID) written [/org/bluez/app/service0/chrc1]# gatt.read 01 . [/org/bluez/app/service0/chrc1]#
* client/gatt: Fix scan-build warningLuiz Augusto von Dentz2022-09-231-1/+2
| | | | | | | | | This fixes the following warning: client/gatt.c:2146:2: warning: Null pointer passed to 2nd parameter expecting 'nonnull' [core.NonNullParamChecker] memcpy(*dst_value + offset, src_val, src_len); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* client/gatt: proxy_property_changed: check for NULL iteratorChristian Eggers2022-09-231-7/+10
| | | | | | | | | | The passed iterator can be NULL as in gdbus/client.c::properties_changed(): ... proxy->prop_func(..., ..., iter=NULL, ...) +--client/gatt.c::proxy_property_changed(..., ..., iter, ...); +--dbus_message_iter_get_arg_type(iter); ...
* client/gatt: Fix notification enabled/disabled outputLuiz Augusto von Dentz2022-09-211-2/+3
| | | | | When notifications are enabled/disable the output was not print a new line.
* client/gatt: Fix memory leak issuesGopal Tiwari2022-05-311-3/+9
| | | | | | | | | | | | | | | | | While performing the static tool analysis using coverity tool found following reports Error: RESOURCE_LEAK (CWE-772): bluez-5.64/client/gatt.c:1531: leaked_storage: Variable "service" going out of scope leaks the storage it points to. Error: RESOURCE_LEAK (CWE-772): bluez-5.64/client/gatt.c:2626: leaked_storage: Variable "chrc" going out of scope leaks the storage it points to. Error: RESOURCE_LEAK (CWE-772): bluez-5.64/client/gatt.c:2906: leaked_storage: Variable "desc" going out of scope leaks the storage it points to.
* build: Replace use of g_memdup with util_memdupLuiz Augusto von Dentz2022-01-061-1/+1
| | | | | | | | | | | This replaces the uses of g_memdup with util_memdup since the former has been deprecated: warning: ‘g_memdup’ is deprecated: Use 'g_memdup2' instead [-Wdeprecated-declarations] g_memdup2 requires bumping glib version which would likely have its own problems thus why util_memdup was introduced.
* client/gatt: Fix property_change in WriteValue for descUlisses Costa2021-12-071-1/+1
| | | | | g_dbus_emit_property_changed was not working properly in the WriteValue for the descriptor because the Characteristic interface was being used.
* client: Fix uninitiailzed scalar variableTedd Ho-Jeong An2021-11-151-0/+3
| | | | | This patch fixes the uninitiailzed varialble(CWE-457) reported by the Coverity scan.
* client/gatt: Fix using atoiLuiz Augusto von Dentz2021-11-091-11/+60
| | | | | | atoi doesn't support values entered in hexadecimal (0x...) which is likely the prefered format for the likes of handles, etc, so this replaces the uses of atoi with strtol.
* client: Add SPDX License IdentifierTedd Ho-Jeong An2020-09-211-14/+1
| | | | | | | | | | | | | | | | | | | | | | This patch adds SPDX License Identifier and removes the license text. ------------------------------------- License COUNT ------------------------------------- GPL-2.0-or-later : 11 License: GPL-2.0-or-later client/adv_monitor.c client/adv_monitor.h client/advertising.h client/display.c client/main.c client/display.h client/agent.h client/gatt.c client/agent.c client/advertising.c client/gatt.h
* client: Update write callbacks with invalid offset error handlersMariusz Skamra2020-05-111-0/+15
| | | | This patch adds invalid offset handlers to write callbacks of attributes.
* client: Fix possible stack corruptionŁukasz Rymanowski2020-05-111-3/+6
| | | | | | | DBUS_TYPE_BOOLEAN is 'int', which does not have to be the same size as 'bool'. On architecture where bool is smaller than in, getting prepare-authorize will corrupt the stack
* client: Fix not able to select attributes if parent existsLuiz Augusto von Dentz2019-08-201-1/+1
| | | | | When selecting attributes by UUID the code was not checking attributes that are not a children of the current selected attribute.
* client: Allow UUID 16 bits on select-attributeLuiz Augusto von Dentz2019-08-201-0/+3
| | | | This allow passing UUIDs on 16 bits format.
* client: Fix build with older version on libdbusLuiz Augusto von Dentz2019-02-261-10/+5
| | | | | | | This fixes the following error when building with older version of D-Bus: client/gatt.c:2973: undefined reference to `dbus_message_iter_get_element_count'
* client: Fix uninitialized errorLuiz Augusto von Dentz2019-02-131-1/+1
| | | | | trusted should be initialized with false since the property may not be available.
* client: Improve logging of GATT operationsLuiz Augusto von Dentz2019-02-131-17/+34
| | | | | This prints the UUID along with attribute path and also print the hexdump when payload is available.
* client: Forward notifications from cloned attributesLuiz Augusto von Dentz2019-02-131-0/+17
| | | | | Notifications come in a form of 'Value' property changes thus this copies the values to the local attribute so they are in sync.
* client: Remove cloned services if the proxy is removedLuiz Augusto von Dentz2019-02-131-0/+22
| | | | | This unregister the cloned services if the proxy is removed since they would no longer be accessible.
* client: Proxy calls to StartNotify/StopNotifyLuiz Augusto von Dentz2019-02-131-2/+87
| | | | | This uses the proxies created by clone command to forward the subscriptions to the cloned services.
* client: Proxy calls to ReadValue and WriteValueLuiz Augusto von Dentz2019-02-131-0/+141
| | | | | This uses the proxies created by clone command to forward the requests to the cloned services.
* client: Add gatt.clone commandLuiz Augusto von Dentz2019-02-131-0/+235
| | | | | | | | | | | | | | | | | | | This adds clone command to gatt submenu which can be use to clone services as follow: Clone all services from the connected device: > gatt.clone Clone a given service > gatt.select-attribute <attribute/uuid> > gatt.clone In either case there is a prompt to confirm since this may add a lot of service the user must confim before proceding. Then finally: > gatt.register-application
* client: Add type to write commandLuiz Augusto von Dentz2019-02-111-72/+52
| | | | | | | | | | | This enables setting the write type as optional third parameter: write <data=xx xx ...> [offset] [type] The type can be used to force a specific procedure to be used, for example to force reliable writes one can enter: > write 00 0 reliable
* client: Don't expose pointer value in attribute pathLuiz Augusto von Dentz2019-01-311-3/+6
| | | | | | | | | | Instead use the position in the list to create a unique path: [bluetooth]# register-service 0x1820 [NEW] Primary Service (Handle 0x0000) /org/bluez/app/service0 0x1820 Internet Protocol Support
* client: Enable list-attributes to print local attributesLuiz Augusto von Dentz2019-01-311-0/+42
| | | | | | | | | | | This enable passing "local" to list-attributes to print the attributes registered locally: > list-attributes local Primary Service (Handle 0x0400) /org/bluez/app/service0x74ccb0 0x1820 Internet Protocol Support
* client: Enable setting attribute handlesLuiz Augusto von Dentz2019-01-311-1/+10
| | | | This emulates application setting their attribute handles.
* client: Enable Handle property for GATT attributesLuiz Augusto von Dentz2019-01-311-16/+124
| | | | | This enable bluetoothd to write back the actual value of attribute handles.
* build: Move declaration of _GNU_SOURCE back into individual source filesMarcel Holtmann2018-12-061-0/+1
|
* client: Switch from write to sendmsg for Acquire*Luiz Augusto von Dentz2018-11-201-25/+60
| | | | Use sendmsg with MSG_NOSIGNAL to prevent crashes involving SIGPIPE.
* client: Don't require authorization for trusted devicesGrzegorz Kolodziejczyk2018-05-291-3/+18
| | | | | This patch adds possibility to ommit authorization request from trusted devices.
* client: Add authorized property handling to characteristic attributeGrzegorz Kolodziejczyk2018-05-281-52/+94
| | | | | This patch adds handling of characteristic prepare write authorized property to bluetoothctl.
* client/gatt : Add support for Included ServiceAvichal Agarwal2018-05-211-2/+151
| | | | included service support implemented at service registration
* client: Define maximum attribute value length as initial valueGrzegorz Kolodziejczyk2018-05-211-9/+45
| | | | Initial registered attribute value is set as maximal attribute length.
* client: Add missing duplicated string freeGrzegorz Kolodziejczyk2018-05-211-0/+2
| | | | This patch free duplicated strings in read, write attribute callbacks.
* client: Add support for optional gatt write offset parameterGrzegorz Kolodziejczyk2018-04-261-8/+26
| | | | This patch extends missing optional gatt write offset parameter.
* client: Add support for optional gatt read offset parameterGrzegorz Kolodziejczyk2018-04-261-5/+13
| | | | This patch extends missing optional gatt read offset parameter.
* client: Fix writing attribute valuesGrzegorz Kolodziejczyk2018-04-261-1/+15
| | | | | | Attribute values is not copied with dbus_message_iter_get_fixed_array, so gatt write callback needs to replace old value with reallocation and copy.
* client: Attempt to convert the device path to addressLuiz Augusto von Dentz2018-03-291-8/+24
| | | | Printing the object path is not only long but it also may change.
* client: Parse all options passed for GATT attributeLuiz Augusto von Dentz2018-03-261-42/+55
| | | | This parses the options given to Acquire*, WriteValue and ReadValue.
* client: Add authorization request handling for attribute operationsGrzegorz Kolodziejczyk2018-03-211-0/+128
| | | | | This patch adds optional authorization request for reading, writing of gatt database attributes.
* client: Update read callbacks with invalid offset error handlersGrzegorz Kolodziejczyk2018-03-211-0/+8
| | | | This patch adds invalid offset handlers to read callbacks of attributes.
* client: Fix reading long valuesGrzegorz Kolodziejczyk2018-03-211-2/+47
| | | | | | While value has more than single MTU can carry long read procedure will be triggered. In such cases offset need to bo considered while getting value from storage.
* client: Fix lines going beyond 80 columnsLuiz Augusto von Dentz2018-03-011-11/+20
|
* client: Quit when done with commandLuiz Augusto von Dentz2018-02-281-38/+75
| | | | | This ensures that the commands don't stay hanging since bt_shell no longer quits immediatelly after executing a command.
* client: Fix not cleaning up notify pipeLuiz Augusto von Dentz2018-02-061-2/+8
| | | | | | If remote unsubscribe, disconnects or the daemon closes the socket the io shall be destroyed properly otherwise it will prevent new subscriptions.
* client: Fix register-{characteristic, descriptor}Luiz Augusto von Dentz2018-01-161-2/+2
| | | | | Flags parameter should be found in the third parameter not the second since bt_shell don't omit the command anymore.
* client: Use g_dbus_proxy_path_lookup()ERAMOTO Masaya2018-01-021-17/+2
|
* client: Use g_dbus_proxy_lookup()ERAMOTO Masaya2018-01-021-29/+9
|
* tools: Remove monitor/uuid.{c,h}Luiz Augusto von Dentz2017-12-211-4/+4
| | | | Use the shared/util.h helpers instead.
* shared/shell: Don't remove command from argumentsLuiz Augusto von Dentz2017-12-081-6/+6
| | | | | Maintain the original argc and argv so the callback has a chance to parse the command if it has to.