| /* 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: Isobus.ttcn |
| // Description: Encoder / Decoder for Isobus message frames |
| // |
| // Revision R1A |
| |
| module Isobus { |
| import from General_Types all |
| import from IsobusCMMessageTypes all |
| import from IsobusNMMessageTypes all |
| import from IsobusVTMessageTypes all |
| import from J1939 all |
| |
| external function f_encode_J1939_message(in J1939_messageWithPGN pdu) return octetstring |
| with { extension "prototype(convert) encode(RAW)" } |
| external function f_decode_J1939_message(in octetstring data) return J1939_messageWithPGN |
| with { extension "prototype(convert) decode(RAW)" } |
| |
| type J1939_Priority Priority |
| |
| type record J1939PDU_with_NAME |
| { |
| J1939_ADDR addr, |
| J1939_NAME name, |
| J1939_messageWithPGN pdu |
| } with {variant "" }; |
| |
| |
| type union Isobus_message { |
| ETP_DT etp_dt, // extended TP data transfer |
| ETP_CM etp_cm, // extended TP connection management |
| VT2ECU vt2ecu, // Message Virtual Terminal (VT) to ECU |
| ECU2VT ecu2vt, // Message ECU to Virtual Terminal (VT) |
| RequestForAddressClaimed requestForAddressClaimed, |
| TP_DT tp_dt, // TP data transfer |
| TP_CM tp_cm, // TP connection management |
| NetworkMessage networkMessage, // Network Message according ISO 11873-4 |
| //CannotClaimSourceAddress cannotClaimSourceAddress, |
| //AddressClaimed addressClaimed, |
| AddressClaimed addressClaimedOrCannotClaimSourceAddress, |
| CommandedAddress commandedAddress |
| // other upper layer isobus protocols like Task Comtroller are added here ... |
| } |
| with { variant "" } |
| |
| |
| type record J1939_messageWithPGN { |
| J1939_PGN pgn, |
| Isobus_message pdu |
| } |
| with { |
| variant (pdu) "CROSSTAG( |
| etp_dt, pgn = '00C700'O; //199 |
| etp_cm, pgn = '00C800'O; //200 |
| vt2ecu, pgn = '00E600'O; //230 |
| ecu2vt, pgn = '00E700'O; //231 |
| requestForAddressClaimed, pgn = '00EA00'O; //234 |
| tp_dt, pgn = '00EB00'O; //235 |
| tp_cm, pgn = '00EC00'O; //236 |
| networkMessage, pgn = '00ED00'O; //237 |
| // cannotClaimSourceAddress, pgn = '00EEFFFE'O; //238 where the SA is 'FE'O |
| // addressClaimed, pgn = '00EEFFXX'O; //238 where the SA is XX != FE! |
| addressClaimedOrCannotClaimSourceAddress, pgn = '00EEFF'O; //238, the SA determies |
| // if it is addressClaimed (SA != 'FE'O) |
| // or it is cannotClaimSourceAddress (SA == 'FE'O) |
| commandedAddress, pgn = '00FED8'O)" //254 |
| } |
| |
| |
| } with { encode "RAW" } |
| |