Skip to content
LibItsDenm_Templates.ttcn 13.2 KiB
Newer Older
/**
 *	@author 	ETSI / STF405
berge's avatar
berge committed
 *  @version 	$URL$
 *				$Id$
 *	@desc		Module containing base template definitions for DENM
 *
 */
module LibItsDenm_Templates {
tepelmann's avatar
tepelmann committed
    //LibIts
    import from DENM_PDU_Descriptions language "ASN.1:1997" all;
    import from CAM_PDU_Descriptions language "ASN.1:1997" all;
    import from LibIts_Interface all;
    import from LibItsDenm_TypesAndValues all;

    group primitivesTemplates {
tepelmann's avatar
tepelmann committed
        template DenmReq m_denmReq(
            template (value) DenmPdu p_denMsg
tepelmann's avatar
tepelmann committed
            ) := {
            msgOut := p_denMsg
        }
        
        template DenmInd mw_denmInd(
            template (present) DenmPdu p_denMsg
tepelmann's avatar
tepelmann committed
            ) := {
berge's avatar
berge committed
            msgIn := p_denMsg,
            receptionTime := ?
tepelmann's avatar
tepelmann committed
        }
        
        group utPrimitives {
            
            template UtEvent m_utEvent(Situation p_situation) := {
                situation := p_situation,
                eventOption := omit
            }
            
            template UtEvent m_utEventCancellation(
                Situation p_situation, 
                DataVersion p_dataVersion
            ) modifies m_utEvent := {
                eventOption := {
                  eventCancellation := p_dataVersion
                }
            }
            
            template UtEvent m_utEventNegation(
                Situation p_situation, 
                DecentralizedEnvironmentalNotificationMessage.management.isNegation p_isNegation
            ) modifies m_utEvent := {
                eventOption := {
                  eventNegation := p_isNegation
                }
            }
            
            template UtEvent m_utEeventTrafficFlowEffect(
                Situation p_situation, 
                TrafficFlowEffect p_trafficFlowEffect
            ) modifies m_utEvent := {
                eventOption := {
                  eventTrafficFlowEffect := p_trafficFlowEffect
                }
            }
            
            template UtEvent m_utEventLinkedCause(
                Situation p_situation, 
                Situation p_linkedCause
            ) modifies m_utEvent := {
                eventOption := {
                  eventLinkedCause := p_linkedCause
                }
            }
            
            template UtEvent m_utEventExpirationTime(
                Situation p_situation, 
                TimeStamp p_expirationTime
            ) modifies m_utEvent := {
                eventOption := {
                    eventExpirationTime := p_expirationTime
                }
            }
            
            template UtEvent m_utEventExpirationTimeFrequency(
                Situation p_situation, 
                TimeStamp p_expirationTime,
                DecentralizedSituationManagement.frequency p_frequency
            ) modifies m_utEvent := {
                eventOption := {
                    eventExpirationTimeFrequency := {
                        p_expirationTime,
                        p_frequency
                    }
                }
            }
            
            template UtEvent m_utEventCharact(
                Situation p_situation, 
                DecentralizedSituation.eventCharact p_eventCharact
            ) modifies m_utEvent := {
                eventOption := {
                    eventCharact := p_eventCharact
                }
            }
            
        } // end utPrimitives
      
tepelmann's avatar
tepelmann committed
    } // end primitives
    
