Пример #1
0
static void setup_srm(GObex *obex, GObexPacket *pkt, gboolean outgoing)
{
	GObexHeader *hdr;
	guint8 op;
	gboolean final;

	if (!obex->use_srm)
		return;

	op = g_obex_packet_get_operation(pkt, &final);

	hdr = g_obex_packet_get_header(pkt, G_OBEX_HDR_SRM);
	if (hdr != NULL) {
		guint8 srm;
		g_obex_header_get_uint8(hdr, &srm);
		g_obex_debug(G_OBEX_DEBUG_COMMAND, "srm 0x%02x", srm);
		set_srm(obex, op, srm);
	}

	hdr = g_obex_packet_get_header(pkt, G_OBEX_HDR_SRMP);
	if (hdr != NULL) {
		guint8 srmp;
		g_obex_header_get_uint8(hdr, &srmp);
		g_obex_debug(G_OBEX_DEBUG_COMMAND, "srmp 0x%02x", srmp);
		set_srmp(obex, srmp, outgoing);
	} else
		set_srmp(obex, -1, outgoing);

	if (final)
		check_srm_final(obex, op);
}
Пример #2
0
static void test_header_encode_actionid(void)
{
	GObexHeader *header;
	gboolean ret;
	guint8 val;

	header = parse_and_encode(hdr_actionid, sizeof(hdr_actionid));

	ret = g_obex_header_get_uint8(header, &val);

	g_assert(ret == TRUE);
	g_assert_cmpuint(val, ==, 0xab);

	g_obex_header_free(header);
}
Пример #3
0
static void test_decode_pkt_header(void)
{
	GObexPacket *pkt;
	GObexHeader *header;
	GError *err = NULL;
	gboolean ret;
	guint8 val;

	pkt = g_obex_packet_decode(pkt_put_action, sizeof(pkt_put_action),
						0, G_OBEX_DATA_REF, &err);
	g_assert_no_error(err);

	header = g_obex_packet_get_header(pkt, G_OBEX_HDR_ACTION);
	g_assert(header != NULL);

	ret = g_obex_header_get_uint8(header, &val);
	g_assert(ret == TRUE);
	g_assert(val == 0xab);

	g_obex_packet_free(pkt);
}