1- using System ;
2- using System . Collections . Generic ;
3- using System . Linq ;
4-
5- namespace DroboSensor
1+ namespace DevelopingTrends
62{
7- using DevelopingTrends . DroboInterface ;
3+ using System ;
4+ using System . Collections . Generic ;
5+ using System . Linq ;
6+
7+ using DroboInterface ;
88
99 using SensorHost . Shared ;
10+
1011 public class DroboSensor : SensorHost . Shared . SensorBase
1112 {
1213 public bool _connected = false ;
1314 private Dictionary < string , IDrobo > _drobos = new Dictionary < string , IDrobo > ( ) ;
1415 private readonly DroboConnection _connection ;
1516 public DroboSensor ( )
1617 {
17- _connection = new DroboConnection ( 30000 ) ;
18- _connected = _connection . Connect ( ) ;
19- _connection . ConnectionLost += ConnectionOnConnectionLost ;
20- _connection . DataRecieved += Connection_DataRecieved ;
21- Console . WriteLine ( $ "Drobo is connected: { _connected } ") ;
18+ this . _connection = new DroboConnection ( 30000 ) ;
19+ this . _connected = this . _connection . Connect ( ) ;
20+ this . _connection . ConnectionLost += this . ConnectionOnConnectionLost ;
21+ this . _connection . DataRecieved += this . Connection_DataRecieved ;
22+ Console . WriteLine ( $ "Drobo is connected: { this . _connected } ") ;
2223 }
2324
2425 private void ConnectionOnConnectionLost ( )
2526 {
26- _connected = false ;
27- _drobos . Clear ( ) ;
27+ this . _connected = false ;
28+ this . _drobos . Clear ( ) ;
2829 Console . WriteLine ( "Connection Lost" ) ;
2930 }
3031
@@ -38,39 +39,39 @@ private void Connection_DataRecieved(IDrobo drobo)
3839 else
3940 {
4041
41- if ( _drobos . ContainsKey ( drobo . SerialNumber ) )
42+ if ( this . _drobos . ContainsKey ( drobo . SerialNumber ) )
4243 {
43- _drobos [ drobo . SerialNumber ] = drobo ;
44+ this . _drobos [ drobo . SerialNumber ] = drobo ;
4445 }
4546 else
4647 {
47- _drobos . Add ( drobo . SerialNumber , drobo ) ;
48+ this . _drobos . Add ( drobo . SerialNumber , drobo ) ;
4849 }
4950 }
5051 }
5152
5253 public override IEnumerable < Result > Results ( )
5354 {
54- if ( ! _connected )
55+ if ( ! this . _connected )
5556 {
56- _connected = _connection . Connect ( ) ;
57+ this . _connected = this . _connection . Connect ( ) ;
5758 }
5859
59- if ( ! _drobos . Any ( ) )
60+ if ( ! this . _drobos . Any ( ) )
6061 {
6162 return Enumerable . Empty < Result > ( ) ;
6263 }
6364 //only going to return the first drobo found for this version.
64- return ConvertToResult ( _drobos . First ( ) . Value ) ;
65+ return this . ConvertToResult ( this . _drobos . First ( ) . Value ) ;
6566 }
6667
6768 public override string Description
6869 {
6970 get
7071 {
71- if ( _drobos . Any ( ) )
72+ if ( this . _drobos . Any ( ) )
7273 {
73- IDrobo firstDrobo = _drobos . First ( ) . Value ;
74+ IDrobo firstDrobo = this . _drobos . First ( ) . Value ;
7475 switch ( firstDrobo . Status )
7576 {
7677 case ConnectionStatus . TimeOut :
0 commit comments