low-can can read only uppercase letter sensitive in case using states in signals.json
Description
Environment
Activity
Walt Miner July 30, 2019 at 9:38 PM
Close for HH 8.0.0 release
knimitz July 3, 2019 at 7:34 AM
OK, the insensitive/sensitive policy should be consistent. The subscription(event name) is case-insensitive, then it makes sense to make case-insensitive for "state" also.
Romain Forlot July 3, 2019 at 7:23 AM(edited)
Oh, I see your point. Right. To my point of view, users can't know but as it isn't a security critical parameter, like a password or login, then keeping the insensitive comparison is more friendly and common. At best, users would use same case than what it's done in the json. At worst, they may include some upper-case character.
But you're right about the fact that it isn't documented and should be. I'll modify the documentation accordingly, so.
PS: Furthermore, subscriptions are already done case-insensitively. So, it make even more sense to make the write occurs also case-insensitively.
knimitz July 3, 2019 at 6:29 AM
Thanks for your comment. I also think insensitive check is useful and smart. But the users of low-can will only look signals.json to know the interface. Users can't know whether it's insensitive or sensitive, unless looking source code or document. So I think it's better to be sensitive (act as described)
Romain Forlot July 2, 2019 at 3:29 PM
Ok, thanks
I don't mind, yes. It is a minor change but insensitive comparison is fine to me. Why it should not be insensitive in your opinion ?
Hi, when I use "states" in signals.json which generates application_generated.cpp, I encounter the case sensitive problem. When I use lower case letter in states, it is not processed by low-can service.
An example is
"messages": { "0x128": { "name": "ECM_z_5D2", "bus": "hs", "signals": { "StrAnglAct": { "generic_name": "SteeringWheelAngle", "bit_position": 52, "bit_size": 12, "factor": 0.15392, "offset": 0, "decoder": "handleUnsignedSteeringWheelAngle"}, // snip "GrshftPos": { "generic_name": "GearshiftPosition", "bit_position": 41, "bit_size": 3, "states": { "FIRST": [1], "SECOND": [2], "THIRD": [3], "FOURTH": [4], "REVERSE": [5], "NEUTRAL": [6]} },
This works.
I modified "states" to lower case
"messages": { "0x128": { "name": "ECM_z_5D2", "bus": "hs", "signals": { "StrAnglAct": { "generic_name": "SteeringWheelAngle", "bit_position": 52, "bit_size": 12, "factor": 0.15392, "offset": 0, "decoder": "handleUnsignedSteeringWheelAngle"}, // snip "GrshftPos": { "generic_name": "GearshiftPosition", "bit_position": 41, "bit_size": 3, "states": { "first": [1], "second": [2], "third": [3], "fourth": [4], "reverse": [5], "neutral": [6]} },
After compiling, low-can doesn't send event for example "first" but 1 for GearshiftPosition.
I think there is no need to case sensitive for states, because generic_name is not case sensitive.