--- /dev/null
+/*
+ * 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 "tester-main.h"
+
+static struct queue *list; /* List of hidhost test cases */
+
+struct queue *get_hidhost_tests(void)
+{
+ list = queue_new();
+
+ return list;
+}
+
+void remove_hidhost_tests(void)
+{
+ queue_destroy(list, NULL);
+}
.le_test_mode_cb = NULL
};
+static bthh_callbacks_t bthh_callbacks = {
+ .size = sizeof(bthh_callbacks),
+ .connection_state_cb = NULL,
+ .hid_info_cb = NULL,
+ .protocol_mode_cb = NULL,
+ .idle_time_cb = NULL,
+ .get_report_cb = NULL,
+ .virtual_unplug_cb = NULL
+};
+
static bool setup_base(struct test_data *data)
{
const hw_module_t *module;
tester_setup_complete();
}
+static void setup_hidhost(const void *test_data)
+{
+ struct test_data *data = tester_get_data();
+ bt_status_t status;
+ const void *hid;
+
+ if (!setup_base(data)) {
+ tester_setup_failed();
+ return;
+ }
+
+ status = data->if_bluetooth->init(&bt_callbacks);
+ if (status != BT_STATUS_SUCCESS) {
+ data->if_bluetooth = NULL;
+ tester_setup_failed();
+ return;
+ }
+
+ hid = data->if_bluetooth->get_profile_interface(BT_PROFILE_HIDHOST_ID);
+ if (!hid) {
+ tester_setup_failed();
+ return;
+ }
+
+ data->if_hid = hid;
+
+ status = data->if_hid->init(&bthh_callbacks);
+ if (status != BT_STATUS_SUCCESS) {
+ data->if_hid = NULL;
+ tester_setup_failed();
+ return;
+ }
+
+ tester_setup_complete();
+}
+
static void teardown(const void *test_data)
{
struct test_data *data = tester_get_data();
queue_destroy(data->steps, NULL);
data->steps = NULL;
+ if (data->if_hid) {
+ data->if_hid->cleanup();
+ data->if_hid = NULL;
+ }
+
if (data->if_bluetooth) {
data->if_bluetooth->cleanup();
data->if_bluetooth = NULL;
test_bredrle(tc, setup_socket, generic_test_function, teardown);
}
+static void add_hidhost_tests(void *data, void *user_data)
+{
+ struct test_case *tc = data;
+
+ test_bredrle(tc, setup_hidhost, generic_test_function, teardown);
+}
+
int main(int argc, char *argv[])
{
snprintf(exec_dir, sizeof(exec_dir), "%s", dirname(argv[0]));
queue_foreach(get_bluetooth_tests(), add_bluetooth_tests, NULL);
queue_foreach(get_socket_tests(), add_socket_tests, NULL);
+ queue_foreach(get_hidhost_tests(), add_hidhost_tests, NULL);
if (tester_run())
return 1;
#include <hardware/hardware.h>
#include <hardware/bluetooth.h>
#include <hardware/bt_sock.h>
+#include <hardware/bt_hh.h>
#define get_test_case_step_num(tc) (sizeof(tc) / sizeof(struct step))
CB_BT_THREAD_EVT,
CB_BT_DUT_MODE_RECV,
CB_BT_LE_TEST_MODE,
+
+ /* Hidhost cb */
+ CB_HH_CONNECTION_STATE,
+ CB_HH_HID_INFO,
+ CB_HH_PROTOCOL_MODE,
+ CB_HH_IDLE_TIME,
+ CB_HH_GET_REPORT,
+ CB_HH_VIRTUAL_UNPLUG,
} expected_bt_callback_t;
struct test_data {
const bt_interface_t *if_bluetooth;
const btsock_interface_t *if_sock;
+ const bthh_interface_t *if_hid;
const void *test_data;
struct queue *steps;
void remove_bluetooth_tests(void);
struct queue *get_socket_tests(void);
void remove_socket_tests(void);
+struct queue *get_hidhost_tests(void);
+void remove_hidhost_tests(void);
/* Actions */
void dummy_action(void);