diff options
author | George Kiagiadakis <george.kiagiadakis@collabora.com> | 2019-06-10 11:29:33 +0300 |
---|---|---|
committer | George Kiagiadakis <george.kiagiadakis@collabora.com> | 2019-06-10 11:38:13 +0300 |
commit | dfc4fc4ffdabdc6a75b1a62e869bc16c297b8d89 (patch) | |
tree | d419bd6e8389834f7419466568277c96e883dc92 /binding/radio-binding.c | |
parent | 4fcdc4500e425badc1af4a5645e0c060161ddfaf (diff) |
Remove support for 4A and pulseaudio completely
Bug-AGL: SPEC-2473
Signed-off-by: George Kiagiadakis <george.kiagiadakis@collabora.com>
Change-Id: I320be57ce48a63c7e85b8daebf7b094423f580f9
Diffstat (limited to 'binding/radio-binding.c')
-rw-r--r-- | binding/radio-binding.c | 75 |
1 files changed, 2 insertions, 73 deletions
diff --git a/binding/radio-binding.c b/binding/radio-binding.c index 19cea20..847e822 100644 --- a/binding/radio-binding.c +++ b/binding/radio-binding.c @@ -55,71 +55,6 @@ static void scan_callback(uint32_t frequency, void *data) afb_event_push(scan_event, json_object_get(jresp)); } -static int set_role_state(bool state, char **output) -{ -#ifdef HAVE_4A_FRAMEWORK - int rc; - json_object *response = NULL; - json_object *jsonData = json_object_new_object(); - - json_object_object_add(jsonData, "action", json_object_new_string(state ? "open" : "close")); - rc = afb_service_call_sync("ahl-4a", "radio", jsonData, &response); - if (rc < 0) { - AFB_ERROR("Failed to %s 4A 'radio' role", state ? "open" : "close"); - goto failed; - } - - if(!state) { - // No need to look at the response on close - goto done; - } - - // Handle response on open - json_object *valJson = NULL; - json_object *val = NULL; - rc = json_object_object_get_ex(response, "response", &valJson); - if (rc == 0) { - AFB_ERROR("Reply from 4A is missing a 'response' field"); - rc = -1; - goto failed_malformed; - } - - rc = json_object_object_get_ex(valJson, "device_uri", &val); - if (rc == 0) { - AFB_ERROR("Reply from 4A is missing a 'device_uri' field"); - rc = -1; - goto failed_malformed; - } - - const char *jres_pcm = json_object_get_string(val); - char * p = strchr(jres_pcm, ':'); - - if (p == NULL) { - AFB_ERROR("Unable to parse 'device_uri' value field"); - rc = -1; - goto failed_malformed; - } - - if (output) { - if (asprintf(output, "hw:%s", p + 1) < 0) { - AFB_ERROR("Insufficient memory"); - rc = -1; - goto failed_malformed; - } - } -done: - rc = 0; - -failed_malformed: - json_object_put(response); - -failed: - return rc; -#else - return 0; -#endif -} - /* * Binding verb handlers */ @@ -373,13 +308,8 @@ static void frequency_step(struct afb_req request) */ static void start(struct afb_req request) { - char *output = NULL; - - if(set_role_state(true, &output) == 0) { - radio_impl_ops->set_output(output); - radio_impl_ops->start(); - free(output); - } + radio_impl_ops->set_output(NULL); + radio_impl_ops->start(); afb_req_success(request, NULL, NULL); json_object *jresp = json_object_new_object(); @@ -397,7 +327,6 @@ static void start(struct afb_req request) static void stop(struct afb_req request) { radio_impl_ops->stop(); - set_role_state(false, NULL); afb_req_success(request, NULL, NULL); json_object *jresp = json_object_new_object(); |