Diff for /mqtt/example/Attic/cmds.c between versions 1.1.2.13 and 1.1.2.15

version 1.1.2.13, 2011/12/05 22:17:39 version 1.1.2.15, 2011/12/06 10:33:37
Line 8  int Line 8  int
 main()  main()
 {  {
         mqtt_msg_t *m;          mqtt_msg_t *m;
        mqtt_subscr_t s[4];        mqtt_subscr_t s[4], *ss;
         mqtthdr_connflgs_t flg;          mqtthdr_connflgs_t flg;
        u_short ka;        u_short ka, msgID;
        int i;        int i, len;
         char cid[BUFSIZ], user[BUFSIZ], pass[BUFSIZ], topic[BUFSIZ], message[BUFSIZ];          char cid[BUFSIZ], user[BUFSIZ], pass[BUFSIZ], topic[BUFSIZ], message[BUFSIZ];
           struct mqtthdr *hdr;
   
         m = mqtt_msgAlloc(0);          m = mqtt_msgAlloc(0);
         /* conn* */          /* conn* */
Line 39  main() Line 40  main()
         printf("publish=%d/%d\n", m->msg_len, mqtt_msgPUBLISH(m, "AAA/bbb/CCC/ddd", 7, 0, 2, 0, "OLE!!!", 7));          printf("publish=%d/%d\n", m->msg_len, mqtt_msgPUBLISH(m, "AAA/bbb/CCC/ddd", 7, 0, 2, 0, "OLE!!!", 7));
         for (i = 0; i < m->msg_len; i++)          for (i = 0; i < m->msg_len; i++)
                 printf("%d\n", ((u_char*) m->msg_base)[i]);                  printf("%d\n", ((u_char*) m->msg_base)[i]);
           len = sizeof message;
           hdr = mqtt_readPUBLISH(m, topic, sizeof topic, &msgID, message, &len);
           if (!hdr) {
                   printf("Error:: mqtt_readPUBLISH() #%d - %s\n", mqtt_GetErrno(), mqtt_GetError());
                   return 2;
           }
           printf("read publish: dup=%d qos=%d retain=%d\n", hdr->mqtt_msg.dup, hdr->mqtt_msg.qos, hdr->mqtt_msg.retain);
           printf("++> topic=%s MessageID=%d DATA=(%d)%s\n", topic, msgID, len, message);
         printf("puback=%d/%d\n", m->msg_len, mqtt_msgPUBACK(m, 10));          printf("puback=%d/%d\n", m->msg_len, mqtt_msgPUBACK(m, 10));
         for (i = 0; i < m->msg_len; i++)          for (i = 0; i < m->msg_len; i++)
                 printf("%d\n", ((u_char*) m->msg_base)[i]);                  printf("%d\n", ((u_char*) m->msg_base)[i]);
Line 55  main() Line 64  main()
         for (i = 0; i < m->msg_len; i++)          for (i = 0; i < m->msg_len; i++)
                 printf("%d\n", ((u_char*) m->msg_base)[i]);                  printf("%d\n", ((u_char*) m->msg_base)[i]);
         printf("read pubcomp=%d\n", mqtt_readPUBCOMP(m));          printf("read pubcomp=%d\n", mqtt_readPUBCOMP(m));
           getchar();
   
         /* sub* */          /* sub* */
         memset(s, 0, sizeof s);          memset(s, 0, sizeof s);
Line 70  main() Line 80  main()
         printf("subscribe=%d/%d\n", m->msg_len, mqtt_msgSUBSCRIBE(m, s, 10, 0, 0));          printf("subscribe=%d/%d\n", m->msg_len, mqtt_msgSUBSCRIBE(m, s, 10, 0, 0));
         for (i = 0; i < m->msg_len; i++)          for (i = 0; i < m->msg_len; i++)
                 printf("%d\n", ((u_char*) m->msg_base)[i]);                  printf("%d\n", ((u_char*) m->msg_base)[i]);
           hdr = mqtt_readSUBSCRIBE(m, &msgID, &ss);
           if (!hdr) {
                   printf("Error:: mqtt_readSUBSCRIBE() #%d - %s\n", mqtt_GetErrno(), mqtt_GetError());
                   return 3;
           }
           printf("read subscribe: dup=%d qos=%d retain=%d\n", hdr->mqtt_msg.dup, hdr->mqtt_msg.qos, hdr->mqtt_msg.retain);
           printf("++> MessageID=%d\n", msgID);
           for (i = 0; ss[i].sub_topic._base; i++)
                   printf(" >>> QoS=%d Topic(%d)=%s\n", ss[i].sub_ret, ss[i].sub_topic._size, ss[i].sub_topic._base);
           mqtt_subFree(&ss);
         printf("suback=%d/%d\n", m->msg_len, mqtt_msgSUBACK(m, s, 10));          printf("suback=%d/%d\n", m->msg_len, mqtt_msgSUBACK(m, s, 10));
         for (i = 0; i < m->msg_len; i++)          for (i = 0; i < m->msg_len; i++)
                 printf("%d\n", ((u_char*) m->msg_base)[i]);                  printf("%d\n", ((u_char*) m->msg_base)[i]);
Line 80  main() Line 100  main()
         for (i = 0; i < m->msg_len; i++)          for (i = 0; i < m->msg_len; i++)
                 printf("%d\n", ((u_char*) m->msg_base)[i]);                  printf("%d\n", ((u_char*) m->msg_base)[i]);
         printf("read unsuback=%d\n", mqtt_readUNSUBACK(m));          printf("read unsuback=%d\n", mqtt_readUNSUBACK(m));
           getchar();
   
         /* ping* */          /* ping* */
         printf("pingreq=%d/%d\n", m->msg_len, mqtt_msgPINGREQ(m));          printf("pingreq=%d/%d\n", m->msg_len, mqtt_msgPINGREQ(m));

Removed from v.1.1.2.13  
changed lines
  Added in v.1.1.2.15


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