| /* Copyright (c) 2000-2019 Ericsson Telecom AB 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 |
| ******************************************************************************/ |
| // |
| // File: SocketCANtest.ttcn |
| // Description: SocketCAN port type test |
| // |
| |
| |
| module SocketCAN_Templates { |
| |
| import from SocketCAN_Types all; |
| import from Bcm all |
| import from Can all |
| import from J1939 all |
| |
| template SocketCAN_Result a_result(template SocketCAN_Result_code v_result_code) := { |
| result_code := v_result_code, |
| err := *, |
| err_text := * |
| } |
| |
| template SocketCAN_socket_result |
| a_SocketCAN_socket_result(template SocketCAN_Result p_result) := { |
| id := ?, |
| result := p_result |
| } |
| |
| template SocketCAN_ioctl_result |
| a_SocketCAN_ioctl_result(template SocketCAN_Result p_result) := { |
| ifr := ?, |
| result := p_result |
| } |
| |
| template SocketCAN_connect_result |
| a_SocketCAN_connect_result(template SocketCAN_Result p_result) := { |
| result := p_result |
| } |
| |
| template SocketCAN_bind_result |
| a_SocketCAN_bind_result(template SocketCAN_Result p_result) := { |
| result := p_result |
| } |
| |
| template SocketCAN_send_data_result |
| a_SocketCAN_send_data_result(template SocketCAN_Result p_result) := { |
| result := p_result |
| } |
| |
| template SocketCAN_j1939_send_data_result |
| a_SocketCAN_j1939_send_data_result(template SocketCAN_Result p_result) := { |
| result := p_result |
| } |
| |
| template SocketCAN_j1939_send_data_to_result |
| a_SocketCAN_j1939_send_data_to_result(template SocketCAN_Result p_result) := { |
| result := p_result |
| } |
| |
| template SocketCAN_write_data_result |
| a_SocketCAN_write_data_result(template SocketCAN_Result p_result) := { |
| result := p_result |
| } |
| |
| template SocketCAN_receive_CAN_or_CAN_FD_frame a_SocketCAN_receive_CAN_frame( |
| template SocketCAN_socketid p_id, |
| template CAN_id p_can_id, |
| template CAN_PDU p_can_pdu) := { |
| // recieved CAN frame |
| id := p_id, |
| ifr := ?, |
| frame := {can_frame := {can_id := p_can_id, can_pdu := p_can_pdu}}, |
| timestamp := ? |
| } |
| |
| |
| 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_flags := p_can_flags, |
| can_pdu := p_can_pdu}}, |
| timestamp := ? |
| } |
| |
| template SocketCAN_receive_CAN_or_CAN_FD_frame a_SocketCAN_receive_CAN_or_CAN_FD_frame( |
| template SocketCAN_socketid p_id, |
| template SocketCAN_CAN_or_CAN_FD_frame p_frame) := { |
| // recieved CAN or CAN FD frame |
| id := p_id, |
| ifr := ?, |
| frame := p_frame, |
| timestamp := ? |
| } |
| |
| template SocketCAN_receive_BCM_message a_SocketCAN_receive_BCM_message( |
| template SocketCAN_socketid p_id, |
| template SocketCAN_bcm_frame p_frame) := { |
| // recieved CAN or CAN FD frame |
| id := p_id, |
| ifr := ?, |
| frame := p_frame |
| } |
| |
| template SocketCAN_receive_j1939_message a_SocketCAN_receive_j1939_message( |
| template SocketCAN_socketid p_id, |
| template SocketCAN_ifr p_ifr, |
| template J1939_PGN p_pgn, |
| template J1939_ADDR p_destAddr, |
| template J1939_NAME p_name, |
| template SocketCAN_J1939_PDU p_pdu) := { |
| id := p_id, |
| ifr := ?, |
| pgn := p_pgn, |
| destAddr := p_destAddr, |
| name := p_name, |
| pdu := p_pdu |
| } |
| |
| template SocketCAN_setsockopt_result |
| a_SocketCAN_setsockopt_result(template SocketCAN_Result p_result) := { |
| result := p_result |
| } |
| |
| } |