esc-337, found errant timer resets on comm monitor and Sammy display

This commit is contained in:
Heath Volmer
2017-08-16 15:26:46 -06:00
parent 17b0373c73
commit 85683ea9fa
11 changed files with 22 additions and 17 deletions

View File

@@ -235,12 +235,23 @@ namespace PepperDash.Essentials.Core
public PropertyInfo PropInfo { get; private set; }
public string Name { get { return PropInfo.Name; } }
public string Type { get { return PropInfo.PropertyType.Name; } }
public string Value { get {
public string Value { get
{
if (PropInfo.CanRead)
return PropInfo.GetValue(Parent, null).ToString();
{
try
{
return PropInfo.GetValue(Parent, null).ToString();
}
catch (Exception)
{
return null;
}
}
else
return "-";
return null;
} }
public bool CanRead { get { return PropInfo.CanRead; } }
public bool CanWrite { get { return PropInfo.CanWrite; } }

View File

@@ -104,7 +104,7 @@ namespace PepperDash.Essentials.Core
void Client_BytesReceived(object sender, GenericCommMethodReceiveBytesArgs e)
{
Status = MonitorStatus.IsOk;
StopErrorTimers();
ResetErrorTimers();
}
void Poll()

View File

@@ -102,17 +102,12 @@ namespace PepperDash.Essentials.Core
ErrorTimer = null;
}
public void ResetErrorTimers()
protected void ResetErrorTimers()
{
if(WarningTimer != null)
WarningTimer.Reset(WarningTime, WarningTime);
if(ErrorTimer != null)
ErrorTimer.Reset(ErrorTime, ErrorTime);
}
public void PrintStatus()
{
CrestronConsole.PrintLine("Status={0}", Status);
}
}
}

View File

@@ -153,13 +153,13 @@ namespace PepperDash.Essentials.Devices.Displays
/// <param name="e"></param>
void Communication_BytesReceived(object sender, GenericCommMethodReceiveBytesArgs e)
{
Debug.Console(2, this, "Socket in: {0}", ComTextHelper.GetEscapedText(e.Bytes));
//Debug.Console(2, this, "Socket in: {0}", ComTextHelper.GetEscapedText(e.Bytes));
// This is probably not thread-safe buffering
// Append the incoming bytes with whatever is in the buffer
var newBytes = new byte[IncomingBuffer.Length + e.Bytes.Length];
IncomingBuffer.CopyTo(newBytes, 0);
e.Bytes.CopyTo(newBytes, IncomingBuffer.Length);
Debug.Console(2, this, "Buffer+new: {0}", ComTextHelper.GetEscapedText(newBytes));
//Debug.Console(2, this, "Buffer+new: {0}", ComTextHelper.GetEscapedText(newBytes));
// Need to find AA FF and have
for (int i = 0; i < newBytes.Length; i++)
@@ -180,7 +180,7 @@ namespace PepperDash.Essentials.Devices.Displays
// Good length, grab the message
var message = newBytes.Skip(4).Take(msgLen).ToArray();
Debug.Console(0, this, "Parsing: {0}", ComTextHelper.GetEscapedText(message));
Debug.Console(0, this, "Parsing input: {0}", ComTextHelper.GetEscapedText(message));
// At this point, the ack/nak is the first byte
if (message[0] == 0x41)
@@ -292,7 +292,6 @@ namespace PepperDash.Essentials.Devices.Displays
b[b.Length - 1] = (byte)checksum;
if(Debug.Level == 2) // This check is here to prevent following string format from building unnecessarily on level 0 or 1
Debug.Console(2, this, "Sending:{0}", ComTextHelper.GetEscapedText(b));
CommunicationMonitor.ResetErrorTimers(); // Helps prevent message collisions
Communication.SendBytes(b);
}

View File

@@ -26,9 +26,9 @@ namespace PepperDash.Essentials.Fusion
{
public class EssentialsHuddleSpaceFusionSystemController : Device
{
public event EventHandler<ScheduleChangeEventArgs> ScheduleChange;
public event EventHandler<MeetingChangeEventArgs> MeetingEndWarning;
public event EventHandler<MeetingChangeEventArgs> NextMeetingBeginWarning;
//public event EventHandler<ScheduleChangeEventArgs> ScheduleChange;
//public event EventHandler<MeetingChangeEventArgs> MeetingEndWarning;
//public event EventHandler<MeetingChangeEventArgs> NextMeetingBeginWarning;
FusionRoom FusionRoom;
EssentialsHuddleSpaceRoom Room;