当前位置: 首页>>代码示例>>C++>>正文


C++ rl_printf函数代码示例

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


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

示例1: read_reply

static void read_reply(DBusMessage *message, void *user_data)
{
	DBusError error;
	DBusMessageIter iter, array;
	uint8_t *value;
	int len;

	dbus_error_init(&error);

	if (dbus_set_error_from_message(&error, message) == TRUE) {
		rl_printf("Failed to read: %s\n", error.name);
		dbus_error_free(&error);
		return;
	}

	dbus_message_iter_init(message, &iter);

	if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY) {
		rl_printf("Invalid response to read\n");
		return;
	}

	dbus_message_iter_recurse(&iter, &array);
	dbus_message_iter_get_fixed_array(&array, &value, &len);

	if (len < 0) {
		rl_printf("Unable to parse value\n");
		return;
	}

	rl_hexdump(value, len);
}
开发者ID:Hibati,项目名称:gatt,代码行数:32,代码来源:gatt.c

示例2: gatt_register_profile

void gatt_register_profile(DBusConnection *conn, GDBusProxy *proxy,
								wordexp_t *w)
{
	GList *l;

	l = g_list_find_custom(managers, proxy, match_proxy);
	if (!l) {
		rl_printf("Unable to find GattManager proxy\n");
		return;
	}

	if (g_dbus_register_interface(conn, PROFILE_PATH,
					PROFILE_INTERFACE, methods,
					NULL, NULL, NULL, NULL) == FALSE) {
		rl_printf("Failed to register profile object\n");
		return;
	}

	if (g_dbus_proxy_method_call(l->data, "RegisterProfile",
						register_profile_setup,
						register_profile_reply, w,
						NULL) == FALSE) {
		rl_printf("Failed register profile\n");
		return;
	}
}
开发者ID:Hibati,项目名称:gatt,代码行数:26,代码来源:gatt.c

示例3: read_attribute

static void read_attribute(GDBusProxy *proxy)
{
	if (g_dbus_proxy_method_call(proxy, "ReadValue", NULL, read_reply,
							NULL, NULL) == FALSE) {
		rl_printf("Failed to read\n");
		return;
	}

	rl_printf("Attempting to read %s\n", g_dbus_proxy_get_path(proxy));
}
开发者ID:anupdw,项目名称:android-bluez.bluez,代码行数:10,代码来源:gatt.c

示例4: register_profile_reply

static void register_profile_reply(DBusMessage *message, void *user_data)
{
	DBusError error;

	dbus_error_init(&error);

	if (dbus_set_error_from_message(&error, message) == TRUE) {
		rl_printf("Failed to register profile: %s\n", error.name);
		dbus_error_free(&error);
		return;
	}

	rl_printf("Profile registered\n");
}
开发者ID:Hibati,项目名称:gatt,代码行数:14,代码来源:gatt.c

示例5: ReadLineTtyUnset

/*
 * Undo changes to tty mode
 */
void ReadLineTtyUnset (void)
{
#if HAVE_TCGETATTR
    if (!tty_saved)
        return;

    if (tcsetattr (STDIN_FILENO, TCSAFLUSH, &tty_saved_attr) != 0)
    {
        rl_printf ("%s%s%s ", COLERROR, i18n (1619, "Warning:"), COLNONE);
        rl_printf (i18n (2524, "Can't restore terminal modes.\n"));
    }
    else
        tty_saved = 0;
#endif
}
开发者ID:egphilippov,项目名称:buguldey-ai-foss,代码行数:18,代码来源:util_rl.c

示例6: char_read_cb

static void char_read_cb(guint8 status, const guint8 *pdu, guint16 plen,
                         gpointer user_data)
{
    uint8_t value[plen];
    ssize_t vlen;
    int i;
    GString *s;

    if (status != 0) {
        error("Characteristic value/descriptor read failed: %s\n",
              att_ecode2str(status));
        return;
    }

    vlen = dec_read_resp(pdu, plen, value, sizeof(value));
    if (vlen < 0) {
        error("Protocol error\n");
        return;
    }

    s = g_string_new("Characteristic value/descriptor: ");
    for (i = 0; i < vlen; i++)
        g_string_append_printf(s, "%02x ", value[i]);

    rl_printf("%s\n", s->str);
    g_string_free(s, TRUE);
}
开发者ID:RebornProject,项目名称:android_hardware_semc,代码行数:27,代码来源:interactive.c

示例7: PeerFileAccept

/*
 * Checks the file request response.
 */
