/**
 * @author	STF 424_ITS_Test_Platform
 * @version    $URL$
 *             $Id$
 */
package org.etsi.its.codec;

import java.util.HashMap;
import java.util.Map;

/** 
 * This is the list of the types introduced by the TTCN-3 libIts modules
 * From 0x01 to 0x1f: Adapter Control port messages
 * From 0x20 to 0x3f: Upper Tester port message
 * From 0x40 to 0x51: LibIts_Interface primitive message identifiers
 * From 0x5e to 0x66: Parameters for GeoNetworking Upper Tester
 * From 0x67 to 0x6f: LibItsIpv6OverGeoNetworking_TypesAndValuesCodec primitive message identifiers
 * From 0x70 to 0x9f: LibItsCam_TypesAndValuesCodec UT field identifiers
 * From 0xa0 to 0xff: CamPdu/DenmPdu identifiers, used by checLdm
 * 
 * Note that 0x00 is not an authorised value
 */
public enum TestAdapterMessageTypeEnum implements IEnumConverter { // FIXME Remove all the other enumerated
	/**
	 * Adapter Control port GeoNetworking primitive message identifier
	 */
	AcGnPrimitive (0x01), 
	/**
	 * Adapter Control port GeoNetworking over IPv6 primitive message identifier
	 */
	AcGn6Primitive (0x02), 
	/**
	 * Adapter Control port GeoNetworking primitive response identifier
	 */
	AcGnResponse (0x03), 
	/**
	 * Adapter Control port GeoNetworking over IPv6 primitive response identifier
	 */
	AcGn6Response (0x04), 
	/**
	 * Adapter Control port GeoNetworking/Start beaconing primitive message identifier
	 */
	AcStartBeaconing (0x05), 
	/**
	 * Adapter Control port GeoNetworking/Stop beaconing primitive message identifier
	 */
	AcStopBeaconing (0x06), 
	/**
	 * Adapter Control port GeoNetworking/Start pass beaconing primitive message identifier
	 */
	AcStartPassBeaconing (0x07), 
	/**
	 * Adapter Control port GeoNetworking primitive/Stop pass beaconing message identifier
	 */
	AcStopPassBeaconing (0x08), 
	/**
	 * Adapter Control port GeoNetworking/Start beaconing for multiple nodes primitive message identifier
	 */
	AcStartBeaconingMultipleNeighbour (0x09), 
	/**
	 * Adapter Control port GeoNetworking/Stop beaconing for multiple nodes primitive message identifier
	 */
	AcStopBeaconingMultipleNeighbour (0x0a), 
	/**
	 * Adapter Control port GeoNetworking/Get long position vector primitive message identifier
	 * 
	 * See ETSI TS 102 636-4-1 - Clause 7.2
	 */
	AcGetLongPosVector (0x0b),
	/**
	 * Adapter Control port GeoNetworking/Get long position vector primitive message identifier
	 * 
	 * See ETSI TS 102 636-4-1 - Clause 7.2
	 */
	LongPosVector (0x0c),
	/**
	 * Used when IUT's nodes table is empty
	 */
	AcGnResponseFailure (0x0d),
	/**
	 * Upper Tester Initialisation message
	 */
	UtInitialize (0x20), 
	/**
	 * Upper Tester trigger message
	 */
	UtTrigger (0x21), 
	/**
	 * Upper Tester check message
	 */
	UtCheck (0x22), 
	/**
	 * Upper Tester event message
	 */
	UtEvent (0x23), 
	/**
	 * Upper Tester response message
	 */
	UtResult (0x24),
	/**
	 * Upper Tester Initialisation message for GeoNetworking
	 */
	UtGNInitialize (0x25),
	/**
	 * Upper Tester event message for GeoNetworking
	 */
	UtGNEvent (0x26),
	/**
	 * GeoNetworking root packet
	 * 
	 * See ETSI TS 102 636-4-1 - Clause 8
	 */
	GeoNetworkingPacket (0x27),
	/**
	 * GeoNetworking Unicat sub packet
	 * 
	 * See ETSI TS 102 636-4-1 - Clause 8.6.2
	 */
	GenerateGeoUnicastMessage (0x28),
	/**
	 * GeoNetworking Broadcat sub packet
	 * 
	 * See ETSI TS 102 636-4-1 - Clause 8.6.5
	 */
	GenerateGeoBroadcastMessage (0x29),
	/**
	 * GeoNetworking Anycat sub packet
	 * 
	 * See ETSI TS 102 636-4-1 - Clause 7.2
	 */
	GenerateGeoAnycastMessage (0x2a),
	/**
	 * GeoNetworking SHB sub packet
	 * 
	 * See ETSI TS 102 636-4-1 - Clause 8.6.4
	 */
	GenerateSHBMessage (0x2b),
	/**
	 * GeoNetworking TSB sub packet
	 * 
	 * See ETSI TS 102 636-4-1 - Clause 8.6.4
	 */
	GenerateTSBMessage (0x2c),
	/**
	 * GeoNetworking ChangePosition sub packet
	 */
	ChangePosition (0x2d),
	/**
	 * Upper Tester Initialisation message for CAM
	 */
	UtCamInitialize (0x2e), 
	/**
	 * Upper Tester Initialisation message for CAM
	 */
	UtCamEvent (0x2f), 
	/**
	 * Upper Tester Initialisation message for BTP
	 */
	UtBtpInitialize (0x30), 
	/**
	 * Upper Tester Initialisation message for BTP
	 */
	UtBtpEvent (0x31), 
	/**
	 * BTP-A header
	 */
	BtpAHeader (0x32), 
	/**
	 * BTP-B header
	 */
	BtpBHeader (0x33), 
	/**
	 * BTP packet container
	 */
	BtpPacket (0x34), 
	/**
	 * Ut/Event BTP-A/B variant field
	 */
	destinationPort (0x35), 
	/**
	 * Ut/Event BTP-A variant field
	 */
	sourcePort (0x36), 
	/**
	 * Ut/Event BTP-B variant field
	 */
	destinationPortInfo (0x37), 
	/**
	 * Ut/Event Payload variant
	 */
	BtpPayload (0x38), 
	
