-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathGXTerminal.cs
More file actions
2319 lines (2216 loc) · 72.4 KB
/
GXTerminal.cs
File metadata and controls
2319 lines (2216 loc) · 72.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//
// --------------------------------------------------------------------------
// Gurux Ltd
//
//
//
// Filename: $HeadURL$
//
// Version: $Revision$,
// $Date$
// $Author$
//
// Copyright (c) Gurux Ltd
//
//---------------------------------------------------------------------------
//
// DESCRIPTION
//
// This file is a part of Gurux Device Framework.
//
// Gurux Device Framework is Open Source 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; version 2 of the License.
// Gurux Device Framework 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.
//
// This code is licensed under the GNU General Public License v2.
// Full text may be retrieved at http://www.gnu.org/licenses/gpl-2.0.txt
//---------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using Gurux.Common;
using System.IO;
using Gurux.Shared;
using System.Xml;
using System.Diagnostics;
using System.IO.Ports;
using System.Reflection;
using System.Threading;
using Gurux.Terminal.Properties;
namespace Gurux.Terminal
{
enum Progress
{
None,
Connecting,
Connected
}
/// <summary>
/// A media component that enables communication of Terminal port.
/// See help in http://www.gurux.org/index.php?q=Gurux.Terminal
/// </summary>
public class GXTerminal : IGXMedia2, IGXVirtualMedia, INotifyPropertyChanged, IDisposable
{
bool IsVirtual, VirtualOpen;
int hangsUpDelay = 0;
int connectionWaitTime = 60000;
int commandWaitTime = 3000;
string initializeCommands = null;
private object m_sync = new object();
Progress progress;
bool server;
string phoneNumber;
TraceLevel trace;
readonly static Dictionary<string, List<int>> BaudRates = new Dictionary<string, List<int>>();
object m_Eop;
readonly GXSynchronousMediaBase m_syncBase;
UInt64 bytesSent, bytesReceived;
readonly object synchronous = new object();
readonly object baseLock = new object();
internal System.IO.Ports.SerialPort m_base = new System.IO.Ports.SerialPort();
ReceiveThread receiver;
Thread receiverThread;
/// <summary>
/// Get baud rates supported by given Terminal port.
/// </summary>
static public int[] GetAvailableBaudRates(string portName)
{
if (BaudRates.ContainsKey(portName.ToLower()))
{
return BaudRates[portName.ToLower()].ToArray();
}
if (string.IsNullOrEmpty(portName))
{
portName = GXTerminal.GetPortNames()[0];
}
List<int> items = new List<int>();
BaudRates[portName.ToLower()] = items;
try
{
Int32 value = 0;
using (SerialPort port = new SerialPort(portName))
{
port.Open();
FieldInfo fi = port.BaseStream.GetType().GetField("commProp", BindingFlags.Instance | BindingFlags.NonPublic);
if (fi != null)
{
object p = fi.GetValue(port.BaseStream);
value = (Int32)p.GetType().GetField("dwSettableBaud", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).GetValue(p);
}
}
if (value != 0)
{
if ((value & 0x1) != 0)
{
items.Add(75);
}
if ((value & 0x2) != 0)
{
items.Add(110);
}
if ((value & 0x8) != 0)
{
items.Add(150);
}
if ((value & 0x10) != 0)
{
items.Add(300);
}
if ((value & 0x20) != 0)
{
items.Add(600);
}
if ((value & 0x40) != 0)
{
items.Add(1200);
}
if ((value & 0x80) != 0)
{
items.Add(1800);
}
if ((value & 0x100) != 0)
{
items.Add(2400);
}
if ((value & 0x200) != 0)
{
items.Add(4800);
}
if ((value & 0x400) != 0)
{
items.Add(7200);
}
if ((value & 0x800) != 0)
{
items.Add(9600);
}
if ((value & 0x1000) != 0)
{
items.Add(14400);
}
if ((value & 0x2000) != 0)
{
items.Add(19200);
}
if ((value & 0x4000) != 0)
{
items.Add(38400);
}
if ((value & 0x8000) != 0)
{
items.Add(56000);
}
if ((value & 0x40000) != 0)
{
items.Add(57600);
}
if ((value & 0x20000) != 0)
{
items.Add(115200);
}
if ((value & 0x10000) != 0)
{
items.Add(128000);
}
if ((value & 0x10000000) != 0) //Programmable baud rate.
{
items.Add(0);
}
}
}
catch
{
items.Clear();
}
//Add default baud rates.
if (items.Count == 0)
{
items.Add(300);
items.Add(600);
items.Add(1800);
items.Add(2400);
items.Add(4800);
items.Add(9600);
items.Add(19200);
items.Add(38400);
items.Add(0); //Programmable baud rate.
}
return items.ToArray();
}
/// <summary>
/// Constructor.
/// </summary>
public GXTerminal()
{
ConfigurableSettings = AvailableMediaSettings.All;
m_syncBase = new GXSynchronousMediaBase(1024);
//Events are not currently implemented in Mono's Terminal port.
if (Environment.OSVersion.Platform != PlatformID.Unix)
{
m_base.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(GXTerminal_DataReceived);
}
}
internal void NotifyError(Exception ex)
{
if (m_OnError != null)
{
m_OnError(this, ex);
}
if (trace >= TraceLevel.Error && m_OnTrace != null)
{
m_OnTrace(this, new TraceEventArgs(TraceTypes.Error, ex, null));
}
}
void NotifyMediaStateChange(MediaState state)
{
if (trace >= TraceLevel.Info && m_OnTrace != null)
{
m_OnTrace(this, new TraceEventArgs(TraceTypes.Info, state, null));
}
if (m_OnMediaStateChange != null)
{
m_OnMediaStateChange(this, new MediaStateEventArgs(state));
}
}
/// <summary>
/// What level of tracing is used.
/// </summary>
public TraceLevel Trace
{
get
{
return trace;
}
set
{
trace = m_syncBase.Trace = value;
}
}
/// <summary>
/// Gets the underlying System.IO.Stream object for a System.IO.Ports.SerialPort object.
/// </summary>
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Browsable(false)]
public Stream BaseStream
{
get
{
lock (baseLock)
{
return m_base.BaseStream;
}
}
}
private void HandleReceivedData(int index, byte[] buff, int totalCount)
{
if (totalCount != 0 && trace == TraceLevel.Verbose && m_OnTrace != null)
{
TraceEventArgs arg = new TraceEventArgs(TraceTypes.Received, m_syncBase.m_Received, index, totalCount, null);
m_OnTrace(this, arg);
}
lock (m_syncBase.receivedSync)
{
if (totalCount != 0 && Eop != null) //Search Eop if given.
{
if (Eop is Array)
{
foreach (object eop in (Array)Eop)
{
totalCount = Gurux.Common.GXCommon.IndexOf(m_syncBase.m_Received, Gurux.Common.GXCommon.GetAsByteArray(eop), index, m_syncBase.receivedSize);
if (totalCount != -1)
{
break;
}
}
}
else
{
totalCount = Gurux.Common.GXCommon.IndexOf(m_syncBase.m_Received, Gurux.Common.GXCommon.GetAsByteArray(Eop), index, m_syncBase.receivedSize);
}
}
}
if (this.IsSynchronous)
{
if (totalCount != -1)
{
m_syncBase.receivedEvent.Set();
}
}
else if (this.m_OnReceived != null)
{
if (totalCount != -1)
{
buff = new byte[m_syncBase.receivedSize];
Array.Copy(m_syncBase.m_Received, buff, m_syncBase.receivedSize);
m_syncBase.receivedSize = 0;
m_OnReceived(this, new ReceiveEventArgs(buff, m_base.PortName));
}
else
{
m_OnReceived(this, new ReceiveEventArgs(buff, m_base.PortName));
}
}
}
internal void GXTerminal_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{
try
{
int count = 0;
int index = m_syncBase.receivedSize;
byte[] buff = null;
int totalCount = 0;
Thread.Sleep((int)ReceiveDelay);
while (IsOpen && (count = m_base.BytesToRead) != 0)
{
totalCount += count;
buff = new byte[count];
m_base.Read(buff, 0, count);
m_syncBase.AppendData(buff, 0, count);
bytesReceived += (uint)count;
}
HandleReceivedData(index, buff, totalCount);
}
catch (Exception ex)
{
if (this.IsSynchronous)
{
m_syncBase.Exception = ex;
m_syncBase.receivedEvent.Set();
}
else
{
NotifyError(ex);
}
}
}
/// <summary>
/// Used baud rate for communication.
/// </summary>
/// <remarks>Can be changed without disconnecting.</remarks>
[Browsable(true)]
[DefaultValue(9600)]
[MonitoringDescription("BaudRate")]
public int BaudRate
{
get
{
if (IsVirtual && m_OnGetPropertyValue != null)
{
string value = m_OnGetPropertyValue("BaudRate");
if (value != null)
{
return int.Parse(value);
}
}
lock (baseLock)
{
return m_base.BaudRate;
}
}
set
{
lock (baseLock)
{
bool change = m_base.BaudRate != value;
m_base.BaudRate = value;
if (change)
{
NotifyPropertyChanged("BaudRate");
}
}
}
}
/// <summary>
/// True if the port is in a break state; otherwise, false.
/// </summary>
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Browsable(false)]
public bool BreakState
{
get
{
if (IsVirtual && m_OnGetPropertyValue != null)
{
string value = m_OnGetPropertyValue("BreakState");
if (value != null)
{
return bool.Parse(value);
}
}
lock (baseLock)
{
return m_base.BreakState;
}
}
set
{
bool change;
lock (baseLock)
{
change = m_base.BreakState != value;
m_base.BreakState = value;
}
if (change)
{
NotifyPropertyChanged("BreakState");
}
}
}
/// <summary>
/// Gets the number of bytes in the receive buffer.
/// </summary>
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Browsable(false)]
public int BytesToRead
{
get
{
lock (baseLock)
{
return m_base.BytesToRead;
}
}
}
/// <summary>
/// Gets the number of bytes in the send buffer.
/// </summary>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public int BytesToWrite
{
get
{
lock (baseLock)
{
return m_base.BytesToWrite;
}
}
}
/// <summary>
/// Gets the state of the Carrier Detect line for the port.
/// </summary>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool CDHolding
{
get
{
lock (baseLock)
{
return m_base.CDHolding;
}
}
}
/// <summary>
/// Gets the state of the Clear-to-Send line.
/// </summary>
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Browsable(false)]
public bool CtsHolding
{
get
{
lock (baseLock)
{
return m_base.CtsHolding;
}
}
}
/// <summary>
/// Gets or sets the standard length of data bits per byte.
/// </summary>
[MonitoringDescription("DataBits")]
[DefaultValue(8)]
[Browsable(true)]
public int DataBits
{
get
{
if (IsVirtual && m_OnGetPropertyValue != null)
{
string value = m_OnGetPropertyValue("DataBits");
if (value != null)
{
return int.Parse(value);
}
}
lock (baseLock)
{
return m_base.DataBits;
}
}
set
{
bool change;
lock (baseLock)
{
change = m_base.DataBits != value;
m_base.DataBits = value;
}
if (change)
{
NotifyPropertyChanged("DataBits");
}
}
}
/// <summary>
/// Gets or sets a value indicating whether null bytes are ignored when transmitted between the port and the receive buffer.
/// </summary>
[Browsable(true)]
[DefaultValue(false)]
[MonitoringDescription("DiscardNull")]
public bool DiscardNull
{
get
{
if (IsVirtual && m_OnGetPropertyValue != null)
{
string value = m_OnGetPropertyValue("DiscardNull");
if (value != null)
{
return bool.Parse(value);
}
}
lock (baseLock)
{
return m_base.DiscardNull;
}
}
set
{
bool change;
lock (baseLock)
{
change = m_base.DiscardNull != value;
m_base.DiscardNull = value;
}
if (change)
{
NotifyPropertyChanged("DiscardNull");
}
}
}
/// <summary>
/// Gets the state of the Data Set Ready (DSR) signal.
/// </summary>
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Browsable(false)]
public bool DsrHolding
{
get
{
lock (baseLock)
{
return m_base.DsrHolding;
}
}
}
/// <summary>
/// Gets or sets a value that enables the Data Terminal Ready (DTR) signal during Terminal communication.
/// </summary>
[DefaultValue(false)]
[MonitoringDescription("DtrEnable")]
[Browsable(true)]
public bool DtrEnable
{
get
{
if (IsVirtual && m_OnGetPropertyValue != null)
{
string value = m_OnGetPropertyValue("DtrEnable");
if (value != null)
{
return bool.Parse(value);
}
}
lock (baseLock)
{
return m_base.DtrEnable;
}
}
set
{
bool change;
lock (baseLock)
{
change = m_base.DtrEnable != value;
m_base.DtrEnable = value;
}
if (change)
{
NotifyPropertyChanged("DtrEnable");
}
}
}
/// <summary>
/// Gets or sets the byte encoding for pre- and post-transmission conversion of text.
/// </summary>
[MonitoringDescription("Encoding")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Browsable(false)]
public Encoding Encoding
{
get
{
lock (baseLock)
{
return m_base.Encoding;
}
}
set
{
bool change;
lock (baseLock)
{
change = m_base.Encoding != value;
m_base.Encoding = value;
}
if (change)
{
NotifyPropertyChanged("Encoding");
}
}
}
/// <summary>
/// Gets or sets the handshaking protocol for Terminal port transmission of data.
/// </summary>
[Browsable(true)]
[MonitoringDescription("Handshake")]
public Handshake Handshake
{
get
{
if (IsVirtual && m_OnGetPropertyValue != null)
{
string value = m_OnGetPropertyValue("Handshake");
if (value != null)
{
return (Handshake)int.Parse(value);
}
}
lock (baseLock)
{
return m_base.Handshake;
}
}
set
{
bool change;
lock (baseLock)
{
change = m_base.Handshake != value;
m_base.Handshake = value;
}
if (change)
{
NotifyPropertyChanged("Handshake");
}
}
}
/// <summary>
/// Gets a value indicating the open or closed status of the System.IO.Ports.SerialPort object.
/// </summary>
[Browsable(false)]
public bool IsOpen
{
get
{
lock (baseLock)
{
return m_base.IsOpen;
}
}
}
/// <summary>
/// Gets or sets the parity-checking protocol.
/// </summary>
[Browsable(true)]
[MonitoringDescription("Parity")]
public Parity Parity
{
get
{
if (IsVirtual && m_OnGetPropertyValue != null)
{
string value = m_OnGetPropertyValue("Parity");
if (value != null)
{
return (Parity)int.Parse(value);
}
}
lock (baseLock)
{
return m_base.Parity;
}
}
set
{
bool change;
lock (baseLock)
{
change = m_base.Parity != value;
m_base.Parity = value;
}
if (change)
{
NotifyPropertyChanged("Parity");
}
}
}
/// <summary>
/// Gets or sets the byte that replaces invalid bytes in a data stream when a parity error occurs.
/// </summary>
[Browsable(true)]
[MonitoringDescription("ParityReplace")]
[DefaultValue(63)]
public byte ParityReplace
{
get
{
if (IsVirtual && m_OnGetPropertyValue != null)
{
string value = m_OnGetPropertyValue("ParityReplace");
if (value != null)
{
return byte.Parse(value);
}
}
lock (baseLock)
{
return m_base.ParityReplace;
}
}
set
{
bool change;
lock (baseLock)
{
change = m_base.ParityReplace != value;
m_base.ParityReplace = value;
}
if (change)
{
NotifyPropertyChanged("ParityReplace");
}
}
}
/// <summary>
/// Gets or sets the phone number.
/// </summary>
public string PhoneNumber
{
get
{
if (IsVirtual && m_OnGetPropertyValue != null)
{
string value = m_OnGetPropertyValue("PhoneNumber");
if (value != null)
{
return value;
}
}
lock (baseLock)
{
return phoneNumber;
}
}
set
{
bool change;
lock (baseLock)
{
change = phoneNumber != value;
phoneNumber = value;
}
if (change)
{
NotifyPropertyChanged("PhoneNumber");
}
}
}
/// <summary>
/// Gets or sets how long (ms.) modem answer is waited when connection is made.
/// </summary>
public int ConnectionWaitTime
{
get
{
if (IsVirtual && m_OnGetPropertyValue != null)
{
string value = m_OnGetPropertyValue("ConnectionWaitTime");
if (value != null)
{
return int.Parse(value);
}
}
lock (baseLock)
{
return connectionWaitTime;
}
}
set
{
bool change;
lock (baseLock)
{
change = connectionWaitTime != value;
connectionWaitTime = value;
}
if (change)
{
NotifyPropertyChanged("ConnectionWaitTime");
}
}
}
/// <summary>
/// Get or set how long (ms) modem answer is waited when command is send for the modem.
/// </summary>
public int CommandWaitTime
{
get
{
if (IsVirtual && m_OnGetPropertyValue != null)
{
string value = m_OnGetPropertyValue("CommandWaitTime");
if (value != null)
{
return int.Parse(value);
}
}
lock (baseLock)
{
return commandWaitTime;
}
}
set
{
bool change;
lock (baseLock)
{
change = commandWaitTime != value;
commandWaitTime = value;
}
if (change)
{
NotifyPropertyChanged("CommandWaitTime");
}
}
}
/// <summary>
/// Server sunctionality is added later.
/// </summary>
[DefaultValue(false)]
[Browsable(true)]
internal bool Server
{
get
{
if (IsVirtual && m_OnGetPropertyValue != null)
{
string value = m_OnGetPropertyValue("Server");
if (value != null)
{
return bool.Parse(value);
}
}
lock (baseLock)
{
return server;
}
}
set
{
bool change = server != value;
if (change)
{
server = value;
NotifyPropertyChanged("Server");
}
}
}
/// <summary>
/// Gets or sets the port for communications, including but not limited to all available COM ports.
/// </summary>
[MonitoringDescription("PortName")]
[Browsable(true)]
[DefaultValue("COM1")]
public string PortName
{
get
{
if (IsVirtual && m_OnGetPropertyValue != null)
{
string value = m_OnGetPropertyValue("PortName");
if (value != null)
{
return value;
}
}
lock (baseLock)
{
return m_base.PortName;
}
}
set
{
bool change;
lock (baseLock)
{
change = m_base.PortName != value;
m_base.PortName = value;
}
if (change)
{
NotifyPropertyChanged("PortName");
}
}
}
/// <summary>
/// Gets or sets the size of the System.IO.Ports.SerialPort input buffer.
/// </summary>
[DefaultValue(4096)]
[MonitoringDescription("ReadBufferSize")]
[Browsable(true)]
public int ReadBufferSize
{
get
{
if (IsVirtual && m_OnGetPropertyValue != null)
{
string value = m_OnGetPropertyValue("ReadBufferSize");
if (value != null)
{
return int.Parse(value);
}
}
lock (baseLock)
{
return m_base.ReadBufferSize;
}
}
set
{
bool change;
lock (baseLock)
{
change = m_base.ReadBufferSize != value;
m_base.ReadBufferSize = value;
}
if (change)
{
NotifyPropertyChanged("ReadBufferSize");