    group denmPduTemplates {
        
        template ItsPduHeader m_itsPduHeader := {
berge's avatar
berge committed
            protocolVersion := c_protocolVersionDenm,
			messageID := c_messageId,
            generationTime := 0 //TODO document: 0 indicates that the lower layer should add the time while sending
        }
        
        template ItsPduHeader mw_itsPduHeader modifies m_itsPduHeader := {
            generationTime := ?
        }
                
        template DenmPdu m_denmPdu(in template (value) DecentralizedEnvironmentalNotificationMessage p_denm) := {
        	header := m_itsPduHeader,
        	denm := p_denm            
        }
             
        template DenmPdu mw_denmPdu(in template (present) DecentralizedEnvironmentalNotificationMessage p_denm) := {
        	header := mw_itsPduHeader,
        	denm := p_denm            
        }     
                
    } // end denmPduTemplates
        
berge's avatar
berge committed
    group decentralizedEnvironmentalNotificationMessageTemplates {
tepelmann's avatar
tepelmann committed
        
        template DecentralizedEnvironmentalNotificationMessage m_denm(
            template (value) DecentralizedSituationManagement p_mgmt,
            template (value) DecentralizedSituation p_sit,
            template (value) DecentralizedSituationLocation p_loc
            ) := {
            management := p_mgmt, 
            situation := p_sit, 
            location := p_loc
        }
    
berge's avatar
berge committed
        template DecentralizedEnvironmentalNotificationMessage mw_anyDenm := {
            management := ?, 
            situation := ?, 
            location := ?            
        }    
    
tepelmann's avatar
tepelmann committed
        template DecentralizedEnvironmentalNotificationMessage mw_denm(
            template (present) DecentralizedSituationManagement p_mgmt,
berge's avatar
berge committed
            template (present) DecentralizedSituation p_sit
            ) modifies mw_anyDenm := {
tepelmann's avatar
tepelmann committed
            management := p_mgmt, 
berge's avatar
berge committed
            situation := p_sit
tepelmann's avatar
tepelmann committed
        }
    
        template DecentralizedEnvironmentalNotificationMessage m_denmWithCause(
            template (value) DataVersion p_dataVersion,
berge's avatar
berge committed
            template (value) Situation p_sit,
            template (value) DecentralizedSituationLocation.eventPosition p_eventPosition,            
            template (value) StationID p_stationId
tepelmann's avatar
tepelmann committed
            ) := {
berge's avatar
berge committed
            management := m_denmMgmtCon(p_dataVersion, p_stationId), 
tepelmann's avatar
tepelmann committed
            situation := m_denmSitCon(p_sit, informative),
            location := m_denmSitLoc(
berge's avatar
berge committed
                            p_eventPosition,
tepelmann's avatar
tepelmann committed
                            m_locationRef
                        )
        }
        template DecentralizedEnvironmentalNotificationMessage m_denmWithCauseIsNeg(
            template (value) DataVersion p_dataVersion,
            template (value) Situation p_sit,
berge's avatar
berge committed
            template (value) DecentralizedSituationLocation.eventPosition p_eventPosition,            
            template (value) StationID p_stationId,
tepelmann's avatar
tepelmann committed
            template (value) DecentralizedSituationManagement.isNegation p_isNeg
        ) modifies m_denmWithCause := {
berge's avatar
berge committed
            management := m_denmMgmtCon_IsNeg(p_dataVersion, p_stationId, p_isNeg)
tepelmann's avatar
tepelmann committed
        }
    
berge's avatar
berge committed
        template DecentralizedSituation mw_anySitutation := ?;
        
berge's avatar
berge committed
    } // end group decentralizedEnvironmentalNotificationMessageTemplates
tepelmann's avatar
tepelmann committed
    
berge's avatar
berge committed
    group decentralizedSituationManagementTemplates {
tepelmann's avatar
tepelmann committed
        
        template DecentralizedSituationManagement m_denmMgmtCon(
berge's avatar
berge committed
            template (value) DataVersion p_dataVersion,
            template (value) StationID p_stationId
tepelmann's avatar
tepelmann committed
            ) := {
            actionID := {
berge's avatar
berge committed
                stationID := p_stationId, 
tepelmann's avatar
tepelmann committed
                sequenceNo := 0
            },
            dataVersion := p_dataVersion,
            expiryTime := omit,
            frequency := omit,
            reliability := 0,
            isNegation := false
        }
        
        template DecentralizedSituationManagement mw_denmMgmtCon (
            template (present) DataVersion p_dataVersion
            ):= {
            actionID := {
                stationID := ?, 
                sequenceNo := ?
            },
            dataVersion := p_dataVersion,
            expiryTime := *,
            frequency := *,
            reliability := ?,
            isNegation := ?
        }
        
        template DecentralizedSituationManagement m_denmMgmtCon_IsNeg(
berge's avatar
berge committed
            template (value) DataVersion p_dataVersion,            
            template (value) StationID p_stationId,
tepelmann's avatar
tepelmann committed
            template (value) DecentralizedSituationManagement.isNegation p_isNeg
            ) modifies m_denmMgmtCon := {
            isNegation := p_isNeg
        }
        
        template DecentralizedSituationManagement mw_denmMgmtCon_IsNeg(
            template (present) DataVersion p_dataVersion,  
tepelmann's avatar
tepelmann committed
            template (present) DecentralizedSituationManagement.isNegation p_isNeg
            ) modifies mw_denmMgmtCon := {
            isNegation := p_isNeg
        }
        
berge's avatar
berge committed
        template DecentralizedSituationManagement mw_denmMgmtConWithExpiryTime(
            template (present) DataVersion p_dataVersion,  
berge's avatar
berge committed
            template (present) DecentralizedSituationManagement.expiryTime p_expiryTime        
        	) modifies mw_denmMgmtCon := {
            expiryTime := p_expiryTime
        }
        
berge's avatar
berge committed
        template DecentralizedSituationManagement.expiryTime mw_anyExpiryTime := ?;
        
berge's avatar
berge committed
    } // end group decentralizedSituationManagementTemplates
tepelmann's avatar
tepelmann committed
    
berge's avatar
berge committed
    group decentralizedSituationTemplates {
tepelmann's avatar
tepelmann committed
        
        template DecentralizedSituation m_denmSitCon(
            template (value) Situation p_sit,
            template (value) Severity p_sev
            ) := {
            trafficFlowEffect := omit,
            situation := p_sit,
            linkedCause := omit,
            severity := p_sev,
            eventCharact := omit,
berge's avatar
berge committed
            vehicleCommonParameters := omit,
tepelmann's avatar
tepelmann committed
            profile := omit
        }
        
        template DecentralizedSituation mw_denmSitCon := {
            trafficFlowEffect := *,
            situation := ?,
            linkedCause := *,
            severity := ?,
            eventCharact := *,
berge's avatar
berge committed
            vehicleCommonParameters := *,
tepelmann's avatar
tepelmann committed
            profile := *
        }
        
        template DecentralizedSituation mw_denmSitCon_Sit(
            template (present) Situation p_sit
            ) modifies mw_denmSitCon := {
            situation := p_sit
        }
        
        template DecentralizedSituation mw_denmSitCon_SitTfe(
            template (present) Situation p_sit,
            template (present) TrafficFlowEffect p_tfe
            ) modifies mw_denmSitCon_Sit := {
                trafficFlowEffect := p_tfe
        }
        
        template DecentralizedSituation mw_denmSitCon_SitLc(
            template (present) Situation p_sit,
            template (present) Situation p_lc
            ) modifies mw_denmSitCon_Sit := {
                linkedCause := p_lc
        }
        
        template DecentralizedSituation mw_denmSitCon_SitEc(
            template (present) Situation p_sit,
            template (present) DecentralizedSituation.eventCharact p_ec
            ) modifies mw_denmSitCon_Sit := {
                eventCharact := p_ec
        }
        
berge's avatar
berge committed
        group situationTemplates {
tepelmann's avatar
tepelmann committed
            
            template Situation m_situation(
                template (value) DENM_PDU_Descriptions.CauseCode p_cause, 
                template (value) SubCauseCode p_subCause
                ) := {
                cause := p_cause,
                subCause := p_subCause
            }
            
            template Situation mw_situation(
                template (present) DENM_PDU_Descriptions.CauseCode p_cause, 
                template (present) SubCauseCode p_subCause
                ) := {
                cause := p_cause,
                subCause := p_subCause
            }
            
berge's avatar
berge committed
            template SubCauseCode mw_anySubCause := ?;
            
berge's avatar
berge committed
        } // end group situationTemplates
tepelmann's avatar
tepelmann committed
        
berge's avatar
berge committed
        group eventCharactTemplates {
tepelmann's avatar
tepelmann committed
            
            //TODO check if depending on kind of ITS station
            template DecentralizedSituation.eventCharact m_eventCharact := {
                eventmobility := true,
                causeType := geographicalRegion,
                relevance := difficultDrivingConditions,
                timeCriticality := false
tepelmann's avatar
tepelmann committed
            }
            
berge's avatar
berge committed
        } // end eventCharactTemplates
tepelmann's avatar
tepelmann committed
        
berge's avatar
berge committed
    } // end group decentralizedSituationTemplates
tepelmann's avatar
tepelmann committed
    
berge's avatar
berge committed
    group decentralizedSituationLocationTemplates {
tepelmann's avatar
tepelmann committed
        
        template DecentralizedSituationLocation m_denmSitLoc(
            template (value) DecentralizedSituationLocation.eventPosition p_eventPosition,
            template (value) DecentralizedSituationLocation.locationRef p_locationRef
            ) := {
            eventPosition := p_eventPosition, 
            locationRef := p_locationRef
        }
        
        template DecentralizedSituationLocation mw_denmSitLoc (
            template (present) DecentralizedSituationLocation.eventPosition p_eventPosition,
            template (present) DecentralizedSituationLocation.locationRef p_locationRef
            ) := {
            eventPosition := p_eventPosition,
            locationRef := p_locationRef
        }
        
        group locationRefTemplates {
tepelmann's avatar
tepelmann committed
            
            template DecentralizedSituationLocation.locationRef m_locationRef := {
                trace := {
                    traceID := 0,
                    waypoints := {}
                }
            }
            
        } // end group locationRefTemplates
tepelmann's avatar
tepelmann committed
        
berge's avatar
berge committed
    } // end group decentralizedSituationLocationTemplates
} // end LibItsDenmTemplates