zephyr/samples/bluetooth/tmap_central/src/ccp_call_control_server.c
Emil Gydesen e45830893f Bluetooth: CCP: Introduce new CCP API
The CCP API for the Call Control Profile works on top of the
TBS API, and will eventually replace parts of the TBS API.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-01-08 07:50:32 +01:00

57 lines
1.3 KiB
C

/** @file
* @brief Bluetooth Call Control Profile (CCP) Server role.
*
* Copyright 2023 NXP
* Copyright (c) 2024 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <zephyr/bluetooth/conn.h>
#include <zephyr/bluetooth/audio/tbs.h>
#include <zephyr/kernel.h>
#include <zephyr/sys/printk.h>
#define URI_LIST_LEN 2
static const char *uri_list[URI_LIST_LEN] = {"skype", "tel"};
static bool tbs_originate_call_cb(struct bt_conn *conn, uint8_t call_index,
const char *caller_id)
{
printk("CCP: Placing call to remote with id %u to %s\n",
call_index, caller_id);
return true;
}
static void tbs_terminate_call_cb(struct bt_conn *conn, uint8_t call_index, uint8_t reason)
{
printk("CCP: Call terminated for id %u with reason %u\n",
call_index, reason);
}
static struct bt_tbs_cb tbs_cbs = {
.originate_call = tbs_originate_call_cb,
.terminate_call = tbs_terminate_call_cb,
.hold_call = NULL,
.accept_call = NULL,
.retrieve_call = NULL,
.join_calls = NULL,
.authorize = NULL,
};
int ccp_call_control_server_init(void)
{
int err;
bt_tbs_register_cb(&tbs_cbs);
err = bt_tbs_set_uri_scheme_list(0, (const char **)&uri_list, URI_LIST_LEN);
return err;
}