@@ -857,20 +857,6 @@ STATIC void process_find_info_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
857857 }
858858}
859859
860- int att_find_info_req (uint16_t conn_handle , uint16_t start_handle , uint16_t end_handle , uint8_t response_buffer []) {
861- struct __packed req {
862- struct bt_att_hdr h ;
863- struct bt_att_find_info_req r ;
864- } req = { {
865- .code = BT_ATT_OP_FIND_INFO_REQ ,
866- }, {
867- .start_handle = start_handle ,
868- .end_handle = end_handle ,
869- }};
870-
871- return send_req_wait_for_rsp (conn_handle , sizeof (req ), (uint8_t * )& req , response_buffer );
872- }
873-
874860STATIC void process_find_info_rsp (uint16_t conn_handle , uint8_t dlen , uint8_t data []) {
875861 if (dlen < 2 ) {
876862 return ; // invalid, drop
@@ -925,7 +911,7 @@ STATIC void process_find_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
925911 }
926912}
927913
928- void process_read_group_req (uint16_t conn_handle , uint16_t mtu , uint8_t dlen , uint8_t data []) {
914+ STATIC void process_read_group_req (uint16_t conn_handle , uint16_t mtu , uint8_t dlen , uint8_t data []) {
929915 struct bt_att_read_group_req * req = (struct bt_att_read_group_req * )data ;
930916 uint16_t type_uuid = req -> uuid [0 ] | (req -> uuid [1 ] << 8 );
931917
@@ -1009,25 +995,6 @@ void process_read_group_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, ui
1009995 }
1010996}
1011997
1012- int att_read_group_req (uint16_t conn_handle , uint16_t start_handle , uint16_t end_handle , uint16_t uuid , uint8_t response_buffer []) {
1013-
1014- typedef struct __packed {
1015- struct bt_att_hdr h ;
1016- struct bt_att_read_group_req r ;
1017- } req_t ;
1018-
1019- uint8_t req_bytes [sizeof (req_t ) + sizeof (uuid )];
1020- req_t * req = (req_t * )req_bytes ;
1021-
1022- req -> h .code = BT_ATT_OP_READ_GROUP_REQ ;
1023- req -> r .start_handle = start_handle ;
1024- req -> r .end_handle = end_handle ;
1025- req -> r .uuid [0 ] = uuid & 0xff ;
1026- req -> r .uuid [1 ] = uuid >> 8 ;
1027-
1028- return send_req_wait_for_rsp (conn_handle , sizeof (req_bytes ), req_bytes , response_buffer );
1029- }
1030-
1031998STATIC void process_read_group_rsp (uint16_t conn_handle , uint8_t dlen , uint8_t data []) {
1032999 if (dlen < 2 ) {
10331000 return ; // invalid, drop
@@ -1305,24 +1272,6 @@ STATIC void process_read_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
13051272 }
13061273}
13071274
1308- int att_read_type_req (uint16_t conn_handle , uint16_t start_handle , uint16_t end_handle , uint16_t type , uint8_t response_buffer []) {
1309- typedef struct __packed {
1310- struct bt_att_hdr h ;
1311- struct bt_att_read_type_req r ;
1312- } req_t ;
1313-
1314- uint8_t req_bytes [sizeof (req_t ) + sizeof (type )];
1315- req_t * req = (req_t * )req_bytes ;
1316-
1317- req -> h .code = BT_ATT_OP_READ_TYPE_REQ ;
1318- req -> r .start_handle = start_handle ;
1319- req -> r .end_handle = end_handle ;
1320- req -> r .uuid [0 ] = type & 0xff ;
1321- req -> r .uuid [1 ] = type >> 8 ;
1322-
1323- return send_req_wait_for_rsp (conn_handle , sizeof (req_bytes ), req_bytes , response_buffer );
1324- }
1325-
13261275STATIC void process_read_type_rsp (uint16_t conn_handle , uint8_t dlen , uint8_t data []) {
13271276 if (dlen < 1 ) {
13281277 return ; // invalid, drop
@@ -1713,77 +1662,3 @@ void att_process_data(uint16_t conn_handle, uint8_t dlen, uint8_t data[]) {
17131662 break ;
17141663 }
17151664}
1716-
1717- // FIX Do we need all of these?
1718- void check_att_err (uint8_t err ) {
1719- const compressed_string_t * msg = NULL ;
1720- switch (err ) {
1721- case 0 :
1722- return ;
1723- case BT_ATT_ERR_INVALID_HANDLE :
1724- msg = translate ("Invalid handle" );
1725- break ;
1726- case BT_ATT_ERR_READ_NOT_PERMITTED :
1727- msg = translate ("Read not permitted" );
1728- break ;
1729- case BT_ATT_ERR_WRITE_NOT_PERMITTED :
1730- msg = translate ("Write not permitted" );
1731- break ;
1732- case BT_ATT_ERR_INVALID_PDU :
1733- msg = translate ("Invalid PDU" );
1734- break ;
1735- case BT_ATT_ERR_NOT_SUPPORTED :
1736- msg = translate ("Not supported" );
1737- break ;
1738- case BT_ATT_ERR_INVALID_OFFSET :
1739- msg = translate ("Invalid offset" );
1740- break ;
1741- case BT_ATT_ERR_PREPARE_QUEUE_FULL :
1742- msg = translate ("Prepare queue full" );
1743- break ;
1744- case BT_ATT_ERR_ATTRIBUTE_NOT_FOUND :
1745- msg = translate ("Attribute not found" );
1746- break ;
1747- case BT_ATT_ERR_ATTRIBUTE_NOT_LONG :
1748- msg = translate ("Attribute not long" );
1749- break ;
1750- case BT_ATT_ERR_ENCRYPTION_KEY_SIZE :
1751- msg = translate ("Encryption key size" );
1752- break ;
1753- case BT_ATT_ERR_INVALID_ATTRIBUTE_LEN :
1754- msg = translate ("Invalid attribute length" );
1755- break ;
1756- case BT_ATT_ERR_UNLIKELY :
1757- msg = translate ("Unlikely" );
1758- break ;
1759- case BT_ATT_ERR_UNSUPPORTED_GROUP_TYPE :
1760- msg = translate ("Unsupported group type" );
1761- break ;
1762- case BT_ATT_ERR_INSUFFICIENT_RESOURCES :
1763- msg = translate ("Insufficient resources" );
1764- break ;
1765- case BT_ATT_ERR_DB_OUT_OF_SYNC :
1766- msg = translate ("DB out of sync" );
1767- break ;
1768- case BT_ATT_ERR_VALUE_NOT_ALLOWED :
1769- msg = translate ("Value not allowed" );
1770- break ;
1771- }
1772- if (msg ) {
1773- mp_raise_bleio_BluetoothError (msg );
1774- }
1775-
1776- switch (err ) {
1777- case BT_ATT_ERR_AUTHENTICATION :
1778- msg = translate ("Insufficient authentication" );
1779- break ;
1780- case BT_ATT_ERR_INSUFFICIENT_ENCRYPTION :
1781- msg = translate ("Insufficient encryption" );
1782- break ;
1783- }
1784- if (msg ) {
1785- mp_raise_bleio_SecurityError (msg );
1786- }
1787-
1788- mp_raise_bleio_BluetoothError (translate ("Unknown ATT error: 0x%02x" ), err );
1789- }
0 commit comments