BOOL PeerFileAccept (Connection *peer, UWORD ackstatus, UDWORD port)
{
    Connection *flist, *fpeer;
    
    flist = PeerFileCreate (peer->serv);
    fpeer = ServerFindChild (flist->serv, peer->cont, TYPE_FILEDIRECT);
    
    if (!flist || !fpeer || !port || (ackstatus == TCP_ACK_REFUSE))
    {
        if (fpeer)
            TCPClose (fpeer);

        return 0;
    }

    ASSERT_MSGDIRECT(peer);
    ASSERT_FILELISTEN(flist);
    ASSERT_FILEDIRECT(fpeer);
    
    fpeer->connect  = 0;
    fpeer->oscar_dc_seq  = 0;
    fpeer->port     = port;
    fpeer->ip       = peer->ip;
    s_repl (&fpeer->server, s_ip (fpeer->ip));
    
    if (prG->verbose)
        rl_printf (i18n (2520, "Opening file transfer connection to %s:%s%ld%s... \n"),
                  s_wordquote (fpeer->server), COLQUOTE, UD2UL (fpeer->port), COLNONE);

    TCPDispatchConn (fpeer);
    
    return 1;
}
开发者ID:tadu,项目名称:climm,代码行数:36,代码来源:oscar_dc_file.c

示例8: connect_cb

static void connect_cb(GIOChannel *io, GError *err, gpointer user_data)
{
	uint16_t mtu;
	uint16_t cid;

	if (err) {
		set_state(STATE_DISCONNECTED);
		error("%s\n", err->message);
		return;
	}

	bt_io_get(io, &err, BT_IO_OPT_IMTU, &mtu,
				BT_IO_OPT_CID, &cid, BT_IO_OPT_INVALID);

	if (err) {
		g_printerr("Can't detect MTU, using default: %s", err->message);
		g_error_free(err);
		mtu = ATT_DEFAULT_LE_MTU;
	}

	if (cid == ATT_CID)
		mtu = ATT_DEFAULT_LE_MTU;

	attrib = g_attrib_new(iochannel, mtu, false);
	g_attrib_register(attrib, ATT_OP_HANDLE_NOTIFY, GATTRIB_ALL_HANDLES,
						events_handler, attrib, NULL);
	g_attrib_register(attrib, ATT_OP_HANDLE_IND, GATTRIB_ALL_HANDLES,
						events_handler, attrib, NULL);
	set_state(STATE_CONNECTED);
	rl_printf("Connection successful\n");
}
开发者ID:ghent360,项目名称:bluez,代码行数:31,代码来源:interactive.c

示例9: cmd_mtu

static void cmd_mtu(int argcp, char **argvp)
{
	if (conn_state != STATE_CONNECTED) {
		failed("Disconnected\n");
		return;
	}

	if (opt_psm) {
		failed("Operation is only available for LE transport.\n");
		return;
	}

	if (argcp < 2) {
		rl_printf("Usage: mtu <value>\n");
		return;
	}

	if (opt_mtu) {
		failed("MTU exchange can only occur once per connection.\n");
		return;
	}

	errno = 0;
	opt_mtu = strtoll(argvp[1], NULL, 0);
	if (errno != 0 || opt_mtu < ATT_DEFAULT_LE_MTU) {
		error("Invalid value. Minimum MTU size is %d\n",
							ATT_DEFAULT_LE_MTU);
		return;
	}

	gatt_exchange_mtu(attrib, opt_mtu, exchange_mtu_cb, NULL);
}
开发者ID:Hibati,项目名称:actuator,代码行数:32,代码来源:interactive.c

示例10: cmd_anki_vehicle_sdk_mode

static void cmd_anki_vehicle_sdk_mode(int argcp, char **argvp)
{
        uint8_t *value;
        size_t plen;
        int handle;

        if (conn_state != STATE_CONNECTED) {
                failed("Disconnected\n");
                return;
        }

        if (argcp < 2) {
                rl_printf("Usage: %s <new value>\n", argvp[0]);
                return;
        }

        handle = vehicle.write_char.value_handle;

        int arg = atoi(argvp[1]);

        anki_vehicle_msg_t msg;
        plen = anki_vehicle_msg_set_sdk_mode(&msg, arg);
        value = (uint8_t *)&msg;

        gatt_write_char(attrib, handle, value, plen,
                                        NULL, NULL);
}
开发者ID:kloepper,项目名称:drive-sdk,代码行数:27,代码来源:vehicle_cmd.c

示例11: assert

/*
 * Create a new file listener unless one already exists.
 */
