aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2011-03-31 14:26:20 +0300
committerJohan Hedberg <johan.hedberg@nokia.com>2011-03-31 14:26:20 +0300
commit421efd407e93464d86e6c77ebf3e237001a30bfe (patch)
tree38506a214afa2d94f5db294bf2dfa5e543947679
parent23fed61b1f3385f6f2d5c98cea8e8536ef5d3be1 (diff)
downloadbluez-421efd407e93464d86e6c77ebf3e237001a30bfe.tar.gz
mgmt: Add support for start_discovery & stop_discovery
-rw-r--r--doc/mgmt-api.txt15
-rw-r--r--lib/mgmt.h4
-rw-r--r--plugins/mgmtops.c24
3 files changed, 41 insertions, 2 deletions
diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
index 13340449..0d6523f6 100644
--- a/doc/mgmt-api.txt
+++ b/doc/mgmt-api.txt
@@ -303,6 +303,21 @@ Remove Remote Out Of Band Data Command
Command Parameters: Address (6 Octets)
Return Paramters:
+Start Discovery Command
+=======================
+
+ Command Code: 0x0001B
+ Controller Index: <controller id>
+ Command Parameters:
+ Return Parameters:
+
+Stop Discovery Command
+======================
+
+ Command Code: 0x0001C
+ Controller Index: <controller id>
+ Command Parameters:
+ Return Parameters:
Read Tracing Buffer Size Command
================================
diff --git a/lib/mgmt.h b/lib/mgmt.h
index fdec6c28..ec3985cc 100644
--- a/lib/mgmt.h
+++ b/lib/mgmt.h
@@ -201,6 +201,10 @@ struct mgmt_cp_remove_remote_oob_data {
bdaddr_t bdaddr;
} __packed;
+#define MGMT_OP_START_DISCOVERY 0x001B
+
+#define MGMT_OP_STOP_DISCOVERY 0x001C
+
#define MGMT_EV_CMD_COMPLETE 0x0001
struct mgmt_ev_cmd_complete {
uint16_t opcode;
diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c
index b41be772..f366c8b9 100644
--- a/plugins/mgmtops.c
+++ b/plugins/mgmtops.c
@@ -1518,14 +1518,34 @@ static int mgmt_set_limited_discoverable(int index, gboolean limited)
static int mgmt_start_inquiry(int index, uint8_t length, gboolean periodic)
{
+ struct mgmt_hdr hdr;
+
DBG("index %d length %u periodic %d", index, length, periodic);
- return -ENOSYS;
+
+ memset(&hdr, 0, sizeof(hdr));
+ hdr.opcode = htobs(MGMT_OP_START_DISCOVERY);
+ hdr.index = htobs(index);
+
+ if (write(mgmt_sock, &hdr, sizeof(hdr)) < 0)
+ return -errno;
+
+ return 0;
}
static int mgmt_stop_inquiry(int index)
{
+ struct mgmt_hdr hdr;
+
DBG("index %d", index);
- return -ENOSYS;
+
+ memset(&hdr, 0, sizeof(hdr));
+ hdr.opcode = htobs(MGMT_OP_STOP_DISCOVERY);
+ hdr.index = htobs(index);
+
+ if (write(mgmt_sock, &hdr, sizeof(hdr)) < 0)
+ return -errno;
+
+ return 0;
}
static int mgmt_start_scanning(int index)