// Copyright © 2006-2009 Travis Robinson. All rights reserved. // // website: sourceforge.net/projects/libusbdotnet/ // e-mail: libusbdotnet@gmail.com // // This program is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by the // Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License // for more details. // // You should have received a copy of the GNU General Public License along // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. or // visit www.gnu.org. // // namespace LibUsbDotNet.Main { /// Contains the locking strategy for a and it's associated endpoints. /// Locking styles are use to change the way proccess/threads are allowed to communcate with a USB device and/or endpoints. /// See the , , and enumerations for a description of the various locking styles. /// public class UsbLockStyle { private ControlEpLockType mControlEpLock; private DataEpLockType mDataEpLock; private DeviceLockType mDeviceLockType; private int mEndpointControlTimeout; private int mEndpointLockTimeout; /// /// Create a device lock style class. /// /// See . /// See . /// See . public UsbLockStyle(DeviceLockType deviceLockType, ControlEpLockType controlEpLockType, DataEpLockType dataEpLockType) : this(deviceLockType, controlEpLockType, dataEpLockType, 1000, 1000) { } /// /// Create a device lock style class. /// /// See . /// See . /// See . /// Number of milliseconds to wait for an endpoint 0 lock before returning a timeout errorcode. /// Number of milliseconds to wait for an endpoint lock before returning a timeout errorcode. public UsbLockStyle(DeviceLockType deviceLockType, ControlEpLockType controlEpLockType, DataEpLockType dataEpLockType, int endpoint0Timeout, int endpointLockTimeout) { mDeviceLockType = deviceLockType; mControlEpLock = controlEpLockType; mDataEpLock = dataEpLockType; mEndpointControlTimeout = endpoint0Timeout; mEndpointLockTimeout = endpointLockTimeout; } /// /// Locking strategy for the device. See for more information. /// public DeviceLockType DeviceLockType { get { return mDeviceLockType; } set { mDeviceLockType = value; } } /// /// Locking strategy for Endpoint0 operations. This property will generally always be , See for more information. /// public ControlEpLockType ControlEpLock { get { return mControlEpLock; } set { mControlEpLock = value; } } /// /// Locking strategy for the endpoint operations. See for more information. /// public DataEpLockType DataEpLock { get { return mDataEpLock; } set { mDataEpLock = value; } } /// /// Timeout value used when attempting to aquire an when is set to a value other than . /// public int EndpointControlTimeout { get { return mEndpointControlTimeout; } set { mEndpointControlTimeout = value; } } /// /// Maximum time(ms) to wait for an endpoint to become idle before returning a error code. /// /// /// This property has no affect unless the includes the enumeration. /// public int EndpointLockTimeout { get { return mEndpointLockTimeout; } set { mEndpointLockTimeout = value; } } } }