2016-08-26 17:17:27 +08:00
|
|
|
/** @file
|
|
|
|
* @brief Handsfree Profile handling.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2015-2016 Intel Corporation
|
|
|
|
*
|
2017-01-19 09:01:01 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2016-08-26 17:17:27 +08:00
|
|
|
*/
|
2018-09-15 01:43:44 +08:00
|
|
|
#ifndef ZEPHYR_INCLUDE_BLUETOOTH_HFP_HF_H_
|
|
|
|
#define ZEPHYR_INCLUDE_BLUETOOTH_HFP_HF_H_
|
2016-08-26 17:17:27 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Hands Free Profile (HFP)
|
|
|
|
* @defgroup bt_hfp Hands Free Profile (HFP)
|
|
|
|
* @ingroup bluetooth
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <bluetooth/bluetooth.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2017-02-27 20:00:24 +08:00
|
|
|
/* AT Commands */
|
|
|
|
enum bt_hfp_hf_at_cmd {
|
|
|
|
BT_HFP_HF_ATA,
|
|
|
|
BT_HFP_HF_AT_CHUP,
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Command complete types for the application
|
|
|
|
*/
|
|
|
|
#define HFP_HF_CMD_OK 0
|
|
|
|
#define HFP_HF_CMD_ERROR 1
|
|
|
|
#define HFP_HF_CMD_CME_ERROR 2
|
|
|
|
#define HFP_HF_CMD_UNKNOWN_ERROR 4
|
|
|
|
|
|
|
|
/** @brief HFP HF Command completion field */
|
|
|
|
struct bt_hfp_hf_cmd_complete {
|
|
|
|
/* Command complete status */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint8_t type;
|
2017-02-27 20:00:24 +08:00
|
|
|
/* CME error number to be added */
|
2020-05-28 00:26:57 +08:00
|
|
|
uint8_t cme;
|
2017-02-27 20:00:24 +08:00
|
|
|
};
|
|
|
|
|
2016-11-14 21:31:18 +08:00
|
|
|
/** @brief HFP profile application callback */
|
2016-08-26 17:17:27 +08:00
|
|
|
struct bt_hfp_hf_cb {
|
2016-11-14 21:31:18 +08:00
|
|
|
/** HF connected callback to application
|
|
|
|
*
|
|
|
|
* If this callback is provided it will be called whenever the
|
|
|
|
* connection completes.
|
|
|
|
*
|
|
|
|
* @param conn Connection object.
|
|
|
|
*/
|
2016-08-26 17:17:27 +08:00
|
|
|
void (*connected)(struct bt_conn *conn);
|
2016-11-14 21:31:18 +08:00
|
|
|
/** HF disconnected callback to application
|
|
|
|
*
|
|
|
|
* If this callback is provided it will be called whenever the
|
|
|
|
* connection gets disconnected, including when a connection gets
|
|
|
|
* rejected or cancelled or any error in SLC establisment.
|
|
|
|
*
|
|
|
|
* @param conn Connection object.
|
|
|
|
*/
|
2016-08-26 17:17:27 +08:00
|
|
|
void (*disconnected)(struct bt_conn *conn);
|
2016-11-14 21:31:18 +08:00
|
|
|
/** HF indicator Callback
|
|
|
|
*
|
|
|
|
* This callback provides service indicator value to the application
|
|
|
|
*
|
|
|
|
* @param conn Connection object.
|
|
|
|
* @param value service indicator value received from the AG.
|
|
|
|
*/
|
2020-05-28 00:26:57 +08:00
|
|
|
void (*service)(struct bt_conn *conn, uint32_t value);
|
2016-11-14 21:31:18 +08:00
|
|
|
/** HF indicator Callback
|
|
|
|
*
|
|
|
|
* This callback provides call indicator value to the application
|
|
|
|
*
|
|
|
|
* @param conn Connection object.
|
|
|
|
* @param value call indicator value received from the AG.
|
|
|
|
*/
|
2020-05-28 00:26:57 +08:00
|
|
|
void (*call)(struct bt_conn *conn, uint32_t value);
|
2016-11-14 21:31:18 +08:00
|
|
|
/** HF indicator Callback
|
|
|
|
*
|
|
|
|
* This callback provides call setup indicator value to the application
|
|
|
|
*
|
|
|
|
* @param conn Connection object.
|
|
|
|
* @param value call setup indicator value received from the AG.
|
|
|
|
*/
|
2020-05-28 00:26:57 +08:00
|
|
|
void (*call_setup)(struct bt_conn *conn, uint32_t value);
|
2016-11-14 21:31:18 +08:00
|
|
|
/** HF indicator Callback
|
|
|
|
*
|
|
|
|
* This callback provides call held indicator value to the application
|
|
|
|
*
|
|
|
|
* @param conn Connection object.
|
|
|
|
* @param value call held indicator value received from the AG.
|
|
|
|
*/
|
2020-05-28 00:26:57 +08:00
|
|
|
void (*call_held)(struct bt_conn *conn, uint32_t value);
|
2016-11-14 21:31:18 +08:00
|
|
|
/** HF indicator Callback
|
|
|
|
*
|
|
|
|
* This callback provides signal indicator value to the application
|
|
|
|
*
|
|
|
|
* @param conn Connection object.
|
|
|
|
* @param value signal indicator value received from the AG.
|
|
|
|
*/
|
2020-05-28 00:26:57 +08:00
|
|
|
void (*signal)(struct bt_conn *conn, uint32_t value);
|
2016-11-14 21:31:18 +08:00
|
|
|
/** HF indicator Callback
|
|
|
|
*
|
|
|
|
* This callback provides roaming indicator value to the application
|
|
|
|
*
|
|
|
|
* @param conn Connection object.
|
|
|
|
* @param value roaming indicator value received from the AG.
|
|
|
|
*/
|
2020-05-28 00:26:57 +08:00
|
|
|
void (*roam)(struct bt_conn *conn, uint32_t value);
|
2016-11-14 21:31:18 +08:00
|
|
|
/** HF indicator Callback
|
|
|
|
*
|
|
|
|
* This callback battery service indicator value to the application
|
|
|
|
*
|
|
|
|
* @param conn Connection object.
|
|
|
|
* @param value battery indicator value received from the AG.
|
|
|
|
*/
|
2020-05-28 00:26:57 +08:00
|
|
|
void (*battery)(struct bt_conn *conn, uint32_t value);
|
2017-02-20 19:54:41 +08:00
|
|
|
/** HF incoming call Ring indication callback to application
|
|
|
|
*
|
|
|
|
* If this callback is provided it will be called whenever there
|
|
|
|
* is an incoming call.
|
|
|
|
*
|
|
|
|
* @param conn Connection object.
|
|
|
|
*/
|
|
|
|
void (*ring_indication)(struct bt_conn *conn);
|
2017-02-27 20:00:24 +08:00
|
|
|
/** HF notify command completed callback to application
|
|
|
|
*
|
|
|
|
* The command sent from the application is notified about its status
|
|
|
|
*
|
|
|
|
* @param conn Connection object.
|
|
|
|
* @param cmd structure contains status of the command including cme.
|
|
|
|
*/
|
|
|
|
void (*cmd_complete_cb)(struct bt_conn *conn,
|
|
|
|
struct bt_hfp_hf_cmd_complete *cmd);
|
2016-08-26 17:17:27 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief Register HFP HF profile
|
|
|
|
*
|
|
|
|
* Register Handsfree profile callbacks to monitor the state and get the
|
|
|
|
* required HFP details to display.
|
|
|
|
*
|
|
|
|
* @param cb callback structure.
|
|
|
|
*
|
|
|
|
* @return 0 in case of success or negative value in case of error.
|
|
|
|
*/
|
|
|
|
int bt_hfp_hf_register(struct bt_hfp_hf_cb *cb);
|
|
|
|
|
2017-02-27 20:00:24 +08:00
|
|
|
/** @brief Handsfree client Send AT
|
|
|
|
*
|
|
|
|
* Send specific AT commands to handsfree client profile.
|
|
|
|
*
|
|
|
|
* @param conn Connection object.
|
|
|
|
* @param cmd AT command to be sent.
|
|
|
|
*
|
|
|
|
* @return 0 in case of success or negative value in case of error.
|
|
|
|
*/
|
|
|
|
int bt_hfp_hf_send_cmd(struct bt_conn *conn, enum bt_hfp_hf_at_cmd cmd);
|
|
|
|
|
2016-08-26 17:17:27 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#endif /* ZEPHYR_INCLUDE_BLUETOOTH_HFP_HF_H_ */
|