Updates as per Heath to volumes object in SendFullStatus(). Fixed issue with populating SourceDeviceMapDictionary in constructor.

This commit is contained in:
Neil Dorin
2018-07-24 15:11:48 -06:00
parent 9ad2fef94a
commit b989b07d78
5 changed files with 89 additions and 16 deletions

View File

@@ -82,6 +82,8 @@ namespace PepperDash.Essentials
CrestronConsole.AddNewConsoleCommand(TestHttpRequest, CrestronConsole.AddNewConsoleCommand(TestHttpRequest,
"mobilehttprequest", "Tests an HTTP get to URL given", ConsoleAccessLevelEnum.AccessOperator); "mobilehttprequest", "Tests an HTTP get to URL given", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(PrintActionDictionaryPaths, "showactionpaths", "Prints the paths in teh Action Dictionary", ConsoleAccessLevelEnum.AccessOperator);
CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler); CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler);
} }
@@ -102,6 +104,16 @@ namespace PepperDash.Essentials
} }
} }
public void PrintActionDictionaryPaths(object o)
{
Debug.Console(0, this, "ActionDictionary Contents:");
foreach (var item in ActionDictionary)
{
Debug.Console(0, this, "{0}", item.Key);
}
}
/// <summary> /// <summary>
/// Adds an action to the dictionary /// Adds an action to the dictionary
/// </summary> /// </summary>

View File

@@ -261,7 +261,7 @@ namespace PepperDash.Essentials.Room.Cotija
foreach (var item in sourceJoinMap) foreach (var item in sourceJoinMap)
{ {
Parent.AddAction(prefix + item.Key, new PressAndHoldAction(b => EISC.SetBool(item.Value, b))); Parent.AddAction(string.Format("{0}{1}", prefix, item.Key), new PressAndHoldAction(b => EISC.SetBool(item.Value, b)));
} }
} }
@@ -467,23 +467,42 @@ namespace PepperDash.Essentials.Room.Cotija
{ {
if (ConfigIsLoaded) if (ConfigIsLoaded)
{ {
var count = EISC.UShortOutput[801].UShortValue;
Debug.Console(1, this, "The Fader Count is : {0}", count);
// build volumes object, serialize and put in content of method below
var auxFaders = new List<Volume>();
// Create auxFaders
for (uint i = 2; i <= count; i++)
{
auxFaders.Add(
new Volume(string.Format("level-{0}", i),
EISC.UShortOutput[i].UShortValue,
EISC.BooleanOutput[i].BoolValue,
EISC.StringOutput[800 + i].StringValue,
true,
"someting.png"));
}
var volumes = new Volumes();
volumes.Master = new Volume("master",
EISC.UShortOutput[UshortJoin.MasterVolumeLevel].UShortValue,
EISC.BooleanOutput[BoolJoin.MasterVolumeIsMuted].BoolValue,
EISC.StringOutput[801].StringValue,
true,
"something.png");
volumes.AuxFaders = auxFaders;
PostStatusMessage(new PostStatusMessage(new
{ {
isOn = EISC.BooleanOutput[BoolJoin.RoomIsOn].BoolValue, isOn = EISC.BooleanOutput[BoolJoin.RoomIsOn].BoolValue,
selectedSourceKey = EISC.StringOutput[StringJoin.SelectedSourceKey].StringValue, selectedSourceKey = EISC.StringOutput[StringJoin.SelectedSourceKey].StringValue,
volumes = new volumes = volumes
{
master = new
{
level = EISC.UShortOutput[UshortJoin.MasterVolumeLevel].UShortValue,
muted = EISC.BooleanOutput[BoolJoin.MasterVolumeIsMuted].BoolValue,
label = EISC.StringInput[701].StringValue,
hasMute = true,
muteIcon = "something.png"
},
count = 1
}
}); });
} }
else else
@@ -495,7 +514,45 @@ namespace PepperDash.Essentials.Room.Cotija
} }
} }
public class Volumes
{
[JsonProperty("master")]
public Volume Master { get; set; }
[JsonProperty("auxFaders")]
public List<Volume> AuxFaders { get; set; }
}
public class Volume
{
[JsonProperty("key")]
public string Key { get; set; }
[JsonProperty("level")]
public ushort Level { get; set; }
[JsonProperty("muted")]
public bool Muted { get; set; }
[JsonProperty("label")]
public string Label { get; set; }
[JsonProperty("hasMute")]
public bool HasMute { get; set; }
[JsonProperty("muteIcon")]
public string MuteIcon { get; set; }
public Volume(string key, ushort level, bool muted, string label, bool hasMute, string muteIcon)
{
Key = key;
Level = level;
Muted = muted;
Label = label;
HasMute = hasMute;
MuteIcon = muteIcon;
}
}
/// <summary> /// <summary>
/// Helper for posting status message /// Helper for posting status message

View File

@@ -90,11 +90,15 @@ namespace PepperDash.Essentials.Room.Cotija
{"prevTrack", 175}, {"prevTrack", 175},
{"nextTrack", 176}, {"nextTrack", 176},
{"powerOn", 177}, {"powerOn", 177},
{"powerOff", 178} {"powerOff", 178},
{"dot", 179}
}; };
foreach (var item in dictionary)
{
this.Add(item.Key, item.Value);
}
} }
} }
} }