ItsAutoInterop_Templates.ttcn 15.7 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;
    import from IEEE1609dot2BaseTypes language "ASN.1:1997" all;
    import from IEEE1609dot2 language "ASN.1:1997" all;
    import from EtsiTs103097Module language "ASN.1:1997" all;
    
    
    // LibItsCommon
    import from LibCommon_DataStrings all;
    import from LibItsExternal_TypesAndValues all;
    
    // LibItsGeoNetworking
    import from LibItsGeoNetworking_TestSystem all;
    import from LibItsGeoNetworking_Templates all;
    import from LibItsGeoNetworking_TypesAndValues all;
    
    // LibItsBtp
    import from LibItsBtp_Templates all;
    
    // LibItsCam
    import from LibItsCam_Templates all;
    
    // LibItsDenm
    import from LibItsDenm_Templates all;
    
    // LibItsSecurity
    import from LibItsSecurity_TypesAndValues 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                     := omit,
            its_aid                 := omit
        } // 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    Conversion template from ThreeDLocation to LongPosVector for distance calculus
         * @param   p_position ThreeDLocation 
         */
        template (value) LongPosVector m_longPosVector(
                                                       in template (value) ThreeDLocation p_position
        ) modifies m_dummyLongPosVector := {
            latitude    := valueof(p_position.latitude),
            longitude   := valueof(p_position.longitude)
        } // End of template mw_denm_stationId
        
garciay's avatar
garciay committed
        /**
         * @desc    Dummy template for long position vector
garciay's avatar
garciay committed
         */
        template (present) LongPosVector mw_dummyLongPosVector := {
            gnAddr := mw_gnAddressMid(?),
            timestamp_ := ?,
            latitude := ?,
            longitude := ?,
            pai := ?,
            speed := ?,
            heading := ?
        }
