ItsAutoInterop_Templates.ttcn 9.17 KB
Newer Older
module ItsAutoInterop_Templates {
    
    // LibCommon
    import from LibCommon_BasicTypesAndValues all;
    
    // LibIts
    import from ITS_Container language "ASN.1:1997" all;
    import from CAM_PDU_Descriptions language "ASN.1:1997" all;
    import from DENM_PDU_Descriptions language "ASN.1:1997" all;
    
    // LibItsCommon
    import from LibItsCommon_Functions all;
    import from LibCommon_DataStrings all;
    import from LibItsExternal_TypesAndValues all;
    
    // LibItsGeoNetworking
    import from LibItsGeoNetworking_TestSystem all;
    import from LibItsGeoNetworking_Functions all;
    import from LibItsGeoNetworking_Templates all;
    import from LibItsGeoNetworking_TypesAndValues all;
    
    // LibItsBtp
    import from LibItsBtp_TypesAndValues all;
    import from LibItsBtp_Templates all;
    
    // LibItsCam
    import from LibItsCam_Templates all;
    
    // LibItsDenm
    import from LibItsDenm_Templates all;
    
    // ItsInterop
    import from ItsAutoInterop_TypesAndValues all;
    import from ItsAutoInterop_Pics all;
    import from ItsAutoInterop_TestSystem all;
    
    group eutGeoNetworkingTemplates {
        
        /**
         * @desc    Re-send template for inter-EUT message exchanges
         * @param   p_geoNetworkingInd GeoNetworking message indication received on GeoNetworking protocol port
         */
        template (value) EutGeoNetworking m_forward_geoNetworkingInd(
                                                                     in template (value) GeoNetworkingInd p_geoNetworkingInd
        ) := {
            msg                     := valueof(p_geoNetworkingInd.msgIn),
            macDestinationAddress   := valueof(p_geoNetworkingInd.macDestinationAddress),
            ssp                     := valueof(p_geoNetworkingInd.ssp),
            its_aid                 := valueof(p_geoNetworkingInd.its_aid)
        } // End of template m_forward_geoNetworkingInd
        
        /**
         * @desc    Receive template for EUT GeoNetworking packet (GeonetworkingPort Primitive)
         * @param   p_geoNwMsg GeoNetworking packet to be received
         */
        template (present) EutGeoNetworking mw_eutGeoNwInd(
                                                           template (present) GeoNetworkingPdu p_geoNwMsg
        ) := {
            msg                     := p_geoNwMsg,
            macDestinationAddress   := ?,
            ssp                     := *,
            its_aid                 := *
        } // End of template mw_eutGeoNwInd
        
        /**
         * @desc    Receive template for EUT GeoNetworking packet (GeonetworkingPort Primitive)
         * @param   p_geoNwMsg              GeoNetworking packet to be received
         * @param   p_llDestinationAdress   Link-layer destination address
         */
        template(present)  EutGeoNetworking mw_eutGeoNwInd_withLinkLayerDestination(
                                                                                    template (present) GeoNetworkingPdu p_geoNwMsg,
                                                                                    template (present) MacAddress p_llDestinationAdress
        ) modifies mw_eutGeoNwInd := {
            macDestinationAddress := p_llDestinationAdress
        } // End of template mw_eutGeoNwInd_withLinkLayerDestination
        
    } // End of group eutGeoNetworkingTemplates
    
