Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
system_bt
Commits
9df3192b
Commit
9df3192b
authored
9 years ago
by
Jakub Pawlowski
Committed by
Andre Eisenbach
9 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Use dynamic memory for keeping GATT cache
Change-Id: I60674c47246d8fe2094fe78ce31b752fa2acb89e
parent
3c30f80c
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
324 additions
and
418 deletions
+324
-418
bta/gatt/bta_gattc_act.c
bta/gatt/bta_gattc_act.c
+4
-11
bta/gatt/bta_gattc_cache.c
bta/gatt/bta_gattc_cache.c
+315
-389
bta/gatt/bta_gattc_int.h
bta/gatt/bta_gattc_int.h
+5
-11
bta/gatt/bta_gattc_utils.c
bta/gatt/bta_gattc_utils.c
+0
-7
No files found.
bta/gatt/bta_gattc_act.c
View file @
9df3192b
...
...
@@ -1038,12 +1038,8 @@ void bta_gattc_disc_cmpl(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
if
(
p_clcb
->
status
!=
GATT_SUCCESS
)
{
/* clean up cache */
if
(
p_clcb
->
p_srcb
&&
p_clcb
->
p_srcb
->
p_srvc_cache
)
{
while
(
!
fixed_queue_is_empty
(
p_clcb
->
p_srcb
->
cache_buffer
))
{
osi_freebuf
(
fixed_queue_try_dequeue
(
p_clcb
->
p_srcb
->
cache_buffer
));
}
if
(
p_clcb
->
p_srcb
&&
p_clcb
->
p_srcb
->
p_srvc_cache
)
{
list_free
(
p_clcb
->
p_srcb
->
p_srvc_cache
);
p_clcb
->
p_srcb
->
p_srvc_cache
=
NULL
;
}
...
...
@@ -1909,11 +1905,8 @@ void bta_gattc_process_api_refresh(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA * p_msg)
}
}
/* in all other cases, mark it and delete the cache */
if
(
p_srvc_cb
->
p_srvc_cache
!=
NULL
)
{
while
(
!
fixed_queue_is_empty
(
p_srvc_cb
->
cache_buffer
))
osi_freebuf
(
fixed_queue_try_dequeue
(
p_srvc_cb
->
cache_buffer
));
if
(
p_srvc_cb
->
p_srvc_cache
!=
NULL
)
{
list_free
(
p_srvc_cb
->
p_srvc_cache
);
p_srvc_cb
->
p_srvc_cache
=
NULL
;
}
}
...
...
This diff is collapsed.
Click to expand it.
bta/gatt/bta_gattc_cache.c
View file @
9df3192b
This diff is collapsed.
Click to expand it.
bta/gatt/bta_gattc_int.h
View file @
9df3192b
...
...
@@ -254,10 +254,9 @@ typedef union
UINT16
uuid16
;
}
tBTA_GATTC_UUID
;
typedef
struct
gattc_attr_cache
typedef
struct
{
tBTA_GATTC_UUID
*
p_uuid
;
struct
gattc_attr_cache
*
p_next
;
UINT16
uuid_len
;
UINT16
attr_handle
;
UINT8
inst_id
;
...
...
@@ -269,15 +268,13 @@ typedef struct gattc_attr_cache
}
__attribute__
((
packed
))
tBTA_GATTC_CACHE_ATTR
;
// btla-specific --
typedef
struct
gattc_svc_cache
typedef
struct
{
tBTA_GATT_SRVC_ID
service_uuid
;
tBTA_GATTC_CACHE_ATTR
*
p_attr
;
tBTA_GATTC_CACHE_ATTR
*
p_last_attr
;
list_t
*
p_attr
;
/* list of tBTA_GATTC_CACHE_ATTR */
UINT16
s_handle
;
UINT16
e_handle
;
struct
gattc_svc_cache
*
p_next
;
tBTA_GATTC_CACHE_ATTR
*
p_cur_char
;
list_node_t
*
p_cur_char
;
/* node pointing to p_attr */
// btla-specific ++
}
__attribute__
((
packed
))
tBTA_GATTC_CACHE
;
// btla-specific --
...
...
@@ -323,11 +320,8 @@ typedef struct
UINT8
state
;
tBTA_GATTC_CACHE
*
p_srvc_cache
;
list_t
*
p_srvc_cache
;
/* list of tBTA_GATTC_CACHE */
tBTA_GATTC_CACHE
*
p_cur_srvc
;
fixed_queue_t
*
cache_buffer
;
/* buffer queue used for storing the cache data */
UINT8
*
p_free
;
/* starting point to next available byte */
UINT16
free_byte
;
/* number of available bytes in server cache buffer */
UINT8
update_count
;
/* indication received */
UINT8
num_clcb
;
/* number of associated CLCB */
...
...
This diff is collapsed.
Click to expand it.
bta/gatt/bta_gattc_utils.c
View file @
9df3192b
...
...
@@ -410,15 +410,8 @@ tBTA_GATTC_SERV * bta_gattc_srcb_alloc(BD_ADDR bda)
if
(
p_tcb
!=
NULL
)
{
if
(
p_tcb
->
cache_buffer
!=
NULL
)
{
while
(
!
fixed_queue_is_empty
(
p_tcb
->
cache_buffer
))
osi_freebuf
(
fixed_queue_try_dequeue
(
p_tcb
->
cache_buffer
));
fixed_queue_free
(
p_tcb
->
cache_buffer
,
NULL
);
}
osi_freebuf_and_reset
((
void
**
)
&
p_tcb
->
p_srvc_list
);
memset
(
p_tcb
,
0
,
sizeof
(
tBTA_GATTC_SERV
));
p_tcb
->
cache_buffer
=
fixed_queue_new
(
SIZE_MAX
);
p_tcb
->
in_use
=
TRUE
;
bdcpy
(
p_tcb
->
server_bda
,
bda
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment