jbuehl / solaredge

SolarEdge inverter logging data capture
GNU General Public License v3.0
289 stars 60 forks source link

Write the exact bytes to the record file that were read from the input file. #105

Closed jbuehl closed 6 years ago

jbuehl commented 6 years ago

This is intended to address issue #90. Bytes are written to the record file as they are read from the input file before there is any attempt to parse messages which should result in an exact copy of the input data. Sent messages are written to the record file as before. Logging of messages written to the record file is removed.

jbuehl commented 6 years ago

Note: this is completely untested.

ericbuehl commented 6 years ago

thats what CI is for :) (tests are failing)

ericbuehl commented 6 years ago

@oliv3r does provide the functionality you are looking for?

ericbuehl commented 6 years ago

I updated all test samples. They each appear to differ by exactly 4 bytes. Is this expected?

ericbuehl commented 6 years ago

specifically, the new .rec files are all 4 bytes shorter

jbuehl commented 6 years ago

That probably means it is working if the extraneous zero length messages are not there any more. A zero length message would consist of the 4 byte magic number and nothing else.

oliv3r commented 6 years ago

Yeah, the 4 bytes are to be expected, as that's what I ran into and what I also pushed in my simplistic version. I think your version is better as it goes down deeper into where its storing bytes. While there still exists a chance of bytes not being logged/going missing, the chances are far slimmer then they where before.

I think we can loose messages if something happens while reading the single bytes to compose the full message that is 'eventually' stored in inBuf.

Currently i'm running this branch on my system so hopefully i don't loose any messages :) The logger output is much more silent now in its output or at least more pleasant to read.