ScanDeviceManager Attach

Attach to a device using the unique device name. This method will be blocked until connection is established or failed. Attach method will not interfere with the running operations in the device.

 

public void Attach(string deviceUniqueName)

 

Return value

void  

 

Parameters

string deviceUniqueName The unique name of the device.

 

Exceptions

DeviceNotFoundException Throws when the device with the given name is not found
DeviceAlreadyInUseException Throws when the device is already connected to another client
DeviceCommunicationFailureException Throws when the communication with the device is failed
DeviceFailureException Throws when the device failed to connect due to unknown reason

 

Example

Copy
try
{
    scanDeviceManager.Attach(DeviceUniqueName);
}

#region Exceptions
catch (DeviceNotFoundException)
{
    MessageBox.Show("Device could not be found", "Custom Canvas");
}
catch (DeviceAlreadyInUseException)
{
    MessageBox.Show("Device is already in use. Please try after sometime", "Custom Canvas");
}
catch (DeviceCommunicationFailureException ex3)
{
    MessageBox.Show("Communication with the device failed. Please try after sometime.\nMessage: " + ex3.DeviceMessage, "Custom Canvas");
}
catch (DeviceFailureException ex4)
{
    MessageBox.Show("Failed to connect with the device.\nMessage: " + ex4.DeviceMessage, "Custom Canvas");
}
#endregion