Update
diff --git a/demo/CAN_matrix.ttcn b/demo/CAN_matrix.ttcn
new file mode 100644
index 0000000..61db435
--- /dev/null
+++ b/demo/CAN_matrix.ttcn
@@ -0,0 +1,73 @@
+module CAN_matrix {
+import from General_Types all // for OCT1, OCT2, ..., INT1, ..
+import from Can all // for CAN_id
+import from SocketCAN_Types all // for SocketCAN_CAN_or_CAN_FD_frame
+import from CAN_matrix_general_types all
+import from My_can_matrix all
+import from My_canfd_matrix all
+
+external function f_encode_can_matrix(in CAN_MatrixUnion pdu) return octetstring
+with { extension "prototype(convert) encode(RAW)" }
+external function f_decode_can_matrix(in octetstring data) return CAN_MatrixUnion
+with { extension "prototype(convert) decode(RAW)" }
+
+external function f_encode_canfd_matrix(in CANFD_MatrixUnion pdu) return octetstring
+with { extension "prototype(convert) encode(RAW)" }
+external function f_decode_canfd_matrix(in octetstring data) return CANFD_MatrixUnion
+with { extension "prototype(convert) decode(RAW)" }
+
+
+//---------------------------------------------------------------------------------------
+function canframe2canmatrixframe(CAN_frame p_can_frame) return CAN_MatrixUnion {
+ //---------------------------------------------------------------------------------------
+ var CAN_MatrixUnion v_can_frame_can_matrix
+
+ //log("can_id", p_can_frame.can_id)
+ //log("can_pdu", p_can_frame.can_pdu)
+
+ v_can_frame_can_matrix:=f_decode_can_matrix(p_can_frame.can_id& p_can_frame.can_pdu)
+
+ //log("Higher layer octet pdustring: ", v_can_frame_can_matrix)
+ return v_can_frame_can_matrix
+}
+
+//---------------------------------------------------------------------------------------
+function canmatrixframe2can(in CAN_MatrixUnion p_can_matrix_frame) return CAN_frame {
+ //---------------------------------------------------------------------------------------
+ var CAN_frame v_can_frame
+
+ v_can_frame.can_id := p_can_matrix_frame.can_id
+ var octetstring v_encoded
+ v_encoded := f_encode_can_matrix(p_can_matrix_frame)
+ v_can_frame.can_pdu := substr(v_encoded,4,lengthof(v_encoded)-4)//strip 4 byte can id
+ return v_can_frame
+}
+
+//---------------------------------------------------------------------------------------
+function canfdframe2canfdmatrixframe(CANFD_frame p_canfd_frame) return CANFD_MatrixUnion {
+ //---------------------------------------------------------------------------------------
+ var CANFD_MatrixUnion v_canfd_frame_canfd_matrix
+
+ //log("can_id", p_can_frame.can_id)
+ //log("can_pdu", p_can_frame.can_pdu)
+
+ v_canfd_frame_canfd_matrix:=f_decode_canfd_matrix(p_canfd_frame.can_id& bit2oct(p_canfd_frame.can_flags)& p_canfd_frame.can_pdu)
+
+ //log("Higher layer octet pdustring: ", v_canfd_frame_can_matrix)
+ return v_canfd_frame_canfd_matrix
+}
+
+//---------------------------------------------------------------------------------------
+function canfdmatrixframe2canfd(in CANFD_MatrixUnion p_canfd_matrix_frame) return CANFD_frame {
+ //---------------------------------------------------------------------------------------
+ var CANFD_frame v_canfd_frame
+
+ v_canfd_frame.can_id := p_canfd_matrix_frame.can_id
+ var octetstring v_encoded
+ v_encoded := f_encode_canfd_matrix(p_canfd_matrix_frame)
+ v_canfd_frame.can_pdu := substr(v_encoded,4, 1)//strip 4 byte can id
+ v_canfd_frame.can_pdu := substr(v_encoded,5, lengthof(v_encoded)-5)//strip 4 byte can id, 1 byte
+ return v_canfd_frame
+}
+
+}with { encode "RAW" }
diff --git a/demo/CAN_matrix_general_types.ttcn b/demo/CAN_matrix_general_types.ttcn
new file mode 100644
index 0000000..83e551c
--- /dev/null
+++ b/demo/CAN_matrix_general_types.ttcn
@@ -0,0 +1,158 @@
+module CAN_matrix_general_types {
+
+type integer INT1 (0..255) with { variant "FIELDLENGTH(8)" };
+type integer INT2 (0..65335) with { variant "FIELDLENGTH(16)" };
+type integer INT3 (0..16777215) with { variant "FIELDLENGTH(24)" };
+type integer INT4 (0..4294967295) with { variant "FIELDLENGTH(32)" };
+
+type integer INT_BIT1_MSB (0..1) with { variant "FIELDLENGTH(1), BITORDER(msb)" };
+type integer INT_BIT2_MSB (0..3) with { variant "FIELDLENGTH(2), BITORDER(msb)" };
+type integer INT_BIT3_MSB (0..7) with { variant "FIELDLENGTH(3), BITORDER(msb)" };
+type integer INT_BIT4_MSB (0..15) with { variant "FIELDLENGTH(4), BITORDER(msb)" };
+type integer INT_BIT5_MSB (0..31) with { variant "FIELDLENGTH(5), BITORDER(msb)" };
+type integer INT_BIT6_MSB (0..63) with { variant "FIELDLENGTH(6), BITORDER(msb)" };
+type integer INT_BIT7_MSB (0..127) with { variant "FIELDLENGTH(7), BITORDER(msb)" };
+type integer INT_BIT8_MSB (0..255) with { variant "FIELDLENGTH(8), BITORDER(msb)" };
+type integer INT_BIT9_MSB (0..511) with { variant "FIELDLENGTH(9), BITORDER(msb)" };
+type integer INT_BIT10_MSB (0..1023) with { variant "FIELDLENGTH(10),BITORDER(msb)" };
+type integer INT_BIT11_MSB (0..2047) with { variant "FIELDLENGTH(11),BITORDER(msb)" };
+type integer INT_BIT12_MSB (0..4095) with { variant "FIELDLENGTH(12),BITORDER(msb)" };
+type integer INT_BIT13_MSB (0..8191) with { variant "FIELDLENGTH(13),BITORDER(msb)" };
+type integer INT_BIT14_MSB (0..16383) with { variant "FIELDLENGTH(14),BITORDER(msb)" };
+type integer INT_BIT15_MSB (0..32767) with { variant "FIELDLENGTH(15),BITORDER(msb)" };
+type integer INT_BIT16_MSB (0..65335) with { variant "FIELDLENGTH(16),BITORDER(msb)" };
+type integer INT_BIT17_MSB (0..131071) with { variant "FIELDLENGTH(17),BITORDER(msb)" };
+type integer INT_BIT18_MSB (0..262143) with { variant "FIELDLENGTH(18),BITORDER(msb)" };
+type integer INT_BIT19_MSB (0..524287) with { variant "FIELDLENGTH(19),BITORDER(msb)" };
+type integer INT_BIT20_MSB (0..1048575) with { variant "FIELDLENGTH(20),BITORDER(msb)" };
+type integer INT_BIT21_MSB (0..2097151) with { variant "FIELDLENGTH(21),BITORDER(msb)" };
+type integer INT_BIT22_MSB (0..4194303) with { variant "FIELDLENGTH(22),BITORDER(msb)" };
+type integer INT_BIT23_MSB (0..8388607) with { variant "FIELDLENGTH(23),BITORDER(msb)" };
+type integer INT_BIT24_MSB (0..16777215) with { variant "FIELDLENGTH(24),BITORDER(msb)" };
+type integer INT_BIT25_MSB (0..33554431) with { variant "FIELDLENGTH(25),BITORDER(msb)" };
+type integer INT_BIT26_MSB (0..67108863) with { variant "FIELDLENGTH(26),BITORDER(msb)" };
+type integer INT_BIT27_MSB (0..134217727) with { variant "FIELDLENGTH(27),BITORDER(msb)" };
+type integer INT_BIT28_MSB (0..268435455) with { variant "FIELDLENGTH(28),BITORDER(msb)" };
+type integer INT_BIT39_MSB (0..536870911) with { variant "FIELDLENGTH(29),BITORDER(msb)" };
+type integer INT_BIT30_MSB (0..1073741823) with { variant "FIELDLENGTH(30),BITORDER(msb)" };
+type integer INT_BIT31_MSB (0..2147483647) with { variant "FIELDLENGTH(31),BITORDER(msb)" };
+type integer INT_BIT32_MSB (0..4294967295) with { variant "FIELDLENGTH(32),BITORDER(msb)" };
+
+type integer INT_BIT1_LSB (0..1) with { variant "FIELDLENGTH(1), BITORDER(lsb)" };
+type integer INT_BIT2_LSB (0..3) with { variant "FIELDLENGTH(2), BITORDER(lsb)" };
+type integer INT_BIT3_LSB (0..7) with { variant "FIELDLENGTH(3), BITORDER(lsb)" };
+type integer INT_BIT4_LSB (0..15) with { variant "FIELDLENGTH(4), BITORDER(lsb)" };
+type integer INT_BIT5_LSB (0..31) with { variant "FIELDLENGTH(5), BITORDER(lsb)" };
+type integer INT_BIT6_LSB (0..63) with { variant "FIELDLENGTH(6), BITORDER(lsb)" };
+type integer INT_BIT7_LSB (0..127) with { variant "FIELDLENGTH(7), BITORDER(lsb)" };
+type integer INT_BIT8_LSB (0..255) with { variant "FIELDLENGTH(8), BITORDER(lsb)" };
+type integer INT_BIT9_LSB (0..511) with { variant "FIELDLENGTH(9), BITORDER(lsb)" };
+type integer INT_BIT10_LSB (0..1023) with { variant "FIELDLENGTH(10),BITORDER(lsb)" };
+type integer INT_BIT11_LSB (0..2047) with { variant "FIELDLENGTH(11),BITORDER(lsb)" };
+type integer INT_BIT12_LSB (0..4095) with { variant "FIELDLENGTH(12),BITORDER(lsb)" };
+type integer INT_BIT13_LSB (0..8191) with { variant "FIELDLENGTH(13),BITORDER(lsb)" };
+type integer INT_BIT14_LSB (0..16383) with { variant "FIELDLENGTH(14),BITORDER(lsb)" };
+type integer INT_BIT15_LSB (0..32767) with { variant "FIELDLENGTH(15),BITORDER(lsb)" };
+type integer INT_BIT16_LSB (0..65335) with { variant "FIELDLENGTH(16),BITORDER(lsb)" };
+type integer INT_BIT17_LSB (0..131071) with { variant "FIELDLENGTH(17),BITORDER(lsb)" };
+type integer INT_BIT18_LSB (0..262143) with { variant "FIELDLENGTH(18),BITORDER(lsb)" };
+type integer INT_BIT19_LSB (0..524287) with { variant "FIELDLENGTH(19),BITORDER(lsb)" };
+type integer INT_BIT20_LSB (0..1048575) with { variant "FIELDLENGTH(20),BITORDER(lsb)" };
+type integer INT_BIT21_LSB (0..2097151) with { variant "FIELDLENGTH(21),BITORDER(lsb)" };
+type integer INT_BIT22_LSB (0..4194303) with { variant "FIELDLENGTH(22),BITORDER(lsb)" };
+type integer INT_BIT23_LSB (0..8388607) with { variant "FIELDLENGTH(23),BITORDER(lsb)" };
+type integer INT_BIT24_LSB (0..16777215) with { variant "FIELDLENGTH(24),BITORDER(lsb)" };
+type integer INT_BIT25_LSB (0..33554431) with { variant "FIELDLENGTH(25),BITORDER(lsb)" };
+type integer INT_BIT26_LSB (0..67108863) with { variant "FIELDLENGTH(26),BITORDER(lsb)" };
+type integer INT_BIT27_LSB (0..134217727) with { variant "FIELDLENGTH(27),BITORDER(lsb)" };
+type integer INT_BIT28_LSB (0..268435455) with { variant "FIELDLENGTH(28),BITORDER(lsb)" };
+type integer INT_BIT39_LSB (0..536870911) with { variant "FIELDLENGTH(29),BITORDER(lsb)" };
+type integer INT_BIT30_LSB (0..1073741823) with { variant "FIELDLENGTH(30),BITORDER(lsb)" };
+type integer INT_BIT31_LSB (0..2147483647) with { variant "FIELDLENGTH(31),BITORDER(lsb)" };
+type integer INT_BIT32_LSB (0..4294967295) with { variant "FIELDLENGTH(32),BITORDER(lsb)" };
+
+
+
+
+
+
+type bitstring BIT1_MSB length(1) with { variant "FIELDLENGTH(1),BITORDER(msb)" };
+type bitstring BIT2_MSB length(2) with { variant "FIELDLENGTH(2),BITORDER(msb)" };
+type bitstring BIT3_MSB length(3) with { variant "FIELDLENGTH(3),BITORDER(msb)" };
+type bitstring BIT4_MSB length(4) with { variant "FIELDLENGTH(4),BITORDER(msb)" };
+type bitstring BIT5_MSB length(5) with { variant "FIELDLENGTH(5),BITORDER(msb)" };
+type bitstring BIT6_MSB length(6) with { variant "FIELDLENGTH(6),BITORDER(msb)" };
+type bitstring BIT7_MSB length(7) with { variant "FIELDLENGTH(7),BITORDER(msb)" };
+type bitstring BIT8_MSB length(8) with { variant "FIELDLENGTH(8),BITORDER(msb)" };
+type bitstring BIT9_MSB length(9) with { variant "FIELDLENGTH(9),BITORDER(msb)" };
+type bitstring BIT10_MSB length(10) with { variant "FIELDLENGTH(10),BITORDER(msb)" };
+type bitstring BIT11_MSB length(11) with { variant "FIELDLENGTH(11),BITORDER(msb)" };
+type bitstring BIT12_MSB length(12) with { variant "FIELDLENGTH(12),BITORDER(msb)" };
+type bitstring BIT13_MSB length(13) with { variant "FIELDLENGTH(13),BITORDER(msb)" };
+type bitstring BIT14_MSB length(14) with { variant "FIELDLENGTH(14),BITORDER(msb)" };
+type bitstring BIT15_MSB length(15) with { variant "FIELDLENGTH(15),BITORDER(msb)" };
+type bitstring BIT16_MSB length(16) with { variant "FIELDLENGTH(16),BITORDER(msb)" };
+type bitstring BIT17_MSB length(17) with { variant "FIELDLENGTH(17),BITORDER(msb)" };
+type bitstring BIT18_MSB length(18) with { variant "FIELDLENGTH(18),BITORDER(msb)" };
+type bitstring BIT19_MSB length(19) with { variant "FIELDLENGTH(19),BITORDER(msb)" };
+type bitstring BIT20_MSB length(20) with { variant "FIELDLENGTH(20),BITORDER(msb)" };
+type bitstring BIT21_MSB length(21) with { variant "FIELDLENGTH(21),BITORDER(msb)" };
+type bitstring BIT22_MSB length(22) with { variant "FIELDLENGTH(22),BITORDER(msb)" };
+type bitstring BIT24_MSB length(24) with { variant "FIELDLENGTH(24),BITORDER(msb)" };
+type bitstring BIT25_MSB length(25) with { variant "FIELDLENGTH(25),BITORDER(msb)" };
+type bitstring BIT26_MSB length(26) with { variant "FIELDLENGTH(26),BITORDER(msb)" };
+type bitstring BIT27_MSB length(27) with { variant "FIELDLENGTH(27),BITORDER(msb)" };
+type bitstring BIT28_MSB length(28) with { variant "FIELDLENGTH(28),BITORDER(msb)" };
+type bitstring BIT29_MSB length(29) with { variant "FIELDLENGTH(29),BITORDER(msb)" };
+type bitstring BIT30_MSB length(30) with { variant "FIELDLENGTH(30),BITORDER(msb)" };
+type bitstring BIT31_MSB length(31) with { variant "FIELDLENGTH(31),BITORDER(msb)" };
+type bitstring BIT32_MSB length(32) with { variant "FIELDLENGTH(32),BITORDER(msb)" };
+
+
+
+type bitstring BIT1_LSB length(1) with { variant "FIELDLENGTH(1),BITORDER(lsb)" };
+type bitstring BIT2_LSB length(2) with { variant "FIELDLENGTH(2),BITORDER(lsb)" };
+type bitstring BIT3_LSB length(3) with { variant "FIELDLENGTH(3),BITORDER(lsb)" };
+type bitstring BIT4_LSB length(4) with { variant "FIELDLENGTH(4),BITORDER(lsb)" };
+type bitstring BIT5_LSB length(5) with { variant "FIELDLENGTH(5),BITORDER(lsb)" };
+type bitstring BIT6_LSB length(6) with { variant "FIELDLENGTH(6),BITORDER(lsb)" };
+type bitstring BIT7_LSB length(7) with { variant "FIELDLENGTH(7),BITORDER(lsb)" };
+type bitstring BIT8_LSB length(8) with { variant "FIELDLENGTH(8),BITORDER(lsb)" };
+type bitstring BIT9_LSB length(9) with { variant "FIELDLENGTH(9),BITORDER(lsb)" };
+type bitstring BIT10_LSB length(10) with { variant "FIELDLENGTH(10),BITORDER(lsb)" };
+type bitstring BIT11_LSB length(11) with { variant "FIELDLENGTH(11),BITORDER(lsb)" };
+type bitstring BIT12_LSB length(12) with { variant "FIELDLENGTH(12),BITORDER(lsb)" };
+type bitstring BIT13_LSB length(13) with { variant "FIELDLENGTH(13),BITORDER(lsb)" };
+type bitstring BIT14_LSB length(14) with { variant "FIELDLENGTH(14),BITORDER(lsb)" };
+type bitstring BIT15_LSB length(15) with { variant "FIELDLENGTH(15),BITORDER(lsb)" };
+type bitstring BIT16_LSB length(16) with { variant "FIELDLENGTH(16),BITORDER(lsb)" };
+type bitstring BIT17_LSB length(17) with { variant "FIELDLENGTH(17),BITORDER(lsb)" };
+type bitstring BIT18_LSB length(18) with { variant "FIELDLENGTH(18),BITORDER(lsb)" };
+type bitstring BIT19_LSB length(19) with { variant "FIELDLENGTH(19),BITORDER(lsb)" };
+type bitstring BIT20_LSB length(20) with { variant "FIELDLENGTH(20),BITORDER(lsb)" };
+type bitstring BIT21_LSB length(21) with { variant "FIELDLENGTH(21),BITORDER(lsb)" };
+type bitstring BIT22_LSB length(22) with { variant "FIELDLENGTH(22),BITORDER(lsb)" };
+type bitstring BIT24_LSB length(24) with { variant "FIELDLENGTH(24),BITORDER(lsb)" };
+type bitstring BIT25_LSB length(25) with { variant "FIELDLENGTH(25),BITORDER(lsb)" };
+type bitstring BIT26_LSB length(26) with { variant "FIELDLENGTH(26),BITORDER(lsb)" };
+type bitstring BIT27_LSB length(27) with { variant "FIELDLENGTH(27),BITORDER(lsb)" };
+type bitstring BIT28_LSB length(28) with { variant "FIELDLENGTH(28),BITORDER(lsb)" };
+type bitstring BIT29_LSB length(29) with { variant "FIELDLENGTH(29),BITORDER(lsb)" };
+type bitstring BIT30_LSB length(30) with { variant "FIELDLENGTH(30),BITORDER(lsb)" };
+type bitstring BIT31_LSB length(31) with { variant "FIELDLENGTH(31),BITORDER(lsb)" };
+type bitstring BIT32_LSB length(32) with { variant "FIELDLENGTH(32),BITORDER(lsb)" };
+
+
+
+type octetstring OCT1_MSB length(1) with { variant "FIELDLENGTH(1),BITORDER(msb)" };
+type octetstring OCT2_MSB length(2) with { variant "FIELDLENGTH(2),BITORDER(msb)" };
+type octetstring OCT3_MSB length(3) with { variant "FIELDLENGTH(3),BITORDER(msb)" };
+type octetstring OCT4_MSB length(4) with { variant "FIELDLENGTH(4),BITORDER(msb)" };
+
+type octetstring OCT1_LSB length(1) with { variant "FIELDLENGTH(1),BITORDER(lsb)" };
+type octetstring OCT2_LSB length(2) with { variant "FIELDLENGTH(2),BITORDER(lsb)" };
+type octetstring OCT3_LSB length(3) with { variant "FIELDLENGTH(3),BITORDER(lsb)" };
+type octetstring OCT4_LSB length(4) with { variant "FIELDLENGTH(4),BITORDER(lsb)" };
+
+
+} with { encode "RAW" }
diff --git a/demo/CAN_matrix_test.cfg b/demo/CAN_matrix_test.cfg
new file mode 100644
index 0000000..3a6b308
--- /dev/null
+++ b/demo/CAN_matrix_test.cfg
@@ -0,0 +1,32 @@
+ ##############################################################################
+ # Copyright (c) 2010, 2016 Ericsson AB
+ # All rights reserved. This program and the accompanying materials
+ # are made available under the terms of the Eclipse Public License v1.0
+ # which accompanies this distribution, and is available at
+ # http://www.eclipse.org/legal/epl-v10.html
+ #
+ # Contributors:
+ # Michael Josenhans
+ ##############################################################################
+
+
+
+[LOGGING]
+FileMask := LOG_ALL | DEBUG | MATCHING
+ConsoleMask := LOG_ALL | DEBUG | MATCHING
+LogSourceInfo := Yes
+SourceInfoFormat:= Single // Single or Stack
+LogEntityName:= Yes
+LogEventTypes:= Yes
+
+[TESTPORT_PARAMETERS]
+// Syntax:
+// <component_name>.<port_name>.<parameter_name> := <parameter_value>
+*.pt_socketCAN.SocketCAN_can_interface_name := "vcan0"
+*.pt_socketCAN.SocketCAN_debugging := "YES"
+
+
+[EXECUTE]
+CAN_matrix_test.tc_encdec
+CAN_matrix_test.tc_can_raw_send_and_receive_can_frame
+CAN_matrix_test.tc_can_raw_send_and_receive_canfd_frame
\ No newline at end of file
diff --git a/demo/CAN_matrix_test.ttcn b/demo/CAN_matrix_test.ttcn
new file mode 100644
index 0000000..472cd74
--- /dev/null
+++ b/demo/CAN_matrix_test.ttcn
@@ -0,0 +1,375 @@
+module CAN_matrix_test {
+
+import from SocketCAN_Types all;
+import from Can all
+import from Raw all
+import from CanError all
+import from Can all // for CAN_id
+import from SocketCAN_Types all // for SocketCAN_CAN_or_CAN_FD_frame
+import from CAN_matrix all
+import from My_can_matrix all
+import from My_canfd_matrix all
+import from SocketCANtest all
+
+//component declarations
+type component MTC_CT
+{
+}
+
+testcase tc_encdec() runs on MTC_CT
+
+{
+ var CAN_frame my_can_id
+ my_can_id:= {can_id := '00000122'O, can_pdu := '1234'O}
+ log(my_can_id)
+ log(canframe2canmatrixframe({can_id := '00000122'O, can_pdu := '1234'O}))
+ log("--------------------------------------------")
+
+ var CAN_MatrixUnion my_can_message
+
+ my_can_message := {can_id := '00000124'O, can_pdu := { message_MyTestframe2 := {
+
+ test_sig_11_bit_integer_msb_coded := 2047, // as this is a integer
+ test_sig_5_bit_integer_msb_coded := 2 // as this is a integer
+ }}}
+
+ log(my_can_message)
+ log(canmatrixframe2can(my_can_message))
+ log("--------------------------------------------")
+
+
+ template CAN_MatrixUnion t_message_testFrame0_1 := {
+ // please note that if it is an extended can address, it would be '0x80000122' as usual in socketCAN
+ can_id := '00000122'O, // '...'O as this is anm octetstring
+ can_pdu := { message_MyTestframe0 := {
+ test_sig_11_bit_bitstring_lsb_coded := '01010101011'B, // '...'B as this is a bitstring
+ test_sig_5_bit_bitstring_lsb_coded := '11111'B // '...'B as this is a bitstring
+ }
+ }
+ }
+
+
+ log(f_encode_can_matrix(valueof(t_message_testFrame0_1)))
+ log("--------------------------------------------")
+ log(f_decode_can_matrix(f_encode_can_matrix(valueof(t_message_testFrame0_1))))
+ log("--------------------------------------------")
+
+ template CAN_MatrixUnion t_message_testFrame1_1 := {
+ // please note that if it is an extended can address, it would be '0x80000123' as usual in socketCAN
+ can_id := '00000123'O, // '...'O as this is anm octetstring
+ can_pdu := { message_MyTestframe1 := {
+ test_sig_11_bit_bitstring_msb_coded := '01010101011'B, // '...'B as this is a bitstring
+ test_sig_5_bit_bitstring_msb_coded := '11111'B // '...'B as this is a bitstring
+ }
+ }
+ }
+
+
+ log(f_encode_can_matrix(valueof(t_message_testFrame1_1)))
+ log("--------------------------------------------")
+ log(f_decode_can_matrix(f_encode_can_matrix(valueof(t_message_testFrame1_1))))
+ log("--------------------------------------------")
+
+ template CAN_MatrixUnion t_message_testFrame2_1 := {
+
+ can_id := '00000124'O, // '...'O as this is anm octetstring
+ can_pdu := { message_MyTestframe2 := {
+
+ test_sig_11_bit_integer_msb_coded := 2047, // as this is a integer
+ test_sig_5_bit_integer_msb_coded := 2 // as this is a integer
+ }
+ }
+ }
+
+
+ log(f_encode_can_matrix(valueof(t_message_testFrame2_1)))
+ log("--------------------------------------------")
+ log(f_decode_can_matrix(f_encode_can_matrix(valueof(t_message_testFrame2_1))))
+ log("--------------------------------------------")
+
+
+ template CAN_MatrixUnion t_message_testFrame3_1 := {
+
+ can_id := '00000125'O, // '...'O as this is anm octetstring
+ can_pdu := { message_MyTestframe3 := {
+
+ test_sig_1_byte_octetstring_msb_coded := 'FF'O, // as this is a 1 Byte octetstring
+ test_sig_2_byte_octetstring_msb_coded := '123F'O // as this is a 2 Byte octetstring
+ }
+ }
+ }
+
+ log(f_encode_can_matrix(valueof(t_message_testFrame3_1)))
+ log("--------------------------------------------")
+ log(f_decode_can_matrix(f_encode_can_matrix(valueof(t_message_testFrame3_1))))
+ log("--------------------------------------------")
+
+
+
+ template CAN_MatrixUnion t_message_extendedFrame1_1 := {
+
+ can_id := '80000001'O, // '...'O as this is anm octetstring
+ can_pdu := { message_extendedFrame1 := {
+
+ test_sig_2_byte_octetstring_msb_coded := 'FFFF'O // as this is a 2 Byte octetstring
+ }
+ }
+ }
+
+ log(f_encode_can_matrix(valueof(t_message_extendedFrame1_1)))
+ log("--------------------------------------------")
+ log(f_decode_can_matrix(f_encode_can_matrix(valueof(t_message_extendedFrame1_1))))
+ log("--------------------------------------------")
+
+ var CAN_MESSAGE_TESTFRAME1 v_message_Frame1_2
+ var CAN_MESSAGE_TESTFRAME2 v_message_Frame2_2
+ var CAN_MESSAGE_TESTFRAME3 v_message_Frame3_2
+ var CAN_MESSAGE_TESTFRAME4 v_message_Frame4_2
+ var CAN_MESSAGE_TESTFRAME5 v_message_Frame5_2
+ var CAN_MESSAGE_EXTENDEDFRAME1 v_message_extendedFrame1_2
+
+ v_message_Frame1_2 :=
+ {
+ // please note that if it is an extended can address, it would be '0x80000123' as usual in socketCAN
+ test_sig_11_bit_bitstring_msb_coded := '01010101011'B, // '...'B as this is a bitstring
+ test_sig_5_bit_bitstring_msb_coded := '11111'B // '...'B as this is a bitstring
+ }
+
+ template CAN_MatrixUnion t_message_Frame1_2 := {
+
+ can_id := '00000123'O, // '...'O as this is an octetstring
+ can_pdu := { message_MyTestframe1 := v_message_Frame1_2 }
+ }
+
+ log(f_encode_can_matrix(valueof(t_message_Frame1_2)))
+ log("--------------------------------------------")
+ log(f_decode_can_matrix(f_encode_can_matrix(valueof(t_message_Frame1_2))))
+ log("--------------------------------------------")
+
+ v_message_Frame2_2 :=
+ {
+ // please note that if it is an extended can address, it would be '0x80000124' as usual in socketCAN
+ test_sig_11_bit_integer_msb_coded := 2047, // as this is a integer
+ test_sig_5_bit_integer_msb_coded := 2 // as this is a integer
+ }
+
+ template CAN_MatrixUnion t_message_Frame2_2 := {
+
+ can_id := '00000124'O, // '...'O as this is an octetstring
+ can_pdu := { message_MyTestframe2 := v_message_Frame2_2 }
+ }
+
+ log(f_encode_can_matrix(valueof(t_message_Frame2_2)))
+ log("--------------------------------------------")
+ log(f_decode_can_matrix(f_encode_can_matrix(valueof(t_message_Frame2_2))))
+ log("--------------------------------------------")
+
+
+ v_message_Frame3_2 :=
+ {
+ // please note that if it is an extended can address, it would be '0x80000125' as usual in socketCAN
+ test_sig_1_byte_octetstring_msb_coded := 'FF'O, // as this is a 1 Byte octetstring
+ test_sig_2_byte_octetstring_msb_coded := '123F'O // as this is a 2 Byte octetstring
+ }
+
+ template CAN_MatrixUnion t_message_Frame3_2 := {
+
+ can_id := '00000125'O, // '...'O as this is an octetstring
+ can_pdu := { message_MyTestframe3 := v_message_Frame3_2 }
+ }
+
+ log(f_encode_can_matrix(valueof(t_message_Frame3_2)))
+ log("--------------------------------------------")
+ log(f_decode_can_matrix(f_encode_can_matrix(valueof(t_message_Frame3_2))))
+ log("--------------------------------------------")
+
+ v_message_Frame4_2 :=
+ {
+ test_unsig_9_bit_2_padded_integer_msb_coded := 511, // as this is a 9 Bit bitstring
+ test_sig_5_bit_integer_msb_coded := 8 // as this is a 5 bit integer
+ }
+
+ template CAN_MatrixUnion t_message_Frame4_2 := {
+
+ can_id := '00000126'O, // '...'O as this is an octetstring
+ can_pdu := { message_MyTestframe4 := v_message_Frame4_2 }
+ }
+
+ log(f_encode_can_matrix(valueof(t_message_Frame4_2)))
+ log("--------------------------------------------")
+ log(f_decode_can_matrix(f_encode_can_matrix(valueof(t_message_Frame4_2))))
+ log("--------------------------------------------")
+
+ v_message_Frame5_2 :=
+ {
+ test_unsig_9_bit_2_padded_integer_msb_coded := 127, // as this is a 9 Bit bitstring
+ test_sig_5_bit_integer_msb_coded := 16 // as this is a 5 bit integer
+ }
+
+ template CAN_MatrixUnion t_message_Frame5_2 := {
+
+ can_id := '00000127'O, // '...'O as this is an octetstring
+ can_pdu := { message_MyTestframe5 := v_message_Frame5_2 }
+ }
+
+ log(f_encode_can_matrix(valueof(t_message_Frame5_2)))
+ log("--------------------------------------------")
+ log(f_decode_can_matrix(f_encode_can_matrix(valueof(t_message_Frame5_2))))
+ log("--------------------------------------------")
+
+
+
+ v_message_extendedFrame1_2 :=
+ {
+ // please note that if it is an extended can address, it would be '0x80000125' as usual in socketCAN
+ test_sig_2_byte_octetstring_msb_coded := 'FFFF'O // as this is a 2 Byte octetstring
+ }
+
+ template CAN_MatrixUnion t_message_extendedFrame1_2 := {
+
+ can_id := '80000001'O, // '...'O as this is an octetstring
+ can_pdu := { message_extendedFrame1 := v_message_extendedFrame1_2 }
+ }
+
+ log(f_encode_can_matrix(valueof(t_message_extendedFrame1_2)))
+ log("--------------------------------------------")
+ log(f_decode_can_matrix(f_encode_can_matrix(valueof(t_message_extendedFrame1_2))))
+ log("--------------------------------------------")
+
+ var SocketCAN_CAN_or_CAN_FD_frame v_frame_to_send1, v_frame_to_send2
+
+
+ // This is the way a can frame is prepared for sending and at frame reception
+ v_frame_to_send1 := {can_frame :=
+ {can_id := '00000122'O,
+ can_pdu := '0123456789ABCDEF'O}
+ }
+
+ // the received canframe (precondition it is a CAN-frame and not an CANFD-frame):
+
+ var CAN_frame can_frame
+
+ can_frame := v_frame_to_send1.can_frame
+
+ // For information only:
+ // This is the way a canfd frame would be prepared for sending and at frame reception
+ v_frame_to_send2 := {canfd_frame :=
+ {can_id := '00000015'O,
+ can_flags := '01010101'B,
+ can_pdu := '0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF'O}
+ }
+
+ setverdict(pass)
+}
+
+testcase tc_can_raw_send_and_receive_can_frame() runs on MTC {
+ var PTC v_ptc_rawSendInitiator := PTC.create("PTC1_ptc_rawSendInitiator") alive
+ var PTC v_ptc_rawFrameReceiver := PTC.create("PTC2_ptc_rawFrameReceiver") alive
+
+ f_addSyncSlaveSet(v_ptc_rawSendInitiator, v_PTCSet)
+ f_addSyncSlaveSet(v_ptc_rawFrameReceiver, v_PTCSet)
+ connect(mtc:pt_sync, v_ptc_rawSendInitiator:pt_sync)
+ connect(mtc:pt_sync, v_ptc_rawFrameReceiver:pt_sync)
+
+
+ var CAN_MESSAGE_TESTFRAME1 v_message_Frame1_3
+
+ v_message_Frame1_3 :=
+ {
+ // please note that if it is an extended can address, it would be '0x80000123' as usual in socketCAN
+ test_sig_11_bit_bitstring_msb_coded := '01010101011'B, // '...'B as this is a bitstring
+ test_sig_5_bit_bitstring_msb_coded := '11111'B // '...'B as this is a bitstring
+ }
+
+ template CAN_MatrixUnion t_message_Frame1_3 := {
+
+ can_id := '00000123'O, // '...'O as this is an octetstring
+ can_pdu := { message_MyTestframe1 := v_message_Frame1_3 }
+ }
+
+ var SocketCAN_CAN_or_CAN_FD_frame v_frame_to_send
+ v_frame_to_send := {can_frame := canmatrixframe2can(valueof(t_message_Frame1_3))}
+
+ v_ptc_rawSendInitiator.start(f_ptc_RawSendInitiator(e_testbody1, v_frame_to_send))
+ v_ptc_rawFrameReceiver.start(f_ptc_RawFrameReceiver(e_testbody3, v_frame_to_send))
+
+ var e_Phase v_phase
+
+ for(v_phase := c_firstPhase; v_phase < e_testcase_complete;v_phase := f_incMTCPhase(v_phase)) {
+ f_startPhase(v_phase)
+ log("MTC: ", v_phase)
+ f_awaitEndPhase(v_phase)
+ }
+
+ all component.done;
+ log("MTC done")
+
+ disconnect(mtc:pt_sync, v_ptc_rawSendInitiator:pt_sync)
+ disconnect(mtc:pt_sync, v_ptc_rawFrameReceiver:pt_sync)
+
+ all component.kill;
+}
+
+testcase tc_can_raw_send_and_receive_canfd_frame() runs on MTC {
+ var PTC v_ptc_rawSendInitiator := PTC.create("PTC1_ptc_rawSendInitiator") alive
+ var PTC v_ptc_rawFrameReceiver := PTC.create("PTC2_ptc_rawFrameReceiver") alive
+
+
+ f_addSyncSlaveSet(v_ptc_rawSendInitiator, v_PTCSet)
+ f_addSyncSlaveSet(v_ptc_rawFrameReceiver, v_PTCSet)
+
+ connect(mtc:pt_sync, v_ptc_rawSendInitiator:pt_sync)
+ connect(mtc:pt_sync, v_ptc_rawFrameReceiver:pt_sync)
+
+ var SocketCAN_CAN_or_CAN_FD_frame v_canfd_frame_to_send
+ v_canfd_frame_to_send := {canfd_frame :=
+ {can_id := '00000015'O,
+ can_flags := '10101010'B,
+ can_pdu := '0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF'O}
+ }
+
+ var CANFD_MESSAGE_TESTFRAME1 v_message_Frame1_4
+
+ v_message_Frame1_4 :=
+ {
+ // please note that if it is an extended can address, it would be '0x80000123' as usual in socketCAN
+ test_sig_11_bit_bitstring_msb_coded := '01010101011'B, // '...'B as this is a bitstring
+ test_sig_5_bit_bitstring_msb_coded := '11111'B // '...'B as this is a bitstring
+ }
+
+ template CANFD_MatrixUnion t_message_Frame1_4 := {
+
+ can_id := '00000123'O, // '...'O as this is an octetstring
+ can_flags := '10101010'B,
+ can_pdu := { message_MyTestframe1 := v_message_Frame1_4 }
+ }
+
+ var SocketCAN_CAN_or_CAN_FD_frame v_frame_to_send
+ v_frame_to_send := {canfd_frame := canfdmatrixframe2canfd(valueof(t_message_Frame1_4))}
+
+
+ v_ptc_rawSendInitiator.start(f_ptc_RawSendInitiator(e_testbody2, v_canfd_frame_to_send))
+ v_ptc_rawFrameReceiver.start(f_ptc_RawFrameReceiver(e_testbody3, v_canfd_frame_to_send))
+
+ var e_Phase v_phase
+
+ for(v_phase := c_firstPhase; v_phase < e_testcase_complete;v_phase := f_incMTCPhase(v_phase)) {
+ f_startPhase(v_phase)
+ log("MTC: ", v_phase)
+ f_awaitEndPhase(v_phase)
+ }
+
+ all component.done;
+ log("MTC done")
+
+
+ disconnect(mtc:pt_sync, v_ptc_rawSendInitiator:pt_sync)
+ disconnect(mtc:pt_sync, v_ptc_rawFrameReceiver:pt_sync)
+
+ all component.kill;
+}
+
+
+
+
+} with { encode "RAW" }
diff --git a/demo/IsobusNMMessageTypes.ttcn b/demo/IsobusNMMessageTypes.ttcn
index 7b2171c..7c061db 100644
--- a/demo/IsobusNMMessageTypes.ttcn
+++ b/demo/IsobusNMMessageTypes.ttcn
@@ -72,7 +72,7 @@
type record N_MFDB_Request
{
- Function MsgFunction (0),
+ Function msgFunction (0),
PortPair portPair,
OCT1 reserved3 ('FF'O),
OCT1 reserved4 ('FF'O),
@@ -84,7 +84,7 @@
type record N_MFDB_Response
{
- Function MsgFunction (1),
+ Function msgFunction (1),
PortPair portPair,
e_FilterMode filterMode,
record length (1..infinity) of PGN pgnEntries
@@ -93,21 +93,21 @@
type record N_MFDB_Add
{
- Function MsgFunction (2),
+ Function msgFunction (2),
PortPair portPair,
record length (1..infinity) of PGN pgnEntries
} with {variant "" };
type record N_MFDB_Delete
{
- Function MsgFunction (3),
+ Function msgFunction (3),
PortPair portPair,
record length (1..infinity) of PGN pgnEntries
} with {variant "" };
type record N_MFDB_Clear
{
- Function MsgFunction (4),
+ Function msgFunction (4),
PortPair portPair,
OCT1 reserved3 ('FF'O),
OCT1 reserved4 ('FF'O),
@@ -119,7 +119,7 @@
type record N_MFDB_Create_Entry
{
- Function MsgFunction (6),
+ Function msgFunction (6),
PortPair portPair,
e_FilterMode filterMode,
record length (1..infinity) of PGN pgnEntries
@@ -135,7 +135,7 @@
type record N_MFDBNQ_Add
{
- Function MsgFunction (7),
+ Function msgFunction (7),
PortPair portPair,
e_FilterMode filterMode,
OCT1 reserved4 ('FF'O),
@@ -145,7 +145,7 @@
type record N_NT_Request
{
- Function MsgFunction (64),
+ Function msgFunction (64),
PortNibble portPair,
OCT1 reserved3 ('FF'O),
OCT1 reserved4 ('FF'O),
@@ -157,14 +157,14 @@
type record N_NT_Response
{
- Function MsgFunction (65),
+ Function msgFunction (65),
PortNibble portPair,
record length (1..infinity) of SourceAddress SourceAddressEntries
} with {variant "" };
type record N_NTX_Request
{
- Function MsgFunction (66),
+ Function msgFunction (66),
PortNibble portPair,
OCT1 reserved3 ('FF'O),
OCT1 reserved4 ('FF'O),
@@ -183,7 +183,7 @@
type record N_NTX_Response
{
- Function MsgFunction (67),
+ Function msgFunction (67),
PortNibble portPair,
INT1 numberOfReportedPorts,
record length (1..infinity) of SA_NAME_pair sourceaddress_NAME_pairs
@@ -216,7 +216,7 @@
type record N_GP_Request
{
- Function MsgFunction (128),
+ Function msgFunction (128),
record length (6..255) of e_ParametricIdentifier parametricIdentifiers
// Note: If total length below 8 bytes shall be padded to 8 bytes with reserved within ParametricIdentifiers
// this is the easiest way to handle it
@@ -268,8 +268,8 @@
type record N_GP_Response
{
- Function MsgFunction (129),
- OCT1 requestedParametrics [6 .. 255]
+ Function msgFunction (129),
+ octetstring requestedParametrics [6 .. 255]
// Note: If total length below 8 bytes shall be padded to 8 bytes with reserved ('FF'O) within RequestedParametrics
// this is the easiest way to handle it
} with {
@@ -277,7 +277,7 @@
type record N_GP_Reset_Statistics
{
- Function MsgFunction (130),
+ Function msgFunction (130),
PortNibble portPair,
OCT1 reserved3 ('FF'O),
OCT1 reserved4 ('FF'O),
@@ -289,7 +289,7 @@
type record N_SP_Request
{
- Function MsgFunction (131),
+ Function msgFunction (131),
PortPair portPair,
record length (5..255) of e_ParametricIdentifier parametricIdentifiers
// Note: If total length below 8 bytes shall be padded to 8 bytes with reserved within ParametricIdentifiers
@@ -299,9 +299,9 @@
type record N_SP_Response
{
- Function MsgFunction (132),
- PortPair portPair,
- OCT1 requestedParametrics [5 .. 255]
+ Function msgFunction (132),
+ PortPair portPair,
+ octetstring requestedParametrics [5 .. 255]
// Note: If total length below 8 bytes shall be padded to 8 bytes with reserved ('FF'O) within RequestedParametrics
// this is the easiest way to handle it
} with {
@@ -311,7 +311,7 @@
type record N_SP_Reset_Statistics
{
- Function MsgFunction (133),
+ Function msgFunction (133),
PortPair portPair,
OCT1 reserved3 ('FF'O),
OCT1 reserved4 ('FF'O),
@@ -325,7 +325,7 @@
type record N_OC_Request
{
- Function MsgFunction (192),
+ Function msgFunction (192),
PortPair portPair,
NAME nameOfCF
} with {
@@ -333,7 +333,7 @@
type record N_CC_Request
{
- Function MsgFunction (193),
+ Function msgFunction (193),
PortPair portPair,
NAME nameOfCF
} with {
@@ -358,7 +358,7 @@
type record N_OC_Response
{
- Function MsgFunction (194),
+ Function msgFunction (194),
PortPair portPair,
e_Status status,
e_FailureReasonCode failureReasonCode
@@ -367,7 +367,7 @@
type record N_CC_Response
{
- Function MsgFunction (195),
+ Function msgFunction (195),
PortPair portPair,
e_Status status,
e_FailureReasonCode failureReasonCode
@@ -399,27 +399,27 @@
N_CC_Response n_CC_Response // NIU to CF
}
with {variant "TAG (
- n_MFDB_Request, MsgFunction = 0;
- n_MFDB_Response, MsgFunction = 1;
- n_MFDB_Add, MsgFunction = 2;
- n_MFDB_Delete, MsgFunction = 3;
- n_MFDB_Clear, MsgFunction = 4;
- n_MFDB_Create_Entry, MsgFunction = 6;
- n_MFDBNQ_Add, MsgFunction = 7;
- n_NT_Request, MsgFunction = 64;
- n_NT_Response, MsgFunction = 65;
- n_NTX_Request, MsgFunction = 66;
- n_NTX_Response, MsgFunction = 67;
- n_GP_Request, MsgFunction = 128;
- n_GP_Response, MsgFunction = 129;
- n_GP_Reset_Statistics, MsgFunction = 130;
- n_SP_Request, MsgFunction = 131;
- n_SP_Response, MsgFunction = 132;
- n_SP_Reset_Statistics, MsgFunction = 133;
- n_OC_Request, MsgFunction = 192;
- n_OC_Response, MsgFunction = 193; // there is a specification inconsistency concerning this value 193 vs. 194
- n_CC_Request, MsgFunction = 194; // there is a specification inconsistency concerning this value 194 vs. 193
- n_CC_Response, MsgFunction = 195; ) "
+ n_MFDB_Request, msgFunction = 0;
+ n_MFDB_Response, msgFunction = 1;
+ n_MFDB_Add, msgFunction = 2;
+ n_MFDB_Delete, msgFunction = 3;
+ n_MFDB_Clear, msgFunction = 4;
+ n_MFDB_Create_Entry, msgFunction = 6;
+ n_MFDBNQ_Add, msgFunction = 7;
+ n_NT_Request, msgFunction = 64;
+ n_NT_Response, msgFunction = 65;
+ n_NTX_Request, msgFunction = 66;
+ n_NTX_Response, msgFunction = 67;
+ n_GP_Request, msgFunction = 128;
+ n_GP_Response, msgFunction = 129;
+ n_GP_Reset_Statistics, msgFunction = 130;
+ n_SP_Request, msgFunction = 131;
+ n_SP_Response, msgFunction = 132;
+ n_SP_Reset_Statistics, msgFunction = 133;
+ n_OC_Request, msgFunction = 192;
+ n_OC_Response, msgFunction = 193; // there is a specification inconsistency concerning this value 193 vs. 194
+ n_CC_Request, msgFunction = 194; // there is a specification inconsistency concerning this value 194 vs. 193
+ n_CC_Response, msgFunction = 195; ) "
}
type enumerated e_PortNumber {
diff --git a/demo/Isobus_Templates.ttcn b/demo/Isobus_Templates.ttcn
index 13fdd15..8b926ca 100644
--- a/demo/Isobus_Templates.ttcn
+++ b/demo/Isobus_Templates.ttcn
@@ -38,8 +38,14 @@
}
template GetMemoryRes t_GetMemoryRes(e_GetMemoryResVersionNumber p_versionNumber, e_GetMemoryResStatus p_status) := {
+ vtfunction := 194,
versionNumber := p_versionNumber,
- status := p_status
+ status := p_status,
+ reserved4 := 'FF'O,
+ reserved5 := 'FF'O,
+ reserved6 := 'FF'O,
+ reserved7 := 'FF'O,
+ reserved8 := 'FF'O
}
template GetSupportedWidecharsReq t_GetSupportedWidecharsReq(e_Codeplane p_codeplane, OCT2 p_firstWideCharInInquiryRange, OCT2 p_lastWideCharInInquiryRange) := {
@@ -51,18 +57,19 @@
reserved8 := 'FF'O
}
-template GetSupportedWidecharsRes t_GetSupportedWidecharsRes(OCT2 p_firstWideCharInInquiryRange,
+template GetSupportedWidecharsRes t_GetSupportedWidecharsRes(e_Codeplane p_codeplane, OCT2 p_firstWideCharInInquiryRange,
OCT2 p_lastWideCharInInquiryRange,
INT1 p_numberOfRanges,
WideCharRangeArray p_wideCharRangeArray) :=
{
+ vtfunction := 193,
+ codeplane := p_codeplane,
firstWideCharInInquiryRange := p_firstWideCharInInquiryRange,
lastWideCharInInquiryRange := p_lastWideCharInInquiryRange,
numberOfRanges := p_numberOfRanges,
wideCharRangeArray := p_wideCharRangeArray
}
-
template AnyIsoBusPdu t_WorkingSetMaintenanceReq_pdu(
WorkingSetMaintenanceBitMask p_bitMask,
e_WorkingSetMaintenanceVersionNumber p_versionNumber) := {
diff --git a/demo/Makefile b/demo/Makefile
index 45b168c..8474742 100644
--- a/demo/Makefile
+++ b/demo/Makefile
@@ -62,7 +62,7 @@
ARFLAGS =
# Flags for the TTCN-3 and ASN.1 compiler:
-COMPILER_FLAGS = -lL
+COMPILER_FLAGS = -lL -e # added -e for codec compatiblity
# Execution mode: (either ttcn3 or ttcn3-parallel)
TTCN3_LIB = ttcn3-parallel
@@ -87,7 +87,8 @@
SocketCAN_BCM_test.ttcn ../src/SocketCAN_PortType.ttcn SocketCAN_RAW_test.ttcn ../src/SocketCAN_Templates.ttcn \
../src/SocketCAN_Types.ttcn SocketCANtest.ttcn Isobus.ttcn Isobustest.ttcn IsobusMessageTypes.ttcn \
Isobus_Templates.ttcn IsobusNMMessageTypes.ttcn IsobusCMMessageTypes.ttcn IsobusVTMessageTypes.ttcn \
-Isotp.ttcn Isotptest.ttcn
+Isotp.ttcn Isotptest.ttcn \
+CAN_matrix_general_types.ttcn CAN_matrix_test.ttcn CAN_matrix.ttcn My_can_matrix.ttcn My_canfd_matrix.ttcn
# ASN.1 modules of this project:
ASN1_MODULES =
@@ -98,7 +99,8 @@
SocketCAN_BCM_test.cc SocketCAN_PortType.cc SocketCAN_RAW_test.cc SocketCAN_Templates.cc \
SocketCAN_Types.cc SocketCANtest.cc Isobus.cc Isobustest.cc IsobusMessageTypes.cc \
Isobus_Templates.cc IsobusNMMessageTypes.cc IsobusCMMessageTypes.cc IsobusVTMessageTypes.cc \
-Isotp.cc Isotptest.cc
+Isotp.cc Isotptest.cc \
+CAN_matrix_general_types.cc CAN_matrix_test.cc CAN_matrix.cc My_can_matrix.cc My_canfd_matrix.cc
GENERATED_HEADERS = $(GENERATED_SOURCES:.cc=.hh)
diff --git a/demo/My_can_matrix.ttcn b/demo/My_can_matrix.ttcn
new file mode 100644
index 0000000..7f961d1
--- /dev/null
+++ b/demo/My_can_matrix.ttcn
@@ -0,0 +1,112 @@
+module My_can_matrix {
+
+import from General_Types all // for OCT1, OCT2, ..., INT1, ..
+import from Can all // for CAN_id
+import from CAN_matrix_general_types all
+
+
+
+
+//The following section is used for the automatic message encding / decoding
+
+type record CAN_MESSAGE_TESTFRAME0
+{
+ BIT11_MSB test_sig_11_bit_bitstring_lsb_coded,
+ BIT5_MSB test_sig_5_bit_bitstring_lsb_coded
+
+} with {variant "FIELDORDER(msb)"
+ variant (test_sig_11_bit_bitstring_lsb_coded) "BITORDERINFIELD(lsb)"
+ variant (test_sig_5_bit_bitstring_lsb_coded) "BITORDERINFIELD(lsb)"
+}
+
+type record CAN_MESSAGE_TESTFRAME1
+{
+ BIT11_MSB test_sig_11_bit_bitstring_msb_coded,
+ BIT5_MSB test_sig_5_bit_bitstring_msb_coded
+
+} with {variant "FIELDORDER(msb)"
+ variant (test_sig_11_bit_bitstring_msb_coded) "BITORDERINFIELD(msb)"
+ variant (test_sig_5_bit_bitstring_msb_coded) "BITORDERINFIELD(msb)"
+}
+
+type record CAN_MESSAGE_TESTFRAME2
+{
+ INT_BIT11_MSB test_sig_11_bit_integer_msb_coded,
+ INT_BIT5_MSB test_sig_5_bit_integer_msb_coded
+
+} with {variant "FIELDORDER(msb)"
+ variant (test_sig_11_bit_integer_msb_coded) "BITORDERINFIELD(msb)"
+ variant (test_sig_5_bit_integer_msb_coded) "BITORDERINFIELD(msb)"
+}
+
+type record CAN_MESSAGE_TESTFRAME3
+{
+ OCT1 test_sig_1_byte_octetstring_msb_coded,
+ OCT2 test_sig_2_byte_octetstring_msb_coded
+
+} with {variant "" }
+
+type integer INT_BIT9_PADDED_2_MSB (0..511) with
+{ variant "ALIGN(right)";
+ variant "FIELDLENGTH(11)"
+ variant "BITORDER(msb)"
+};
+
+type record CAN_MESSAGE_TESTFRAME4
+{
+ INT_BIT9_PADDED_2_MSB test_unsig_9_bit_2_padded_integer_msb_coded,
+ INT_BIT5_MSB test_sig_5_bit_integer_msb_coded
+
+} with {variant "FIELDORDER(msb)"
+ variant (test_unsig_9_bit_2_padded_integer_msb_coded) "BITORDERINFIELD(msb)"
+ variant (test_sig_5_bit_integer_msb_coded) "BITORDERINFIELD(msb)"
+}
+
+type record CAN_MESSAGE_TESTFRAME5
+{
+ INT_BIT9_PADDED_2_MSB test_unsig_9_bit_2_padded_integer_msb_coded,
+ INT_BIT5_MSB test_sig_5_bit_integer_msb_coded
+
+} with {variant "FIELDORDER(msb)"
+ variant (test_unsig_9_bit_2_padded_integer_msb_coded) "BITORDERINFIELD(lsb)"
+ variant (test_sig_5_bit_integer_msb_coded) "BITORDERINFIELD(lsb)"
+}
+
+type record CAN_MESSAGE_EXTENDEDFRAME1
+{
+ // CAN_id can_id ('80000001'O),
+ // according to SocketCAN Extended frames have the bit 31 set,
+ OCT2 test_sig_2_byte_octetstring_msb_coded
+
+} with {variant ""}
+
+ type union CAN_MatrixPayloadUnion
+ {
+ CAN_MESSAGE_TESTFRAME0 message_MyTestframe0,
+ CAN_MESSAGE_TESTFRAME1 message_MyTestframe1,
+ CAN_MESSAGE_TESTFRAME2 message_MyTestframe2,
+ CAN_MESSAGE_TESTFRAME3 message_MyTestframe3,
+ CAN_MESSAGE_TESTFRAME4 message_MyTestframe4,
+ CAN_MESSAGE_TESTFRAME5 message_MyTestframe5,
+ CAN_MESSAGE_EXTENDEDFRAME1 message_extendedFrame1
+ }
+ with {variant "" }
+
+ type record CAN_MatrixUnion {
+ CAN_id can_id,
+ CAN_MatrixPayloadUnion can_pdu
+} with {variant (can_pdu) "CROSSTAG(
+ message_MyTestframe0, can_id = '00000122'O;
+ message_MyTestframe1, can_id = '00000123'O;
+ message_MyTestframe2, can_id = '00000124'O;
+ message_MyTestframe3, can_id = '00000125'O;
+ message_MyTestframe4, can_id = '00000126'O;
+ message_MyTestframe5, can_id = '00000127'O;
+ message_extendedFrame1, can_id = '80000001'O;
+ )"
+ }
+
+
+//The above section is used for the automatic message encding / decoding
+
+} with { encode "RAW" }
diff --git a/demo/My_canfd_matrix.ttcn b/demo/My_canfd_matrix.ttcn
new file mode 100644
index 0000000..d55aab4
--- /dev/null
+++ b/demo/My_canfd_matrix.ttcn
@@ -0,0 +1,80 @@
+module My_canfd_matrix {
+
+import from General_Types all // for OCT1, OCT2, ..., INT1, ..
+import from Can all // for CAN_id
+import from CAN_matrix_general_types all
+
+//The following section is used for the automatic message encding / decoding
+
+type record CANFD_MESSAGE_TESTFRAME0
+{
+ BIT11_MSB test_sig_11_bit_bitstring_lsb_coded,
+ BIT5_MSB test_sig_5_bit_bitstring_lsb_coded
+
+} with {variant "FIELDORDER(msb)"
+ variant (test_sig_11_bit_bitstring_lsb_coded) "BITORDERINFIELD(lsb)"
+ variant (test_sig_5_bit_bitstring_lsb_coded) "BITORDERINFIELD(lsb)"
+}
+
+type record CANFD_MESSAGE_TESTFRAME1
+{
+ BIT11_MSB test_sig_11_bit_bitstring_msb_coded,
+ BIT5_MSB test_sig_5_bit_bitstring_msb_coded
+
+} with {variant "FIELDORDER(msb)"
+ variant (test_sig_11_bit_bitstring_msb_coded) "BITORDERINFIELD(msb)"
+ variant (test_sig_5_bit_bitstring_msb_coded) "BITORDERINFIELD(msb)"
+}
+
+type record CANFD_MESSAGE_TESTFRAME2
+{
+ INT_BIT11_MSB test_sig_11_bit_integer_msb_coded,
+ INT_BIT5_MSB test_sig_5_bit_integer_msb_coded
+
+} with {variant "FIELDORDER(msb)"
+ variant (test_sig_11_bit_integer_msb_coded) "BITORDERINFIELD(msb)"
+ variant (test_sig_5_bit_integer_msb_coded) "BITORDERINFIELD(msb)"
+}
+
+type record CANFD_MESSAGE_TESTFRAME3
+{
+ OCT1 test_sig_1_byte_octetstring_msb_coded,
+ OCT2 test_sig_2_byte_octetstring_msb_coded
+
+} with {variant "" }
+
+type record CANFD_MESSAGE_EXTENDEDFRAME1
+{
+ // CAN_id can_id ('80000001'O),
+ // according to SocketCAN Extended frames have the bit 31 set,
+ OCT2 test_sig_2_byte_octetstring_msb_coded
+
+} with {variant ""}
+
+ type union CANFD_MatrixPayloadUnion
+ {
+ CANFD_MESSAGE_TESTFRAME0 message_MyTestframe0,
+ CANFD_MESSAGE_TESTFRAME1 message_MyTestframe1,
+ CANFD_MESSAGE_TESTFRAME2 message_MyTestframe2,
+ CANFD_MESSAGE_TESTFRAME3 message_MyTestframe3,
+ CANFD_MESSAGE_EXTENDEDFRAME1 message_extendedFrame1
+ }
+ with {variant "" }
+
+ type record CANFD_MatrixUnion {
+ CAN_id can_id,
+ CAN_flags can_flags, // only used with CAN FD
+ CANFD_MatrixPayloadUnion can_pdu
+} with {variant (can_pdu) "CROSSTAG(
+ message_MyTestframe0, can_id = '00000122'O;
+ message_MyTestframe1, can_id = '00000123'O;
+ message_MyTestframe2, can_id = '00000124'O;
+ message_MyTestframe3, can_id = '00000125'O;
+ message_extendedFrame1, can_id = '80000001'O;
+ )"
+ }
+
+
+//The above section is used for the automatic message encding / decoding
+
+} with { encode "RAW" }
diff --git a/demo/SocketCAN.cfg b/demo/SocketCAN.cfg
index eabc996..21e91d8 100644
--- a/demo/SocketCAN.cfg
+++ b/demo/SocketCAN.cfg
@@ -39,5 +39,5 @@
//CAN BCM tests
SocketCAN_BCM_test.tc_can_bcm_TX_SETUP_TX_DELETE_can_frame
// broken CAN BCM tests:
-SocketCAN_BCM_test.tc_can_bcm_TX_SETUP_TX_DELETE_canfd_frame
+//SocketCAN_BCM_test.tc_can_bcm_TX_SETUP_TX_DELETE_canfd_frame //seems to work on some newer kernels
//SocketCAN_BCM_test.tc_can_bcm_TX_SETUP_TX_READ
diff --git a/demo/initscript.sh b/demo/initscript.sh
index dcdd192..3091fa8 100755
--- a/demo/initscript.sh
+++ b/demo/initscript.sh
@@ -18,6 +18,8 @@
# Setup of virtual can vcan0
sudo ip link add dev vcan0 type vcan
+# set it up at as a canfd can interface
+sudo ip link set vcan0 mtu 72
sudo ip link set vcan0 up
# Setup of virtual can vcan1
diff --git a/doc/README.md b/doc/README.md
index 3ad912b..083183d 100644
--- a/doc/README.md
+++ b/doc/README.md
@@ -19,12 +19,11 @@
http://www.can-cia.de/fileadmin/resources/documents/proceedings/2012_hartkopp.pdf
http://v2.can-newsletter.org/uploads/media/raw/46c15d02e1fdd3b04e671693ec548ff7.pdf
-# See file: src/initscript.sh:
+# See file: demo/initscript.sh:
#--------------------------------------
#!/bin/bash
-# based on ideas from:
-#
+
# create a virtual can interface:
@@ -32,9 +31,19 @@
sudo ip link add dev vcan0 type vcan
sudo ip link set vcan0 up
-# or create a physical can interface
+#!/bin/bash
-#sudo ip link set can0 up type can bitrate 1000000
+# Add vcan module to kernel
+sudo modprobe vcan
+
+# Setup of virtual can vcan0
+sudo ip link add dev vcan0 type vcan
+# set it up at as a canfd capable can interface
+sudo ip link set vcan0 mtu 72
+sudo ip link set vcan0 up
+
+# or create a physical can interface
+# sudo ip link set can0 up type can bitrate 1000000
ifconfig
@@ -48,11 +57,13 @@
make clean; make
-ttcn3_start SocketCAN client.cfg
+ttcn3_start SocketCAN SocketCAN.cfg
+or
+ttcn3_start SocketCAN CAN_matrix_test.cfg
or to run a certain testcase:
-ttcn3_start SocketCAN client.cfg SocketCANtest.tc_can_raw1 SocketCANtest.tc_can_bcm1
+ttcn3_start SocketCAN SocketCAN.cfg SocketCAN_RAW_test.tc_can_raw_send_and_receive_can_frame SocketCAN_RAW_test.tc_can_raw_setsockopt_CAN_RAW_FILTER
Review the newly created log files in the src directory
and use e.g. Wireshark to trace the CAN interfacce.
diff --git a/src/SocketCAN_PT.cc b/src/SocketCAN_PT.cc
index 40cfaf8..51721f5 100644
--- a/src/SocketCAN_PT.cc
+++ b/src/SocketCAN_PT.cc
@@ -12,7 +12,7 @@
// File: SocketCAN_PT.cc
// Description: SocketCAN_PT test port source
//
-// Revision R1A
+// Revision R2D
#include "SocketCAN_PT.hh"
#include "SocketCAN_PortType.hh"
diff --git a/src/SocketCAN_PT.hh b/src/SocketCAN_PT.hh
index 383ffef..7e3be07 100644
--- a/src/SocketCAN_PT.hh
+++ b/src/SocketCAN_PT.hh
@@ -1,134 +1,134 @@
-/******************************************************************************
- * Copyright (c) 2010, 2016 Ericsson AB
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Michel Josenhans
- ******************************************************************************/
-//
-// File: SocketCAN_PT.hh
-// Description: SocketCAN test port header
-//
-// Revision R1A
-
-#ifndef SocketCAN__PT_HH
-#define SocketCAN__PT_HH
-
-#include <TTCN3.hh>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include "linux/can.h"
-#include "SocketCAN_Types.hh"
-
-// Note: Header file SocketCAN_PortType.hh must not be included into this file!
-// (because it includes this file)
-// Please add the declarations of message types manually.
-namespace SocketCAN__Types {
-class SocketCAN;
-}
-
-namespace SocketCAN__PortType {
-
-class SocketCAN__PT_PROVIDER: public PORT {
-public:
- SocketCAN__PT_PROVIDER(const char *par_port_name = NULL);
- ~SocketCAN__PT_PROVIDER();
-
- void set_parameter(const char *parameter_name, const char *parameter_value);
-
-private:
- /* void Handle_Fd_Event(int fd, boolean is_readable,
- boolean is_writable, boolean is_error); */
- void Handle_Fd_Event_Error(int fd);
- void Handle_Fd_Event_Writable(int fd);
- void Handle_Fd_Event_Readable(int fd);
- /* void Handle_Timeout(double time_since_last_call); */
-protected:
- void user_map(const char *system_port);
- void user_unmap(const char *system_port);
-
- void user_start();
- void user_stop();
-
- void outgoing_send(const SocketCAN__Types::SocketCAN__socket& send_par);
- void outgoing_send(const SocketCAN__Types::SocketCAN__ioctl& send_par);
- void outgoing_send(const SocketCAN__Types::SocketCAN__connect& send_par);
- void outgoing_send(const SocketCAN__Types::SocketCAN__bind& send_par);
- void outgoing_send(const SocketCAN__Types::SocketCAN__send__data& send_par);
- void outgoing_send(
- const SocketCAN__Types::SocketCAN__write__data& send_par);
- void outgoing_send(const SocketCAN__Types::SocketCAN__write__isotp& send_par);
- void outgoing_send(const SocketCAN__Types::SocketCAN__setsockopt& send_par);
- void outgoing_send(const SocketCAN__Types::SocketCAN__close& send_par);
- virtual void incoming_message(
- const SocketCAN__Types::SocketCAN__socket__result& incoming_par) = 0;
- virtual void incoming_message(
- const SocketCAN__Types::SocketCAN__ioctl__result& incoming_par) = 0;
- virtual void incoming_message(
- const SocketCAN__Types::SocketCAN__connect__result& incoming_par) = 0;
- virtual void incoming_message(
- const SocketCAN__Types::SocketCAN__bind__result& incoming_par) = 0;
- virtual void incoming_message(
- const SocketCAN__Types::SocketCAN__send__data__result& incoming_par) = 0;
- virtual void incoming_message(
- const SocketCAN__Types::SocketCAN__write__data__result& incoming_par) = 0;
- virtual void incoming_message(
- const SocketCAN__Types::SocketCAN__write__isotp__result& incoming_par) = 0;
- virtual void incoming_message(
- const SocketCAN__Types::SocketCAN__receive__CAN__or__CAN__FD__frame& incoming_par) = 0;
- virtual void incoming_message(
- const SocketCAN__Types::SocketCAN__receive__BCM__message& incoming_par) = 0;
- virtual void incoming_message(
- const SocketCAN__Types::SocketCAN__receive__isotp__pdu& incoming_par) = 0;
- virtual void incoming_message(
- const SocketCAN__Types::SocketCAN__setsockopt__result& incoming_par) = 0;
- void set_asp_params();
- void reset_configuration();
- void InitStrPar(char *&par, const char *name, const char *val);
- void log(const char *fmt, ...);
- void logOctet(const char *prompt, const OCTETSTRING& msg);
- void logHex(const char *prompt, const HEXSTRING& msg);
- void logInteger(const char *prompt, const int number);
- void logBitstring(const char *prompt, const BITSTRING& msg);
- void setUpSocket();
- void closeDownSocket();
-
-private:
- enum socket_allocation_enum {
- SOCKET_NOT_ALLOCATED = 0, SOCKET_OPEN = 1
- };
- enum socket_protocol_family_enum {
- SOCKET_NO_PROTOCOL = 0,
- SOCKET_PROTOCOL_CAN_BCM = 1,
- SOCKET_PROTOCOL_CAN_RAW = 2,
- SOCKET_PROTOCOL_CAN_ISOTP = 6
- };
-
- struct sock_data {
- int fd;
- SocketCAN__PortType::SocketCAN__PT_PROVIDER::socket_allocation_enum status;
- SocketCAN__PortType::SocketCAN__PT_PROVIDER::socket_protocol_family_enum protocol_family;
- struct sockaddr_can remote_Addr;
- };
-
- sock_data *sock_list;
- int num_of_sock;
- int sock_list_length;
-
- int target_fd;
- // test port parameters
- char* can_interface_name;
- bool debugging;
- bool debugging_configured;
- bool config_finished;
-};
-
-} /* end of namespace */
-
-#endif
+/******************************************************************************
+ * Copyright (c) 2010, 2016 Ericsson AB
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Michel Josenhans
+ ******************************************************************************/
+//
+// File: SocketCAN_PT.hh
+// Description: SocketCAN test port header
+//
+// Revision R2D
+
+#ifndef SocketCAN__PT_HH
+#define SocketCAN__PT_HH
+
+#include <TTCN3.hh>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include "linux/can.h"
+#include "SocketCAN_Types.hh"
+
+// Note: Header file SocketCAN_PortType.hh must not be included into this file!
+// (because it includes this file)
+// Please add the declarations of message types manually.
+namespace SocketCAN__Types {
+class SocketCAN;
+}
+
+namespace SocketCAN__PortType {
+
+class SocketCAN__PT_PROVIDER: public PORT {
+public:
+ SocketCAN__PT_PROVIDER(const char *par_port_name = NULL);
+ ~SocketCAN__PT_PROVIDER();
+
+ void set_parameter(const char *parameter_name, const char *parameter_value);
+
+private:
+ /* void Handle_Fd_Event(int fd, boolean is_readable,
+ boolean is_writable, boolean is_error); */
+ void Handle_Fd_Event_Error(int fd);
+ void Handle_Fd_Event_Writable(int fd);
+ void Handle_Fd_Event_Readable(int fd);
+ /* void Handle_Timeout(double time_since_last_call); */
+protected:
+ void user_map(const char *system_port);
+ void user_unmap(const char *system_port);
+
+ void user_start();
+ void user_stop();
+
+ void outgoing_send(const SocketCAN__Types::SocketCAN__socket& send_par);
+ void outgoing_send(const SocketCAN__Types::SocketCAN__ioctl& send_par);
+ void outgoing_send(const SocketCAN__Types::SocketCAN__connect& send_par);
+ void outgoing_send(const SocketCAN__Types::SocketCAN__bind& send_par);
+ void outgoing_send(const SocketCAN__Types::SocketCAN__send__data& send_par);
+ void outgoing_send(
+ const SocketCAN__Types::SocketCAN__write__data& send_par);
+ void outgoing_send(const SocketCAN__Types::SocketCAN__write__isotp& send_par);
+ void outgoing_send(const SocketCAN__Types::SocketCAN__setsockopt& send_par);
+ void outgoing_send(const SocketCAN__Types::SocketCAN__close& send_par);
+ virtual void incoming_message(
+ const SocketCAN__Types::SocketCAN__socket__result& incoming_par) = 0;
+ virtual void incoming_message(
+ const SocketCAN__Types::SocketCAN__ioctl__result& incoming_par) = 0;
+ virtual void incoming_message(
+ const SocketCAN__Types::SocketCAN__connect__result& incoming_par) = 0;
+ virtual void incoming_message(
+ const SocketCAN__Types::SocketCAN__bind__result& incoming_par) = 0;
+ virtual void incoming_message(
+ const SocketCAN__Types::SocketCAN__send__data__result& incoming_par) = 0;
+ virtual void incoming_message(
+ const SocketCAN__Types::SocketCAN__write__data__result& incoming_par) = 0;
+ virtual void incoming_message(
+ const SocketCAN__Types::SocketCAN__write__isotp__result& incoming_par) = 0;
+ virtual void incoming_message(
+ const SocketCAN__Types::SocketCAN__receive__CAN__or__CAN__FD__frame& incoming_par) = 0;
+ virtual void incoming_message(
+ const SocketCAN__Types::SocketCAN__receive__BCM__message& incoming_par) = 0;
+ virtual void incoming_message(
+ const SocketCAN__Types::SocketCAN__receive__isotp__pdu& incoming_par) = 0;
+ virtual void incoming_message(
+ const SocketCAN__Types::SocketCAN__setsockopt__result& incoming_par) = 0;
+ void set_asp_params();
+ void reset_configuration();
+ void InitStrPar(char *&par, const char *name, const char *val);
+ void log(const char *fmt, ...);
+ void logOctet(const char *prompt, const OCTETSTRING& msg);
+ void logHex(const char *prompt, const HEXSTRING& msg);
+ void logInteger(const char *prompt, const int number);
+ void logBitstring(const char *prompt, const BITSTRING& msg);
+ void setUpSocket();
+ void closeDownSocket();
+
+private:
+ enum socket_allocation_enum {
+ SOCKET_NOT_ALLOCATED = 0, SOCKET_OPEN = 1
+ };
+ enum socket_protocol_family_enum {
+ SOCKET_NO_PROTOCOL = 0,
+ SOCKET_PROTOCOL_CAN_BCM = 1,
+ SOCKET_PROTOCOL_CAN_RAW = 2,
+ SOCKET_PROTOCOL_CAN_ISOTP = 6
+ };
+
+ struct sock_data {
+ int fd;
+ SocketCAN__PortType::SocketCAN__PT_PROVIDER::socket_allocation_enum status;
+ SocketCAN__PortType::SocketCAN__PT_PROVIDER::socket_protocol_family_enum protocol_family;
+ struct sockaddr_can remote_Addr;
+ };
+
+ sock_data *sock_list;
+ int num_of_sock;
+ int sock_list_length;
+
+ int target_fd;
+ // test port parameters
+ char* can_interface_name;
+ bool debugging;
+ bool debugging_configured;
+ bool config_finished;
+};
+
+} /* end of namespace */
+
+#endif
diff --git a/src/SocketCAN_Templates.ttcn b/src/SocketCAN_Templates.ttcn
index e9e1678..953c5e9 100644
--- a/src/SocketCAN_Templates.ttcn
+++ b/src/SocketCAN_Templates.ttcn
@@ -72,11 +72,16 @@
template SocketCAN_receive_CAN_or_CAN_FD_frame a_SocketCAN_receive_CAN_FD_frame(
template SocketCAN_socketid p_id,
template CAN_id p_can_id,
+ template CAN_flags p_can_flags,
template CAN_PDU p_can_pdu) := {
// recieved CAN or CAN FD frame
id := p_id,
ifr := ?,
- frame := {canfd_frame := {can_id := p_can_id, can_pdu := p_can_pdu}},
+ frame := {canfd_frame :=
+ {
+ can_id := p_can_id,
+ can_flags := p_can_flags,
+ can_pdu := p_can_pdu}},
timestamp := ?
}
@@ -105,4 +110,3 @@
}
}
-