• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 ASR Microelectronics (Shanghai) Co., Ltd. All rights reserved.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  ****************************************************************************************
18  *
19  * @file sonata_prf_diss_api.h
20  *
21  * @brief header file - device information service server api
22  *
23  ****************************************************************************************
24  */
25 
26 #ifndef _SONATA_PRF_DISS_API_H_
27 #define _SONATA_PRF_DISS_API_H_
28 
29 /*
30  * INCLUDE FILES
31  ****************************************************************************************
32  */
33 /// @cond
34 #if BLE_HOST_PRESENT
35 /// @endcond
36 #include "sonata_utils_api.h"
37 #include "sonata_api_task.h"
38 
39 /**
40  * @defgroup SONATA_PRF_DISS_API PRF_DISS_API
41  * @{
42  */
43 
44 /*
45  * MACRO DEFINITIONS
46  ****************************************************************************************
47  */
48 
49 #define PRF_DISS_FEATURES                   (0x01FF)
50 
51 /*
52  * ENUM DEFINITIONS
53  ****************************************************************************************
54  */
55 
56 /// Attribute Table Indexes
57 typedef enum {
58     /// Manufacturer Name
59     SONATA_DIS_MANUFACTURER_NAME_CHAR,
60     /// Model Number
61     SONATA_DIS_MODEL_NB_STR_CHAR,
62     /// Serial Number
63     SONATA_DIS_SERIAL_NB_STR_CHAR,
64     /// HW Revision Number
65     SONATA_DIS_HARD_REV_STR_CHAR,
66     /// FW Revision Number
67     SONATA_DIS_FIRM_REV_STR_CHAR,
68     /// SW Revision Number
69     SONATA_DIS_SW_REV_STR_CHAR,
70     /// System Identifier Name
71     SONATA_DIS_SYSTEM_ID_CHAR,
72     /// IEEE Certificate
73     SONATA_DIS_IEEE_CHAR,
74     /// Plug and Play Identifier
75     SONATA_DIS_PNP_ID_CHAR,
76 
77     SONATA_DIS_CHAR_MAX,
78 } sonata_dis_info;
79 
80 /*
81  * Type Definition
82  ****************************************************************************************
83  */
84 
85 /*!
86  * @brief Callback for diss value
87  */
88 typedef struct prf_diss_callback {
89     uint16_t (*prf_diss_value_req)(sonata_dis_info info_id);
90 
91 } prf_diss_callback_t;
92 
93 /*
94  * FUNCTION DECLARATIONS
95  ****************************************************************************************
96  */
97 /*!
98  * @brief init diss profile
99  */
100 void sonata_prf_diss_init(void);
101 
102 /*!
103 * @brief Send value confirm message
104 * @param task_id task_id was get in SONATA_GAP_PROFILE_ADDED_IND event
105 * @param value @see sonata_dis_info
106 * @param data_len data length
107 * @param data data
108 * @return API_SUCCESS
109 */
110 int sonata_prf_diss_send_value_cfm_cmd(sonata_dis_info value, uint8_t data_len, uint8_t *data);
111 
112 /*!
113  * @brief add diss profile
114  */
115 void sonata_prf_diss_add_dis(void);
116 
117 /*!
118  * @brief Add diss callback
119  * @param cb
120  * @return API_SUCCESS
121  * @note if App need to modify the diss value in runtime, then should use this callback
122  */
123 uint16_t sonata_prf_diss_register_callback(prf_diss_callback_t *cb);
124 
125 extern const sonata_api_subtask_handlers_t prf_diss_api_ke_msg_handlers;
126 
127 /** @}*/
128 
129 #endif // BLE_HOST_PRESENT
130 
131 #endif // _SONATA_PRF_DISS_API_H_
132 
133