From feabb53c6ce94bcffcb3a41eef0b4ed49937c734 Mon Sep 17 00:00:00 2001 From: Olaf Bergmann Date: Tue, 6 Jul 2010 13:43:02 +0200 Subject: [PATCH] added string representation of encoded value to payload of sent pdu --- examples/tiny.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/examples/tiny.c b/examples/tiny.c index f3ba9e6e..cbe29025 100644 --- a/examples/tiny.c +++ b/examples/tiny.c @@ -20,6 +20,8 @@ coap_pdu_t * make_pdu( unsigned int value ) { coap_pdu_t *pdu; unsigned char enc; + static char buf[20]; + int len; if ( ! ( pdu = coap_new_pdu() ) ) return NULL; @@ -30,6 +32,11 @@ make_pdu( unsigned int value ) { enc = COAP_PSEUDOFP_ENCODE(value); coap_add_data( pdu, 1, &enc); + len = snprintf(buf, 20, "%u", COAP_PSEUDOFP_DECODE(enc)); + if ( len > 0 ) { + coap_add_data( pdu, len, buf ); + } + return pdu; }