Skip to content

Commit 3e00699

Browse files
Adjust namespace, and add value lookup file.
1 parent aaa94aa commit 3e00699

File tree

3 files changed

+55
-23
lines changed

3 files changed

+55
-23
lines changed

Sensors/DroboSensor/DroboSensor/DroboSensor.cs

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
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:

Sensors/DroboSensor/DroboSensor/DroboSensor.csproj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<ProjectGuid>{0407107E-C0DF-43EA-A1DF-11BBA69837D3}</ProjectGuid>
88
<OutputType>Library</OutputType>
99
<AppDesignerFolder>Properties</AppDesignerFolder>
10-
<RootNamespace>DroboSensor</RootNamespace>
10+
<RootNamespace>DevelopingTrends</RootNamespace>
1111
<AssemblyName>DroboSensor</AssemblyName>
1212
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
@@ -58,6 +58,11 @@
5858
<Content Include="ExternallDLLs\SensorHost.Shared.dll" />
5959
<Content Include="ExternallDLLs\SensorHost.Shared.XML" />
6060
</ItemGroup>
61+
<ItemGroup>
62+
<None Include="Value Lookups\developingtrends.drobosensor.drivestatus.ovl">
63+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
64+
</None>
65+
</ItemGroup>
6166
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
6267
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
6368
Other similar extension points exist, see Microsoft.Common.targets.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ValueLookup id="developingtrends.drobosensor.drivestatus" desiredValue="1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PaeValueLookup.xsd">
3+
<Lookups>
4+
<SingleInt state="Error" value="1">
5+
Add/upgrade drive immediately
6+
</SingleInt>
7+
<SingleInt state="Warning" value="2">
8+
Add/upgrade drive soon
9+
</SingleInt>
10+
<SingleInt state="OK" value="3">
11+
All OK
12+
</SingleInt>
13+
<SingleInt state="OK" value="4">
14+
Relayout of data
15+
</SingleInt>
16+
<SingleInt state="OK" value="123">
17+
Empty Slot
18+
</SingleInt>
19+
<SingleInt state="OK" value="129">
20+
Insert New Drive Here
21+
</SingleInt>
22+
<SingleInt state="Error" value="134">
23+
Defective drive, replace immediately
24+
</SingleInt>
25+
</Lookups>
26+
</ValueLookup>

0 commit comments

Comments
 (0)