Mr-Markus / ZigbeeNet

A .NET Standard library for working with ZigBee
Eclipse Public License 1.0
130 stars 46 forks source link

Add Zcl(de)serializer.(de)serialize overloads with DataType #145

Closed oblaise closed 3 years ago

oblaise commented 3 years ago

By adding new overloads for ZclFieldSerializer.Serialize and ZclFieldDeserializer.Deserialize you can simplify the calls to these functions by using directly DataType instead of ZclDataType.Get(DataType type). This will make the code more compact and more readable.

I only changed the non-generated code. This should be included also in the generated code to be efficient. But I don't know how your code generation is working exactly, is it explained somewhere ? From my understanding if the generation is changed it must be run to regenerate all the code this will result in an important number of changed files in the commit. Ideally the generated code should be excluded from Git and regenerated locally when required. But this will require a more complex building process.

Mr-Markus commented 3 years ago

I always like simplifications.

If you would start autocode generator there will be a section in .vscode/launch.json and a publish task under .vscode/tasks.json But there is no documentation at the moment. I would create it, because it should be clear for everone.

Because of simplification it is included in git, so that everybody can start after cloning, just by launch the PlayGround app. I have some other private repos with code generation, too and my experience with it is that the build process will be too complex for new developers.

oblaise commented 3 years ago

After analyzing generator I also added a new ZclAttribute constructor, changed generator and re-generated the classes.

All is included in the PR now.