Functions

The following functions are available globally.

  • Calculates the bearing between two coordinates

    Declaration

    Swift

    func calculateBearing(from: CLLocationCoordinate2D, to: CLLocationCoordinate2D) -> Double

    Parameters

    from

    CLLocationCoordinate2D

    to

    CLLocationCoordinate2D

    Return Value

    The bearing between the two input coordinates

  • Checks if the vsign entering direction (determined using the bearing) matches with the one required by the vSign, including a tolerance threshold

    Declaration

    Swift

    func checkBearing(signalBearing: Double, currBearing: Double, tolerance: Int) -> Bool

    Parameters

    signalBearing

    Entering bearing associate to the vSign

    currBearing

    Bearing of the user entering the vSign

    tolerance

    Value (in degreees) used as the tolerance threshold.

    Return Value

    Returns true or false if the user entering bearing matches with the bearing assigned to the vSign

  • Given a list of vSigns, find the entered and the matched ones, based on the input location

    Declaration

    Swift

    func findMatchingSignals(signals: [QPSignal],
    						 currLocation: CLLocation,
    						 currBearing: Double,
    						 tolerance: Int,
    						 enableBearingChecks: Bool = true,
    						 notifiedTimeoutSeconds: Int = 60 * 5
    	) -> VSignScanResults
  • Helper function to convert degrees to radians

    Declaration

    Swift

    func deg2rad(_ number: Double) -> Double
  • Helper function to convert radians to degrees

    Declaration

    Swift

    func rad2deg(_ number: Double) -> Double