Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add a telephony_ready callback to notify initialization completion

  • Loading branch information...
commit 09c1b1ac6c7da499430445eb51d346f907daa00c 1 parent 70d1d32
Johan Hedberg authored
View
27 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;
+}
View
1  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);
}
View
10 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;
}
View
9 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);
Please sign in to comment.
Something went wrong with that request. Please try again.