File:  [ELWIX - Embedded LightWeight unIX -] / mqtt / example / Attic / cmds.c
Revision 1.1.2.2: download - view: text, annotated - select for diffs - revision graph
Mon Nov 21 14:51:23 2011 UTC (12 years, 7 months ago) by misho
Branches: mqtt1_0
remove Retain in publish, not use in this scenario

#include <stdio.h>
#include <sys/types.h>
#include <aitmqtt.h>


int
main()
{
	mqtt_msg_t *m;
	int i;

	m = mqtt_msgAlloc(0);
	/* conn* */
	printf("connect=%d/%d\n", m->msg_len, mqtt_msgCONNECT(m, "MRYN", "aaaaa", NULL, "bbb", NULL, 0, 0, 0));
	for (i = 0; i < m->msg_len; i++)
		printf("%d\n", ((u_char*) m->msg_base)[i]);
	printf("connack=%d/%d\n", m->msg_len, mqtt_msgCONNACK(m, 1));
	for (i = 0; i < m->msg_len; i++)
		printf("%d\n", ((u_char*) m->msg_base)[i]);

	/* pub* */
	printf("publish=%d/%d\n", m->msg_len, mqtt_msgPUBLISH(m, "AAA/bbb/CCC/ddd", 0, 0, 0));
	for (i = 0; i < m->msg_len; i++)
		printf("%d\n", ((u_char*) m->msg_base)[i]);

	mqtt_msgFree(&m, 42);
	return 0;
}

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>