mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-13 12:37:07 +00:00
style: run code cleanup & apply VS suggestions
This commit is contained in:
parent
4d98191fa7
commit
789111cb9a
64 changed files with 329 additions and 390 deletions
|
|
@ -1,5 +1,4 @@
|
|||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using PepperDash.Essentials.Devices.Common.AudioCodec;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using System;
|
||||
|
|
@ -103,14 +102,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
var info = Codec.CodecInfo;
|
||||
|
||||
PostStatusMessage(JToken.FromObject(new
|
||||
{
|
||||
isInCall = Codec.IsInCall,
|
||||
calls = Codec.ActiveCalls,
|
||||
info = new
|
||||
{
|
||||
isInCall = Codec.IsInCall,
|
||||
calls = Codec.ActiveCalls,
|
||||
info = new
|
||||
{
|
||||
phoneNumber = info.PhoneNumber
|
||||
}
|
||||
})
|
||||
phoneNumber = info.PhoneNumber
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using PepperDash.Essentials.Devices.Common.Cameras;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
@ -40,9 +39,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
presetList = presetsCamera.Presets;
|
||||
|
||||
PostStatusMessage(JToken.FromObject(new
|
||||
{
|
||||
presets = presetList
|
||||
})
|
||||
{
|
||||
presets = presetList
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -175,14 +174,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
presetList = presetsCamera.Presets;
|
||||
|
||||
PostStatusMessage(JToken.FromObject(new
|
||||
{
|
||||
cameraManualSupported = Camera is IHasCameraControls,
|
||||
cameraAutoSupported = Camera is IHasCameraAutoMode,
|
||||
cameraOffSupported = Camera is IHasCameraOff,
|
||||
cameraMode = GetCameraMode(),
|
||||
hasPresets = Camera is IHasCameraPresets,
|
||||
presets = presetList
|
||||
})
|
||||
{
|
||||
cameraManualSupported = Camera is IHasCameraControls,
|
||||
cameraAutoSupported = Camera is IHasCameraAutoMode,
|
||||
cameraOffSupported = Camera is IHasCameraOff,
|
||||
cameraMode = GetCameraMode(),
|
||||
hasPresets = Camera is IHasCameraPresets,
|
||||
presets = presetList
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,6 @@
|
|||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.DeviceInfo;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
|
|
|
|||
|
|
@ -43,12 +43,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
protected override void RegisterActions()
|
||||
|
||||
{
|
||||
AddAction("/presets/fullStatus", (id, content) => {
|
||||
AddAction("/presets/fullStatus", (id, content) =>
|
||||
{
|
||||
this.LogInformation("getting full status for client {id}", id);
|
||||
try
|
||||
{
|
||||
SendPresets();
|
||||
} catch(Exception ex)
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogMessage(ex, "Exception sending preset full status", this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Core.Logging;
|
||||
using PepperDash.Essentials.Core;
|
||||
using System;
|
||||
|
||||
|
|
@ -39,7 +38,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
}
|
||||
|
||||
PostStatusMessage(messageObj);
|
||||
} catch(Exception ex)
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogMessage(ex, "Exception sending full status", this);
|
||||
}
|
||||
|
|
@ -60,7 +60,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
});
|
||||
|
||||
AddAction("/muteToggle", (id, content) =>
|
||||
{
|
||||
{
|
||||
_localDevice.MuteToggle();
|
||||
});
|
||||
|
||||
|
|
@ -74,21 +74,22 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
_localDevice.MuteOff();
|
||||
});
|
||||
|
||||
AddAction("/volumeUp", (id, content) => PressAndHoldHandler.HandlePressAndHold(DeviceKey, content, (b) =>
|
||||
AddAction("/volumeUp", (id, content) => PressAndHoldHandler.HandlePressAndHold(DeviceKey, content, (b) =>
|
||||
{
|
||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Calling {localDevice} volume up with {value}", DeviceKey, b);
|
||||
try
|
||||
{
|
||||
_localDevice.VolumeUp(b);
|
||||
} catch (Exception ex)
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogMessage(ex, "Got exception during volume up: {Exception}", null, ex);
|
||||
}
|
||||
}));
|
||||
}));
|
||||
|
||||
|
||||
|
||||
AddAction("/volumeDown", (id, content) => PressAndHoldHandler.HandlePressAndHold(DeviceKey, content, (b) =>
|
||||
AddAction("/volumeDown", (id, content) => PressAndHoldHandler.HandlePressAndHold(DeviceKey, content, (b) =>
|
||||
{
|
||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Calling {localDevice} volume down with {value}", DeviceKey, b);
|
||||
|
||||
|
|
@ -132,7 +133,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
}
|
||||
};
|
||||
|
||||
PostStatusMessage(JToken.FromObject(message));
|
||||
PostStatusMessage(JToken.FromObject(message));
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,11 +3,6 @@ using Newtonsoft.Json.Converters;
|
|||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
|
|
@ -24,7 +19,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
{
|
||||
base.RegisterActions();
|
||||
|
||||
AddAction("/fullStatus", (id, content) =>
|
||||
AddAction("/fullStatus", (id, content) =>
|
||||
{
|
||||
PostStatusMessage(new CommunicationMonitorState
|
||||
{
|
||||
|
|
@ -33,7 +28,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
IsOnline = _communicationMonitor.CommunicationMonitor.IsOnline,
|
||||
Status = _communicationMonitor.CommunicationMonitor.Status
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
_communicationMonitor.CommunicationMonitor.StatusChange += (sender, args) =>
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
PostStatusMessage(JToken.FromObject(message));
|
||||
};
|
||||
|
||||
foreach(var partition in _roomCombiner.Partitions)
|
||||
foreach (var partition in _roomCombiner.Partitions)
|
||||
{
|
||||
partition.PartitionPresentFeedback.OutputChange += (sender, args) =>
|
||||
{
|
||||
|
|
@ -101,7 +101,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
|
||||
foreach (var room in _roomCombiner.Rooms)
|
||||
{
|
||||
rooms.Add(new RoomCombinerRoom{ Key = room.Key, Name = room.Name });
|
||||
rooms.Add(new RoomCombinerRoom { Key = room.Key, Name = room.Name });
|
||||
}
|
||||
|
||||
var message = new IEssentialsRoomCombinerStateMessage
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
|
|
@ -29,7 +28,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
PostStatusMessage(message);
|
||||
});
|
||||
|
||||
sourceDevice.CurrentSourceChange += (sender, e) => {
|
||||
sourceDevice.CurrentSourceChange += (sender, e) =>
|
||||
{
|
||||
switch (e)
|
||||
{
|
||||
case ChangeType.DidChange:
|
||||
|
|
@ -42,11 +42,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class CurrentSourceStateMessage: DeviceStateMessageBase
|
||||
public class CurrentSourceStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
[JsonProperty("currentSourceKey", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string CurrentSourceKey { get; set; }
|
||||
|
|
|
|||
|
|
@ -1,20 +1,15 @@
|
|||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
public class IHasPowerControlWithFeedbackMessenger: MessengerBase
|
||||
public class IHasPowerControlWithFeedbackMessenger : MessengerBase
|
||||
{
|
||||
private readonly IHasPowerControlWithFeedback _powerControl;
|
||||
|
||||
public IHasPowerControlWithFeedbackMessenger(string key, string messagePath, IHasPowerControlWithFeedback powerControl)
|
||||
public IHasPowerControlWithFeedbackMessenger(string key, string messagePath, IHasPowerControlWithFeedback powerControl)
|
||||
: base(key, messagePath, powerControl as Device)
|
||||
{
|
||||
_powerControl = powerControl;
|
||||
|
|
@ -42,9 +37,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
private void PowerIsOnFeedback_OutputChange(object sender, FeedbackEventArgs args)
|
||||
{
|
||||
PostStatusMessage(JToken.FromObject(new
|
||||
{
|
||||
powerState = args.BoolValue
|
||||
})
|
||||
{
|
||||
powerState = args.BoolValue
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
@ -28,13 +27,13 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
private void CodecSchedule_MeetingEventChange(object sender, MeetingEventArgs e)
|
||||
{
|
||||
PostStatusMessage(JToken.FromObject(new MeetingChangeMessage
|
||||
{
|
||||
MeetingChange = new MeetingChange
|
||||
{
|
||||
MeetingChange = new MeetingChange
|
||||
{
|
||||
ChangeType = e.ChangeType.ToString(),
|
||||
Meeting = e.Meeting
|
||||
}
|
||||
})
|
||||
ChangeType = e.ChangeType.ToString(),
|
||||
Meeting = e.Meeting
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
using Independentsoft.Exchange;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
|
|
@ -33,7 +29,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
PostStatusMessage(message);
|
||||
});
|
||||
|
||||
foreach(var levelControl in levelControlsDevice.LevelControlPoints)
|
||||
foreach (var levelControl in levelControlsDevice.LevelControlPoints)
|
||||
{
|
||||
// reassigning here just in case of lambda closure issues
|
||||
var key = levelControl.Key;
|
||||
|
|
@ -78,7 +74,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
}
|
||||
}
|
||||
|
||||
public class LevelControlStateMessage:DeviceStateMessageBase
|
||||
public class LevelControlStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
[JsonProperty("levelControls")]
|
||||
public Dictionary<string, Volume> Levels { get; set; }
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ using Newtonsoft.Json.Linq;
|
|||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Serilog.Events;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
|
|
@ -36,7 +36,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
Inputs = matrixDevice.InputSlots.ToDictionary(kvp => kvp.Key, kvp => new RoutingInput(kvp.Value)),
|
||||
};
|
||||
|
||||
|
||||
|
||||
PostStatusMessage(message);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
@ -52,7 +52,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
matrixDevice.Route(request.InputKey, request.OutputKey, request.RouteType);
|
||||
});
|
||||
|
||||
foreach(var output in matrixDevice.OutputSlots)
|
||||
foreach (var output in matrixDevice.OutputSlots)
|
||||
{
|
||||
var key = output.Key;
|
||||
var outputSlot = output.Value;
|
||||
|
|
@ -66,7 +66,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
};
|
||||
}
|
||||
|
||||
foreach(var input in matrixDevice.InputSlots)
|
||||
foreach (var input in matrixDevice.InputSlots)
|
||||
{
|
||||
var key = input.Key;
|
||||
var inputSlot = input.Value;
|
||||
|
|
@ -82,7 +82,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
}
|
||||
}
|
||||
|
||||
public class MatrixStateMessage : DeviceStateMessageBase
|
||||
public class MatrixStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
[JsonProperty("outputs")]
|
||||
public Dictionary<string, RoutingOutput> Outputs;
|
||||
|
|
@ -113,13 +113,13 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
|
||||
[JsonProperty("videoSyncDetected", NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
public bool? VideoSyncDetected => _input?.VideoSyncDetected;
|
||||
public bool? VideoSyncDetected => _input?.VideoSyncDetected;
|
||||
|
||||
[JsonProperty("key", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Key => _input?.Key;
|
||||
|
||||
public RoutingInput(IRoutingInputSlot input)
|
||||
{
|
||||
{
|
||||
_input = input;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using System;
|
|||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
public class IProjectorScreenLiftControlMessenger: MessengerBase
|
||||
public class IProjectorScreenLiftControlMessenger : MessengerBase
|
||||
{
|
||||
private readonly IProjectorScreenLiftControl device;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using System;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,8 @@
|
|||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
|
|
@ -45,7 +40,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
foreach (var input in itemDevice.Items)
|
||||
{
|
||||
var key = input.Key;
|
||||
var localItem = input.Value;
|
||||
var localItem = input.Value;
|
||||
|
||||
AddAction($"/{key}", (id, content) =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,12 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using PepperDash.Essentials.Core.CrestronIO;
|
||||
using PepperDash.Essentials.Core.Shades;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.CrestronIO;
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
|
|
@ -41,7 +36,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
|
||||
});
|
||||
|
||||
device.OutputIsOnFeedback.OutputChange += new EventHandler<Core.FeedbackEventArgs>((o, a) => SendFullStatus());
|
||||
device.OutputIsOnFeedback.OutputChange += new EventHandler<Core.FeedbackEventArgs>((o, a) => SendFullStatus());
|
||||
}
|
||||
|
||||
private void SendFullStatus()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Independentsoft.Json.Parser;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
|
|
@ -82,8 +75,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
[JsonProperty("isValid", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? IsValid { get; set; }
|
||||
}
|
||||
|
||||
class SetTechPasswordContent
|
||||
|
||||
internal class SetTechPasswordContent
|
||||
{
|
||||
[JsonProperty("oldPassword")]
|
||||
public string OldPassword { get; set; }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using PepperDash.Essentials.Core.Lighting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
|
@ -81,9 +80,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
private void HandleMessage(string path, string id, JToken content)
|
||||
{
|
||||
// replace base path with empty string. Should leave something like /fullStatus
|
||||
var route = path.Replace(MessagePath, string.Empty);
|
||||
var route = path.Replace(MessagePath, string.Empty);
|
||||
|
||||
if(!_actions.TryGetValue(route, out var action)) {
|
||||
if (!_actions.TryGetValue(route, out var action))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -136,12 +136,12 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
{
|
||||
try
|
||||
{
|
||||
if(message == null)
|
||||
if (message == null)
|
||||
{
|
||||
throw new ArgumentNullException("message");
|
||||
}
|
||||
|
||||
if(_device == null)
|
||||
if (_device == null)
|
||||
{
|
||||
throw new ArgumentNullException("device");
|
||||
}
|
||||
|
|
@ -154,7 +154,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
|
||||
PostStatusMessage(JToken.FromObject(message), MessagePath, clientId);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogMessage(ex, "Exception posting status message", this);
|
||||
}
|
||||
}
|
||||
|
|
@ -202,17 +203,17 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
{
|
||||
Type = $"/event{MessagePath}/{message.EventType}",
|
||||
Content = JToken.FromObject(message),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
protected void PostEventMessage(DeviceEventMessageBase message, string eventType)
|
||||
{
|
||||
{
|
||||
message.Key = _device.Key;
|
||||
|
||||
|
||||
message.Name = _device.Name;
|
||||
|
||||
message.EventType = eventType;
|
||||
|
||||
|
||||
AppServerController?.SendMessageObject(new MobileControlMessage
|
||||
{
|
||||
Type = $"/event{MessagePath}/{eventType}",
|
||||
|
|
|
|||
|
|
@ -3,12 +3,11 @@ using Newtonsoft.Json.Linq;
|
|||
using PepperDash.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
public static class PressAndHoldHandler
|
||||
{
|
||||
{
|
||||
private const long ButtonHeartbeatInterval = 1000;
|
||||
|
||||
private static readonly Dictionary<string, CTimer> _pushedActions = new Dictionary<string, CTimer>();
|
||||
|
|
@ -54,7 +53,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
private static void ResetTimer(string deviceKey, Action<bool> action)
|
||||
{
|
||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Attempting to reset timer for {deviceKey}", deviceKey);
|
||||
|
||||
|
||||
if (!_pushedActions.TryGetValue(deviceKey, out CTimer cancelTimer))
|
||||
{
|
||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Timer for {deviceKey} not found", deviceKey);
|
||||
|
|
@ -70,7 +69,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
{
|
||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Attempting to stop timer for {deviceKey}", deviceKey);
|
||||
|
||||
if (!_pushedActions.TryGetValue(deviceKey, out CTimer cancelTimer)) {
|
||||
if (!_pushedActions.TryGetValue(deviceKey, out CTimer cancelTimer))
|
||||
{
|
||||
Debug.LogMessage(Serilog.Events.LogEventLevel.Debug, "Timer for {deviceKey} not found", deviceKey);
|
||||
return;
|
||||
}
|
||||
|
|
@ -110,7 +110,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
return;
|
||||
}
|
||||
|
||||
timerHandler(deviceKey, action);
|
||||
timerHandler(deviceKey, action);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using PepperDash.Essentials.Room.Config;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
@ -44,12 +43,12 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
private void SendFullStatus()
|
||||
{
|
||||
PostStatusMessage(JToken.FromObject(new
|
||||
{
|
||||
calls = GetCurrentCallList(),
|
||||
currentCallString = _eisc.GetString(JoinMap.CurrentCallName.JoinNumber),
|
||||
currentDialString = _eisc.GetString(JoinMap.CurrentDialString.JoinNumber),
|
||||
isInCall = _eisc.GetString(JoinMap.HookState.JoinNumber) == "Connected"
|
||||
})
|
||||
{
|
||||
calls = GetCurrentCallList(),
|
||||
currentCallString = _eisc.GetString(JoinMap.CurrentCallName.JoinNumber),
|
||||
currentDialString = _eisc.GetString(JoinMap.CurrentDialString.JoinNumber),
|
||||
isInCall = _eisc.GetString(JoinMap.HookState.JoinNumber) == "Connected"
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -139,9 +138,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
private void SendCallsList()
|
||||
{
|
||||
PostStatusMessage(JToken.FromObject(new
|
||||
{
|
||||
calls = GetCurrentCallList(),
|
||||
})
|
||||
{
|
||||
calls = GetCurrentCallList(),
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -125,11 +125,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
}
|
||||
|
||||
PostStatusMessage(JToken.FromObject(new
|
||||
{
|
||||
cameraMode = GetCameraMode(),
|
||||
hasPresets = _eisc.GetBool(_joinMap.SupportsPresets.JoinNumber),
|
||||
presets = presetList
|
||||
})
|
||||
{
|
||||
cameraMode = GetCameraMode(),
|
||||
hasPresets = _eisc.GetBool(_joinMap.SupportsPresets.JoinNumber),
|
||||
presets = presetList
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
|
|
|
|||
|
|
@ -60,9 +60,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
sourceKey = "none";
|
||||
|
||||
PostStatusMessage(JToken.FromObject(new
|
||||
{
|
||||
selectedSourceKey = sourceKey
|
||||
})
|
||||
{
|
||||
selectedSourceKey = sourceKey
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using PepperDash.Essentials.Devices.Common.Cameras;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using System;
|
||||
|
|
@ -44,7 +43,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
/// </summary>
|
||||
/// <param name="appServerController"></param>
|
||||
protected override void RegisterActions()
|
||||
{
|
||||
{
|
||||
_eisc.SetStringSigAction(JoinMap.HookState.JoinNumber, s =>
|
||||
{
|
||||
_currentCallItem.Status = (eCodecCallStatus)Enum.Parse(typeof(eCodecCallStatus), s, true);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using Newtonsoft.Json;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using PepperDash.Essentials.Core.Shades;
|
||||
using System;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using PepperDash.Essentials.Core.Monitoring;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -71,15 +70,15 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
|
||||
// This takes a while, launch a new thread
|
||||
Task.Run(() => PostStatusMessage(JToken.FromObject(new SystemMonitorStateMessage
|
||||
{
|
||||
{
|
||||
|
||||
TimeZone = systemMonitor.TimeZoneFeedback.IntValue,
|
||||
TimeZoneName = systemMonitor.TimeZoneTextFeedback.StringValue,
|
||||
IoControllerVersion = systemMonitor.IoControllerVersionFeedback.StringValue,
|
||||
SnmpVersion = systemMonitor.SnmpVersionFeedback.StringValue,
|
||||
BacnetVersion = systemMonitor.BaCnetAppVersionFeedback.StringValue,
|
||||
ControllerVersion = systemMonitor.ControllerVersionFeedback.StringValue
|
||||
})
|
||||
TimeZone = systemMonitor.TimeZoneFeedback.IntValue,
|
||||
TimeZoneName = systemMonitor.TimeZoneTextFeedback.StringValue,
|
||||
IoControllerVersion = systemMonitor.IoControllerVersionFeedback.StringValue,
|
||||
SnmpVersion = systemMonitor.SnmpVersionFeedback.StringValue,
|
||||
BacnetVersion = systemMonitor.BaCnetAppVersionFeedback.StringValue,
|
||||
ControllerVersion = systemMonitor.ControllerVersionFeedback.StringValue
|
||||
})
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,10 +47,10 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
private void CurrentInputFeedbackOnOutputChange(object sender, FeedbackEventArgs feedbackEventArgs)
|
||||
{
|
||||
PostStatusMessage(JToken.FromObject(new
|
||||
{
|
||||
currentInput = feedbackEventArgs.StringValue
|
||||
})
|
||||
);
|
||||
{
|
||||
currentInput = feedbackEventArgs.StringValue
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -66,21 +66,21 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
private void IsWarmingFeedbackOnOutputChange(object sender, FeedbackEventArgs feedbackEventArgs)
|
||||
{
|
||||
PostStatusMessage(JToken.FromObject(new
|
||||
{
|
||||
isWarming = feedbackEventArgs.BoolValue
|
||||
})
|
||||
);
|
||||
{
|
||||
isWarming = feedbackEventArgs.BoolValue
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
private void IsCoolingFeedbackOnOutputChange(object sender, FeedbackEventArgs feedbackEventArgs)
|
||||
{
|
||||
PostStatusMessage(JToken.FromObject(new
|
||||
{
|
||||
isCooling = feedbackEventArgs.BoolValue
|
||||
})
|
||||
{
|
||||
isCooling = feedbackEventArgs.BoolValue
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue