Open J-N-K opened 5 years ago
I also would like that for the MQTT binding, CoAP binding and the HTTP binding would benefit as well. I guess every more "generic" binding is benefiting.
I moved from XML to programmatic thing types, channel, configuration etc. for a while. It allows to use the same constants in the definition and its usage and it allows inheritance and reuse of every part. Perhaps you can give it a try what needs to be changed to allow both and we could check if there are some blockers. But I assume there will be a request sooner or later why we don't allow multiple configuration descriptor references that are merged etc.
I moved from XML to programmatic thing types, channel, configuration etc. for a while.
@maggu2810 , could you give me a pointer where I can read how you do the programmatic access? I have bindings (senseBox, already in master, and luftinfo, still in planning) which could benefit from extensible channels as well.
@hakan42 I cannot point you to a location that contains code at the moment as it is done for proprietary bindings. But perhaps I can post some parts of code if I am back to work next week (need to check).
I had a quick look and it is not so easy. The current implementation of getConfigDescriptionObjects
in AbstractDescriptionTypeConverter
checks if there is a config-description-ref
and if so, returns with that URI and an empty set of parameters. If there is no config-description-ref
, the config-description
is parsed, and the thing-type UID is returned as URI with the parsed parameters.
So either two (or more) URIs need to be returned (the provided one(s) and a second one for the attached parameter set) and merged later (i have not found out where the URI is resolved to parameters yet) or we need to merge it there. I have no idea yet, if the URI-content is already available at that time.
At the moment it is only allowed to either use a
config-description-ref
or aconfig-description
. It would be very useful to combine both.Usecase:
The OneWire binding defines a lot of thing-types that all have two parameters which are identical. This is perfect for
config-description-ref
. Some thing-types have additional parameters. With the proposed change one could writeinstead of repeating the parameter defintion that are already part of the referenced config-description.