Compare commits

...

126 Commits

Author SHA1 Message Date
jtalborough
5e6f8cfeb3 fix: update file path for build 2024-04-26 12:52:30 -04:00
jtalborough
64ba5a9f94 refactor: Update file paths for packaging commands 2024-04-26 12:23:06 -04:00
jtalborough
b9382216c1 ci: Install 7-Zip for packaging 2024-04-26 12:16:34 -04:00
jtalborough
d75d355dc7 ci: Add CPZ and CPLZ to NuGet Package 2024-04-26 12:11:42 -04:00
jtalborough
7277ccc687 style: Update NuGet package source and add NonInteractive 2024-04-26 12:06:41 -04:00
jtalborough
2e4601b5f9 style: update nuget add command order 2024-04-26 11:59:36 -04:00
jtalborough
fe1804f9c7 feat: Inject CPZ into NuGet Package 2024-04-26 10:28:27 -04:00
jtalborough
faa07e682f feat: Add PackageOutputPath to msbuild command 2024-04-26 10:06:56 -04:00
jtalborough
a1af0bf943 feature: include build in nuget package output 2024-04-24 12:08:13 -04:00
Neil Dorin
661f7b827a fix: Updates to scheduler to attempt to deal with exceptions modifying existing events. Adds console command to allow deletign event group 2024-04-18 16:12:31 -06:00
Andrew Welker
49c4d2a387 fix: use IRoutingSink instead of IRoutingSinkWithSwitching 2024-04-11 09:15:05 -05:00
Neil Dorin
cf81431f57 feat: updates interfaces on GenericSoftCodec and adds IRoutingSink 2024-04-10 10:59:32 -06:00
Neil Dorin
8a7bcd5297 Merge pull request #1178 from PepperDash/feature-2.0.0/interface-updates
Multiple Updates
2024-04-09 10:36:21 -06:00
Andrew Welker
1fdaa84a62 fix: remove generics from matrix routing interfaces 2024-04-09 08:33:58 -05:00
Neil Dorin
8a374072ae feat: Adds EndpointKeys to IHasMatrixRouting 2024-04-04 16:16:54 -06:00
Neil Dorin
5d608887a1 feat: Adds IEssentialsRoomPropertiesConfig 2024-04-03 14:38:54 -06:00
Andrew Welker
d2d041dbf7 fix: make IRoutingOutputSlot & RoutingOutputSlotBase generic 2024-04-03 10:46:43 -05:00
Neil Dorin
b90e5b2a0d feat: Adds IHasRoutingEndpoints and IShutdownPromptTimer interfaces 2024-03-28 19:56:17 -06:00
Neil Dorin
d26c5344e4 fix: makes IMatrixRouting use generic types. 2024-03-28 19:55:53 -06:00
Neil Dorin
595fb3894e feat: addes IHasMatrixRouting interface 2024-03-28 11:42:52 -06:00
Neil Dorin
a7654aa77d feat: Adds property MatrixRoutingKey to EssentialsAvRoomPropertiesConfig 2024-03-28 11:18:22 -06:00
Neil Dorin
5ccf298584 chore: updates PD.Core version 2024-03-27 15:05:41 -06:00
Neil Dorin
a1cc46b992 Merge branch 'feature-2.0.0/volume-interfaces' into feature-2.0.0/interface-updates 2024-03-27 14:30:54 -06:00
Neil Dorin
a1310f2de7 docs: added comment to interface 2024-03-27 14:27:30 -06:00
Andrew Welker
09ac964335 fix: add base classes for input/output slots for matrix routing 2024-03-26 15:19:06 -05:00
Neil Dorin
9acffc620d feat: Adds IBasicVolumeWithFeedbackAdvanced and eVolumeLevelUnits 2024-03-21 21:01:47 -06:00
Neil Dorin
d653cf1a13 Merge pull request #1177 from PepperDash/feature-2.0.0/interface-updates
Feature 2.0.0/interface updates
2024-03-21 14:48:21 -06:00
Andrew Welker
ee4ccb0d1a feat: change to use Debug.LogMessage everywhere 2024-03-21 13:44:08 -05:00
Andrew Welker
4d0e3b1943 fix: create sfot codec Routing collections 2024-03-20 10:50:23 -05:00
Andrew Welker
69e83735b8 feat: update PD Core 2024-03-20 10:35:03 -05:00
Andrew Welker
e12f9f0afd feat: add generic soft codec device 2024-03-19 16:11:58 -05:00
Andrew Welker
f6cd2b57c1 feat: add GenericSink 2024-03-19 15:53:04 -05:00
Andrew Welker
e319280f43 Merge branch 'feature-2.0.0/interface-updates' of https://github.com/PepperDash/Essentials into feature-2.0.0/interface-updates 2024-03-19 11:08:42 -05:00
Andrew Welker
f43b0df65f refactor: remove args definition for event 2024-03-19 11:08:25 -05:00
Neil Dorin
62f182c634 debug: removes annoying console statements at startup 2024-03-14 22:28:26 -06:00
Neil Dorin
8ae8a3ef41 fix: adds missing JsonProperty decorator 2024-03-14 16:13:02 -06:00
Neil Dorin
0f57799382 feat: Adds TSelector generic type to IHasSurroundSoundModes 2024-03-14 12:26:05 -06:00
Neil Dorin
a2e4c2fad6 feat: Adds ISelectableItems/Item and IHasSurroundSoundModes, modfies IHasInputs, Updates MockDisplay to implement IHasInputs 2024-03-14 11:55:46 -06:00
Neil Dorin
ed5bd360b4 feat: adds more generic ISelectableItems and ISelectableItem interfaces and implements on new IHasInputs and IHasSurroundSoundModes 2024-03-14 10:46:48 -06:00
Andrew Welker
4eeb2145ae chore: update PD Core 2024-03-13 08:34:03 -05:00
Andrew Welker
a5460f16cd feat: add IVideoSync interface & implement on IRoutingInputSlot 2024-03-12 10:51:52 -05:00
Andrew Welker
3b55d6af93 fix: implement DestinationListKey on EssentialsRoomBase 2024-03-08 23:06:26 -06:00
Andrew Welker
285d87d8ac feat: add DestinationListKey to IEssentialsRoom 2024-03-08 22:59:17 -06:00
Andrew Welker
c6690c7765 build: update package names
Updated package names for Core and Devices Common to be valid names and match existing 2.0.0 packages
2024-03-08 21:17:59 -06:00
Andrew Welker
2609006024 feat: implement ILevelControls on DspBase
Also added DspLevelControlPoint class
2024-03-08 21:12:27 -06:00
Andrew Welker
9e61dcd554 refactor: RKST-93 rename interface & properties 2024-03-08 20:41:54 -06:00
Andrew Welker
693d4f8723 feat: RKST-161 add IHasInputs & IInputs interfaces 2024-03-08 20:26:13 -06:00
Andrew Welker
882f41d8bd feat: RKST-160 add IAdvancedVolume interface 2024-03-08 20:11:19 -06:00
Andrew Welker
6669b6125b build: change assembly names to match 1.0.0
This allow 3-series plugins to be loaded correctly
2024-03-08 20:10:44 -06:00
Andrew Welker
9ad151bd7e feat: RKST-131 add IMatrixRouting interfaces 2024-03-08 11:16:48 -06:00
Andrew Welker
b0e9ecf29e build: update PD Core version 2024-03-08 11:16:27 -06:00
Andrew Welker
d4df36b863 feat: add type param for direct route method 2024-03-06 15:39:39 -06:00
Andrew Welker
1146d89abf refactor: Make AddAction generic 2024-02-29 13:40:52 -06:00
Andrew Welker
0ee3e1d52b refactor: modify AddAction method to take the messenger 2024-02-29 13:27:02 -06:00
Andrew Welker
5084861067 feat: add IMobileControlAction interface 2024-02-29 12:36:50 -06:00
Andrew Welker
d6f896c4b2 feat: modify IMobileControl interface 2024-02-28 21:51:03 -06:00
Andrew Welker
7a5dc29946 refactor: remove MC bridge creation 2024-02-20 09:23:32 -06:00
Andrew Welker
812dd0e771 refactor: remove method
Moving all messenger creation to MC EPI.
2024-02-20 09:18:18 -06:00
Andrew Welker
08a4099842 refactor: change ApiOnline to BoolFeedback 2024-02-20 08:27:01 -06:00
Andrew Welker
a3c7d0c96a refactor: add online property for API 2024-02-20 08:13:46 -06:00
Andrew Welker
d7af57ba16 feat: add Properties to IMobileControl3 interface 2024-02-19 17:09:38 -06:00
Neil Dorin
2faa83cd1a Merge pull request #1175 from PepperDash/feature-2.0.0/RKST-97-handler-updates
Multiple Updates
2024-02-15 15:42:34 -07:00
Andrew Welker
6c2ef7b63b chore: update PepperDash Core version 2024-02-15 16:40:25 -06:00
Andrew Welker
06244b8a18 build: update PepperDash Core 2024-02-14 15:54:42 -06:00
Andrew Welker
b213262cdd refactor: use new method by default 2024-02-14 13:04:36 -06:00
Andrew Welker
e0e08ba22c feat: add methods to add routes to API 2024-02-14 13:02:09 -06:00
Andrew Welker
420ae8c7de refactor: add UpdateAppUrl method to RoomMessenger interface
Also renamed the interface to more accurately represent what it is for
2024-02-08 09:26:29 -06:00
Andrew Welker
f7cf854965 fix: remove incorrect using statement 2024-02-07 12:43:30 -06:00
Andrew Welker
5ce82f03b4 feat: move LightingBase to Devices Common 2024-02-07 12:43:13 -06:00
Andrew Welker
4d20cd7e80 chore: fix namespaces for room interfaces to be consistent 2024-02-07 12:32:59 -06:00
Andrew Welker
9e7239b219 chore: fix bad namespace
Namespaces were not correct

BREAKING_CHANGE: Namespaces changed
2024-02-07 12:32:45 -06:00
Andrew Welker
b689c847fb fix: invert interface to be custom instead of default
This way, existing rooms and devices will build messengers by default, while new plugins can implement their own messengers
2024-02-07 11:14:54 -06:00
Andrew Welker
4d608eef06 feat: refactor LoadRooms method
In order to facilitate using custom messengers, I added an interface, `IStandardMobileControl` that devices or rooms can implement if they should use the standard/existing MobileControl messengers. If a room or device wants to implement non-standard messengers, or is a new type of device that doesn't yet have a corresponding messenger in the Mobile Control plugin, do NOT implement this interface and MC won't attempt to build a messenger for it.
2024-02-07 08:44:58 -06:00
Andrew Welker
49b7faa400 chore: add back in config classes
Mobile Control (for the moment) relies on these classes, so they are necessary in Essentials until we determine a better solution.
2024-02-07 08:42:22 -06:00
Andrew Welker
8af0cf2702 chore: add room configs back in
At the moment, MC relies on some of these classes, so they are necessary
in Essentials for now. We can explore how to remove them at a later date
2024-02-07 07:46:16 -06:00
Andrew Welker
8d34b73cdf feat: add property to send ID to handlers for MC 2024-02-06 10:51:53 -06:00
Andrew Welker
5628042841 feat: move room aggregate interfaces back into Essentials 2024-02-06 10:51:25 -06:00
Andrew Welker
9f49a7faef feat: RKST-130 add missing event 2024-02-06 08:28:13 -06:00
Andrew Welker
b80b827217 chore: fix namespace for IRoomEventSchedule interface 2024-02-06 08:14:39 -06:00
Andrew Welker
35e9e54564 feat: RKST-130 add IRoomEventSchedule interface 2024-02-06 08:10:02 -06:00
Andrew Welker
3eefd1ce36 fix: Web API is now correctly included, along with debug updates from PD Core 2024-02-05 13:49:58 -06:00
Andrew Welker
1e6e8a044d merge dev 2.0.0 2024-02-05 13:33:25 -06:00
Nick Genovese
5941763acb Merge pull request #1171 from PepperDash/feature-2.0.0/newtonsoft-fixes
Remove Newtonsoft & Update build tasks
2024-02-02 13:10:05 -05:00
Andrew Welker
dc52ec4c0c ci: adjust for new paths for things 2024-02-02 11:54:43 -06:00
Andrew Welker
9dfc99259f build: got packages building correctly 2024-02-02 11:53:00 -06:00
Andrew Welker
7a66fdd490 fi: more newtonsoft fixes 2024-02-02 09:53:53 -06:00
Andrew Welker
1d74136e9e build: correct more issues with targets and such 2024-02-02 09:25:24 -06:00
Andrew Welker
b74755c825 chore: remove references to full Newtonsoft package 2024-02-02 09:23:29 -06:00
Andrew Welker
0a9ba77bb7 feat: add event for when AppUrlChanges 2024-02-02 09:19:34 -06:00
Nick Genovese
758ac8c91b Merge pull request #1160 from PepperDash/feature-2.0.0/move-device-base-classes
Feature 2.0.0/move device base classes
2024-02-01 15:40:42 -05:00
Nick Genovese
0548d3b3ea chore: added some additional documentation 2024-02-01 13:16:15 -05:00
Andrew Welker
f9d3607072 feat: rename MC Message interface 2024-01-31 09:48:46 -06:00
Andrew Welker
d6b32f48c7 refactor: change Content type to JToken for MC 2024-01-30 13:24:27 -06:00
Andrew Welker
8883fc329e feat: use Action<JToken> instead of object for MC handlers 2024-01-30 08:56:43 -06:00
Nick Genovese
e8408add14 Merge remote-tracking branch 'origin/feature-2.0.0/multi-targeting' into feature-2.0.0/move-device-base-classes 2024-01-24 17:02:52 -05:00
Neil Dorin
ab6f1f36f0 feat: Updates IMobileControl3 and adds IMobileControlMessenger 2024-01-15 14:31:24 -07:00
Neil Dorin
610fae972d feat: updates to IMobileControl3 and adds IMobileControlResponseMessage 2024-01-15 13:34:51 -07:00
Neil Dorin
876689fdfe fix: minor updates to debug levels 2024-01-15 13:30:14 -07:00
Andrew Welker
332d56cf70 build: add multi-targeting to Essentials
Essentials will now build for both .NET Framework 4.7.2 and .NET 6.
CPZ's and CPLZs are named appropriately, as .NET 6 assemblies won't work
on VC-4.
2023-12-28 15:41:16 -06:00
Neil Dorin
a2c628145d feat: adds more api handlers to load config and get/set min log level 2023-11-24 18:58:11 -07:00
Neil Dorin
d2877f2cec feat: more debug testing 2023-11-23 23:11:36 -07:00
Neil Dorin
3eaa86905f feat: working websocket debug server 2023-11-20 19:21:30 -07:00
Nick Genovese
476eaba519 fix: added method to resolve old plugin assesmbly names & get version info 2023-11-08 16:15:27 -05:00
Nick Genovese
690499c864 feat: removed zoom room 2023-11-08 15:10:16 -05:00
Nick Genovese
8023ef6c1b feat: removed rooms and cisco codec 2023-11-08 14:26:58 -05:00
Neil Dorin
b263c7421b feat: updates to DebugSessionRequestHandler 2023-11-06 21:50:30 -07:00
Nick Genovese
ba9cc9f00c feat(wip): still working on re-arranging base classes 2023-11-06 15:46:07 -05:00
Nick Genovese
c66b239e02 Merge branch 'development-2.0.0' into feature-2.0.0/move-device-base-classes 2023-11-06 15:39:34 -05:00
Nick Genovese
d2e1979d96 feat(wip): removing base classes from Essentials.Core 2023-11-06 15:38:48 -05:00
Neil Dorin
1727e81e33 Adds handler for getting a debug session 2023-11-03 13:00:21 -06:00
Nick Genovese
8a53693173 Merge pull request #1157 from PepperDash/feature-2.0.0/remove-unused-devices
Feature 2.0.0/remove unused devices
2023-11-03 12:46:50 -04:00
Neil Dorin
5a097e7057 feat: updates for web debugging 2023-11-02 23:31:15 -06:00
Nick Genovese
f43559941b feat(wip): removing base classes 2023-11-02 12:43:33 -04:00
Nick Genovese
116ac0e168 fix: accidentally deleted some needed display interfaces 2023-11-02 09:55:45 -04:00
Nick Genovese
ae109f8f8a Merge branch 'feature-2.0.0/remove-crestron-io' into feature-2.0.0/remove-unused-devices 2023-11-02 09:51:17 -04:00
Nick Genovese
4ed808aebf feat: removed deprecated diplay devices 2023-11-02 09:51:06 -04:00
Nick Genovese
faaf979472 feat: removed DSP, Lutron, Analog Way, TVOne 2023-11-02 09:50:56 -04:00
Nick Genovese
bf347bbf04 feature: removed din8sw8 2023-11-02 09:42:43 -04:00
Nick Genovese
7d8baf4bb0 Merge branch 'development-2.0.0' into feature-2.0.0/remove-crestron-io 2023-11-02 09:38:59 -04:00
Nick Genovese
bdb28bbd95 Merge pull request #1155 from PepperDash/feature-2.0.0/remove-obsolete-classes
Feature 2.0.0/remove obsolete classes
2023-11-01 13:15:22 -04:00
Nick Genovese
96d97ee0fc feat(wip): marked device base classes obsolete
- will move into essentials.devices.common
2023-10-31 20:28:58 -04:00
Nick Genovese
7a8158a3d3 feat: renamed CrestronIO folder 2023-10-31 20:10:14 -04:00
Nick Genovese
b4911bfda1 feat: removed crestron io devices 2023-10-31 20:07:57 -04:00
Nick Genovese
8feabcd536 feature: removed everything that had obsolete marked 2023-10-31 10:30:39 -04:00
Neil Dorin
e1eb432dee Merge pull request #1153 from PepperDash/feature-2.0.0/move-dm-to-library
Move DM Project to library
2023-10-27 10:35:45 -06:00
Andrew Welker
47a0b537ba chore: remove DM files 2023-10-27 10:00:44 -05:00
393 changed files with 4007 additions and 62788 deletions

View File

@@ -72,6 +72,12 @@ jobs:
git tag ${{ steps.setVersion.outputs.version }}
git push --tags origin
# Create the release on the source repo
- name: Install 7-Zip
run: choco install 7zip.install -y
- name: Add CPZ and CPLZ to NuGet Package
run: |
7z a .\output\PepperDash.Essentials.${{ steps.setVersion.outputs.version }}.nupkg output\**\*.cpz
7z a .\output\PepperDash.Essentials.${{ steps.setVersion.outputs.version }}.nupkg output\**\*.cplz
- name: Create Release
id: create_release
# if: contains(steps.setVersion.outputs.version,'-rc-') ||
@@ -79,7 +85,7 @@ jobs:
# contains(steps.setVersion.outputs.version, '-beta-')
uses: ncipollo/release-action@v1
with:
artifacts: 'output\*.*(cpz|cplz)'
artifacts: 'output\**\*.*(cpz|cplz)'
generateReleaseNotes: true
prerelease: ${{contains('debug', env.BUILD_TYPE)}}
tag: ${{ steps.setVersion.outputs.version }}

View File

@@ -42,7 +42,7 @@ jobs:
uses: ncipollo/release-action@v1
with:
updateRelease: true
artifacts: 'output\*.*(cpz|cplz)'
artifacts: 'output\**\*.*(cpz|cplz)'
tag: ${{ steps.setVersion.outputs.version }}
- name: Setup Nuget
run: |

1
.gitignore vendored
View File

@@ -390,3 +390,4 @@ MigrationBackup/
FodyWeavers.xsd
essentials-framework/Essentials Interfaces/PepperDash_Essentials_Interfaces/PepperDash_Essentials_Interfaces.csproj
.DS_Store
/._PepperDash.Essentials.sln

View File

@@ -11,18 +11,25 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PepperDash.Essentials.Core"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug 4.7.2|Any CPU = Debug 4.7.2|Any CPU
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{53E204B7-97DD-441D-A96C-721DF014DF82}.Debug 4.7.2|Any CPU.ActiveCfg = Debug 4.7.2|Any CPU
{53E204B7-97DD-441D-A96C-721DF014DF82}.Debug 4.7.2|Any CPU.Build.0 = Debug 4.7.2|Any CPU
{53E204B7-97DD-441D-A96C-721DF014DF82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{53E204B7-97DD-441D-A96C-721DF014DF82}.Debug|Any CPU.Build.0 = Debug|Any CPU
{53E204B7-97DD-441D-A96C-721DF014DF82}.Release|Any CPU.ActiveCfg = Release|Any CPU
{53E204B7-97DD-441D-A96C-721DF014DF82}.Release|Any CPU.Build.0 = Release|Any CPU
{CB3B11BA-625C-4D35-B663-FDC5BE9A230E}.Debug 4.7.2|Any CPU.ActiveCfg = Debug 4.7.2|Any CPU
{CB3B11BA-625C-4D35-B663-FDC5BE9A230E}.Debug 4.7.2|Any CPU.Build.0 = Debug 4.7.2|Any CPU
{CB3B11BA-625C-4D35-B663-FDC5BE9A230E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CB3B11BA-625C-4D35-B663-FDC5BE9A230E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CB3B11BA-625C-4D35-B663-FDC5BE9A230E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CB3B11BA-625C-4D35-B663-FDC5BE9A230E}.Release|Any CPU.Build.0 = Release|Any CPU
{3D192FED-8FFC-4CB5-B5F7-BA307ABA254B}.Debug 4.7.2|Any CPU.ActiveCfg = Debug 4.7.2|Any CPU
{3D192FED-8FFC-4CB5-B5F7-BA307ABA254B}.Debug 4.7.2|Any CPU.Build.0 = Debug 4.7.2|Any CPU
{3D192FED-8FFC-4CB5-B5F7-BA307ABA254B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3D192FED-8FFC-4CB5-B5F7-BA307ABA254B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3D192FED-8FFC-4CB5-B5F7-BA307ABA254B}.Release|Any CPU.ActiveCfg = Release|Any CPU

View File

@@ -1,6 +1,7 @@
<Project>
<PropertyGroup>
<Version>2.0.0-local</Version>
<InformationalVersion>$(Version)</InformationalVersion>
<Authors>PepperDash Technologies</Authors>
<Company>PepperDash Technologies</Company>
<Product>PepperDash Essentials</Product>

View File

@@ -1,28 +1,26 @@
<Project>
<ItemGroup>
<None Include="$(TargetDir)\$(TargetName).$(Version).cpz" Condition="$(ProjectType) == 'Program'">
<None Include="$(PackageOutputPath)\$(AssemblyName)\*.cpz" Condition="$(ProjectType) == 'Program'">
<Pack>true</Pack>
<PackagePath>content;</PackagePath>
<PackagePath>build;</PackagePath>
</None>
<None Include="$(PackageOutputPath)\$(TargetName).$(Version).cplz" Condition="$(ProjectType) == 'ProgramLibrary'">
<None Include="$(PackageOutputPath)\$(AssemblyName)\*.cplz" Condition="$(ProjectType) == 'ProgramLibrary'">
<Pack>true</Pack>
<PackagePath>content;</PackagePath>
<PackagePath>build;</PackagePath>
</None>
</ItemGroup>
<Target Name="Create CPLZ" AfterTargets="Build; Rebuild" Condition="$(ProjectType) == 'ProgramLibrary'">
<Message Text="Creating CPLZ"></Message>
<MakeDir Directories="$(PackageOutputPath)" Condition="!Exists($(PackageOutputPath))"></MakeDir>
<ZipDirectory SourceDirectory="$(TargetDir)" DestinationFile="$(PackageOutputPath)\$(TargetName).$(Version).cplz" Overwrite="true"/>
<Target Name="Create CPLZ" AfterTargets="Build; AfterRebuild" Condition="$(ProjectType) == 'ProgramLibrary' And $(TargetDir) != ''">
<Message Text="Creating CPLZ $(TargetDir)"></Message>
<MakeDir Directories="$(PackageOutputPath)" Condition="!Exists($(PackageOutputPath))" />
<MakeDir Directories="$(PackageOutputPath)\$(AssemblyName)" Condition="!Exists('$(PackageOutputPath)\$(AssemblyName)')" />
<ZipDirectory SourceDirectory="$(TargetDir)" DestinationFile="$(PackageOutputPath)\$(AssemblyName)\$(TargetName).$(Version).$(TargetFramework).cplz" Overwrite="true"/>
</Target>
<Target Name="Clean CPLZ" AfterTargets="AfterClean" Condition="$(ProjectType) == 'ProgramLibrary'">
<Delete Files="$(PackageOutputPath)\$(TargetName).$(Version).cplz"/>
</Target>
<Target Name="Copy CPZ" AfterTargets="SimplSharpPostProcess" Condition="$(ProjectType) == 'Program'">
<Target Name="Copy CPZ NET6" AfterTargets="SimplSharpPostProcess" Condition="($(ProjectType) == 'Program' And ( '$(TargetFramework)' == 'net6.0' ) Or ( '$(TargetFramework)' == 'net8.0' ))">
<Message Text="Copying CPZ"></Message>
<Move SourceFiles="$(TargetDir)$(TargetName).cpz" DestinationFiles="$(TargetDir)$(TargetName).$(Version).cpz" />
<Copy SourceFiles="$(TargetDir)$(TargetName).$(Version).cpz" DestinationFiles="$(PackageOutputPath)\$(TargetName).$(Version).cpz"/>
</Target>
<Target Name="Clean CPZ" AfterTargets="AfterClean" Condition="$(ProjectType) == 'Program'">
<Delete Files="$(PackageOutputPath)\$(TargetName).$(Version).cpz"/>
<Move SourceFiles="$(TargetDir)$(TargetName).cpz" DestinationFiles="$(PackageOutputPath)\$(AssemblyName)\$(TargetName).$(Version).$(TargetFramework).cpz" />
</Target>
<Target Name="Copy CPZ NET47" AfterTargets="SimplSharpPostProcess47" Condition="($(ProjectType) == 'Program' And ( '$(TargetFramework)' != 'net6.0' ) And ( '$(TargetFramework)' != 'net8.0' ))">
<Message Text="Copying CPZ"></Message>
<Move SourceFiles="$(TargetDir)$(TargetName).cpz" DestinationFiles="$(PackageOutputPath)\$(AssemblyName)\$(TargetName).$(Version).$(TargetFramework).cpz" />
</Target>
</Project>

View File

@@ -1,4 +1,4 @@
extern alias Full;
using System;
using System.Collections.Generic;
@@ -8,10 +8,11 @@ using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.EthernetCommunication;
using Full.Newtonsoft.Json;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
using Serilog.Events;
//using PepperDash.Essentials.Devices.Common.Cameras;
@@ -32,7 +33,7 @@ namespace PepperDash.Essentials.Core.Bridges
if (bridge == null)
{
Debug.Console(0, "Unable to find advanced bridge with key: '{0}'", bridgeKey);
Debug.LogMessage(LogEventLevel.Information, "Unable to find advanced bridge with key: '{0}'", bridgeKey);
return;
}
@@ -58,7 +59,7 @@ namespace PepperDash.Essentials.Core.Bridges
if (bridge == null)
{
Debug.Console(0, "Unable to find advanced bridge with key: '{0}'", bridgeKey);
Debug.LogMessage(LogEventLevel.Information, "Unable to find advanced bridge with key: '{0}'", bridgeKey);
return;
}
@@ -148,11 +149,11 @@ namespace PepperDash.Essentials.Core.Bridges
private void LinkDevices()
{
Debug.Console(1, this, "Linking Devices...");
Debug.LogMessage(LogEventLevel.Debug, this, "Linking Devices...");
if (PropertiesConfig.Devices == null)
{
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "No devices linked to this bridge");
Debug.LogMessage(LogEventLevel.Debug, this, "No devices linked to this bridge");
return;
}
@@ -165,11 +166,11 @@ namespace PepperDash.Essentials.Core.Bridges
continue;
}
Debug.Console(1, this, "Linking Device: '{0}'", device.Key);
Debug.LogMessage(LogEventLevel.Debug, this, "Linking Device: '{0}'", device.Key);
if (!typeof(IBridgeAdvanced).IsAssignableFrom(device.GetType().GetCType()))
{
Debug.Console(0, this, Debug.ErrorLogLevel.Notice,
Debug.LogMessage(LogEventLevel.Information, this,
"{0} is not compatible with this bridge type. Please use 'eiscapi' instead, or updae the device.",
device.Key);
continue;
@@ -194,20 +195,20 @@ namespace PepperDash.Essentials.Core.Bridges
if (registerResult != eDeviceRegistrationUnRegistrationResponse.Success)
{
Debug.Console(2, this, Debug.ErrorLogLevel.Error, "Registration result: {0}", registerResult);
Debug.LogMessage(LogEventLevel.Verbose, this, "Registration result: {0}", registerResult);
return;
}
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "EISC registration successful");
Debug.LogMessage(LogEventLevel.Debug, this, "EISC registration successful");
}
public void LinkRooms()
{
Debug.Console(1, this, "Linking Rooms...");
Debug.LogMessage(LogEventLevel.Debug, this, "Linking Rooms...");
if (PropertiesConfig.Rooms == null)
{
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "No rooms linked to this bridge.");
Debug.LogMessage(LogEventLevel.Debug, this, "No rooms linked to this bridge.");
return;
}
@@ -217,7 +218,7 @@ namespace PepperDash.Essentials.Core.Bridges
if (rm == null)
{
Debug.Console(1, this, Debug.ErrorLogLevel.Notice,
Debug.LogMessage(LogEventLevel.Debug, this,
"Room {0} does not implement IBridgeAdvanced. Skipping...", room.RoomKey);
continue;
}
@@ -239,7 +240,7 @@ namespace PepperDash.Essentials.Core.Bridges
}
else
{
Debug.Console(2, this, "Unable to add join map with key '{0}'. Key already exists in JoinMaps dictionary", deviceKey);
Debug.LogMessage(LogEventLevel.Verbose, this, "Unable to add join map with key '{0}'. Key already exists in JoinMaps dictionary", deviceKey);
}
}
@@ -248,11 +249,11 @@ namespace PepperDash.Essentials.Core.Bridges
/// </summary>
public virtual void PrintJoinMaps()
{
Debug.Console(0, this, "Join Maps for EISC IPID: {0}", Eisc.ID.ToString("X"));
Debug.LogMessage(LogEventLevel.Information, this, "Join Maps for EISC IPID: {0}", Eisc.ID.ToString("X"));
foreach (var joinMap in JoinMaps)
{
Debug.Console(0, "Join map for device '{0}':", joinMap.Key);
Debug.LogMessage(LogEventLevel.Information, "Join map for device '{0}':", joinMap.Key);
joinMap.Value.PrintJoinMapInfo();
}
}
@@ -261,11 +262,11 @@ namespace PepperDash.Essentials.Core.Bridges
/// </summary>
public virtual void MarkdownForBridge(string bridgeKey)
{
Debug.Console(0, this, "Writing Joinmaps to files for EISC IPID: {0}", Eisc.ID.ToString("X"));
Debug.LogMessage(LogEventLevel.Information, this, "Writing Joinmaps to files for EISC IPID: {0}", Eisc.ID.ToString("X"));
foreach (var joinMap in JoinMaps)
{
Debug.Console(0, "Generating markdown for device '{0}':", joinMap.Key);
Debug.LogMessage(LogEventLevel.Information, "Generating markdown for device '{0}':", joinMap.Key);
joinMap.Value.MarkdownJoinMapInfo(joinMap.Key, bridgeKey);
}
}
@@ -280,11 +281,11 @@ namespace PepperDash.Essentials.Core.Bridges
if (joinMap == null)
{
Debug.Console(0, this, "Unable to find joinMap for device with key: '{0}'", deviceKey);
Debug.LogMessage(LogEventLevel.Information, this, "Unable to find joinMap for device with key: '{0}'", deviceKey);
return;
}
Debug.Console(0, "Join map for device '{0}' on EISC '{1}':", deviceKey, Key);
Debug.LogMessage(LogEventLevel.Information, "Join map for device '{0}' on EISC '{1}':", deviceKey, Key);
joinMap.PrintJoinMapInfo();
}
/// <summary>
@@ -297,11 +298,11 @@ namespace PepperDash.Essentials.Core.Bridges
if (joinMap == null)
{
Debug.Console(0, this, "Unable to find joinMap for device with key: '{0}'", deviceKey);
Debug.LogMessage(LogEventLevel.Information, this, "Unable to find joinMap for device with key: '{0}'", deviceKey);
return;
}
Debug.Console(0, "Join map for device '{0}' on EISC '{1}':", deviceKey, Key);
Debug.LogMessage(LogEventLevel.Information, "Join map for device '{0}' on EISC '{1}':", deviceKey, Key);
joinMap.MarkdownJoinMapInfo(deviceKey, bridgeKey);
}
@@ -322,11 +323,11 @@ namespace PepperDash.Essentials.Core.Bridges
var uo = Eisc.BooleanOutput[join].UserObject as Action<bool>;
if (uo != null)
{
Debug.Console(2, this, "Executing Action: {0}", uo.ToString());
Debug.LogMessage(LogEventLevel.Verbose, this, "Executing Action: {0}", uo.ToString());
uo(Convert.ToBoolean(state));
}
else
Debug.Console(2, this, "User Action is null. Nothing to Execute");
Debug.LogMessage(LogEventLevel.Verbose, this, "User Action is null. Nothing to Execute");
break;
}
case "analog":
@@ -334,34 +335,34 @@ namespace PepperDash.Essentials.Core.Bridges
var uo = Eisc.BooleanOutput[join].UserObject as Action<ushort>;
if (uo != null)
{
Debug.Console(2, this, "Executing Action: {0}", uo.ToString());
Debug.LogMessage(LogEventLevel.Verbose, this, "Executing Action: {0}", uo.ToString());
uo(Convert.ToUInt16(state));
}
else
Debug.Console(2, this, "User Action is null. Nothing to Execute"); break;
Debug.LogMessage(LogEventLevel.Verbose, this, "User Action is null. Nothing to Execute"); break;
}
case "serial":
{
var uo = Eisc.BooleanOutput[join].UserObject as Action<string>;
if (uo != null)
{
Debug.Console(2, this, "Executing Action: {0}", uo.ToString());
Debug.LogMessage(LogEventLevel.Verbose, this, "Executing Action: {0}", uo.ToString());
uo(Convert.ToString(state));
}
else
Debug.Console(2, this, "User Action is null. Nothing to Execute");
Debug.LogMessage(LogEventLevel.Verbose, this, "User Action is null. Nothing to Execute");
break;
}
default:
{
Debug.Console(2, "Unknown join type. Use digital/serial/analog");
Debug.LogMessage(LogEventLevel.Verbose, "Unknown join type. Use digital/serial/analog");
break;
}
}
}
catch (Exception e)
{
Debug.Console(1, this, "Error: {0}", e);
Debug.LogMessage(LogEventLevel.Debug, this, "Error: {0}", e);
}
}
@@ -375,13 +376,12 @@ namespace PepperDash.Essentials.Core.Bridges
{
try
{
if (Debug.Level >= 1)
Debug.Console(1, this, "EiscApiAdvanced change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
Debug.LogMessage(LogEventLevel.Verbose, this, "EiscApiAdvanced change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
var uo = args.Sig.UserObject;
if (uo == null) return;
Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
Debug.LogMessage(LogEventLevel.Debug, this, "Executing Action: {0}", uo.ToString());
if (uo is Action<bool>)
(uo as Action<bool>)(args.Sig.BoolValue);
else if (uo is Action<ushort>)
@@ -391,7 +391,7 @@ namespace PepperDash.Essentials.Core.Bridges
}
catch (Exception e)
{
Debug.Console(2, this, "Error in Eisc_SigChange handler: {0}", e);
Debug.LogMessage(LogEventLevel.Verbose, this, "Error in Eisc_SigChange handler: {0}", e);
}
}
@@ -449,7 +449,7 @@ namespace PepperDash.Essentials.Core.Bridges
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new EiscApiAdvanced Device");
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new EiscApiAdvanced Device");
var controlProperties = CommFactory.GetControlPropertiesConfig(dc);
@@ -479,7 +479,7 @@ namespace PepperDash.Essentials.Core.Bridges
{
if (string.IsNullOrEmpty(controlProperties.RoomId))
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to build VC-4 EISC Client for device {0}. Room ID is missing or empty", dc.Key);
Debug.LogMessage(LogEventLevel.Information, "Unable to build VC-4 EISC Client for device {0}. Room ID is missing or empty", dc.Key);
eisc = null;
break;
}

View File

@@ -1,43 +0,0 @@
using System;
namespace PepperDash.Essentials.Core.Bridges
{
[Obsolete("This Device will be moved to a plugin in a future update")]
public class DigitalLoggerJoinMap : JoinMapBase
{
public uint IsOnline { get; set; }
public uint CircuitNames { get; set; }
public uint CircuitState { get; set; }
public uint CircuitCycle { get; set; }
public uint CircuitIsCritical { get; set; }
public uint CircuitOnCmd { get; set; }
public uint CircuitOffCmd { get; set; }
public DigitalLoggerJoinMap()
{
// Digital
IsOnline = 9;
CircuitState = 0;
CircuitCycle = 0;
CircuitIsCritical = 10;
CircuitOnCmd = 10;
CircuitOffCmd = 20;
// Serial
CircuitNames = 0;
// Analog
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
IsOnline = IsOnline + joinOffset;
CircuitNames = CircuitNames + joinOffset;
CircuitState = CircuitState + joinOffset;
CircuitCycle = CircuitCycle + joinOffset;
CircuitIsCritical = CircuitIsCritical + joinOffset;
CircuitOnCmd = CircuitOnCmd + joinOffset;
CircuitOffCmd = CircuitOffCmd + joinOffset;
}
}
}

View File

@@ -1,6 +1,6 @@
using PepperDash.Essentials.Core;
namespace PepperDash_Essentials_Core.Bridges.JoinMaps
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
{
public sealed class GenericIrControllerJoinMap : JoinMapBaseAdvanced
{

View File

@@ -155,146 +155,3 @@ namespace PepperDash.Essentials.Core.Bridges.JoinMaps
}
}
}
namespace PepperDash_Essentials_Core.Bridges.JoinMaps
{
/// <summary>
///
/// </summary>
[Obsolete("use PepperDash.Essentials.Core.Bridges.JoinMaps version")]
public class GlsPartitionSensorJoinMap:JoinMapBaseAdvanced
{
[JoinName("IsOnline")]
public JoinDataComplete IsOnline = new JoinDataComplete(
new JoinData
{
JoinNumber = 1,
JoinSpan = 1
},
new JoinMetadata
{
Description = "Sensor Is Online",
JoinCapabilities = eJoinCapabilities.ToSIMPL,
JoinType = eJoinType.Digital
});
[JoinName("Name")]
public JoinDataComplete Name = new JoinDataComplete(
new JoinData
{
JoinNumber = 1,
JoinSpan = 1
},
new JoinMetadata
{
Description = "Sensor Name",
JoinCapabilities = eJoinCapabilities.ToSIMPL,
JoinType = eJoinType.Serial
});
[JoinName("Enable")]
public JoinDataComplete Enable = new JoinDataComplete(
new JoinData
{
JoinNumber = 2,
JoinSpan = 1
},
new JoinMetadata
{
Description = "Sensor Enable",
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
JoinType = eJoinType.Digital
});
[JoinName("PartitionSensed")]
public JoinDataComplete PartitionSensed = new JoinDataComplete(
new JoinData
{
JoinNumber = 3,
JoinSpan = 1
},
new JoinMetadata
{
Description = "Sensor Partition Sensed",
JoinCapabilities = eJoinCapabilities.ToSIMPL,
JoinType = eJoinType.Digital
});
[JoinName("PartitionNotSensed")]
public JoinDataComplete PartitionNotSensed = new JoinDataComplete(
new JoinData
{
JoinNumber = 4,
JoinSpan = 1
},
new JoinMetadata
{
Description = "Sensor Partition Not Sensed",
JoinCapabilities = eJoinCapabilities.ToSIMPL,
JoinType = eJoinType.Digital
});
[JoinName("IncreaseSensitivity")]
public JoinDataComplete IncreaseSensitivity = new JoinDataComplete(
new JoinData
{
JoinNumber = 6,
JoinSpan = 1
},
new JoinMetadata
{
Description = "Sensor Increase Sensitivity",
JoinCapabilities = eJoinCapabilities.FromSIMPL,
JoinType = eJoinType.Digital
});
[JoinName("DecreaseSensitivity")]
public JoinDataComplete DecreaseSensitivity = new JoinDataComplete(
new JoinData
{
JoinNumber = 7,
JoinSpan = 1
},
new JoinMetadata
{
Description = "Sensor Decrease Sensitivity",
JoinCapabilities = eJoinCapabilities.FromSIMPL,
JoinType = eJoinType.Digital
});
[JoinName("Sensitivity")]
public JoinDataComplete Sensitivity = new JoinDataComplete(
new JoinData
{
JoinNumber = 2,
JoinSpan = 1
},
new JoinMetadata
{
Description = "Sensor Sensitivity",
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
JoinType = eJoinType.Analog
});
/// <summary>
/// Constructor to use when instantiating this Join Map without inheriting from it
/// </summary>
/// <param name="joinStart">Join this join map will start at</param>
public GlsPartitionSensorJoinMap(uint joinStart)
: this(joinStart, typeof(GlsPartitionSensorJoinMap))
{
}
/// <summary>
/// Constructor to use when extending this Join map
/// </summary>
/// <param name="joinStart">Join this join map will start at</param>
/// <param name="type">Type of the child join map</param>
protected GlsPartitionSensorJoinMap(uint joinStart, Type type)
: base(joinStart, type)
{
}
}
}

View File

@@ -1,7 +1,7 @@
using System;
using PepperDash.Essentials.Core;
namespace PepperDash_Essentials_Core.Bridges
namespace PepperDash.Essentials.Core.Bridges
{
public class HdPsXxxControllerJoinMap : JoinMapBaseAdvanced
{

View File

@@ -8,6 +8,7 @@ using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DM;
using PepperDash.Core;
using Serilog.Events;
namespace PepperDash.Essentials.Core
{
@@ -49,7 +50,7 @@ namespace PepperDash.Essentials.Core
OnDataReceived(cecDevice.Received.StringValue);
else if (args.EventId == CecEventIds.ErrorFeedbackEventId)
if(cecDevice.ErrorFeedback.BoolValue)
Debug.Console(2, this, "CEC NAK Error");
Debug.LogMessage(LogEventLevel.Verbose, this, "CEC NAK Error");
}
void OnDataReceived(string s)
@@ -59,14 +60,14 @@ namespace PepperDash.Essentials.Core
{
var bytes = Encoding.GetEncoding(28591).GetBytes(s);
if (StreamDebugging.RxStreamDebuggingIsEnabled)
Debug.Console(0, this, "Received: '{0}'", ComTextHelper.GetEscapedText(bytes));
Debug.LogMessage(LogEventLevel.Information, this, "Received: '{0}'", ComTextHelper.GetEscapedText(bytes));
bytesHandler(this, new GenericCommMethodReceiveBytesArgs(bytes));
}
var textHandler = TextReceived;
if (textHandler != null)
{
if (StreamDebugging.RxStreamDebuggingIsEnabled)
Debug.Console(0, this, "Received: '{0}'", s);
Debug.LogMessage(LogEventLevel.Information, this, "Received: '{0}'", s);
textHandler(this, new GenericCommMethodReceiveTextArgs(s));
}
}
@@ -78,7 +79,7 @@ namespace PepperDash.Essentials.Core
if (Port == null)
return;
if (StreamDebugging.TxStreamDebuggingIsEnabled)
Debug.Console(0, this, "Sending {0} characters of text: '{1}'", text.Length, text);
Debug.LogMessage(LogEventLevel.Information, this, "Sending {0} characters of text: '{1}'", text.Length, text);
Port.StreamCec.Send.StringValue = text;
}
@@ -88,7 +89,7 @@ namespace PepperDash.Essentials.Core
return;
var text = Encoding.GetEncoding(28591).GetString(bytes, 0, bytes.Length);
if (StreamDebugging.TxStreamDebuggingIsEnabled)
Debug.Console(0, this, "Sending {0} bytes: '{1}'", bytes.Length, ComTextHelper.GetEscapedText(bytes));
Debug.LogMessage(LogEventLevel.Information, this, "Sending {0} bytes: '{1}'", bytes.Length, ComTextHelper.GetEscapedText(bytes));
Port.StreamCec.Send.StringValue = text;
}

View File

@@ -7,6 +7,7 @@ using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using PepperDash.Core;
using Serilog.Events;
namespace PepperDash.Essentials.Core
@@ -43,7 +44,7 @@ namespace PepperDash.Essentials.Core
{
if (port == null)
{
Debug.Console(0, this, "ERROR: Invalid com port, continuing but comms will not function");
Debug.LogMessage(LogEventLevel.Information, this, "ERROR: Invalid com port, continuing but comms will not function");
return;
}
@@ -58,7 +59,7 @@ namespace PepperDash.Essentials.Core
{
if (Port == null)
{
Debug.Console(0,this,Debug.ErrorLogLevel.Error, "Configured com Port for this device does not exist.");
Debug.LogMessage(LogEventLevel.Information, this, "Configured com Port for this device does not exist.");
return;
}
if (Port.Parent is CrestronControlSystem)
@@ -66,7 +67,7 @@ namespace PepperDash.Essentials.Core
var result = Port.Register();
if (result != eDeviceRegistrationUnRegistrationResponse.Success)
{
Debug.Console(0, this, "ERROR: Cannot register Com port: {0}", result);
Debug.LogMessage(LogEventLevel.Information, this, "ERROR: Cannot register Com port: {0}", result);
return; // false
}
}
@@ -74,7 +75,7 @@ namespace PepperDash.Essentials.Core
var specResult = Port.SetComPortSpec(Spec);
if (specResult != 0)
{
Debug.Console(0, this, "WARNING: Cannot set comspec");
Debug.LogMessage(LogEventLevel.Information, this, "WARNING: Cannot set comspec");
return;
}
Port.SerialDataReceived += Port_SerialDataReceived;
@@ -98,14 +99,14 @@ namespace PepperDash.Essentials.Core
{
var bytes = Encoding.GetEncoding(28591).GetBytes(s);
if (StreamDebugging.RxStreamDebuggingIsEnabled)
Debug.Console(0, this, "Received: '{0}'", ComTextHelper.GetEscapedText(bytes));
Debug.LogMessage(LogEventLevel.Information, this, "Received: '{0}'", ComTextHelper.GetEscapedText(bytes));
bytesHandler(this, new GenericCommMethodReceiveBytesArgs(bytes));
}
var textHandler = TextReceived;
if (textHandler != null)
{
if (StreamDebugging.RxStreamDebuggingIsEnabled)
Debug.Console(0, this, "Received: '{0}'", s);
Debug.LogMessage(LogEventLevel.Information, this, "Received: '{0}'", s);
textHandler(this, new GenericCommMethodReceiveTextArgs(s));
}
}
@@ -123,7 +124,7 @@ namespace PepperDash.Essentials.Core
return;
if (StreamDebugging.TxStreamDebuggingIsEnabled)
Debug.Console(0, this, "Sending {0} characters of text: '{1}'", text.Length, text);
Debug.LogMessage(LogEventLevel.Information, this, "Sending {0} characters of text: '{1}'", text.Length, text);
Port.Send(text);
}
@@ -133,7 +134,7 @@ namespace PepperDash.Essentials.Core
return;
var text = Encoding.GetEncoding(28591).GetString(bytes, 0, bytes.Length);
if (StreamDebugging.TxStreamDebuggingIsEnabled)
Debug.Console(0, this, "Sending {0} bytes: '{1}'", bytes.Length, ComTextHelper.GetEscapedText(bytes));
Debug.LogMessage(LogEventLevel.Information, this, "Sending {0} bytes: '{1}'", bytes.Length, ComTextHelper.GetEscapedText(bytes));
Port.Send(text);
}

View File

@@ -1,4 +1,4 @@
extern alias Full;
using System;
using System.Collections.Generic;
@@ -7,8 +7,8 @@ using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Full.Newtonsoft.Json;
using Full.Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
@@ -76,7 +76,7 @@ namespace PepperDash.Essentials.Core
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
//Debug.Console(2, "ReadJson type: " + objectType.Name);
//Debug.LogMessage(LogEventLevel.Verbose, "ReadJson type: " + objectType.Name);
if (objectType == typeof(ComPort.eComBaudRates))
return Enum.Parse(typeof(ComPort.eComBaudRates), "ComspecBaudRate" + reader.Value, false);
else if (objectType == typeof(ComPort.eComDataBits))

View File

