2015-04-15 20:37:22 +08:00
|
|
|
/* bluetooth.c - Bluetooth smoke test */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2015 Intel Corporation.
|
|
|
|
*
|
2015-10-07 00:00:37 +08:00
|
|
|
* 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
|
2015-04-15 20:37:22 +08:00
|
|
|
*
|
2015-10-07 00:00:37 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2015-04-15 20:37:22 +08:00
|
|
|
*
|
2015-10-07 00:00:37 +08:00
|
|
|
* 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.
|
2015-04-15 20:37:22 +08:00
|
|
|
*/
|
|
|
|
|
2015-10-21 19:36:59 +08:00
|
|
|
#include <zephyr.h>
|
|
|
|
|
2015-04-15 20:37:22 +08:00
|
|
|
#include <errno.h>
|
|
|
|
#include <tc_util.h>
|
|
|
|
|
|
|
|
#include <bluetooth/bluetooth.h>
|
2015-06-16 22:31:09 +08:00
|
|
|
#include <bluetooth/driver.h>
|
2015-04-15 20:37:22 +08:00
|
|
|
|
|
|
|
#define EXPECTED_ERROR -ENOSYS
|
|
|
|
|
|
|
|
static int driver_open(void)
|
|
|
|
{
|
|
|
|
TC_PRINT("driver: %s\n", __func__);
|
|
|
|
|
|
|
|
/* Indicate that there is no real Bluetooth device */
|
|
|
|
return EXPECTED_ERROR;
|
|
|
|
}
|
|
|
|
|
2015-10-29 02:24:16 +08:00
|
|
|
static int driver_send(enum bt_buf_type type, struct net_buf *buf)
|
2015-04-15 20:37:22 +08:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct bt_driver drv = {
|
2015-05-15 05:30:48 +08:00
|
|
|
.open = driver_open,
|
2015-10-29 02:24:16 +08:00
|
|
|
.send = driver_send,
|
2015-04-15 20:37:22 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static void driver_init(void)
|
|
|
|
{
|
|
|
|
bt_driver_register(&drv);
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(CONFIG_MICROKERNEL)
|
|
|
|
void mainloop(void)
|
|
|
|
#else
|
|
|
|
void main(void)
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
int ret, ret_code;
|
|
|
|
|
|
|
|
driver_init();
|
|
|
|
|
2015-07-28 23:23:19 +08:00
|
|
|
ret = bt_enable(NULL);
|
2015-05-15 05:30:48 +08:00
|
|
|
if (ret == EXPECTED_ERROR) {
|
2015-04-15 20:37:22 +08:00
|
|
|
ret_code = TC_PASS;
|
2015-05-16 01:05:47 +08:00
|
|
|
} else {
|
2015-04-15 20:37:22 +08:00
|
|
|
ret_code = TC_FAIL;
|
2015-05-15 05:30:48 +08:00
|
|
|
}
|
2015-04-15 20:37:22 +08:00
|
|
|
|
|
|
|
TC_END(ret_code, "%s - %s.\n", ret_code == TC_PASS ? PASS : FAIL,
|
2015-05-15 05:30:48 +08:00
|
|
|
__func__);
|
2015-04-15 20:37:22 +08:00
|
|
|
|
|
|
|
TC_END_REPORT(ret_code);
|
|
|
|
}
|