diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2005-01-13 22:57:36 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2005-01-13 22:57:36 +0000 |
commit | 84cc44acd712f84ff544b7e1b96d1410c732dc8c (patch) | |
tree | dd64865287fa04178333d9e71566d92019e0f1ae /src/hci.c | |
parent | 864124c296636015f90e26512143cf2c297ed6d2 (diff) |
Add function for reading the transmit power level
Diffstat (limited to 'src/hci.c')
-rw-r--r-- | src/hci.c | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -1432,6 +1432,36 @@ int hci_write_afh_mode(int dd, uint8_t mode, int to) return 0; } +int hci_read_transmit_power_level(int dd, uint16_t handle, uint8_t type, uint8_t *level, int to) +{ + read_transmit_power_level_cp cp; + read_transmit_power_level_rp rp; + struct hci_request rq; + + memset(&cp, 0, sizeof(cp)); + cp.handle = handle; + cp.type = type; + + memset(&rq, 0, sizeof(rq)); + rq.ogf = OGF_HOST_CTL; + rq.ocf = OCF_READ_TRANSMIT_POWER_LEVEL; + rq.cparam = &cp; + rq.clen = READ_TRANSMIT_POWER_LEVEL_CP_SIZE; + rq.rparam = &rp; + rq.rlen = READ_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_read_link_supervision_timeout(int dd, uint16_t handle, uint16_t *timeout, int to) { read_link_supervision_timeout_rp rp; |