The CAN Frame method is_remote_frame() returns:
true if the frame is a Remote Transmission Request (RTR bit is set)
false if the frame is a Data Frame (RTR bit is clear)
In other words, it allows to distinguish between:
- a frame which contains actual data, and
- a frame which contains no data, but requests that data be sent back
Calling the latter a "remote frame" is terribly misleading:
- It's no more "remote" than a data frame: both come from another device on the bus
- It does not convey that it contains no data, nor that it wants data to be sent back
- it's not the exclusive opposite to its boolean alternative (the opposite of "remote" is "local" ―not "data", and the opposite of "data" is "no data" ―not "remote"), leading to confusing code like this:
/// Returns true if this frame is a data frame.
fn is_data_frame(&self) -> bool {
!self.is_remote_frame()
}
- Lastly, in device testing mode (we receive the frames we send), it's not even "remote" anymore! Now this unfortunate name has lost any and all connection to whatever meaning it was trying to convey to begin with…
If one wants to shorten "Remote Transmission Request", the only important word in there is: request. Therefore, I'm suggesting that:
is_remote_frame() be renamed into is_request_frame()
new_remote() be renamed into new_request()
This way, it makes it clear that we're in a "transactional" context, where each frame is either a request or a reply/broadcast:
/// Returns true if this frame is a data frame.
fn is_data_frame(&self) -> bool {
!self.is_request_frame()
}
Thank you!
The CAN Frame method
is_remote_frame()returns:trueif the frame is a Remote Transmission Request (RTRbit is set)falseif the frame is a Data Frame (RTRbit is clear)In other words, it allows to distinguish between:
Calling the latter a "remote frame" is terribly misleading:
If one wants to shorten "Remote Transmission Request", the only important word in there is: request. Therefore, I'm suggesting that:
is_remote_frame()be renamed intois_request_frame()new_remote()be renamed intonew_request()This way, it makes it clear that we're in a "transactional" context, where each frame is either a request or a reply/broadcast:
Thank you!