@@ -1,13 +1,14 @@
extern alias Full;
using System;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DM;
using Full.Newtonsoft.Json;
using Full.Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
using Serilog.Events;
namespace PepperDash.Essentials.Core
{
@@ -22,12 +23,12 @@ namespace PepperDash.Essentials.Core
{
return JsonConvert.DeserializeObject<EssentialsControlPropertiesConfig>
(deviceConfig.Properties["control"].ToString());
//Debug.Console(2, "Control TEST: {0}", JsonConvert.SerializeObject(controlConfig));
//Debug.LogMessage(LogEventLevel.Verbose, "Control TEST: {0}", JsonConvert.SerializeObject(controlConfig));
}
catch (Exception e)
{
Debug.Console(0, "ERROR: [{0}] Control properties deserialize failed:\r{1}", deviceConfig.Key, e);
Debug.LogMessage(LogEventLevel.Information, "ERROR: [{0}] Control properties deserialize failed:\r{1}", deviceConfig.Key, e);
return null;
}
}
@@ -98,7 +99,7 @@ namespace PepperDash.Essentials.Core
}
catch (Exception e)
{
Debug.Console(0, "Cannot create communication from JSON:\r{0}\r\rException:\r{1}",
Debug.LogMessage(LogEventLevel.Information, "Cannot create communication from JSON:\r{0}\r\rException:\r{1}",
deviceConfig.Properties.ToString(), e);
}
@@ -115,7 +116,7 @@ namespace PepperDash.Essentials.Core
var dev = GetIComPortsDeviceFromManagedDevice(config.ControlPortDevKey);
if (dev != null && config.ControlPortNumber <= dev.NumberOfComPorts)
return dev.ComPorts[config.ControlPortNumber];
Debug.Console(0,Debug.ErrorLogLevel.Notice, "GetComPort: Device '{0}' does not have com port {1}", config.ControlPortDevKey, config.ControlPortNumber);
Debug.LogMessage(LogEventLevel.Information, "GetComPort: Device '{0}' does not have com port {1}", config.ControlPortDevKey, config.ControlPortNumber);
return null;
}
@@ -130,7 +131,7 @@ namespace PepperDash.Essentials.Core
{
var dev = DeviceManager.GetDeviceForKey(config.ControlPortDevKey);
Debug.Console(0, "GetCecPort: device '{0}' {1}", config.ControlPortDevKey, dev == null
Debug.LogMessage(LogEventLevel.Information, "GetCecPort: device '{0}' {1}", config.ControlPortDevKey, dev == null
? "is not valid, failed to get cec port"
: "found in device manager, attempting to get cec port");
@@ -139,7 +140,7 @@ namespace PepperDash.Essentials.Core
if (String.IsNullOrEmpty(config.ControlPortName))
{
Debug.Console(0, "GetCecPort: '{0}' - Configuration missing 'ControlPortName'", config.ControlPortDevKey);
Debug.LogMessage(LogEventLevel.Information, "GetCecPort: '{0}' - Configuration missing 'ControlPortName'", config.ControlPortDevKey);
return null;
}
@@ -147,7 +148,7 @@ namespace PepperDash.Essentials.Core
var inputsOutputs = dev as IRoutingInputsOutputs;
if (inputsOutputs == null)
{
Debug.Console(0, "GetCecPort: Device '{0}' does not support IRoutingInputsOutputs, failed to get CEC port called '{1}'",
Debug.LogMessage(LogEventLevel.Information, "GetCecPort: Device '{0}' does not support IRoutingInputsOutputs, failed to get CEC port called '{1}'",
config.ControlPortDevKey, config.ControlPortName);
return null;
@@ -164,13 +165,13 @@ namespace PepperDash.Essentials.Core
}
catch (Exception ex)
{
Debug.Console(1, "GetCecPort Exception Message: {0}", ex.Message);
Debug.Console(2, "GetCecPort Exception StackTrace: {0}", ex.StackTrace);
Debug.LogMessage(LogEventLevel.Debug, "GetCecPort Exception Message: {0}", ex.Message);
Debug.LogMessage(LogEventLevel.Verbose, "GetCecPort Exception StackTrace: {0}", ex.StackTrace);
if (ex.InnerException != null)
Debug.Console(0, "GetCecPort Exception InnerException: {0}", ex.InnerException);
Debug.LogMessage(LogEventLevel.Information, "GetCecPort Exception InnerException: {0}", ex.InnerException);
}
Debug.Console(0, "GetCecPort: Device '{0}' does not have a CEC port called '{1}'",
Debug.LogMessage(LogEventLevel.Information, "GetCecPort: Device '{0}' does not have a CEC port called '{1}'",
config.ControlPortDevKey, config.ControlPortName);
return null;
@@ -191,7 +192,7 @@ namespace PepperDash.Essentials.Core
{
var dev = DeviceManager.GetDeviceForKey(ComPortDevKey) as IComPorts;
if (dev == null)
Debug.Console(0, "ComPortConfig: Cannot find com port device '{0}'", ComPortDevKey);
Debug.LogMessage(LogEventLevel.Information, "ComPortConfig: Cannot find com port device '{0}'", ComPortDevKey);
return dev;
}
}
@@ -205,9 +206,7 @@ namespace PepperDash.Essentials.Core
{
[JsonConverter(typeof(ComSpecJsonConverter))]
public ComPort.ComPortSpec ComParams { get; set; }
public string RoomId { get; set; }
public ComPort.ComPortSpec ComParams { get; set; }
public string CresnetId { get; set; }

View File

@@ -1,4 +1,4 @@
extern alias Full;
using System;
using System.Collections.Generic;
@@ -7,8 +7,8 @@ using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Full.Newtonsoft.Json;
using Full.Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;

View File

@@ -6,6 +6,7 @@ using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
using Serilog.Events;
namespace PepperDash.Essentials.Core
@@ -39,7 +40,7 @@ namespace PepperDash.Essentials.Core
public override bool CustomActivate()
{
Communication.Connect();
CommunicationMonitor.StatusChange += (o, a) => { Debug.Console(2, this, "Communication monitor state: {0}", CommunicationMonitor.Status); };
CommunicationMonitor.StatusChange += (o, a) => { Debug.LogMessage(LogEventLevel.Verbose, this, "Communication monitor state: {0}", CommunicationMonitor.Status); };
CommunicationMonitor.Start();
CrestronConsole.AddNewConsoleCommand(SendLine, "send" + Key, "", ConsoleAccessLevelEnum.AccessOperator);
@@ -50,7 +51,7 @@ namespace PepperDash.Essentials.Core
void SendLine(string s)
{
//if (Debug.Level == 2)
// Debug.Console(2, this, " Send '{0}'", ComTextHelper.GetEscapedText(s));
// Debug.LogMessage(LogEventLevel.Verbose, this, " Send '{0}'", ComTextHelper.GetEscapedText(s));
Communication.SendText(s + LineEnding);
}
}
@@ -75,7 +76,7 @@ namespace PepperDash.Essentials.Core
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new Comm Mock Device");
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Comm Mock Device");
var comm = CommFactory.CreateCommForDevice(dc);
var props = Newtonsoft.Json.JsonConvert.DeserializeObject<ConsoleCommMockDevicePropertiesConfig>(
dc.Properties.ToString());

View File

@@ -1,15 +1,16 @@
extern alias Full;
using System;
using System.Collections.Generic;
using Crestron.SimplSharp.CrestronSockets;
using Crestron.SimplSharpPro.DeviceSupport;
using Full.Newtonsoft.Json;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Devices;
using PepperDash.Essentials.Core.Config;
using Serilog.Events;
namespace PepperDash.Essentials.Core
@@ -45,7 +46,7 @@ namespace PepperDash.Essentials.Core
public static IKeyed BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new Generic Comm Device");
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Generic Comm Device");
return new GenericComm(dc);
}
@@ -59,7 +60,7 @@ namespace PepperDash.Essentials.Core
}
catch (Exception e)
{
Debug.Console(2, this, "Error deserializing port config: {0}", e);
Debug.LogMessage(LogEventLevel.Verbose, this, "Error deserializing port config: {0}", e);
}
}
@@ -85,16 +86,16 @@ namespace PepperDash.Essentials.Core
}
else
{
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
Debug.LogMessage(LogEventLevel.Information, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
if (CommPort == null)
{
Debug.Console(1, this, "Unable to link device '{0}'. CommPort is null", Key);
Debug.LogMessage(LogEventLevel.Debug, this, "Unable to link device '{0}'. CommPort is null", Key);
return;
}
Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.LogMessage(LogEventLevel.Debug, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
// this is a permanent event handler. This cannot be -= from event
CommPort.TextReceived += (s, a) =>
@@ -137,7 +138,7 @@ namespace PepperDash.Essentials.Core
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new Generic Comm Device");
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Generic Comm Device");
return new GenericComm(dc);
}
}

View File

@@ -9,6 +9,7 @@ using PepperDash.Core.DebugThings;
namespace PepperDash.Essentials.Core
{
[Obsolete("Please use the builtin HttpClient class instead: https://learn.microsoft.com/en-us/dotnet/fundamentals/networking/http/httpclient-guidelines")]
public class GenericHttpClient : Device, IBasicCommunication
{
public HttpClient Client;

View File

@@ -1,4 +1,4 @@
extern alias Full;
using System;
using System.Collections.Generic;
@@ -6,10 +6,11 @@ using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Full.Newtonsoft.Json;
using Full.Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
using Serilog.Events;
namespace PepperDash.Essentials.Core
{
@@ -40,7 +41,7 @@ namespace PepperDash.Essentials.Core
return null;
if (control["method"].Value<string>() != "ir")
{
Debug.Console(0, "IRPortHelper called with non-IR properties");
Debug.LogMessage(LogEventLevel.Information, "IRPortHelper called with non-IR properties");
return null;
}
@@ -50,7 +51,7 @@ namespace PepperDash.Essentials.Core
var portNum = control.Value<uint>("controlPortNumber");
if (portDevKey == null || portNum == 0)
{
Debug.Console(1, "WARNING: Properties is missing port device or port number");
Debug.LogMessage(LogEventLevel.Debug, "WARNING: Properties is missing port device or port number");
return port;
}
@@ -63,7 +64,7 @@ namespace PepperDash.Essentials.Core
if (irDev == null)
{
Debug.Console(1, "[Config] Error, device with IR ports '{0}' not found", portDevKey);
Debug.LogMessage(LogEventLevel.Debug, "[Config] Error, device with IR ports '{0}' not found", portDevKey);
return port;
}
@@ -76,7 +77,7 @@ namespace PepperDash.Essentials.Core
}
else
{
Debug.Console(1, "[Config] Error, device '{0}' IR port {1} out of range",
Debug.LogMessage(LogEventLevel.Debug, "[Config] Error, device '{0}' IR port {1} out of range",
portDevKey, portNum);
return port;
}
@@ -87,14 +88,14 @@ namespace PepperDash.Essentials.Core
var irControllerKey = dc.Key + "-ir";
if (dc.Properties == null)
{
Debug.Console(0, "[{0}] WARNING: Device config does not include properties. IR will not function.", dc.Key);
Debug.LogMessage(LogEventLevel.Information, "[{0}] WARNING: Device config does not include properties. IR will not function.", dc.Key);
return null;
}
var control = dc.Properties["control"];
if (control == null)
{
Debug.Console(0,
Debug.LogMessage(LogEventLevel.Information,
"WARNING: Device config does not include control properties. IR will not function for {0}", dc.Key);
return null;
}
@@ -105,13 +106,13 @@ namespace PepperDash.Essentials.Core
if (portDevKey == null)
{
Debug.Console(0, "WARNING: control properties is missing ir device for {0}", dc.Key);
Debug.LogMessage(LogEventLevel.Information, "WARNING: control properties is missing ir device for {0}", dc.Key);
return null;
}
if (portNum == 0)
{
Debug.Console(0, "WARNING: control properties is missing ir port number for {0}", dc.Key);
Debug.LogMessage(LogEventLevel.Information, "WARNING: control properties is missing ir port number for {0}", dc.Key);
return null;
}
@@ -123,12 +124,12 @@ namespace PepperDash.Essentials.Core
if (irDev == null)
{
Debug.Console(0, "WARNING: device with IR ports '{0}' not found", portDevKey);
Debug.LogMessage(LogEventLevel.Information, "WARNING: device with IR ports '{0}' not found", portDevKey);
return null;
}
if (portNum > irDev.NumberOfIROutputPorts)
{
Debug.Console(0, "WARNING: device '{0}' IR port {1} out of range",
Debug.LogMessage(LogEventLevel.Information, "WARNING: device '{0}' IR port {1} out of range",
portDevKey, portNum);
return null;
}
@@ -143,7 +144,7 @@ namespace PepperDash.Essentials.Core
public static IrOutputPortController GetIrOutputPortController(DeviceConfig config)
{
Debug.Console(1, "Attempting to create new Ir Port Controller");
Debug.LogMessage(LogEventLevel.Debug, "Attempting to create new Ir Port Controller");
if (config == null)
{
@@ -165,7 +166,7 @@ namespace PepperDash.Essentials.Core
var irControllerKey = devConf.Key + "-ir";
if (devConf.Properties == null)
{
Debug.Console(0, "[{0}] WARNING: Device config does not include properties. IR will not function.", devConf.Key);
Debug.LogMessage(LogEventLevel.Information, "[{0}] WARNING: Device config does not include properties. IR will not function.", devConf.Key);
return new IrOutputPortController(irControllerKey, null, "");
}
@@ -173,7 +174,7 @@ namespace PepperDash.Essentials.Core
if (control == null)
{
var c = new IrOutputPortController(irControllerKey, null, "");
Debug.Console(0, c, "WARNING: Device config does not include control properties. IR will not function");
Debug.LogMessage(LogEventLevel.Information, c, "WARNING: Device config does not include control properties. IR will not function");
return c;
}
@@ -184,14 +185,14 @@ namespace PepperDash.Essentials.Core
if (portDevKey == null)
{
var c = new IrOutputPortController(irControllerKey, null, "");
Debug.Console(0, c, "WARNING: control properties is missing ir device");
Debug.LogMessage(LogEventLevel.Information, c, "WARNING: control properties is missing ir device");
return c;
}
if (portNum == 0)
{
var c = new IrOutputPortController(irControllerKey, null, "");
Debug.Console(0, c, "WARNING: control properties is missing ir port number");
Debug.LogMessage(LogEventLevel.Information, c, "WARNING: control properties is missing ir port number");
return c;
}
@@ -204,7 +205,7 @@ namespace PepperDash.Essentials.Core
if (irDev == null)
{
var c = new IrOutputPortController(irControllerKey, null, "");
Debug.Console(0, c, "WARNING: device with IR ports '{0}' not found", portDevKey);
Debug.LogMessage(LogEventLevel.Information, c, "WARNING: device with IR ports '{0}' not found", portDevKey);
return c;
}
@@ -214,7 +215,7 @@ namespace PepperDash.Essentials.Core
else
{
var c = new IrOutputPortController(irControllerKey, null, "");
Debug.Console(0, c, "WARNING: device '{0}' IR port {1} out of range",
Debug.LogMessage(LogEventLevel.Information, c, "WARNING: device '{0}' IR port {1} out of range",
portDevKey, portNum);
return c;
}

View File

@@ -1,10 +1,10 @@
extern alias Full;
using System.Collections.Generic;
using System.Linq;
using Full.Newtonsoft.Json;
using Newtonsoft.Json;
using Full.Newtonsoft.Json.Linq;
using Newtonsoft.Json.Linq;
namespace PepperDash.Essentials.Core.Config
{

View File

@@ -1,4 +1,4 @@
extern alias Full;
using System;
using System.Collections.Generic;
@@ -7,7 +7,7 @@ using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using PepperDash.Core;
using Full.Newtonsoft.Json.Linq;
using Newtonsoft.Json.Linq;
namespace PepperDash.Essentials.Core.Config
{

View File

@@ -1,4 +1,4 @@
extern alias Full;
using System;
using System.Collections.Generic;
@@ -6,8 +6,8 @@ using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Full.Newtonsoft.Json;
using Full.Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core;

View File

@@ -1,14 +1,15 @@
extern alias Full;
using System;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Full.Newtonsoft.Json;
using Full.Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Core.Config;
using Serilog.Events;
namespace PepperDash.Essentials.Core.Config
{
@@ -27,7 +28,7 @@ namespace PepperDash.Essentials.Core.Config
public static bool LoadConfig2()
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loading unmerged system/template portal configuration file.");
Debug.LogMessage(LogEventLevel.Information, "Loading unmerged system/template portal configuration file.");
try
{
// Check for local config file first
@@ -35,7 +36,7 @@ namespace PepperDash.Essentials.Core.Config
bool localConfigFound = false;
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to load Local config file: '{0}'", filePath);
Debug.LogMessage(LogEventLevel.Information, "Attempting to load Local config file: '{0}'", filePath);
// Check for local config directory first
@@ -45,7 +46,7 @@ namespace PepperDash.Essentials.Core.Config
{
if (configFiles.Length > 1)
{
Debug.Console(0, Debug.ErrorLogLevel.Error,
Debug.LogMessage(LogEventLevel.Information,
"****Error: Multiple Local Configuration files present. Please ensure only a single file exists and reset program.****");
return false;
}
@@ -57,7 +58,7 @@ namespace PepperDash.Essentials.Core.Config
}
else
{
Debug.Console(0, Debug.ErrorLogLevel.Notice,
Debug.LogMessage(LogEventLevel.Information,
"Local Configuration file not present.", filePath);
}
@@ -67,33 +68,33 @@ namespace PepperDash.Essentials.Core.Config
{
filePath = Global.FilePathPrefix + Global.ConfigFileName;
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to load Portal config file: '{0}'", filePath);
Debug.LogMessage(LogEventLevel.Information, "Attempting to load Portal config file: '{0}'", filePath);
configFiles = GetConfigFiles(filePath);
if (configFiles != null)
{
Debug.Console(2, "{0} config files found matching pattern", configFiles.Length);
Debug.LogMessage(LogEventLevel.Verbose, "{0} config files found matching pattern", configFiles.Length);
if (configFiles.Length > 1)
{
Debug.Console(0, Debug.ErrorLogLevel.Error,
Debug.LogMessage(LogEventLevel.Information,
"****Error: Multiple Portal Configuration files present. Please ensure only a single file exists and reset program.****");
return false;
}
else if (configFiles.Length == 1)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Found Portal config file: '{0}'", filePath);
Debug.LogMessage(LogEventLevel.Information, "Found Portal config file: '{0}'", filePath);
}
else
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "No config file found.");
Debug.LogMessage(LogEventLevel.Information, "No config file found.");
return false;
}
}
else
{
Debug.Console(0, Debug.ErrorLogLevel.Error,
Debug.LogMessage(LogEventLevel.Information,
"ERROR: Portal Configuration file not present. Please load file and reset program.");
return false;
}
@@ -111,13 +112,13 @@ namespace PepperDash.Essentials.Core.Config
// Read the file
using (StreamReader fs = new StreamReader(filePath))
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loading config file: '{0}'", filePath);
Debug.LogMessage(LogEventLevel.Information, "Loading config file: '{0}'", filePath);
if (localConfigFound)
{
ConfigObject = JObject.Parse(fs.ReadToEnd()).ToObject<EssentialsConfig>();
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Successfully Loaded Local Config");
Debug.LogMessage(LogEventLevel.Information, "Successfully Loaded Local Config");
return true;
}
@@ -139,14 +140,14 @@ namespace PepperDash.Essentials.Core.Config
}
}
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Successfully Loaded Merged Config");
Debug.LogMessage(LogEventLevel.Information, "Successfully Loaded Merged Config");
return true;
}
}
catch (Exception e)
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "ERROR: Config load failed: \r{0}", e);
Debug.LogMessage(LogEventLevel.Information, "ERROR: Config load failed: \r{0}", e);
return false;
}
}
@@ -163,20 +164,20 @@ namespace PepperDash.Essentials.Core.Config
if (Directory.Exists(dir))
{
Debug.Console(1, "Searching in Directory '{0}'", dir);
Debug.LogMessage(LogEventLevel.Debug, "Searching in Directory '{0}'", dir);
// Get the directory info
var dirInfo = new DirectoryInfo(dir);
// Get the file name
var fileName = Path.GetFileName(filePath);
Debug.Console(1, "For Config Files matching: '{0}'", fileName);
Debug.LogMessage(LogEventLevel.Debug, "For Config Files matching: '{0}'", fileName);
// Get the files that match from the directory
return dirInfo.GetFiles(fileName);
}
else
{
Debug.Console(0, Debug.ErrorLogLevel.Notice,
Debug.LogMessage(LogEventLevel.Information,
"Directory not found: ", dir);
return null;
@@ -248,8 +249,8 @@ namespace PepperDash.Essentials.Core.Config
// Line 8
.Append(new string('*', debugStringWidth));
Debug.Console(2, Debug.ErrorLogLevel.Notice, "Found Local config file: '{0}'", filePath);
Debug.Console(0, newDebugString.ToString());
Debug.LogMessage(LogEventLevel.Verbose, "Found Local config file: '{0}'", filePath);
Debug.LogMessage(LogEventLevel.Information, newDebugString.ToString());
}
}

View File

@@ -1,4 +1,4 @@
extern alias Full;
using System;
using System.Collections.Generic;
@@ -6,12 +6,13 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Full.Newtonsoft.Json;
using Full.Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Crestron.SimplSharp.Net.Http;
using Crestron.SimplSharpPro.Diagnostics;
using PepperDash.Core;
using Serilog.Events;
namespace PepperDash.Essentials.Core.Config
{
@@ -21,7 +22,7 @@ namespace PepperDash.Essentials.Core.Config
public static void GetConfigFromServer(string url)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to get new config from '{0}'", url);
Debug.LogMessage(LogEventLevel.Information, "Attempting to get new config from '{0}'", url);
// HTTP GET
var req = new HttpClientRequest();
@@ -51,17 +52,17 @@ namespace PepperDash.Essentials.Core.Config
}
else
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Config Update Process Stopped. Failed to get config file from server: {0}", r.Code);
Debug.LogMessage(LogEventLevel.Information, "Config Update Process Stopped. Failed to get config file from server: {0}", r.Code);
OnStatusUpdate(eUpdateStatus.UpdateFailed);
}
}
else
Debug.Console(0, Debug.ErrorLogLevel.Error, "Request for config from Server Failed: {0}", e);
Debug.LogMessage(LogEventLevel.Information, "Request for config from Server Failed: {0}", e);
});
}
catch (Exception e)
{
Debug.Console(1, "Error Getting Config from Server: {0}", e);
Debug.LogMessage(LogEventLevel.Debug, "Error Getting Config from Server: {0}", e);
}
}
@@ -90,7 +91,7 @@ namespace PepperDash.Essentials.Core.Config
}
catch (Exception e)
{
Debug.Console(1, "Error parsing new config: {0}", e);
Debug.LogMessage(LogEventLevel.Debug, "Error parsing new config: {0}", e);
OnStatusUpdate(eUpdateStatus.UpdateFailed);
}
@@ -107,7 +108,7 @@ namespace PepperDash.Essentials.Core.Config
if (configFiles != null)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Existing config files found. Moving to Archive folder.");
Debug.LogMessage(LogEventLevel.Information, "Existing config files found. Moving to Archive folder.");
OnStatusUpdate(eUpdateStatus.ArchivingConfigs);
@@ -115,7 +116,7 @@ namespace PepperDash.Essentials.Core.Config
}
else
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "No Existing config files found in '{0}'. Nothing to archive", filePath);
Debug.LogMessage(LogEventLevel.Information, "No Existing config files found in '{0}'. Nothing to archive", filePath);
}
}
@@ -140,12 +141,12 @@ namespace PepperDash.Essentials.Core.Config
if(archivedConfigFiles != null || archivedConfigFiles.Length > 0)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "{0} Existing files found in archive folder. Deleting.", archivedConfigFiles.Length);
Debug.LogMessage(LogEventLevel.Information, "{0} Existing files found in archive folder. Deleting.", archivedConfigFiles.Length);
for (int i = 0; i < archivedConfigFiles.Length; i++ )
{
var file = archivedConfigFiles[i];
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Deleting archived file: '{0}'", file.FullName);
Debug.LogMessage(LogEventLevel.Information, "Deleting archived file: '{0}'", file.FullName);
file.Delete();
}
}
@@ -155,7 +156,7 @@ namespace PepperDash.Essentials.Core.Config
// Move any files from the program folder to the archive folder
foreach (var file in files)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Moving config file '{0}' to archive folder", file.FullName);
Debug.LogMessage(LogEventLevel.Information, "Moving config file '{0}' to archive folder", file.FullName);
// Moves the file and appends the .bak extension
var fileDest = archiveDirectoryPath + "/" + file.Name + ".bak";
@@ -164,7 +165,7 @@ namespace PepperDash.Essentials.Core.Config
file.MoveTo(fileDest);
}
else
Debug.Console(0, Debug.ErrorLogLevel.Warning, "Cannot move file to archive folder. Existing file already exists with same name: '{0}'", fileDest);
Debug.LogMessage(LogEventLevel.Information, "Cannot move file to archive folder. Existing file already exists with same name: '{0}'", fileDest);
}
}
@@ -179,7 +180,7 @@ namespace PepperDash.Essentials.Core.Config
{
OnStatusUpdate(eUpdateStatus.DeletingLocalConfig);
Directory.Delete(folderPath);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Local Config Found in '{0}'. Deleting.", folderPath);
Debug.LogMessage(LogEventLevel.Information, "Local Config Found in '{0}'. Deleting.", folderPath);
}
}
@@ -188,7 +189,7 @@ namespace PepperDash.Essentials.Core.Config
/// </summary>
static void RestartProgram()
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to Reset Program");
Debug.LogMessage(LogEventLevel.Information, "Attempting to Reset Program");
OnStatusUpdate(eUpdateStatus.RestartingProgram);
@@ -196,7 +197,7 @@ namespace PepperDash.Essentials.Core.Config
CrestronConsole.SendControlSystemCommand(string.Format("progreset -p:{0}", InitialParametersClass.ApplicationNumber), ref response);
Debug.Console(1, "Console Response: {0}", response);
Debug.LogMessage(LogEventLevel.Debug, "Console Response: {0}", response);
}
}

View File

@@ -1,4 +1,4 @@
extern alias Full;
using System;
using System.Collections.Generic;
@@ -6,9 +6,10 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Full.Newtonsoft.Json;
using Full.Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using Serilog.Events;
namespace PepperDash.Essentials.Core.Config
{
@@ -42,7 +43,7 @@ namespace PepperDash.Essentials.Core.Config
// Replace the current properties JToken with the new one passed into this method
deviceConfig.Properties = properties;
Debug.Console(1, "Updated properties of device: '{0}'", deviceKey);
Debug.LogMessage(LogEventLevel.Debug, "Updated properties of device: '{0}'", deviceKey);
success = true;
}
@@ -62,7 +63,7 @@ namespace PepperDash.Essentials.Core.Config
{
ConfigReader.ConfigObject.Devices[deviceConfigIndex] = config;
Debug.Console(1, "Updated config of device: '{0}'", config.Key);
Debug.LogMessage(LogEventLevel.Debug, "Updated config of device: '{0}'", config.Key);
success = true;
}
@@ -82,7 +83,7 @@ namespace PepperDash.Essentials.Core.Config
{
ConfigReader.ConfigObject.Rooms[roomConfigIndex] = config;
Debug.Console(1, "Updated room of device: '{0}'", config.Key);
Debug.LogMessage(LogEventLevel.Debug, "Updated room of device: '{0}'", config.Key);
success = true;
}
@@ -102,7 +103,7 @@ namespace PepperDash.Essentials.Core.Config
WriteTimer.Reset(WriteTimeout);
Debug.Console(1, "Config File write timer has been reset.");
Debug.LogMessage(LogEventLevel.Debug, "Config File write timer has been reset.");
}
/// <summary>
@@ -128,9 +129,9 @@ namespace PepperDash.Essentials.Core.Config
if (WriteTimer != null)
WriteTimer.Stop();
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Writing Configuration to file");
Debug.LogMessage(LogEventLevel.Information, "Writing Configuration to file");
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to write config file: '{0}'", filePath);
Debug.LogMessage(LogEventLevel.Information, "Attempting to write config file: '{0}'", filePath);
try
{
@@ -144,12 +145,12 @@ namespace PepperDash.Essentials.Core.Config
}
else
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to enter FileLock");
Debug.LogMessage(LogEventLevel.Information, "Unable to enter FileLock");
}
}
catch (Exception e)
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: Config write failed: \r{0}", e);
Debug.LogMessage(LogEventLevel.Information, "Error: Config write failed: \r{0}", e);
}
finally
{

View File

@@ -1,11 +1,11 @@
extern alias Full;
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using Crestron.SimplSharp.CrestronIO;
using Full.Newtonsoft.Json;
using Newtonsoft.Json;
using PepperDash.Core;

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PepperDash.Essentials.Core
{
public interface ILoadConfig
{
void GoWithLoad();
}
}

View File

@@ -1,11 +1,11 @@
extern alias Full;
using System;
using System.Collections.Generic;
using Crestron.SimplSharp;
using Crestron.SimplSharp.Reflection;
using Full.Newtonsoft.Json;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Core.Config
{

View File

@@ -1,106 +0,0 @@
using System;
using System.Collections.Generic;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.GeneralIO;
using PepperDash.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core.CrestronIO
{
public class C2NIoController:CrestronGenericBaseDevice, IComPorts, IIROutputPorts, IRelayPorts
{
private C2nIo _device;
public C2NIoController(string key, Func<DeviceConfig, C2nIo> preActivationFunc, DeviceConfig config):base(key, config.Name)
{
AddPreActivationAction(() =>
{
_device = preActivationFunc(config);
RegisterCrestronGenericBase(_device);
});
}
#region Implementation of IComPorts
public CrestronCollection<ComPort> ComPorts
{
get { return _device.ComPorts; }
}
public int NumberOfComPorts
{
get { return _device.NumberOfComPorts; }
}
#endregion
#region Implementation of IIROutputPorts
public CrestronCollection<IROutputPort> IROutputPorts
{
get { return _device.IROutputPorts; }
}
public int NumberOfIROutputPorts
{
get { return _device.NumberOfIROutputPorts; }
}
#endregion
#region Implementation of IRelayPorts
public CrestronCollection<Relay> RelayPorts
{
get { return _device.RelayPorts; }
}
public int NumberOfRelayPorts
{
get { return _device.NumberOfRelayPorts; }
}
#endregion
}
public class C2NIoControllerFactory : EssentialsDeviceFactory<C2NIoController>
{
public C2NIoControllerFactory()
{
TypeNames = new List<string>() { "c2nio" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new C2N-IO Device");
return new C2NIoController(dc.Key, GetC2NIoDevice, dc);
}
static C2nIo GetC2NIoDevice(DeviceConfig dc)
{
var control = CommFactory.GetControlPropertiesConfig(dc);
var cresnetId = control.CresnetIdInt;
var branchId = control.ControlPortNumber;
var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nIo", parentKey);
return new C2nIo(cresnetId, Global.ControlSystem);
}
var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches;
if (cresnetBridge != null)
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nIo", parentKey);
return new C2nIo(cresnetId, cresnetBridge.CresnetBranches[branchId]);
}
Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
return null;
}
}
}

View File

@@ -1,150 +0,0 @@
extern alias Full;
using System;
using System.Collections.Generic;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.GeneralIO;
using Full.Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core.CrestronIO
{
[Description("Wrapper class for the C2N-RTHS sensor")]
public class C2nRthsController : CrestronGenericBridgeableBaseDevice
{
private C2nRths _device;
public IntFeedback TemperatureFeedback { get; private set; }
public IntFeedback HumidityFeedback { get; private set; }
public C2nRthsController(string key, Func<DeviceConfig, C2nRths> preActivationFunc,
DeviceConfig config)
: base(key, config.Name)
{
AddPreActivationAction(() =>
{
_device = preActivationFunc(config);
RegisterCrestronGenericBase(_device);
TemperatureFeedback = new IntFeedback(() => _device.TemperatureFeedback.UShortValue);
HumidityFeedback = new IntFeedback(() => _device.HumidityFeedback.UShortValue);
if (_device != null) _device.BaseEvent += DeviceOnBaseEvent;
});
}
private void DeviceOnBaseEvent(GenericBase device, BaseEventArgs args)
{
switch (args.EventId)
{
case C2nRths.TemperatureFeedbackEventId:
TemperatureFeedback.FireUpdate();
break;
case C2nRths.HumidityFeedbackEventId:
HumidityFeedback.FireUpdate();
break;
}
}
public void SetTemperatureFormat(bool setToC)
{
_device.TemperatureFormat.BoolValue = setToC;
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
var joinMap = new C2nRthsControllerJoinMap(joinStart);
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<C2nRthsControllerJoinMap>(joinMapSerialized);
if (bridge != null)
{
bridge.AddJoinMap(Key, joinMap);
}
else
{
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
trilist.SetBoolSigAction(joinMap.TemperatureFormat.JoinNumber, SetTemperatureFormat);
IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
TemperatureFeedback.LinkInputSig(trilist.UShortInput[joinMap.Temperature.JoinNumber]);
HumidityFeedback.LinkInputSig(trilist.UShortInput[joinMap.Humidity.JoinNumber]);
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name;
trilist.OnlineStatusChange += (d, args) =>
{
if (!args.DeviceOnLine) return;
UpdateFeedbacksWhenOnline();
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name;
};
}
private void UpdateFeedbacksWhenOnline()
{
IsOnline.FireUpdate();
TemperatureFeedback.FireUpdate();
HumidityFeedback.FireUpdate();
}
#region PreActivation
private static C2nRths GetC2nRthsDevice(DeviceConfig dc)
{
var control = CommFactory.GetControlPropertiesConfig(dc);
var cresnetId = control.CresnetIdInt;
var branchId = control.ControlPortNumber;
var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nRths", parentKey);
return new C2nRths(cresnetId, Global.ControlSystem);
}
var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches;
if (cresnetBridge != null)
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nRths", parentKey);
return new C2nRths(cresnetId, cresnetBridge.CresnetBranches[branchId]);
}
Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
return null;
}
#endregion
public class C2nRthsControllerFactory : EssentialsDeviceFactory<C2nRthsController>
{
public C2nRthsControllerFactory()
{
TypeNames = new List<string>() { "c2nrths" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new C2N-RTHS Device");
return new C2nRthsController(dc.Key, GetC2nRthsDevice, dc);
}
}
}
}

View File

@@ -1,24 +0,0 @@
using System;
using Crestron.SimplSharpProInternal;
namespace PepperDash.Essentials.Core.CrestronIO.Cards
{
public class C3CardControllerBase:CrestronGenericBaseDevice
{
private readonly C3Card _card;
public C3CardControllerBase(string key, string name, C3Card hardware) : base(key, name, hardware)
{
_card = hardware;
}
#region Overrides of Object
public override string ToString()
{
return String.Format("{0} {1}", Key, _card.ToString());
}
#endregion
}
}

View File

@@ -1,29 +0,0 @@
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.ThreeSeriesCards;
namespace PepperDash.Essentials.Core.CrestronIO.Cards
{
public class C3Com3Controller:C3CardControllerBase, IComPorts
{
private readonly C3com3 _card;
public C3Com3Controller(string key, string name, C3com3 hardware) : base(key, name, hardware)
{
_card = hardware;
}
#region Implementation of IComPorts
public CrestronCollection<ComPort> ComPorts
{
get { return _card.ComPorts; }
}
public int NumberOfComPorts
{
get { return _card.NumberOfComPorts; }
}
#endregion
}
}

View File

@@ -1,29 +0,0 @@
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.ThreeSeriesCards;
namespace PepperDash.Essentials.Core.CrestronIO.Cards
{
public class C3Io16Controller:C3CardControllerBase,IIOPorts
{
private readonly C3io16 _card;
public C3Io16Controller(string key, string name, C3io16 hardware) : base(key, name, hardware)
{
_card = hardware;
}
#region Implementation of IIOPorts
public CrestronCollection<Versiport> VersiPorts
{
get { return _card.VersiPorts; }
}
public int NumberOfVersiPorts
{
get { return _card.NumberOfVersiPorts; }
}
#endregion
}
}

View File

@@ -1,29 +0,0 @@
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.ThreeSeriesCards;
namespace PepperDash.Essentials.Core.CrestronIO.Cards
{
public class C3Ir8Controller:C3CardControllerBase, IIROutputPorts
{
private readonly C3ir8 _card;
public C3Ir8Controller(string key, string name, C3ir8 hardware) : base(key, name, hardware)
{
_card = hardware;
}
#region Implementation of IIROutputPorts
public CrestronCollection<IROutputPort> IROutputPorts
{
get { return _card.IROutputPorts; }
}
public int NumberOfIROutputPorts
{
get { return _card.NumberOfIROutputPorts; }
}
#endregion
}
}

View File

@@ -1,29 +0,0 @@
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.ThreeSeriesCards;
namespace PepperDash.Essentials.Core.CrestronIO.Cards
{
public class C3Ry16Controller:C3CardControllerBase, IRelayPorts
{
private readonly C3ry16 _card;
public C3Ry16Controller(string key, string name, C3ry16 hardware) : base(key, name, hardware)
{
_card = hardware;
}
#region Implementation of IRelayPorts
public CrestronCollection<Relay> RelayPorts
{
get { return _card.RelayPorts; }
}
public int NumberOfRelayPorts
{
get { return _card.NumberOfRelayPorts; }
}
#endregion
}
}

View File

@@ -1,29 +0,0 @@
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.ThreeSeriesCards;
namespace PepperDash.Essentials.Core.CrestronIO.Cards
{
public class C3Ry8Controller:C3CardControllerBase, IRelayPorts
{
private readonly C3ry8 _card;
public C3Ry8Controller(string key, string name, C3ry8 hardware) : base(key, name, hardware)
{
_card = hardware;
}
#region Implementation of IRelayPorts
public CrestronCollection<Relay> RelayPorts
{
get { return _card.RelayPorts; }
}
public int NumberOfRelayPorts
{
get { return _card.NumberOfRelayPorts; }
}
#endregion
}
}

View File

@@ -1,118 +0,0 @@
extern alias Full;
using System;
using System.Collections.Generic;
using Crestron.SimplSharpPro.ThreeSeriesCards;
using Full.Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core.CrestronIO.Cards
{
[ConfigSnippet("\"properties\":{\"card\":\"c3com3\"}")]
public class CenCi31Controller : CrestronGenericBaseDevice
{
private const string CardKeyTemplate = "{0}-card";
private const string CardNameTemplate = "{0}:{1}:{2}";
private const uint CardSlot = 1;
private readonly CenCi31 _cardCage;
private readonly CenCi31Configuration _config;
private readonly Dictionary<string, Func<CenCi31, uint, C3CardControllerBase>> _cardDict;
public CenCi31Controller(string key, string name, CenCi31Configuration config, CenCi31 hardware) : base(key, name, hardware)
{
_cardCage = hardware;
_config = config;
_cardDict = new Dictionary<string, Func<CenCi31, uint, C3CardControllerBase>>
{
{
"c3com3",
(c, s) =>
new C3Com3Controller(String.Format(CardKeyTemplate, key),
String.Format(CardNameTemplate, key, s, "C3Com3"), new C3com3(_cardCage))
},
{
"c3io16",
(c, s) =>
new C3Io16Controller(String.Format(CardKeyTemplate, key),
String.Format(CardNameTemplate, key, s,"C3Io16"), new C3io16(_cardCage))
},
{
"c3ir8",
(c, s) =>
new C3Ir8Controller(String.Format(CardKeyTemplate, key),
String.Format(CardNameTemplate, key, s, "C3Ir8"), new C3ir8(_cardCage))
},
{
"c3ry16",
(c, s) =>
new C3Ry16Controller(String.Format(CardKeyTemplate, key),
String.Format(CardNameTemplate, key, s, "C3Ry16"), new C3ry16(_cardCage))
},
{
"c3ry8",
(c, s) =>
new C3Ry8Controller(String.Format(CardKeyTemplate, key),
String.Format(CardNameTemplate, key, s, "C3Ry8"), new C3ry8(_cardCage))
},
};
GetCards();
}
private void GetCards()
{
Func<CenCi31, uint, C3CardControllerBase> cardBuilder;
if (String.IsNullOrEmpty(_config.Card))
{
Debug.Console(0, this, "No card specified");
return;
}
if (!_cardDict.TryGetValue(_config.Card.ToLower(), out cardBuilder))
{
Debug.Console(0, "Unable to find factory for 3-Series card type {0}.", _config.Card);
return;
}
var device = cardBuilder(_cardCage, CardSlot);
DeviceManager.AddDevice(device);
}
}
public class CenCi31Configuration
{
[JsonProperty("card")]
public string Card { get; set; }
}
public class CenCi31ControllerFactory : EssentialsDeviceFactory<CenCi31Controller>
{
public CenCi31ControllerFactory()
{
TypeNames = new List<string> {"cenci31"};
}
#region Overrides of EssentialsDeviceFactory<CenCi31Controller>
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory attempting to build new CEN-CI-1");
var controlProperties = CommFactory.GetControlPropertiesConfig(dc);
var ipId = controlProperties.IpIdInt;
var cardCage = new CenCi31(ipId, Global.ControlSystem);
var config = dc.Properties.ToObject<CenCi31Configuration>();
return new CenCi31Controller(dc.Key, dc.Name, config, cardCage);
}
#endregion
}
}