	/**
	 * Upper Tester Initialisation message for DENM
	 */
	UtDenmInitialize (0x39), 
	/**
	 * Upper Tester Initialisation message for DENM
	 */
	UtDenmEvent (0x3a),
	/**
	 * GenerateGeoBroadcastMessage/GenerateGeoAnycastMessage gnAddress field
	 */
	gnAddress (0x3c),
	/**
	 * GenerateGeoBroadcastMessage/GenerateGeoAnycastMessage area field
	 */
	area (0x3d),
	/**
	 * GenerateGeoBroadcastMessage/GenerateGeoAnycastMessage lifetime field
	 */
	lifetime (0x3e),
	/**
	 * GenerateGeoBroadcastMessage/GenerateGeoAnycastMessage/GenerateSHBMessage/GenerateTSBMessage payload field
	 */
	payload (0x3f), 
	/**
	 * IR indication message identifier
	 */
	MacIrInd (0x40), 
	/**
	 * IR request message identifier
	 */
	MacIrReq (0x41), 
	/**
	 * CAM indication message identifier
	 */
	CamInd (0x42), 
	/**
	 * CAM request message identifier
	 */
	CamReq (0x43), 
	/**
	 * DENM indication message identifier
	 */
	DenmInd (0x44), 
	/**
	 * DENM request message identifier
	 */
	DenmReq (0x45), 
	/**
	 * DENM 'situation' field identifier
	 */
	Situation (0x46), 
	/**
	 * DENM 'eventOption' field identifier
	 */
	EventOption (0x47), 
	/**
	 * DENM 'eventTimeFrequency' field identifier
	 */
	EventTimeFrequency (0x48),
	/**
	 * DENM 'eventTimeFrequency' field identifier
	 */
	EventExpirationTimeFrequency (0x49),
	/**
	 * BTP indication message identifier
	 */
	BtpInd (0x4a), 
	/**
	 * BTP request message identifier
	 */
	BtpReq (0x4b), 
	/**
	 * GeoNetworking indication message identifier
	 */
	GeoNetworkingInd (0x4c), 
	/**
	 * GeoNetworking request message identifier
	 */
	GeoNetworkingReq (0x4d), 
	/**
	 * GeoNetworking over IPv6 indication message identifier
	 */
	IPv6OverGeoNetworkingInd (0x4e), 
	/**
	 * GeoNetworking over IPv6 request message identifier
	 */
	IPv6OverGeoNetworkingReq (0x4f), 
	/**
	 * FAST protocol indication message identifier
	 */
	FastInd (0x50), 
	/**
	 * FAST protocol request message identifier
	 */
	FastReq (0x51),
	
