• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
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  * Description: SLE Service Access Protocol data struct defination.
16  */
17 
18 /**
19  * @defgroup sle_ssap_stru Service Access Protocol data struct defination.
20  * @ingroup  SLE
21  * @{
22  */
23 
24 #ifndef SLE_SSAP_STRU_H
25 #define SLE_SSAP_STRU_H
26 
27 #include <stdint.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 /**
34  * @if Eng
35  * @brief  Length of sle UUID.
36  * @else
37  * @brief  星闪UUID长度。
38  * @endif
39  */
40 #define SLE_UUID_LEN 16
41 
42 /**
43  * @if Eng
44  * @brief  Enum of write types for ssap clients to write property and descriptor.
45  * @else
46  * @brief  定义SSAP client写property和descriptor时的写类型。
47  * @endif
48  */
49 typedef enum {
50     SSAP_WRITE_NO_RSP           = 0x01, /*!< @if Eng type of wirte with no server response
51                                              @else 只写,且不需要server回复响应 @endif */
52     SSAP_WRITE_DEFAULT_WITH_RSP = 0x02, /*!< @if Eng type of wirte with server response
53                                              @else 只写,且需要server回复响应 @endif */
54 } ssap_write_type_t;
55 
56 /**
57  * @if Eng
58  * @brief  SSAP attribute permission.
59  * @else
60  * @brief  SSAP attribute操作权限。
61  * @endif
62  */
63 typedef enum {
64     SSAP_PERMISSION_READ                = 0x01, /*!< @if Eng readable
65                                                      @else   可读 @endif */
66     SSAP_PERMISSION_WRITE               = 0x02, /*!< @if Eng writable
67                                                      @else   可写 @endif */
68     SSAP_PERMISSION_ENCRYPTION_NEED     = 0x04, /*!< @if Eng need encryption
69                                                      @else   需要加密 @endif */
70     SSAP_PERMISSION_AUTHENTICATION_NEED = 0x08, /*!< @if Eng need authentication
71                                                      @else   需要认证 @endif */
72     SSAP_PERMISSION_AUTHORIZATION_NEED  = 0x10, /*!< @if Eng need authorization
73                                                      @else   需要授权 @endif */
74 } ssap_permission_t;
75 
76 /**
77  * @if Eng
78  * @brief  SSAP find type.
79  * @else
80  * @brief  SSAP 查找类型
81  * @endif
82  */
83 typedef enum {
84     SSAP_FIND_TYPE_SERVICE_STRUCTURE = 0x00, /*!< @if Eng service structure
85                                                   @else   服务结构 @endif */
86     SSAP_FIND_TYPE_PRIMARY_SERVICE   = 0x01, /*!< @if Eng primary service
87                                                   @else   首要服务 @endif */
88     SSAP_FIND_TYPE_REFERENCE_SERVICE = 0x02, /*!< @if Eng reference service
89                                                   @else   引用服务 @endif */
90     SSAP_FIND_TYPE_PROPERTY          = 0x03, /*!< @if Eng property
91                                                   @else   属性 @endif */
92     SSAP_FIND_TYPE_METHOD            = 0x04, /*!< @if Eng method
93                                                   @else   方法 @endif */
94     SSAP_FIND_TYPE_EVENT             = 0x05, /*!< @if Eng event
95                                                   @else   事件 @endif */
96 } ssap_find_type_t;
97 
98 /**
99  * @if Eng
100  * @brief  SSAP property type.
101  * @else
102  * @brief  SSAP 特征类型。
103  * @endif
104  */
105 typedef enum {
106     SSAP_PROPERTY_TYPE_VALUE             = 0x00, /*!< @if Eng property value
107                                                       @else   特征值 @endif */
108     SSAP_DESCRIPTOR_USER_DESCRIPTION     = 0x01, /*!< @if Eng user description descriptor
109                                                       @else   属性说明描述符 @endif */
110     SSAP_DESCRIPTOR_CLIENT_CONFIGURATION = 0x02, /*!< @if Eng client configuration descriptor
111                                                       @else   客户端配置描述符 @endif */
112     SSAP_DESCRIPTOR_SERVER_CONFIGURATION = 0x03, /*!< @if Eng server configuration descriptor
113                                                       @else   服务端配置描述符 @endif */
114     SSAP_DESCRIPTOR_PRESENTATION_FORMAT  = 0x04, /*!< @if Eng presentation format descriptor
115                                                       @else   格式描述符 @endif */
116     SSAP_DESCRIPTOR_RFU                  = 0x05, /*!< @if Eng RFU descriptor, 0x05 – 0x1F
117                                                       @else   服务管理保留描述符,0x05 – 0x1F @endif */
118     SSAP_DESCRIPTOR_CUSTOM               = 0xFF, /*!< @if Eng custom descriptor
119                                                       @else   厂商自定义描述符 @endif */
120 } ssap_property_type_t;
121 
122 /**
123  * @if Eng
124  * @brief  SSAP operation indication.
125  * @else
126  * @brief  SSAP 操作指示。
127  * @endif
128  */
129 typedef enum {
130     SSAP_OPERATE_INDICATION_BIT_READ = 0x01,              /*!< @if Eng data values can be read
131                                                                @else   数据值可被读取 @endif */
132     SSAP_OPERATE_INDICATION_BIT_WRITE_NO_RSP = 0x02,      /*!< @if Eng data values can be written without feedback.
133                                                                @else   数据值可被写入,写入后无反馈 @endif */
134     SSAP_OPERATE_INDICATION_BIT_WRITE = 0x04,             /*!< @if Eng data values can be written. After being written,
135                                                                        a feedback is generated to the client.
136                                                                @else   数据值可被写入,写入后产生反馈给客户端 @endif */
137     SSAP_OPERATE_INDICATION_BIT_NOTIFY = 0x08,            /*!< @if Eng data value send to client by notification.
138                                                                @else   数据值通过通知方式传递给客户端 @endif */
139     SSAP_OPERATE_INDICATION_BIT_INDICATE = 0x10,          /*!< @if Eng data value send to client by indication.
140                                                                @else   数据值通过指示方式传递给客户端 @endif */
141     SSAP_OPERATE_INDICATION_BIT_BROADCAST = 0x20,         /*!< @if Eng data value can be carried in broadcast
142                                                                @else   数据值可携带在广播中 @endif */
143     SSAP_OPERATE_INDICATION_BIT_DESCRITOR_WRITE = 0x100,  /*!< @if Eng data value description descriptor can be
144                                                                        written
145                                                                @else   数据值说明描述符可被写入 @endif */
146     SSAP_OPERATE_INDICATION_MAX,                          /*!< @if Eng maximum of operation indication
147                                                                @else   操作指示最大值 @endif */
148 } ssap_operate_indication_t;
149 
150 /**
151  * @if Eng
152  * @brief  UUID.
153  * @else
154  * @brief  通用唯一识别码。
155  * @endif
156  */
157 typedef struct {
158     uint8_t len;                /*!< @if Eng uuid len
159                                      @else   UUID 长度 @endif */
160     uint8_t uuid[SLE_UUID_LEN]; /*!< @if Eng uuid
161                                      @else   UUID字段 @endif */
162 } sle_uuid_t;
163 
164 /**
165  * @if Eng
166  * @brief  Struct of ssap info exchange
167  * @else
168  * @brief  ssap 信息交换结构体。
169  * @endif
170  */
171 typedef struct {
172     uint32_t mtu_size; /*!< @if Eng mtu size
173         ·                   @else   mtu大小 @endif */
174     uint16_t version;  /*!< @if Eng version
175                             @else   版本 @endif */
176 } ssap_exchange_info_t;
177 
178 #ifdef __cplusplus
179 }
180 #endif
181 #endif /* SLE_SSAP_STRU_H */
182 /**
183  * @}
184  */
185