View File

@@ -1,133 +0,0 @@
extern alias Full;
using System;
using System.Collections.Generic;
using Crestron.SimplSharpPro.ThreeSeriesCards;
using Full.Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core.CrestronIO.Cards
{
[ConfigSnippet("\"properties\":{\"cards\":{\"1\":\"c3com3\",\"2\":\"c3ry16\",\"3\":\"c3ry8\"}}")]
public class CenCi33Controller : CrestronGenericBaseDevice
{
private const string CardKeyTemplate = "{0}-card{1}";
private const string CardNameTemplate = "{0}:{1}:{2}";
private const uint CardSlots = 3;
private readonly CenCi33 _cardCage;
private readonly CenCi33Configuration _config;
private readonly Dictionary<string, Func<CenCi33, uint, C3CardControllerBase>> _cardDict;
public CenCi33Controller(string key, string name, CenCi33Configuration config, CenCi33 hardware) : base(key, name, hardware)
{
_cardCage = hardware;
_config = config;
_cardDict = new Dictionary<string, Func<CenCi33, uint, C3CardControllerBase>>
{
{
"c3com3",
(c, s) =>
new C3Com3Controller(String.Format(CardKeyTemplate, key, s),
String.Format(CardNameTemplate, key, s, "C3Com3"), new C3com3(s,_cardCage))
},
{
"c3io16",
(c, s) =>
new C3Io16Controller(String.Format(CardKeyTemplate, key, s),
String.Format(CardNameTemplate, key, s, "C3Io16"), new C3io16(s,_cardCage))
},
{
"c3ir8",
(c, s) =>
new C3Ir8Controller(String.Format(CardKeyTemplate, key, s),
String.Format(CardNameTemplate, key, s, "C3Ir8"), new C3ir8(s,_cardCage))
},
{
"c3ry16",
(c, s) =>
new C3Ry16Controller(String.Format(CardKeyTemplate, key, s),
String.Format(CardNameTemplate, key, s, "C3Ry16"), new C3ry16(s,_cardCage))
},
{
"c3ry8",
(c, s) =>
new C3Ry8Controller(String.Format(CardKeyTemplate, key, s),
String.Format(CardNameTemplate, key, s, "C3Ry8"), new C3ry8(s,_cardCage))
},
};
GetCards();
}
private void GetCards()
{
if (_config.Cards == null)
{
Debug.Console(0, this, "No card configuration for this device found");
return;
}
for (uint i = 1; i <= CardSlots; i++)
{
string cardType;
if (!_config.Cards.TryGetValue(i, out cardType))
{
Debug.Console(1, this, "No card found for slot {0}", i);
continue;
}
if (String.IsNullOrEmpty(cardType))
{
Debug.Console(0, this, "No card specified for slot {0}", i);
return;
}
Func<CenCi33, uint, C3CardControllerBase> cardBuilder;
if (!_cardDict.TryGetValue(cardType.ToLower(), out cardBuilder))
{
Debug.Console(0, "Unable to find factory for 3-Series card type {0}.", cardType);
return;
}
var device = cardBuilder(_cardCage, i);
DeviceManager.AddDevice(device);
}
}
}
public class CenCi33Configuration
{
[JsonProperty("cards")]
public Dictionary<uint, string> Cards { get; set; }
}
public class CenCi33ControllerFactory : EssentialsDeviceFactory<CenCi33Controller>
{
public CenCi33ControllerFactory()
{
TypeNames = new List<string> {"cenci33"};
}
#region Overrides of EssentialsDeviceFactory<CenCi33Controller>
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory attempting to build new CEN-CI-3");
var controlProperties = CommFactory.GetControlPropertiesConfig(dc);
var ipId = controlProperties.IpIdInt;
var cardCage = new CenCi33(ipId, Global.ControlSystem);
var config = dc.Properties.ToObject<CenCi33Configuration>();
return new CenCi33Controller(dc.Key, dc.Name, config, cardCage);
}
#endregion
}
}

View File

@@ -1,143 +0,0 @@
extern alias Full;
using System;
using System.Collections.Generic;
using Crestron.SimplSharpPro.ThreeSeriesCards;
using Full.Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core.CrestronIO.Cards
{
[ConfigSnippet("\"properties\":{\"cards\":{\"1\":\"c3com3\",\"2\":\"c3ry16\",\"3\":\"c3ry8\"}}")]
public class InternalCardCageController : EssentialsDevice
{
private const string CardKeyTemplate = "{0}-card{1}";
private const string CardNameTemplate = "{0}:{1}:{2}";
private const uint CardSlots = 3;
private readonly InternalCardCageConfiguration _config;
private readonly Dictionary<string, Func<uint, C3CardControllerBase>> _cardDict;
public InternalCardCageController(string key, string name, InternalCardCageConfiguration config) : base(key, name)
{
_config = config;
_cardDict = new Dictionary<string, Func<uint, C3CardControllerBase>>
{
{
"c3com3",
(s) =>
new C3Com3Controller(String.Format(CardKeyTemplate, key, s),
String.Format(CardNameTemplate, key, s, "C3Com3"), new C3com3(s,Global.ControlSystem))
},
{
"c3io16",
(s) =>
new C3Io16Controller(String.Format(CardKeyTemplate, key, s),
String.Format(CardNameTemplate, key, s, "C3Io16"), new C3io16(s,Global.ControlSystem))
},
{
"c3ir8",
(s) =>
new C3Ir8Controller(String.Format(CardKeyTemplate, key, s),
String.Format(CardNameTemplate, key, s, "C3Ir8"), new C3ir8(s,Global.ControlSystem))
},
{
"c3ry16",
(s) =>
new C3Ry16Controller(String.Format(CardKeyTemplate, key, s),
String.Format(CardNameTemplate, key, s, "C3Ry16"), new C3ry16(s,Global.ControlSystem))
},
{
"c3ry8",
(s) =>
new C3Ry8Controller(String.Format(CardKeyTemplate, key, s),
String.Format(CardNameTemplate, key, s, "C3Ry8"), new C3ry8(s,Global.ControlSystem))
},
};
GetCards();
}
private void GetCards()
{
if (_config.Cards == null)
{
Debug.Console(0, this, "No card configuration for this device found");
return;
}
for (uint i = 1; i <= CardSlots; i++)
{
string cardType;
if (!_config.Cards.TryGetValue(i, out cardType))
{
Debug.Console(0, this, "No card found for slot {0}", i);
continue;
}
if (String.IsNullOrEmpty(cardType))
{
Debug.Console(0, this, "No card specified for slot {0}", i);
continue;
}
Func<uint, C3CardControllerBase> cardBuilder;
if (!_cardDict.TryGetValue(cardType.ToLower(), out cardBuilder))
{
Debug.Console(0, "Unable to find factory for 3-Series card type {0}.", cardType);
continue;
}
try
{
var device = cardBuilder(i);
DeviceManager.AddDevice(device);
}
catch (InvalidOperationException ex)
{
Debug.Console(0, this, Debug.ErrorLogLevel.Error,
"Unable to add card {0} to internal card cage.\r\nError Message: {1}\r\nStack Trace: {2}",
cardType, ex.Message, ex.StackTrace);
}
}
}
}
public class InternalCardCageConfiguration
{
[JsonProperty("cards")]
public Dictionary<uint, string> Cards { get; set; }
}
public class InternalCardCageControllerFactory : EssentialsDeviceFactory<InternalCardCageController>
{
public InternalCardCageControllerFactory()
{
TypeNames = new List<string> {"internalcardcage"};
}
#region Overrides of EssentialsDeviceFactory<InternalCardCageController>
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory attempting to build new Internal Card Cage Controller");
if (!Global.ControlSystem.SupportsThreeSeriesPlugInCards)
{
Debug.Console(0, Debug.ErrorLogLevel.Warning, "Current control system does NOT support 3-Series cards. Everything is NOT awesome.");
return null;
}
var config = dc.Properties.ToObject<InternalCardCageConfiguration>();
return new InternalCardCageController(dc.Key, dc.Name, config);
}
#endregion
}
}

View File

@@ -1,51 +0,0 @@
using System.Collections.Generic;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.GeneralIO;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core
{
public class DinCenCn2Controller : CrestronGenericBaseDevice, IHasCresnetBranches
{
private readonly DinCenCn2 _device;
public CrestronCollection<CresnetBranch> CresnetBranches
{
get {
return _device != null ? _device.Branches : null;
}
}
public DinCenCn2Controller(string key, string name, DinCenCn2 device, DeviceConfig config)
: base(key, name, device)
{
_device = device;
}
public class DinCenCn2ControllerFactory : EssentialsDeviceFactory<DinCenCn2Controller>
{
public DinCenCn2ControllerFactory()
{
TypeNames = new List<string>() { "dincencn2", "dincencn2poe", "din-cencn2", "din-cencn2-poe" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new DIN-CEN-CN2 Device");
var control = CommFactory.GetControlPropertiesConfig(dc);
var ipid = control.IpIdInt;
if (dc.Type.ToLower().Contains("poe"))
{
return new DinCenCn2Controller(dc.Key, dc.Name, new DinCenCn2Poe(ipid, Global.ControlSystem), dc);
}
return new DinCenCn2Controller(dc.Key, dc.Name, new DinCenCn2(ipid, Global.ControlSystem), dc);
}
}
}
}

View File

@@ -1,80 +0,0 @@
using System;
using System.Collections.Generic;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.GeneralIO;
using PepperDash.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core.CrestronIO
{
public class DinIo8Controller:CrestronGenericBaseDevice, IIOPorts
{
private DinIo8 _device;
public DinIo8Controller(string key, Func<DeviceConfig, DinIo8> preActivationFunc, DeviceConfig config):base(key, config.Name)
{
AddPreActivationAction(() =>
{
_device = preActivationFunc(config);
RegisterCrestronGenericBase(_device);
});
}
#region Implementation of IIOPorts
public CrestronCollection<Versiport> VersiPorts
{
get { return _device.VersiPorts; }
}
public int NumberOfVersiPorts
{
get { return _device.NumberOfVersiPorts; }
}
#endregion
}
public class DinIo8ControllerFactory : EssentialsDeviceFactory<DinIo8Controller>
{
public DinIo8ControllerFactory()
{
TypeNames = new List<string>() { "DinIo8" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new DinIo8 Device");
return new DinIo8Controller(dc.Key, GetDinIo8Device, dc);
}
static DinIo8 GetDinIo8Device(DeviceConfig dc)
{
var control = CommFactory.GetControlPropertiesConfig(dc);
var cresnetId = control.CresnetIdInt;
var branchId = control.ControlPortNumber;
var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new DinIo8", parentKey);
return new DinIo8(cresnetId, Global.ControlSystem);
}
var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches;
if (cresnetBridge != null)
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new DinIo8", parentKey);
return new DinIo8(cresnetId, cresnetBridge.CresnetBranches[branchId]);
}
Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
return null;
}
}
}

View File

@@ -1,69 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.GeneralIO;
using PepperDash.Essentials.Core.Config;
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Wrapper class for CEN-IO-DIGIN-104 digital input module
/// </summary>
[Description("Wrapper class for the CEN-IO-DIGIN-104 diginal input module")]
public class CenIoDigIn104Controller : CrestronGenericBaseDevice, IDigitalInputPorts
{
public CenIoDi104 Di104 { get; private set; }
public CenIoDigIn104Controller(string key, string name, CenIoDi104 di104)
: base(key, name)
{
Di104 = di104;
}
#region IDigitalInputPorts Members
public CrestronCollection<DigitalInput> DigitalInputPorts
{
get { return Di104.DigitalInputPorts; }
}
public int NumberOfDigitalInputPorts
{
get { return Di104.NumberOfDigitalInputPorts; }
}
#endregion
}
public class CenIoDigIn104ControllerFactory : EssentialsDeviceFactory<CenIoDigIn104Controller>
{
public CenIoDigIn104ControllerFactory()
{
TypeNames = new List<string>() { "ceniodigin104" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new CEN-DIGIN-104 Device");
var control = CommFactory.GetControlPropertiesConfig(dc);
if (control == null)
{
Debug.Console(1, "Factory failed to create a new CEN-DIGIN-104 Device, control properties not found");
return null;
}
var ipid = control.IpIdInt;
if (ipid != 0) return new CenIoDigIn104Controller(dc.Key, dc.Name, new CenIoDi104(ipid, Global.ControlSystem));
Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device using IP-ID-{0}", ipid);
return null;
}
}
}

View File

@@ -1,93 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.GeneralIO;
using PepperDash.Essentials.Core.Config;
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Wrapper class for CEN-IO-IR-104 module
/// </summary>
[Description("Wrapper class for the CEN-IO-IR-104 module")]
public class CenIoIr104Controller : CrestronGenericBaseDevice, IIROutputPorts
{
private readonly CenIoIr104 _ir104;
/// <summary>
/// Constructor
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="ir104"></param>
public CenIoIr104Controller(string key, string name, CenIoIr104 ir104)
: base(key, name, ir104)
{
_ir104 = ir104;
}
#region IDigitalInputPorts Members
/// <summary>
/// IR port collection
/// </summary>
public CrestronCollection<IROutputPort> IROutputPorts
{
get { return _ir104.IROutputPorts; }
}
/// <summary>
/// Number of relay ports property
/// </summary>
public int NumberOfIROutputPorts
{
get { return _ir104.NumberOfIROutputPorts; }
}
#endregion
}
/// <summary>
/// CEN-IO-IR-104 controller fatory
/// </summary>
public class CenIoIr104ControllerFactory : EssentialsDeviceFactory<CenIoIr104Controller>
{
/// <summary>
/// Constructor
/// </summary>
public CenIoIr104ControllerFactory()
{
TypeNames = new List<string>() { "cenioir104" };
}
/// <summary>
/// Build device CEN-IO-IR-104
/// </summary>
/// <param name="dc"></param>
/// <returns></returns>
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new CEN-IO-IR-104 Device");
var control = CommFactory.GetControlPropertiesConfig(dc);
if (control == null)
{
Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device, control properties not found");
return null;
}
var ipid = control.IpIdInt;
if(ipid != 0) return new CenIoIr104Controller(dc.Key, dc.Name, new CenIoIr104(ipid, Global.ControlSystem));
Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device using IP-ID-{0}", ipid);
return null;
}
}
}

View File

@@ -1,77 +0,0 @@
using System.Collections.Generic;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.GeneralIO;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Wrapper class for CEN-IO-RY-104 relay module
/// </summary>
[Description("Wrapper class for the CEN-IO-RY-104 relay module")]
public class CenIoRy104Controller : CrestronGenericBaseDevice, IRelayPorts
{
private readonly CenIoRy104 _ry104;
/// <summary>
/// Constructor
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="ry104"></param>
public CenIoRy104Controller(string key, string name, CenIoRy104 ry104)
: base(key, name, ry104)
{
_ry104 = ry104;
}
/// <summary>
/// Relay port collection
/// </summary>
public CrestronCollection<Relay> RelayPorts
{
get { return _ry104.RelayPorts; }
}
/// <summary>
/// Number of relay ports property
/// </summary>
public int NumberOfRelayPorts
{
get { return _ry104.NumberOfRelayPorts; }
}
}
/// <summary>
/// CEN-IO-RY Controller factory
/// </summary>
public class CenIoRy104ControllerFactory : EssentialsDeviceFactory<CenIoRy104Controller>
{
/// <summary>
/// Constructor
/// </summary>
public CenIoRy104ControllerFactory()
{
TypeNames = new List<string>() { "ceniory104" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create a new CEN-IO-RY-104 Device");
var controlPropertiesConfig = CommFactory.GetControlPropertiesConfig(dc);
if (controlPropertiesConfig == null)
{
Debug.Console(1, "Factory failed to create a new CEN-IO-RY-104 Device, control properties not found");
return null;
}
var ipid = controlPropertiesConfig.IpIdInt;
if (ipid != 0) return new CenIoRy104Controller(dc.Key, dc.Name, new CenIoRy104(ipid, Global.ControlSystem));
Debug.Console(1, "Factory failed to create a new CEN-IO-RY-104 Device using IP-ID-{0}", ipid);
return null;
}
}
}

View File

@@ -1,225 +0,0 @@
extern alias Full;
using System;
using System.Collections.Generic;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.GeneralIO;
using Full.Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core.CrestronIO
{
[Description("Wrapper class for the Crestron StatusSign device")]
public class StatusSignController : CrestronGenericBridgeableBaseDevice
{
private StatusSign _device;
public BoolFeedback RedLedEnabledFeedback { get; private set; }
public BoolFeedback GreenLedEnabledFeedback { get; private set; }
public BoolFeedback BlueLedEnabledFeedback { get; private set; }
public IntFeedback RedLedBrightnessFeedback { get; private set; }
public IntFeedback GreenLedBrightnessFeedback { get; private set; }
public IntFeedback BlueLedBrightnessFeedback { get; private set; }
public StatusSignController(string key, Func<DeviceConfig, StatusSign> preActivationFunc, DeviceConfig config) : base(key, config.Name)
{
AddPreActivationAction(() =>
{
_device = preActivationFunc(config);
RegisterCrestronGenericBase(_device);
RedLedEnabledFeedback =
new BoolFeedback(
() =>
_device.Leds[(uint)StatusSign.Led.eLedColor.Red]
.ControlFeedback.BoolValue);
GreenLedEnabledFeedback =
new BoolFeedback(
() =>
_device.Leds[(uint)StatusSign.Led.eLedColor.Green]
.ControlFeedback.BoolValue);
BlueLedEnabledFeedback =
new BoolFeedback(
() =>
_device.Leds[(uint)StatusSign.Led.eLedColor.Blue]
.ControlFeedback.BoolValue);
RedLedBrightnessFeedback =
new IntFeedback(() => (int)_device.Leds[(uint)StatusSign.Led.eLedColor.Red].BrightnessFeedback);
GreenLedBrightnessFeedback =
new IntFeedback(() => (int)_device.Leds[(uint)StatusSign.Led.eLedColor.Green].BrightnessFeedback);
BlueLedBrightnessFeedback =
new IntFeedback(() => (int)_device.Leds[(uint)StatusSign.Led.eLedColor.Blue].BrightnessFeedback);
if (_device != null) _device.BaseEvent += _device_BaseEvent;
});
}
void _device_BaseEvent(GenericBase device, BaseEventArgs args)
{
switch (args.EventId)
{
case StatusSign.LedBrightnessFeedbackEventId:
RedLedBrightnessFeedback.FireUpdate();
GreenLedBrightnessFeedback.FireUpdate();
BlueLedBrightnessFeedback.FireUpdate();
break;
case StatusSign.LedControlFeedbackEventId:
RedLedEnabledFeedback.FireUpdate();
GreenLedEnabledFeedback.FireUpdate();
BlueLedEnabledFeedback.FireUpdate();
break;
}
}
public void EnableLedControl(bool red, bool green, bool blue)
{
_device.Leds[(uint) StatusSign.Led.eLedColor.Red].Control.BoolValue = red;
_device.Leds[(uint)StatusSign.Led.eLedColor.Green].Control.BoolValue = green;
_device.Leds[(uint)StatusSign.Led.eLedColor.Blue].Control.BoolValue = blue;
}
public void SetColor(uint red, uint green, uint blue)
{
try
{
_device.Leds[(uint)StatusSign.Led.eLedColor.Red].Brightness =
(StatusSign.Led.eBrightnessPercentageValues)SimplSharpDeviceHelper.PercentToUshort(red);
}
catch (InvalidOperationException)
{
Debug.Console(1, this, "Error converting value to Red LED brightness. value: {0}", red);
}
try
{
_device.Leds[(uint)StatusSign.Led.eLedColor.Green].Brightness =
(StatusSign.Led.eBrightnessPercentageValues)SimplSharpDeviceHelper.PercentToUshort(green);
}
catch (InvalidOperationException)
{
Debug.Console(1, this, "Error converting value to Green LED brightness. value: {0}", green);
}
try
{
_device.Leds[(uint)StatusSign.Led.eLedColor.Blue].Brightness =
(StatusSign.Led.eBrightnessPercentageValues)SimplSharpDeviceHelper.PercentToUshort(blue);
}
catch (InvalidOperationException)
{
Debug.Console(1, this, "Error converting value to Blue LED brightness. value: {0}", blue);
}
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
var joinMap = new StatusSignControllerJoinMap(joinStart);
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<StatusSignControllerJoinMap>(joinMapSerialized);
if (bridge != null)
{
bridge.AddJoinMap(Key, joinMap);
}
else
{
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
trilist.SetBoolSigAction(joinMap.RedControl.JoinNumber, b => EnableControl(trilist, joinMap, this));
trilist.SetBoolSigAction(joinMap.GreenControl.JoinNumber, b => EnableControl(trilist, joinMap, this));
trilist.SetBoolSigAction(joinMap.BlueControl.JoinNumber, b => EnableControl(trilist, joinMap, this));
trilist.SetUShortSigAction(joinMap.RedLed.JoinNumber, u => SetColor(trilist, joinMap, this));
trilist.SetUShortSigAction(joinMap.GreenLed.JoinNumber, u => SetColor(trilist, joinMap, this));
trilist.SetUShortSigAction(joinMap.BlueLed.JoinNumber, u => SetColor(trilist, joinMap, this));
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name;
IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
RedLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RedControl.JoinNumber]);
BlueLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.BlueControl.JoinNumber]);
GreenLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.GreenControl.JoinNumber]);
RedLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.RedLed.JoinNumber]);
BlueLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.BlueLed.JoinNumber]);
GreenLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.GreenLed.JoinNumber]);
}
private static void EnableControl(BasicTriList triList, StatusSignControllerJoinMap joinMap,
StatusSignController device)
{
var redEnable = triList.BooleanOutput[joinMap.RedControl.JoinNumber].BoolValue;
var greenEnable = triList.BooleanOutput[joinMap.GreenControl.JoinNumber].BoolValue;
var blueEnable = triList.BooleanOutput[joinMap.BlueControl.JoinNumber].BoolValue;
device.EnableLedControl(redEnable, greenEnable, blueEnable);
}
private static void SetColor(BasicTriList triList, StatusSignControllerJoinMap joinMap,
StatusSignController device)
{
var redBrightness = triList.UShortOutput[joinMap.RedLed.JoinNumber].UShortValue;
var greenBrightness = triList.UShortOutput[joinMap.GreenLed.JoinNumber].UShortValue;
var blueBrightness = triList.UShortOutput[joinMap.BlueLed.JoinNumber].UShortValue;
device.SetColor(redBrightness, greenBrightness, blueBrightness);
}
#region PreActivation
private static StatusSign GetStatusSignDevice(DeviceConfig dc)
{
var control = CommFactory.GetControlPropertiesConfig(dc);
var cresnetId = control.CresnetIdInt;
var branchId = control.ControlPortNumber;
var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey;
if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase))
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new StatusSign", parentKey);
return new StatusSign(cresnetId, Global.ControlSystem);
}
var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches;
if (cresnetBridge != null)
{
Debug.Console(0, "Device {0} is a valid cresnet master - creating new StatusSign", parentKey);
return new StatusSign(cresnetId, cresnetBridge.CresnetBranches[branchId]);
}
Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey);
return null;
}
#endregion
public class StatusSignControllerFactory : EssentialsDeviceFactory<StatusSignController>
{
public StatusSignControllerFactory()
{
TypeNames = new List<string>() { "statussign" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new StatusSign Device");
var control = CommFactory.GetControlPropertiesConfig(dc);
var cresnetId = control.CresnetIdInt;
return new StatusSignController(dc.Key, GetStatusSignDevice, dc);
}
}
}
}

View File

@@ -5,12 +5,10 @@ using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using PepperDash.Core.JsonStandardObjects;
using PepperDash.Essentials.Core.Bridges;
using Serilog.Events;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// A bridge class to cover the basic features of GenericBase hardware
/// </summary>
public abstract class CrestronGenericBaseDevice : EssentialsDevice, IOnline, IHasFeedback, ICommunicationMonitor, IUsageTracking
{
protected GenericBase Hardware;
@@ -68,17 +66,17 @@ namespace PepperDash.Essentials.Core
/// </summary>
public override bool CustomActivate()
{
Debug.Console(0, this, "Activating");
Debug.LogMessage(LogEventLevel.Information, this, "Activating");
if (!PreventRegistration)
{
//Debug.Console(1, this, " Does not require registration. Skipping");
//Debug.LogMessage(LogEventLevel.Debug, this, " Does not require registration. Skipping");
if (Hardware.Registerable && !Hardware.Registered)
{
var response = Hardware.RegisterWithLogging(Key);
if (response != eDeviceRegistrationUnRegistrationResponse.Success)
{
//Debug.Console(0, this, "ERROR: Cannot register Crestron device: {0}", response);
//Debug.LogMessage(LogEventLevel.Information, this, "ERROR: Cannot register Crestron device: {0}", response);
return false;
}
}
@@ -144,7 +142,7 @@ namespace PepperDash.Essentials.Core
void Hardware_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
{
Debug.Console(2, this, "OnlineStatusChange Event. Online = {0}", args.DeviceOnLine);
Debug.LogMessage(LogEventLevel.Verbose, this, "OnlineStatusChange Event. Online = {0}", args.DeviceOnLine);
if (!Hardware.Registered)
{
@@ -201,12 +199,11 @@ namespace PepperDash.Essentials.Core
public static eDeviceRegistrationUnRegistrationResponse RegisterWithLogging(this GenericBase device, string key)
{
var result = device.Register();
var level = result == eDeviceRegistrationUnRegistrationResponse.Success ?
Debug.ErrorLogLevel.Notice : Debug.ErrorLogLevel.Error;
Debug.Console(0, level, "Register device result: '{0}', type '{1}', result {2}", key, device, result);
Debug.LogMessage(LogEventLevel.Information, "Register device result: '{0}', type '{1}', result {2}", key, device, result);
//if (result != eDeviceRegistrationUnRegistrationResponse.Success)
//{
// Debug.Console(0, Debug.ErrorLogLevel.Error, "Cannot register device '{0}': {1}", key, result);
// Debug.LogMessage(LogEventLevel.Information, "Cannot register device '{0}': {1}", key, result);
//}
return result;
}

View File

@@ -38,16 +38,16 @@ namespace PepperDash.Essentials.Core
/// </summary>
public override bool CustomActivate()
{
Debug.Console(0, this, "Activating");
Debug.LogMessage(LogEventLevel.Information, this, "Activating");
var response = Hardware.RegisterWithLogging(Key);
if (response != eDeviceRegistrationUnRegistrationResponse.Success)
{
<<<<<<< HEAD
Debug.Console(0, this, "ERROR: Cannot register Crestron device: {0}", response);
Debug.LogMessage(LogEventLevel.Information, this, "ERROR: Cannot register Crestron device: {0}", response);
return false;
}
=======
Debug.Console(0, this, "ERROR: Cannot register Crestron device: {0}", response);
Debug.LogMessage(LogEventLevel.Information, this, "ERROR: Cannot register Crestron device: {0}", response);
return false;
}
>>>>>>> origin/feature/ecs-342-neil
@@ -119,7 +119,7 @@ namespace PepperDash.Essentials.Core
var result = device.Register();
if (result != eDeviceRegistrationUnRegistrationResponse.Success)
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Cannot register device '{0}': {1}", key, result);
Debug.LogMessage(LogEventLevel.Information, "Cannot register device '{0}': {1}", key, result);
}
return result;
}

View File

@@ -1,4 +1,4 @@
extern alias Full;

using System;
using System.Collections.Generic;
@@ -7,10 +7,11 @@ using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Full.Newtonsoft.Json;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
using Serilog.Events;
namespace PepperDash.Essentials.Core.CrestronIO
@@ -67,7 +68,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
{
if (!Global.ControlSystem.SupportsDigitalInput)
{
Debug.Console(0, "GetDigitalInput: Processor does not support Digital Inputs");
Debug.LogMessage(LogEventLevel.Information, "GetDigitalInput: Processor does not support Digital Inputs");
return null;
}
ioPortDevice = Global.ControlSystem;
@@ -77,20 +78,20 @@ namespace PepperDash.Essentials.Core.CrestronIO
var ioPortDev = DeviceManager.GetDeviceForKey(dc.PortDeviceKey) as IDigitalInputPorts;
if (ioPortDev == null)
{
Debug.Console(0, "GetDigitalInput: Device {0} is not a valid device", dc.PortDeviceKey);
Debug.LogMessage(LogEventLevel.Information, "GetDigitalInput: Device {0} is not a valid device", dc.PortDeviceKey);
return null;
}
ioPortDevice = ioPortDev;
}
if (ioPortDevice == null)
{
Debug.Console(0, "GetDigitalInput: Device '0' is not a valid IDigitalInputPorts Device", dc.PortDeviceKey);
Debug.LogMessage(LogEventLevel.Information, "GetDigitalInput: Device '0' is not a valid IDigitalInputPorts Device", dc.PortDeviceKey);
return null;
}
if (dc.PortNumber > ioPortDevice.NumberOfDigitalInputPorts)
{
Debug.Console(0, "GetDigitalInput: Device {0} does not contain a port {1}", dc.PortDeviceKey, dc.PortNumber);
Debug.LogMessage(LogEventLevel.Information, "GetDigitalInput: Device {0} does not contain a port {1}", dc.PortDeviceKey, dc.PortNumber);
}
return ioPortDevice.DigitalInputPorts[dc.PortNumber];
@@ -117,20 +118,20 @@ namespace PepperDash.Essentials.Core.CrestronIO
}
else
{
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
Debug.LogMessage(LogEventLevel.Information, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
try
{
Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.LogMessage(LogEventLevel.Debug, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
// Link feedback for input state
InputStateFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputState.JoinNumber]);
}
catch (Exception e)
{
Debug.Console(1, this, "Unable to link device '{0}'. Input is null", Key);
Debug.Console(1, this, "Error: {0}", e);
Debug.LogMessage(LogEventLevel.Debug, this, "Unable to link device '{0}'. Input is null", Key);
Debug.LogMessage(LogEventLevel.Debug, this, "Error: {0}", e);
}
}
@@ -147,7 +148,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new Generic Digital Input Device");
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Generic Digital Input Device");
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());

View File

@@ -1,4 +1,4 @@
extern alias Full;

using System;
using System.Collections.Generic;
@@ -7,10 +7,11 @@ using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Full.Newtonsoft.Json;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
using Serilog.Events;
namespace PepperDash.Essentials.Core.CrestronIO
{
@@ -48,7 +49,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
if (RelayOutput == null)
{
Debug.Console(0, this, Debug.ErrorLogLevel.Error, "Unable to get parent relay device for device key {0} and port {1}", config.PortDeviceKey, config.PortNumber);
Debug.LogMessage(LogEventLevel.Information, this, "Unable to get parent relay device for device key {0} and port {1}", config.PortDeviceKey, config.PortNumber);
return;
}
@@ -69,7 +70,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
{
if (!Global.ControlSystem.SupportsRelay)
{
Debug.Console(0, "Processor does not support relays");
Debug.LogMessage(LogEventLevel.Information, "Processor does not support relays");
return null;
}
relayDevice = Global.ControlSystem;
@@ -80,7 +81,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
var essentialsDevice = DeviceManager.GetDeviceForKey(dc.PortDeviceKey);
if (essentialsDevice == null)
{
Debug.Console(0, "Device {0} was not found in Device Manager. Check configuration or for errors with device.", dc.PortDeviceKey);
Debug.LogMessage(LogEventLevel.Information, "Device {0} was not found in Device Manager. Check configuration or for errors with device.", dc.PortDeviceKey);
return null;
}
@@ -88,7 +89,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
if (relayDevice == null)
{
Debug.Console(0, "Device {0} is not a valid relay parent. Please check configuration.", dc.PortDeviceKey);
Debug.LogMessage(LogEventLevel.Information, "Device {0} is not a valid relay parent. Please check configuration.", dc.PortDeviceKey);
return null;
}
@@ -97,7 +98,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
return relayDevice.RelayPorts[dc.PortNumber];
}
Debug.Console(0, "Device {0} does not contain a port {1}", dc.PortDeviceKey, dc.PortNumber);
Debug.LogMessage(LogEventLevel.Information, "Device {0} does not contain a port {1}", dc.PortDeviceKey, dc.PortNumber);
return null;
}
@@ -165,16 +166,16 @@ namespace PepperDash.Essentials.Core.CrestronIO
}
else
{
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
Debug.LogMessage(LogEventLevel.Information, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
if (RelayOutput == null)
{
Debug.Console(1, this, "Unable to link device '{0}'. Relay is null", Key);
Debug.LogMessage(LogEventLevel.Debug, this, "Unable to link device '{0}'. Relay is null", Key);
return;
}
Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.LogMessage(LogEventLevel.Debug, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
trilist.SetBoolSigAction(joinMap.Relay.JoinNumber, b =>
{
@@ -202,7 +203,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new Generic Relay Device");
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Generic Relay Device");
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());

View File

@@ -1,4 +1,4 @@
extern alias Full;

using System;
using System.Collections.Generic;
@@ -13,7 +13,8 @@ using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Bridges;
using Full.Newtonsoft.Json;
using Newtonsoft.Json;
using Serilog.Events;
namespace PepperDash.Essentials.Core.CrestronIO
{
@@ -59,7 +60,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
InputPort.VersiportChange += InputPort_VersiportChange;
Debug.Console(1, this, "Created GenericVersiportAnalogInputDevice on port '{0}'. DisablePullUpResistor: '{1}'", config.PortNumber, InputPort.DisablePullUpResistor);
Debug.LogMessage(LogEventLevel.Debug, this, "Created GenericVersiportAnalogInputDevice on port '{0}'. DisablePullUpResistor: '{1}'", config.PortNumber, InputPort.DisablePullUpResistor);
});
@@ -76,7 +77,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
void InputPort_VersiportChange(Versiport port, VersiportEventArgs args)
{
Debug.Console(1, this, "Versiport change: {0}", args.Event);
Debug.LogMessage(LogEventLevel.Debug, this, "Versiport change: {0}", args.Event);
if(args.Event == eVersiportEvent.AnalogInChange)
InputValueFeedback.FireUpdate();
@@ -102,12 +103,12 @@ namespace PepperDash.Essentials.Core.CrestronIO
}
else
{
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
Debug.LogMessage(LogEventLevel.Information, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
try
{
Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.LogMessage(LogEventLevel.Debug, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
// Link feedback for input state
InputValueFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputValue.JoinNumber]);
@@ -117,8 +118,8 @@ namespace PepperDash.Essentials.Core.CrestronIO
}
catch (Exception e)
{
Debug.Console(1, this, "Unable to link device '{0}'. Input is null", Key);
Debug.Console(1, this, "Error: {0}", e);
Debug.LogMessage(LogEventLevel.Debug, this, "Unable to link device '{0}'. Input is null", Key);
Debug.LogMessage(LogEventLevel.Debug, this, "Error: {0}", e);
}
trilist.OnlineStatusChange += (d, args) =>
@@ -147,7 +148,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
{
if (!Global.ControlSystem.SupportsVersiport)
{
Debug.Console(0, "GetVersiportAnalogInput: Processor does not support Versiports");
Debug.LogMessage(LogEventLevel.Information, "GetVersiportAnalogInput: Processor does not support Versiports");
return null;
}
ioPortDevice = Global.ControlSystem;
@@ -157,25 +158,25 @@ namespace PepperDash.Essentials.Core.CrestronIO
var ioPortDev = DeviceManager.GetDeviceForKey(dc.PortDeviceKey) as IIOPorts;
if (ioPortDev == null)
{
Debug.Console(0, "GetVersiportAnalogInput: Device {0} is not a valid device", dc.PortDeviceKey);
Debug.LogMessage(LogEventLevel.Information, "GetVersiportAnalogInput: Device {0} is not a valid device", dc.PortDeviceKey);
return null;
}
ioPortDevice = ioPortDev;
}
if (ioPortDevice == null)
{
Debug.Console(0, "GetVersiportAnalogInput: Device '0' is not a valid IIOPorts Device", dc.PortDeviceKey);
Debug.LogMessage(LogEventLevel.Information, "GetVersiportAnalogInput: Device '0' is not a valid IIOPorts Device", dc.PortDeviceKey);
return null;
}
if (dc.PortNumber > ioPortDevice.NumberOfVersiPorts)
{
Debug.Console(0, "GetVersiportAnalogInput: Device {0} does not contain a port {1}", dc.PortDeviceKey, dc.PortNumber);
Debug.LogMessage(LogEventLevel.Information, "GetVersiportAnalogInput: Device {0} does not contain a port {1}", dc.PortDeviceKey, dc.PortNumber);
return null;
}
if(!ioPortDevice.VersiPorts[dc.PortNumber].SupportsAnalogInput)
{
Debug.Console(0, "GetVersiportAnalogInput: Device {0} does not support AnalogInput on port {1}", dc.PortDeviceKey, dc.PortNumber);
Debug.LogMessage(LogEventLevel.Information, "GetVersiportAnalogInput: Device {0} does not support AnalogInput on port {1}", dc.PortDeviceKey, dc.PortNumber);
return null;
}
@@ -196,7 +197,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new Generic Versiport Device");
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Generic Versiport Device");
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());

View File

@@ -1,4 +1,4 @@
extern alias Full;

using System;
using System.Collections.Generic;
@@ -13,7 +13,8 @@ using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Bridges;
using Full.Newtonsoft.Json;
using Newtonsoft.Json;
using Serilog.Events;
namespace PepperDash.Essentials.Core.CrestronIO
{
@@ -53,7 +54,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
Debug.Console(1, this, "Created GenericVersiportDigitalInputDevice on port '{0}'. DisablePullUpResistor: '{1}'", config.PortNumber, InputPort.DisablePullUpResistor);
Debug.LogMessage(LogEventLevel.Debug, this, "Created GenericVersiportDigitalInputDevice on port '{0}'. DisablePullUpResistor: '{1}'", config.PortNumber, InputPort.DisablePullUpResistor);
});
@@ -61,7 +62,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
void InputPort_VersiportChange(Versiport port, VersiportEventArgs args)
{
Debug.Console(1, this, "Versiport change: {0}", args.Event);
Debug.LogMessage(LogEventLevel.Debug, this, "Versiport change: {0}", args.Event);
if(args.Event == eVersiportEvent.DigitalInChange)
InputStateFeedback.FireUpdate();
@@ -85,20 +86,20 @@ namespace PepperDash.Essentials.Core.CrestronIO
}
else
{
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
Debug.LogMessage(LogEventLevel.Information, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
try
{
Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.LogMessage(LogEventLevel.Debug, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
// Link feedback for input state
InputStateFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputState.JoinNumber]);
}
catch (Exception e)
{
Debug.Console(1, this, "Unable to link device '{0}'. Input is null", Key);
Debug.Console(1, this, "Error: {0}", e);
Debug.LogMessage(LogEventLevel.Debug, this, "Unable to link device '{0}'. Input is null", Key);
Debug.LogMessage(LogEventLevel.Debug, this, "Error: {0}", e);
}
}
@@ -114,7 +115,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
{
if (!Global.ControlSystem.SupportsVersiport)
{
Debug.Console(0, "GetVersiportDigitalInput: Processor does not support Versiports");
Debug.LogMessage(LogEventLevel.Information, "GetVersiportDigitalInput: Processor does not support Versiports");
return null;
}
ioPortDevice = Global.ControlSystem;
@@ -124,20 +125,20 @@ namespace PepperDash.Essentials.Core.CrestronIO
var ioPortDev = DeviceManager.GetDeviceForKey(dc.PortDeviceKey) as IIOPorts;
if (ioPortDev == null)
{
Debug.Console(0, "GetVersiportDigitalInput: Device {0} is not a valid device", dc.PortDeviceKey);
Debug.LogMessage(LogEventLevel.Information, "GetVersiportDigitalInput: Device {0} is not a valid device", dc.PortDeviceKey);
return null;
}
ioPortDevice = ioPortDev;
}
if (ioPortDevice == null)
{
Debug.Console(0, "GetVersiportDigitalInput: Device '0' is not a valid IIOPorts Device", dc.PortDeviceKey);
Debug.LogMessage(LogEventLevel.Information, "GetVersiportDigitalInput: Device '0' is not a valid IIOPorts Device", dc.PortDeviceKey);
return null;
}
if (dc.PortNumber > ioPortDevice.NumberOfVersiPorts)
{
Debug.Console(0, "GetVersiportDigitalInput: Device {0} does not contain a port {1}", dc.PortDeviceKey, dc.PortNumber);
Debug.LogMessage(LogEventLevel.Information, "GetVersiportDigitalInput: Device {0} does not contain a port {1}", dc.PortDeviceKey, dc.PortNumber);
}
return ioPortDevice.VersiPorts[dc.PortNumber];
@@ -156,7 +157,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new Generic Versiport Device");
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Generic Versiport Device");
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());

View File

@@ -1,4 +1,4 @@
extern alias Full;

using System;
using System.Collections.Generic;
@@ -13,7 +13,8 @@ using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Bridges;
using Full.Newtonsoft.Json;
using Newtonsoft.Json;
using Serilog.Events;
namespace PepperDash.Essentials.Core.CrestronIO
{
@@ -48,7 +49,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
if (!OutputPort.SupportsDigitalOutput)
{
Debug.Console(0, this, "Device does not support configuration as a Digital Output");
Debug.LogMessage(LogEventLevel.Information, this, "Device does not support configuration as a Digital Output");
return;
}
@@ -63,7 +64,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
void OutputPort_VersiportChange(Versiport port, VersiportEventArgs args)
{
Debug.Console(1, this, "Versiport change: {0}", args.Event);
Debug.LogMessage(LogEventLevel.Debug, this, "Versiport change: {0}", args.Event);
if(args.Event == eVersiportEvent.DigitalOutChange)
OutputStateFeedback.FireUpdate();
@@ -77,14 +78,14 @@ namespace PepperDash.Essentials.Core.CrestronIO
{
if (OutputPort.SupportsDigitalOutput)
{
Debug.Console(0, this, "Passed the Check");
Debug.LogMessage(LogEventLevel.Information, this, "Passed the Check");
OutputPort.DigitalOut = state;
}
else
{
Debug.Console(0, this, "Versiport does not support Digital Output Mode");
Debug.LogMessage(LogEventLevel.Information, this, "Versiport does not support Digital Output Mode");
}
}
@@ -106,12 +107,12 @@ namespace PepperDash.Essentials.Core.CrestronIO
}
else
{
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
Debug.LogMessage(LogEventLevel.Information, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
try
{
Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.LogMessage(LogEventLevel.Debug, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
// Link feedback for input state
OutputStateFeedback.LinkInputSig(trilist.BooleanInput[joinMap.OutputState.JoinNumber]);
@@ -119,8 +120,8 @@ namespace PepperDash.Essentials.Core.CrestronIO
}
catch (Exception e)
{
Debug.Console(1, this, "Unable to link device '{0}'. Input is null", Key);
Debug.Console(1, this, "Error: {0}", e);
Debug.LogMessage(LogEventLevel.Debug, this, "Unable to link device '{0}'. Input is null", Key);
Debug.LogMessage(LogEventLevel.Debug, this, "Error: {0}", e);
}
}
@@ -136,7 +137,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
{
if (!Global.ControlSystem.SupportsVersiport)
{
Debug.Console(0, "GetVersiportDigitalOuptut: Processor does not support Versiports");
Debug.LogMessage(LogEventLevel.Information, "GetVersiportDigitalOuptut: Processor does not support Versiports");
return null;
}
ioPortDevice = Global.ControlSystem;
@@ -146,20 +147,20 @@ namespace PepperDash.Essentials.Core.CrestronIO
var ioPortDev = DeviceManager.GetDeviceForKey(dc.PortDeviceKey) as IIOPorts;
if (ioPortDev == null)
{
Debug.Console(0, "GetVersiportDigitalOuptut: Device {0} is not a valid device", dc.PortDeviceKey);
Debug.LogMessage(LogEventLevel.Information, "GetVersiportDigitalOuptut: Device {0} is not a valid device", dc.PortDeviceKey);
return null;
}
ioPortDevice = ioPortDev;
}
if (ioPortDevice == null)
{
Debug.Console(0, "GetVersiportDigitalOuptut: Device '0' is not a valid IOPorts Device", dc.PortDeviceKey);
Debug.LogMessage(LogEventLevel.Information, "GetVersiportDigitalOuptut: Device '0' is not a valid IOPorts Device", dc.PortDeviceKey);
return null;
}
if (dc.PortNumber > ioPortDevice.NumberOfVersiPorts)
{
Debug.Console(0, "GetVersiportDigitalOuptut: Device {0} does not contain a port {1}", dc.PortDeviceKey, dc.PortNumber);
Debug.LogMessage(LogEventLevel.Information, "GetVersiportDigitalOuptut: Device {0} does not contain a port {1}", dc.PortDeviceKey, dc.PortNumber);
}
var port = ioPortDevice.VersiPorts[dc.PortNumber];
return port;
@@ -177,7 +178,7 @@ namespace PepperDash.Essentials.Core.CrestronIO
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new Generic Versiport Device");
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Generic Versiport Device");
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());

View File

@@ -1,11 +1,11 @@
extern alias Full;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Full.Newtonsoft.Json;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Core.CrestronIO
{

View File

@@ -4,6 +4,7 @@ using System.Linq;
using PepperDash.Core;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
using Serilog.Events;
namespace PepperDash.Essentials.Core.DeviceInfo
{
@@ -48,7 +49,7 @@ namespace PepperDash.Essentials.Core.DeviceInfo
}
ArpTable.Clear();
Debug.Console(2, "ConsoleResponse of 'showarptable' : {0}{1}", NewLine, consoleResponse);
Debug.LogMessage(LogEventLevel.Verbose, "ConsoleResponse of 'showarptable' : {0}{1}", NewLine, consoleResponse);
var myLines =
consoleResponse.Split(NewLineSplitter)
@@ -68,7 +69,7 @@ namespace PepperDash.Essentials.Core.DeviceInfo
}
catch (Exception ex)
{
Debug.Console(0, "Exception in \"RefreshArp\" : {0}", ex.Message);
Debug.LogMessage(LogEventLevel.Information, "Exception in \"RefreshArp\" : {0}", ex.Message);
error = true;
}
finally
@@ -106,7 +107,7 @@ namespace PepperDash.Essentials.Core.DeviceInfo
}
catch (Exception ex)
{
Debug.Console(0, "Unable to Santize Ip : {0}", ex.Message);
Debug.LogMessage(LogEventLevel.Information, "Unable to Santize Ip : {0}", ex.Message);
return ipAddressIn;
}
}
@@ -126,7 +127,7 @@ namespace PepperDash.Essentials.Core.DeviceInfo
}
catch (Exception ex)
{
Debug.Console(0, "Exception Resolving Hostname from IP Address : {0}", ex.Message);
Debug.LogMessage(LogEventLevel.Information, "Exception Resolving Hostname from IP Address : {0}", ex.Message);
return ipAddress;
}
}
@@ -145,7 +146,7 @@ namespace PepperDash.Essentials.Core.DeviceInfo
}
catch (Exception ex)
{
Debug.Console(0, "Exception Resolving IP Address from Hostname : {0}", ex.Message);
Debug.LogMessage(LogEventLevel.Information, "Exception Resolving IP Address from Hostname : {0}", ex.Message);
return hostName;
}
}

View File

@@ -7,14 +7,4 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
bool BrandingEnabled { get; }
void InitializeBranding(string roomKey);
}
}
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
{
[Obsolete("Use PepperDash.Essentials.Core.DeviceTypeInterfaces")]
public interface IHasBranding
{
bool BrandingEnabled { get; }
void InitializeBranding(string roomKey);
}
}

View File

@@ -0,0 +1,24 @@
using PepperDash.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
{
/// <summary>
/// Describes a device that has selectable inputs
/// </summary>
/// <typeparam name="TKey">the type to use as the key for each input item. Most likely an enum or string</typeparam>\
/// <example>
/// See MockDisplay for example implemntation
/// </example>
public interface IHasInputs<TKey, TSelector>: IKeyName
{
ISelectableItems<TKey> Inputs { get; }
void SetInput(TSelector selector);
}
}

View File

@@ -12,18 +12,4 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
void EndPhoneCall();
void SendDtmfToPhone(string digit);
}
}
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
{
[Obsolete("Use PepperDash.Essentials.Core.DeviceTypeInterfaces")]
public interface IHasPhoneDialing
{
BoolFeedback PhoneOffHookFeedback { get; }
StringFeedback CallerIdNameFeedback { get; }
StringFeedback CallerIdNumberFeedback { get; }
void DialPhoneCall(string number);
void EndPhoneCall();
void SendDtmfToPhone(string digit);
}
}

View File

@@ -0,0 +1,20 @@
using PepperDash.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
{
/// <summary>
/// Describes a device that has selectable surround sound modes
/// </summary>
/// <typeparam name="TKey">the type to use as the key for each input item. Most likely an enum or string</typeparam>
public interface IHasSurroundSoundModes<TKey, TSelector>: IKeyName
{
ISelectableItems<TKey> SurroundSoundModes { get; }
void SetSurroundSoundMode(TSelector selector);
}
}

View File

@@ -16,20 +16,3 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
List<LanguageLabel> RoomNames { get; set; }
}
}
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
{
[Obsolete("Use PepperDash.Essentials.Core.DeviceTypeInterfaces")]
public interface ILanguageDefinition
{
string LocaleName { get; set; }
string FriendlyName { get; set; }
bool Enable { get; set; }
List<LanguageLabel> UiLabels { get; set; }
List<LanguageLabel> Sources { get; set; }
List<LanguageLabel> Destinations { get; set; }
List<LanguageLabel> SourceGroupNames { get; set; }
List<LanguageLabel> DestinationGroupNames { get; set; }
List<LanguageLabel> RoomNames { get; set; }
}
}

View File

@@ -11,15 +11,3 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
}
}
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
{
[Obsolete("Use PepperDash.Essentials.Core.DeviceTypeInterfaces")]
public interface ILanguageProvider
{
ILanguageDefinition CurrentLanguage { get; set; }
event EventHandler CurrentLanguageChanged;
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
{
public interface ILevelControls
{
Dictionary<string, IBasicVolumeWithFeedback> LevelControlPoints { get; }
}
}

View File

@@ -1,9 +1,18 @@
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
{
/// <summary>
/// Use this interface on a device or room if it uses custom Mobile Control messengers
/// </summary>
public interface ICustomMobileControl : IKeyed
{
}
/*/// <summary>
/// Describes a MobileControlSystemController
/// </summary>
public interface IMobileControl : IKeyed
@@ -11,20 +20,61 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
void CreateMobileControlRoomBridge(IEssentialsRoom room, IMobileControl parent);
void LinkSystemMonitorToAppServer();
}
}*/
/// <summary>
/// Describes a MobileSystemController that accepts IEssentialsRoom
/// </summary>
public interface IMobileControl3 : IMobileControl
public interface IMobileControl : IKeyed
{
void CreateMobileControlRoomBridge(IEssentialsRoom room, IMobileControl parent);
string Host { get; }
string ClientAppUrl { get; }
string SystemUuid { get; }
BoolFeedback ApiOnlineAndAuthorized { get;}
void SendMessageObject(IMobileControlMessage o);
void AddAction<T>(T messenger, Action<string, string, JToken> action) where T:IMobileControlMessenger;
void RemoveAction(string key);
void AddDeviceMessenger(IMobileControlMessenger messenger);
bool CheckForDeviceMessenger(string key);
}
/// <summary>
/// Describes a mobile control messenger
/// </summary>
public interface IMobileControlMessenger: IKeyed
{
IMobileControl AppServerController { get; }
string MessagePath { get; }
string DeviceKey { get; }
void RegisterWithAppServer(IMobileControl appServerController);
}
public interface IMobileControlMessage
{
[JsonProperty("type")]
string Type { get; }
[JsonProperty("clientId", NullValueHandling = NullValueHandling.Ignore)]
string ClientId { get; }
[JsonProperty("content", NullValueHandling = NullValueHandling.Ignore)]
JToken Content { get; }
}
/// <summary>
/// Describes a MobileControl Room Bridge
/// </summary>
public interface IMobileControlRoomBridge : IKeyed
public interface IMobileControlRoomMessenger : IKeyed
{
event EventHandler<EventArgs> UserCodeChanged;
@@ -32,6 +82,8 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
event EventHandler<EventArgs> ClientJoined;
event EventHandler<EventArgs> AppUrlChanged;
string UserCode { get; }
string QrCodeUrl { get; }
@@ -41,5 +93,17 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
string McServerUrl { get; }
string RoomName { get; }
string AppUrl { get; }
void UpdateAppUrl(string url);
}
public interface IMobileControlAction
{
IMobileControlMessenger Messenger { get; }
Action<string,string, JToken> Action { get; }
}
}

View File

@@ -13,17 +13,6 @@ using PepperDash.Essentials.Core.SmartObjects;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// Defines the ability to power a device on and off
/// </summary>
[Obsolete("Will be replaced by IHasPowerControlWithFeedback")]
public interface IPower
{
void PowerOn();
void PowerOff();
void PowerToggle();
BoolFeedback PowerIsOnFeedback { get; }
}
/// <summary>
/// Adds feedback for current power state

View File

@@ -0,0 +1,19 @@
using System;
using Newtonsoft.Json;
using PepperDash.Core;
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
{
/// <summary>
/// Describes an item that can be selected
/// </summary>
public interface ISelectableItem : IKeyName
{
event EventHandler ItemUpdated;
[JsonProperty("isSelected")]
bool IsSelected { get; set; }
void Select();
}
}

View File

@@ -0,0 +1,22 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
{
/// <summary>
/// Describes a collection of items that can be selected
/// </summary>
/// <typeparam name="TKey">type for the keys in the collection. Probably a string or enum</typeparam>
public interface ISelectableItems<TKey>
{
event EventHandler ItemsUpdated;
event EventHandler CurrentItemChanged;
[JsonProperty("items")]
Dictionary<TKey, ISelectableItem> Items { get; set; }
[JsonProperty("currentItem")]
string CurrentItem { get; set; }
}
}

View File

@@ -10,16 +10,4 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
public string DisplayText { get; set; }
public uint JoinNumber { get; set; }
}
}
namespace PepperDash_Essentials_Core.DeviceTypeInterfaces
{
[Obsolete("Use PepperDash.Essentials.Core.DeviceTypeInterfaces")]
public class LanguageLabel
{
public string Key { get; set; }
public string Description { get; set; }
public string DisplayText { get; set; }
public uint JoinNumber { get; set; }
}
}

View File

@@ -6,6 +6,7 @@ using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core.CrestronIO;
using Serilog.Events;
namespace PepperDash.Essentials.Core.Devices
{
@@ -45,7 +46,7 @@ namespace PepperDash.Essentials.Core.Devices
}
catch (Exception e)
{
Debug.Console(1, this, "Error Getting Relays from processor:\n '{0}'", e);
Debug.LogMessage(LogEventLevel.Debug, this, "Error Getting Relays from processor:\n '{0}'", e);
}
}
}

View File

@@ -1,6 +1,6 @@
extern alias Full;
using Full.Newtonsoft.Json;
using Newtonsoft.Json;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Core
@@ -52,5 +52,11 @@ namespace PepperDash.Essentials.Core
[JsonProperty("sinkType")]
public eRoutingSignalType SinkType { get; set; }
[JsonProperty("isCodecContentDestination")]
public bool isCodecContentDestination { get; set; }
[JsonProperty("isProgramAudioDestination")]
public bool isProgramAudioDestination { get; set; }
}
}

View File

@@ -1,4 +1,4 @@
extern alias Full;
using System;
using System.Collections;
@@ -7,9 +7,10 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharp.Reflection;
using Full.Newtonsoft.Json;
using Newtonsoft.Json;
using PepperDash.Core;
using Serilog.Events;
namespace PepperDash.Essentials.Core
@@ -147,7 +148,7 @@ namespace PepperDash.Essentials.Core
}
else
{
Debug.Console(1, "Unable to find Property: {0} on Device with path: {1}", propertyName, deviceObjectPath);
Debug.LogMessage(LogEventLevel.Debug, "Unable to find Property: {0} on Device with path: {1}", propertyName, deviceObjectPath);
return null;
}
}
@@ -198,7 +199,7 @@ namespace PepperDash.Essentials.Core
var dev = DeviceManager.GetDeviceForKey(path[0]);
if (dev == null)
{
Debug.Console(0, "Device {0} not found", path[0]);
Debug.LogMessage(LogEventLevel.Information, "Device {0} not found", path[0]);
return null;
}
@@ -216,20 +217,20 @@ namespace PepperDash.Essentials.Core
var indexClose = objName.IndexOf(']');
if (indexClose == -1)
{
Debug.Console(0, dev, "ERROR Unmatched index brackets");
Debug.LogMessage(LogEventLevel.Information, dev, "ERROR Unmatched index brackets");
return null;
}
// Get the index and strip quotes if any
indexStr = objName.Substring(indexOpen + 1, indexClose - indexOpen - 1).Replace("\"", "");
objName = objName.Substring(0, indexOpen);
Debug.Console(0, dev, " Checking for collection '{0}', index '{1}'", objName, indexStr);
Debug.LogMessage(LogEventLevel.Information, dev, " Checking for collection '{0}', index '{1}'", objName, indexStr);
}
CType oType = obj.GetType();
var prop = oType.GetProperty(objName);
if (prop == null)
{
Debug.Console(0, dev, "Property {0} not found on {1}", objName, path[i - 1]);
Debug.LogMessage(LogEventLevel.Information, dev, "Property {0} not found on {1}", objName, path[i - 1]);
return null;
}
// if there's an index, try to get the property
@@ -237,7 +238,7 @@ namespace PepperDash.Essentials.Core
{
if (!typeof(ICollection).IsAssignableFrom(prop.PropertyType))
{
Debug.Console(0, dev, "Property {0} is not collection", objName);
Debug.LogMessage(LogEventLevel.Information, dev, "Property {0} is not collection", objName);
return null;
}
var collection = prop.GetValue(obj, null) as ICollection;
@@ -247,7 +248,7 @@ namespace PepperDash.Essentials.Core
var indexParams = indexedPropInfo.GetIndexParameters();
if (indexParams.Length > 0)
{
Debug.Console(0, " Indexed, param type: {0}", indexParams[0].ParameterType.Name);
Debug.LogMessage(LogEventLevel.Information, " Indexed, param type: {0}", indexParams[0].ParameterType.Name);
var properParam = Convert.ChangeType(indexStr, indexParams[0].ParameterType,
System.Globalization.CultureInfo.InvariantCulture);
try
@@ -258,9 +259,9 @@ namespace PepperDash.Essentials.Core
catch (Crestron.SimplSharp.Reflection.TargetInvocationException e)
{
if (e.InnerException is ArgumentOutOfRangeException)
Debug.Console(0, " Index Out of range");
Debug.LogMessage(LogEventLevel.Information, " Index Out of range");
else if (e.InnerException is KeyNotFoundException)
Debug.Console(0, " Key not found");
Debug.LogMessage(LogEventLevel.Information, " Key not found");
return null;
}
}

View File

@@ -7,6 +7,7 @@ using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using PepperDash.Core;
using Serilog.Events;
namespace PepperDash.Essentials.Core
@@ -63,7 +64,7 @@ namespace PepperDash.Essentials.Core
DeviceCriticalSection.Enter();
AddDeviceEnabled = false;
// PreActivate all devices
Debug.Console(0,"****PreActivation starting...****");
Debug.LogMessage(LogEventLevel.Information,"****PreActivation starting...****");
foreach (var d in Devices.Values)
{
try
@@ -73,12 +74,12 @@ namespace PepperDash.Essentials.Core
}
catch (Exception e)
{
Debug.Console(0, d, "ERROR: Device {1} PreActivation failure: {0}", e.Message, d.Key);
Debug.Console(1, d, "Stack Trace: {0}", e.StackTrace);
Debug.LogMessage(LogEventLevel.Information, d, "ERROR: Device {1} PreActivation failure: {0}", e.Message, d.Key);
Debug.LogMessage(LogEventLevel.Debug, d, "Stack Trace: {0}", e.StackTrace);
}
}
Debug.Console(0, "****PreActivation complete****");
Debug.Console(0, "****Activation starting...****");
Debug.LogMessage(LogEventLevel.Information, "****PreActivation complete****");
Debug.LogMessage(LogEventLevel.Information, "****Activation starting...****");
// Activate all devices
foreach (var d in Devices.Values)
@@ -90,13 +91,13 @@ namespace PepperDash.Essentials.Core
}
catch (Exception e)
{
Debug.Console(0, d, "ERROR: Device {1} Activation failure: {0}", e.Message, d.Key);
Debug.Console(1, d, "Stack Trace: {0}", e.StackTrace);
Debug.LogMessage(LogEventLevel.Information, d, "ERROR: Device {1} Activation failure: {0}", e.Message, d.Key);
Debug.LogMessage(LogEventLevel.Debug, d, "Stack Trace: {0}", e.StackTrace);
}
}
Debug.Console(0, "****Activation complete****");
Debug.Console(0, "****PostActivation starting...****");
Debug.LogMessage(LogEventLevel.Information, "****Activation complete****");
Debug.LogMessage(LogEventLevel.Information, "****PostActivation starting...****");
// PostActivate all devices
foreach (var d in Devices.Values)
@@ -108,12 +109,12 @@ namespace PepperDash.Essentials.Core
}
catch (Exception e)
{
Debug.Console(0, d, "ERROR: Device {1} PostActivation failure: {0}", e.Message, d.Key);
Debug.Console(1, d, "Stack Trace: {0}", e.StackTrace);
Debug.LogMessage(LogEventLevel.Information, d, "ERROR: Device {1} PostActivation failure: {0}", e.Message, d.Key);
Debug.LogMessage(LogEventLevel.Debug, d, "Stack Trace: {0}", e.StackTrace);
}
}
Debug.Console(0, "****PostActivation complete****");
Debug.LogMessage(LogEventLevel.Information, "****PostActivation complete****");
OnAllDevicesActivated();
}
@@ -183,14 +184,14 @@ namespace PepperDash.Essentials.Core
private static void ListDevices(string s)
{
Debug.Console(0, "{0} Devices registered with Device Manager:", Devices.Count);
Debug.LogMessage(LogEventLevel.Information, "{0} Devices registered with Device Manager:", Devices.Count);
var sorted = Devices.Values.ToList();
sorted.Sort((a, b) => a.Key.CompareTo(b.Key));
foreach (var d in sorted)
{
var name = d is IKeyName ? (d as IKeyName).Name : "---";
Debug.Console(0, " [{0}] {1}", d.Key, name);
Debug.LogMessage(LogEventLevel.Information, " [{0}] {1}", d.Key, name);
}
}
@@ -199,13 +200,13 @@ namespace PepperDash.Essentials.Core
var dev = GetDeviceForKey(devKey);
if (dev == null)
{
Debug.Console(0, "Device '{0}' not found", devKey);
Debug.LogMessage(LogEventLevel.Information, "Device '{0}' not found", devKey);
return;
}
var statusDev = dev as IHasFeedback;
if (statusDev == null)
{
Debug.Console(0, "Device '{0}' does not have visible feedbacks", devKey);
Debug.LogMessage(LogEventLevel.Information, "Device '{0}' does not have visible feedbacks", devKey);
return;
}
statusDev.DumpFeedbacksToConsole(true);
@@ -216,10 +217,10 @@ namespace PepperDash.Essentials.Core
// var dev = GetDeviceForKey(devKey);
// if (dev == null)
// {
// Debug.Console(0, "Device '{0}' not found", devKey);
// Debug.LogMessage(LogEventLevel.Information, "Device '{0}' not found", devKey);
// return;
// }
// Debug.Console(0, "This needs to be reworked. Stay tuned.", devKey);
// Debug.LogMessage(LogEventLevel.Information, "This needs to be reworked. Stay tuned.", devKey);
//}
private static void ListDeviceCommStatuses(string input)
@@ -236,7 +237,7 @@ namespace PepperDash.Essentials.Core
//static void DoDeviceCommand(string command)
//{
// Debug.Console(0, "Not yet implemented. Stay tuned");
// Debug.LogMessage(LogEventLevel.Information, "Not yet implemented. Stay tuned");
//}
public static void AddDevice(IKeyed newDev)
@@ -245,7 +246,7 @@ namespace PepperDash.Essentials.Core
{
if (!DeviceCriticalSection.TryEnter())
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Currently unable to add devices to Device Manager. Please try again");
Debug.LogMessage(LogEventLevel.Information, "Currently unable to add devices to Device Manager. Please try again");
return;
}
// Check for device with same key
@@ -255,13 +256,13 @@ namespace PepperDash.Essentials.Core
if (!AddDeviceEnabled)
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "All devices have been activated. Adding new devices is not allowed.");
Debug.LogMessage(LogEventLevel.Information, "All devices have been activated. Adding new devices is not allowed.");
return;
}
if (Devices.ContainsKey(newDev.Key))
{
Debug.Console(0, newDev, "WARNING: A device with this key already exists. Not added to manager");
Debug.LogMessage(LogEventLevel.Information, newDev, "WARNING: A device with this key already exists. Not added to manager");
return;
}
Devices.Add(newDev.Key, newDev);
@@ -280,13 +281,13 @@ namespace PepperDash.Essentials.Core
{
if (!DeviceCriticalSection.TryEnter())
{
Debug.Console(0, Debug.ErrorLogLevel.Error,
Debug.LogMessage(LogEventLevel.Information,
"Currently unable to add devices to Device Manager. Please try again");
return;
}
if (!AddDeviceEnabled)
{
Debug.Console(0, Debug.ErrorLogLevel.Error,
Debug.LogMessage(LogEventLevel.Information,
"All devices have been activated. Adding new devices is not allowed.");
return;
}
@@ -299,7 +300,7 @@ namespace PepperDash.Essentials.Core
}
catch (ArgumentException ex)
{
Debug.Console(0, "Error adding device with key {0} to Device Manager: {1}\r\nStack Trace: {2}",
Debug.LogMessage(LogEventLevel.Information, "Error adding device with key {0} to Device Manager: {1}\r\nStack Trace: {2}",
dev.Key, ex.Message, ex.StackTrace);
}
}
@@ -322,7 +323,7 @@ namespace PepperDash.Essentials.Core
//if (_Devices.Contains(newDev))
// _Devices.Remove(newDev);
else
Debug.Console(0, "Device manager: Device '{0}' does not exist in manager. Cannot remove", newDev.Key);
Debug.LogMessage(LogEventLevel.Information, "Device manager: Device '{0}' does not exist in manager. Cannot remove", newDev.Key);
}
finally
{
@@ -364,7 +365,7 @@ namespace PepperDash.Essentials.Core
CrestronConsole.ConsoleCommandResponse(" Format: devsimreceive:P <device key> <string to send>");
return;
}
//Debug.Console(2, "**** {0} - {1} ****", match.Groups[1].Value, match.Groups[2].Value);
//Debug.LogMessage(LogEventLevel.Verbose, "**** {0} - {1} ****", match.Groups[1].Value, match.Groups[2].Value);
var com = GetDeviceForKey(match.Groups[1].Value) as ComPortController;
if (com == null)

View File

@@ -7,6 +7,7 @@ using Crestron.SimplSharp.Reflection;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
using Serilog.Events;
namespace PepperDash.Essentials.Core
{
@@ -43,11 +44,25 @@ namespace PepperDash.Essentials.Core
}
catch (Exception ex)
{
Debug.Console(0, this, Debug.ErrorLogLevel.Error, "Exception initializing device: {0}", ex.Message);
Debug.Console(1, this, Debug.ErrorLogLevel.Error, "Stack Trace: {0}", ex.StackTrace);
Debug.LogMessage(LogEventLevel.Error, this, "Exception initializing device: {0}", ex.Message);
Debug.LogMessage(LogEventLevel.Debug, this, "Stack Trace: {0}", ex.StackTrace);
}
});
}
public override bool CustomActivate()
{
CreateMobileControlMessengers();
return base.CustomActivate();
}
/// <summary>
/// Override this method to build and create custom Mobile Control Messengers during the Activation phase
/// </summary>
protected virtual void CreateMobileControlMessengers() {
}
}
[AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = true)]
@@ -57,7 +72,7 @@ namespace PepperDash.Essentials.Core
public DescriptionAttribute(string description)
{
//Debug.Console(2, "Setting Description: {0}", description);
//Debug.LogMessage(LogEventLevel.Verbose, "Setting Description: {0}", description);
_Description = description;
}
@@ -74,7 +89,7 @@ namespace PepperDash.Essentials.Core
public ConfigSnippetAttribute(string configSnippet)
{
//Debug.Console(2, "Setting Config Snippet {0}", configSnippet);
//Debug.LogMessage(LogEventLevel.Verbose, "Setting Config Snippet {0}", configSnippet);
_ConfigSnippet = configSnippet;
}
@@ -103,7 +118,7 @@ namespace PepperDash.Essentials.Core
{
foreach (var typeName in TypeNames)
{
//Debug.Console(2, "Getting Description Attribute from class: '{0}'", typeof(T).FullName);
//Debug.LogMessage(LogEventLevel.Verbose, "Getting Description Attribute from class: '{0}'", typeof(T).FullName);
var descriptionAttribute = typeof(T).GetCustomAttributes(typeof(DescriptionAttribute), true) as DescriptionAttribute[];
string description = descriptionAttribute[0].Description;
var snippetAttribute = typeof(T).GetCustomAttributes(typeof(ConfigSnippetAttribute), true) as ConfigSnippetAttribute[];
@@ -137,7 +152,7 @@ namespace PepperDash.Essentials.Core
{
foreach (var typeName in TypeNames)
{
//Debug.Console(2, "Getting Description Attribute from class: '{0}'", typeof(T).FullName);
//Debug.LogMessage(LogEventLevel.Verbose, "Getting Description Attribute from class: '{0}'", typeof(T).FullName);
var descriptionAttribute = typeof(T).GetCustomAttributes(typeof(DescriptionAttribute), true) as DescriptionAttribute[];
string description = descriptionAttribute[0].Description;
var snippetAttribute = typeof(T).GetCustomAttributes(typeof(ConfigSnippetAttribute), true) as ConfigSnippetAttribute[];

View File

@@ -1,14 +1,15 @@
extern alias Full;
using System;
using System.Collections.Generic;
using System.Linq;
using Crestron.SimplSharpPro.DeviceSupport;
using Full.Newtonsoft.Json;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
using PepperDash_Essentials_Core.Bridges.JoinMaps;
using PepperDash.Essentials.Core.Bridges.JoinMaps;
using Serilog.Events;
namespace PepperDash.Essentials.Core.Devices
{
@@ -29,7 +30,7 @@ namespace PepperDash.Essentials.Core.Devices
_port = irPort;
if (_port == null)
{
Debug.Console(0, this, Debug.ErrorLogLevel.Error, "IR Port is null, device will not function");
Debug.LogMessage(LogEventLevel.Information, this, "IR Port is null, device will not function");
return;
}
DeviceManager.AddDevice(_port);
@@ -75,12 +76,12 @@ namespace PepperDash.Essentials.Core.Devices
if (_port.UseBridgeJoinMap)
{
Debug.Console(0, this, "Using new IR bridge join map");
Debug.LogMessage(LogEventLevel.Information, this, "Using new IR bridge join map");
var bridgeJoins = joinMap.Joins.Where((kv) => _port.IrFileCommands.Any(cmd => cmd == kv.Key)).ToDictionary(kv => kv.Key);
if (bridgeJoins == null)
{
Debug.Console(0, this, Debug.ErrorLogLevel.Error, "Failed to link new IR bridge join map");
Debug.LogMessage(LogEventLevel.Information, this, "Failed to link new IR bridge join map");
return;
}
@@ -93,7 +94,7 @@ namespace PepperDash.Essentials.Core.Devices
var joinDataValue = bridgeJoin.Value.Value;
var joinNumber = bridgeJoin.Value.Value.JoinNumber;
Debug.Console(2, this, @"bridgeJoin: Key-'{0}'
Debug.LogMessage(LogEventLevel.Verbose, this, @"bridgeJoin: Key-'{0}'
Value.Key-'{1}'
Value.JoinNumber-'{2}'
Value.Metadata.Description-'{3}'",
@@ -110,7 +111,7 @@ Value.Metadata.Description-'{3}'",
}
else
{
Debug.Console(0, this, "Using legacy IR join mapping based on available IR commands");
Debug.LogMessage(LogEventLevel.Information, this, "Using legacy IR join mapping based on available IR commands");
joinMap.Joins.Clear();
@@ -141,7 +142,7 @@ Value.Metadata.Description-'{3}'",
}
else
{
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
Debug.LogMessage(LogEventLevel.Information, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
}
@@ -163,7 +164,7 @@ Value.Metadata.Description-'{3}'",
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new Generic IR Controller Device");
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Generic IR Controller Device");
var irPort = IRPortHelper.GetIrOutputPortController(dc);

View File

@@ -5,6 +5,7 @@ using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using Serilog.Events;
namespace PepperDash.Essentials.Core.Devices
@@ -25,7 +26,7 @@ namespace PepperDash.Essentials.Core.Devices
// ------------------------------------------------------DELETE THIS
CommunicationMonitor.StatusChange += (o, a) =>
{
Debug.Console(2, this, "Communication monitor status change: {0}", a.Status);
Debug.LogMessage(LogEventLevel.Verbose, this, "Communication monitor status change: {0}", a.Status);
};
}
@@ -35,35 +36,6 @@ namespace PepperDash.Essentials.Core.Devices
{
}
/// <summary>
/// Generic monitor for TCP reachability. Default with 30s poll, 120s warning and 300s error times
/// </summary>
[Obsolete]
public GenericCommunicationMonitoredDevice(string key, string name, string hostname, int port, string pollString)
: this(key, name, hostname, port, pollString, 30000, 120000, 300000)
{
}
/// <summary>
/// Monitor for TCP reachability
/// </summary>
[Obsolete]
public GenericCommunicationMonitoredDevice(string key, string name, string hostname, int port, string pollString,
long pollTime, long warningTime, long errorTime)
: base(key, name)
{
Client = new GenericTcpIpClient(key + "-tcp", hostname, port, 512);
CommunicationMonitor = new GenericCommunicationMonitor(this, Client, pollTime, warningTime, errorTime, pollString);
// ------------------------------------------------------DELETE THIS
CommunicationMonitor.StatusChange += (o, a) =>
{
Debug.Console(2, this, "Communication monitor status change: {0}", a.Status);
};
}
public override bool CustomActivate()
{
CommunicationMonitor.Start();

View File

@@ -4,6 +4,7 @@ using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharp.Reflection;
using PepperDash.Core;
using Serilog.Events;
namespace PepperDash.Essentials.Core
{
@@ -29,7 +30,7 @@ namespace PepperDash.Essentials.Core
var feedbacks = source.Feedbacks;
if (feedbacks != null)
{
Debug.Console(0, source, "\n\nAvailable feedbacks:");
Debug.LogMessage(LogEventLevel.Information, source, "\n\nAvailable feedbacks:");
foreach (var f in feedbacks)
{
string val = "";
@@ -52,12 +53,12 @@ namespace PepperDash.Essentials.Core
type = "string";
}
}
Debug.Console(0, "{0,-12} {1, -25} {2}", type,
Debug.LogMessage(LogEventLevel.Information, "{0,-12} {1, -25} {2}", type,
(string.IsNullOrEmpty(f.Key) ? "-no key-" : f.Key), val);
}
}
else
Debug.Console(0, source, "No available outputs:");
Debug.LogMessage(LogEventLevel.Information, source, "No available outputs:");
}
}
}

View File

@@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using Serilog.Events;
namespace PepperDash.Essentials.Core
{
@@ -84,14 +85,14 @@ namespace PepperDash.Essentials.Core
if (handler != null)
{
Debug.Console(1, "Device Usage Ended for: {0} at {1}. In use for {2} minutes.", Parent.Name, UsageEndTime, timeUsed.Minutes);
Debug.LogMessage(LogEventLevel.Debug, "Device Usage Ended for: {0} at {1}. In use for {2} minutes.", Parent.Name, UsageEndTime, timeUsed.Minutes);
handler(this, new DeviceUsageEventArgs() { UsageEndTime = UsageEndTime, MinutesUsed = timeUsed.Minutes });
}
}
}
catch (Exception e)
{
Debug.Console(1, "Error ending device usage: {0}", e);
Debug.LogMessage(LogEventLevel.Debug, "Error ending device usage: {0}", e);
}
}
}

View File

@@ -64,6 +64,24 @@ namespace PepperDash.Essentials.Core
IntFeedback VolumeLevelFeedback { get; }
}
/// <summary>
/// Adds the ability to display a raw volume level and the units of that level
/// </summary>
public interface IBasicVolumeWithFeedbackAdvanced : IBasicVolumeWithFeedback
{
int RawVolumeLevel { get; }
eVolumeLevelUnits Units { get; }
}
public enum eVolumeLevelUnits
{
Decibels,
Percent,
Relative,
Absolute
}
/// <summary>
/// A class that implements this contains a reference to a current IBasicVolumeControls device.
/// The class may have multiple IBasicVolumeControls.

View File

@@ -1,4 +1,4 @@
extern alias Full;
using System;
using System.Collections.Generic;
@@ -6,11 +6,12 @@ using System.Linq;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Full.Newtonsoft.Json.Linq;
using Newtonsoft.Json.Linq;
using PepperDash.Essentials.Core.Config;
using PepperDash.Core;
using Serilog.Events;
namespace PepperDash.Essentials.Core
{
@@ -46,7 +47,7 @@ namespace PepperDash.Essentials.Core
IrPort = port;
if (port == null)
{
Debug.Console(0, this, "WARNING No valid IR Port assigned to controller. IR will not function");
Debug.LogMessage(LogEventLevel.Information, this, "WARNING No valid IR Port assigned to controller. IR will not function");
return;
}
LoadDriver(irDriverFilepath);
@@ -64,12 +65,12 @@ namespace PepperDash.Essentials.Core
if (IrPort == null)
{
Debug.Console(0, this, "WARNING No valid IR Port assigned to controller. IR will not function");
Debug.LogMessage(LogEventLevel.Information, this, "WARNING No valid IR Port assigned to controller. IR will not function");
return;
}
var filePath = Global.FilePathPrefix + "ir" + Global.DirectorySeparator + config.Properties["control"]["irFile"].Value<string>();
Debug.Console(1, "*************Attempting to load IR file: {0}***************", filePath);
Debug.LogMessage(LogEventLevel.Debug, "*************Attempting to load IR file: {0}***************", filePath);
LoadDriver(filePath);
@@ -79,10 +80,10 @@ namespace PepperDash.Essentials.Core
public void PrintAvailableCommands()
{
Debug.Console(2, this, "Available IR Commands in IR File {0}", IrPortUid);
Debug.LogMessage(LogEventLevel.Verbose, this, "Available IR Commands in IR File {0}", IrPortUid);
foreach (var cmd in IrPort.AvailableIRCmds())
{
Debug.Console(2, this, "{0}", cmd);
Debug.LogMessage(LogEventLevel.Verbose, this, "{0}", cmd);
}
}
@@ -93,7 +94,7 @@ namespace PepperDash.Essentials.Core
/// <param name="path"></param>
public void LoadDriver(string path)
{
Debug.Console(2, this, "***Loading IR File***");
Debug.LogMessage(LogEventLevel.Verbose, this, "***Loading IR File***");
if (string.IsNullOrEmpty(path)) path = DriverFilepath;
try
{
@@ -108,7 +109,7 @@ namespace PepperDash.Essentials.Core
{
DriverIsLoaded = false;
var message = string.Format("WARNING IR Driver '{0}' failed to load", path);
Debug.Console(0, this, Debug.ErrorLogLevel.Error, message);
Debug.LogMessage(LogEventLevel.Information, this, message);
DriverLoaded.FireUpdate();
}
}
@@ -119,15 +120,15 @@ namespace PepperDash.Essentials.Core
/// </summary>
public virtual void PressRelease(string command, bool state)
{
Debug.Console(2, this, "IR:'{0}'={1}", command, state);
Debug.LogMessage(LogEventLevel.Verbose, this, "IR:'{0}'={1}", command, state);
if (IrPort == null)
{
Debug.Console(2, this, "WARNING No IR Port assigned to controller");
Debug.LogMessage(LogEventLevel.Verbose, this, "WARNING No IR Port assigned to controller");
return;
}
if (!DriverIsLoaded)
{
Debug.Console(2, this, "WARNING IR driver is not loaded");
Debug.LogMessage(LogEventLevel.Verbose, this, "WARNING IR driver is not loaded");
return;
}
if (state)
@@ -148,12 +149,12 @@ namespace PepperDash.Essentials.Core
{
if (IrPort == null)
{
Debug.Console(2, this, "WARNING No IR Port assigned to controller");
Debug.LogMessage(LogEventLevel.Verbose, this, "WARNING No IR Port assigned to controller");
return;
}
if (!DriverIsLoaded)
{
Debug.Console(2, this, "WARNING IR driver is not loaded");
Debug.LogMessage(LogEventLevel.Verbose, this, "WARNING IR driver is not loaded");
return;
}
if (IrPort.IsIRCommandAvailable(IrPortUid, command))
@@ -167,7 +168,7 @@ namespace PepperDash.Essentials.Core
/// </summary>
protected void NoIrCommandError(string command)
{
Debug.Console(2, this, "Device {0}: IR Driver {1} does not contain command {2}",
Debug.LogMessage(LogEventLevel.Verbose, this, "Device {0}: IR Driver {1} does not contain command {2}",
Key, IrPort.IRDriverFileNameByIRDriverId(IrPortUid), command);
}
}

View File

@@ -7,12 +7,11 @@ using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Routing;
using PepperDash.Core;
using Serilog.Events;
namespace PepperDash.Essentials.Core.Devices
{
/// <summary>
/// This DVD class should cover most IR, one-way DVD and Bluray fuctions
/// </summary>
[Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")]
public class InRoomPc : EssentialsDevice, IHasFeedback, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo, IUsageTracking
{
public uint DisplayUiType { get { return DisplayUiConstants.TypeLaptop; } }
@@ -65,6 +64,7 @@ namespace PepperDash.Essentials.Core.Devices
#endregion
}
[Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")]
public class InRoomPcFactory : EssentialsDeviceFactory<InRoomPc>
{
public InRoomPcFactory()
@@ -74,7 +74,7 @@ namespace PepperDash.Essentials.Core.Devices
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new InRoomPc Device");
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new InRoomPc Device");
return new InRoomPc(dc.Key, dc.Name);
}
}

View File

@@ -7,13 +7,13 @@ using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Routing;
using PepperDash.Core;
using Serilog.Events;
namespace PepperDash.Essentials.Core.Devices
{
/// <summary>
/// This DVD class should cover most IR, one-way DVD and Bluray fuctions
/// </summary>
public class Laptop : EssentialsDevice, IHasFeedback, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo, IUsageTracking
[Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")]
public class Laptop : EssentialsDevice, IHasFeedback, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo, IUsageTracking
{
public uint DisplayUiType { get { return DisplayUiConstants.TypeLaptop; } }
public string IconName { get; set; }
@@ -65,6 +65,7 @@ namespace PepperDash.Essentials.Core.Devices
#endregion
}
[Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")]
public class LaptopFactory : EssentialsDeviceFactory<Laptop>
{
public LaptopFactory()
@@ -74,7 +75,7 @@ namespace PepperDash.Essentials.Core.Devices
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new Laptop Device");
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Laptop Device");
return new Core.Devices.Laptop(dc.Key, dc.Name);
}
}

View File

@@ -4,12 +4,11 @@ using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Core;
namespace PepperDash_Essentials_Core.Devices
namespace PepperDash.Essentials.Core.Devices
{
/// <summary>
/// Interface for any device that is able to control it'spower and has a configurable reboot time
/// </summary>
[Obsolete("PepperDash_Essentials_Core.Devices is Deprecated - use PepperDash.Essentials.Core")]
/// </summary>
public interface IHasPowerCycle : IKeyName, IHasPowerControlWithFeedback
{
/// <summary>
@@ -25,8 +24,7 @@ namespace PepperDash_Essentials_Core.Devices
/// <summary>
/// Interface for any device that contains a collection of IHasPowerReboot Devices
/// </summary>
[Obsolete("PepperDash_Essentials_Core.Devices is Deprecated - use PepperDash.Essentials.Core")]
/// </summary>
public interface IHasControlledPowerOutlets : IKeyName
{
/// <summary>

View File

@@ -9,18 +9,6 @@ using Crestron.SimplSharpPro.UI;
namespace PepperDash.Essentials.Core
{
//[Obsolete]
//public class PresentationDeviceType
//{
// public const ushort Default = 1;
// public const ushort CableSetTopBox = 2;
// public const ushort SatelliteSetTopBox = 3;
// public const ushort Dvd = 4;
// public const ushort Bluray = 5;
// public const ushort PC = 9;
// public const ushort Laptop = 10;
//}
public enum PresentationSourceType
{
None, Dvd, Laptop, PC, SetTopBox, VCR

View File

@@ -1,4 +1,4 @@
extern alias Full;
using System;
using System.Collections.Generic;
@@ -9,8 +9,8 @@ using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
using Full.Newtonsoft.Json;
using Full.Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace PepperDash.Essentials.Core.Devices
{

View File

@@ -1,4 +1,4 @@
extern alias Full;
using System;
using System.Collections.Generic;
@@ -6,9 +6,9 @@ using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Full.Newtonsoft.Json;
using Full.Newtonsoft.Json.Converters;
using Full.Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
namespace PepperDash.Essentials.Core

View File

@@ -11,18 +11,16 @@ using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Routing;
using Serilog.Events;
namespace PepperDash.Essentials.Core
{
[Description("Wrapper class for a Basic IR Display")]
[Obsolete("Please use PepperDash.Essentials.Device.Common, this will be removed in 2.1")]
public class BasicIrDisplay : DisplayBase, IBasicVolumeControls, IBridgeAdvanced
{
public IrOutputPortController IrPort { get; private set; }
public ushort IrPulseTime { get; set; }
[Obsolete("This property will be removed in version 2.0.0")]
public override BoolFeedback PowerIsOnFeedback { get; protected set; }
protected Func<bool> PowerIsOnFeedbackFunc
{
get { return () => _PowerIsOn; }
@@ -46,16 +44,8 @@ namespace PepperDash.Essentials.Core
IrPort = new IrOutputPortController(key + "-ir", port, irDriverFilepath);
DeviceManager.AddDevice(IrPort);
PowerIsOnFeedback = new BoolFeedback(PowerIsOnFeedbackFunc);
PowerIsOnFeedback.OutputChange += (o, a) =>
{
Debug.Console(2, this, "Power on={0}", _PowerIsOn);
if (_PowerIsOn) StartWarmingTimer();
else StartCoolingTimer();
};
IsWarmingUpFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Warming up={0}", _IsWarmingUp);
IsCoolingDownFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Cooling down={0}", _IsCoolingDown);
IsWarmingUpFeedback.OutputChange += (o, a) => Debug.LogMessage(LogEventLevel.Verbose, this, "Warming up={0}", _IsWarmingUp);
IsCoolingDownFeedback.OutputChange += (o, a) => Debug.LogMessage(LogEventLevel.Verbose, this, "Cooling down={0}", _IsCoolingDown);
InputPorts.AddRange(new RoutingPortCollection<RoutingInputPort>
{
@@ -117,20 +107,17 @@ namespace PepperDash.Essentials.Core
{
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_ON, IrPulseTime);
_PowerIsOn = true;
PowerIsOnFeedback.FireUpdate();
}
public override void PowerOff()
{
_PowerIsOn = false;
PowerIsOnFeedback.FireUpdate();
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_OFF, IrPulseTime);
}
public override void PowerToggle()
{
_PowerIsOn = false;
PowerIsOnFeedback.FireUpdate();
IrPort.Pulse(IROutputStandardCommands.IROut_POWER, IrPulseTime);
}
@@ -184,7 +171,7 @@ namespace PepperDash.Essentials.Core
/// <param name="inputSelector">A delegate containing the input selector method to call</param>
public override void ExecuteSwitch(object inputSelector)
{
Debug.Console(2, this, "Switching to input '{0}'", (inputSelector as Action).ToString());
Debug.LogMessage(LogEventLevel.Verbose, this, "Switching to input '{0}'", (inputSelector as Action).ToString());
Action finishSwitch = () =>
{
@@ -193,7 +180,7 @@ namespace PepperDash.Essentials.Core
action();
};
if (!PowerIsOnFeedback.BoolValue)
if (!_PowerIsOn)
{
PowerOn();
EventHandler<FeedbackEventArgs> oneTimer = null;
@@ -217,6 +204,7 @@ namespace PepperDash.Essentials.Core
}
}
[Obsolete("Please use PepperDash.Essentials.Device.Common, this will be removed in 2.1")]
public class BasicIrDisplayFactory : EssentialsDeviceFactory<BasicIrDisplay>
{
public BasicIrDisplayFactory()
@@ -226,7 +214,7 @@ namespace PepperDash.Essentials.Core
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new BasicIrDisplay Device");
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new BasicIrDisplay Device");
var ir = IRPortHelper.GetIrPort(dc.Properties);
if (ir != null)
{

View File

@@ -1,26 +1,23 @@
extern alias Full;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
using Full.Newtonsoft.Json;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Bridges;
using Serilog.Events;
namespace PepperDash.Essentials.Core
{
/// <summary>
///
/// </summary>
public abstract class DisplayBase : EssentialsDevice, IHasFeedback, IRoutingSinkWithSwitching, IHasPowerControl, IWarmingCooling, IUsageTracking, IPower
[Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")]
public abstract class DisplayBase : EssentialsDevice, IHasFeedback, IRoutingSinkWithSwitching, IHasPowerControl, IWarmingCooling, IUsageTracking
{
public event SourceInfoChangeHandler CurrentSourceChange;
@@ -51,9 +48,6 @@ namespace PepperDash.Essentials.Core
public BoolFeedback IsCoolingDownFeedback { get; protected set; }
public BoolFeedback IsWarmingUpFeedback { get; private set; }
[Obsolete("This property will be removed in version 2.0.0")]
public abstract BoolFeedback PowerIsOnFeedback { get; protected set; }
public UsageTracking UsageTracker { get; set; }
public uint WarmupTime { get; set; }
@@ -120,7 +114,7 @@ namespace PepperDash.Essentials.Core
}
else
{
Debug.Console(0,this,"Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
Debug.LogMessage(LogEventLevel.Information,this,"Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
LinkDisplayToApi(displayDevice, trilist, joinMap);
@@ -128,8 +122,8 @@ namespace PepperDash.Essentials.Core
protected void LinkDisplayToApi(DisplayBase displayDevice, BasicTriList trilist, DisplayControllerJoinMap joinMap)
{
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.Console(0, "Linking to Display: {0}", displayDevice.Name);
Debug.LogMessage(LogEventLevel.Debug, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.LogMessage(LogEventLevel.Information, "Linking to Display: {0}", displayDevice.Name);
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = displayDevice.Name;
@@ -151,7 +145,7 @@ namespace PepperDash.Essentials.Core
{
trilist.SetBool(joinMap.IsTwoWayDisplay.JoinNumber, true);
twoWayDisplay.CurrentInputFeedback.OutputChange += (o, a) => Debug.Console(0, "CurrentInputFeedback_OutputChange {0}", a.StringValue);
twoWayDisplay.CurrentInputFeedback.OutputChange += (o, a) => Debug.LogMessage(LogEventLevel.Information, "CurrentInputFeedback_OutputChange {0}", a.StringValue);
inputNumberFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputSelect.JoinNumber]);
@@ -205,16 +199,16 @@ namespace PepperDash.Essentials.Core
var tempKey = inputKeys.ElementAt(i);
trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset.JoinNumber + i),
() => displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector));
Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}",
Debug.LogMessage(LogEventLevel.Verbose, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}",
joinMap.InputSelectOffset.JoinNumber + i, displayDevice.InputPorts[tempKey].Key.ToString());
trilist.StringInput[(ushort)(joinMap.InputNamesOffset.JoinNumber + i)].StringValue = displayDevice.InputPorts[i].Key.ToString();
}
else
Debug.Console(0, displayDevice, Debug.ErrorLogLevel.Warning, "Device has {0} inputs. The Join Map allows up to {1} inputs. Discarding inputs {2} - {3} from bridge.",
Debug.LogMessage(LogEventLevel.Information, displayDevice, "Device has {0} inputs. The Join Map allows up to {1} inputs. Discarding inputs {2} - {3} from bridge.",
displayDevice.InputPorts.Count, joinMap.InputNamesOffset.JoinSpan, i + 1, displayDevice.InputPorts.Count);
}
Debug.Console(2, displayDevice, "Setting Input Select Action on Analog Join {0}", joinMap.InputSelect);
Debug.LogMessage(LogEventLevel.Verbose, displayDevice, "Setting Input Select Action on Analog Join {0}", joinMap.InputSelect);
trilist.SetUShortSigAction(joinMap.InputSelect.JoinNumber, (a) =>
{
if (a == 0)
@@ -260,16 +254,14 @@ namespace PepperDash.Essentials.Core
}
/// <summary>
///
/// </summary>
[Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")]
public abstract class TwoWayDisplayBase : DisplayBase, IRoutingFeedback, IHasPowerControlWithFeedback
{
public StringFeedback CurrentInputFeedback { get; private set; }
abstract protected Func<string> CurrentInputFeedbackFunc { get; }
public override BoolFeedback PowerIsOnFeedback { get; protected set; }
public BoolFeedback PowerIsOnFeedback { get; protected set; }
abstract protected Func<bool> PowerIsOnFeedbackFunc { get; }

View File

@@ -13,13 +13,12 @@ using PepperDash.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Routing;
using PepperDash.Essentials.Core.Config;
using Serilog.Events;
namespace PepperDash.Essentials.Core
{
/// <summary>
///
/// </summary>
public class MockDisplay : TwoWayDisplayBase, IBasicVolumeWithFeedback, IBridgeAdvanced
[Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")]
public class MockDisplay : TwoWayDisplayBase, IBasicVolumeWithFeedback, IBridgeAdvanced
{
public RoutingInputPort HdmiIn1 { get; private set; }
@@ -38,7 +37,7 @@ namespace PepperDash.Essentials.Core
{
return () =>
{
Debug.Console(2, this, "*************************************************** Display Power is {0}", _PowerIsOn ? "on" : "off");
Debug.LogMessage(LogEventLevel.Verbose, this, "*************************************************** Display Power is {0}", _PowerIsOn ? "on" : "off");
return _PowerIsOn;
};
} }
@@ -48,7 +47,7 @@ namespace PepperDash.Essentials.Core
{
return () =>
{
Debug.Console(2, this, "*************************************************** {0}", _IsCoolingDown ? "Display is cooling down" : "Display has finished cooling down");
Debug.LogMessage(LogEventLevel.Verbose, this, "*************************************************** {0}", _IsCoolingDown ? "Display is cooling down" : "Display has finished cooling down");
return _IsCoolingDown;
};
}
@@ -59,7 +58,7 @@ namespace PepperDash.Essentials.Core
{
return () =>
{
Debug.Console(2, this, "*************************************************** {0}", _IsWarmingUp ? "Display is warming up" : "Display has finished warming up");
Debug.LogMessage(LogEventLevel.Verbose, this, "*************************************************** {0}", _IsWarmingUp ? "Display is warming up" : "Display has finished warming up");
return _IsWarmingUp;
};
}
@@ -121,7 +120,7 @@ namespace PepperDash.Essentials.Core
// Fake cool-down cycle
CooldownTimer = new CTimer(o =>
{
Debug.Console(2, this, "Cooldown timer ending");
Debug.LogMessage(LogEventLevel.Verbose, this, "Cooldown timer ending");
_IsCoolingDown = false;
IsCoolingDownFeedback.InvokeFireUpdate();
_PowerIsOn = false;
@@ -140,7 +139,7 @@ namespace PepperDash.Essentials.Core
public override void ExecuteSwitch(object selector)
{
Debug.Console(2, this, "ExecuteSwitch: {0}", selector);
Debug.LogMessage(LogEventLevel.Verbose, this, "ExecuteSwitch: {0}", selector);
if (!_PowerIsOn)
{
@@ -182,7 +181,7 @@ namespace PepperDash.Essentials.Core
{
//while (pressRelease)
//{
Debug.Console(2, this, "Volume Down {0}", pressRelease);
Debug.LogMessage(LogEventLevel.Verbose, this, "Volume Down {0}", pressRelease);
if (pressRelease)
{
var newLevel = _FakeVolumeLevel + VolumeInterval;
@@ -196,7 +195,7 @@ namespace PepperDash.Essentials.Core
{
//while (pressRelease)
//{
Debug.Console(2, this, "Volume Up {0}", pressRelease);
Debug.LogMessage(LogEventLevel.Verbose, this, "Volume Up {0}", pressRelease);
if (pressRelease)
{
var newLevel = _FakeVolumeLevel - VolumeInterval;
@@ -220,6 +219,8 @@ namespace PepperDash.Essentials.Core
}
}
[Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")]
public class MockDisplayFactory : EssentialsDeviceFactory<MockDisplay>
{
public MockDisplayFactory()
@@ -229,7 +230,7 @@ namespace PepperDash.Essentials.Core
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new Mock Display Device");
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Mock Display Device");
return new MockDisplay(dc.Key, dc.Name);
}
}

View File

@@ -1,12 +1,12 @@
extern alias Full;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Full.Newtonsoft.Json;
using Full.Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace PepperDash.Essentials.Core
{

View File

@@ -1,10 +1,11 @@
extern alias Full;
using Crestron.SimplSharp;
using Crestron.SimplSharp.Reflection;
using Full.Newtonsoft.Json.Linq;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
using Serilog.Events;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -44,7 +45,7 @@ namespace PepperDash.Essentials.Core
}
catch (Exception e)
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to load type: '{1}' DeviceFactory: {0}", e, type.Name);
Debug.LogMessage(LogEventLevel.Information, "Unable to load type: '{1}' DeviceFactory: {0}", e, type.Name);
}
}
}
@@ -64,17 +65,17 @@ namespace PepperDash.Essentials.Core
/// <returns></returns>
public static void AddFactoryForType(string typeName, Func<DeviceConfig, IKeyed> method)
{
//Debug.Console(1, Debug.ErrorLogLevel.Notice, "Adding factory method for type '{0}'", typeName);
//Debug.LogMessage(LogEventLevel.Debug, "Adding factory method for type '{0}'", typeName);
DeviceFactory.FactoryMethods.Add(typeName, new DeviceFactoryWrapper() { FactoryMethod = method});
}
public static void AddFactoryForType(string typeName, string description, CType cType, Func<DeviceConfig, IKeyed> method)
{
//Debug.Console(1, Debug.ErrorLogLevel.Notice, "Adding factory method for type '{0}'", typeName);
//Debug.LogMessage(LogEventLevel.Debug, "Adding factory method for type '{0}'", typeName);
if(FactoryMethods.ContainsKey(typeName))
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to add type: '{0}'. Already exists in DeviceFactory", typeName);
Debug.LogMessage(LogEventLevel.Information, "Unable to add type: '{0}'. Already exists in DeviceFactory", typeName);
return;
}
@@ -104,7 +105,7 @@ namespace PepperDash.Essentials.Core
if (secretProvider == null) return null;
var secret = secretProvider.GetSecret(data.Key);
if (secret != null) return (string) secret.Value;
Debug.Console(1,
Debug.LogMessage(LogEventLevel.Debug,
"Unable to retrieve secret {0}{1} - Make sure you've added it to the secrets provider",
data.Provider, data.Key);
return String.Empty;
@@ -121,7 +122,7 @@ namespace PepperDash.Essentials.Core
{
try
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loading '{0}' from Essentials Core", dc.Type);
Debug.LogMessage(LogEventLevel.Information, "Loading '{0}' from Essentials Core", dc.Type);
var localDc = new DeviceConfig(dc);
@@ -142,24 +143,24 @@ namespace PepperDash.Essentials.Core
CheckForSecrets(jProp);
}
Debug.Console(2, "typeName = {0}", typeName);
Debug.LogMessage(LogEventLevel.Verbose, "typeName = {0}", typeName);
// Check for types that have been added by plugin dlls.
return !FactoryMethods.ContainsKey(typeName) ? null : FactoryMethods[typeName].FactoryMethod(localDc);
}
catch (Exception ex)
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Exception occurred while creating device {0}: {1}", dc.Key, ex.Message);
Debug.LogMessage(LogEventLevel.Error, "Exception occurred while creating device {0}: {1}", dc.Key, ex.Message);
Debug.Console(2, "{0}", ex.StackTrace);
Debug.LogMessage(LogEventLevel.Verbose, "{0}", ex.StackTrace);
if (ex.InnerException == null)
{
return null;
}
Debug.Console(0, Debug.ErrorLogLevel.Error, "Inner exception while creating device {0}: {1}", dc.Key,
Debug.LogMessage(LogEventLevel.Error, "Inner exception while creating device {0}: {1}", dc.Key,
ex.InnerException.Message);
Debug.Console(2, "{0}", ex.InnerException.StackTrace);
Debug.LogMessage(LogEventLevel.Verbose, "{0}", ex.InnerException.StackTrace);
return null;
}
}
@@ -189,7 +190,7 @@ namespace PepperDash.Essentials.Core
CrestronConsole.ConsoleCommandResponse(
@"Type: '{0}'
CType: '{1}'
Description: {2}", type.Key, cType, description);
Description: {2}{3}", type.Key, cType, description, CrestronEnvironment.NewLine);
}
}

View File

@@ -1,9 +1,8 @@
extern alias Full;
using Crestron.SimplSharp.Reflection;
using Full.Newtonsoft.Json.Linq;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
using Serilog.Events;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -31,7 +30,7 @@ namespace PepperDash.Essentials.Core
}
catch( Exception e )
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to load extension device: '{1}' ProcessorExtensionDeviceFactory: {0}", e, extension.Name);
Debug.LogMessage(LogEventLevel.Information, "Unable to load extension device: '{1}' ProcessorExtensionDeviceFactory: {0}", e, extension.Name);
}
}
}
@@ -52,17 +51,17 @@ namespace PepperDash.Essentials.Core
/// <returns></returns>
public static void AddFactoryForType(string extensionName, Func<DeviceConfig, IKeyed> method)
{
//Debug.Console(1, Debug.ErrorLogLevel.Notice, "Adding factory method for type '{0}'", typeName);
//Debug.LogMessage(LogEventLevel.Debug, "Adding factory method for type '{0}'", typeName);
ProcessorExtensionDeviceFactory.ProcessorExtensionFactoryMethods.Add(extensionName, new DeviceFactoryWrapper() { FactoryMethod = method });
}
public static void AddFactoryForType(string extensionName, string description, CType cType, Func<DeviceConfig, IKeyed> method)
{
//Debug.Console(1, Debug.ErrorLogLevel.Notice, "Adding factory method for type '{0}'", typeName);
//Debug.LogMessage(LogEventLevel.Debug, "Adding factory method for type '{0}'", typeName);
if (ProcessorExtensionFactoryMethods.ContainsKey(extensionName))
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to add extension device: '{0}'. Already exists in ProcessorExtensionDeviceFactory", extensionName);
Debug.LogMessage(LogEventLevel.Information, "Unable to add extension device: '{0}'. Already exists in ProcessorExtensionDeviceFactory", extensionName);
return;
}
@@ -70,9 +69,9 @@ namespace PepperDash.Essentials.Core
ProcessorExtensionDeviceFactory.ProcessorExtensionFactoryMethods.Add(extensionName, wrapper);
}
private static void CheckForSecrets(IEnumerable<Full.Newtonsoft.Json.Linq.JProperty> obj)
private static void CheckForSecrets(IEnumerable<Newtonsoft.Json.Linq.JProperty> obj)
{
foreach (var prop in obj.Where(prop => prop.Value as Full.Newtonsoft.Json.Linq.JObject != null))
foreach (var prop in obj.Where(prop => prop.Value as Newtonsoft.Json.Linq.JObject != null))
{
if (prop.Name.ToLower() == "secret")
{
@@ -80,7 +79,7 @@ namespace PepperDash.Essentials.Core
//var secret = GetSecret(JsonConvert.DeserializeObject<SecretsPropertiesConfig>(prop.Children().First().ToString()));
prop.Parent.Replace(secret);
}
var recurseProp = prop.Value as Full.Newtonsoft.Json.Linq.JObject;
var recurseProp = prop.Value as Newtonsoft.Json.Linq.JObject;
if (recurseProp == null) return;
CheckForSecrets(recurseProp.Properties());
}
@@ -92,7 +91,7 @@ namespace PepperDash.Essentials.Core
if (secretProvider == null) return null;
var secret = secretProvider.GetSecret(data.Key);
if (secret != null) return (string)secret.Value;
Debug.Console(1,
Debug.LogMessage(LogEventLevel.Debug,
"Unable to retrieve secret {0}{1} - Make sure you've added it to the secrets provider",
data.Provider, data.Key);
return String.Empty;
@@ -108,7 +107,7 @@ namespace PepperDash.Essentials.Core
{
try
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loading '{0}' from Essentials Core", dc.Type);
Debug.LogMessage(LogEventLevel.Information, "Loading '{0}' from Essentials Core", dc.Type);
var localDc = new DeviceConfig(dc);
@@ -120,7 +119,7 @@ namespace PepperDash.Essentials.Core
var typeName = localDc.Type.ToLower();
var jObject = properties as Full.Newtonsoft.Json.Linq.JObject;
var jObject = properties as Newtonsoft.Json.Linq.JObject;
if (jObject != null)
{
var jProp = jObject.Properties();
@@ -128,24 +127,24 @@ namespace PepperDash.Essentials.Core
CheckForSecrets(jProp);
}
Debug.Console(2, "typeName = {0}", typeName);
Debug.LogMessage(LogEventLevel.Verbose, "typeName = {0}", typeName);
// Check for types that have been added by plugin dlls.
return !ProcessorExtensionFactoryMethods.ContainsKey(typeName) ? null : ProcessorExtensionFactoryMethods[typeName].FactoryMethod(localDc);
}
catch (Exception ex)
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Exception occurred while creating device {0}: {1}", dc.Key, ex.Message);
Debug.LogMessage(LogEventLevel.Information, "Exception occurred while creating device {0}: {1}", dc.Key, ex.Message);
Debug.Console(2, "{0}", ex.StackTrace);
Debug.LogMessage(LogEventLevel.Verbose, "{0}", ex.StackTrace);
if (ex.InnerException == null)
{
return null;
}
Debug.Console(0, Debug.ErrorLogLevel.Error, "Inner exception while creating device {0}: {1}", dc.Key,
Debug.LogMessage(LogEventLevel.Information, "Inner exception while creating device {0}: {1}", dc.Key,
ex.InnerException.Message);
Debug.Console(2, "{0}", ex.InnerException.StackTrace);
Debug.LogMessage(LogEventLevel.Verbose, "{0}", ex.InnerException.StackTrace);
return null;
}
}

View File

@@ -23,24 +23,3 @@ namespace PepperDash.Essentials.Core
bool IsReady { get; }
}
}
namespace PepperDash_Essentials_Core
{
[Obsolete("Use PepperDash.Essentials.Core")]
public class IsReadyEventArgs : EventArgs
{
public bool IsReady { get; set; }
public IsReadyEventArgs(bool data)
{
IsReady = data;
}
}
[Obsolete("Use PepperDash.Essentials.Core")]
public interface IHasReady
{
event EventHandler<IsReadyEventArgs> IsReadyEvent;
bool IsReady { get; }
}
}

View File

@@ -6,6 +6,7 @@ using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using PepperDash.Core;
using Crestron.SimplSharpPro.CrestronThread;
using Serilog.Events;
namespace PepperDash.Essentials.Core
{
@@ -26,7 +27,7 @@ namespace PepperDash.Essentials.Core
string fullFilePath = Global.FilePathPrefix + fileName;
DirectoryInfo dirInfo = new DirectoryInfo(Path.GetDirectoryName(fullFilePath));
var files = dirInfo.GetFiles(Path.GetFileName(fullFilePath));
Debug.Console(0, "FileIO found: {0}, {1}", files.Count(), fullFilePath);
Debug.LogMessage(LogEventLevel.Information, "FileIO found: {0}, {1}", files.Count(), fullFilePath);
if (files.Count() > 0)
{
return files;
@@ -42,7 +43,7 @@ namespace PepperDash.Essentials.Core
string fullFilePath = Global.FilePathPrefix + fileName;
DirectoryInfo dirInfo = new DirectoryInfo(Path.GetDirectoryName(fullFilePath));
var files = dirInfo.GetFiles(Path.GetFileName(fullFilePath));
Debug.Console(0, "FileIO found: {0}, {1}", files.Count(), fullFilePath);
Debug.LogMessage(LogEventLevel.Information, "FileIO found: {0}, {1}", files.Count(), fullFilePath);
if (files.Count() > 0)
{
return files.FirstOrDefault();
@@ -67,7 +68,7 @@ namespace PepperDash.Essentials.Core
}
catch (Exception e)
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO read failed: \r{0}", e);
Debug.LogMessage(LogEventLevel.Information, "Error: FileIO read failed: \r{0}", e);
return "";
}
}
@@ -84,7 +85,7 @@ namespace PepperDash.Essentials.Core
if (fileLock.TryEnter())
{
DirectoryInfo dirInfo = new DirectoryInfo(file.DirectoryName);
Debug.Console(2, "FileIO Getting Data {0}", file.FullName);
Debug.LogMessage(LogEventLevel.Verbose, "FileIO Getting Data {0}", file.FullName);
if (File.Exists(file.FullName))
{
@@ -95,20 +96,20 @@ namespace PepperDash.Essentials.Core
}
else
{
Debug.Console(2, "File {0} does not exsist", file.FullName);
Debug.LogMessage(LogEventLevel.Verbose, "File {0} does not exsist", file.FullName);
return "";
}
}
else
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "FileIO Unable to enter FileLock");
Debug.LogMessage(LogEventLevel.Information, "FileIO Unable to enter FileLock");
return "";
}
}
catch (Exception e)
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO read failed: \r{0}", e);
Debug.LogMessage(LogEventLevel.Information, "Error: FileIO read failed: \r{0}", e);
return "";
}
finally
@@ -128,7 +129,7 @@ namespace PepperDash.Essentials.Core
}
catch (Exception e)
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO read failed: \r{0}", e);
Debug.LogMessage(LogEventLevel.Information, "Error: FileIO read failed: \r{0}", e);
}
}
@@ -140,7 +141,7 @@ namespace PepperDash.Essentials.Core
}
catch (Exception e)
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO read failed: \r{0}", e);
Debug.LogMessage(LogEventLevel.Information, "Error: FileIO read failed: \r{0}", e);
}
}
@@ -152,7 +153,7 @@ namespace PepperDash.Essentials.Core
if (fileLock.TryEnter())
{
DirectoryInfo dirInfo = new DirectoryInfo(file.Name);
Debug.Console(2, "FileIO Getting Data {0}", file.FullName);
Debug.LogMessage(LogEventLevel.Verbose, "FileIO Getting Data {0}", file.FullName);
if (File.Exists(file.FullName))
@@ -164,20 +165,20 @@ namespace PepperDash.Essentials.Core
}
else
{
Debug.Console(2, "File {0} Does not exsist", file.FullName);
Debug.LogMessage(LogEventLevel.Verbose, "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");
Debug.LogMessage(LogEventLevel.Information, "FileIO Unable to enter FileLock");
}
}
catch (Exception e)
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO read failed: \r{0}", e);
Debug.LogMessage(LogEventLevel.Information, "Error: FileIO read failed: \r{0}", e);
data = "";
}
finally
@@ -207,13 +208,13 @@ namespace PepperDash.Essentials.Core
_WriteFileThread = new Thread((O) => _WriteFileMethod(data, Global.FilePathPrefix + "/" + filePath), null, Thread.eThreadStartOptions.CreateSuspended);
_WriteFileThread.Priority = Thread.eThreadPriority.LowestPriority;
_WriteFileThread.Start();
Debug.Console(0, Debug.ErrorLogLevel.Notice, "New WriteFile Thread");
Debug.LogMessage(LogEventLevel.Information, "New WriteFile Thread");
}
static object _WriteFileMethod(string data, string filePath)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to write file: '{0}'", filePath);
Debug.LogMessage(LogEventLevel.Information, "Attempting to write file: '{0}'", filePath);
try
{
@@ -229,13 +230,13 @@ namespace PepperDash.Essentials.Core
}
else
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "FileIO Unable to enter FileLock");
Debug.LogMessage(LogEventLevel.Information, "FileIO Unable to enter FileLock");
}
}
catch (Exception e)
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO write failed: \r{0}", e);
Debug.LogMessage(LogEventLevel.Error, "Error: FileIO write failed: \r{0}", e);
}
finally
{
@@ -259,7 +260,7 @@ namespace PepperDash.Essentials.Core
var file = FileIO.GetFile("\\user\\*FileIOTest*");
var readData = FileIO.ReadDataFromFile(file);
Debug.Console(0, "Returned {0}", readData);
Debug.LogMessage(LogEventLevel.Information, "Returned {0}", readData);
File.Delete(file.FullName);
if (testData == readData)
{

View File

@@ -1,4 +1,4 @@
extern alias Full;
using System;
using System.Collections.Generic;
@@ -10,9 +10,10 @@ using Crestron.SimplSharp.CrestronXml;
using Crestron.SimplSharp.CrestronXml.Serialization;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.Fusion;
using Full.Newtonsoft.Json;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
using Serilog.Events;
namespace PepperDash.Essentials.Core.Fusion
{
@@ -128,7 +129,7 @@ namespace PepperDash.Essentials.Core.Fusion
if (File.Exists(oldGuidFilePath))
{
Debug.Console(0, this, "Migrating from old Fusion GUID file to new Fusion GUID File");
Debug.LogMessage(LogEventLevel.Information, this, "Migrating from old Fusion GUID file to new Fusion GUID File");
File.Copy(oldGuidFilePath, guidFilePath);
@@ -172,7 +173,7 @@ namespace PepperDash.Essentials.Core.Fusion
}
catch (Exception e)
{
Debug.Console(0, this, Debug.ErrorLogLevel.Error, "Error Building Fusion System Controller: {0}", e);
Debug.LogMessage(LogEventLevel.Information, this, "Error Building Fusion System Controller: {0}", e);
}
}
@@ -231,7 +232,7 @@ namespace PepperDash.Essentials.Core.Fusion
{
if (string.IsNullOrEmpty(filePath))
{
Debug.Console(0, this, "Error writing guid file. No path specified.");
Debug.LogMessage(LogEventLevel.Information, this, "Error writing guid file. No path specified.");
return;
}
@@ -246,13 +247,13 @@ namespace PepperDash.Essentials.Core.Fusion
fileLock.Enter();
Debug.Console(1, this, "Writing GUIDs to file");
Debug.LogMessage(LogEventLevel.Debug, this, "Writing GUIDs to file");
_guiDs = FusionOccSensor == null
? new FusionRoomGuids(Room.Name, _ipId, RoomGuid, FusionStaticAssets)
: new FusionRoomGuids(Room.Name, _ipId, RoomGuid, FusionStaticAssets, FusionOccSensor);
var json = JsonConvert.SerializeObject(_guiDs, Full.Newtonsoft.Json.Formatting.Indented);
var json = JsonConvert.SerializeObject(_guiDs, Newtonsoft.Json.Formatting.Indented);
using (var sw = new StreamWriter(filePath))
{
@@ -260,11 +261,11 @@ namespace PepperDash.Essentials.Core.Fusion
sw.Flush();
}
Debug.Console(1, this, "Guids successfully written to file '{0}'", filePath);
Debug.LogMessage(LogEventLevel.Debug, this, "Guids successfully written to file '{0}'", filePath);
}
catch (Exception e)
{
Debug.Console(0, this, "Error writing guid file: {0}", e);
Debug.LogMessage(LogEventLevel.Information, this, "Error writing guid file: {0}", e);
}
finally
{
@@ -283,7 +284,7 @@ namespace PepperDash.Essentials.Core.Fusion
{
if (string.IsNullOrEmpty(filePath))
{
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Error reading guid file. No path specified.");
Debug.LogMessage(LogEventLevel.Information, this, "Error reading guid file. No path specified.");
return;
}
@@ -309,20 +310,20 @@ namespace PepperDash.Essentials.Core.Fusion
FusionStaticAssets = _guiDs.StaticAssets;
}
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Fusion Guids successfully read from file: {0}",
Debug.LogMessage(LogEventLevel.Information, this, "Fusion Guids successfully read from file: {0}",
filePath);
Debug.Console(1, this, "\r\n********************\r\n\tRoom Name: {0}\r\n\tIPID: {1:X}\r\n\tRoomGuid: {2}\r\n*******************", Room.Name, _ipId, RoomGuid);
Debug.LogMessage(LogEventLevel.Debug, this, "\r\n********************\r\n\tRoom Name: {0}\r\n\tIPID: {1:X}\r\n\tRoomGuid: {2}\r\n*******************", Room.Name, _ipId, RoomGuid);
foreach (var item in FusionStaticAssets)
{
Debug.Console(1, this, "\nAsset Name: {0}\nAsset No: {1}\n Guid: {2}", item.Value.Name,
Debug.LogMessage(LogEventLevel.Debug, this, "\nAsset Name: {0}\nAsset No: {1}\n Guid: {2}", item.Value.Name,
item.Value.SlotNumber, item.Value.InstanceId);
}
}
catch (Exception e)
{
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Error reading guid file: {0}", e);
Debug.LogMessage(LogEventLevel.Information, this, "Error reading guid file: {0}", e);
}
finally
{
@@ -335,7 +336,7 @@ namespace PepperDash.Essentials.Core.Fusion
protected virtual void CreateSymbolAndBasicSigs(uint ipId)
{
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Creating Fusion Room symbol with GUID: {0} and IP-ID {1:X2}", RoomGuid, ipId);
Debug.LogMessage(LogEventLevel.Information, this, "Creating Fusion Room symbol with GUID: {0} and IP-ID {1:X2}", RoomGuid, ipId);
FusionRoom = new FusionRoom(ipId, Global.ControlSystem, Room.Name, RoomGuid);
FusionRoom.ExtenderRoomViewSchedulingDataReservedSigs.Use();
@@ -554,7 +555,7 @@ namespace PepperDash.Essentials.Core.Fusion
"</Parameters>\n" +
"</RequestAction>\n";
Debug.Console(2, this, "Sending Fusion ActionRequest: \n{0}", actionRequest);
Debug.LogMessage(LogEventLevel.Verbose, this, "Sending Fusion ActionRequest: \n{0}", actionRequest);
FusionRoom.ExtenderFusionRoomDataReservedSigs.ActionQuery.StringValue = actionRequest;
@@ -605,7 +606,7 @@ namespace PepperDash.Essentials.Core.Fusion
"<RequestSchedule><RequestID>FullSchedleRequest</RequestID><RoomID>{0}</RoomID><Start>{1}</Start><HourSpan>24</HourSpan></RequestSchedule>",
RoomGuid, currentTime);
Debug.Console(2, this, "Sending Fusion ScheduleQuery: \n{0}", requestTest);
Debug.LogMessage(LogEventLevel.Verbose, this, "Sending Fusion ScheduleQuery: \n{0}", requestTest);
FusionRoom.ExtenderRoomViewSchedulingDataReservedSigs.ScheduleQuery.StringValue = requestTest;
@@ -633,7 +634,7 @@ namespace PepperDash.Essentials.Core.Fusion
}
catch (Exception e)
{
Debug.Console(1, this, "Error parsing console command: {0}", e);
Debug.LogMessage(LogEventLevel.Debug, this, "Error parsing console command: {0}", e);
}
ModifyMeetingEndTime(requestId, extendMinutes);
@@ -648,7 +649,7 @@ namespace PepperDash.Essentials.Core.Fusion
{
if (_currentMeeting == null)
{
Debug.Console(1, this, "No meeting in progress. Unable to modify end time.");
Debug.LogMessage(LogEventLevel.Debug, this, "No meeting in progress. Unable to modify end time.");
return;
}
@@ -667,13 +668,13 @@ namespace PepperDash.Essentials.Core.Fusion
"<RequestAction><RequestID>{0}</RequestID><RoomID>{1}</RoomID><ActionID>MeetingChange</ActionID><Parameters><Parameter ID = 'MeetingID' Value = '{2}' /><Parameter ID = 'EndTime' Value = '{3}' /></Parameters></RequestAction>"
, requestId, RoomGuid, _currentMeeting.MeetingID, extendMinutes);
Debug.Console(1, this, "Sending MeetingChange Request: \n{0}", requestTest);
Debug.LogMessage(LogEventLevel.Debug, this, "Sending MeetingChange Request: \n{0}", requestTest);
FusionRoom.ExtenderFusionRoomDataReservedSigs.ActionQuery.StringValue = requestTest;
}
else
{
Debug.Console(1, this, "Invalid time specified");
Debug.LogMessage(LogEventLevel.Debug, this, "Invalid time specified");
}
}
@@ -716,11 +717,11 @@ namespace PepperDash.Essentials.Core.Fusion
"</Event>" +
"</CreateSchedule>";
Debug.Console(2, this, "Sending CreateMeeting Request: \n{0}", createMeetingRequest);
Debug.LogMessage(LogEventLevel.Verbose, this, "Sending CreateMeeting Request: \n{0}", createMeetingRequest);
FusionRoom.ExtenderRoomViewSchedulingDataReservedSigs.CreateMeeting.StringValue = createMeetingRequest;
//Debug.Console(1, this, "Sending CreateMeeting Request: \n{0}", command);
//Debug.LogMessage(LogEventLevel.Debug, this, "Sending CreateMeeting Request: \n{0}", command);
//FusionRoom.ExtenderRoomViewSchedulingDataReservedSigs.CreateMeeting.StringValue = command;
}
@@ -733,7 +734,7 @@ namespace PepperDash.Essentials.Core.Fusion
protected void ExtenderFusionRoomDataReservedSigs_DeviceExtenderSigChange(DeviceExtender currentDeviceExtender,
SigEventArgs args)
{
Debug.Console(2, this, "Event: {0}\n Sig: {1}\nFusionResponse:\n{2}", args.Event, args.Sig.Name,
Debug.LogMessage(LogEventLevel.Verbose, this, "Event: {0}\n Sig: {1}\nFusionResponse:\n{2}", args.Event, args.Sig.Name,
args.Sig.StringValue);
@@ -802,7 +803,7 @@ namespace PepperDash.Essentials.Core.Fusion
}
catch (Exception e)
{
Debug.Console(1, this, "Error parsing ActionQueryResponse: {0}", e);
Debug.LogMessage(LogEventLevel.Debug, this, "Error parsing ActionQueryResponse: {0}", e);
}
}
else if (args.Sig == FusionRoom.ExtenderFusionRoomDataReservedSigs.LocalDateTimeQueryResponse)
@@ -825,20 +826,20 @@ namespace PepperDash.Essentials.Core.Fusion
var currentTime = DateTime.Parse(tempLocalDateTime);
Debug.Console(1, this, "DateTime from Fusion Server: {0}", currentTime);
Debug.LogMessage(LogEventLevel.Debug, this, "DateTime from Fusion Server: {0}", currentTime);
// Parse time and date from response and insert values
CrestronEnvironment.SetTimeAndDate((ushort) currentTime.Hour, (ushort) currentTime.Minute,
(ushort) currentTime.Second, (ushort) currentTime.Month, (ushort) currentTime.Day,
(ushort) currentTime.Year);
Debug.Console(1, this, "Processor time set to {0}", CrestronEnvironment.GetLocalTime());
Debug.LogMessage(LogEventLevel.Debug, this, "Processor time set to {0}", CrestronEnvironment.GetLocalTime());
}
}
}
catch (Exception e)
{
Debug.Console(1, this, "Error parsing LocalDateTimeQueryResponse: {0}", e);
Debug.LogMessage(LogEventLevel.Debug, this, "Error parsing LocalDateTimeQueryResponse: {0}", e);
}
}
else if (args.Sig == FusionRoom.ExtenderFusionRoomDataReservedSigs.RoomConfigResponse)
@@ -847,7 +848,7 @@ namespace PepperDash.Essentials.Core.Fusion
var roomConfigResponseArgs = args.Sig.StringValue.Replace("&", "and");
Debug.Console(2, this, "Fusion Response: \n {0}", roomConfigResponseArgs);
Debug.LogMessage(LogEventLevel.Verbose, this, "Fusion Response: \n {0}", roomConfigResponseArgs);
try
{
@@ -912,7 +913,7 @@ namespace PepperDash.Essentials.Core.Fusion
}
catch (Exception e)
{
Debug.Console(1, this, "Error parsing Custom Properties response: {0}", e);
Debug.LogMessage(LogEventLevel.Debug, this, "Error parsing Custom Properties response: {0}", e);
}
//PrintRoomInfo();
//getRoomInfoBusy = false;
@@ -928,7 +929,7 @@ namespace PepperDash.Essentials.Core.Fusion
protected void FusionRoomSchedule_DeviceExtenderSigChange(DeviceExtender currentDeviceExtender,
SigEventArgs args)
{
Debug.Console(2, this, "Scehdule Response Event: {0}\n Sig: {1}\nFusionResponse:\n{2}", args.Event,
Debug.LogMessage(LogEventLevel.Verbose, this, "Scehdule Response Event: {0}\n Sig: {1}\nFusionResponse:\n{2}", args.Event,
args.Sig.Name, args.Sig.StringValue);
@@ -980,7 +981,7 @@ namespace PepperDash.Essentials.Core.Fusion
}
else if (element.Name == "Event")
{
Debug.Console(2, this, "Event Found:\n{0}", element.OuterXml);
Debug.LogMessage(LogEventLevel.Verbose, this, "Event Found:\n{0}", element.OuterXml);
var reader = new XmlReader(element.OuterXml);
@@ -1024,12 +1025,12 @@ namespace PepperDash.Essentials.Core.Fusion
}
catch (Exception e)
{
Debug.Console(1, this, "Error parsing ScheduleResponse: {0}", e);
Debug.LogMessage(LogEventLevel.Debug, this, "Error parsing ScheduleResponse: {0}", e);
}
}
else if (args.Sig == FusionRoom.ExtenderRoomViewSchedulingDataReservedSigs.CreateResponse)
{
Debug.Console(2, this, "Create Meeting Response Event: {0}\n Sig: {1}\nFusionResponse:\n{2}", args.Event,
Debug.LogMessage(LogEventLevel.Verbose, this, "Create Meeting Response Event: {0}\n Sig: {1}\nFusionResponse:\n{2}", args.Event,
args.Sig.Name, args.Sig.StringValue);
}
}
@@ -1043,16 +1044,16 @@ namespace PepperDash.Essentials.Core.Fusion
{
if (_currentSchedule.Meetings.Count > 0)
{
Debug.Console(1, this, "Today's Schedule for '{0}'\n", Room.Name);
Debug.LogMessage(LogEventLevel.Debug, this, "Today's Schedule for '{0}'\n", Room.Name);
foreach (var e in _currentSchedule.Meetings)
{
Debug.Console(1, this, "Subject: {0}", e.Subject);
Debug.Console(1, this, "Organizer: {0}", e.Organizer);
Debug.Console(1, this, "MeetingID: {0}", e.MeetingID);
Debug.Console(1, this, "Start Time: {0}", e.dtStart);
Debug.Console(1, this, "End Time: {0}", e.dtEnd);
Debug.Console(1, this, "Duration: {0}\n", e.DurationInMinutes);
Debug.LogMessage(LogEventLevel.Debug, this, "Subject: {0}", e.Subject);
Debug.LogMessage(LogEventLevel.Debug, this, "Organizer: {0}", e.Organizer);
Debug.LogMessage(LogEventLevel.Debug, this, "MeetingID: {0}", e.MeetingID);
Debug.LogMessage(LogEventLevel.Debug, this, "Start Time: {0}", e.dtStart);
Debug.LogMessage(LogEventLevel.Debug, this, "End Time: {0}", e.dtEnd);
Debug.LogMessage(LogEventLevel.Debug, this, "Duration: {0}\n", e.DurationInMinutes);
}
}
}
@@ -1110,7 +1111,7 @@ namespace PepperDash.Essentials.Core.Fusion
}
else
{
Debug.Console(1, this, "WARNING: Config source list '{0}' not found for room '{1}'",
Debug.LogMessage(LogEventLevel.Debug, this, "WARNING: Config source list '{0}' not found for room '{1}'",
Room.SourceListKey, Room.Key);
}
}
@@ -1144,18 +1145,18 @@ namespace PepperDash.Essentials.Core.Fusion
e.UsageEndTime.ToString("yyyy-MM-dd"), e.UsageEndTime.ToString("HH:mm:ss"),
@group, deviceTracker.Parent.Name, e.MinutesUsed, "-", currentMeetingId);
Debug.Console(1, this, "Device usage for: {0} ended at {1}. In use for {2} minutes",
Debug.LogMessage(LogEventLevel.Debug, this, "Device usage for: {0} ended at {1}. In use for {2} minutes",
deviceTracker.Parent.Name, e.UsageEndTime, e.MinutesUsed);
FusionRoom.DeviceUsage.InputSig.StringValue = deviceUsage;
Debug.Console(1, this, "Device usage string: {0}", deviceUsage);
Debug.LogMessage(LogEventLevel.Debug, this, "Device usage string: {0}", deviceUsage);
}
protected void TryAddRouteActionSigs(string attrName, uint attrNum, string routeKey, Device pSrc)
{
Debug.Console(2, this, "Creating attribute '{0}' with join {1} for source {2}",
Debug.LogMessage(LogEventLevel.Verbose, this, "Creating attribute '{0}' with join {1} for source {2}",
attrName, attrNum, pSrc.Key);
try
{
@@ -1176,7 +1177,7 @@ namespace PepperDash.Essentials.Core.Fusion
}
catch (Exception)
{
Debug.Console(2, this, "Error creating Fusion signal {0} {1} for device '{2}'. THIS NEEDS REWORKING",
Debug.LogMessage(LogEventLevel.Verbose, this, "Error creating Fusion signal {0} {1} for device '{2}'. THIS NEEDS REWORKING",
attrNum, attrName, pSrc.Key);
}
}
@@ -1205,7 +1206,7 @@ namespace PepperDash.Essentials.Core.Fusion
//var keyNum = ExtractNumberFromKey(dev.Key);
//if (keyNum == -1)
//{
// Debug.Console(1, this, "WARNING: Cannot link device '{0}' to numbered Fusion monitoring attributes",
// Debug.LogMessage(LogEventLevel.Debug, this, "WARNING: Cannot link device '{0}' to numbered Fusion monitoring attributes",
// dev.Key);
// continue;
//}
@@ -1277,7 +1278,7 @@ namespace PepperDash.Essentials.Core.Fusion
sigD.InputSig.BoolValue = smd.CommunicationMonitor.Status == MonitorStatus.IsOk;
smd.CommunicationMonitor.StatusChange +=
(o, a) => { sigD.InputSig.BoolValue = a.Status == MonitorStatus.IsOk; };
Debug.Console(0, this, "Linking '{0}' communication monitor to Fusion '{1}'", dev.Key, attrName);
Debug.LogMessage(LogEventLevel.Information, this, "Linking '{0}' communication monitor to Fusion '{1}'", dev.Key, attrName);
}
}
}
@@ -1306,7 +1307,7 @@ namespace PepperDash.Essentials.Core.Fusion
var defaultDisplay = hasDefaultDisplay.DefaultDisplay as DisplayBase;
if (defaultDisplay == null)
{
Debug.Console(1, this, "Cannot link null display to Fusion because default display is null");
Debug.LogMessage(LogEventLevel.Debug, this, "Cannot link null display to Fusion because default display is null");
return;
}
@@ -1374,7 +1375,7 @@ namespace PepperDash.Essentials.Core.Fusion
}
catch (Exception e)
{
Debug.Console(1, this, "Error setting up display in Fusion: {0}", e);
Debug.LogMessage(LogEventLevel.Debug, this, "Error setting up display in Fusion: {0}", e);
}
}
@@ -1467,7 +1468,7 @@ namespace PepperDash.Essentials.Core.Fusion
if (md != null)
{
_errorMessageRollUp.AddMonitor(md.CommunicationMonitor);
Debug.Console(2, this, "Adding '{0}' to room's overall error monitor",
Debug.LogMessage(LogEventLevel.Verbose, this, "Adding '{0}' to room's overall error monitor",
md.CommunicationMonitor.Parent.Key);
}
}
@@ -1704,19 +1705,19 @@ namespace PepperDash.Essentials.Core.Fusion
{
try
{
Debug.Console(0, "Adding Fusion Static Asset '{0}' to slot {1} with GUID: '{2}'", name, number, instanceId);
Debug.LogMessage(LogEventLevel.Information, "Adding Fusion Static Asset '{0}' to slot {1} with GUID: '{2}'", name, number, instanceId);
fr.AddAsset(eAssetType.StaticAsset, number, name, type, instanceId);
return fr.UserConfigurableAssetDetails[number].Asset as FusionStaticAsset;
}
catch (InvalidOperationException ex)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Error creating Static Asset for device: '{0}'. Check that multiple devices don't have missing or duplicate uid properties in configuration. /r/nError: {1}", name, ex);
Debug.LogMessage(LogEventLevel.Information, "Error creating Static Asset for device: '{0}'. Check that multiple devices don't have missing or duplicate uid properties in configuration. /r/nError: {1}", name, ex);
return null;
}
catch (Exception e)
{
Debug.Console(2, Debug.ErrorLogLevel.Error, "Error creating Static Asset: {0}", e);
Debug.LogMessage(LogEventLevel.Verbose, "Error creating Static Asset: {0}", e);
return null;
}
}
@@ -1726,7 +1727,7 @@ namespace PepperDash.Essentials.Core.Fusion
{
try
{
Debug.Console(0, "Adding Fusion Occupancy Sensor Asset '{0}' to slot {1} with GUID: '{2}'", name, number,
Debug.LogMessage(LogEventLevel.Information, "Adding Fusion Occupancy Sensor Asset '{0}' to slot {1} with GUID: '{2}'", name, number,
instanceId);
fr.AddAsset(eAssetType.OccupancySensor, number, name, type, instanceId);
@@ -1734,12 +1735,12 @@ namespace PepperDash.Essentials.Core.Fusion
}
catch (InvalidOperationException ex)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Error creating Static Asset for device: '{0}'. Check that multiple devices don't have missing or duplicate uid properties in configuration. Error: {1}", name, ex);
Debug.LogMessage(LogEventLevel.Information, "Error creating Static Asset for device: '{0}'. Check that multiple devices don't have missing or duplicate uid properties in configuration. Error: {1}", name, ex);
return null;
}
catch (Exception e)
{
Debug.Console(2, Debug.ErrorLogLevel.Error, "Error creating Static Asset: {0}", e);
Debug.LogMessage(LogEventLevel.Error, "Error creating Static Asset: {0}", e);
return null;
}
}

