mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-14 20:24:57 +00:00
Merge branch 'development' into hotfix/dm-build-issues
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
@@ -8,6 +9,7 @@ namespace PepperDash_Essentials_Core.Devices
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interface for any device that is able to control it'spower and has a configurable reboot time
|
/// Interface for any device that is able to control it'spower and has a configurable reboot time
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Obsolete("PepperDash_Essentials_Core.Devices is Deprecated - use PepperDash.Essentials.Core")]
|
||||||
public interface IHasPowerCycle : IKeyName, IHasPowerControlWithFeedback
|
public interface IHasPowerCycle : IKeyName, IHasPowerControlWithFeedback
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -24,6 +26,7 @@ namespace PepperDash_Essentials_Core.Devices
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interface for any device that contains a collection of IHasPowerReboot Devices
|
/// Interface for any device that contains a collection of IHasPowerReboot Devices
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Obsolete("PepperDash_Essentials_Core.Devices is Deprecated - use PepperDash.Essentials.Core")]
|
||||||
public interface IHasControlledPowerOutlets : IKeyName
|
public interface IHasControlledPowerOutlets : IKeyName
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
using Crestron.SimplSharp;
|
||||||
|
using PepperDash.Core;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interface for any device that has a battery that can be monitored
|
||||||
|
/// </summary>
|
||||||
|
public interface IHasBatteryStats : IKeyName
|
||||||
|
{
|
||||||
|
int BatteryPercentage { get; }
|
||||||
|
int BatteryCautionThresholdPercentage { get; }
|
||||||
|
int BatteryWarningThresholdPercentage { get; }
|
||||||
|
BoolFeedback BatteryIsWarningFeedback { get; }
|
||||||
|
BoolFeedback BatteryIsCautionFeedback { get; }
|
||||||
|
BoolFeedback BatteryIsOkFeedback { get; }
|
||||||
|
IntFeedback BatteryPercentageFeedback { get; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interface for any device that has a battery that can be monitored and the ability to charge and discharge
|
||||||
|
/// </summary>
|
||||||
|
public interface IHasBatteryCharging : IHasBatteryStats
|
||||||
|
{
|
||||||
|
BoolFeedback BatteryIsCharging { get; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interface for any device that has multiple batteries that can be monitored
|
||||||
|
/// </summary>
|
||||||
|
public interface IHasBatteries : IKeyName
|
||||||
|
{
|
||||||
|
ReadOnlyDictionary<string, IHasBatteryStats> Batteries { get; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IHasBatteryStatsExtended : IHasBatteryStats
|
||||||
|
{
|
||||||
|
int InputVoltage { get; }
|
||||||
|
int OutputVoltage { get; }
|
||||||
|
int InptuCurrent { get; }
|
||||||
|
int OutputCurrent { get; }
|
||||||
|
|
||||||
|
IntFeedback InputVoltageFeedback { get; }
|
||||||
|
IntFeedback OutputVoltageFeedback { get; }
|
||||||
|
IntFeedback InputCurrentFeedback { get; }
|
||||||
|
IntFeedback OutputCurrentFeedback { get; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interface for any device that is able to control its power, has a configurable reboot time, and has batteries that can be monitored
|
||||||
|
/// </summary>
|
||||||
|
public interface IHasPowerCycleWithBattery : IHasPowerCycle, IHasBatteryStats
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interface for any device that is able to control it's power and has a configurable reboot time
|
||||||
|
/// </summary>
|
||||||
|
public interface IHasPowerCycle : IKeyName, IHasPowerControlWithFeedback
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Delay between power off and power on for reboot
|
||||||
|
/// </summary>
|
||||||
|
int PowerCycleTimeMs { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reboot outlet
|
||||||
|
/// </summary>
|
||||||
|
void PowerCycle();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interface for any device that contains a collection of IHasPowerReboot Devices
|
||||||
|
/// </summary>
|
||||||
|
public interface IHasControlledPowerOutlets : IKeyName
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Collection of IPduOutlets
|
||||||
|
/// </summary>
|
||||||
|
ReadOnlyDictionary<int, IHasPowerCycle> PduOutlets { get; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -21,35 +21,37 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="fileName"></param>
|
/// <param name="fileName"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static FileInfo[] GetFiles(string fileName)
|
public static FileInfo[] GetFiles(string fileName)
|
||||||
{
|
{
|
||||||
DirectoryInfo dirInfo = new DirectoryInfo(Path.GetDirectoryName(fileName));
|
string fullFilePath = Global.FilePathPrefix + fileName;
|
||||||
var files = dirInfo.GetFiles(Path.GetFileName(fileName));
|
DirectoryInfo dirInfo = new DirectoryInfo(Path.GetDirectoryName(fullFilePath));
|
||||||
Debug.Console(0, "FileIO found: {0}, {1}", files.Count(), fileName);
|
var files = dirInfo.GetFiles(Path.GetFileName(fullFilePath));
|
||||||
if (files.Count() > 0)
|
Debug.Console(0, "FileIO found: {0}, {1}", files.Count(), fullFilePath);
|
||||||
{
|
if (files.Count() > 0)
|
||||||
return files;
|
{
|
||||||
}
|
return files;
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
return null;
|
{
|
||||||
}
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static FileInfo GetFile(string fileName)
|
public static FileInfo GetFile(string fileName)
|
||||||
{
|
{
|
||||||
DirectoryInfo dirInfo = new DirectoryInfo(Path.GetDirectoryName(fileName));
|
string fullFilePath = Global.FilePathPrefix + fileName;
|
||||||
var files = dirInfo.GetFiles(Path.GetFileName(fileName));
|
DirectoryInfo dirInfo = new DirectoryInfo(Path.GetDirectoryName(fullFilePath));
|
||||||
Debug.Console(0, "FileIO found: {0}, {1}", files.Count(), fileName);
|
var files = dirInfo.GetFiles(Path.GetFileName(fullFilePath));
|
||||||
if (files.Count() > 0)
|
Debug.Console(0, "FileIO found: {0}, {1}", files.Count(), fullFilePath);
|
||||||
{
|
if (files.Count() > 0)
|
||||||
return files.FirstOrDefault();
|
{
|
||||||
}
|
return files.FirstOrDefault();
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
return null;
|
{
|
||||||
}
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -81,7 +83,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
{
|
{
|
||||||
if (fileLock.TryEnter())
|
if (fileLock.TryEnter())
|
||||||
{
|
{
|
||||||
DirectoryInfo dirInfo = new DirectoryInfo(file.Name);
|
DirectoryInfo dirInfo = new DirectoryInfo(file.DirectoryName);
|
||||||
Debug.Console(2, "FileIO Getting Data {0}", file.FullName);
|
Debug.Console(2, "FileIO Getting Data {0}", file.FullName);
|
||||||
|
|
||||||
if (File.Exists(file.FullName))
|
if (File.Exists(file.FullName))
|
||||||
@@ -202,7 +204,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
public static void WriteDataToFile(string data, string filePath)
|
public static void WriteDataToFile(string data, string filePath)
|
||||||
{
|
{
|
||||||
Thread _WriteFileThread;
|
Thread _WriteFileThread;
|
||||||
_WriteFileThread = new Thread((O) => _WriteFileMethod(data, filePath), null, Thread.eThreadStartOptions.CreateSuspended);
|
_WriteFileThread = new Thread((O) => _WriteFileMethod(data, Global.FilePathPrefix + "/" + filePath), null, Thread.eThreadStartOptions.CreateSuspended);
|
||||||
_WriteFileThread.Priority = Thread.eThreadPriority.LowestPriority;
|
_WriteFileThread.Priority = Thread.eThreadPriority.LowestPriority;
|
||||||
_WriteFileThread.Start();
|
_WriteFileThread.Start();
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "New WriteFile Thread");
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "New WriteFile Thread");
|
||||||
@@ -217,7 +219,8 @@ namespace PepperDash.Essentials.Core
|
|||||||
{
|
{
|
||||||
if (fileLock.TryEnter())
|
if (fileLock.TryEnter())
|
||||||
{
|
{
|
||||||
using (StreamWriter sw = new StreamWriter(filePath))
|
|
||||||
|
using (StreamWriter sw = new StreamWriter(filePath))
|
||||||
{
|
{
|
||||||
sw.Write(data);
|
sw.Write(data);
|
||||||
sw.Flush();
|
sw.Flush();
|
||||||
|
|||||||
@@ -200,6 +200,7 @@
|
|||||||
<Compile Include="Crestron IO\Relay\GenericRelayDevice.cs" />
|
<Compile Include="Crestron IO\Relay\GenericRelayDevice.cs" />
|
||||||
<Compile Include="Crestron IO\Relay\ISwitchedOutput.cs" />
|
<Compile Include="Crestron IO\Relay\ISwitchedOutput.cs" />
|
||||||
<Compile Include="Crestron IO\StatusSign\StatusSignController.cs" />
|
<Compile Include="Crestron IO\StatusSign\StatusSignController.cs" />
|
||||||
|
<Compile Include="Devices\PowerInterfaces.cs" />
|
||||||
<Compile Include="Web\RequestHandlers\AppDebugRequestHandler.cs" />
|
<Compile Include="Web\RequestHandlers\AppDebugRequestHandler.cs" />
|
||||||
<Compile Include="Web\RequestHandlers\GetFeedbacksForDeviceRequestHandler.cs" />
|
<Compile Include="Web\RequestHandlers\GetFeedbacksForDeviceRequestHandler.cs" />
|
||||||
<Compile Include="Web\EssentialsWebApiHelpers.cs" />
|
<Compile Include="Web\EssentialsWebApiHelpers.cs" />
|
||||||
|
|||||||
Reference in New Issue
Block a user