Connection *PeerFileCreate (Server *serv)
{
    Connection *flist;
    
    assert (serv);
    
    if (!serv->oscar_dc || serv->oscar_dc->version < 6)
        return NULL;
    
    if ((flist = ServerFindChild (serv, NULL, TYPE_FILELISTEN)))
        return flist;
    
    flist = ServerChild (serv, NULL, TYPE_FILELISTEN);
    if (!flist)
        return NULL;

    flist->oscar_dc_seq  = -1;
    flist->version  = serv->oscar_dc->version;
    flist->cont     = serv->oscar_dc->cont;
    flist->port     = ServerPrefVal (serv, CO_OSCAR_DC_PORT);
    flist->dispatch = &TCPDispatchMain;
    
    if (prG->verbose)
        rl_printf (i18n (2519, "Opening file listener connection at %slocalhost%s:%s%ld%s... "),
                  COLQUOTE, COLNONE, COLQUOTE, UD2UL (flist->port), COLNONE);

    UtilIOListenTCP (flist);
    
    return flist;
}
开发者ID:tadu,项目名称:climm,代码行数:33,代码来源:oscar_dc_file.c

示例12: notify_reply

static void notify_reply(DBusMessage *message, void *user_data)
{
	bool enable = GPOINTER_TO_UINT(user_data);
	DBusError error;

	dbus_error_init(&error);

	if (dbus_set_error_from_message(&error, message) == TRUE) {
		rl_printf("Failed to %s notify: %s\n",
				enable ? "start" : "stop", error.name);
		dbus_error_free(&error);
		return;
	}

	rl_printf("Notify %s\n", enable == TRUE ? "started" : "stopped");
}
开发者ID:anupdw,项目名称:android-bluez.bluez,代码行数:16,代码来源:gatt.c

示例13: cmd_anki_vehicle_write

static void cmd_anki_vehicle_write(int argcp, char **argvp)
{
        uint8_t *value;
        size_t plen;
        int handle;

        if (conn_state != STATE_CONNECTED) {
                failed("Disconnected\n");
                return;
        }

        if (argcp < 2) {
                rl_printf("Usage: %s <handle> <new value>\n", argvp[0]);
                return;
        }

        handle = vehicle.write_char.value_handle;

        plen = gatt_attr_data_from_string(argvp[1], &value);
        if (plen == 0) {
                error("Invalid value\n");
                return;
        }

        if (g_strcmp0("send-data-req", argvp[0]) == 0)
                gatt_write_char(attrib, handle, value, plen,
                                        char_write_req_cb, NULL);
        else
                gatt_write_cmd(attrib, handle, value, plen, NULL, NULL);

        g_free(value);
}
开发者ID:kloepper,项目名称:drive-sdk,代码行数:32,代码来源:vehicle_cmd.c

示例14: cmd_connect

static void cmd_connect(int argcp, char **argvp)
{
	GError *gerr = NULL;

	if (conn_state != STATE_DISCONNECTED)
		return;

	if (argcp > 1) {
		g_free(opt_dst);
		opt_dst = g_strdup(argvp[1]);

		g_free(opt_dst_type);
		if (argcp > 2)
			opt_dst_type = g_strdup(argvp[2]);
		else
			opt_dst_type = g_strdup("public");
	}

	if (opt_dst == NULL) {
		error("Remote Bluetooth address required\n");
		return;
	}

	rl_printf("Attempting to connect to %s\n", opt_dst);
	set_state(STATE_CONNECTING);
	iochannel = gatt_connect(opt_src, opt_dst, opt_dst_type, opt_sec_level,
					opt_psm, opt_mtu, connect_cb, &gerr);
	if (iochannel == NULL) {
		set_state(STATE_DISCONNECTED);
		error("%s\n", gerr->message);
		g_error_free(gerr);
	} else
		g_io_add_watch(iochannel, G_IO_HUP, channel_watcher, NULL);
}
开发者ID:Hibati,项目名称:actuator,代码行数:34,代码来源:interactive.c

示例15: char_read_by_uuid_cb

static void char_read_by_uuid_cb(guint8 status, const guint8 *pdu,
					guint16 plen, gpointer user_data)
{
	struct att_data_list *list;
	int i;
	GString *s;

	if (status != 0) {
		error("Read characteristics by UUID failed: %s\n",
							att_ecode2str(status));
		return;
	}

	list = dec_read_by_type_resp(pdu, plen);
	if (list == NULL)
		return;

	s = g_string_new(NULL);
	for (i = 0; i < list->num; i++) {
		uint8_t *value = list->data[i];
		int j;

		g_string_printf(s, "handle: 0x%04x \t value: ",
							get_le16(value));
		value += 2;
		for (j = 0; j < list->len - 2; j++, value++)
			g_string_append_printf(s, "%02x ", *value);

		rl_printf("%s\n", s->str);
	}

	att_data_list_free(list);
	g_string_free(s, TRUE);
}
开发者ID:Hibati,项目名称:actuator,代码行数:34,代码来源:interactive.c


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