Giter VIP home page Giter VIP logo

Comments (8)

stevew817 avatar stevew817 commented on June 15, 2024

Okay, so the SetResourceValueAsync call ends up here: https://github.com/ARMmbed/mbed-cloud-sdk-dotnet/blame/7c3822bed9eb332306a31a86e9b8d11df2163d95/MbedCloudSDK/Backends/Mds/Api/ResourcesApi.cs#L1043

This line is pointless and faulty for the C# .NET version of the mbed cloud SDK. The function has an input type of 'string' for resourceValue, which means it will never be typed as a byte array. Which also means every resource value will be passed through a serializer, and if you pass a string through the serializer, the serializer will enclose it with double quotes. I think the meaning was to 'stringify' any non-string object, but then it needs to be possible to pass in any Object, and not just a String.

Please fix @alexl0gan

from mbed-cloud-sdk-dotnet.

alexl0gan avatar alexl0gan commented on June 15, 2024

@stevew817
The serialisation of the string is an issue with the Swagger Codegen templates and a fix is being looked at. All files in the /Backends folder are autogenerated using generic templates which is why the line you linked appears pointless for this scenario, but will be used in other parts of the SDK.

We are aware that only being able to set a resource value to a string is a limitation and have plans to address it as part of a larger effort to support more LWM2M features.

from mbed-cloud-sdk-dotnet.

stevew817 avatar stevew817 commented on June 15, 2024

Hi @alexl0gan
Thanks for the explanation. My issue is not so much in that you can only set a string through the SDK (stringifying numbers is easy enough), the issue is that the SDK will add double quotes to the passed string, which will show up on the device side. Ergo, what I push in on one side, doesn't come out the same on the other end. Hope for that fix to come soon.

from mbed-cloud-sdk-dotnet.

alexl0gan avatar alexl0gan commented on June 15, 2024

I thought I addressed the double quotes issue in my first comment. I am aware of this and have updated the templates so the fix will come with the next release.

from mbed-cloud-sdk-dotnet.

stevew817 avatar stevew817 commented on June 15, 2024

Thanks! 👍

from mbed-cloud-sdk-dotnet.

stevew817 avatar stevew817 commented on June 15, 2024

@alexl0gan I can't see a fix in the release you just made... Was this the release the fix was supposed to be in?

from mbed-cloud-sdk-dotnet.

alexl0gan avatar alexl0gan commented on June 15, 2024

Is this issue still happening in the new version?

https://github.com/ARMmbed/mbed-cloud-sdk-dotnet/blob/master/MbedCloudSDK/Backends/Mds/Client/ApiClient.cs#L379

This is a bit of a hack but it stops the double quotes.

The way the swagger codegen template is written is not ideal and I would have rather spent time to fix it properly but the team has other priorities at the moment and our next block of work will involve re-writing the templates any way so will keep it in mind for then.

from mbed-cloud-sdk-dotnet.

alexl0gan avatar alexl0gan commented on June 15, 2024

No reply so closing

from mbed-cloud-sdk-dotnet.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.