Skip to main content
Open topic with navigation CAPL Functions » Ethernet » Function Overview » ethernetPacket::protocol::field::SetData

ethernetPacket::protocol::field::SetData

Valid for: CANoe DE • CANoe4SW DE

Method Syntax

  • word ethernetPacket.<protocol>.<field>.SetData( word offset, char[]data, word length ); // from 1
  • word ethernetPacket.<protocol>.<field>.SetData( word offset, byte[]data, word length ); // form 2
  • word ethernetPacket.<protocol>.<field>.SetData( word offset, struct * data); // from 3
  • word ethernetPacket.<protocol>.<field>.SetData( word offset, sysvarStruct data); // from 4

Description

Sets payload data of a protocol within an Ethernet packet. The length of the protocol field is not changed. If the source data is larger than the protocol field, the data is truncated. If <protocol> or <field> is not available in the packet, no data is set and 0 is returned.

Parameters

  • data: buffer where the data is copied from.
  • length: Number of bytes to copy to the protocol field data.
  • offset: Byte offset in the protocol field data where it starts to copy data.

Return Values

Number of bytes copied to the Ethernet packet.

Example