mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-09 01:35:02 +00:00
Compare commits
28 Commits
feature/Ge
...
1.10.2-alp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ebd978d917 | ||
|
|
1c252521f0 | ||
|
|
641fa2101d | ||
|
|
0500a359b8 | ||
|
|
50e94eb373 | ||
|
|
96dbd44a04 | ||
|
|
a74753d4a3 | ||
|
|
768a93d44d | ||
|
|
46cb10f452 | ||
|
|
5386f0fffb | ||
|
|
ad3ae0de69 | ||
|
|
892167d236 | ||
|
|
e843098ac3 | ||
|
|
1566e04edf | ||
|
|
f902a57f60 | ||
|
|
33c7038d99 | ||
|
|
7f36a00813 | ||
|
|
c4843d68f4 | ||
|
|
7e8d88c3af | ||
|
|
c539c79135 | ||
|
|
281b6f065f | ||
|
|
acfbefca00 | ||
|
|
397c0f250b | ||
|
|
a1dce1bb17 | ||
|
|
15aacbd8c8 | ||
|
|
34a695ba95 | ||
|
|
0ab1ece445 | ||
|
|
747c68bd1e |
@@ -490,21 +490,17 @@ namespace PepperDash.Essentials
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AddRoomAndBuildMC(room);
|
||||||
|
|
||||||
if (room is IEssentialsHuddleSpaceRoom)
|
if (room is IEssentialsHuddleSpaceRoom)
|
||||||
{
|
{
|
||||||
DeviceManager.AddDevice(room);
|
|
||||||
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleSpaceRoom, attempting to add to DeviceManager with Fusion with IP-ID {0:X2}", fusionIpId);
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleSpaceRoom, attempting to add to DeviceManager with Fusion with IP-ID {0:X2}", fusionIpId);
|
||||||
DeviceManager.AddDevice(new Core.Fusion.EssentialsHuddleSpaceFusionSystemControllerBase(room, fusionIpId, fusionJoinMapKey));
|
DeviceManager.AddDevice(new Core.Fusion.EssentialsHuddleSpaceFusionSystemControllerBase(room, fusionIpId, fusionJoinMapKey));
|
||||||
|
|
||||||
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge...");
|
|
||||||
|
|
||||||
CreateMobileControlBridge(room);
|
|
||||||
}
|
}
|
||||||
else if (room is IEssentialsHuddleVtc1Room)
|
else if (room is IEssentialsHuddleVtc1Room)
|
||||||
{
|
{
|
||||||
DeviceManager.AddDevice(room);
|
|
||||||
|
|
||||||
if (!(room is EssentialsCombinedHuddleVtc1Room))
|
if (!(room is EssentialsCombinedHuddleVtc1Room))
|
||||||
{
|
{
|
||||||
@@ -512,28 +508,15 @@ namespace PepperDash.Essentials
|
|||||||
DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController((IEssentialsHuddleVtc1Room)room, fusionIpId, fusionJoinMapKey));
|
DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController((IEssentialsHuddleVtc1Room)room, fusionIpId, fusionJoinMapKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge...");
|
|
||||||
|
|
||||||
CreateMobileControlBridge(room);
|
|
||||||
}
|
}
|
||||||
else if (room is EssentialsTechRoom)
|
else if (room is EssentialsTechRoom)
|
||||||
{
|
{
|
||||||
DeviceManager.AddDevice(room);
|
|
||||||
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice,
|
Debug.Console(0, Debug.ErrorLogLevel.Notice,
|
||||||
"Room is EssentialsTechRoom, Attempting to add to DeviceManager with Fusion with IP-ID {0:X2}", fusionIpId);
|
"Room is EssentialsTechRoom, Attempting to add to DeviceManager with Fusion with IP-ID {0:X2}", fusionIpId);
|
||||||
DeviceManager.AddDevice(new EssentialsTechRoomFusionSystemController((EssentialsTechRoom)room, fusionIpId, fusionJoinMapKey));
|
DeviceManager.AddDevice(new EssentialsTechRoomFusionSystemController((EssentialsTechRoom)room, fusionIpId, fusionJoinMapKey));
|
||||||
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge");
|
|
||||||
|
|
||||||
CreateMobileControlBridge(room);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is NOT EssentialsRoom, attempting to add to DeviceManager w/o Fusion");
|
|
||||||
DeviceManager.AddDevice(room);
|
|
||||||
}
|
|
||||||
|
|
||||||
fusionIpId += 1;
|
fusionIpId += 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -547,6 +530,15 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void AddRoomAndBuildMC(IEssentialsRoom room)
|
||||||
|
{
|
||||||
|
DeviceManager.AddDevice(room);
|
||||||
|
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge");
|
||||||
|
|
||||||
|
CreateMobileControlBridge(room);
|
||||||
|
}
|
||||||
|
|
||||||
private static void CreateMobileControlBridge(object room)
|
private static void CreateMobileControlBridge(object room)
|
||||||
{
|
{
|
||||||
var mobileControl = GetMobileControlDevice();
|
var mobileControl = GetMobileControlDevice();
|
||||||
|
|||||||
@@ -19,32 +19,41 @@ namespace PepperDash.Essentials.Room.Config
|
|||||||
/// Returns a room object from this config data
|
/// Returns a room object from this config data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Device GetRoomObject(DeviceConfig roomConfig)
|
public static IKeyed GetRoomObject(DeviceConfig roomConfig)
|
||||||
{
|
{
|
||||||
var typeName = roomConfig.Type.ToLower();
|
var typeName = roomConfig.Type.ToLower();
|
||||||
|
|
||||||
if (typeName == "huddle")
|
switch (typeName)
|
||||||
{
|
|
||||||
return new EssentialsHuddleSpaceRoom(roomConfig);
|
|
||||||
}
|
|
||||||
if (typeName == "huddlevtc1")
|
|
||||||
{
|
{
|
||||||
return new EssentialsHuddleVtc1Room(roomConfig);
|
case "huddle" :
|
||||||
|
{
|
||||||
|
return new EssentialsHuddleSpaceRoom(roomConfig);
|
||||||
|
}
|
||||||
|
case "huddlevtc1" :
|
||||||
|
{
|
||||||
|
return new EssentialsHuddleVtc1Room(roomConfig);
|
||||||
|
}
|
||||||
|
case "ddvc01bridge" :
|
||||||
|
{
|
||||||
|
return new Device(roomConfig.Key, roomConfig.Name); // placeholder device that does nothing.
|
||||||
|
}
|
||||||
|
case "dualdisplay" :
|
||||||
|
{
|
||||||
|
return new EssentialsDualDisplayRoom(roomConfig);
|
||||||
|
}
|
||||||
|
case "combinedhuddlevtc1" :
|
||||||
|
{
|
||||||
|
return new EssentialsCombinedHuddleVtc1Room(roomConfig);
|
||||||
|
}
|
||||||
|
case "techroom" :
|
||||||
|
{
|
||||||
|
return new EssentialsTechRoom(roomConfig);
|
||||||
|
}
|
||||||
|
default :
|
||||||
|
{
|
||||||
|
return Core.DeviceFactory.GetDevice(roomConfig);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (typeName == "ddvc01bridge")
|
|
||||||
{
|
|
||||||
return new Device(roomConfig.Key, roomConfig.Name); // placeholder device that does nothing.
|
|
||||||
}
|
|
||||||
if (typeName == "dualdisplay")
|
|
||||||
{
|
|
||||||
return new EssentialsDualDisplayRoom(roomConfig);
|
|
||||||
}
|
|
||||||
if (typeName == "combinedhuddlevtc1")
|
|
||||||
{
|
|
||||||
return new EssentialsCombinedHuddleVtc1Room(roomConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
return typeName != "techroom" ? null : new EssentialsTechRoom(roomConfig);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -7,25 +7,61 @@ using Crestron.SimplSharp;
|
|||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines minimal volume control methods
|
/// Defines minimal volume and mute control methods
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IBasicVolumeControls
|
public interface IBasicVolumeControls
|
||||||
{
|
{
|
||||||
void VolumeUp(bool pressRelease);
|
void VolumeUp(bool pressRelease);
|
||||||
void VolumeDown(bool pressRelease);
|
void VolumeDown(bool pressRelease);
|
||||||
void MuteToggle();
|
void MuteToggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines basic volume control methods
|
||||||
|
/// </summary>
|
||||||
|
public interface IHasVolumeControl
|
||||||
|
{
|
||||||
|
void VolumeUp(bool pressRelease);
|
||||||
|
void VolumeDown(bool pressRelease);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines volume control methods and properties with feedback
|
||||||
|
/// </summary>
|
||||||
|
public interface IHasVolumeControlWithFeedback : IHasVolumeControl
|
||||||
|
{
|
||||||
|
void SetVolume(ushort level);
|
||||||
|
IntFeedback VolumeLevelFeedback { get; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines basic mute control methods
|
||||||
|
/// </summary>
|
||||||
|
public interface IHasMuteControl
|
||||||
|
{
|
||||||
|
void MuteToggle();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines mute control methods and properties with feedback
|
||||||
|
/// </summary>
|
||||||
|
public interface IHasMuteControlWithFeedback : IHasMuteControl
|
||||||
|
{
|
||||||
|
BoolFeedback MuteFeedback { get; }
|
||||||
|
void MuteOn();
|
||||||
|
void MuteOff();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds feedback and direct volume level set to IBasicVolumeControls
|
/// Adds feedback and direct volume level set to IBasicVolumeControls
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IBasicVolumeWithFeedback : IBasicVolumeControls
|
public interface IBasicVolumeWithFeedback : IBasicVolumeControls
|
||||||
{
|
{
|
||||||
void SetVolume(ushort level);
|
|
||||||
void MuteOn();
|
|
||||||
void MuteOff();
|
|
||||||
IntFeedback VolumeLevelFeedback { get; }
|
|
||||||
BoolFeedback MuteFeedback { get; }
|
BoolFeedback MuteFeedback { get; }
|
||||||
|
void MuteOn();
|
||||||
|
void MuteOff();
|
||||||
|
void SetVolume(ushort level);
|
||||||
|
IntFeedback VolumeLevelFeedback { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -0,0 +1,317 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharp.CrestronIO;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using Crestron.SimplSharpPro.CrestronThread;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
public static class FileIO
|
||||||
|
{
|
||||||
|
|
||||||
|
static CCriticalSection fileLock = new CCriticalSection();
|
||||||
|
public delegate void GotFileEventHandler(object sender, FileEventArgs e);
|
||||||
|
public static event GotFileEventHandler GotFileEvent;
|
||||||
|
private static Dictionary<string, CTimer> WriteTimers;
|
||||||
|
public const long WriteTimeout = 5000;
|
||||||
|
/// <summary>
|
||||||
|
/// Get the full file info from a path/filename, can include wildcards.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fileName"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
///
|
||||||
|
static FileIO()
|
||||||
|
{
|
||||||
|
WriteTimers = new Dictionary<string, CTimer>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FileInfo[] GetFiles(string fileName)
|
||||||
|
{
|
||||||
|
DirectoryInfo dirInfo = new DirectoryInfo(Path.GetDirectoryName(fileName));
|
||||||
|
var files = dirInfo.GetFiles(Path.GetFileName(fileName));
|
||||||
|
Debug.Console(0, "FileIO found: {0}, {1}", files.Count(), fileName);
|
||||||
|
if (files.Count() > 0)
|
||||||
|
{
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FileInfo GetFile(string fileName)
|
||||||
|
{
|
||||||
|
DirectoryInfo dirInfo = new DirectoryInfo(Path.GetDirectoryName(fileName));
|
||||||
|
var files = dirInfo.GetFiles(Path.GetFileName(fileName));
|
||||||
|
Debug.Console(0, "FileIO found: {0}, {1}", files.Count(), fileName);
|
||||||
|
if (files.Count() > 0)
|
||||||
|
{
|
||||||
|
return files.FirstOrDefault();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the data from string path/filename
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fileName"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string ReadDataFromFile(string fileName)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return ReadDataFromFile(GetFile(fileName));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO read failed: \r{0}", e);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the data with fileInfo object
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fileName"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string ReadDataFromFile(FileInfo file)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (fileLock.TryEnter())
|
||||||
|
{
|
||||||
|
Debug.Console(2, "FileIO Getting Data {0}", file.FullName);
|
||||||
|
|
||||||
|
if (File.Exists(file.FullName))
|
||||||
|
{
|
||||||
|
using (StreamReader r = new StreamReader(file.FullName))
|
||||||
|
{
|
||||||
|
return r.ReadToEnd();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Console(2, "File {0} does not exsist", file.FullName);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Error, "FileIO Unable to enter FileLock");
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO read failed: \r{0}", e);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (fileLock != null && !fileLock.Disposed)
|
||||||
|
fileLock.Leave();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void ReadDataFromFileASync(string fileName)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ReadDataFromFileASync(GetFile(fileName));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO read failed: \r{0}", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ReadDataFromFileASync(FileInfo file)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
CrestronInvoke.BeginInvoke(o => _ReadDataFromFileASync(file));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO read failed: \r{0}", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void _ReadDataFromFileASync(FileInfo file)
|
||||||
|
{
|
||||||
|
string data;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (fileLock.TryEnter())
|
||||||
|
{
|
||||||
|
DirectoryInfo dirInfo = new DirectoryInfo(file.Name);
|
||||||
|
Debug.Console(2, "FileIO Getting Data {0}", file.FullName);
|
||||||
|
|
||||||
|
|
||||||
|
if (File.Exists(file.FullName))
|
||||||
|
{
|
||||||
|
using (StreamReader r = new StreamReader(file.FullName))
|
||||||
|
{
|
||||||
|
data = r.ReadToEnd();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Console(2, "File {0} Does not exsist", file.FullName);
|
||||||
|
data = "";
|
||||||
|
}
|
||||||
|
GotFileEvent.Invoke(null, new FileEventArgs(data));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Error, "FileIO Unable to enter FileLock retrying");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO read failed: \r{0}", e);
|
||||||
|
data = "";
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (fileLock != null && !fileLock.Disposed)
|
||||||
|
fileLock.Leave();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets (or starts) the write timer
|
||||||
|
/// </summary>
|
||||||
|
static void ResetTimer(string data, string filePath)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (WriteTimers.ContainsKey(filePath))
|
||||||
|
{
|
||||||
|
WriteTimers[filePath].Stop();
|
||||||
|
WriteTimers[filePath] = null;
|
||||||
|
WriteTimers.Remove(filePath);
|
||||||
|
}
|
||||||
|
WriteTimers.Add(filePath, new CTimer((o) =>
|
||||||
|
{
|
||||||
|
Thread _WriteFileThread;
|
||||||
|
_WriteFileThread = new Thread((O) => _WriteFileMethod(data, filePath), null, Thread.eThreadStartOptions.CreateSuspended);
|
||||||
|
_WriteFileThread.Priority = Thread.eThreadPriority.LowestPriority;
|
||||||
|
_WriteFileThread.Start();
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "New WriteFile Thread");
|
||||||
|
WriteTimers.Remove(filePath);
|
||||||
|
}, WriteTimeout));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Debug.Console(0, "FileIO write timer has been reset.");
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO ResetTimer failed: \r{0}", e);
|
||||||
|
data = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="data"></param>
|
||||||
|
/// <param name="filePath"></param>
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="data"></param>
|
||||||
|
/// <param name="filePath"></param>
|
||||||
|
public static void WriteDataToFile(string data, string filePath)
|
||||||
|
{
|
||||||
|
ResetTimer(data, filePath);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static object _WriteFileMethod(string data, string filePath)
|
||||||
|
{
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to write file: '{0}'", filePath);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (fileLock.TryEnter())
|
||||||
|
{
|
||||||
|
using (StreamWriter sw = new StreamWriter(filePath))
|
||||||
|
{
|
||||||
|
sw.Write(data);
|
||||||
|
sw.Flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Error, "FileIO Unable to enter FileLock");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO write failed: \r{0}", e);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (fileLock != null && !fileLock.Disposed)
|
||||||
|
fileLock.Leave();
|
||||||
|
|
||||||
|
}
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Notice, "File Written to : '{0}'", filePath);
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool FileIoUnitTest()
|
||||||
|
{
|
||||||
|
var testData = "Testing FileIO";
|
||||||
|
FileIO.WriteDataToFile(testData, "\\user\\FileIOTest.pdt");
|
||||||
|
|
||||||
|
var file = FileIO.GetFile("\\user\\*FileIOTest*");
|
||||||
|
|
||||||
|
var readData = FileIO.ReadDataFromFile(file);
|
||||||
|
Debug.Console(0, "Returned {0}", readData);
|
||||||
|
File.Delete(file.FullName);
|
||||||
|
if (testData == readData)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public class FileEventArgs
|
||||||
|
{
|
||||||
|
public FileEventArgs(string data) { Data = data; }
|
||||||
|
public string Data { get; private set; } // readonly
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -99,13 +99,18 @@ namespace PepperDash.Essentials.Core.Lighting
|
|||||||
var sceneIndex = 0;
|
var sceneIndex = 0;
|
||||||
foreach (var scene in lightingDevice.LightingScenes)
|
foreach (var scene in lightingDevice.LightingScenes)
|
||||||
{
|
{
|
||||||
trilist.SetSigTrueAction((uint)(joinMap.SelectSceneDirect.JoinNumber + sceneIndex), () => lightingDevice.SelectScene(lightingDevice.LightingScenes[sceneIndex]));
|
var index1 = sceneIndex;
|
||||||
|
trilist.SetSigTrueAction((uint)(joinMap.SelectSceneDirect.JoinNumber + sceneIndex), () =>
|
||||||
|
{
|
||||||
|
var index = index1;
|
||||||
|
Debug.Console(2, this, "LightingDevice: sceneIndex: {0} index: {1} > inside action", index1, index);
|
||||||
|
lightingDevice.SelectScene(lightingDevice.LightingScenes[index]);
|
||||||
|
});
|
||||||
scene.IsActiveFeedback.LinkInputSig(trilist.BooleanInput[(uint)(joinMap.SelectSceneDirect.JoinNumber + sceneIndex)]);
|
scene.IsActiveFeedback.LinkInputSig(trilist.BooleanInput[(uint)(joinMap.SelectSceneDirect.JoinNumber + sceneIndex)]);
|
||||||
trilist.StringInput[(uint)(joinMap.SelectSceneDirect.JoinNumber + sceneIndex)].StringValue = scene.Name;
|
trilist.StringInput[(uint)(joinMap.SelectSceneDirect.JoinNumber + sceneIndex)].StringValue = scene.Name;
|
||||||
trilist.BooleanInput[(uint)(joinMap.ButtonVisibility.JoinNumber + sceneIndex)].BoolValue = true;
|
trilist.BooleanInput[(uint)(joinMap.ButtonVisibility.JoinNumber + sceneIndex)].BoolValue = true;
|
||||||
sceneIndex++;
|
sceneIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return joinMap;
|
return joinMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -224,6 +224,7 @@
|
|||||||
<Compile Include="Feedbacks\IntFeedback.cs" />
|
<Compile Include="Feedbacks\IntFeedback.cs" />
|
||||||
<Compile Include="Feedbacks\SerialFeedback.cs" />
|
<Compile Include="Feedbacks\SerialFeedback.cs" />
|
||||||
<Compile Include="Feedbacks\StringFeedback.cs" />
|
<Compile Include="Feedbacks\StringFeedback.cs" />
|
||||||
|
<Compile Include="File\FileIO.cs" />
|
||||||
<Compile Include="Fusion\EssentialsHuddleSpaceFusionSystemControllerBase.cs" />
|
<Compile Include="Fusion\EssentialsHuddleSpaceFusionSystemControllerBase.cs" />
|
||||||
<Compile Include="Fusion\FusionCustomPropertiesBridge.cs" />
|
<Compile Include="Fusion\FusionCustomPropertiesBridge.cs" />
|
||||||
<Compile Include="Fusion\FusionEventHandlers.cs" />
|
<Compile Include="Fusion\FusionEventHandlers.cs" />
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ namespace PepperDash.Essentials.Devices.Displays
|
|||||||
//Send((string)selector);
|
//Send((string)selector);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetVolume(ushort level)
|
public void SetVolume(ushort level)
|
||||||
{
|
{
|
||||||
var levelString = string.Format("{0}{1:X4}\x03", VolumeLevelPartialCmd, level);
|
var levelString = string.Format("{0}{1:X4}\x03", VolumeLevelPartialCmd, level);
|
||||||
AppendChecksumAndSend(levelString);
|
AppendChecksumAndSend(levelString);
|
||||||
@@ -333,10 +333,13 @@ namespace PepperDash.Essentials.Devices.Displays
|
|||||||
Send(MuteOnCmd);
|
Send(MuteOnCmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IBasicVolumeWithFeedback.SetVolume(ushort level)
|
|
||||||
|
/*
|
||||||
|
public void IBasicVolumeWithFeedback.SetVolume(ushort level)
|
||||||
{
|
{
|
||||||
SetVolume(level);
|
SetVolume(level);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ namespace PepperDash.Essentials.Devices.Displays
|
|||||||
//Send((string)selector);
|
//Send((string)selector);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetVolume(ushort level)
|
public void SetVolume(ushort level)
|
||||||
{
|
{
|
||||||
var levelString = string.Format("{0}{1:X3}\x03", VolumeLevelPartialCmd, level);
|
var levelString = string.Format("{0}{1:X3}\x03", VolumeLevelPartialCmd, level);
|
||||||
|
|
||||||
@@ -315,11 +315,12 @@ namespace PepperDash.Essentials.Devices.Displays
|
|||||||
Send(MuteOnCmd);
|
Send(MuteOnCmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
void IBasicVolumeWithFeedback.SetVolume(ushort level)
|
void IBasicVolumeWithFeedback.SetVolume(ushort level)
|
||||||
{
|
{
|
||||||
SetVolume(level);
|
SetVolume(level);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IBasicVolumeControls Members
|
#region IBasicVolumeControls Members
|
||||||
|
|||||||
Reference in New Issue
Block a user