ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Core.DeviceLocation Namespace / DeviceLocationService Class / GetSource Method
Example

In This Topic
    GetSource Method (DeviceLocationService)
    In This Topic
    Returns the device location source currently in use.
    Syntax
    public DeviceLocationSource GetSource()
    Public Function GetSource() As DeviceLocationSource

    Return Value

    Example
    Get the Current Device Location Source
    var source = DeviceLocationService.Instance.GetSource();
    if (source == null)
    {
      //There is no current source
    }
    
    Get Current Device Location Source and Properties
    bool isConnected = DeviceLocationService.Instance.IsDeviceConnected();
    
    var src = DeviceLocationService.Instance.GetSource();
    
    if (src is SerialPortDeviceLocationSource serialPortSrc)
    {
      var port = serialPortSrc.ComPort;
      var antennaHeight = serialPortSrc.AntennaHeight;
      var dataBits = serialPortSrc.DataBits;
      var baudRate = serialPortSrc.BaudRate;
      var parity = serialPortSrc.Parity;
      var stopBits = serialPortSrc.StopBits;
    
      // retrieving spatial reference needs the MCT
      var sr = await QueuedTask.Run(() =>
      {
        return serialPortSrc.GetSpatialReference();
      });
    
    }
    var dlProps = DeviceLocationService.Instance.GetProperties();
    var accuracy = dlProps.AccuracyThreshold;
    
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also