ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Core.DeviceLocation Namespace / DeviceLocationService Class / IsDeviceConnected Method
Example

In This Topic
    IsDeviceConnected Method (DeviceLocationService)
    In This Topic
    Returns the connection status of the selected location source.
    Syntax
    public bool IsDeviceConnected()
    Public Function IsDeviceConnected() As Boolean

    Return Value

    returns true if CurrentSource is connected; false if no connected.
    Example
    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

    ArcGIS Pro version: 3 or higher.
    See Also