Commit da7b45e2 authored by mogos's avatar mogos
Browse files

added simple possition validation

parent 82d0e83b
Loading
Loading
Loading
Loading
+43 −14
Original line number Diff line number Diff line
@@ -150,20 +150,33 @@ module LibItsECall_Functions {
        // Check possition information
        //
        
        //TODO implement
//		  if (not PX_IGNORE_MSD_POSITION) {
//			  mw_msdMessage.msdStructure.control_.positionCanBeTrusted := ?;
//			  mw_msdMessage.msdStructure.vehicleLocation := ?;
//			  mw_msdMessage.msdStructure.vehicleDirection := ?;
//                
//			  if (PC_MSD_recentVehicleLocationN1) {
//				  mw_msdMessage.msdStructure.recentVehicleLocationN1 := PX_RECENT_VEHICLE_LOCATION_N1;
//			  }
//
//			  if (PC_MSD_recentVehicleLocationN2) {
//				  mw_msdMessage.msdStructure.recentVehicleLocationN2 := PX_RECENT_VEHICLE_LOCATION_N2;
//			  }
//		  }
        if (not PX_IGNORE_MSD_POSITION) {
            var Int32 v_actualLat  := v_receivedMSDMessage.msdStructure.vehicleLocation.positionLatitude;
            var Int32 v_actualLong := v_receivedMSDMessage.msdStructure.vehicleLocation.positionLongitude;
            
            var Int32 v_latLower, v_latUpper;
            var Int32 v_longLower, v_longUpper;
            
            if (not v_receivedMSDMessage.msdStructure.control_.positionCanBeTrusted) {
                f_stopIvsTestcase(fail, "MSD possition cannot be trusted");
            }
            
            v_latLower := f_coordinateLowerBound(PX_VEHICLE_LOCATION.positionLatitude);
            v_latUpper := f_coordinateUpperBound(PX_VEHICLE_LOCATION.positionLatitude);
            
            if (v_actualLat < v_latLower or v_latUpper < v_actualLat) {
                log(v_latLower, v_actualLat, v_latUpper);
                f_stopIvsTestcase(fail, "MSD possitionLatitude outside of bounds");
            }
            
            v_longLower := f_coordinateLowerBound(PX_VEHICLE_LOCATION.positionLongitude);
            v_longUpper := f_coordinateUpperBound(PX_VEHICLE_LOCATION.positionLongitude);
            
            if (v_actualLong < v_longLower or v_longUpper < v_actualLong) {
                log(v_longLower, v_actualLong, v_longUpper);
                f_stopIvsTestcase(fail, "MSD positionLongitude outside of bounds");
            }
        }
        
        setverdict(pass, "Correct MSD received");
        
@@ -974,6 +987,22 @@ module LibItsECall_Functions {
        }
    }
    
    group position {
        /**
         * Return the lower bound to be used when measuring coordinate values
         */
        function f_coordinateLowerBound(Int32 coordinate) return Int32 {
            return coordinate - c_coordinate_tolerance;
        }

        /**
         * Return the lower bound to be used when measuring coordinate values
         */
        function f_coordinateUpperBound(Int32 coordinate) return Int32 {
            return coordinate + c_coordinate_tolerance;
        }
    }
    
    group psap {
        /**
         * @desc  Set the eCall message to be sent by simulated IVS
+9 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ module LibItsECall_TypesAndValues {

        type integer PositiveInteger (1 .. infinity);
        type integer UInt8 (0 .. 255);
        type integer Int32 (-2147483648..2147483647);
        
        type enumerated SimulatorModeType {PSAP, IVS};
        type integer AckNumberType (0 .. 20);
@@ -762,4 +763,11 @@ module LibItsECall_TypesAndValues {
         */
        const float c_ctp_1_1_17_4_call_back_delay := 55.0 * 60.0;
    }
    
    group position {
        /**
         * @desc Tolerance in milliarcsec for coordinate values
         */
        const Int32 c_coordinate_tolerance := 300;
    }
}