-
-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Made verifying the checksum of a message optional #18
base: master
Are you sure you want to change the base?
Conversation
…pec there's no checksum value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for my superlate response. Overall, you change looks good (left one remark inline). However, I'm not quite sure if adding a (runtime) bool parameter to parse
is the best way to configure this. In #22 I just wrote:
This is probably best fixed with an option somewhere, probably in the parser, which means either a runtime argument to the
P1Parser::parse
function, or a template argument to theP1Parser
class (where the latter might make more sense). The argument could either be a DSMR version number (deriving whether a checksum is needed from that, a simple booleanenable_crc
or something, or an object/struct containing anenable_crc
which allows more options later). Any thoughts on that?
next = data_end; | ||
while (next < str + n && *next != '\r' && *next != '\n') { | ||
++next; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed? Is there a CRLF after the !? If I read the v4 spec correctly, there should be no CRLF after the last line (which I think is the checksum line in v4, and the ! line in v3)? Are you seeing a CRLF in your messages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, you could be right, I've checked the v3 spec and there's no CRLF. Need to check if that's somehow added to my recording.
I've added it runtime so I can use one firmware for multiple smart meters and make it configurable over a web interface. |
Matthijs, |
In the DSMR 3.0 spec there's no checksum value to verify a (P1) message, so a simple message could look like this,
`/ISk5\2ME382-1000
1-0:1.8.1(000671.578kWh)
1-0:1.7.0(00.318kW)
!`
I've mainly added an optional parameter to the parse function to not verify the checksum and added some if statements to not actually verify it. As it's optional it should not conflict with current code.