本文整理汇总了C++中osi_free函数的典型用法代码示例。如果您正苦于以下问题:C++ osi_free函数的具体用法?C++ osi_free怎么用?C++ osi_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了osi_free函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: btc_ble_gattc_get_include_service
esp_gatt_status_t btc_ble_gattc_get_include_service(uint16_t conn_id,
uint16_t start_handle,
uint16_t end_handle,
esp_bt_uuid_t *incl_uuid,
esp_gattc_incl_svc_elem_t *result,
uint16_t *count)
{
esp_gatt_status_t status;
btgatt_db_element_t *db = NULL;
int incl_num = 0;
tBT_UUID bta_uuid = {0};
if (incl_uuid != NULL) {
btc_to_bta_uuid(&bta_uuid, incl_uuid);
BTA_GATTC_GetIncludeService(conn_id, start_handle, end_handle, &bta_uuid, &db, &incl_num);
} else {
BTA_GATTC_GetIncludeService(conn_id, start_handle, end_handle, NULL, &db, &incl_num);
}
if ((status = btc_gattc_check_valid_param(incl_num, 0)) != ESP_GATT_OK) {
if (db) {
osi_free(db);
}
return status;
}else {
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)incl_num, ESP_GATT_DB_INCLUDED_SERVICE, 0, (void *)result, db);
}
*count = incl_num;
//don't forget to free the db buffer after used.
if (db) {
osi_free(db);
}
return ESP_GATT_OK;
}
开发者ID:altran-nl,项目名称:esp-idf,代码行数:35,代码来源:btc_gattc.c
示例2: avdt_ccb_clear_ccb
/*******************************************************************************
**
** Function avdt_ccb_clear_ccb
**
** Description This function clears out certain buffers, queues, and
** other data elements of a ccb.
**
**
** Returns void.
**
*******************************************************************************/
static void avdt_ccb_clear_ccb(tAVDT_CCB *p_ccb)
{
BT_HDR *p_buf;
/* clear certain ccb variables */
p_ccb->cong = FALSE;
p_ccb->ret_count = 0;
/* free message being fragmented */
if (p_ccb->p_curr_msg != NULL) {
osi_free(p_ccb->p_curr_msg);
p_ccb->p_curr_msg = NULL;
}
/* free message being reassembled */
if (p_ccb->p_rx_msg != NULL) {
osi_free(p_ccb->p_rx_msg);
p_ccb->p_rx_msg = NULL;
}
/* clear out response queue */
while ((p_buf = (BT_HDR *) fixed_queue_try_dequeue(p_ccb->rsp_q)) != NULL) {
osi_free(p_buf);
}
}
开发者ID:tve,项目名称:esp-idf,代码行数:36,代码来源:avdt_ccb_act.c
示例3: bta_hf_client_at_parse
/******************************************************************************
**
** MAIN PARSING FUNCTION
**
**
*******************************************************************************/
void bta_hf_client_at_parse(char *buf, unsigned int len)
{
APPL_TRACE_DEBUG("%s offset: %u len: %u", __FUNCTION__, bta_hf_client_cb.scb.at_cb.offset, len);
if (len + bta_hf_client_cb.scb.at_cb.offset > BTA_HF_CLIENT_AT_PARSER_MAX_LEN) {
unsigned int tmp = bta_hf_client_cb.scb.at_cb.offset;
unsigned int space_left = BTA_HF_CLIENT_AT_PARSER_MAX_LEN - bta_hf_client_cb.scb.at_cb.offset;
char *tmp_buff = osi_malloc(BTA_HF_CLIENT_AT_PARSER_MAX_LEN);
if (tmp_buff == NULL) {
APPL_TRACE_ERROR("No mem %s", __FUNCTION__);
return;
}
APPL_TRACE_DEBUG("%s overrun, trying to recover", __FUNCTION__);
/* fill up parser buffer */
memcpy(bta_hf_client_cb.scb.at_cb.buf + bta_hf_client_cb.scb.at_cb.offset, buf, space_left);
len -= space_left;
buf += space_left;
bta_hf_client_cb.scb.at_cb.offset += space_left;
/* find end of last complete command before proceeding */
while (bta_hf_client_check_at_complete() == FALSE) {
if (bta_hf_client_cb.scb.at_cb.offset == 0) {
APPL_TRACE_ERROR("HFPClient: AT parser buffer overrun, disconnecting");
bta_hf_client_at_reset();
bta_hf_client_sm_execute(BTA_HF_CLIENT_API_CLOSE_EVT, NULL);
osi_free(tmp_buff);
return;
}
bta_hf_client_cb.scb.at_cb.offset--;
}
/* cut buffer to complete AT event and keep cut data */
tmp += space_left - bta_hf_client_cb.scb.at_cb.offset;
memcpy(tmp_buff, bta_hf_client_cb.scb.at_cb.buf + bta_hf_client_cb.scb.at_cb.offset, tmp);
bta_hf_client_cb.scb.at_cb.buf[bta_hf_client_cb.scb.at_cb.offset] = '\0';
/* parse */
bta_hf_client_at_parse_start();
bta_hf_client_at_clear_buf();
/* recover cut data */
memcpy(bta_hf_client_cb.scb.at_cb.buf, tmp_buff, tmp);
bta_hf_client_cb.scb.at_cb.offset += tmp;
osi_free(tmp_buff);
}
memcpy(bta_hf_client_cb.scb.at_cb.buf + bta_hf_client_cb.scb.at_cb.offset, buf, len);
bta_hf_client_cb.scb.at_cb.offset += len;
/* If last event is complete, parsing can be started */
if (bta_hf_client_check_at_complete() == TRUE) {
bta_hf_client_at_parse_start();
bta_hf_client_at_clear_buf();
}
}
开发者ID:tve,项目名称:esp-idf,代码行数:65,代码来源:bta_hf_client_at.c
示例4: rfc_port_sm_sabme_wait_ua
/*******************************************************************************
**
** Function rfc_port_sm_sabme_wait_ua
**
** Description This function handles events when SABME on the DLC was
** sent and SM is waiting for UA or DM.
**
** Returns void
**
*******************************************************************************/
void rfc_port_sm_sabme_wait_ua (tPORT *p_port, UINT16 event, void *p_data)
{
switch (event) {
case RFC_EVENT_OPEN:
case RFC_EVENT_ESTABLISH_RSP:
RFCOMM_TRACE_ERROR ("Port error state %d event %d", p_port->rfc.state, event);
return;
case RFC_EVENT_CLOSE:
rfc_port_timer_start (p_port, RFC_DISC_TIMEOUT);
rfc_send_disc (p_port->rfc.p_mcb, p_port->dlci);
p_port->rfc.expected_rsp = 0;
p_port->rfc.state = RFC_STATE_DISC_WAIT_UA;
return;
case RFC_EVENT_CLEAR:
rfc_port_closed (p_port);
return;
case RFC_EVENT_DATA:
osi_free (p_data);
break;
case RFC_EVENT_UA:
rfc_port_timer_stop (p_port);
p_port->rfc.state = RFC_STATE_OPENED;
PORT_DlcEstablishCnf (p_port->rfc.p_mcb, p_port->dlci, p_port->rfc.p_mcb->peer_l2cap_mtu, RFCOMM_SUCCESS);
return;
case RFC_EVENT_DM:
p_port->rfc.p_mcb->is_disc_initiator = TRUE;
PORT_DlcEstablishCnf (p_port->rfc.p_mcb, p_port->dlci, p_port->rfc.p_mcb->peer_l2cap_mtu, RFCOMM_ERROR);
rfc_port_closed (p_port);
return;
case RFC_EVENT_DISC:
rfc_send_ua (p_port->rfc.p_mcb, p_port->dlci);
PORT_DlcEstablishCnf (p_port->rfc.p_mcb, p_port->dlci, p_port->rfc.p_mcb->peer_l2cap_mtu, RFCOMM_ERROR);
rfc_port_closed (p_port);
return;
case RFC_EVENT_SABME:
/* Continue to wait for the UA the SABME this side sent */
rfc_send_ua (p_port->rfc.p_mcb, p_port->dlci);
return;
case RFC_EVENT_UIH:
osi_free (p_data);
return;
case RFC_EVENT_TIMEOUT:
p_port->rfc.state = RFC_STATE_CLOSED;
PORT_DlcEstablishCnf (p_port->rfc.p_mcb, p_port->dlci, p_port->rfc.p_mcb->peer_l2cap_mtu, RFCOMM_ERROR);
return;
}
RFCOMM_TRACE_WARNING ("Port state sabme_wait_ua Event ignored %d", event);
}
开发者ID:mr-nice,项目名称:esp-idf,代码行数:67,代码来源:rfc_port_fsm.c
示例5: rfc_port_sm_state_closed
/*******************************************************************************
**
** Function rfc_port_sm_state_closed
**
** Description This function handles events when the port is in
** CLOSED state. This state exists when port is
** being initially established.
**
** Returns void
**
*******************************************************************************/
void rfc_port_sm_state_closed (tPORT *p_port, UINT16 event, void *p_data)
{
switch (event) {
case RFC_EVENT_OPEN:
p_port->rfc.state = RFC_STATE_ORIG_WAIT_SEC_CHECK;
btm_sec_mx_access_request (p_port->rfc.p_mcb->bd_addr, BT_PSM_RFCOMM, TRUE,
BTM_SEC_PROTO_RFCOMM, (UINT32)(p_port->dlci / 2),
&rfc_sec_check_complete, p_port);
return;
case RFC_EVENT_CLOSE:
break;
case RFC_EVENT_CLEAR:
return;
case RFC_EVENT_DATA:
osi_free (p_data);
break;
case RFC_EVENT_SABME:
/* make sure the multiplexer disconnect timer is not running (reconnect case) */
rfc_timer_stop(p_port->rfc.p_mcb );
/* Open will be continued after security checks are passed */
p_port->rfc.state = RFC_STATE_TERM_WAIT_SEC_CHECK;
btm_sec_mx_access_request (p_port->rfc.p_mcb->bd_addr, BT_PSM_RFCOMM, FALSE,
BTM_SEC_PROTO_RFCOMM, (UINT32)(p_port->dlci / 2),
&rfc_sec_check_complete, p_port);
return;
case RFC_EVENT_UA:
return;
case RFC_EVENT_DM:
rfc_port_closed (p_port);
return;
case RFC_EVENT_UIH:
osi_free (p_data);
rfc_send_dm (p_port->rfc.p_mcb, p_port->dlci, FALSE);
return;
case RFC_EVENT_DISC:
rfc_send_dm (p_port->rfc.p_mcb, p_port->dlci, FALSE);
return;
case RFC_EVENT_TIMEOUT:
Port_TimeOutCloseMux( p_port->rfc.p_mcb ) ;
RFCOMM_TRACE_ERROR ("Port error state %d event %d", p_port->rfc.state, event);
return;
}
RFCOMM_TRACE_WARNING ("Port state closed Event ignored %d", event);
return;
}
开发者ID:mr-nice,项目名称:esp-idf,代码行数:67,代码来源:rfc_port_fsm.c
示例6: entry_free
static void entry_free(void *ptr)
{
if (!ptr) {
return;
}
entry_t *entry = ptr;
osi_free(entry->key);
osi_free(entry->value);
osi_free(entry);
}
开发者ID:altran-nl,项目名称:esp-idf,代码行数:11,代码来源:config.c
示例7: section_free
static void section_free(void *ptr)
{
if (!ptr) {
return;
}
section_t *section = ptr;
osi_free(section->name);
list_free(section->entries);
osi_free(section);
}
开发者ID:altran-nl,项目名称:esp-idf,代码行数:11,代码来源:config.c
示例8: data_dispatcher_free
void data_dispatcher_free(data_dispatcher_t *dispatcher) {
if (!dispatcher)
return;
hash_map_free(dispatcher->dispatch_table);
if (dispatcher->name)
osi_free(dispatcher->name);
osi_free(dispatcher);
}
开发者ID:Emill,项目名称:android_bluetooth,代码行数:11,代码来源:data_dispatcher.c
示例9: buffer_free
void buffer_free(buffer_t *buffer) {
if (!buffer)
return;
if (buffer->root != buffer) {
// We're a leaf node. Delete the root node if we're the last referent.
if (--buffer->root->refcount == 0)
osi_free(buffer->root);
osi_free(buffer);
} else if (--buffer->refcount == 0) {
// We're a root node. Roots are only deleted when their refcount goes to 0.
osi_free(buffer);
}
}
开发者ID:Emill,项目名称:android_bluetooth,代码行数:14,代码来源:buffer.c
示例10: osi_malloc
static char *bta_hf_client_parse_cind_list(char *buffer)
{
int offset;
char *name = osi_malloc(129);
UINT32 min, max;
UINT32 index = 0;
int res;
if (name == NULL) {
APPL_TRACE_ERROR("No mem %s", __FUNCTION__);
return NULL;
}
while ((res = sscanf(buffer, "(\"%128[^\"]\",(%u%*[-,]%u))%n", name, &min, &max, &offset)) > 2) {
bta_hf_client_handle_cind_list_item(name, min, max, index);
buffer += offset;
index++;
if (*buffer != ',') {
break;
}
buffer++;
}
osi_free(name);
if (res > 2) {
AT_CHECK_RN(buffer);
return buffer;
}
return NULL;
}
开发者ID:tve,项目名称:esp-idf,代码行数:34,代码来源:bta_hf_client_at.c
示例11: bta_hf_client_send_at_bia
void bta_hf_client_send_at_bia(void)
{
char *buf;
int at_len;
int i;
APPL_TRACE_DEBUG("%s", __FUNCTION__);
if (bta_hf_client_cb.scb.peer_version < HFP_VERSION_1_6) {
APPL_TRACE_DEBUG("Remote does not Support AT+BIA");
return;
}
buf = osi_malloc(BTA_HF_CLIENT_AT_MAX_LEN);
if (buf == NULL) {
APPL_TRACE_ERROR("No mem %s", __FUNCTION__);
return;
}
at_len = snprintf(buf, BTA_HF_CLIENT_AT_MAX_LEN, "AT+BIA=");
for (i = 0; i < BTA_HF_CLIENT_AT_INDICATOR_COUNT; i++) {
int sup = bta_hf_client_cb.scb.at_cb.indicator_lookup[i] == -1 ? 0 : 1;
at_len += snprintf(buf + at_len, BTA_HF_CLIENT_AT_MAX_LEN - at_len, "%u,", sup);
}
buf[at_len - 1] = '\r';
bta_hf_client_send_at(BTA_HF_CLIENT_AT_BIA, buf, at_len);
osi_free(buf);
}
开发者ID:tve,项目名称:esp-idf,代码行数:30,代码来源:bta_hf_client_at.c
示例12: btc_a2dp_sink_ctrl_handler
static void btc_a2dp_sink_ctrl_handler(BtTaskEvt_t *e)
{
if (e == NULL) {
return;
}
switch (e->sig) {
case BTC_MEDIA_TASK_SINK_INIT:
btc_a2dp_sink_thread_init(NULL);
break;
case BTC_MEDIA_TASK_SINK_CLEAN_UP:
btc_a2dp_sink_thread_cleanup(NULL);
break;
case BTC_MEDIA_AUDIO_SINK_CFG_UPDATE:
btc_a2dp_sink_handle_decoder_reset(e->par);
break;
case BTC_MEDIA_AUDIO_SINK_CLEAR_TRACK:
btc_a2dp_sink_handle_clear_track();
break;
case BTC_MEDIA_FLUSH_AA_RX:
btc_a2dp_sink_rx_flush();
break;
default:
APPL_TRACE_WARNING("media task unhandled evt: 0x%x\n", e->sig);
}
if (e->par != NULL) {
osi_free(e->par);
}
}
开发者ID:altran-nl,项目名称:esp-idf,代码行数:28,代码来源:btc_a2dp_sink.c
示例13: LOG_ERROR
socket_t *socket_new(void) {
socket_t *ret = (socket_t *)osi_calloc(sizeof(socket_t));
if (!ret) {
LOG_ERROR("%s unable to allocate memory for socket.", __func__);
goto error;
}
ret->fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (ret->fd == INVALID_FD) {
LOG_ERROR("%s unable to create socket: %s", __func__, strerror(errno));
goto error;
}
int enable = 1;
if (setsockopt(ret->fd, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable)) == -1) {
LOG_ERROR("%s unable to set SO_REUSEADDR: %s", __func__, strerror(errno));
goto error;
}
return ret;
error:;
if (ret)
close(ret->fd);
osi_free(ret);
return NULL;
}
开发者ID:jolin90,项目名称:jolin,代码行数:27,代码来源:socket.c
示例14: avdt_ccb_cmd_fail
/*******************************************************************************
**
** Function avdt_ccb_cmd_fail
**
** Description This function is called when there is a response timeout.
** The currently pending command is freed and we fake a
** reject message back to ourselves.
**
**
** Returns void.
**
*******************************************************************************/
void avdt_ccb_cmd_fail(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
{
tAVDT_MSG msg;
UINT8 evt;
tAVDT_SCB *p_scb;
if (p_ccb->p_curr_cmd != NULL) {
/* set up data */
msg.hdr.err_code = p_data->err_code;
msg.hdr.err_param = 0;
msg.hdr.ccb_idx = avdt_ccb_to_idx(p_ccb);
/* pretend that we received a rej message */
evt = avdt_msg_rej_2_evt[p_ccb->p_curr_cmd->event - 1];
if (evt & AVDT_CCB_MKR) {
avdt_ccb_event(p_ccb, (UINT8) (evt & ~AVDT_CCB_MKR), (tAVDT_CCB_EVT *) &msg);
} else {
/* we get the scb out of the current cmd */
p_scb = avdt_scb_by_hdl(*((UINT8 *)(p_ccb->p_curr_cmd + 1)));
if (p_scb != NULL) {
avdt_scb_event(p_scb, evt, (tAVDT_SCB_EVT *) &msg);
}
}
osi_free(p_ccb->p_curr_cmd);
p_ccb->p_curr_cmd = NULL;
}
}
开发者ID:tve,项目名称:esp-idf,代码行数:41,代码来源:avdt_ccb_act.c
示例15: non_repeating_timer_free
void non_repeating_timer_free(non_repeating_timer_t *timer) {
if (!timer)
return;
alarm_free(timer->alarm);
osi_free(timer);
}
开发者ID:Emill,项目名称:android_bluetooth,代码行数:7,代码来源:non_repeating_timer.c
示例16: btc_dm_sec_arg_deep_free
/******************************************************************************
** Functions
******************************************************************************/
static void btc_dm_sec_arg_deep_free(btc_msg_t *msg)
{
btc_dm_sec_args_t *arg = (btc_dm_sec_args_t *)(msg->arg);
if (msg->act == BTA_DM_BLE_KEY_EVT) {
osi_free(arg->sec.ble_key.p_key_value);
}
}
开发者ID:mr-nice,项目名称:esp-idf,代码行数:10,代码来源:btc_dm.c
示例17: avct_lcb_dealloc
/*******************************************************************************
**
** Function avct_lcb_dealloc
**
** Description Deallocate a link control block.
**
**
** Returns void.
**
*******************************************************************************/
void avct_lcb_dealloc(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
{
UNUSED(p_data);
AVCT_TRACE_DEBUG("%s allocated: %d", __func__, p_lcb->allocated);
// Check if the LCB is still referenced
tAVCT_CCB *p_ccb = &avct_cb.ccb[0];
for (size_t i = 0; i < AVCT_NUM_CONN; i++, p_ccb++)
{
if (p_ccb->allocated && p_ccb->p_lcb == p_lcb)
{
AVCT_TRACE_DEBUG("%s LCB in use; lcb index: %d", __func__, i);
return;
}
}
// If not, de-allocate now...
AVCT_TRACE_DEBUG("%s Freeing LCB", __func__);
osi_free(p_lcb->p_rx_msg);
fixed_queue_free(p_lcb->tx_q, NULL);
memset(p_lcb, 0, sizeof(tAVCT_LCB));
}
开发者ID:altran-nl,项目名称:esp-idf,代码行数:35,代码来源:avct_lcb.c
示例18: reactor_unregister
void reactor_unregister(reactor_object_t *obj) {
assert(obj != NULL);
reactor_t *reactor = obj->reactor;
if (epoll_ctl(reactor->epoll_fd, EPOLL_CTL_DEL, obj->fd, NULL) == -1)
LOG_ERROR("%s unable to unregister fd %d from epoll set: %s", __func__, obj->fd, strerror(errno));
if (reactor->is_running && pthread_equal(pthread_self(), reactor->run_thread)) {
reactor->object_removed = true;
return;
}
pthread_mutex_lock(&reactor->list_lock);
list_append(reactor->invalidation_list, obj);
pthread_mutex_unlock(&reactor->list_lock);
// Taking the object lock here makes sure a callback for |obj| isn't
// currently executing. The reactor thread must then either be before
// the callbacks or after. If after, we know that the object won't be
// referenced because it has been taken out of the epoll set. If before,
// it won't be referenced because the reactor thread will check the
// invalidation_list and find it in there. So by taking this lock, we
// are waiting until the reactor thread drops all references to |obj|.
// One the wait completes, we can unlock and destroy |obj| safely.
pthread_mutex_lock(&obj->lock);
pthread_mutex_unlock(&obj->lock);
pthread_mutex_destroy(&obj->lock);
osi_free(obj);
}
开发者ID:ghostrider96,项目名称:platform_system_bt,代码行数:30,代码来源:reactor.c
示例19: btif_config_set_bin
bool btif_config_set_bin(const char *section, const char *key, const uint8_t *value, size_t length) {
const char *lookup = "0123456789abcdef";
assert(config != NULL);
assert(section != NULL);
assert(key != NULL);
if (length > 0)
assert(value != NULL);
char *str = (char *)osi_calloc(length * 2 + 1);
if (!str)
return false;
for (size_t i = 0; i < length; ++i) {
str[(i * 2) + 0] = lookup[(value[i] >> 4) & 0x0F];
str[(i * 2) + 1] = lookup[value[i] & 0x0F];
}
pthread_mutex_lock(&lock);
config_set_string(config, section, key, str);
pthread_mutex_unlock(&lock);
osi_free(str);
return true;
}
开发者ID:Emill,项目名称:android_bluetooth,代码行数:26,代码来源:btif_config.c
示例20: avdt_ad_tc_data_ind
/*******************************************************************************
**
** Function avdt_ad_tc_data_ind
**
** Description This function is called by the L2CAP interface layer when
** incoming data is received from L2CAP. It looks up the CCB
** or SCB for the channel and routes the data accordingly.
**
**
** Returns Nothing.
**
*******************************************************************************/
void avdt_ad_tc_data_ind(tAVDT_TC_TBL *p_tbl, BT_HDR *p_buf)
{
tAVDT_CCB *p_ccb;
tAVDT_SCB *p_scb;
/* store type (media, recovery, reporting) */
p_buf->layer_specific = avdt_ad_tcid_to_type(p_tbl->tcid);
/* if signaling channel, handle control message */
if (p_tbl->tcid == 0) {
p_ccb = avdt_ccb_by_idx(p_tbl->ccb_idx);
avdt_msg_ind(p_ccb, p_buf);
}
/* if media or other channel, send event to scb */
else {
p_scb = avdt_scb_by_hdl(avdt_cb.ad.rt_tbl[p_tbl->ccb_idx][p_tbl->tcid].scb_hdl);
if (p_scb != NULL) {
avdt_scb_event(p_scb, AVDT_SCB_TC_DATA_EVT, (tAVDT_SCB_EVT *) &p_buf);
} else {
osi_free(p_buf);
AVDT_TRACE_ERROR(" avdt_ad_tc_data_ind buffer freed");
}
}
}
开发者ID:tve,项目名称:esp-idf,代码行数:37,代码来源:avdt_ad.c
注:本文中的osi_free函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论