Add support for RTR Frame

* You can send an RTR-Frame by adding rtr=True the calling of sendMessage
This commit is contained in:
Philipp Rauch 2013-11-15 16:01:45 +01:00
parent 43af99401f
commit ec5cd45b4d

View file

@ -91,7 +91,7 @@ class PcanAdapter (object):
print("PCAN deinitialised")
def sendMessage(self, Message):
def sendMessage(self, Message, rtr = False):
'''
Sends the CanMessage object Message onto the CAN bus.
@ -101,7 +101,10 @@ class PcanAdapter (object):
msg = PCANBasic.TPCANMsg() # create a new PCAN message object
msg.ID = Message.Id # copy the ID
msg.MSGTYPE = PCANBasic.PCAN_MESSAGE_STANDARD # Message type is standard (not extended)
if rtr:
msg.MSGTYPE = PCANBasic.PCAN_MESSAGE_RTR # Message type is Remote-Transfer-Request
else:
msg.MSGTYPE = PCANBasic.PCAN_MESSAGE_STANDARD # Message type is standard (not extended)
msg.LEN = Message.Length # copy the length
msg.DATA[0:Message.Length] = Message.Data # copy the message data into the PCAN message object