AccuracyThreshold Property
Gets and sets the acceptable accuracy threshold in meters.
public double AccuracyThreshold {get; set;}
Public Property AccuracyThreshold As Double
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);
});
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;
Update Properties on the Current Device Location Source
await QueuedTask.Run(() =>
{
var dlProps = DeviceLocationService.Instance.GetProperties();
//Change the accuracy threshold
dlProps.AccuracyThreshold = 22.5; // meters
DeviceLocationService.Instance.UpdateProperties(dlProps);
});
Target Platforms: Windows 11, Windows 10
ArcGIS Pro version: 3 or higher.