From d6cbeb4c61f5dc0c0d04dd022139b44f81964b18 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 15 Dec 2002 13:18:53 +0000 Subject: Support for voice setting --- include/hci.h | 13 +++++++++++++ include/hci_lib.h | 2 ++ src/hci.c | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+) diff --git a/include/hci.h b/include/hci.h index 7868366c..a00b7218 100644 --- a/include/hci.h +++ b/include/hci.h @@ -338,6 +338,19 @@ typedef struct { } __attribute__ ((packed)) write_class_of_dev_cp; #define WRITE_CLASS_OF_DEV_CP_SIZE 3 +#define OCF_READ_VOICE_SETTING 0x0025 +typedef struct { + uint8_t status; + uint16_t voice_setting; +} __attribute__ ((packed)) read_voice_setting_rp; +#define READ_VOICE_SETTING_RP_SIZE 3 + +#define OCF_WRITE_VOICE_SETTING 0x0026 +typedef struct { + uint16_t voice_setting; +} __attribute__ ((packed)) write_voice_setting_cp; +#define WRITE_VOICE_SETTING_CP_SIZE 2 + #define OCF_HOST_BUFFER_SIZE 0x0033 typedef struct { uint16_t acl_mtu; diff --git a/include/hci_lib.h b/include/hci_lib.h index e7aa8bcd..81d29ecf 100644 --- a/include/hci_lib.h +++ b/include/hci_lib.h @@ -75,6 +75,8 @@ int hci_read_remote_version(int dd, uint16_t handle, struct hci_version *ver, in int hci_read_local_version(int dd, struct hci_version *ver, int to); int hci_read_class_of_dev(int dd, uint8_t *cls, int to); int hci_write_class_of_dev(int dd, uint32_t cls, int to); +int hci_read_voice_setting(int dd, uint16_t *vs, int to); +int hci_write_voice_setting(int dd, uint16_t vs, int to); int hci_read_current_iac_lap(int dd, uint8_t *num_iac, uint8_t *lap, int to); int hci_write_current_iac_lap(int dd, uint8_t num_iac, uint8_t *lap, int to); diff --git a/src/hci.c b/src/hci.c index 42de36e5..b8bbc0c2 100644 --- a/src/hci.c +++ b/src/hci.c @@ -970,6 +970,43 @@ int hci_write_class_of_dev(int dd, uint32_t cls, int to) return hci_send_req(dd, &rq, 1000); } +int hci_read_voice_setting(int dd, uint16_t *vs, int to) +{ + read_voice_setting_rp rp; + struct hci_request rq; + + memset(&rq, 0, sizeof(rq)); + rq.ogf = OGF_HOST_CTL; + rq.ocf = OCF_READ_VOICE_SETTING; + rq.rparam = &rp; + rq.rlen = READ_VOICE_SETTING_RP_SIZE; + + if (hci_send_req(dd, &rq, to) < 0) + return -1; + + if (rp.status) { + errno = EIO; + return -1; + } + + *vs = rp.voice_setting; + return 0; +} + +int hci_write_voice_setting(int dd, uint16_t vs, int to) +{ + write_voice_setting_cp cp; + struct hci_request rq; + + memset(&rq, 0, sizeof(rq)); + cp.voice_setting = vs; + rq.ogf = OGF_HOST_CTL; + rq.ocf = OCF_WRITE_VOICE_SETTING; + rq.cparam = &cp; + rq.clen = WRITE_VOICE_SETTING_CP_SIZE; + return hci_send_req(dd, &rq, 1000); +} + int hci_read_current_iac_lap(int dd, uint8_t *num_iac, uint8_t *lap, int to) { read_current_iac_lap_rp rp; -- cgit