	/**
	 * GeoArea record
	 */
	GeoArea (0x5e),
	/**
	 * GeoArea record
	 */
	Area (0x5f),
	/**
	 * GeoArea's shape
	 */
	shape (0x60),
	/**
	 * GeoArea's distance A
	 */
	distanceA (0x61),
	/**
	 * GeoArea's distance B
	 */
	distanceB (0x62),	
	/**
	 * GeoArea's angle
	 */
	angle (0x63),
	/**
	 * TSB's nb hops
	 */
	nbHops (0x64),
    /**
     * TSB's nb hops
     */
	geoAreaPosLatitude (0x65),
    /**
     * TSB's nb hops
     */
	geoAreaPosLongitude (0x66),
	/**
	 * GeoNetworking over IPv6 interface information container
	 */
	AcGn6InterfaceInfoList (0x67), 

	/**
	 * Changes the heading
	 */
	changeHeading (0x70), 
	/**
	 * Changes the position
	 */
	changePosition (0x71), 
	/**
	 * Changes the speed
	 */
	changeSpeed (0x72), 
	/**
	 * Changes the crash status
	 */
	setCrashSignal (0x73), 
	/**
	 * Changes the type of dangerous good according to UN Recommendations on the Transport of Dangerous Goods
	 */
	setDangerousGoodsStatus (0x74), 
	/**
	 * Changes the type of length width precision
	 */
	setLengthWidthPrecision (0x75),
	/**
	 *  Changes the type of distance to stop line
	 */
	setDistanceToStopLine (0x76),
	/**
	 * 
	 */
	setTurnAdvice (0x77), 
	/**
	 * Changes the curvature
	 */
	changeCurvature (0x78), 
	/**
	 * Changes the occupancy status
	 */
	setOccupancy (0x79), 
	/**
	 * Changes the doors status
	 */
	setDoorStatus (0x7a), 
	/**
	 * Changes the light bar status
	 */
	setLightBarStatus (0x7b), 
	/**
	 * Changes the siren status
	 */
	setSireneStatus (0x7c), 
	/**
	 * TODO
	 */
	setTrafficLightPriority (0x7d), 
	/**
	 * TODO
	 */
	setScheduleDeviation (0x7e), 
	/**
	 * TODO
	 */
	setExteriorLightsStatus (0x7f), 
	/**
	 * TODO
	 */
	direction (0x80), 
	/**
	 * TODO
	 */
	distance (0x81), 
	/**
	 * TODO
	 */
	setPtLineDescription (0x82), 
	/**
	 * TODO
	 */
	courseOfJourney (0x83), 
	/**
	 * TODO
	 */
	lineRef (0x84), 
	/**
	 * TODO
	 */
	routeRef (0x85), 
	/**
	 * Check send and LDM receive message
	 */
	checkLdm (0x86), 
	/**
	 * Changes the Situation cause
	 */
	cause (0x87), 
	/**
	 * Changes the Situation sub-cause
	 */
	subCause (0x88), 
	/**
	 * TODO
	 */
	eventTrafficFlowEffect (0x89),
	/**
	 * TODO
	 */
	eventNegation (0x8a), 
	/**
	 * TODO
	 */
	DataVersion (0x8b), 
	/**
	 * TODO
	 */
	eventExpirationTime (0x8c), 
	/**
	 * TODO
	 */
	eventCancellation (0x8d), 
	/**
	 * TODO
	 */
	eventLinkedCause (0x8e), 
	/**
	 * TODO
	 */
	eventCharact (0x8f), // TODO Shall be move in 0x4a
	/**
	 * TODO
	 */
	expirationTime (0x90), 
	/**
	 * TODO
	 */
	frequency (0x91), 
	/**
	 * event mobility description, set to TRUE if the event is in mobility
	 */
	eventmobility (0x92), 
	/**
	 * whether the event is caused by the originator ITS station
	 */
	causeType (0x93), 
	/**
	 * whether the event is physicalling relevant to the  receiving ITS station
	 */
	relevance (0x94), 
	/**
	 * whether the event is time critical road safety event, set to TRUE if it is the case
	 */
	timeCriticality (0x95), 
	
