You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Gets or sets the size of the <see cref="UsbStream"/> input buffer.
75
+
/// </summary>
76
+
/// <value>The size of the input buffer. The default is 256.</value>
77
+
/// <exception cref="ArgumentOutOfRangeException">The <see cref="ReadBufferSize"/> value is less than or equal to zero.</exception>
78
+
/// <remarks>
79
+
/// <para>
80
+
/// - There is only one work buffer which is used for transmission and reception.
81
+
/// </para>
82
+
/// <para>
83
+
/// - When the <see cref="UsbStream"/> is <see cref="UsbClient.CreateUsbStream(Guid, string)"/> the driver will try to allocate the requested memory for the buffer. On failure to do so, an <see cref="OutOfMemoryException"/> exception will be throw and the <see cref="UsbClient.CreateUsbStream(Guid, string)"/> operation will fail.
84
+
/// </para>
85
+
/// </remarks>
86
+
publicintReadBufferSize
87
+
{
88
+
get
89
+
{
90
+
return_bufferSize;
91
+
}
92
+
93
+
set
94
+
{
95
+
if(value<=0)
96
+
{
97
+
thrownewArgumentOutOfRangeException();
98
+
}
99
+
100
+
_bufferSize=value;
101
+
}
102
+
}
103
+
40
104
/// <summary>
41
105
/// Gets or sets the number of milliseconds before a time-out occurs when a read operation does not finish.
42
106
/// </summary>
@@ -54,6 +118,22 @@ public override int ReadTimeout
54
118
}
55
119
}
56
120
121
+
/// <summary>
122
+
/// Gets or sets the number of bytes in the internal input buffer before a <see cref="DataReceived"/> event occurs.
123
+
/// </summary>
124
+
/// <value>The number of bytes in the internal input buffer before a <see cref="DataReceived"/> event is fired. The default is 1.</value>
125
+
/// <exception cref="ArgumentOutOfRangeException">The <see cref="ReceivedBytesThreshold"/> value is less than or equal
126
+
/// to zero.</exception>
127
+
publicintReceivedBytesThreshold
128
+
{
129
+
get=>_receivedBytesThreshold;
130
+
131
+
set
132
+
{
133
+
NativeReceivedBytesThreshold(value);
134
+
}
135
+
}
136
+
57
137
/// <summary>
58
138
/// Gets or sets the number of milliseconds before a time-out occurs when a write operation does not finish.
59
139
/// </summary>
@@ -75,11 +155,20 @@ internal UsbStream(
75
155
GuidclassId,
76
156
stringname)
77
157
{
158
+
// at this time there is support for a single instance of the UsbStream
159
+
if(_streamCreated)
160
+
{
161
+
thrownewInvalidOperationException();
162
+
}
163
+
78
164
// need to convert GUID to proper format to help processing at native end
0 commit comments