danielwippermann / resol-vbus-java

A Java library for processing RESOL VBus data
7 stars 7 forks source link

[Feature Request] Date offsets #8

Closed ramack closed 6 years ago

ramack commented 6 years ago

Fields of type WeekTime, Time and DateTime use different "magic" offsets and scales from the raw value to the unix system time and the Formatters in Specification consider them during string generation.

I suggest to encapsulate this logic in a new API Date PacketFieldValue.getRawValueDate() which is also of use in applications without leaking the internal know how of the conversion and not forcing the application to parse the string...

If you want and are willing to guide me it's also fine for me to submit a PR for this.

danielwippermann commented 6 years ago

Great idea! If you write a PR I'll be happy to review it. Otherwise just drop me a line so that I can put it on my TODO list.

ramack commented 6 years ago

I am back in normal mode after the vacation with much room for programming, so it will take some time until I can work on this.

danielwippermann commented 6 years ago

I have pushed an implementation proposal to the "feature/convert-to-date" branch. If you are okay to base your impl on that I'll merge it to the master branch.

ramack commented 6 years ago

This is what I have thought of so far - exactly the other way round than how you started. But I am also fine with your approach. May be it is even the best if you just finish it :-) Because the formatters in my case would somehow need to be changed quite a lot, while your approach doesn't need this.

danielwippermann commented 6 years ago

I've rebased the "feature/convert-to-date" branch and completed the impl of getRawValueDate(). Please have a look whether that suits your need.

ramack commented 6 years ago

it took longer than expected, but I tried your convert-to-date branch and think it is good. So I'd suggest to merge it into master!

danielwippermann commented 6 years ago

I merged that branch in fa5580c53df4ebeda0879afd1bca9831251b9b2b. Closing this issue.