summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-10-05 11:23:35 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-10-05 11:23:35 +0000
commitf4afe8ea387410929ee303a510fd7cdfd1cc7552 (patch)
tree00cc5a1b55cf2690780d72052903c8f89cdb73e4
parent0d5bcfd73f1d52e3c2b49b28062f9972f40ad42f (diff)
Add support for inquiry transmit power level
-rw-r--r--include/hci_lib.h2
-rw-r--r--src/hci.c51
2 files changed, 53 insertions, 0 deletions
diff --git a/include/hci_lib.h b/include/hci_lib.h
index 1215a62f..7b728283 100644
--- a/include/hci_lib.h
+++ b/include/hci_lib.h
@@ -101,6 +101,8 @@ int hci_write_ext_inquiry_response(int dd, uint8_t fec, uint8_t *data, int to);
int hci_read_simple_pairing_mode(int dd, uint8_t *mode, int to);
int hci_write_simple_pairing_mode(int dd, uint8_t mode, int to);
int hci_read_local_oob_data(int dd, uint8_t *hash, uint8_t *randomizer, int to);
+int hci_read_inquiry_transmit_power_level(int dd, int8_t *level, int to);
+int hci_write_inquiry_transmit_power_level(int dd, int8_t level, int to);
int hci_read_transmit_power_level(int dd, uint16_t handle, uint8_t type, int8_t *level, int to);
int hci_read_link_supervision_timeout(int dd, uint16_t handle, uint16_t *timeout, int to);
int hci_write_link_supervision_timeout(int dd, uint16_t handle, uint16_t timeout, int to);
diff --git a/src/hci.c b/src/hci.c
index 54e57cf3..8351c475 100644
--- a/src/hci.c
+++ b/src/hci.c
@@ -2135,6 +2135,57 @@ int hci_read_local_oob_data(int dd, uint8_t *hash, uint8_t *randomizer, int to)
return 0;
}
+int hci_read_inquiry_transmit_power_level(int dd, int8_t *level, int to)
+{
+ read_inquiry_transmit_power_level_rp rp;
+ struct hci_request rq;
+
+ memset(&rq, 0, sizeof(rq));
+ rq.ogf = OGF_HOST_CTL;
+ rq.ocf = OCF_READ_INQUIRY_TRANSMIT_POWER_LEVEL;
+ rq.rparam = &rp;
+ rq.rlen = READ_INQUIRY_TRANSMIT_POWER_LEVEL_RP_SIZE;
+
+ if (hci_send_req(dd, &rq, to) < 0)
+ return -1;
+
+ if (rp.status) {
+ errno = EIO;
+ return -1;
+ }
+
+ *level = rp.level;
+ return 0;
+}
+
+int hci_write_inquiry_transmit_power_level(int dd, int8_t level, int to)
+{
+ write_inquiry_transmit_power_level_cp cp;
+ write_inquiry_transmit_power_level_rp rp;
+ struct hci_request rq;
+
+ memset(&cp, 0, sizeof(cp));
+ cp.level = level;
+
+ memset(&rq, 0, sizeof(rq));
+ rq.ogf = OGF_HOST_CTL;
+ rq.ocf = OCF_WRITE_INQUIRY_TRANSMIT_POWER_LEVEL;
+ rq.cparam = &cp;
+ rq.clen = WRITE_INQUIRY_TRANSMIT_POWER_LEVEL_CP_SIZE;
+ rq.rparam = &rp;
+ rq.rlen = WRITE_INQUIRY_TRANSMIT_POWER_LEVEL_RP_SIZE;
+
+ if (hci_send_req(dd, &rq, to) < 0)
+ return -1;
+
+ if (rp.status) {
+ errno = EIO;
+ return -1;
+ }
+
+ return 0;
+}
+
int hci_read_transmit_power_level(int dd, uint16_t handle, uint8_t type, int8_t *level, int to)
{
read_transmit_power_level_cp cp;