From 7568d14b66f8838f85d1a0c4d4fff599c3e54c59 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Thu, 23 Jan 2014 16:37:07 +0200 Subject: [PATCH] android/haltest: Add init and cleanup calls to rc methods --- android/Android.mk | 1 + android/Makefile.am | 1 + android/client/haltest.c | 2 ++ android/client/if-bt.c | 2 +- android/client/if-main.h | 2 ++ android/client/if-rc.c | 55 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 android/client/if-rc.c diff --git a/android/Android.mk b/android/Android.mk index e988f73b8..83ea4b37b 100644 --- a/android/Android.mk +++ b/android/Android.mk @@ -132,6 +132,7 @@ LOCAL_SRC_FILES := \ bluez/android/client/tabcompletion.c \ bluez/android/client/if-audio.c \ bluez/android/client/if-av.c \ + bluez/android/client/if-rc.c \ bluez/android/client/if-bt.c \ bluez/android/client/if-hf.c \ bluez/android/client/if-hh.c \ diff --git a/android/Makefile.am b/android/Makefile.am index 664524f7a..e065c0c8e 100644 --- a/android/Makefile.am +++ b/android/Makefile.am @@ -85,6 +85,7 @@ android_haltest_SOURCES = android/client/haltest.c \ android/client/tabcompletion.c \ android/client/if-main.h \ android/client/if-av.c \ + android/client/if-rc.c \ android/client/if-bt.c \ android/client/if-gatt.c \ android/client/if-hf.c \ diff --git a/android/client/haltest.c b/android/client/haltest.c index f4d1ade7f..114fe3181 100644 --- a/android/client/haltest.c +++ b/android/client/haltest.c @@ -34,6 +34,7 @@ const struct interface *interfaces[] = { &audio_if, &bluetooth_if, &av_if, + &rc_if, &gatt_if, &gatt_client_if, &gatt_server_if, @@ -382,6 +383,7 @@ static void init(void) static const char * const inames[] = { BT_PROFILE_HANDSFREE_ID, BT_PROFILE_ADVANCED_AUDIO_ID, + BT_PROFILE_AV_RC_ID, BT_PROFILE_HEALTH_ID, BT_PROFILE_HIDHOST_ID, BT_PROFILE_PAN_ID, diff --git a/android/client/if-bt.c b/android/client/if-bt.c index 6bfb439cf..8dcffeae9 100644 --- a/android/client/if-bt.c +++ b/android/client/if-bt.c @@ -760,7 +760,7 @@ static void get_profile_interface_p(int argc, const char **argv) else if (strcmp(BT_PROFILE_PAN_ID, id) == 0) pif = (const void **) &if_pan; else if (strcmp(BT_PROFILE_AV_RC_ID, id) == 0) - pif = &dummy; /* TODO: change when if_rc is there */ + pif = (const void **) &if_rc; else if (strcmp(BT_PROFILE_GATT_ID, id) == 0) pif = (const void **) &if_gatt; else diff --git a/android/client/if-main.h b/android/client/if-main.h index 2b22fc44e..d82358e3d 100644 --- a/android/client/if-main.h +++ b/android/client/if-main.h @@ -48,6 +48,7 @@ extern audio_hw_device_t *if_audio; /* Interfaces from hal that can be populated during application lifetime */ extern const bt_interface_t *if_bluetooth; extern const btav_interface_t *if_av; +extern const btrc_interface_t *if_rc; extern const bthf_interface_t *if_hf; extern const bthh_interface_t *if_hh; extern const btpan_interface_t *if_pan; @@ -68,6 +69,7 @@ struct interface { extern const struct interface audio_if; extern const struct interface bluetooth_if; extern const struct interface av_if; +extern const struct interface rc_if; extern const struct interface gatt_if; extern const struct interface gatt_client_if; extern const struct interface gatt_server_if; diff --git a/android/client/if-rc.c b/android/client/if-rc.c new file mode 100644 index 000000000..58fb89297 --- /dev/null +++ b/android/client/if-rc.c @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2014 Intel Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "if-main.h" +#include "../hal-utils.h" + +const btrc_interface_t *if_rc = NULL; + +static btrc_callbacks_t rc_cbacks = { + .size = sizeof(rc_cbacks), +}; + +/* init */ + +static void init_p(int argc, const char **argv) +{ + RETURN_IF_NULL(if_rc); + + EXEC(if_rc->init, &rc_cbacks); +} + +/* cleanup */ + +static void cleanup_p(int argc, const char **argv) +{ + RETURN_IF_NULL(if_rc); + + EXECV(if_rc->cleanup); + if_rc = NULL; +} + +static struct method methods[] = { + STD_METHOD(init), + STD_METHOD(cleanup), + END_METHOD +}; + +const struct interface rc_if = { + .name = "rc", + .methods = methods +}; -- 2.47.3