Re-added api for volume and mute

This commit is contained in:
Heath Volmer
2018-01-01 05:00:33 -07:00
parent 68fb82f801
commit 51afb966d5
6 changed files with 2012 additions and 2011 deletions

View File

@@ -4,5 +4,5 @@
[assembly: AssemblyCompany("PepperDash Technology Corp")]
[assembly: AssemblyProduct("PepperDashEssentials")]
[assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2017")]
[assembly: AssemblyVersion("1.0.10.*")]
[assembly: AssemblyVersion("1.0.11.*")]

View File

@@ -31,9 +31,11 @@ namespace PepperDash.Essentials
Parent.AddAction(string.Format(@"/room/{0}/source", Room.Key), new Action<SourceSelectMessageContent>(c => room.RunRouteAction(c.SourceListItem)));
Parent.AddAction(string.Format(@"/room/{0}/defaultsource", Room.Key), new Action(Room.RunDefaultRoute));
Parent.AddAction(string.Format(@"/room/{0}/event/masterVolumeUpBtn", Room.Key), new PressAndHoldAction(b => room.CurrentVolumeControls.VolumeUp(b)));
Parent.AddAction(string.Format(@"/room/{0}/event/masterVolumeDownBtn", Room.Key), new PressAndHoldAction(b => room.CurrentVolumeControls.VolumeDown(b)));
Parent.AddAction(string.Format(@"/room/{0}/event/muteToggle", Room.Key), new Action(() => room.CurrentVolumeControls.MuteToggle()));
//Parent.AddAction(string.Format(@"/room/{0}/event/masterVolumeUpBtn", Room.Key), new PressAndHoldAction(b => room.CurrentVolumeControls.VolumeUp(b)));
//Parent.AddAction(string.Format(@"/room/{0}/event/masterVolumeDownBtn", Room.Key), new PressAndHoldAction(b => room.CurrentVolumeControls.VolumeDown(b)));
Parent.AddAction(string.Format(@"/room/{0}/masterVolumeLevel", Room.Key), new Action<ushort>(u =>
(room.CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(u)));
Parent.AddAction(string.Format(@"/room/{0}/masterVolumeMuteToggle", Room.Key), new Action(() => room.CurrentVolumeControls.MuteToggle()));
Room.CurrentSingleSourceChange += new SourceInfoChangeHandler(Room_CurrentSingleSourceChange);

View File

@@ -205,33 +205,23 @@ namespace PepperDash.Essentials
{
try
{
//if(Client == null)
if(Client == null)
Client = new HttpClient();
Client.Verbose = true;
Client.KeepAlive = true;
try
{
HttpClientRequest request = new HttpClientRequest();
request.RequestType = RequestType.Post;
string url = string.Format("http://{0}/api/system/{1}/status", Config.ServerUrl, SystemUuid);
request.Url.Parse(url);
request.KeepAlive = true;
request.Header.ContentType = "application/json";
// Ignore any null objects when serializing and remove formatting
string ignored = JsonConvert.SerializeObject(o, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
Debug.Console(1, this, "Posting to '{0}':\n{1}", url, ignored);
request.ContentString = ignored;
request.FinalizeHeader();
Client.DispatchAsync(request, (r, err) => { if (r != null) { Debug.Console(1, this, "Status Response Code: {0}", r.Code); } });
}
catch (Exception e)
{
Debug.Console(1, this, "PostToServer exception: {0}", e);
}
HttpClientRequest request = new HttpClientRequest();
request.RequestType = RequestType.Post;
string url = string.Format("http://{0}/api/system/{1}/status", Config.ServerUrl, SystemUuid);
request.Url.Parse(url);
request.KeepAlive = true;
request.Header.ContentType = "application/json";
// Ignore any null objects when serializing and remove formatting
string ignored = JsonConvert.SerializeObject(o, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
Debug.Console(1, this, "Posting to '{0}':\n{1}", url, ignored);
request.ContentString = ignored;
request.FinalizeHeader();
Client.DispatchAsync(request, (r, err) => { if (r != null) { Debug.Console(1, this, "Status Response Code: {0}", r.Code); } });
//ResetOrStartHearbeatTimer();
}