LibItsCam_Templates.ttcn 16 KB
Newer Older
 *    @author     ETSI / STF405
 *  @version     $URL$
 *                $Id$
 *    @desc        Module containing base template definitions for CAM
module LibItsCam_Templates {
    import from LibItsCam_TypesAndValues all;
    import from LibIts_Interface all;
    import from LibItsCam_Pixits all;
    import from CAM_PDU_Descriptions language "ASN.1:1997" all;
    import from DENM_PDU_Descriptions language "ASN.1:1997" all;
    import from LibItsCommon_TypesAndValues all;
fischer's avatar
fischer committed
    
    group camPrimitives {
berge's avatar
berge committed
        
        /**
         * @desc    Send template for CAM Message (CamPort Primitive)
         * @param   p_camMsg CAM Message to be sent
         */
        template CamInd mw_camInd (
            in template (present) CamPdu p_camMsg
        ) := { 
            msgIn := p_camMsg 
        };

        /**
         * @desc    Send template for CAM Message (CamPort Primitive)
berge's avatar
berge committed
         * @param   p_camMsg CAM Message to be received
berge's avatar
berge committed
         */    
        template (value) CamReq m_camReq (
            in template (value) CamPdu p_camMsg
        ) := { 
            msgOut := p_camMsg 
        };
        group camUtPrimitives {
            /**
             * @desc Initializes the CAM IUT. 
             */
            template (value) UtInitialize m_camInitialize := {
                utCamInitialize := {
                }
            }
            
            /**
             * @desc Change the heading
             * @param p_offset Offset to the current heading
             */
            template (value) UtEvent m_changeHeading(Direction p_offset) := {
                utCamEvent := {
                    changeHeading := p_offset
                }
             * @desc Change the position in the direction of the current heading
             * @param p_offset Offset to the current position
             */
            template (value) UtEvent m_changePosition(integer p_offset) := {
                utCamEvent := {
                    changePosition := p_offset
                }
            }
            
            /**
             * @desc Change the speed
             * @param p_offset Offset to the current position
             */
            template (value) UtEvent m_changeSpeed(Speed p_offset) := {
                utCamEvent := {
                    changeSpeed := p_offset
                }
            }
            
            /**
             * @desc Set the crash status
             * @param p_status The status to set
             */
            template (value) UtEvent m_setCrashSignal(CrashStatus p_status) := {
                utCamEvent := {
                    setCrashSignal := p_status
                }
            }
            
            /**
             * @desc Set the dangerous goods status
             * @param p_status The status to set
             */
            template (value) UtEvent m_setDangerousGoodsStatus(DangerousGoods p_status) := {
                utCamEvent := {
                    setDangerousGoodsStatus := p_status
                }
            }
            
            /**
             * @desc Set the length and width precision
             * @param p_precision The precision to set
             */
            template (value) UtEvent m_setLengthWidthPrecision(boolean p_precision) := {
                utCamEvent := {
                    setLengthWidthPrecision := p_precision
                }
            }
            
            /**
             * @desc Set the distance to the stop line
             * @param p_distance The distance to set
             */
            template (value) UtEvent m_setDistanceToStopLine(Distance p_distance) := {
                utCamEvent := {
                    setDistanceToStopLine := p_distance
                }
            }
            
            /**
             * @desc Set the turn advice
             * @param p_turnAdvice The turn advice to set
             */
            template (value) UtEvent m_setTurnAdvice(TurnAdvice p_turnAdvice) := {
                utCamEvent := {
                    setTurnAdvice := p_turnAdvice
                }
            }
            
            /**
             * @desc Change the curvature
             * @param p_offset Offset to the current curvature
             */
            template (value) UtEvent m_changeCurvature(Curvature p_offset) := {
                utCamEvent := {
                    changeCurvature := p_offset
                }
            }
            
            /**
             * @desc Set the occupancy
             * @param p_occupancy The occupancy to set
             */
            template (value) UtEvent m_setOccupancy(Occupancy p_occupancy) := {
                utCamEvent := {
                    setOccupancy := p_occupancy
                }
            }
            
            /**
             * @desc Set the door status
             * @param p_status The status to set
             */
            template (value) UtEvent m_setDoorStatus(DoorOpen p_status) := {
                utCamEvent := {
                    setDoorStatus := p_status
                }
            }
            
            /**
             * @desc Set the light bar status
             * @param p_status The status to set
             */
            template (value) UtEvent m_setLightBarStatus(SimpleSystemState p_status) := {
                utCamEvent := {
                    setLightBarStatus := p_status
                }
            }
            
            /**
             * @desc Set the sirene status
             * @param p_status The status to set
             */
            template (value) UtEvent m_setSireneStatus(SimpleSystemState p_status) := {
                utCamEvent := {
                    setSireneStatus := p_status
                }
            }
            
            /**
             * @desc Set the traffic light priority
             * @param p_priority The priority to set
             */
            template (value) UtEvent m_setTrafficLightPriority(Priority p_priority) := {
                utCamEvent := {
                    setTrafficLightPriority := p_priority
                }
            }
            
            /**
             * @desc Set the schedule deviation
             * @param p_scheduleDeviation The schedule deviation to set
             */
            template (value) UtEvent m_setScheduleDeviation(ScheduleDeviation p_scheduleDeviation) := {
                utCamEvent := {
                    setScheduleDeviation := p_scheduleDeviation
                }
            }
            
            /**
             * @desc Set the PT line description
             * @param p_ptLineDescription The PT line description to set
             */
            template (value) UtEvent m_setPtLineDescription(PTLineDescription p_ptLineDescription) := {
                utCamEvent := {
                    setPtLineDescription := p_ptLineDescription
                }
            }
            
            /**
             * @desc Set the exterior lights status
             * @param p_status The status to set
             */
            template (value) UtEvent m_setExteriorLightsStatus(ExteriorLights p_status) := {
                utCamEvent := {
                    setExteriorLightsStatus := p_status
                }
            }
            
            /**
             * @desc Checks the receive of a message at LDM
             * @param p_message The CAM message to check
             */
            template (value) UtEvent m_checkLdm(CamPdu p_message) := {
                utCamEvent := {
                    checkLdm := p_message
                }
            }
            
        } // end utPrimitives
        
    } // end group Primitives
berge's avatar
berge committed
    /**
     * @desc    Default Receive template for CAM PDU
     */
    template CamPdu mw_camMsg_any := {
        header := {
            protocolVersion := 0, 
            messageID := 0, 
            generationTime := ?
            },
        cam := {
            stationID := ?,
            stationCharacteristics := ?,
            referencePosition := ?,
            camParameters := *
        }
    }
berge's avatar
berge committed
    /**
     * @desc    Receive template for CAM PDU for vehicle  
     * @see     mw_camMsg_any
     */
    template CamPdu mw_camMsg_anyVehicle 
    modifies mw_camMsg_any := {
        cam := {
            stationCharacteristics := {?, ?, ?},
            camParameters := {
                vehicleCommonParameters := {
                    vehicleType := ?,
                    stationLength := ?,
                    stationLengthConfidence := *,
                    stationWidth := ?,
                    stationWidthConfidence := *,
                    vehicleSpeed := ?,
                    vehicleSpeedConfidence := ?,
                    longAcceleration := ?,
                    longAccelerationConfidence := ?,
                    accelerationControl := ?,
                    yawRate := ?,
                    yawRateConfidence := ?,
                    exteriorLights := ?,
                    turnAdvice := *,
                    distanceToStopLine := *,
                    occupancy := *,
                    doorOpen := *,
                    posConfidenceEllipse := ?,
                    curvature := ?,
                    curvatureChange := *,
                    curvatureConfidence := ?,
                    crashStatus := *,
                    headingConfidence := ?,
                    dangerousGoods := *
                },
                profileDependent := *
            }
        }
    }
    
berge's avatar
berge committed
    /**
     * @desc    Receive template for CAM PDU for road-side unit
     * @see     mw_camMsg_any
     */
    template CamPdu mw_camMsg_basicIrs 
berge's avatar
berge committed
    modifies mw_camMsg_any := {
        cam := {
            stationCharacteristics := {false, false, false},
            referencePosition := {
                longitude := ?,
                latitude := ?,
                elevation := ?,
                heading := omit,
                streetName := *,
                positionConfidence := omit,
                elevationConfidence := omit,
                roadSegmentID := *
            }
        }
    }
berge's avatar
berge committed
    /**
     * @desc    Send template for CAM PDU
     * @param   p_generationTime Timestamp of the generated message
     * @param   p_stationId Station ID of the source
berge's avatar
berge committed
     * @param   p_stationCharacteristics Characteristics of the sending station
     * @param   p_referencePosition Position of the sending station
     */
    template (value) CamPdu m_camMsg_valid(
        TimeStamp p_generationTime, 
        StationID p_stationId,
        CoopAwareness.stationCharacteristics p_stationCharacteristics,
        template (value) ReferencePosition p_referencePosition
    ) := {
        header := {
            protocolVersion := 0,
            messageID := 0,
            generationTime := p_generationTime
        },
        cam := {
            stationID := p_stationId,
            stationCharacteristics := p_stationCharacteristics,
            referencePosition := p_referencePosition,
            camParameters := omit
        }
    };
        
berge's avatar
berge committed
    /**
     * @desc    Receive template for CAM PDU for vehicle
     * @see     mw_camMsg_anyVehicle
     */
    template CamPdu mw_camMsg_basicVehicle 
    modifies mw_camMsg_anyVehicle := {
        cam := {
            stationCharacteristics := {true, false, true},
            camParameters := {
                profileDependent := {basicVehicle := ?}
            }
        }
    }
berge's avatar
berge committed
    /**
     * @desc    Receive template for CAM PDU for emergency vehicle
     * @see     mw_camMsg_anyVehicle
     */
    template CamPdu mw_camMsg_emergencyVehicle 
    modifies mw_camMsg_anyVehicle := {
        cam := {
            stationCharacteristics := {true, false, true},
            camParameters := {
                profileDependent := {
                    emergencyVehicle := {
                        lightBarInUse := *,
                        sireneInUse := *,
                        emergencyResponseType := ?
                    }
                }
            }
        }
    };
berge's avatar
berge committed
    /**
     * @desc    Receive template for CAM PDU for public transport vehicle
     * @see     mw_camMsg_anyVehicle
     */
    template CamPdu mw_camMsg_publicTransportVehicle 
    modifies mw_camMsg_basicVehicle := {
        cam := {
            stationCharacteristics := {true, false, true},
            camParameters := {
                profileDependent := {
                    publicTransportVehicle := {
                        publicVehicleType := ?,
                        pTLineDescription := *,
                        scheduleDeviation := *,
                        trafficLightPriority := *
                    }
                }
            }
        }
    };
  group camExteriorLightsTemplates {
berge's avatar
berge committed
      /**
       * @desc  Receive template for exterior lights with low beam lights off  
       */
      template ExteriorLights mw_lowBeamLightsOff := '0???????'B ; 
      
      /**
       * @desc  Receive template for exterior lights with low beam lights on 
       */
      template ExteriorLights mw_lowBeamLightsOn := '1???????'B ; 
      
      /**
       * @desc  Receive template for exterior lights with high beam lights off 
       */
      template ExteriorLights mw_highBeamLightsOff := '?0??????'B ; 
      
      /**
       * @desc  Receive template for exterior lights with high beam lights on 
       */
      template ExteriorLights mw_highBeamLightsOn := '?1??????'B ; 
      
      /**
       * @desc  Receive template for exterior lights with left turn signal off 
       */
      template ExteriorLights mw_leftTurnSignalOff := '??0?????'B ; 
      
      /**
       * @desc  Receive template for exterior lights with left turn signal on 
       */
      template ExteriorLights mw_leftTurnSignalOn := '??1?????'B ; 
berge's avatar
berge committed
      /**
       * @desc  Receive template for exterior lights with right turn signal off 
       */
      template ExteriorLights mw_rightTurnSignalOff := '???0????'B ; 
      /**
       * @desc  Receive template for exterior lights with right turn signal on 
       */
      template ExteriorLights mw_rightTurnSignalOn := '???1????'B ; 
berge's avatar
berge committed
      /**
       * @desc  Receive template for exterior lights with automatic light control off 
       */
      template ExteriorLights mw_automaticLightControlOff := '????0???'B ; 
      /**
       * @desc  Receive template for exterior lights with automatic light control on 
       */
      template ExteriorLights mw_automaticLightControlOn := '????1???'B ; 
berge's avatar
berge committed
      /**
       * @desc  Receive template for exterior lights with day time running lights off 
       */
      template ExteriorLights mw_daytimeRunningLightOff := '?????0??'B ; 
berge's avatar
berge committed
      /**
       * @desc  Receive template for exterior lights with day time running lights on 
       */
      template ExteriorLights mw_daytimeRunningLightOn := '?????1??'B ; 
berge's avatar
berge committed
      /**
       * @desc  Receive template for exterior lights with fog lights off 
       */
      template ExteriorLights mw_fogLightOff := '??????0?'B ; 
berge's avatar
berge committed
      /**
       * @desc  Receive template for exterior lights with fog lights on 
       */
      template ExteriorLights mw_fogLightOn := '??????1?'B ; 
berge's avatar
berge committed
      /**
       * @desc  Receive template for exterior lights with parking lights off 
       */
      template ExteriorLights mw_parkingLightsOff := '???????0'B ;
       
      /**
       * @desc  Receive template for exterior lights with parking lights on 
       */
      template ExteriorLights mw_parkingLightsOn := '???????1'B ; 
berge's avatar
berge committed
      /**
       * @desc  Receive template for exterior lights with hazard lights on 
       */
      template ExteriorLights mw_hazardConditionOn := '??11????'B ; 
      
  } // end group exteriorLights
} // end LibItsCam_Templates