linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@codecoup.pl>
To: linux-bluetooth@vger.kernel.org
Cc: Szymon Janc <szymon.janc@codecoup.pl>
Subject: [PATCH 3/9] shared/btp: Add definitions for GAP service
Date: Thu,  7 Dec 2017 15:21:37 +0100	[thread overview]
Message-ID: <20171207142143.27324-4-szymon.janc@codecoup.pl> (raw)
In-Reply-To: <20171207142143.27324-1-szymon.janc@codecoup.pl>

---
 src/shared/btp.h | 225 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 225 insertions(+)

diff --git a/src/shared/btp.h b/src/shared/btp.h
index 1bb3d6313..10b729afd 100644
--- a/src/shared/btp.h
+++ b/src/shared/btp.h
@@ -71,6 +71,231 @@ struct btp_core_unregister_cp {
 
 #define BTP_EV_CORE_READY			0x80
 
+#define BTP_OP_GAP_READ_SUPPORTED_COMMANDS	0x01
+
+#define BTP_OP_GAP_READ_CONTROLLER_INDEX_LIST	0x02
+struct btp_gap_read_index_rp {
+	uint8_t num;
+	uint8_t indexes[0];
+} __packed;
+
+#define BTP_GAP_SETTING_POWERED			0x00000001
+#define BTP_GAP_SETTING_CONNECTABLE		0x00000002
+#define BTP_GAP_SETTING_FAST_CONNECTABLE	0x00000004
+#define BTP_GAP_SETTING_DISCOVERABLE		0x00000008
+#define BTP_GAP_SETTING_BONDABLE		0x00000010
+#define BTP_GAP_SETTING_LL_SECURITY		0x00000020
+#define BTP_GAP_SETTING_SSP			0x00000040
+#define BTP_GAP_SETTING_BREDR			0x00000080
+#define BTP_GAP_SETTING_HS			0x00000100
+#define BTP_GAP_SETTING_LE			0x00000200
+#define BTP_GAP_SETTING_ADVERTISING		0x00000400
+#define BTP_GAP_SETTING_SC			0x00000800
+#define BTP_GAP_SETTING_DEBUG_KEYS		0x00001000
+#define BTP_GAP_SETTING_PRIVACY			0x00002000
+#define BTP_GAP_SETTING_CONTROLLER_CONF		0x00004000
+#define BTP_GAP_SETTING_STATIC_ADDRESS		0x00008000
+
+#define BTP_OP_GAP_READ_COTROLLER_INFO		0x03
+struct btp_gap_read_info_rp {
+	uint8_t address[6];
+	uint32_t supported_settings;
+	uint32_t current_settings;
+	uint8_t cod[3];
+	uint8_t name[249];
+	uint8_t short_name[11];
+} __packed;
+
+#define BTP_OP_GAP_RESET			0x04
+struct btp_gap_reset_rp {
+	uint32_t current_settings;
+} __packed;
+
+#define BTP_OP_GAP_SET_POWERED			0x05
+struct btp_gap_set_powered_cp {
+	uint8_t powered;
+} __packed;
+
+struct btp_gap_set_powered_rp {
+	uint32_t current_settings;
+} __packed;
+
+#define BTP_OP_GAP_SET_CONNECTABLE		0x06
+struct btp_gap_set_connectable_cp {
+	uint8_t connectable;
+} __packed;
+
+struct btp_gap_set_connectable_rp {
+	uint32_t current_settings;
+} __packed;
+
+#define BTP_OP_GAP_SET_FAST_CONNECTABLE		0x07
+struct btp_gap_set_fast_connectable_cp {
+	uint8_t fast_connectable;
+} __packed;
+
+struct btp_gap_set_fast_connectable_rp {
+	uint32_t current_settings;
+} __packed;
+
+#define BTP_OP_GAP_SET_DISCOVERABLE		0x08
+struct btp_gap_set_discoverable_cp {
+	uint8_t discoverable;
+} __packed;
+
+struct btp_gap_set_discoverable_rp {
+	uint32_t current_settings;
+} __packed;
+
+#define BTP_OP_GAP_SET_BONDABLE			0x09
+struct btp_gap_set_bondable_cp {
+	uint8_t bondable;
+} __packed;
+
+struct btp_gap_set_bondable_rp {
+	uint32_t current_settings;
+} __packed;
+
+#define BTP_OP_GAP_START_ADVERTISING		0x0a
+struct btp_gap_start_adv_cp {
+	uint8_t adv_data_len;
+	uint8_t scan_rsp_len;
+	uint8_t data[0];
+} __packed;
+
+struct btp_gap_start_adv_rp {
+	uint32_t current_settings;
+} __packed;
+
+#define BTP_OP_GAP_STOP_ADVERTISING		0x0b
+struct btp_gap_stop_adv_rp {
+	uint32_t current_settings;
+} __packed;
+
+#define BTP_GAP_DISCOVERY_FLAG_LE		0x01
+#define BTP_GAP_DISCOVERY_FLAG_BREDR		0x02
+#define BTP_GAP_DISCOVERY_FLAG_LIMITED		0x04
+#define BTP_GAP_DISCOVERY_FLAG_ACTIVE		0x08
+#define BTP_GAP_DISCOVERY_FLAG_OBSERVATION	0x10
+
+#define BTP_OP_GAP_START_DISCOVERY		0x0c
+struct btp_gap_start_discovery_cp {
+	uint8_t flags;
+} __packed;
+
+#define BTP_OP_GAP_STOP_DISCOVERY		0x0d
+
+#define BTP_GAP_ADDR_PUBLIC			0x00
+#define BTP_GAP_ADDR_RANDOM			0x01
+
+#define BTP_OP_GAP_CONNECT			0x0e
+struct btp_gap_connect_cp {
+	uint8_t address_type;
+	uint8_t address[6];
+} __packed;
+
+#define BTP_OP_GAP_DISCONNECT			0x0f
+struct btp_gap_disconnect_cp {
+	uint8_t address_type;
+	uint8_t address[6];
+} __packed;
+
+#define BTP_GAP_IOCAPA_DISPLAY_ONLY		0x00
+#define BTP_GAP_IOCAPA_DISPLAY_YESNO		0x01
+#define BTP_GAP_IOCAPA_KEYBOARD_ONLY		0x02
+#define BTP_GAP_IOCAPA_NO_INPUT_NO_OUTPUT	0x03
+#define BTP_GAP_IOCAPA_KEYBOARD_DISPLAY		0x04
+
+#define BTP_OP_GAP_SET_IO_CAPA			0x10
+struct btp_gap_set_io_capa_cp {
+	uint8_t capa;
+} __packed;
+
+#define BTP_OP_GAP_PAIR				0x11
+struct btp_gap_pair_cp {
+	uint8_t address_type;
+	uint8_t address[6];
+} __packed;
+
+#define BTP_OP_GAP_UNPAIR			0x12
+struct btp_gap_unpair_cp {
+	uint8_t address_type;
+	uint8_t address[6];
+} __packed;
+
+#define BTP_OP_GAP_PASSKEY_ENTRY_RSP		0x13
+struct btp_gap_passkey_entry_rsp_cp {
+	uint8_t address_type;
+	uint8_t address[6];
+	uint32_t passkey;
+} __packed;
+
+#define BTP_OP_GAP_PASSKEY_CONFIRM_RSP		0x14
+struct btp_gap_passkey_confirm_rsp_cp {
+	uint8_t address_type;
+	uint8_t address[6];
+	uint8_t match;
+} __packed;
+
+#define BTP_EV_GAP_NEW_SETTINGS			0x80
+struct btp_new_settings_ev {
+	uint32_t current_settings;
+} __packed;
+
+#define BTP_EV_GAP_DEVICE_FOUND_FLAG_RSSI	0x00
+#define BTP_EV_GAP_DEVICE_FOUND_FLAG_AD		0x01
+#define BTP_EV_GAP_DEVICE_FOUND_FLAG_SR		0x02
+
+#define BTP_EV_GAP_DEVICE_FOUND			0x81
+struct btp_device_found_ev {
+	uint8_t address[6];
+	uint8_t address_type;
+	int8_t rssi;
+	uint8_t flags;
+	uint16_t eir_len;
+	uint8_t eir[0];
+} __packed;
+
+#define BTP_EV_GAP_DEVICE_CONNECTED		0x82
+struct btp_gap_device_connected_ev {
+	uint8_t address_type;
+	uint8_t address[6];
+} __packed;
+
+#define BTP_EV_GAP_DEVICE_DISCONNECTED		0x83
+struct btp_gap_device_disconnected_ev {
+	uint8_t address_type;
+	uint8_t address[6];
+} __packed;
+
+#define BTP_EV_GAP_PASSKEY_DISPLAY		0x84
+struct btp_gap_passkey_display_ev {
+	uint8_t address_type;
+	uint8_t address[6];
+	uint32_t passkey;
+} __packed;
+
+#define BTP_EV_GAP_PASSKEY_REQUEST		0x85
+struct btp_gap_passkey_req_ev {
+	uint8_t address_type;
+	uint8_t address[6];
+} __packed;
+
+#define BTP_EV_GAP_PASSKEY_CONFIRM		0x86
+struct btp_gap_passkey_confirm_ev {
+	uint8_t address_type;
+	uint8_t address[6];
+	uint32_t passkey;
+} __packed;
+
+#define BTP_EV_GAP_IDENTITY_RESOLVED		0x87
+struct btp_gap_identity_resolved_ev {
+	uint8_t address_type;
+	uint8_t address[6];
+	uint8_t identity_address_type;
+	uint8_t identity_address[6];
+} __packed;
+
 struct btp;
 
 typedef void (*btp_destroy_func_t)(void *user_data);
-- 
2.14.3


  parent reply	other threads:[~2017-12-07 14:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-07 14:21 [PATCH 0/9] Initial code for BTP client Szymon Janc
2017-12-07 14:21 ` [PATCH 1/9] shared/btp: Add initial code for library Szymon Janc
2017-12-07 14:21 ` [PATCH 2/9] tools/btpclient: Add initial code Szymon Janc
2017-12-07 14:21 ` Szymon Janc [this message]
2017-12-07 14:21 ` [PATCH 4/9] tools/btpclient: Store index along with adapter proxy Szymon Janc
2017-12-07 17:42   ` Luiz Augusto von Dentz
2017-12-08 10:12     ` Szymon Janc
2017-12-07 14:21 ` [PATCH 5/9] tools/btpclient: Add initial support for GAP service Szymon Janc
2017-12-07 14:21 ` [PATCH 6/9] tools/btpclient: Add initial support for read controller info command Szymon Janc
2017-12-07 14:21 ` [PATCH 7/9] tools/btpclient: Get initial values for adapter setttings Szymon Janc
2017-12-07 14:21 ` [PATCH 8/9] tools/btpclient: Add support for tracking mutable adapter settings Szymon Janc
2017-12-07 14:21 ` [PATCH 9/9] tools/btpclient: Add support for configuring " Szymon Janc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171207142143.27324-4-szymon.janc@codecoup.pl \
    --to=szymon.janc@codecoup.pl \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).