	/**
	 * CAM PDU, header field
	 * See CAM.asn - CamPdu ::= SEQUENCE {...}
	 */
	ItsPduHeader (0xa0), 
	/**
	 * CAM PDU, cam field
	 * See CAM.asn - CamPdu ::= SEQUENCE {...}
	 */
	CoopAwareness (0xa1), 
	/**
	 * Basic characterisation of an ITS station
	 */
	StationCharacteristics (0xa2), 
	/**
	 * 
	 * See DENM.asn - ReferencePosition ::= SEQUENCE {...}
	 */
	ReferencePosition (0xa3), 
	/**
	 * 
	 * See DENM.asn - Longitude ::= SEQUENCE {...}
	 */
	Longitude (0xa4), 
	/**
	 * 
	 * See DENM.asn - Latitude ::= SEQUENCE {...}
	 */
	Latitude (0xa5), 
	/**
	 * 
	 * See CAM.asn - CamParameters ::= SEQUENCE {...}
	 */
	CamParameters (0xa6), 
	/**
	 * Advice given by the navigation for the next turning manoeuvre
	 * 
	 * See ETSI TS 102 637-3
	 */
	TurnAdvice (0xa7), 
	/**
	 * TODO
	 */
	VehicleCommonParameters (0xa8), 
	/**
	 * TODO
	 */
	PosConfidenceEllipse (0xa9), 
	/**
	 * Data element represents the signed change of the node heading
	 * 
	 * See ETSI TS 102 637-3
	 */
	YawRate (0xaa), 
	/**
	 * TODO
	 */
	BasicVehicle (0xab), 
	/**
	 * TODO
	 */
	EmergencyVehicle (0xac), 
	/**
	 * TODO
	 */
	PublicTransportVehicle (0xad), 
	/**
	 * ItsPduHeader field
	 */
	protocolVersion (0xb0), 
	/**
	 * ItsPduHeader field
	 */
	messageID (0xb1), 
	/**
	 * ItsPduHeader field
	 */
	generationTime (0xb2), 
	/**
	 * ITS station identifier
	 */
	stationID (0xb3), 
	/**
	 * StationCharacteristics field
	 */
	mobileItsStation (0xb4), 
	/**
	 * StationCharacteristics field
	 */
	privateItsStation (0xb5), 
	/**
	 * StationCharacteristics field
	 */
	physicalRelevantItsStation (0xb6), 
	/**
	 * Longitue/latitude field
	 */
	hemisphere (0xb7), 
	/**
	 * Longitue/latitude field
	 */
	degree (0xb8), 
	/**
	 * StationCharacteristics field
	 */
	elevation (0xb9), 
	/**
	 * StationCharacteristics field
	 */
	heading (0xba), 
	/**
	 * Name of the referenced street
	 * 
	 * See ETSI TS 102 637-3
	 */
	streetName (0xbb), 
	/**
	 * StationCharacteristics field
	 */
	positionConfidence (0xbc), 
	/**
	 * StationCharacteristics field
	 */
	elevationConfidence (0xbd), 
	/**
	 * StationCharacteristics field
	 */
	roadSegmentID (0xbe), 
	/**
	 * TODO
	 */
	vehicleType (0xbf), 
	/**
	 * TODO
	 */
	stationLength (0xc0), 
	/**
	 * TODO
	 */
	stationLengthConfidence (0xc1), 
	/**
	 * The data element describes the maximum width of the station. It is given by the minimum passage width needed for a station with all factory installed equipment
	 * 
	 * See ETSI TS 102 637-3
	 */
	stationWidth (0xc2), 
	/**
	 * TODO
	 */
	stationWidthConfidence (0xc3), 
	/**
	 * Speed of a single vehicle in direction of heading
	 * 
	 * See ETSI TS 102 637-3
	 */
	vehicleSpeed (0xc4), 
	/**
	 * Speed of a single vehicle in direction of heading
	 * 
	 * See ETSI TS 102 637-3
	 */
	vehicleSpeedConfidence (0xc5), 
	/**
	 * TODO
	 */
	longAcceleration (0xc6), 
	/**
	 * TODO
	 */
	longAccelerationConfidence (0xc7), 
	/**
	 * TODO
	 */
	accelerationControl (0xc8), 
	/**
	 * Data element represents the signed change of the node heading
	 * 
	 * See ETSI TS 102 637-3
	 */
	yawDirection (0xc9), 
	/**
	 * Data element represents the signed change of the node heading
	 * 
	 * See ETSI TS 102 637-3
	 */
	yawRateValue (0xca), 
	/**
	 * Data element represents the signed change of the node heading
	 * 
	 * See ETSI TS 102 637-3
	 */
	yawRateConfidence (0xcb), 
	/**
	 * TODO
	 */
	exteriorLights (0xcc), 
	/**
	 * TODO
	 */
	distanceToStopLine (0xcd), 
	/**
	 * TODO
	 */
	occupancy (0xce), 
	/**
	 * TODO
	 */
	doorOpen (0xcf), 
	/**
	 * TODO
	 */
	semiMajorConfidence (0xd0), 
	/**
	 * TODO
	 */
	semiMinorConfidence (0xd1), 
	/**
	 * TODO
	 */
	semiMajorOrientation (0xd2), 
	/**
	 * TODO
	 */
	curvature (0xd3), 
	/**
	 * TODO
	 */
	curvatureChange (0xd4), 
	/**
	 * TODO
	 */
	curvatureConfidence (0xd5), 
	/**
	 * TODO
	 */
	crashStatus (0xd6), 
	/**
	 * TODO
	 */
	headingConfidence (0xd7), 
	/**
	 * TODO
	 */
	dangerousGoods (0xd8), 
	/**
	 * TODO
	 */
	lightBarInUse (0xd9), 
	/**
	 * TODO
	 */
	sireneInUse (0xda), 
	/**
	 * TODO
	 */
	emergencyResponseType (0xdb), 
	/**
	 * TODO
	 */
	publicVehicleType (0xdc), 
	/**
	 * TODO
	 */
	scheduleDeviation (0xdd), 
	/**
	 * TODO
	 */
	trafficLightPriority (0xde), 
	/**
	 * TODO
	 */
	camParameters (0xdf), 
	/**
	 * TODO
	 */
	profileDependent (0xe0),
	/**
	 * TODO
	 */
	turnAdvice (0xe1),
	/**
	 * TODO
	 */
	ActionID (0xe2),
	/**
	 * TODO
	 */
	sequenceNo (0xe3),
	/**
	 * TODO
	 */
	eventSeverity (0xe4),
	/**
	 * TODO
	 */
	eventReliability (0xe5),
	/**
	 * TODO
	 */
	UpdateEventExpiry (0xe6), // FIXME Try to improve double entry like UpdateEventExpiry and updateEventExpiry
	/**
	 * TODO
	 */
	updateEventExpiry (0xe7),
	/**
	 * TODO
	 */
	eventActionId (0xe8),
	/**
	 * TODO
	 */
	expiryTime (0xe9), 
	/**
	 * TODO
	 */
	receptionTime (0xff); // TODO: To be formatted properly