garciay's avatar
garciay committed
        
         * @desc    Receive template for the destinationArea which indicates the TARGET_GEOAREA
         * @param   p_gnAddress GN_Address to be contained in the long position vector
        template (present) LongPosVector mw_longPosVector( 
                                                          template (value) ThreeDLocation p_position
        ) modifies mw_dummyLongPosVector := { // TODO use mw_longPosVectorAny instead of mw_dummyLongPosVector
            latitude    := valueof(p_position.latitude),
            longitude   := valueof(p_position.longitude)
        } // End of template mw_longPosVector
        
        /**
         * @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 := ?/*TODO Check CAM in TC{ 
                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
        
        /**
         * @desc    Receive template for Management Container
         * @param   p_actionID              The expected action id
         * @param   p_referenceTime         The reference time (Default: any)
         * @param   p_isNegation            The expected negation flag (Default: false)
         * @param   p_validityDuration      The expected validity duration (Default: any or omit)
         * @param   p_transmissionInterval  The expected transmission interval (Default: any or omit)
         */
        template (present) ManagementContainer mw_denmMgmtCon_with_relevances(
                                                                              template (present) ActionID p_actionID := ?,
                                                                              template (present) ITS_Container.StationType p_stationType := ?,
                                                                              template (present) TimestampIts p_referenceTime := ?,
                                                                              template ValidityDuration p_validityDuration := *, // In ASN.1, a DEFAULT value constraint could be replaced by an omit
                                                                              template TransmissionInterval p_transmissionInterval := *,
                                                                              template Termination p_termination := *,
                                                                              template (present) RelevanceDistance p_relevanceDistance := ?,
                                                                              template (present) RelevanceTrafficDirection p_relevanceTrafficDirection := ?,
                                                                              template (present) ReferencePosition p_eventPosition := ?
        ) modifies mw_denmMgmtCon := {
            eventPosition               := p_eventPosition,
            relevanceDistance           := p_relevanceDistance,
            relevanceTrafficDirection   := p_relevanceTrafficDirection
        } // End of tamplate mw_denmMgmtCon_with_relevances
        /**
         * @desc    Receive template for the test system position
         * @param   p_longitude The longitude (Default: Test system's longitude)
         * @param   p_latitude  The latitude (Default: Test system's latitude)
         * @see     m_posConfidenceEllipse
         * @see     m_elevation
         */
        template (present) ReferencePosition mw_referencePosition(
                                                                  template (present) ThreeDLocation p_location := ?
        ) := {
            latitude := p_location.latitude,
            longitude := p_location.longitude,
            positionConfidenceEllipse := ?,
            altitude := ? // FIXME Create a convertion function SecElevation to intteger for p_location.elevation
        } // End of tamplate mw_referencePosition
        
    } // End of group denmTemplates
    
    group hmiPrimitiveTemplates {
        
        /**
         * @desc Initializes the EUT's HMI.
         */
        template (value) HmiInitialize m_hmiInitialize := {
            hashedId8 := '0000000000000000'O
        }
        /**
         * @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
        
        /**
         * @desc    Value template for NeighborEventInd matching
         * @param   p_mid       MID value
         * @param   p_stationId Vehicle station ID
         */
        template (present) HmiNeighborEventInd mw_hmiNeighborEventInd(
                                                                      template (present) Oct6    p_mid := ?,
                                                                      template (present) UInt32  p_stationId := ? 
        ) := {
            mid         := p_mid,
            stationId   := p_stationId
        } // End of template mw_hmiNeighborEventInd
        
        /**
garciay's avatar
garciay committed
         * @desc    Received indication generic template HMI indications
garciay's avatar
garciay committed
        template (present) HmiSignageEventInd mw_hmiSignageEventInd := {
            countryCode                             := ?,
            trafficSignPictogramClass               := *,
            trafficSignPictogramNature              := *, 
garciay's avatar
garciay committed
            ambientOrRoadConditionPictogramClass    := *,
            ambientOrRoadConditionPictogramNature   := *
        } // End of template mw_hmiSignageEventInd
        
        /**
         * @desc    Received indication template for Road Work Warning/Speed limit
         */
        template (present) HmiSignageEventInd mw_hmiSignageEventInd_roadworks_limitedspeed(
                                                                                           template (present) integer p_seed := 30
        ) modifies mw_hmiSignageEventInd := {
            ambientOrRoadConditionPictogramClass    := e_roadCondition,
            ambientOrRoadConditionPictogramNature   := (1..9)
garciay's avatar
garciay committed
        } // End of template mw_hmiSignageEventInd_roadworks_limitedspeed
        
        /**
         * @desc    Received indication template for Road Hazard Signals
         */
        template (present) HmiSignageEventInd mw_hmiSignageEventInd_roadHazardSignal modifies mw_hmiSignageEventInd := {
            ambientOrRoadConditionPictogramClass    := e_roadCondition,
            ambientOrRoadConditionPictogramNature   := (1..9)
        } // End of template mw_hmiSignageEventInd_roadHazardSignal
        
        /**
         * @desc    Received indication template for Stationary Vehicle Information
         */
        template (present) HmiSignageEventInd mw_hmiSignageEventInd_stationaryVehicleWarning modifies mw_hmiSignageEventInd := {
            ambientOrRoadConditionPictogramClass    := e_roadCondition,
            ambientOrRoadConditionPictogramNature   := (1..9)
        } // End of template mw_hmiSignageEventInd_stationaryVehicleWarning
        
        /**
         * @desc    Received indication template for Forward Collision Risk
         */
garciay's avatar
garciay committed
        template (present) HmiSignageEventInd mw_hmiSignageEventInd_forwardCollisionRisk modifies mw_hmiSignageEventInd := {
            trafficSignPictogramClass               := e_dangerWarning,
garciay's avatar
garciay committed
            trafficSignPictogramNature              := (1..9)
        } // End of template mw_hmiSignageEventInd_forwardCollisionRisk
        
        /**
         * @desc    Received indication template for Lateral Collision Risk
         */
garciay's avatar
garciay committed
        template (present) HmiSignageEventInd mw_hmiSignageEventInd_lateralCollisionRisk modifies mw_hmiSignageEventInd := {
            trafficSignPictogramClass               := e_dangerWarning,
garciay's avatar
garciay committed
            trafficSignPictogramNature              := (1..9)
        } // End of template mw_hmiSignageEventInd_lateralCollisionRisk
        
    } // End of group hmiPrimitiveTemplates
    
    group utPrimitiveTemplates {
        
    } // End of group utPrimitiveTemplates
    
} // End of module ItsAutoInterop_Templates