aboutsummaryrefslogtreecommitdiff
path: root/inc/bluetooth/profile/server/lls.h
diff options
context:
space:
mode:
Diffstat (limited to 'inc/bluetooth/profile/server/lls.h')
-rw-r--r--inc/bluetooth/profile/server/lls.h159
1 files changed, 159 insertions, 0 deletions
diff --git a/inc/bluetooth/profile/server/lls.h b/inc/bluetooth/profile/server/lls.h
new file mode 100644
index 0000000..4036bbb
--- /dev/null
+++ b/inc/bluetooth/profile/server/lls.h
@@ -0,0 +1,159 @@
+/**
+*****************************************************************************************
+* Copyright(c) 2017, Realtek Semiconductor Corporation. All rights reserved.
+*****************************************************************************************
+ * @file lls.h
+ * @brief Head file for using link loss service.
+ * @details LLS data structs and external functions declaration.
+ * @author
+ * @date
+ * @version v1.0
+ * *************************************************************************************
+ */
+
+/* Define to prevent recursive inclusion */
+#ifndef _LLS_H_
+#define _LLS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/* Add Includes here */
+#include "profile_server.h"
+
+/** @defgroup LLS Link Loss Service
+ * @brief Link loss service
+ * @details
+
+ The Link Loss Service (LLS) defines behavior when a link is lost between two devices.
+
+ The Link Loss Service uses the Alert Level characteristic to cause an alert in the device
+ when the link is lost.
+
+ Link Loss Service generally constitutes a profile collectively with other Services, such
+ as Proximity or Find Me etc., which enables device to cause an alert when the link is lost.
+
+ Application shall register link loss service when initialization through @ref lls_add_service function.
+
+ Application can set LLS alert level value through @ref lls_set_parameter function.
+
+ * @{
+ */
+/*============================================================================*
+ * Macros
+ *============================================================================*/
+/** @defgroup LLS_Exported_Macros LLS Service Exported Macros
+ * @brief
+ * @{
+ */
+
+/** @defgroup LLS_Read_Info LLS Read Info
+ * @brief Read characteristic value.
+ * @{
+ */
+#define LLS_READ_ALERT_LEVEL 1
+/** @} */
+
+/** @} End of LLS_Exported_Macros */
+
+/*============================================================================*
+ * Types
+ *============================================================================*/
+
+/** @defgroup LLS_Exported_Types LLS Exported Types
+ * @brief
+ * @{
+ */
+
+/** @defgroup LLS_PARAM_TYPE LLS Parameter Type
+* @brief Type of parameters set from application.
+* @{
+*/
+typedef enum
+{
+ LLS_PARAM_LINK_LOSS_ALERT_LEVEL
+} T_LLS_PARAM_TYPE;
+/** @} */
+
+/** @defgroup LLS_Callback_Data LLS Callback Data
+ * @brief LLS data struct for notification data to application.
+ * @{
+ */
+/** Message content: @ref T_LLS_CALLBACK_DATA */
+typedef union
+{
+ uint8_t read_value_index;
+ uint8_t write_alert_level;
+} T_LLS_UPSTREAM_MSG_DATA;
+
+/** LLSdata service data to inform application */
+typedef struct
+{
+ uint8_t conn_id;
+ T_SERVICE_CALLBACK_TYPE msg_type;
+ T_LLS_UPSTREAM_MSG_DATA msg_data;
+} T_LLS_CALLBACK_DATA;
+/** @} */
+
+/** @} End of LLS_Exported_Types */
+
+/*============================================================================*
+ * Functions
+ *============================================================================*/
+
+/** @defgroup LLS_Exported_Functions LLS Exported Functions
+ * @brief
+ * @{
+ */
+
+/**
+ * @brief Set a link loss service parameter.
+ *
+ * NOTE: You can call this function with a link loss service parameter type and it will set the
+ * link loss service parameter. Link loss service parameters are defined in @ref T_LLS_PARAM_TYPE.
+ * If the "len" field sets to the size of a "uint16_t" ,the
+ * "p_value" field must point to a data with type of "uint16_t".
+ *
+ * @param[in] param_type Link loss service parameter type: @ref T_LLS_PARAM_TYPE
+ * @param[in] length Length of data to write
+ * @param[in] p_value Pointer to data to write. This is dependent on
+ * the parameter type and WILL be cast to the appropriate
+ * data type (For example: if data type of param is uint16_t, p_value will be cast to
+ * pointer of uint16_t).
+ *
+ * @return Operation result.
+ * @retval true Operation success.
+ * @retval false Operation failure.
+ */
+bool lls_set_parameter(T_LLS_PARAM_TYPE param_type, uint8_t length, void *p_value);
+
+/**
+ * @brief Add link loss service to the BLE stack database.
+ *
+ * @param[in] p_func Callback when service attribute was read, write or cccd update.
+ * @return Service id generated by the BLE stack: @ref T_SERVER_ID.
+ * @retval 0xFF Operation failure.
+ * @retval others Service id assigned by stack.
+ *
+ * <b>Example usage</b>
+ * \code{.c}
+ void profile_init()
+ {
+ server_init(1);
+ lls_id = lls_add_service(app_handle_profile_message);
+ }
+ * \endcode
+ */
+T_SERVER_ID lls_add_service(void *p_func);
+/** @} End of LLS_Exported_Functions */
+
+/** @} End of LLS*/
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
+