ArcGIS Pro 3.1 API Reference Guide
ArcGIS.Desktop.Core.DeviceLocation Namespace / DeviceLocationService Class / Open Method
A DeviceLocationSource.
A DeviceLocationProperties.
Example

In This Topic
    Open Method (DeviceLocationService)
    In This Topic
    Connects to a new device location source such as a GPS/GNSS device via a COM port. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Value cannot be null: source
    DeviceLocationSource ComPort cannot be null
    Remarks
    At a minimum, a ComPort must be specified in the DeviceLocationSource parameter.
    Example
    var sp = new SerialPortDeviceLocationSource()
    {
      ComPort = "COM4",
    };
                
    await QueuedTask.Run(() =>
    {
      DeviceLocationService.Instance.Open(sp);
    });
    Connect to a Device Location Source
    var newSrc = new SerialPortDeviceLocationSource();
    
    //Specify the COM port the device is connected to
    newSrc.ComPort = "Com3";
    newSrc.BaudRate = 4800;
    newSrc.AntennaHeight = 3;  // meters
                               //fill in other properties as needed
    
    var props = new DeviceLocationProperties();
    props.AccuracyThreshold = 10;   // meters
    
    // jump to the background thread
    await QueuedTask.Run(() =>
    {
      //open the device
      DeviceLocationService.Instance.Open(newSrc, props);
    });
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also