	/**
	 * Used by the constructor to convert enumerate item into byte
	 */
	private final byte _value;

	/**
	 * Used by to convert numerical value into a TestAdapterMessageTypeEnum item
	 */
	private static final Map<Byte, TestAdapterMessageTypeEnum> _lookup = new HashMap<Byte, TestAdapterMessageTypeEnum>();

	/**
	 * Used by to convert String value into the byte value of the TestAdapterMessageTypeEnum item
	 */
	private static final Map<String, Byte> _frameId = new HashMap<String, Byte>();

	/**
	 * Constructor
	 * @param value The byte value of the TestAdapterMessageTypeEnum value to be created
	 */
	private TestAdapterMessageTypeEnum(int value) {
		_value = (byte) value;
	}

	/** 
	 * This method converts a JAVA enumerated item into a byte value
	 * 
	 * @return The byte value of the JAVA enumerated item
	 */
	@Override
	public byte convert() {
		return _value;
	}

	/** 
	 * This method converts a JAVA enumerated item in string format into its associated byte value
	 * 
	 * @param value The JAVA enumerated item in string format
	 * @return The byte value of the JAVA enumerated item
	 */
	public static byte convert(String value) {
		return _frameId.get(value);
	}

	/**
	 * This method converts the specified numerical value into a TestAdapterMessageTypeEnum value
	 * 
	 * @param value The numerical value to convert
	 * @return A TestAdapterMessageTypeEnum value
	 */
	public static TestAdapterMessageTypeEnum valueOf(byte value) {
		return _lookup.get(new Byte(value));
	}

	/**
	 * Static constructor
	 */
	static {
		for (TestAdapterMessageTypeEnum item : TestAdapterMessageTypeEnum.values()) {
			_lookup.put(new Byte(item._value), item);
			_frameId.put(item.name(), new Byte(item.convert()));
		}
	} // End of static Constructor
} // End of enum TestAdapterMessageTypeEnum

