mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-08-31 19:08:29 +00:00
feat: update documentation links and remove obsolete files
This commit is contained in:
parent
da2a09f7cb
commit
0d4fd7773e
6 changed files with 3 additions and 176 deletions
|
|
@ -52,7 +52,7 @@ Utilization of Essentials Framework falls into the following categories:
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
For detailed documentation, see the [Wiki](https://github.com/PepperDash/EssentialsFramework/wiki).
|
For detailed documentation, see the [DocFx Site](https://pepperdash.github.io/Essentials/).
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,13 @@ Or use the links to the right to navigate our documentation.
|
||||||
|
|
||||||
## Benefits
|
## Benefits
|
||||||
|
|
||||||
- Runs on Crestron 3-Series, **4-Series** and VC-4 Control System platforms
|
- Runs on Crestron **4-Series** and VC-4 Control System platforms
|
||||||
- Reduced hardware overhead compared to S+ and Simpl solutions
|
- Reduced hardware overhead compared to S+ and Simpl solutions
|
||||||
- Quick development cycle
|
- Quick development cycle
|
||||||
- Shared resources made easily available
|
- Shared resources made easily available
|
||||||
- More flexibility with less code
|
- More flexibility with less code
|
||||||
- Configurable using simple JSON files
|
- Configurable using simple JSON files
|
||||||
|
- Built in websocket communication API for HTML5 frontend applications.
|
||||||
- Is awesome
|
- Is awesome
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -1,128 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
using Crestron.SimplSharpPro;
|
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
|
||||||
|
|
||||||
using PepperDash.Core;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A bridge class to cover the basic features of GenericBase hardware
|
|
||||||
/// </summary>
|
|
||||||
public class CrestronGenericBaseDevice : Device, IOnline, IHasFeedback, ICommunicationMonitor, IUsageTracking
|
|
||||||
{
|
|
||||||
public virtual GenericBase Hardware { get; protected set; }
|
|
||||||
|
|
||||||
public BoolFeedback IsOnline { get; private set; }
|
|
||||||
public BoolFeedback IsRegistered { get; private set; }
|
|
||||||
public StringFeedback IpConnectionsText { get; private set; }
|
|
||||||
|
|
||||||
public CrestronGenericBaseDevice(string key, string name, GenericBase hardware)
|
|
||||||
: base(key, name)
|
|
||||||
{
|
|
||||||
Hardware = hardware;
|
|
||||||
IsOnline = new BoolFeedback(CommonBoolCue.IsOnlineFeedback, () => Hardware.IsOnline);
|
|
||||||
IsRegistered = new BoolFeedback(new Cue("IsRegistered", 0, eCueType.Bool), () => Hardware.Registered);
|
|
||||||
IpConnectionsText = new StringFeedback(CommonStringCue.IpConnectionsText, () =>
|
|
||||||
string.Join(",", Hardware.ConnectedIpList.Select(cip => cip.DeviceIpAddress).ToArray()));
|
|
||||||
CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, hardware, 120000, 300000);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Make sure that overriding classes call this!
|
|
||||||
/// Registers the Crestron device, connects up to the base events, starts communication monitor
|
|
||||||
/// </summary>
|
|
||||||
protected override bool CustomActivate()
|
|
||||||
{
|
|
||||||
Debug.LogMessage(LogEventLevel.Information, this, "Activating");
|
|
||||||
var response = Hardware.RegisterWithLogging(Key);
|
|
||||||
if (response != eDeviceRegistrationUnRegistrationResponse.Success)
|
|
||||||
{
|
|
||||||
<<<<<<< HEAD
|
|
||||||
Debug.LogMessage(LogEventLevel.Information, this, "ERROR: Cannot register Crestron device: {0}", response);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
=======
|
|
||||||
Debug.LogMessage(LogEventLevel.Information, this, "ERROR: Cannot register Crestron device: {0}", response);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
>>>>>>> origin/feature/ecs-342-neil
|
|
||||||
Hardware.OnlineStatusChange += new OnlineStatusChangeEventHandler(Hardware_OnlineStatusChange);
|
|
||||||
CommunicationMonitor.Start();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This disconnects events and unregisters the base hardware device.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public override bool Deactivate()
|
|
||||||
{
|
|
||||||
CommunicationMonitor.Stop();
|
|
||||||
Hardware.OnlineStatusChange -= Hardware_OnlineStatusChange;
|
|
||||||
|
|
||||||
return Hardware.UnRegister() == eDeviceRegistrationUnRegistrationResponse.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns a list containing the Outputs that we want to expose.
|
|
||||||
/// </summary>
|
|
||||||
public virtual List<Feedback> Feedbacks
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return new List<Feedback>
|
|
||||||
{
|
|
||||||
IsOnline,
|
|
||||||
IsRegistered,
|
|
||||||
IpConnectionsText
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Hardware_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
|
|
||||||
{
|
|
||||||
IsOnline.FireUpdate();
|
|
||||||
}
|
|
||||||
|
|
||||||
#region IStatusMonitor Members
|
|
||||||
|
|
||||||
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region IUsageTracking Members
|
|
||||||
|
|
||||||
public UsageTracking UsageTracker { get; set; }
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
|
|
||||||
//***********************************************************************************
|
|
||||||
public class CrestronGenericBaseDeviceEventIds
|
|
||||||
{
|
|
||||||
public const uint IsOnline = 1;
|
|
||||||
public const uint IpConnectionsText =2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds logging to Register() failure
|
|
||||||
/// </summary>
|
|
||||||
public static class GenericBaseExtensions
|
|
||||||
{
|
|
||||||
public static eDeviceRegistrationUnRegistrationResponse RegisterWithLogging(this GenericBase device, string key)
|
|
||||||
{
|
|
||||||
var result = device.Register();
|
|
||||||
if (result != eDeviceRegistrationUnRegistrationResponse.Success)
|
|
||||||
{
|
|
||||||
Debug.LogMessage(LogEventLevel.Information, "Cannot register device '{0}': {1}", key, result);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -28,12 +28,6 @@
|
||||||
<PackageReference Include="Crestron.SimplSharp.SDK.ProgramLibrary" Version="2.21.128" />
|
<PackageReference Include="Crestron.SimplSharp.SDK.ProgramLibrary" Version="2.21.128" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<None Include="Crestron\CrestronGenericBaseDevice.cs.orig" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Display\" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\PepperDash.Core\PepperDash.Core.csproj" />
|
<ProjectReference Include="..\PepperDash.Core\PepperDash.Core.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
|
||||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=Crestron_0020Web_0020Server/@EntryIndexedValue">True</s:Boolean>
|
|
||||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=Web/@EntryIndexedValue">False</s:Boolean></wpf:ResourceDictionary>
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Net.WebSockets;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
public class SomeWebSocketClass
|
|
||||||
{
|
|
||||||
private ClientWebSocket _webSocket;
|
|
||||||
|
|
||||||
public SomeWebSocketClass()
|
|
||||||
{
|
|
||||||
_webSocket = new ClientWebSocket();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task ConnectAsync(Uri uri)
|
|
||||||
{
|
|
||||||
await _webSocket.ConnectAsync(uri, CancellationToken.None);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task SendAsync(string message)
|
|
||||||
{
|
|
||||||
var buffer = System.Text.Encoding.UTF8.GetBytes(message);
|
|
||||||
await _webSocket.SendAsync(new ArraySegment<byte>(buffer), WebSocketMessageType.Text, true, CancellationToken.None);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<string> ReceiveAsync()
|
|
||||||
{
|
|
||||||
var buffer = new byte[1024];
|
|
||||||
var result = await _webSocket.ReceiveAsync(new ArraySegment<byte>(buffer), CancellationToken.None);
|
|
||||||
return System.Text.Encoding.UTF8.GetString(buffer, 0, result.Count);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task CloseAsync()
|
|
||||||
{
|
|
||||||
await _webSocket.CloseAsync(WebSocketCloseStatus.NormalClosure, string.Empty, CancellationToken.None);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue