Work in progress. Add EventArgs.cs to root of PepperDash core, exposing the event arg classes to everything in PDC

This commit is contained in:
Jason DeVito
2019-10-11 17:48:56 -05:00
parent 9ba46eb3d5
commit 5808e53618
16 changed files with 1616 additions and 306 deletions

View File

@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Core.JsonToSimpl
{
/// <summary>
/// Constants for Simpl modules
/// </summary>
public class JsonToSimplConstants
{
public const ushort BoolValueChange = 1;
public const ushort JsonIsValidBoolChange = 2;
public const ushort UshortValueChange = 101;
public const ushort StringValueChange = 201;
public const ushort FullPathToArrayChange = 202;
public const ushort ActualFilePathChange = 203;
// TODO: pdc-20: Added below constants for passing file path and filename back to S+
public const ushort FilenameResolvedChange = 204;
public const ushort FilePathResolvedChange = 205;
}
/// <summary>
/// S+ values delegate
/// </summary>
public delegate void SPlusValuesDelegate();
/// <summary>
/// S+ values wrapper
/// </summary>
public class SPlusValueWrapper
{
public SPlusType ValueType { get; private set; }
public ushort Index { get; private set; }
public ushort BoolUShortValue { get; set; }
public string StringValue { get; set; }
public SPlusValueWrapper() { }
public SPlusValueWrapper(SPlusType type, ushort index)
{
ValueType = type;
Index = index;
}
}
/// <summary>
/// S+ types enum
/// </summary>
public enum SPlusType
{
Digital, Analog, String
}
}

View File

@@ -1,129 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Core.JsonToSimpl
{
/// <summary>
/// Constants for Simpl modules
/// </summary>
public class JsonToSimplConstants
{
public const ushort JsonIsValidBoolChange = 2;
public const ushort BoolValueChange = 1;
public const ushort UshortValueChange = 101;
public const ushort StringValueChange = 201;
public const ushort FullPathToArrayChange = 202;
public const ushort ActualFilePathChange = 203;
// TODO: pdc-20: Added below constants for passing file path and filename back to S+
public const ushort FilenameResolvedChange = 204;
public const ushort FilePathResolvedChange = 205;
}
//**************************************************************************************************//
public delegate void SPlusValuesDelegate();
public class SPlusValueWrapper
{
public SPlusType ValueType { get; private set; }
public ushort Index { get; private set; }
public ushort BoolUShortValue { get; set; }
public string StringValue { get; set; }
public SPlusValueWrapper() { }
public SPlusValueWrapper(SPlusType type, ushort index)
{
ValueType = type;
Index = index;
}
}
public enum SPlusType
{
Digital, Analog, String
}
//**************************************************************************************************//
public class BoolChangeEventArgs : EventArgs
{
public bool State { get; set; }
public ushort IntValue { get { return (ushort)(State ? 1 : 0); } }
public ushort Type { get; set; }
public ushort Index { get; set; }
public BoolChangeEventArgs()
{
}
public BoolChangeEventArgs(bool state, ushort type)
{
State = state;
Type = type;
}
public BoolChangeEventArgs(bool state, ushort type, ushort index)
{
State = state;
Type = type;
Index = index;
}
}
//**************************************************************************************************//
public class UshrtChangeEventArgs : EventArgs
{
public ushort IntValue { get; set; }
public ushort Type { get; set; }
public ushort Index { get; set; }
public UshrtChangeEventArgs()
{
}
public UshrtChangeEventArgs(ushort intValue, ushort type)
{
IntValue = intValue;
Type = type;
}
public UshrtChangeEventArgs(ushort intValue, ushort type, ushort index)
{
IntValue = intValue;
Type = type;
Index = index;
}
}
//**************************************************************************************************//
public class StringChangeEventArgs : EventArgs
{
public string StringValue { get; set; }
public ushort Type { get; set; }
public ushort Index { get; set; }
public StringChangeEventArgs()
{
}
public StringChangeEventArgs(string stringValue, ushort type)
{
StringValue = stringValue;
Type = type;
}
public StringChangeEventArgs(string stringValue, ushort type, ushort index)
{
StringValue = stringValue;
Type = type;
Index = index;
}
}
}