TI BLE-Stack for Bluetooth API Documentation  3.03.02.00
att.h
Go to the documentation of this file.
1 /******************************************************************************
2 
3  Group: WCS, BTS
4  $Target Device: DEVICES $
5 
6  ******************************************************************************
7  $License: TISD 2009 $
8  ******************************************************************************
9  $Release Name: PACKAGE NAME $
10  $Release Date: PACKAGE RELEASE DATE $
11  *****************************************************************************/
12 
27 #ifndef ATT_H
28 #define ATT_H
29 
30 #ifdef __cplusplus
31 extern "C"
32 {
33 #endif
34 
35 /*********************************************************************
36  * INCLUDES
37  */
38 #include "bcomdef.h"
39 #include "osal.h"
40 
41 #include "l2cap.h"
42 
43 /*********************************************************************
44  * CONSTANTS
45  */
46 
59 #define ATT_MTU_SIZE L2CAP_MTU_SIZE
60 #define ATT_MAX_MTU_SIZE (255-L2CAP_HDR_SIZE)
61 
66 #define ATT_ERROR_RSP 0x01
67 #define ATT_EXCHANGE_MTU_REQ 0x02
68 #define ATT_EXCHANGE_MTU_RSP 0x03
69 #define ATT_FIND_INFO_REQ 0x04
70 #define ATT_FIND_INFO_RSP 0x05
71 #define ATT_FIND_BY_TYPE_VALUE_REQ 0x06
72 #define ATT_FIND_BY_TYPE_VALUE_RSP 0x07
73 #define ATT_READ_BY_TYPE_REQ 0x08
74 #define ATT_READ_BY_TYPE_RSP 0x09
75 #define ATT_READ_REQ 0x0a
76 #define ATT_READ_RSP 0x0b
77 #define ATT_READ_BLOB_REQ 0x0c
78 #define ATT_READ_BLOB_RSP 0x0d
79 #define ATT_READ_MULTI_REQ 0x0e
80 #define ATT_READ_MULTI_RSP 0x0f
81 #define ATT_READ_BY_GRP_TYPE_REQ 0x10
82 #define ATT_READ_BY_GRP_TYPE_RSP 0x11
83 #define ATT_WRITE_REQ 0x12
84 #define ATT_WRITE_RSP 0x13
85 #define ATT_PREPARE_WRITE_REQ 0x16
86 #define ATT_PREPARE_WRITE_RSP 0x17
87 #define ATT_EXECUTE_WRITE_REQ 0x18
88 #define ATT_EXECUTE_WRITE_RSP 0x19
89 #define ATT_HANDLE_VALUE_NOTI 0x1b
90 #define ATT_HANDLE_VALUE_IND 0x1d
91 #define ATT_HANDLE_VALUE_CFM 0x1e
92 #define ATT_UNSUPPORTED_METHOD 0x20
93 
94 #define ATT_WRITE_CMD 0x52
95 #define ATT_SIGNED_WRITE_CMD 0xD2
96 
101 #define ATT_FLOW_CTRL_VIOLATED_EVENT 0x7E
102 #define ATT_MTU_UPDATED_EVENT 0x7F
103 
108 #define ATT_METHOD_BITS 0x3f
109 #define ATT_CMD_FLAG_BIT 0x40
110 #define ATT_AUTHEN_SIG_FLAG_BIT 0x80
111 #define ATT_BT_UUID_SIZE 2
112 #define ATT_UUID_SIZE 16
113 #define ATT_MSG_TIMEOUT 30
114 
120 #define ATT_SIG_NOT_INCLUDED 0x00
121 #define ATT_SIG_VALID 0x01
122 #define ATT_SIG_INVALID 0x02
123 
125 /*********************************************************************
126  * Error Response: Error Code
127  */
128 
132 #define ATT_ERR_INVALID_HANDLE 0x01
133 #define ATT_ERR_READ_NOT_PERMITTED 0x02
134 #define ATT_ERR_WRITE_NOT_PERMITTED 0x03
135 #define ATT_ERR_INVALID_PDU 0x04
136 #define ATT_ERR_INSUFFICIENT_AUTHEN 0x05
137 #define ATT_ERR_UNSUPPORTED_REQ 0x06
138 #define ATT_ERR_INVALID_OFFSET 0x07
139 #define ATT_ERR_INSUFFICIENT_AUTHOR 0x08
140 #define ATT_ERR_PREPARE_QUEUE_FULL 0x09
141 #define ATT_ERR_ATTR_NOT_FOUND 0x0a
142 #define ATT_ERR_ATTR_NOT_LONG 0x0b
143 #define ATT_ERR_INSUFFICIENT_KEY_SIZE 0x0c
144 #define ATT_ERR_INVALID_VALUE_SIZE 0x0d
145 #define ATT_ERR_UNLIKELY 0x0e
146 #define ATT_ERR_INSUFFICIENT_ENCRYPT 0x0f
147 #define ATT_ERR_UNSUPPORTED_GRP_TYPE 0x10
148 #define ATT_ERR_INSUFFICIENT_RESOURCES 0x11
149 
150 /*** Reserved for future use: 0x12 - 0x7F ***/
151 
152 /*** Application error code defined by a higher layer specification: 0x80-0x9F ***/
153 
154 #define ATT_ERR_INVALID_VALUE 0x80
155 
157 /*********************************************************************
158  * Find Information Response: UUID Format
159  */
160 #define ATT_HANDLE_BT_UUID_TYPE 0x01
161 #define ATT_HANDLE_UUID_TYPE 0x02
162 
163 /*********************************************************************
164  * Read Multiple Request: Handles
165  */
166 #define ATT_MIN_NUM_HANDLES 2
167 
168 /*********************************************************************
169  * Execute Write Request: Flags
170  */
171 #define ATT_CANCEL_PREPARED_WRITES 0x00
172 #define ATT_WRITE_PREPARED_VALUES 0x01
173 
174 #if defined ( TESTMODES )
175  #define ATT_TESTMODE_OFF 0
177  #define ATT_TESTMODE_UNAUTHEN_SIG 1
178  #define ATT_TESTMODE_SEND_UNS_REQ 2
179  #define ATT_TESTMODE_SEND_UNS_CMD 3
180 #endif
181 
185 #define ATT_OPCODE_SIZE 1
186 #define ATT_EXCHANGE_MTU_REQ_SIZE 2
187 #define ATT_EXCHANGE_MTU_RSP_SIZE 2
188 #define ATT_ERROR_RSP_SIZE 4
189 #define ATT_FIND_INFO_REQ_FIXED_SIZE 4
190 #define ATT_FIND_INFO_RSP_FIXED_SIZE 1
191 #define ATT_FIND_INFO_RSP_HDR_SIZE ( ATT_OPCODE_SIZE + ATT_FIND_INFO_RSP_FIXED_SIZE )
192 #define ATT_FIND_BY_TYPE_VALUE_REQ_FIXED_SIZE 6
193 #define ATT_FIND_BY_TYPE_VALUE_REQ_HDR_SIZE ( ATT_OPCODE_SIZE + ATT_FIND_BY_TYPE_VALUE_REQ_FIXED_SIZE )
194 #define ATT_READ_BY_TYPE_REQ_FIXED_SIZE 4
195 #define ATT_READ_BY_TYPE_REQ_HDR_SIZE ( ATT_OPCODE_SIZE + ATT_READ_BY_TYPE_REQ_FIXED_SIZE )
196 #define ATT_READ_BY_TYPE_RSP_FIXED_SIZE 1
197 #define ATT_READ_BY_TYPE_RSP_HDR_SIZE ( ATT_OPCODE_SIZE + ATT_READ_BY_TYPE_RSP_FIXED_SIZE )
198 #define ATT_READ_REQ_SIZE 2
199 #define ATT_READ_BY_GRP_TYPE_RSP_FIXED_SIZE 1
200 #define ATT_READ_BY_GRP_TYPE_RSP_HDR_SIZE ( ATT_OPCODE_SIZE + ATT_READ_BY_GRP_TYPE_RSP_FIXED_SIZE )
201 #define ATT_WRITE_REQ_FIXED_SIZE 2
202 #define ATT_READ_BLOB_REQ_SIZE 4
203 #define ATT_WRITE_REQ_FIXED_SIZE 2
204 #define ATT_WRITE_REQ_HDR_SIZE ( ATT_OPCODE_SIZE + ATT_WRITE_REQ_FIXED_SIZE )
205 #define ATT_PREPARE_WRITE_REQ_FIXED_SIZE 4
206 #define ATT_PREPARE_WRITE_REQ_HDR_SIZE ( ATT_OPCODE_SIZE + ATT_PREPARE_WRITE_REQ_FIXED_SIZE )
207 #define ATT_PREPARE_WRITE_RSP_FIXED_SIZE 4
208 #define ATT_EXECUTE_WRITE_REQ_SIZE 1
209 #define ATT_HANDLE_VALUE_IND_FIXED_SIZE 2
210 #define ATT_HANDLE_VALUE_IND_HDR_SIZE ( ATT_OPCODE_SIZE + ATT_HANDLE_VALUE_IND_FIXED_SIZE )
211 #define ATT_AUTHEN_SIG_LEN 12
212 
214 /*********************************************************************
215  * VARIABLES
216  */
217 
219 extern CONST uint8 btBaseUUID[ATT_UUID_SIZE];
221 
222 /*********************************************************************
223  * MACROS
224  */
226 #define ATT_WRITE_COMMAND( method, cmd ) ( ( (method) == ATT_WRITE_REQ ) && ( (cmd) == TRUE ) )
227 
228 /*********************************************************************
229  * ATT Find Info Response macros
230  */
231 
233 
234 // Handle and 16-bit Bluetooth UUID pair indexes
235 #define ATT_BT_PAIR_HANDLE_IDX( i ) ( (i) * (2 + ATT_BT_UUID_SIZE) )
236 #define ATT_BT_PAIR_UUID_IDX( i ) ( ATT_BT_PAIR_HANDLE_IDX( (i) ) + 2 )
237 
238 #define ATT_BT_PAIR_HANDLE( info, i ) ( BUILD_UINT16( (info)[ATT_BT_PAIR_HANDLE_IDX((i))], \
239  (info)[ATT_BT_PAIR_HANDLE_IDX((i))+1] ) )
240 #define ATT_BT_PAIR_UUID( info, i ) ( BUILD_UINT16( (info)[ATT_BT_PAIR_UUID_IDX((i))], \
241  (info)[ATT_BT_PAIR_UUID_IDX((i))+1] ) )
242 
243 // Handle and 128-bit UUID pair indexes
244 #define ATT_PAIR_HANDLE_IDX( i ) ( (i) * (2 + ATT_UUID_SIZE) )
245 #define ATT_PAIR_UUID_IDX( i ) ( ATT_PAIR_HANDLE_IDX( (i) ) + 2 )
246 
247 #define ATT_PAIR_HANDLE( info, i ) ( BUILD_UINT16( (info)[ATT_PAIR_HANDLE_IDX((i))], \
248  (info)[ATT_PAIR_HANDLE_IDX((i))+1] ) )
249 
250 /*********************************************************************
251  * ATT Find By Type Value Response macros
252  */
253 // Attribute Handle and Group End Handle pair indexes
254 #define ATT_ATTR_HANDLE_IDX( i ) ( (i) * (2 + 2) )
255 #define ATT_GRP_END_HANDLE_IDX( i ) ( ATT_ATTR_HANDLE_IDX( (i) ) + 2 )
256 
257 #define ATT_ATTR_HANDLE( info, i ) ( BUILD_UINT16( (info)[ATT_ATTR_HANDLE_IDX((i))], \
258  (info)[ATT_ATTR_HANDLE_IDX((i))+1] ) )
259 #define ATT_GRP_END_HANDLE( info, i ) ( BUILD_UINT16( (info)[ATT_GRP_END_HANDLE_IDX((i))], \
260  (info)[ATT_GRP_END_HANDLE_IDX((i))+1] ) )
261 
262 /*********************************************************************
263  * ATT Read Multiple Request macros
264  */
265 // Attribute Handle index
266 #define ATT_HANDLE_IDX( i ) ( (i) * 2 )
267 
268 #define ATT_HANDLE( handles, i ) ( BUILD_UINT16( (handles)[ATT_HANDLE_IDX((i))], \
269  (handles)[ATT_HANDLE_IDX((i))+1] ) )
270 
272 
275 /*********************************************************************
276  * TYPEDEFS
277  */
278 
283 typedef struct
285 {
286  uint8 sig;
287  uint8 cmd;
288  uint8 method;
289  uint16 len;
290  uint8 *pParams;
291 } attPacket_t;
292 
294 typedef struct
295 {
296  uint8 len;
297  uint8 uuid[ATT_UUID_SIZE];
298 } attAttrType_t;
299 
301 typedef struct
302 {
303  uint8 len;
304  uint8 uuid[ATT_BT_UUID_SIZE];
306 
316 typedef struct
317 {
318  uint8 reqOpcode;
319  uint16 handle;
320  uint8 errCode;
321 } attErrorRsp_t;
322 
328 typedef struct
329 {
330  uint16 clientRxMTU;
332 
338 typedef struct
339 {
340  uint16 serverRxMTU;
342 
348 typedef struct
349 {
350  uint16 startHandle;
351  uint16 endHandle;
353 
355 typedef struct
356 {
357  uint16 handle;
358  uint8 uuid[ATT_BT_UUID_SIZE];
360 
362 typedef struct
363 {
364  uint16 handle;
365  uint8 uuid[ATT_UUID_SIZE];
367 
373 typedef struct
374 {
375  uint16 numInfo;
376  uint8 format;
377  uint8 *pInfo;
379 
385 typedef struct
386 {
387  uint16 startHandle;
388  uint16 endHandle;
390  uint16 len;
391  uint8 *pValue;
393 
395 typedef struct
396 {
397  uint16 handle;
398  uint16 grpEndHandle;
400 
406 typedef struct
407 {
408  uint16 numInfo;
409  uint8 *pHandlesInfo;
411 
417 typedef struct
418 {
419  uint16 startHandle;
420  uint16 endHandle;
423 
429 typedef struct
430 {
431  uint16 numPairs;
432  uint16 len;
433  uint8 *pDataList;
434  uint16 dataLen;
436 
442 typedef struct
443 {
444  uint16 handle;
445 } attReadReq_t;
446 
452 typedef struct
453 {
454  uint16 len;
455  uint8 *pValue;
456 } attReadRsp_t;
457 
463 typedef struct
464 {
465  uint16 handle;
466  uint16 offset;
468 
474 typedef struct
475 {
476  uint16 len;
477  uint8 *pValue;
479 
485 typedef struct
486 {
487  uint8 *pHandles;
488  uint16 numHandles;
490 
496 typedef struct
497 {
498  uint16 len;
499  uint8 *pValues;
501 
507 typedef struct
508 {
509  uint16 startHandle;
510  uint16 endHandle;
513 
519 typedef struct
520 {
521  uint16 numGrps;
522  uint16 len;
523  uint8 *pDataList;
525 
531 typedef struct
532 {
533  uint16 handle;
534  uint16 len;
535  uint8 *pValue;
536  uint8 sig;
537  uint8 cmd;
538 } attWriteReq_t;
539 
545 typedef struct
546 {
547  uint16 handle;
548  uint16 offset;
549  uint16 len;
550  uint8 *pValue;
552 
558 typedef struct
559 {
560  uint16 handle;
561  uint16 offset;
562  uint16 len;
563  uint8 *pValue;
565 
571 typedef struct
572 {
573  uint8 flags;
576 
582 typedef struct
583 {
584  uint16 handle;
585  uint16 len;
586  uint8 *pValue;
588 
594 typedef struct
595 {
596  uint16 handle;
597  uint16 len;
598  uint8 *pValue;
600 
618 typedef struct
619 {
620  uint8 opcode;
623 
634 typedef struct
635 {
636  uint16 MTU;
638 
648 typedef union
649 {
650  // Request messages
662 
663  // Response messages
674 
675  // Indication and Notification messages
678 
679  // Locally-generated event messages
682 } attMsg_t;
683 
686 
688 // Function prototype to notify GATT Server or Client about an outgoing ATT message.
689 typedef void (*attNotifyTxCB_t)( uint16 connHandle, uint8 opcode );
690 
691 /*********************************************************************
692  * VARIABLES
693  */
694 
695 /*********************************************************************
696  * API FUNCTIONS
697  */
698 
699 /*-------------------------------------------------------------------
700  * General Utility APIs
701  */
702 
703 /*
704  * Parse an attribute protocol message.
705  */
706 extern uint8 ATT_ParsePacket( l2capDataEvent_t *pL2capMsg, attPacket_t *pPkt );
707 
708 /*
709  * Compare two UUIDs. The UUIDs are converted if necessary.
710  */
711 extern uint8 ATT_CompareUUID( const uint8 *pUUID1, uint16 len1,
712  const uint8 *pUUID2, uint16 len2 );
713 /*
714  * Convert a 16-bit UUID to 128-bit UUID.
715  */
716 extern uint8 ATT_ConvertUUIDto128( const uint8 *pUUID16, uint8 *pUUID128 );
717 
718 /*
719  * Convert a 128-bit UUID to 16-bit UUID.
720  */
721 extern uint8 ATT_ConvertUUIDto16( const uint8 *pUUID128, uint8 *pUUID16 );
722 
723 
724 /*-------------------------------------------------------------------
725  * Attribute Client Utility APIs
726  */
727 
728 /*
729  * Build Error Response.
730  */
731 extern uint16 ATT_BuildErrorRsp( uint8 *pBuf, uint8 *pMsg );
732 
733 /*
734  * Parse Error Response.
735  */
736 extern bStatus_t ATT_ParseErrorRsp( uint8 *pParams, uint16 len, attMsg_t *pMsg );
737 
738 /*
739  * Build Exchange MTU Request.
740  */
741 extern uint16 ATT_BuildExchangeMTUReq( uint8 *pBuf, uint8 *pMsg );
742 
743 /*
744  * Build Exchange MTU Response.
745  */
746 extern uint16 ATT_BuildExchangeMTURsp( uint8 *pBuf, uint8 *pMsg );
747 
748 /*
749  * Parse Exchange MTU Response.
750  */
751 extern bStatus_t ATT_ParseExchangeMTURsp( uint8 *pParams, uint16 len, attMsg_t *pMsg );
752 
753 /*
754  * Build Find Information Request.
755  */
756 extern uint16 ATT_BuildFindInfoReq( uint8 *pBuf, uint8 *pMsg );
757 
758 /*
759  * Parse Find Information Response.
760  */
761 extern bStatus_t ATT_ParseFindInfoRsp( uint8 *pParams, uint16 len, attMsg_t *pMsg );
762 
763 /*
764  * Build Find Information Response.
765  */
766 extern uint16 ATT_BuildFindInfoRsp( uint8 *pBuf, uint8 *pMsg );
767 
768 /*
769  * Build Find By Type Value Request.
770  */
771 extern uint16 ATT_BuildFindByTypeValueReq( uint8 *pBuf, uint8 *pMsg );
772 
773 /*
774  * Build Find By Type Value Response.
775  */
776 extern uint16 ATT_BuildFindByTypeValueRsp( uint8 *pBuf, uint8 *pMsg );
777 
778 /*
779  * Parse Find By Type Value Response.
780  */
781 extern bStatus_t ATT_ParseFindByTypeValueRsp( uint8 *pParams, uint16 len, attMsg_t *pMsg );
782 
783 /*
784  * Build Read By Type Request.
785  */
786 extern uint16 ATT_BuildReadByTypeReq( uint8 *pBuf, uint8 *pMsg );
787 
788 /*
789  * Build Read By Type Response.
790  */
791 extern uint16 ATT_BuildReadByTypeRsp( uint8 *pBuf, uint8 *pMsg );
792 
793 /*
794  * Parse Read By Type Response.
795  */
796 extern bStatus_t ATT_ParseReadByTypeRsp( uint8 *pParams, uint16 len, attMsg_t *pMsg );
797 
798 /*
799  * Build Read Request.
800  */
801 extern uint16 ATT_BuildReadReq( uint8 *pBuf, uint8 *pMsg );
802 
803 /*
804  * Build Read Response.
805  */
806 extern uint16 ATT_BuildReadRsp( uint8 *pBuf, uint8 *pMsg );
807 
808 /*
809  * Parse Read Response.
810  */
811 extern bStatus_t ATT_ParseReadRsp( uint8 *pParams, uint16 len, attMsg_t *pMsg );
812 
813 /*
814  * Build Read Blob Request.
815  */
816 extern uint16 ATT_BuildReadBlobReq( uint8 *pBuf, uint8 *pMsg );
817 
818 /*
819  * Build Read Blob Response.
820  */
821 extern uint16 ATT_BuildReadBlobRsp( uint8 *pBuf, uint8 *pMsg );
822 
823 /*
824  * Parse Read Blob Response.
825  */
826 extern bStatus_t ATT_ParseReadBlobRsp( uint8 *pParams, uint16 len, attMsg_t *pMsg );
827 
828 /*
829  * Build Read Multiple Request.
830  */
831 extern uint16 ATT_BuildReadMultiReq( uint8 *pBuf, uint8 *pMsg );
832 
833 /*
834  * Build Read Multiple Response.
835  */
836 extern uint16 ATT_BuildReadMultiRsp( uint8 *pBuf, uint8 *pMsg );
837 
838 /*
839  * Parse Read Multiple Response.
840  */
841 extern bStatus_t ATT_ParseReadMultiRsp( uint8 *pParams, uint16 len, attMsg_t *pMsg );
842 
843 /*
844  * Build Read By Group Type Response.
845  */
846 extern uint16 ATT_BuildReadByGrpTypeRsp( uint8 *pBuf, uint8 *pMsg );
847 
848 /*
849  * Parse Read By Group Type Response.
850  */
851 extern bStatus_t ATT_ParseReadByGrpTypeRsp( uint8 *pParams, uint16 len, attMsg_t *pMsg );
852 
853 /*
854  * Build Write Request.
855  */
856 extern uint16 ATT_BuildWriteReq( uint8 *pBuf, uint8 *pMsg );
857 
858 /*
859  * Parse Write Response.
860  */
861 extern bStatus_t ATT_ParseWriteRsp( uint8 *pParams, uint16 len, attMsg_t *pMsg );
862 
863 /*
864  * Build Prepare Write Request.
865  */
866 extern uint16 ATT_BuildPrepareWriteReq( uint8 *pBuf, uint8 *pMsg );
867 
868 /*
869  * Build Prepare Write Response.
870  */
871 extern uint16 ATT_BuildPrepareWriteRsp( uint8 *pBuf, uint8 *pMsg );
872 
873 /*
874  * Parse Prepare Write Response.
875  */
876 extern bStatus_t ATT_ParsePrepareWriteRsp( uint8 *pParams, uint16 len, attMsg_t *pMsg );
877 
878 /*
879  * Build Execute Write Request.
880  */
881 extern uint16 ATT_BuildExecuteWriteReq( uint8 *pBuf, uint8 *pMsg );
882 
883 /*
884  * Parse Execute Write Response.
885  */
886 extern bStatus_t ATT_ParseExecuteWriteRsp( uint8 *pParams, uint16 len, attMsg_t *pMsg );
887 
888 /*
889  * Build Handle Value Indication.
890  */
891 extern uint16 ATT_BuildHandleValueInd( uint8 *pBuf, uint8 *pMsg );
892 
893 /*
894  * Parse Handle Value Indication.
895  */
896 extern bStatus_t ATT_ParseHandleValueInd( uint8 sig, uint8 cmd, uint8 *pParams, uint16 len, attMsg_t *pMsg );
897 
898 
899 /*-------------------------------------------------------------------
900  * Attribute Server Utility APIs
901  */
902 
903 /*
904  * Parse Exchange MTU Request.
905  */
906 extern bStatus_t ATT_ParseExchangeMTUReq( uint8 sig, uint8 cmd, uint8 *pParams, uint16 len, attMsg_t *pMsg );
907 
908 /*
909  * Parse Find Information Request.
910  */
911 extern bStatus_t ATT_ParseFindInfoReq( uint8 sig, uint8 cmd, uint8 *pParams, uint16 len, attMsg_t *pMsg );
912 
913 /*
914  * Parse Find By Type Value Request.
915  */
916 extern bStatus_t ATT_ParseFindByTypeValueReq( uint8 sig, uint8 cmd, uint8 *pParams, uint16 len, attMsg_t *pMsg );
917 
918 /*
919  * Parse Read By Type Request.
920  */
921 extern bStatus_t ATT_ParseReadByTypeReq( uint8 sig, uint8 cmd, uint8 *pParams, uint16 len, attMsg_t *pMsg );
922 
923 /*
924  * Parse Read Request.
925  */
926 extern bStatus_t ATT_ParseReadReq( uint8 sig, uint8 cmd, uint8 *pParams, uint16 len, attMsg_t *pMsg );
927 
928 /*
929  * Parse Write Blob Request.
930  */
931 extern bStatus_t ATT_ParseReadBlobReq( uint8 sig, uint8 cmd, uint8 *pParams, uint16 len, attMsg_t *pMsg );
932 
933 /*
934  * Parse Read Multiple Request.
935  */
936 extern bStatus_t ATT_ParseReadMultiReq( uint8 sig, uint8 cmd, uint8 *pParams, uint16 len, attMsg_t *pMsg );
937 
938 /*
939  * Parse Write Request.
940  */
941 extern bStatus_t ATT_ParseWriteReq( uint8 sig, uint8 cmd, uint8 *pParams, uint16 len, attMsg_t *pMsg );
942 
943 /*
944  * Parse Execute Write Request.
945  */
946 extern bStatus_t ATT_ParseExecuteWriteReq( uint8 sig, uint8 cmd, uint8 *pParams, uint16 len, attMsg_t *pMsg );
947 
948 /*
949  * Parse Prepare Write Request.
950  */
951 extern bStatus_t ATT_ParsePrepareWriteReq( uint8 sig, uint8 cmd, uint8 *pParams, uint16 len, attMsg_t *pMsg );
952 
953 /*
954  * Parse Handle Value Confirmation.
955  */
956 extern bStatus_t ATT_ParseHandleValueCfm( uint8 *pParams, uint16 len, attMsg_t *pMsg );
957 
959 
960 /*-------------------------------------------------------------------
961  * Attribute Client Public APIs
962  */
963 
982 extern bStatus_t ATT_ExchangeMTUReq( uint16 connHandle, attExchangeMTUReq_t *pReq );
983 
996 extern bStatus_t ATT_FindInfoReq( uint16 connHandle, attFindInfoReq_t *pReq );
997 
1010 extern bStatus_t ATT_FindByTypeValueReq( uint16 connHandle, attFindByTypeValueReq_t *pReq );
1011 
1024 extern bStatus_t ATT_ReadByTypeReq( uint16 connHandle, attReadByTypeReq_t *pReq );
1025 
1038 extern bStatus_t ATT_ReadReq( uint16 connHandle, attReadReq_t *pReq );
1039 
1052 extern bStatus_t ATT_ReadBlobReq( uint16 connHandle, attReadBlobReq_t *pReq );
1053 
1066 extern bStatus_t ATT_ReadMultiReq( uint16 connHandle, attReadMultiReq_t *pReq );
1067 
1080 extern bStatus_t ATT_ReadByGrpTypeReq( uint16 connHandle, attReadByGrpTypeReq_t *pReq );
1081 
1095 extern bStatus_t ATT_WriteReq( uint16 connHandle, attWriteReq_t *pReq );
1096 
1109 extern bStatus_t ATT_PrepareWriteReq( uint16 connHandle, attPrepareWriteReq_t *pReq );
1110 
1123 extern bStatus_t ATT_ExecuteWriteReq( uint16 connHandle, attExecuteWriteReq_t *pReq );
1124 
1136 extern bStatus_t ATT_HandleValueCfm( uint16 connHandle );
1137 
1138 
1139 /*-------------------------------------------------------------------
1140  * Attribute Server Public APIs
1141  */
1142 
1155 extern bStatus_t ATT_ErrorRsp( uint16 connHandle, attErrorRsp_t *pRsp );
1156 
1169 extern bStatus_t ATT_ExchangeMTURsp( uint16 connHandle, attExchangeMTURsp_t *pRsp );
1170 
1183 extern bStatus_t ATT_FindInfoRsp( uint16 connHandle, attFindInfoRsp_t *pRsp );
1184 
1197 extern bStatus_t ATT_FindByTypeValueRsp( uint16 connHandle, attFindByTypeValueRsp_t *pRsp );
1198 
1211 extern bStatus_t ATT_ReadByTypeRsp( uint16 connHandle, attReadByTypeRsp_t *pRsp );
1212 
1225 extern bStatus_t ATT_ReadRsp( uint16 connHandle, attReadRsp_t *pRsp );
1226 
1239 extern bStatus_t ATT_ReadBlobRsp( uint16 connHandle, attReadBlobRsp_t *pRsp );
1240 
1253 extern bStatus_t ATT_ReadMultiRsp( uint16 connHandle, attReadMultiRsp_t *pRsp ) ;
1254 
1267 extern bStatus_t ATT_ReadByGrpTypeRsp( uint16 connHandle, attReadByGrpTypeRsp_t *pRsp );
1268 
1280 extern bStatus_t ATT_WriteRsp( uint16 connHandle );
1281 
1294 extern bStatus_t ATT_PrepareWriteRsp( uint16 connHandle, attPrepareWriteRsp_t *pRsp );
1295 
1307 extern bStatus_t ATT_ExecuteWriteRsp( uint16 connHandle );
1308 
1321 extern bStatus_t ATT_HandleValueNoti( uint16 connHandle, attHandleValueNoti_t *pNoti );
1322 
1335 extern bStatus_t ATT_HandleValueInd( uint16 connHandle, attHandleValueInd_t *pInd );
1336 
1337 /*-------------------------------------------------------------------
1338  * Attribute Common Public APIs
1339  */
1340 
1350 extern uint8 ATT_UpdateMTU( uint16 connHandle, uint16 MTU );
1351 
1359 extern uint16 ATT_GetMTU( uint16 connHandle );
1360 
1367 extern void ATT_SetParamValue( uint16 value );
1368 
1374 extern uint16 ATT_GetParamValue( void );
1375 
1381 extern void ATT_RegisterServer( attNotifyTxCB_t pfnNotifyTx );
1382 
1388 extern void ATT_RegisterClient( attNotifyTxCB_t pfnNotifyTx );
1389 
1392 /*********************************************************************
1393 *********************************************************************/
1394 
1395 #ifdef __cplusplus
1396 }
1397 #endif
1398 
1399 #endif /* ATT_H */
1400 
uint16 endHandle
Last requested handle number.
Definition: att.h:351
void ATT_RegisterServer(attNotifyTxCB_t pfnNotifyTx)
Register the server's notify Tx function with the ATT layer.
bStatus_t ATT_ReadRsp(uint16 connHandle, attReadRsp_t *pRsp)
Send Read Response.
uint16 handle
Handle of the attribute to be read (must be first field)
Definition: att.h:444
uint16 len
Length of each attribute handle, end group handle and value set.
Definition: att.h:522
This API allows the software components in the Z-Stack to be written independently of the specifics o...
attFindInfoRsp_t findInfoRsp
ATT Find Information Response.
Definition: att.h:666
uint16 numInfo
Number of attribute handle-UUID pairs found.
Definition: att.h:375
attPrepareWriteRsp_t prepareWriteRsp
ATT Prepare Write Response.
Definition: att.h:673
L2CAP layer interface.
Exchange MTU Response format.
Definition: att.h:338
bStatus_t ATT_FindByTypeValueRsp(uint16 connHandle, attFindByTypeValueRsp_t *pRsp)
Send Find By Type Value Response.
Read Request.
Definition: att.h:442
uint16 numGrps
Number of attribute handle, end group handle and value sets found.
Definition: att.h:521
Find Information Response format.
Definition: att.h:373
bStatus_t ATT_ExecuteWriteReq(uint16 connHandle, attExecuteWriteReq_t *pReq)
Send Execute Write Request.
bStatus_t ATT_FindInfoReq(uint16 connHandle, attFindInfoReq_t *pReq)
Send Find Information Request.
uint8 * pHandlesInfo
List of 1 or more handles information (4 to ATT_MTU_SIZE-1)
Definition: att.h:409
bStatus_t ATT_ExchangeMTUReq(uint16 connHandle, attExchangeMTUReq_t *pReq)
Send Exchange MTU Request.
uint16 MTU
new MTU size
Definition: att.h:636
attReadByGrpTypeReq_t readByGrpTypeReq
ATT Read By Group Type Request.
Definition: att.h:658
uint16 numHandles
Number of attribute handles.
Definition: att.h:488
attPrepareWriteReq_t prepareWriteReq
ATT Prepare Write Request.
Definition: att.h:660
attAttrBtType_t type
2-octet UUID to find
Definition: att.h:389
uint8 reqOpcode
Request that generated this error response.
Definition: att.h:318
bStatus_t ATT_FindInfoRsp(uint16 connHandle, attFindInfoRsp_t *pRsp)
Send Find Information Response.
attMtuUpdatedEvt_t mtuEvt
ATT MTU Updated Event.
Definition: att.h:681
Find Information Request format.
Definition: att.h:348
Read Response.
Definition: att.h:452
Handle and its 128-bit UUID.
Definition: att.h:362
attErrorRsp_t errorRsp
ATT Error Response.
Definition: att.h:664
bStatus_t ATT_ExchangeMTURsp(uint16 connHandle, attExchangeMTURsp_t *pRsp)
Send Exchange MTU Response.
attHandleValueNoti_t handleValueNoti
ATT Handle Value Notification.
Definition: att.h:676
Error Response format.
Definition: att.h:316
attAttrType_t type
Requested group type (2 or 16 octet UUID)
Definition: att.h:511
Find By Type Value Request format.
Definition: att.h:385
uint8 sig
Authentication Signature status (not included (0), valid (1), invalid (2))
Definition: att.h:286
uint8 * pHandles
Set of two or more attribute handles (4 to ATT_MTU_SIZE-1) - must be first field. ...
Definition: att.h:487
#define ATT_BT_UUID_SIZE
Size of 16-bit Bluetooth UUID.
Definition: att.h:111
uint16 offset
Offset of the first octet to be written.
Definition: att.h:548
#define ATT_UUID_SIZE
Size of 128-bit UUID.
Definition: att.h:112
Write Request format.
Definition: att.h:531
uint8 flags
Definition: att.h:573
void ATT_RegisterClient(attNotifyTxCB_t pfnNotifyTx)
Register the client's notify Tx function with the ATT layer.
uint8 cmd
Command Flag.
Definition: att.h:537
uint16 len
Length of value.
Definition: att.h:476
bStatus_t ATT_ReadByTypeReq(uint16 connHandle, attReadByTypeReq_t *pReq)
Send Read By Type Request.
bStatus_t ATT_ReadByGrpTypeRsp(uint16 connHandle, attReadByGrpTypeRsp_t *pRsp)
Send Read By Group Type Respond.
uint16 len
Length of value.
Definition: att.h:562
uint8 * pDataList
List of 1 or more attribute handle-value pairs (2 to ATT_MTU_SIZE-2)
Definition: att.h:433
attReadMultiReq_t readMultiReq
ATT Read Multiple Request.
Definition: att.h:657
uint8 * pValue
Part of the value of the attribute to be written (0 to ATT_MTU_SIZE-5) - must be allocated.
Definition: att.h:550
uint16 len
Length of value.
Definition: att.h:454
uint16 startHandle
First requested handle number (must be first field)
Definition: att.h:387
uint16 handle
Handle of the attribute that has been read.
Definition: att.h:560
uint8 opcode
opcode of message that caused flow control violation
Definition: att.h:620
attFindInfoReq_t findInfoReq
ATT Find Information Request.
Definition: att.h:652
uint16 numPairs
Number of attribute handle-UUID pairs found.
Definition: att.h:431
attReadRsp_t readRsp
ATT Read Response.
Definition: att.h:669
bStatus_t ATT_PrepareWriteReq(uint16 connHandle, attPrepareWriteReq_t *pReq)
Send Prepare Write Request.
attHandleValueInd_t handleValueInd
ATT Handle Value Indication.
Definition: att.h:677
uint16 clientRxMTU
Client receive MTU size.
Definition: att.h:330
uint8 format
Format of information data.
Definition: att.h:376
uint16 offset
Offset of the first octet to be read.
Definition: att.h:466
uint16 startHandle
First requested handle number (must be first field)
Definition: att.h:350
uint16 len
Length of Attribute Parameters.
Definition: att.h:289
uint8 sig
Authentication Signature status (not included (0), valid (1), invalid (2))
Definition: att.h:536
Read By Group Type Response format.
Definition: att.h:519
attReadByTypeRsp_t readByTypeRsp
ATT Read By Type Response.
Definition: att.h:668
uint16 ATT_GetParamValue(void)
Get a ATT Parameter value.
ATT MTU Updated Event message format.
Definition: att.h:634
bStatus_t ATT_FindByTypeValueReq(uint16 connHandle, attFindByTypeValueReq_t *pReq)
Send Find By Type Value Request.
uint16 len
Length of values.
Definition: att.h:498
attExchangeMTUReq_t exchangeMTUReq
ATT Exchange MTU Request.
Definition: att.h:651
uint16 endHandle
Last requested handle number.
Definition: att.h:388
bStatus_t ATT_ReadByGrpTypeReq(uint16 connHandle, attReadByGrpTypeReq_t *pReq)
Send Read By Group Type Request.
Attribute Type format (2 or 16 octet UUID).
Definition: att.h:294
Read Multiple Response format.
Definition: att.h:496
bStatus_t ATT_HandleValueInd(uint16 connHandle, attHandleValueInd_t *pInd)
Send Handle Value Indication.
Read Blob Response format.
Definition: att.h:474
bStatus_t ATT_ReadByTypeRsp(uint16 connHandle, attReadByTypeRsp_t *pRsp)
Send Read By Type Respond.
attReadBlobReq_t readBlobReq
ATT Read Blob Request.
Definition: att.h:656
bStatus_t ATT_WriteRsp(uint16 connHandle)
Send Write Response.
uint16 endHandle
Last requested handle number.
Definition: att.h:420
Attribute Type format (2-octet Bluetooth UUID).
Definition: att.h:301
uint16 serverRxMTU
Server receive MTU size.
Definition: att.h:340
uint8 method
Method.
Definition: att.h:288
uint8 * pParams
Attribute Parameters.
Definition: att.h:290
uint16 offset
Offset of the first octet to be written.
Definition: att.h:561
uint8 * pValue
Value of the attribute to be written (0 to ATT_MTU_SIZE-3)
Definition: att.h:535
uint16 len
Length of value.
Definition: att.h:585
Read Blob Request format.
Definition: att.h:463
uint8 cmd
Command Flag.
Definition: att.h:287
uint8 * pValue
Part of the value of the attribute to be written (0 to ATT_MTU_SIZE-5)
Definition: att.h:563
Find By Type Value Response format.
Definition: att.h:406
bStatus_t ATT_PrepareWriteRsp(uint16 connHandle, attPrepareWriteRsp_t *pRsp)
Send Prepare Write Response.
ATT Flow Control Violated Event message format.
Definition: att.h:618
Read By Type Request format.
Definition: att.h:417
uint8 * pValue
Attribute value to find (0 to ATT_MTU_SIZE-7)
Definition: att.h:391
Read Multiple Request format.
Definition: att.h:485
uint8 * pValue
Current value of the attribute (0 to ATT_MTU_SIZE-3)
Definition: att.h:598
uint8 len
Length of UUID (2 or 16)
Definition: att.h:296
uint16 len
Length of value.
Definition: att.h:549
uint16 handle
Attribute handle that generated error response.
Definition: att.h:319
uint8 * pInfo
Information data whose format is determined by format field (4 to ATT_MTU_SIZE-2) ...
Definition: att.h:377
Handle Value Indication format.
Definition: att.h:594
uint16 handle
Handle of the attribute to be read (must be first field)
Definition: att.h:465
attExecuteWriteReq_t executeWriteReq
ATT Execute Write Request.
Definition: att.h:661
Type definitions and macros for BLE stack.
Handle Value Notification format.
Definition: att.h:582
uint16 startHandle
First requested handle number (must be first field)
Definition: att.h:419
uint16 handle
Handle of the attribute to be written (must be first field)
Definition: att.h:547
uint16 endHandle
Last requested handle number.
Definition: att.h:510
bStatus_t ATT_ReadBlobReq(uint16 connHandle, attReadBlobReq_t *pReq)
Send Read Blob Request.
ATT Message format.
Definition: att.h:648
attReadBlobRsp_t readBlobRsp
ATT Read Blob Response.
Definition: att.h:670
bStatus_t ATT_ReadMultiReq(uint16 connHandle, attReadMultiReq_t *pReq)
Send Read Multiple Request.
uint8 * pDataList
List of 1 or more attribute handle, end group handle and value (4 to ATT_MTU_SIZE-2) ...
Definition: att.h:523
uint16 handle
Handle of the attribute to be written (must be first field)
Definition: att.h:533
uint32_t len
Image length in bytes.
Definition: oad_image_header.h:662
void ATT_SetParamValue(uint16 value)
Set a ATT Parameter value. Use this function to change the default ATT parameter values.
uint16 len
Length of value.
Definition: att.h:597
bStatus_t ATT_ExecuteWriteRsp(uint16 connHandle)
Send Execute Write Response.
attFlowCtrlViolatedEvt_t flowCtrlEvt
ATT Flow Control Violated Event.
Definition: att.h:680
uint16 handle
Handle of the attribute that has been changed (must be first field)
Definition: att.h:596
bStatus_t ATT_ReadReq(uint16 connHandle, attReadReq_t *pReq)
Send Read Request.
Exchange MTU Request format.
Definition: att.h:328
uint16 grpEndHandle
Group end handle.
Definition: att.h:398
uint16 len
Size of each attribute handle-value pair.
Definition: att.h:432
Attribute Protocol PDU format.
Definition: att.h:284
uint8 * pValue
Value of the attribute with the handle given (0 to ATT_MTU_SIZE-1)
Definition: att.h:455
uint8 * pValue
Part of the value of the attribute with the handle given (0 to ATT_MTU_SIZE-1)
Definition: att.h:477
uint16 dataLen
Length of data written into pDataList. Not part of actual ATT Response.
Definition: att.h:434
attAttrType_t type
Requested type (2 or 16 octet UUID)
Definition: att.h:421
uint8 ATT_UpdateMTU(uint16 connHandle, uint16 MTU)
This function is used to update the MTU size of a connection.
Read By Group Type Request format.
Definition: att.h:507
uint16 handle
Handle.
Definition: att.h:357
attReadByTypeReq_t readByTypeReq
ATT Read By Type Request.
Definition: att.h:654
Handle and its 16-bit Bluetooth UUIDs.
Definition: att.h:355
uint16 len
Length of value.
Definition: att.h:534
attReadByGrpTypeRsp_t readByGrpTypeRsp
ATT Read By Group Type Response.
Definition: att.h:672
bStatus_t ATT_ReadBlobRsp(uint16 connHandle, attReadBlobRsp_t *pRsp)
Send Read Blob Response.
Status_t bStatus_t
BLE Generic Status return.
Definition: bcomdef.h:233
uint8 pendingOpcode
opcode of pending message
Definition: att.h:621
uint8 len
Length of UUID (2)
Definition: att.h:303
Read By Type Response format.
Definition: att.h:429
Prepare Write Response format.
Definition: att.h:558
uint16 handle
Handle.
Definition: att.h:364
uint16 numInfo
Number of handles information found.
Definition: att.h:408
Prepare Write Request format.
Definition: att.h:545
attExchangeMTURsp_t exchangeMTURsp
ATT Exchange MTU Response.
Definition: att.h:665
bStatus_t ATT_ReadMultiRsp(uint16 connHandle, attReadMultiRsp_t *pRsp)
Send Read Multiple Response.
attFindByTypeValueReq_t findByTypeValueReq
ATT Find By Type Value Request.
Definition: att.h:653
bStatus_t ATT_WriteReq(uint16 connHandle, attWriteReq_t *pReq)
Send Write Request.
attReadReq_t readReq
ATT Read Request.
Definition: att.h:655
bStatus_t ATT_HandleValueNoti(uint16 connHandle, attHandleValueNoti_t *pNoti)
Send Handle Value Notification.
attReadMultiRsp_t readMultiRsp
ATT Read Multiple Response.
Definition: att.h:671
attWriteReq_t writeReq
ATT Write Request.
Definition: att.h:659
uint8 * pValues
Set of two or more values (0 to ATT_MTU_SIZE-1)
Definition: att.h:499
uint16 len
Length of value.
Definition: att.h:390
attFindByTypeValueRsp_t findByTypeValueRsp
ATT Find By Type Value Response.
Definition: att.h:667
uint8 * pValue
Current value of the attribute (0 to ATT_MTU_SIZE-3)
Definition: att.h:586
uint16 ATT_GetMTU(uint16 connHandle)
This function is used to get the MTU size of a connection.
uint16 handle
Found attribute handle.
Definition: att.h:397
uint16 startHandle
First requested handle number (must be first field)
Definition: att.h:509
uint8 errCode
Reason why the request has generated error response.
Definition: att.h:320
OSAL L2CAP_DATA_EVENT message format.
Definition: l2cap.h:564
bStatus_t ATT_HandleValueCfm(uint16 connHandle)
Send Handle Value Confirmation.
Execute Write Request format.
Definition: att.h:571
uint16 handle
Handle of the attribute that has been changed (must be first field)
Definition: att.h:584
bStatus_t ATT_ErrorRsp(uint16 connHandle, attErrorRsp_t *pRsp)
Send Error Response.
Handles Information format.
Definition: att.h:395
© Copyright 1995-2020, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale