• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ sdp_record_free函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中sdp_record_free函数的典型用法代码示例。如果您正苦于以下问题:C++ sdp_record_free函数的具体用法?C++ sdp_record_free怎么用?C++ sdp_record_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了sdp_record_free函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: sdp_record_free

static DBusMessage *update_record(DBusConnection *conn, DBusMessage *msg,
		struct service_adapter *serv_adapter,
		dbus_uint32_t handle, sdp_record_t *sdp_record)
{
	bdaddr_t src;
	int err;

	if (remove_record_from_server(handle) < 0) {
		sdp_record_free(sdp_record);
		return btd_error_not_available(msg);
	}

	if (serv_adapter->adapter)
		adapter_get_address(serv_adapter->adapter, &src);
	else
		bacpy(&src, BDADDR_ANY);

	sdp_record->handle = handle;
	err = add_record_to_server(&src, sdp_record);
	if (err < 0) {
		sdp_record_free(sdp_record);
		error("Failed to update the service record");
		return btd_error_failed(msg, strerror(-err));
	}

	return dbus_message_new_method_return(msg);
}
开发者ID:520lly,项目名称:bluez,代码行数:27,代码来源:service.c


示例2: bt_pan_register

bool bt_pan_register(struct ipc *ipc, const bdaddr_t *addr, uint8_t mode)
{
    sdp_record_t *nap_rec, *panu_rec;
    int err;

    DBG("");

    bacpy(&adapter_addr, addr);

    nap_rec = nap_record();
    if (bt_adapter_add_record(nap_rec, SVC_HINT_NETWORKING) < 0) {
        sdp_record_free(nap_rec);
        error("Failed to allocate PAN-NAP sdp record");
        return false;
    }

    panu_rec = panu_record();
    if (bt_adapter_add_record(panu_rec, SVC_HINT_NETWORKING) < 0) {
        sdp_record_free(nap_rec);
        sdp_record_free(panu_rec);
        error("Failed to allocate PAN-PANU sdp record");
        return false;
    }

    err = bnep_init();
    if (err < 0) {
        error("Failed to init BNEP");
        bt_adapter_remove_record(nap_rec->handle);
        bt_adapter_remove_record(panu_rec->handle);
        return false;
    }

    err = register_nap_server();
    if (err < 0) {
        error("Failed to register NAP server");
        bt_adapter_remove_record(nap_rec->handle);
        bt_adapter_remove_record(panu_rec->handle);
        bnep_cleanup();
        return false;
    }

    nap_rec_id = nap_rec->handle;
    panu_rec_id = panu_rec->handle;

    hal_ipc = ipc;
    ipc_register(hal_ipc, HAL_SERVICE_ID_PAN, cmd_handlers,
                 G_N_ELEMENTS(cmd_handlers));

    return true;
}
开发者ID:ijonesalvarez,项目名称:SHIO,代码行数:50,代码来源:pan.c


示例3: DBG

static DBusMessage *add_sap_service_record(DBusConnection *conn, DBusMessage *msg,
                        void *data)
{
   DBG("");

   sdp_record_t *record = NULL;
   GError *gerr = NULL;

	record = create_sap_record(SAP_SERVER_CHANNEL);
	if (!record) {
		error("Creating SAP SDP record failed.");
		goto sdp_err;
	}

	if (add_record_to_server(&server->src, record) < 0) {
		error("Adding SAP SDP record to the SDP server failed.");
		sdp_record_free(record);
		goto sdp_err;
	}

	server->record_id = record->handle;

   DBG("EXIT");

   return dbus_message_new_method_return(msg);

sdp_err:
	server_free(server);
	sap_exit();
   return dbus_message_new_method_return(msg);
}
开发者ID:Kick-Buttowski,项目名称:android_external_bluetooth_bluez,代码行数:31,代码来源:server.c


示例4: del_service

static int del_service(sdp_session_t *session, uint32_t handle)
{
	sdp_record_t *rec;

	logDebug("Deleting Service Record.\n");

	if (!session) {
		logDebug("Bad local SDP session!\n");
		return -1;
	}

	rec = sdp_record_alloc();

	if (rec == NULL) {
		return -1;
	}

	rec->handle = handle;

	if (sdp_device_record_unregister(session, &loc_addr.rc_bdaddr, rec) != 0) {
		/*
		 If Bluetooth is shut off, the sdp daemon will not be running and it is
		 therefore common that this function will fail in that case. This is fine
		 since the record is removed when the daemon shuts down. We only have
		 to free our record handle here then....
		 */
		//CM_DBG("Failed to unregister service record: %s\n", strerror(errno));
		sdp_record_free(rec);
		return -1;
	}

	logDebug("Service Record deleted.");

	return 0;
}
开发者ID:Keerecles,项目名称:AOA-Proxy,代码行数:35,代码来源:bluetooth.c


示例5: sdp_svcdb_collect_all

/*
 * collect all services registered over this socket
 */
void sdp_svcdb_collect_all(int sock)
{
	sdp_list_t *p, *q;

	for (p = socket_index, q = 0; p; ) {
		sdp_indexed_t *item = p->data;
		if (item->sock == sock) {
			sdp_list_t *next = p->next;
			sdp_record_remove(item->record->handle);
			sdp_record_free(item->record);
			free(item);
			if (q)
				q->next = next;
			else
				socket_index = next;
			free(p);
			p = next;
		} else if (item->sock > sock)
			return;
		else {
			q = p;
			p = p->next;
		}
	}
}
开发者ID:BjornSjolund,项目名称:bluepy,代码行数:28,代码来源:sdpd-database.c


示例6: malloc

static sdp_record_t *sdp_xml_parse_record(const char *data, int size)
{
	GMarkupParseContext *ctx;
	struct context_data *ctx_data;
	sdp_record_t *record;

	ctx_data = malloc(sizeof(*ctx_data));
	if (!ctx_data)
		return NULL;

	record = sdp_record_alloc();
	if (!record) {
		free(ctx_data);
		return NULL;
	}

	memset(ctx_data, 0, sizeof(*ctx_data));
	ctx_data->record = record;

	ctx = g_markup_parse_context_new(&parser, 0, ctx_data, NULL);

	if (g_markup_parse_context_parse(ctx, data, size, NULL) == FALSE) {
		error("XML parsing error");
		g_markup_parse_context_free(ctx);
		sdp_record_free(record);
		free(ctx_data);
		return NULL;
	}

	g_markup_parse_context_free(ctx);

	free(ctx_data);

	return record;
}
开发者ID:520lly,项目名称:bluez,代码行数:35,代码来源:service.c


示例7: service_remove_req

/*
 * Remove a registered service record
 */
int service_remove_req(sdp_req_t *req, sdp_buf_t *rsp)
{
	uint8_t *p = req->buf + sizeof(sdp_pdu_hdr_t);
	uint32_t handle = bt_get_be32(p);
	sdp_record_t *rec;
	int status = 0;

	/* extract service record handle */

	rec = sdp_record_find(handle);
	if (rec) {
		sdp_svcdb_collect(rec);
		status = sdp_record_remove(handle);
		sdp_record_free(rec);
		if (status == 0)
			update_db_timestamp();
	} else {
		status = SDP_INVALID_RECORD_HANDLE;
		SDPDBG("Could not find record : 0x%x", handle);
	}

	p = rsp->data;
	bt_put_be16(status, p);
	rsp->data_size = sizeof(uint16_t);

	return status;
}
开发者ID:intgr,项目名称:bluez,代码行数:30,代码来源:sdpd-service.c


示例8: g_new0

static struct a2dp_sep *a2dp_add_sep(DBusConnection *conn, uint8_t type,
					uint8_t codec)
{
	struct a2dp_sep *sep;
	GSList **l;
	sdp_record_t *(*create_record)(void);
	uint32_t *record_id;
	sdp_record_t *record;
	struct avdtp_sep_ind *ind;

	sep = g_new0(struct a2dp_sep, 1);

	ind = (codec == A2DP_CODEC_MPEG12) ? &mpeg_ind : &sbc_ind;
	sep->sep = avdtp_register_sep(type, AVDTP_MEDIA_TYPE_AUDIO, codec,
					ind, &cfm, sep);
	if (sep->sep == NULL) {
		g_free(sep);
		return NULL;
	}

	sep->codec = codec;
	sep->type = type;

	if (type == AVDTP_SEP_TYPE_SOURCE) {
		l = &sources;
		create_record = a2dp_source_record;
		record_id = &source_record_id;
	} else {
		l = &sinks;
		create_record = a2dp_sink_record;
		record_id = &sink_record_id;
	}

	if (*record_id != 0)
		goto add;

	record = create_record();
	if (!record) {
		error("Unable to allocate new service record");
		avdtp_unregister_sep(sep->sep);
		g_free(sep);
		return NULL;
	}

	if (add_record_to_server(BDADDR_ANY, record) < 0) {
		error("Unable to register A2DP service record");\
		sdp_record_free(record);
		avdtp_unregister_sep(sep->sep);
		g_free(sep);
		return NULL;
	}
	*record_id = record->handle;

add:
	*l = g_slist_append(*l, sep);

	return sep;
}
开发者ID:0omega,项目名称:platform_external_bluez,代码行数:58,代码来源:a2dp.c


示例9: hdp_update_sdp_record

gboolean hdp_update_sdp_record(struct hdp_adapter *adapter, GSList *app_list)
{
	sdp_record_t *sdp_record;
	bdaddr_t addr;

	if (adapter->sdp_handler)
		remove_record_from_server(adapter->sdp_handler);

	if (!app_list) {
		adapter->sdp_handler = 0;
		return TRUE;
	}

	sdp_record = sdp_record_alloc();
	if (!sdp_record)
		return FALSE;

	if (adapter->sdp_handler)
		sdp_record->handle = adapter->sdp_handler;
	else
		sdp_record->handle = 0xffffffff; /* Set automatically */

	if (is_app_role(app_list, HDP_SINK))
		set_sdp_services_uuid(sdp_record, HDP_SINK);
	if (is_app_role(app_list, HDP_SOURCE))
		set_sdp_services_uuid(sdp_record, HDP_SOURCE);

	if (!register_service_protocols(adapter, sdp_record))
		goto fail;
	if (!register_service_profiles(sdp_record))
		goto fail;
	if (!register_service_additional_protocols(adapter, sdp_record))
		goto fail;

	sdp_set_info_attr(sdp_record, HDP_SERVICE_NAME, HDP_SERVICE_PROVIDER,
							HDP_SERVICE_DSC);
	if (!register_service_sup_features(app_list, sdp_record))
		goto fail;
	if (!register_data_exchange_spec(sdp_record))
		goto fail;

	register_mcap_features(sdp_record);

	if (sdp_set_record_state(sdp_record, adapter->record_state++))
		goto fail;

	adapter_get_address(adapter->btd_adapter, &addr);

	if (add_record_to_server(&addr, sdp_record) < 0)
		goto fail;
	adapter->sdp_handler = sdp_record->handle;
	return TRUE;

fail:
	if (sdp_record)
		sdp_record_free(sdp_record);
	return FALSE;
}
开发者ID:DroidModderXtreme,项目名称:Novathor_xperia_u8500,代码行数:58,代码来源:hdp_util.c


示例10: g_new0

static struct a2dp_sep *a2dp_add_sep(struct a2dp_server *server, uint8_t type,
                                     uint8_t codec, gboolean delay_reporting)
{
    struct a2dp_sep *sep;
    GSList **l;
    uint32_t *record_id;
    sdp_record_t *record;
    struct avdtp_sep_ind *ind;

    sep = g_new0(struct a2dp_sep, 1);

    ind = (codec == A2DP_CODEC_MPEG12) ? &mpeg_ind : &sbc_ind;
    sep->sep = avdtp_register_sep(&server->src, type,
                                  AVDTP_MEDIA_TYPE_AUDIO, codec,
                                  delay_reporting, ind, &cfm, sep);
    if (sep->sep == NULL) {
        g_free(sep);
        return NULL;
    }

    sep->codec = codec;
    sep->type = type;
    sep->delay_reporting = delay_reporting;

    if (type == AVDTP_SEP_TYPE_SOURCE) {
        l = &server->sources;
        record_id = &server->source_record_id;
    } else {
        l = &server->sinks;
        record_id = &server->sink_record_id;
    }

    if (*record_id != 0)
        goto add;

    record = a2dp_record(type, server->version);
    if (!record) {
        error("Unable to allocate new service record");
        avdtp_unregister_sep(sep->sep);
        g_free(sep);
        return NULL;
    }

    if (add_record_to_server(&server->src, record) < 0) {
        error("Unable to register A2DP service record");
        \
        sdp_record_free(record);
        avdtp_unregister_sep(sep->sep);
        g_free(sep);
        return NULL;
    }
    *record_id = record->handle;

add:
    *l = g_slist_append(*l, sep);

    return sep;
}
开发者ID:tkymgr,项目名称:semc-qsd8x50,代码行数:58,代码来源:a2dp.c


示例11: main

int main(int argc, char const *argv[])
{
	uint32_t svc_uuid_int[] = {0, 0, 0, 0xABCD};
	int status;
	bdaddr_t target, source;
	uuid_t svc_uuid;
	sdp_list_t *response_list, *search_list, *attrid_list;
	sdp_session_t *session = 0;
	uint32_t range = 0x0000ffff;
	uint8_t port = 0;


	//connect to the SDP server running on the remote machine
	str2ba(dest, &target);
	str2ba(src, &source);

	session = sdp_connect(&source, &target, 0);
	if (session == NULL) {
		perror("sdp_connect");
		exit(1);
	}

	sdp_uuid128_create(&svc_uuid, &svc_uuid_int);
	search_list = sdp_list_append(0, &svc_uuid);
	attrid_list = sdp_list_append(0, &range);

	//get a list of service records that have UUID 0xabcd
	response_list = NULL;
	status = sdp_service_search_attr_req(session, search_list, SDP_ATTR_REQ_RANGE, attrid_list, &response_list);
	if (status == 0) {
		sdp_list_t *proto_list = NULL;
		sdp_list_t *r = response_list;

		//go through each of the service records
		for (; r; r = r->next) {
			sdp_record_t *rec = (sdp_record_t *)r->data;

			//get a list of the protocol sequences
			if (sdp_get_access_protos(rec, &proto_list) == 0) {
				// get the RFCOMM port number
				port = sdp_get_proto_port(proto_list, RFCOMM_UUID);
				sdp_list_free(proto_list, 0);
			}
			sdp_record_free(rec);
		}
	}
	sdp_list_free(response_list, 0);
	sdp_list_free(search_list, 0);
	sdp_list_free(attrid_list, 0);
	sdp_close(session);

	if (port != 0) {
		printf("found service running on RFCOMM Port %d\n", port);
	}

	return 0;
}
开发者ID:lsyslsy,项目名称:SEMG,代码行数:57,代码来源:discover-client.c


示例12: gateway_server_init

static int gateway_server_init(struct audio_adapter *adapter)
{
	uint8_t chan = DEFAULT_HFP_HS_CHANNEL;
	sdp_record_t *record;
	gboolean master = TRUE;
	GError *err = NULL;
	GIOChannel *io;
	bdaddr_t src;

	if (config) {
		gboolean tmp;

		tmp = g_key_file_get_boolean(config, "General", "Master",
						&err);
		if (err) {
			DBG("audio.conf: %s", err->message);
			g_clear_error(&err);
		} else
			master = tmp;
	}

	adapter_get_address(adapter->btd_adapter, &src);

	io = bt_io_listen(BT_IO_RFCOMM, NULL, hf_io_cb, adapter, NULL, &err,
				BT_IO_OPT_SOURCE_BDADDR, &src,
				BT_IO_OPT_CHANNEL, chan,
				BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_MEDIUM,
				BT_IO_OPT_MASTER, master,
				BT_IO_OPT_INVALID);
	if (!io) {
		error("%s", err->message);
		g_error_free(err);
		return -1;
	}

	adapter->hfp_hs_server = io;
	record = hfp_hs_record(chan);
	if (!record) {
		error("Unable to allocate new service record");
		return -1;
	}

	if (add_record_to_server(&src, record) < 0) {
		error("Unable to register HFP HS service record");
		sdp_record_free(record);
		g_io_channel_unref(adapter->hfp_hs_server);
		adapter->hfp_hs_server = NULL;
		return -1;
	}

	adapter->hfp_hs_record_id = record->handle;

	return 0;
}
开发者ID:dev-life,项目名称:GT-I9300_Platform,代码行数:54,代码来源:manager.c


示例13: failed

static DBusMessage *proxy_enable(DBusConnection *conn,
                                 DBusMessage *msg, void *data)
{
    struct serial_proxy *prx = data;
    sdp_record_t *record;
    GError *err = NULL;
    DBusMessage *reply;

    if (prx->io)
        return failed(msg, "Already enabled");

    /* Listen */
    prx->io = bt_io_listen(BT_IO_RFCOMM, NULL, confirm_event_cb, prx,
                           NULL, &err,
                           BT_IO_OPT_SOURCE_BDADDR, &prx->src,
                           BT_IO_OPT_INVALID);
    if (!prx->io)
        goto failed;

    bt_io_get(prx->io, BT_IO_RFCOMM, &err,
              BT_IO_OPT_CHANNEL, &prx->channel,
              BT_IO_OPT_INVALID);
    if (err) {
        g_io_channel_unref(prx->io);
        prx->io = NULL;
        goto failed;
    }

    debug("Allocated channel %d", prx->channel);

    g_io_channel_set_close_on_unref(prx->io, TRUE);

    record = proxy_record_new(prx->uuid128, prx->channel);
    if (!record) {
        g_io_channel_unref(prx->io);
        return failed(msg, "Unable to allocate new service record");
    }

    if (add_record_to_server(&prx->src, record) < 0) {
        sdp_record_free(record);
        g_io_channel_unref(prx->io);
        return failed(msg, "Service registration failed");
    }

    prx->record_id = record->handle;

    return dbus_message_new_method_return(msg);

failed:
    error("%s", err->message);
    reply = failed(msg, err->message);
    g_error_free(err);
    return reply;
}
开发者ID:writefaruq,项目名称:bluez-oob,代码行数:54,代码来源:proxy.c


示例14: sdp_record_free

static DBusMessage *update_record(DBusMessage *msg,
				struct service_adapter *serv_adapter,
				dbus_uint32_t handle, sdp_record_t *sdp_record)
{
	int err;

	if (remove_record_from_server(handle) < 0) {
		sdp_record_free(sdp_record);
		return btd_error_not_available(msg);
	}

	sdp_record->handle = handle;
	err = add_record_to_server(get_address(serv_adapter), sdp_record);
	if (err < 0) {
		sdp_record_free(sdp_record);
		error("Failed to update the service record");
		return btd_error_failed(msg, strerror(-err));
	}

	return dbus_message_new_method_return(msg);
}
开发者ID:intgr,项目名称:bluez,代码行数:21,代码来源:service.c


示例15: enable_proxy

static int enable_proxy(struct serial_proxy *prx)
{
	sdp_record_t *record;
	GError *gerr = NULL;
	int err;

	if (prx->io)
		return -EALREADY;

	/* Listen */
	prx->io = bt_io_listen(BT_IO_RFCOMM, NULL, confirm_event_cb, prx,
				NULL, &gerr,
				BT_IO_OPT_SOURCE_BDADDR, &prx->src,
				BT_IO_OPT_INVALID);
	if (!prx->io)
		goto failed;

	bt_io_get(prx->io, BT_IO_RFCOMM, &gerr,
			BT_IO_OPT_CHANNEL, &prx->channel,
			BT_IO_OPT_INVALID);
	if (gerr) {
		g_io_channel_unref(prx->io);
		prx->io = NULL;
		goto failed;
	}

	debug("Allocated channel %d", prx->channel);

	g_io_channel_set_close_on_unref(prx->io, TRUE);

	record = proxy_record_new(prx->uuid128, prx->channel);
	if (!record) {
		g_io_channel_unref(prx->io);
		return -ENOMEM;
	}

	err = add_record_to_server(&prx->src, record);
	if (err < 0) {
		sdp_record_free(record);
		g_io_channel_unref(prx->io);
		return err;
	}

	prx->record_id = record->handle;

	return 0;

failed:
	error("%s", gerr->message);
	g_error_free(gerr);
	return -EIO;

}
开发者ID:Mcjesus15,项目名称:Zio_Other,代码行数:53,代码来源:proxy.c


示例16: search_completed_cb

static void search_completed_cb(uint8_t type, uint16_t status,
			uint8_t *rsp, size_t size, void *user_data)
{
	struct search_context *ctxt = user_data;
	sdp_list_t *recs = NULL;
	int scanned, seqlen = 0, bytesleft = size;
	uint8_t dataType;
	int err = 0;

	if (status || type != SDP_SVC_SEARCH_ATTR_RSP) {
		err = -EPROTO;
		goto done;
	}

	scanned = sdp_extract_seqtype(rsp, bytesleft, &dataType, &seqlen);
	if (!scanned || !seqlen)
		goto done;

	rsp += scanned;
	bytesleft -= scanned;
	do {
		sdp_record_t *rec;
		int recsize;

		recsize = 0;
		rec = sdp_extract_pdu(rsp, bytesleft, &recsize);
		if (!rec)
			break;

		if (!recsize) {
			sdp_record_free(rec);
			break;
		}

		scanned += recsize;
		rsp += recsize;
		bytesleft -= recsize;

		recs = sdp_list_append(recs, rec);
	} while (scanned < (ssize_t) size && bytesleft > 0);

done:
	cache_sdp_session(&ctxt->src, &ctxt->dst, ctxt->session);

	if (ctxt->cb)
		ctxt->cb(recs, err, ctxt->user_data);

	if (recs)
		sdp_list_free(recs, (sdp_free_func_t) sdp_record_free);

	search_context_cleanup(ctxt);
}
开发者ID:Xperia-Nicki,项目名称:android_platform_sony_nicki,代码行数:52,代码来源:glib-helper.c


示例17: bt_a2dp_register

bool bt_a2dp_register(struct ipc *ipc, const bdaddr_t *addr, uint8_t mode)
{
	GError *err = NULL;
	sdp_record_t *rec;

	DBG("");

	bacpy(&adapter_addr, addr);

	server = bt_io_listen(connect_cb, NULL, NULL, NULL, &err,
				BT_IO_OPT_SOURCE_BDADDR, &adapter_addr,
				BT_IO_OPT_PSM, AVDTP_PSM,
				BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_MEDIUM,
				BT_IO_OPT_MASTER, true,
				BT_IO_OPT_INVALID);
	if (!server) {
		error("Failed to listen on AVDTP channel: %s", err->message);
		g_error_free(err);
		return false;
	}

	rec = a2dp_record();
	if (!rec) {
		error("Failed to allocate A2DP record");
		goto fail;
	}

	if (bt_adapter_add_record(rec, SVC_HINT_CAPTURING) < 0) {
		error("Failed to register A2DP record");
		sdp_record_free(rec);
		goto fail;
	}
	record_id = rec->handle;

	hal_ipc = ipc;

	ipc_register(hal_ipc, HAL_SERVICE_ID_A2DP, cmd_handlers,
						G_N_ELEMENTS(cmd_handlers));

	if (bt_audio_register(audio_disconnected))
		return true;

fail:
	g_io_channel_shutdown(server, TRUE, NULL);
	g_io_channel_unref(server);
	server = NULL;
	return false;
}
开发者ID:BirdAndEarth,项目名称:RPi,代码行数:48,代码来源:a2dp.c


示例18: debug

JNIEXPORT jboolean JNICALL Java_com_intel_bluetooth_BluetoothStackBlueZ_populateServiceRecordAttributeValuesImpl
  (JNIEnv *env, jobject peer, jlong localDeviceBTAddress, jlong remoteDeviceAddressLong, jlong sdpSession, jlong handle, jintArray attrIDs, jobject serviceRecord) {
    sdp_session_t* session = (sdp_session_t*)jlong2ptr(sdpSession);
    sdp_session_t* close_session_on_return = NULL;
    if (session != NULL) {
        debug("populateServiceRecordAttributeValuesImpl connected %p, recordHandle %li", session, handle);
    } else {
        debug("populateServiceRecordAttributeValuesImpl connects, recordHandle %li", handle);
        bdaddr_t localAddr;
        longToDeviceAddr(localDeviceBTAddress, &localAddr);
        bdaddr_t remoteAddress;
        longToDeviceAddr(remoteDeviceAddressLong, &remoteAddress);
        session = sdp_connect(&localAddr, &remoteAddress, SDP_RETRY_IF_BUSY);
        if (session == NULL) {
            debug("populateServiceRecordAttributeValuesImpl can't connect");
            return JNI_FALSE;
        }
        // Close session on exit
       close_session_on_return = session;
    }

    sdp_list_t *attr_list = NULL;
    jboolean isCopy = JNI_FALSE;
    jint* ids = (*env)->GetIntArrayElements(env, attrIDs, &isCopy);
    int i;
    for(i = 0; i < (*env)->GetArrayLength(env, attrIDs); i++) {
        uint16_t* id = (uint16_t*)malloc(sizeof(uint16_t));
        *id=(uint16_t)ids[i];
        attr_list = sdp_list_append(attr_list,id);
    }

    jboolean rc = JNI_FALSE;
    sdp_record_t *sdpRecord = sdp_service_attr_req(session, (uint32_t)handle, SDP_ATTR_REQ_INDIVIDUAL, attr_list);
    if (!sdpRecord) {
        debug("sdp_service_attr_req return error");
        rc = JNI_FALSE;
    } else {
        populateServiceRecord(env, serviceRecord, sdpRecord, attr_list);
        sdp_record_free(sdpRecord);
        rc = JNI_TRUE;
    }
    sdp_list_free(attr_list, free);
    if (close_session_on_return != NULL) {
        sdp_close(close_session_on_return);
    }

    return rc;
}
开发者ID:rahulopengts,项目名称:bluetooth,代码行数:48,代码来源:BlueCoveBlueZ_SDPQuery.c


示例19: remove_record_from_server

int remove_record_from_server(uint32_t handle)
{
	sdp_record_t *rec;

	DBG("Removing record with handle 0x%05x", handle);

	rec = sdp_record_find(handle);
	if (!rec)
		return -ENOENT;

	if (sdp_record_remove(handle) == 0)
		update_db_timestamp();

	sdp_record_free(rec);

	return 0;
}
开发者ID:520lly,项目名称:bluez,代码行数:17,代码来源:sdpd-service.c


示例20: register_server_record

static uint32_t register_server_record(struct network_server *ns)
{
	sdp_record_t *record;

	record = server_record_new(ns->name, ns->id);
	if (!record) {
		error("Unable to allocate new service record");
		return 0;
	}

	if (add_record_to_server(&ns->src, record) < 0) {
		error("Failed to register service record");
		sdp_record_free(record);
		return 0;
	}

	DBG("got record id 0x%x", record->handle);

	return record->handle;
}
开发者ID:sancane,项目名称:BlueZ,代码行数:20,代码来源:server.c



注:本文中的sdp_record_free函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ sdr_begin_xn函数代码示例发布时间:2022-05-30
下一篇:
C++ sdp_list_free函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap