View Single Post
Old November 14th, 2018   #1
Junior Member
Join Date: Nov 2018
Location: Oakland, CA, USA
Posts: 19
Default When locked, which comes first, NR_WRITE_PROTECT or message checking?

I have a question about the interpretation of when to send a NR_WRITE_PROTECT NACK response when a device is in a locked state.

When a device is in some lock state, E1.37-1 says that it should return NR_WRITE_PROTECT for those PID's that require locking. Should this be returned before even looking at a message, or should the message first be examined for format or content errors and then the NR_WRITE_PROTECT sent?

There are really three cases for when a message/PID gets denied. Either it has an unknown PID, the command class is not supported, or it has some bad formatting or content errors. The question of when to send the NR_WRITE_PROTECT arises for all three.

If we send the NR_WRITE_PROTECT first, it makes the code easier to write, because there's only one check at the top. If it's sent only after a message is checked (with associated potential NR_UNKNOWN_PID, NR_UNSUPPORTED_COMMAND_CLASS, or NR_FORMAT_ERROR/NR_DATA_OUT_OF_RANGE), then those other errors have priority and are returned first.

shawn is offline   Reply With Quote