You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/08/13 17:19:36 UTC

[GitHub] adityaxavier opened a new issue #1330: CBOR Decoding of Array of Arrays not working

adityaxavier opened a new issue #1330: CBOR Decoding of Array of Arrays not working
URL: https://github.com/apache/mynewt-core/issues/1330
 
 
   Hi,
   CBOR Decoding for an Array of Int Array for e.g. 
   the following structure :-
    {a:[1,2,3,4], b:[ {c:[1,2,3,4,5]}, {c:[1,2,3,4,5]}]}
   
   Tried decoding using the following structure.
   
   uint64_t a[5];
   Int a_count = 0;
   
   struct c_object{
   	int c[6];
   }c_arr_objs[5];
   int c_obj_count = 0;
   
   struct cbor_attr_t c_attrs[] = {
      {
          .attribute = “c",
          .type = CborAttrObjectType,
          CBORATTR_STRUCT_OBJECT(struct c_object, c),
          .dflt.integer = 0
      },
      {
          .attribute = NULL
      }
   };
   // Tried CborAttrObjectType, CborAttrIntegerType and CborAttrArrayType.
   
   struct cbor_attr_t root_attrs[] = {
      {
          .attribute = “a",
          .type = CborAttrArrayType,
          .addr.array.element_type = CborAttrUnsignedIntegerType,
          .addr.array.arr.uintegers.store = a,
          .addr.array.count = &a_count,
          .addr.array.maxlen = sizeof(a) / sizeof(a[0]),
          .nodefault = true
      },
      {
          .attribute = “b",
          .type = CborAttrArrayType,
          CBORATTR_STRUCT_ARRAY(c_arr_objs, c_attrs, &c_obj_count),
          .nodefault = true
      },
      {
          .attribute = NULL
      }
   };
   
   This method doesn't work. The method is very similar to the example given in the following test case :-
   cborattr/test/src/testcases/cborattr_decode_int_array.c
   
   Please let me know if there is a mistake on my end.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services