codelabsab / rust-ocpp

Libraries for ocpp 1.6 and 2.0.1
https://docs.rs/rust-ocpp/latest/rust_ocpp/
Apache License 2.0
64 stars 15 forks source link

OCPP1.6: size of integer for transaction_id #27

Closed laurst closed 8 months ago

laurst commented 8 months ago

Thank you very much for this library. While using it, I found some poles implementing OCPP 1.6 that expect 32bits integer for transaction_id instead of 64bits as it is specified in the messages here. Reading the OCPP standard, I could not find any place where the size of integers is defined (they just specify integer both in the documentation and in the json validation files).

Do you have more information about what OCPP specifies here?

I'd be happy to provide a PR if you want to switch to i32; on the other hand, 32bit is not a lot of entropy for a distributed system and I'd have preferred to use at least 64 bits, so I understand if you're happy to leave things as they are.

tommymalmqvist commented 8 months ago

Hi @laurst, thank you for your input. You are actually correct, the specification states 32-bit so I'd happily take a PR :)

From the specification:

Integer 32 bit (31 bit resolution, 1 sign bit) No leading 0’s No plus sign Allowed value examples: 1234, -1234 Not Allowed: 01234, +1234

tommymalmqvist commented 8 months ago

Hi @laurst this is nagging me so I'll fix it :) Thanks tho, totally missed this.

laurst commented 8 months ago

That was quick, thanks! I have to ask though, in which document do you see this specified? I've searched in both the 1.6 edition 2 spec, the erratas, the json spec, and I might be dense but I didn't see it.

tommymalmqvist commented 8 months ago

file: OCPP-2.0.1_part2_specification.pdf

2.1.3. Primitive Datatypes

SirVer commented 8 months ago

@tommymalmqvist This seems to be only for 2.0.1, is this also specified for 1.6?

tommymalmqvist commented 8 months ago

@SirVer No, 1.6 has not defined it. Do you need 64-bit for 1.6? Else I think it'll be more safe to use 32-bit if there are many Pole's running on 32-bit.

SirVer commented 8 months ago

I do not need it. I agree 32bit is the right choice here Am 24.10.2023 um 09:39 schrieb Tommy Malmqvist @.***>: @SirVer No, 1.6 has not defined it. Do you need 64-bit for 1.6? Else I think it'll be more safe to use 32-bit if there are many Pole's running on 32-bit.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>