btp: Update connect event structure
Subsystems (2)
PATCH 1/3 btp: Update connect event structure
From: Tedd Ho-Jeong An <[email protected]>
This patch updates the connect event struct to align withe the btp spec.
Opcode 0x82 - Device Connected event
Controller Index: <controller id>
Event parameters: Address_Type (1 octet)
Address (6 octets) Connection Interval (2 octets) Connection Latency (2 octets) Supervision Timeout (2 octets)
--- src/shared/btp.h | 3 +++ 1 file changed, 3 insertions(+)
src/shared/btp.h +3 -0
@@ -259,6 +259,9 @@ struct btp_device_found_ev {struct btp_gap_device_connected_ev {uint8_t address_type;bdaddr_t address; +uint16_t connection_interval; +uint16_t connection_latency; +uint16_t supervision_timeout; } __packed;#define BTP_EV_GAP_DEVICE_DISCONNECTED 0x83
Signature · 1 line
2.25.4
PATCH 2/3 tools/btpclientctl: Add btpclient test application
From: Tedd Ho-Jeong An <[email protected]>
This patch adds a test application for btpclient, which exercises the BTP API.
--- Makefile.tools | 7 +- tools/btpclientctrl.c | 2151 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 2157 insertions(+), 1 deletion(-) create mode 100644 tools/btpclientctrl.c
Makefile.tools +6 -1
@@ -492,11 +492,16 @@ test_scripts += test/sap_client.py test/bluezutils.py \ test/test-gatt-profile test/test-mesh test/agent.py if BTPCLIENT -noinst_PROGRAMS += tools/btpclient +noinst_PROGRAMS += tools/btpclient tools/btpclientctrl tools_btpclient_SOURCES = tools/btpclient.c src/shared/btp.c src/shared/btp.h tools_btpclient_LDADD = lib/libbluetooth-internal.la \ src/libshared-ell.la $(ell_ldadd) tools_btpclient_DEPENDENCIES = lib/libbluetooth-internal.la $(ell_dependencies) tools/btpclient.$(OBJEXT): src/libshared-ell.la ell/internal + +tools_btpclientctrl_SOURCES = tools/btpclientctrl.c client/display.c +tools_btpclientctrl_LDADD = lib/libbluetooth-internal.la \ + src/libshared-mainloop.la $(GLIB_LIBS) \ + src/libshared-glib.la -lreadline endif
tools/btpclientctrl.c new file +2151 -0
2,151 lines not on this page · raw message
Signature · 1 line
2.25.4
PATCH 3/3 btpclient: Fix gap reset not sending response
In reply to [email protected]From: Tedd Ho-Jeong An <[email protected]>
This patch fixes the GAP reset command to response the default settings after resetting the stack.
--- tools/btpclient.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-)
tools/btpclient.c +19 -15
@@ -521,6 +521,19 @@ static void reset_unreg_agent_reply(struct l_dbus_proxy *proxy, ag.registered = false; } +static void update_current_settings (struct btp_adapter *adapter, +uint32_t new_settings) +{ +struct btp_new_settings_ev ev; + + adapter->current_settings = new_settings; + + ev.current_settings =L_CPU_TO_LE32 (adapter->current_settings); + +btp_send (btp,BTP_GAP_SERVICE ,BTP_EV_GAP_NEW_SETTINGS , adapter->index, +sizeof (ev), &ev); +} +static void btp_gap_reset (uint8_t index,const void *param,uint16_t length,void *user_data) {
@@ -528,6 +541,7 @@ static void btp_gap_reset(uint8_t index, const void *param, uint16_t length,const struct l_queue_entry *entry;uint8_t status;bool prop; +uint32_t default_settings;if (!adapter) { status =BTP_ERROR_INVALID_INDEX ;
@@ -570,10 +584,13 @@ static void btp_gap_reset(uint8_t index, const void *param, uint16_t length, goto failed; } - adapter->current_settings = adapter->default_settings; + default_settings = adapter->default_settings; + +update_current_settings (adapter, default_settings);/* TODO for we assume all went well */ -btp_send (btp,BTP_GAP_SERVICE ,BTP_OP_GAP_RESET , index,0 ,NULL ); +btp_send (btp,BTP_GAP_SERVICE ,BTP_OP_GAP_RESET , index, +sizeof (default_settings), &default_settings);return ; failed:
@@ -644,19 +661,6 @@ failed:btp_send_error (btp,BTP_GAP_SERVICE , index, status); } -static void update_current_settings (struct btp_adapter *adapter, -uint32_t new_settings) -{ -struct btp_new_settings_ev ev; - - adapter->current_settings = new_settings; - - ev.current_settings =L_CPU_TO_LE32 (adapter->current_settings); - -btp_send (btp,BTP_GAP_SERVICE ,BTP_EV_GAP_NEW_SETTINGS , adapter->index, -sizeof (ev), &ev); -} -static void btp_gap_set_connectable (uint8_t index,const void *param,uint16_t length,void *user_data) {
Signature · 1 line
2.25.4