    group geoNetworkingTemplates {
        
        /**
         * @desc    Receive template for GeoNetworking DENM Packet
         * @param   p_sourceLongPosVec    Source position vector of destination
         * @param   p_hopLimit            Sequence number of GeoUnicast packet
         * @param   p_nextHeader          Expected next header
         * @param   p_denm                Expected DEN message 
         */
        template (present) GnNonSecuredPacket mw_geoNwTsbPacketWithNextHeader_denm(
                                                                                   template (present) LongPosVector p_sourceLongPosVec := ?,
                                                                                   template (present) UInt8 p_hopLimit := ?,
                                                                                   template (present) NextHeader p_nextHeader := ?,
                                                                                   template (present) DENM p_denm := ?
        ) modifies mw_geoNwShbPacket := {
            commonHeader := mw_commonHeaderWithHopLimit(
                p_nextHeader,
                m_shbHeaderType,
                p_hopLimit
            ),
            payload := { 
                decodedPayload := { 
                    btpPacket := mw_btpB(
                        PICS_DENM_BTP_DESTINATION_PORT, 
                        PICS_DENM_BTP_SOURCE_PORT, 
                        {
                            decodedPayload := {
                                denmPacket := p_denm
                            },
                            rawPayload := ?
                        }
                    )
                }, 
                rawPayload := ?
            }
        } // End of template mw_geoNwTsbPacketWithNextHeader_denm
        
        /**
         * @desc    Receive template for GeoNetworking CAM Packet
         * @param   p_sourceLongPosVec    Source position vector of destination
         * @param   p_hopLimit            Sequence number of GeoUnicast packet
         * @param   p_nextHeader          Expected next header
         * @param   p_cam                 Expected CA message 
         */
        template (present) GnNonSecuredPacket mw_geoNwShbPacketWithNextHeader_cam(
                                                                                  template (present) LongPosVector p_sourceLongPosVec := ?,
                                                                                  template (present) UInt8 p_hopLimit := ?,
                                                                                  template (present) NextHeader p_nextHeader,
                                                                                  template (present) CAM p_cam := ?
        ) modifies mw_geoNwShbPacket := {
            payload := { 
                decodedPayload := { 
                    btpPacket := mw_btpB(
                        PICS_CAM_BTP_DESTINATION_PORT, 
                        PICS_CAM_BTP_SOURCE_PORT, 
                        {
                            decodedPayload := {
                                camPacket := p_cam
                            },
                            rawPayload := ?
                        }
                    )
                }, 
                rawPayload := ?
            }
        } // End of template mw_geoNwShbPacketWithNextHeader_cam
        
    } // End of group geoNetworkingTemplates
    
    group camTemplates {
        
        /**
         * @desc    Receive template for CAM station ID
         * @param   p_basicVehicleContainer CA basic vehicle container
         * @param   p_stationId             Vehicle station ID
         * @param   p_referencePosition     Expected reference position
         */
        template (present) CAM mw_cam_stationId(
                                                template (present) BasicVehicleContainerHighFrequency p_basicVehicleContainer := mw_HF_BV_speed(?),
                                                template (present) StationID p_stationId := ?,
                                                template (present) ReferencePosition p_referencePosition := ?
        ) modifies mw_camMsg_HF_BV := {
            header := {
                stationID := p_stationId
            }, 
            cam := {
                camParameters := {
                    basicContainer := {
                        stationType := ?,
                        referencePosition := p_referencePosition
                    }
                }
            }
        } // End of template mw_cam_stationId
        
    } // End of group camTemplates
    
    group denmTemplates {
        
        /**
         * @desc    Receive template for DENM station ID
         * @param   p_stationId Vehicle station ID
         * @param   p_denm      Expected DENM packet
         */
        template (present) DENM mw_denm_stationId(
                                                  template (present) StationID p_stationId := ?,
                                                  template (present) DecentralizedEnvironmentalNotificationMessage p_denm := ?
        ) := mw_denmPdu(p_denm, p_stationId) // End of template mw_denm_stationId
        
    } // End of group denmTemplates
    
    group utPrimitiveTemplates {
        
        /**
         * @desc    Value template for NeighborEventInd matching
         * @param   p_mid       MID value
         * @param   p_stationId Vehicle station ID
         */
        template (value) HmiNeighborEventInd m_hmiNeighborEventInd(
                                                                   in Oct6    p_mid,
                                                                   in UInt32  p_stationId 
        ) := {
            mid         := p_mid,
            stationId   := p_stationId
        } // End of template m_hmiNeighborEventInd
        
    }
} // End of module ItsAutoInterop_Templates