View File

@@ -1,17 +1,18 @@
extern alias Full;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Full.Newtonsoft.Json;
using Full.Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Devices;
using Serilog.Events;
namespace PepperDash.Essentials.Core.Fusion
{
@@ -38,7 +39,7 @@ namespace PepperDash.Essentials.Core.Fusion
if (device is RoomOnToDefaultSourceWhenOccupied)
{
Debug.Console(1, "Mapping Room on via Occupancy values from Fusion");
Debug.LogMessage(LogEventLevel.Debug, "Mapping Room on via Occupancy values from Fusion");
var devProps = JsonConvert.DeserializeObject<RoomOnToDefaultSourceWhenOccupiedConfig>(deviceConfig.Properties.ToString());
@@ -89,18 +90,18 @@ namespace PepperDash.Essentials.Core.Fusion
// Set the room name
if (!string.IsNullOrEmpty(roomInfo.Name))
{
Debug.Console(1, "Current Room Name: {0}. New Room Name: {1}", deviceConfig.Name, roomInfo.Name);
Debug.LogMessage(LogEventLevel.Debug, "Current Room Name: {0}. New Room Name: {1}", deviceConfig.Name, roomInfo.Name);
// Set the name in config
deviceConfig.Name = roomInfo.Name;
Debug.Console(1, "Room Name Successfully Changed.");
Debug.LogMessage(LogEventLevel.Debug, "Room Name Successfully Changed.");
}
// Set the help message
var helpMessage = roomInfo.FusionCustomProperties.FirstOrDefault(p => p.ID.Equals("RoomHelpMessage"));
if (helpMessage != null)
{
//Debug.Console(1, "Current Help Message: {0}. New Help Message: {1}", deviceConfig.Properties["help"]["message"].Value<string>(ToString()), helpMessage.CustomFieldValue);
//Debug.LogMessage(LogEventLevel.Debug, "Current Help Message: {0}. New Help Message: {1}", deviceConfig.Properties["help"]["message"].Value<string>(ToString()), helpMessage.CustomFieldValue);
deviceConfig.Properties["helpMessage"] = (string)helpMessage.CustomFieldValue;
}
}
@@ -113,7 +114,7 @@ namespace PepperDash.Essentials.Core.Fusion
}
catch (Exception e)
{
Debug.Console(1, "FusionCustomPropetiesBridge: Error mapping properties: {0}", e);
Debug.LogMessage(LogEventLevel.Debug, "FusionCustomPropetiesBridge: Error mapping properties: {0}", e);
}
}
}

Some files were not shown because too many files have changed in this diff Show More