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, 8 months ago) by misho
Branches: mqtt1_0
remove Retain in publish, not use in this scenario

    1: #include <stdio.h>
    2: #include <sys/types.h>
    3: #include <aitmqtt.h>
    4: 
    5: 
    6: int
    7: main()
    8: {
    9: 	mqtt_msg_t *m;
   10: 	int i;
   11: 
   12: 	m = mqtt_msgAlloc(0);
   13: 	/* conn* */
   14: 	printf("connect=%d/%d\n", m->msg_len, mqtt_msgCONNECT(m, "MRYN", "aaaaa", NULL, "bbb", NULL, 0, 0, 0));
   15: 	for (i = 0; i < m->msg_len; i++)
   16: 		printf("%d\n", ((u_char*) m->msg_base)[i]);
   17: 	printf("connack=%d/%d\n", m->msg_len, mqtt_msgCONNACK(m, 1));
   18: 	for (i = 0; i < m->msg_len; i++)
   19: 		printf("%d\n", ((u_char*) m->msg_base)[i]);
   20: 
   21: 	/* pub* */
   22: 	printf("publish=%d/%d\n", m->msg_len, mqtt_msgPUBLISH(m, "AAA/bbb/CCC/ddd", 0, 0, 0));
   23: 	for (i = 0; i < m->msg_len; i++)
   24: 		printf("%d\n", ((u_char*) m->msg_base)[i]);
   25: 
   26: 	mqtt_msgFree(&m, 42);
   27: 	return 0;
   28: }

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