Lines Matching refs:p_db
41 static BOOLEAN allocate_svc_db_buf(tGATT_SVC_DB *p_db);
42 static void *allocate_attr_in_db(tGATT_SVC_DB *p_db, tBT_UUID *p_uuid, tGATT_PERM perm);
43 static BOOLEAN deallocate_attr_in_db(tGATT_SVC_DB *p_db, void *p_attr);
44 static BOOLEAN copy_extra_byte_in_db(tGATT_SVC_DB *p_db, void **p_dst, UINT16 len);
46 static BOOLEAN gatts_db_add_service_declaration(tGATT_SVC_DB *p_db, tBT_UUID *p_service, BOOLEAN is_pri);
56 ** Parameter p_db: database pointer.
62 BOOLEAN gatts_init_service_db (tGATT_SVC_DB *p_db, tBT_UUID *p_service, BOOLEAN is_pri,
65 if (!allocate_svc_db_buf(p_db))
75 p_db->next_handle = s_hdl;
76 p_db->end_handle = s_hdl + num_handle;
78 return gatts_db_add_service_declaration(p_db, p_service, is_pri);
87 ** Parameter p_db: database pointer.
93 tBT_UUID * gatts_get_service_uuid (tGATT_SVC_DB *p_db)
95 if (!p_db || !p_db->p_attr_list)
103 return &((tGATT_ATTR16 *)p_db->p_attr_list)->p_value->uuid;
314 ** Parameter p_db: pointer to the attribute database.
327 tGATT_SVC_DB *p_db,
348 if (p_db && p_db->p_attr_list)
350 p_attr = (tGATT_ATTR16 *)p_db->p_attr_list;
445 ** Parameter p_db: database pointer.
451 UINT16 gatts_add_included_service (tGATT_SVC_DB *p_db, UINT16 s_handle, UINT16 e_handle,
466 if ((p_attr = (tGATT_ATTR16 *) allocate_attr_in_db(p_db, &uuid, GATT_PERM_READ)) != NULL)
468 if (copy_extra_byte_in_db(p_db, (void **)&p_attr->p_value, sizeof(tGATT_INCL_SRVC)))
478 deallocate_attr_in_db(p_db, p_attr);
492 ** Parameter p_db: database pointer.
500 UINT16 gatts_add_characteristic (tGATT_SVC_DB *p_db, tGATT_PERM perm,
509 if ((p_char_decl = (tGATT_ATTR16 *)allocate_attr_in_db(p_db, &uuid, GATT_PERM_READ)) != NULL)
511 if (!copy_extra_byte_in_db(p_db, (void **)&p_char_decl->p_value, sizeof(tGATT_CHAR_DECL)))
513 deallocate_attr_in_db(p_db, p_char_decl);
517 p_char_val = (tGATT_ATTR16 *)allocate_attr_in_db(p_db, p_char_uuid, perm);
521 deallocate_attr_in_db(p_db, p_char_decl);
586 ** Parameter p_db: database pointer.
594 UINT16 gatts_add_char_descr (tGATT_SVC_DB *p_db, tGATT_PERM perm,
602 if ((p_char_dscptr = (tGATT_ATTR16 *)allocate_attr_in_db(p_db,
625 ** Parameter p_db: pointer to the attribute database.
639 tGATT_SVC_DB *p_db,
652 if (p_db && p_db->p_attr_list)
654 p_attr = (tGATT_ATTR16 *)p_db->p_attr_list;
683 ** Parameter p_db: pointer to the attribute database.
696 tGATT_STATUS gatts_read_attr_perm_check(tGATT_SVC_DB *p_db,
705 if (p_db && p_db->p_attr_list)
707 p_attr = (tGATT_ATTR16 *)p_db->p_attr_list;
730 ** Parameter p_db: pointer to the attribute database.
742 tGATT_STATUS gatts_write_attr_perm_check (tGATT_SVC_DB *p_db, UINT8 op_code,
755 if (p_db != NULL)
757 p_attr = (tGATT_ATTR16 *) p_db->p_attr_list;
916 ** Parameter p_db : database pointer.
923 static void *allocate_attr_in_db(tGATT_SVC_DB *p_db, tBT_UUID *p_uuid, tGATT_PERM perm)
943 if (p_db->end_handle <= p_db->next_handle)
946 p_db->end_handle, p_db->next_handle);
950 if (p_db->mem_free < len)
952 if (!allocate_svc_db_buf(p_db))
958 memset(p_db->p_free_mem, 0, len);
959 p_attr16 = (tGATT_ATTR16 *) p_db->p_free_mem;
968 p_attr32 = (tGATT_ATTR32 *) p_db->p_free_mem;
974 p_attr128 = (tGATT_ATTR128 *) p_db->p_free_mem;
979 p_db->p_free_mem += len;
980 p_db->mem_free -= len;
982 p_attr16->handle = p_db->next_handle++;
987 if (p_db->p_attr_list == NULL)
988 p_db->p_attr_list = p_attr16;
991 p_last = (tGATT_ATTR16 *)p_db->p_attr_list;
1024 ** Parameter p_db: database pointer.
1030 static BOOLEAN deallocate_attr_in_db(tGATT_SVC_DB *p_db, void *p_attr)
1035 if (p_db->p_attr_list == NULL)
1038 p_cur = (tGATT_ATTR16 *) p_db->p_attr_list;
1050 if (p_cur == p_attr && p_cur == p_db->p_attr_list)
1052 p_db->p_attr_list = p_cur->p_next;
1057 p_db->next_handle --;
1070 ** Parameter p_db: database pointer.
1078 static BOOLEAN copy_extra_byte_in_db(tGATT_SVC_DB *p_db, void **p_dst, UINT16 len)
1082 if (p_db->mem_free < len)
1084 if (!allocate_svc_db_buf(p_db))
1091 p = p_db->p_free_mem;
1092 p_db->p_free_mem += len;
1093 p_db->mem_free -= len;
1109 static BOOLEAN allocate_svc_db_buf(tGATT_SVC_DB *p_db)
1122 p_db->p_free_mem = (UINT8 *) p_buf;
1123 p_db->mem_free = GKI_get_buf_size(p_buf);
1125 GKI_enqueue(&p_db->svc_buffer, p_buf);
1181 ** Parameter p_db: database pointer.
1187 static BOOLEAN gatts_db_add_service_declaration(tGATT_SVC_DB *p_db, tBT_UUID *p_service, BOOLEAN is_pri)
1201 if ((p_attr = (tGATT_ATTR16 *)(allocate_attr_in_db(p_db, &uuid, GATT_PERM_READ))) != NULL)
1203 if (copy_extra_byte_in_db (p_db, (void **)&p_attr->p_value, sizeof(tBT_UUID)))