mirror of
https://github.com/ckaczor/WeatherService.git
synced 2026-02-16 10:58:33 -05:00
Code modernization
This commit is contained in:
@@ -70,13 +70,13 @@ namespace WeatherService.Devices
|
|||||||
_valueList = new Dictionary<WeatherValueType, Value>();
|
_valueList = new Dictionary<WeatherValueType, Value>();
|
||||||
|
|
||||||
// Store properties of the device
|
// Store properties of the device
|
||||||
_deviceAddress = device.ID.Name;
|
_deviceAddress = device.Id.Name;
|
||||||
_deviceType = deviceType;
|
_deviceType = deviceType;
|
||||||
_session = session;
|
_session = session;
|
||||||
_device = device;
|
_device = device;
|
||||||
|
|
||||||
// Default the display name
|
// Default the display name
|
||||||
_displayName = device.ID.Name;
|
_displayName = device.Id.Name;
|
||||||
|
|
||||||
// Default the read interval
|
// Default the read interval
|
||||||
if (Type == DeviceType.WindDirection || Type == DeviceType.WindSpeed)
|
if (Type == DeviceType.WindDirection || Type == DeviceType.WindSpeed)
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ namespace WeatherService.Devices
|
|||||||
|
|
||||||
PrepPioForWrite();
|
PrepPioForWrite();
|
||||||
|
|
||||||
owAdapter.Select(_writeDevice.ID);
|
owAdapter.Select(_writeDevice.Id);
|
||||||
|
|
||||||
data[dataCount++] = ChannelAccessCommand;
|
data[dataCount++] = ChannelAccessCommand;
|
||||||
data[dataCount++] = ConfigWrite;
|
data[dataCount++] = ConfigWrite;
|
||||||
@@ -172,7 +172,7 @@ namespace WeatherService.Devices
|
|||||||
|
|
||||||
PrepPioForRead();
|
PrepPioForRead();
|
||||||
|
|
||||||
owAdapter.Select(_readDevice.ID);
|
owAdapter.Select(_readDevice.Id);
|
||||||
|
|
||||||
data[dataCount++] = ChannelAccessCommand;
|
data[dataCount++] = ChannelAccessCommand;
|
||||||
data[dataCount++] = ConfigRead;
|
data[dataCount++] = ConfigRead;
|
||||||
@@ -192,7 +192,7 @@ namespace WeatherService.Devices
|
|||||||
|
|
||||||
PrepPioForWrite();
|
PrepPioForWrite();
|
||||||
|
|
||||||
owAdapter.Select(_readDevice.ID);
|
owAdapter.Select(_readDevice.Id);
|
||||||
|
|
||||||
data[dataCount++] = ChannelAccessCommand;
|
data[dataCount++] = ChannelAccessCommand;
|
||||||
data[dataCount++] = ConfigPulseRead;
|
data[dataCount++] = ConfigPulseRead;
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ namespace WeatherService
|
|||||||
device.Errors++;
|
device.Errors++;
|
||||||
|
|
||||||
// TODO - Error event
|
// TODO - Error event
|
||||||
Tracer.WriteLine(String.Format("{0} - Error in device {1}: {2}", DateTime.Now, exception.DeviceID.Name, exception.Message));
|
Tracer.WriteLine(String.Format("{0} - Error in device {1}: {2}", DateTime.Now, exception.DeviceId.Name, exception.Message));
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
@@ -116,7 +116,7 @@ namespace WeatherService
|
|||||||
owIdentifier deviceID; // Identifier for the other device
|
owIdentifier deviceID; // Identifier for the other device
|
||||||
|
|
||||||
// Select this device
|
// Select this device
|
||||||
owAdapter.Select(device.ID);
|
owAdapter.Select(device.Id);
|
||||||
|
|
||||||
// Setup to try to open the pressure sensor file
|
// Setup to try to open the pressure sensor file
|
||||||
fileEntry.Name = System.Text.Encoding.ASCII.GetBytes("8570");
|
fileEntry.Name = System.Text.Encoding.ASCII.GetBytes("8570");
|
||||||
@@ -152,7 +152,7 @@ namespace WeatherService
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1D:
|
case 0x1D:
|
||||||
if (device.ID.Name == "4000000004A4081D")
|
if (device.Id.Name == "4000000004A4081D")
|
||||||
{
|
{
|
||||||
// Create a new rain device and add it to the list
|
// Create a new rain device and add it to the list
|
||||||
Devices.Add(new RainDevice(this, device));
|
Devices.Add(new RainDevice(this, device));
|
||||||
|
|||||||
Reference in New Issue
Block a user