Beispiel #1
0
 def testSend(self):
     bus = Bus(channel=can_interface, claimed_addresses=[0, 1])
     print "send addr: {0}".format(bus.local_node.address)
     arb = ArbitrationID(priority=5, destination_addresses = [0], source_address=bus.local_node.address)
     msg = SecureMessage(data=[0, 245, 134], arbitration_id=arb)
     bus.send(msg)
     bus.recv()
Beispiel #2
0
 def testSend(self):
     bus = Bus(channel=can_interface, claimed_addresses=[0, 1])
     print "send addr: {0}".format(bus.local_node.address)
     arb = ArbitrationID(priority=5,
                         destination_addresses=[0],
                         source_address=bus.local_node.address)
     msg = SecureMessage(data=[0, 245, 134], arbitration_id=arb)
     bus.send(msg)
     bus.recv()
Beispiel #3
0
"""
Script to run from receiving Beaglebone to receive secure CAN messages.
"""

import can
import time
from can.protocols.secure import Bus

interface = 'vcan0'

bus = Bus(channel=interface, claimed_addresses=[0, 2])
print bus.local_node.address
msg = bus.recv(timeout=2)
sum, count = 0, 0
latest_time = 0.0

while(msg is not None):
    if not msg.accepted:
        print "FAKE MESSAGE DETECTED"
    start_time = time.time()
    msg = bus.recv(timeout=2)
    timer = time.time() - start_time
    sum += timer
    count += 1
    latest_time = timer

sum -= timer
if count is not 0:
    print "average receiving time per msg: ", (sum/count)
Beispiel #4
0
 def testRecv(self):
     bus = Bus(channel=can_interface)
     print "recv addr: {0}".format(bus.local_node.address)
     print bus.recv(timeout=2)
Beispiel #5
0
 def testRecv(self):
     bus = Bus(channel=can_interface)
     print "recv addr: {0}".format(bus.local_node.address)
     print bus.recv(timeout=2)