summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2008-09-04 15:39:00 +0300
committerJohan Hedberg <johan.hedberg@nokia.com>2008-09-04 15:39:00 +0300
commit09c1b1ac6c7da499430445eb51d346f907daa00c (patch)
tree80dd7faf8d9188b37d5e5870dedfda5dcded01ca /audio
parent70d1d32c6eebef45adfa46e714a8f78482007f52 (diff)
Add a telephony_ready callback to notify initialization completion
Diffstat (limited to 'audio')
-rw-r--r--audio/headset.c27
-rw-r--r--audio/manager.c1
-rw-r--r--audio/telephony-dummy.c10
-rw-r--r--audio/telephony.h9
4 files changed, 22 insertions, 25 deletions
diff --git a/audio/headset.c b/audio/headset.c
index 4fc58cf8..b9e7ccbd 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -70,6 +70,7 @@
static struct ag_state {
gboolean telephony_ready;
uint32_t features;
+ struct indicator *indicators;
int er_mode;
int er_ind;
int rh;
@@ -266,19 +267,14 @@ static int report_indicators(struct audio_device *device, const char *buf)
struct headset *hs = device->headset;
int err;
char *str;
- struct indicator *indicators;
if (strlen(buf) < 8)
return -EINVAL;
- indicators = telephony_indicators_req();
- if (!indicators)
- return headset_send(hs, "\r\nERROR\r\n");
-
if (buf[7] == '=')
- str = indicator_ranges(indicators);
+ str = indicator_ranges(ag.indicators);
else
- str = indicator_values(indicators);
+ str = indicator_values(ag.indicators);
err = headset_send(hs, str);
@@ -1992,7 +1988,7 @@ void telephony_features_rsp(uint32_t features)
ag.features = features;
}
-int telephony_event_ind(int index, int value)
+int telephony_event_ind(int index)
{
struct headset *hs;
@@ -2009,7 +2005,8 @@ int telephony_event_ind(int index, int value)
return -EINVAL;
}
- return headset_send(hs, "\r\n+CIEV:%d,%d\r\n", index, value);
+ return headset_send(hs, "\r\n+CIEV:%d,%d\r\n", index + 1,
+ ag.indicators[index].val);
}
int telephony_response_and_hold_ind(int rh)
@@ -2032,3 +2029,15 @@ int telephony_response_and_hold_ind(int rh)
return headset_send(hs, "\r\n+BTRH:%d\r\n", ag.rh);
}
+
+int telephony_ready(uint32_t features, struct indicator *indicators, int rh)
+{
+ ag.telephony_ready = TRUE;
+ ag.features = features;
+ ag.indicators = indicators;
+ ag.rh = rh;
+
+ debug("Telephony plugin initialized");
+
+ return 0;
+}
diff --git a/audio/manager.c b/audio/manager.c
index f4905ea9..2484e932 100644
--- a/audio/manager.c
+++ b/audio/manager.c
@@ -935,7 +935,6 @@ int audio_manager_init(DBusConnection *conn, GKeyFile *conf)
proceed:
if (enabled.headset) {
telephony_init();
- telephony_features_req();
btd_register_adapter_driver(&headset_server_driver);
}
diff --git a/audio/telephony-dummy.c b/audio/telephony-dummy.c
index 73d367c1..b4658e01 100644
--- a/audio/telephony-dummy.c
+++ b/audio/telephony-dummy.c
@@ -55,15 +55,6 @@ static struct indicator indicators[] =
{ NULL }
};
-int telephony_features_req(void)
-{
- uint32_t features = 0;
-
- telephony_features_rsp(features);
-
- return 0;
-}
-
struct indicator *telephony_indicators_req(void)
{
return indicators;
@@ -90,6 +81,7 @@ int telephony_response_and_hold_req(int rh)
int telephony_init(void)
{
+ telephony_ready(0, indicators, -1);
return 0;
}
diff --git a/audio/telephony.h b/audio/telephony.h
index 21d5af4d..4cc74ede 100644
--- a/audio/telephony.h
+++ b/audio/telephony.h
@@ -40,18 +40,15 @@ struct indicator {
int val;
};
-int telephony_features_req(void);
-void telephony_features_rsp(uint32_t features);
-
-struct indicator *telephony_indicators_req(void);
-
int telephony_event_reporting_req(int ind);
-int telephony_event_ind(int index, int value);
+int telephony_event_ind(int index);
int telephony_response_and_hold_req(int rh);
int telephony_response_and_hold_ind(int rh);
+int telephony_ready(uint32_t features, struct indicator *indicators, int rh);
+
int telephony_init(void);
void telephony_exit(void);