public static AJI_DEVICE[] GetDevices(IntPtr Chain) { try { if (aji_lock_chain(Chain, 1000) != AJI_ERROR.E_NONE) { throw new JTAGClientException("Error locking chain"); } //If we have E_IN_USE, device chain scan still works fine AJI_ERROR err = aji_scan_device_chain(Chain); if (err != AJI_ERROR.E_NONE && err != AJI_ERROR.E_IN_USE) { throw new JTAGClientException("Error scanning chain"); } uint numDevices = 0; if (aji_read_device_chain(Chain, ref numDevices, null, true) != AJI_ERROR.E_GOT_NUM) { throw new JTAGClientException("Error reading devices"); } AJI_DEVICE[] devices = new AJI_DEVICE[numDevices]; if (aji_read_device_chain(Chain, ref numDevices, devices, true) != AJI_ERROR.E_NONE) { throw new JTAGClientException("Error reading devices"); } return(devices); } finally { aji_unlock_chain(Chain); } }
public static AJI_DEVICE[] GetDevices(IntPtr Chain) { try { if (aji_lock_chain(Chain, 1000) != AJI_ERROR.E_NONE) { throw new JTAGClientException("Error locking chain"); } //If we have E_IN_USE, device chain scan still works fine AJI_ERROR err = aji_scan_device_chain(Chain); if (err != AJI_ERROR.E_NONE && err != AJI_ERROR.E_IN_USE) { throw new JTAGClientException("Error scanning chain"); } uint numDevices = 0; if (aji_read_device_chain(Chain, ref numDevices, null, true) != AJI_ERROR.E_GOT_NUM) { throw new JTAGClientException("Error reading devices"); } AJI_DEVICE[] devices = new AJI_DEVICE[numDevices]; if (aji_read_device_chain(Chain, ref numDevices, devices, true) != AJI_ERROR.E_NONE) { throw new JTAGClientException("Error reading devices"); } return devices; } finally { aji_unlock_chain(Chain); } }