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 2021/01/26 22:31:58 UTC

[GitHub] [mynewt-mcumgr] mibr0303 opened a new issue #107: cborattr doesn't support of half float type

mibr0303 opened a new issue #107:
URL: https://github.com/apache/mynewt-mcumgr/issues/107


   I have a tool that converts a JSON message into CBOR. When it converts a float into message to send to mcumgr it is handled by cborattr.c file except the message has the cbor type of CborHalfFloatType and that is currently not supported in the cborattr file system.
   There is only the option to define the type in cborattr as CborAttrDoubleType or CborAttrFloatType. So when parsing the CBOR message with half float it will always fail in the following function:
   
   static int valid_attr_type(CborType ct, CborAttrType at)
   {
       switch (at) {
       case CborAttrIntegerType:
       case CborAttrUnsignedIntegerType:
           if (ct == CborIntegerType) {
               return 1;
           }
           break;
       case CborAttrByteStringType:
           if (ct == CborByteStringType) {
               return 1;
           }
           break;
       case CborAttrTextStringType:
           if (ct == CborTextStringType) {
               return 1;
           }
           break;
       case CborAttrBooleanType:
           if (ct == CborBooleanType) {
               return 1;
           }
                  break;
   #if FLOAT_SUPPORT
       case CborAttrFloatType:
           if (ct == CborFloatType) {
               return 1;
           }
           break;
       case CborAttrDoubleType:
           if (ct == CborDoubleType) {
               return 1;
           }
           break;
   #endif
       case CborAttrArrayType:
           if (ct == CborArrayType) {
               return 1;
           }
           break;
       case CborAttrObjectType:
           if (ct == CborMapType) {
               return 1;
           }
           break;
       case CborAttrNullType:
           if (ct == CborNullType) {
               return 1;
           }
           break;
       default:
           break;
       }
       return 0;
   }
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



[GitHub] [mynewt-mcumgr] utzig commented on issue #107: cborattr doesn't support of half float type

Posted by GitBox <gi...@apache.org>.
utzig commented on issue #107:
URL: https://github.com/apache/mynewt-mcumgr/issues/107#issuecomment-780447395


   Fixed by #112, thanks!


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



[GitHub] [mynewt-mcumgr] greg-leach commented on issue #107: cborattr doesn't support of half float type

Posted by GitBox <gi...@apache.org>.
greg-leach commented on issue #107:
URL: https://github.com/apache/mynewt-mcumgr/issues/107#issuecomment-779348457


   https://github.com/apache/mynewt-mcumgr/pull/112 addresses this.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



[GitHub] [mynewt-mcumgr] utzig closed issue #107: cborattr doesn't support of half float type

Posted by GitBox <gi...@apache.org>.
utzig closed issue #107:
URL: https://github.com/apache/mynewt-mcumgr/issues/107


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



[GitHub] [mynewt-mcumgr] greg-leach commented on issue #107: cborattr doesn't support of half float type

Posted by GitBox <gi...@apache.org>.
greg-leach commented on issue #107:
URL: https://github.com/apache/mynewt-mcumgr/issues/107#issuecomment-780445433


   This issue can now be closed, https://github.com/apache/mynewt-mcumgr/pull/112 addresses this.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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