Minor updates to address min/max level parsing issues when resubscribing

This commit is contained in:
Neil Dorin
2017-03-22 16:29:26 -06:00
parent 061505706d
commit 589b21461c
6 changed files with 16 additions and 16 deletions

View File

@@ -290,7 +290,7 @@ namespace PepperDash.Essentials.Devices.Common.DSP
public void EnqueueCommand(QueuedCommand commandToEnqueue) public void EnqueueCommand(QueuedCommand commandToEnqueue)
{ {
CommandQueue.Enqueue(commandToEnqueue); CommandQueue.Enqueue(commandToEnqueue);
Debug.Console(1, this, "Command (QueuedCommand) Enqueued '{0}'. CommandQueue has '{1}' Elements.", commandToEnqueue.Command, CommandQueue.Count); //Debug.Console(1, this, "Command (QueuedCommand) Enqueued '{0}'. CommandQueue has '{1}' Elements.", commandToEnqueue.Command, CommandQueue.Count);
if(!CommandQueueInProgress) if(!CommandQueueInProgress)
SendNextQueuedCommand(); SendNextQueuedCommand();
@@ -303,7 +303,7 @@ namespace PepperDash.Essentials.Devices.Common.DSP
public void EnqueueCommand(string command) public void EnqueueCommand(string command)
{ {
CommandQueue.Enqueue(command); CommandQueue.Enqueue(command);
Debug.Console(1, this, "Command (string) Enqueued '{0}'. CommandQueue has '{1}' Elements.", command, CommandQueue.Count); //Debug.Console(1, this, "Command (string) Enqueued '{0}'. CommandQueue has '{1}' Elements.", command, CommandQueue.Count);
if (!CommandQueueInProgress) if (!CommandQueueInProgress)
SendNextQueuedCommand(); SendNextQueuedCommand();
@@ -314,25 +314,25 @@ namespace PepperDash.Essentials.Devices.Common.DSP
/// </summary> /// </summary>
void SendNextQueuedCommand() void SendNextQueuedCommand()
{ {
Debug.Console(2, this, "Attempting to send next queued command. CommandQueueInProgress: {0} Communication isConnected: {1}", CommandQueueInProgress, Communication.IsConnected); //Debug.Console(2, this, "Attempting to send next queued command. CommandQueueInProgress: {0} Communication isConnected: {1}", CommandQueueInProgress, Communication.IsConnected);
//if (CommandQueue.IsEmpty) //if (CommandQueue.IsEmpty)
// CommandQueueInProgress = false; // CommandQueueInProgress = false;
Debug.Console(1, this, "CommandQueue has {0} Elements:\n", CommandQueue.Count); Debug.Console(1, this, "CommandQueue has {0} Elements:\n", CommandQueue.Count);
foreach (object o in CommandQueue) //foreach (object o in CommandQueue)
{ //{
if (o is string) // if (o is string)
Debug.Console(1, this, "{0}", o); // Debug.Console(1, this, "{0}", o);
else if(o is QueuedCommand) // else if(o is QueuedCommand)
{ // {
var item = (QueuedCommand)o; // var item = (QueuedCommand)o;
Debug.Console(1, this, "{0}", item.Command); // Debug.Console(1, this, "{0}", item.Command);
} // }
} //}
Debug.Console(1, this, "End of CommandQueue"); //Debug.Console(1, this, "End of CommandQueue");
if (Communication.IsConnected && !CommandQueue.IsEmpty) if (Communication.IsConnected && !CommandQueue.IsEmpty)
{ {

View File

@@ -220,7 +220,7 @@ namespace PepperDash.Essentials.Devices.Common.DSP
string value = match.Groups[1].Value; string value = match.Groups[1].Value;
//Debug.Console(1, this, "{0} is {1}", attributeCode, value); Debug.Console(1, this, "Response: '{0}' Value: '{1}'", attributeCode, value);
if (message.IndexOf("\"value\":") > -1) if (message.IndexOf("\"value\":") > -1)
{ {
@@ -238,7 +238,7 @@ namespace PepperDash.Essentials.Devices.Common.DSP
{ {
MaxLevel = Double.Parse(value); MaxLevel = Double.Parse(value);
Debug.Console(1, this, "MaxLevel is '{0}'", MinLevel); Debug.Console(1, this, "MaxLevel is '{0}'", MaxLevel);
break; break;
} }