From 37e0486cf76c56ba98b8b0be699fe58b203e84e3 Mon Sep 17 00:00:00 2001 From: Gregg Date: Sat, 23 Oct 2021 22:58:16 -0500 Subject: [PATCH] Removed all unusable TV Characteristics from TV and Input Source Services But retained the actual Characteristics in the Characteristics lists in the event that they may be activated in the Home App in the future. --- Other Examples/Television/Television.ino | 70 +++++++++--------------- src/Span.h | 17 +----- 2 files changed, 28 insertions(+), 59 deletions(-) diff --git a/Other Examples/Television/Television.ino b/Other Examples/Television/Television.ino index 4079c11..2349019 100644 --- a/Other Examples/Television/Television.ino +++ b/Other Examples/Television/Television.ino @@ -92,7 +92,6 @@ struct TV_Source : Service::InputSource{ SpanCharacteristic *configName = new Characteristic::ConfiguredName("HDMI 12",true); TV_Source() : Service::InputSource(){ -// new Characteristic::ConfiguredName("HDMI 12"); new Characteristic::Identifier(12); new Characteristic::IsConfigured(1); } @@ -134,76 +133,59 @@ void setup() { new Characteristic::Identify(); new Service::HAPProtocolInformation(); - new Characteristic::Version("1.1.0"); + new Characteristic::Version("1.1.0"); - SpanService *hdmi1 = new Service::InputSource(); + SpanService *hdmi1 = new Service::InputSource(); // Source included in Selection List, but excluded from Settings Screen new Characteristic::ConfiguredName("HDMI 1"); new Characteristic::Identifier(1); SpanService *hdmi2 = new Service::InputSource(); new Characteristic::ConfiguredName("HDMI 2"); new Characteristic::Identifier(2); - new Characteristic::IsConfigured(0); + new Characteristic::IsConfigured(0); // Source excluded from both the Selection List and the Settings Screen SpanService *hdmi3 = new Service::InputSource(); new Characteristic::ConfiguredName("HDMI 3"); new Characteristic::Identifier(3); - new Characteristic::IsConfigured(1); + new Characteristic::IsConfigured(1); // Source included in both the Selection List and the Settings Screen SpanService *hdmi4 = new Service::InputSource(); new Characteristic::ConfiguredName("HDMI 4"); new Characteristic::Identifier(4); - new Characteristic::IsConfigured(1); - new Characteristic::TargetVisibilityState(0); - new Characteristic::CurrentVisibilityState(0); + new Characteristic::IsConfigured(1); // Source included in the Settings Screen... + new Characteristic::CurrentVisibilityState(1); // ...but excluded from the Selection List SpanService *hdmi5 = new Service::InputSource(); new Characteristic::ConfiguredName("HDMI 5"); new Characteristic::Identifier(5); - new Characteristic::IsConfigured(1); - new Characteristic::TargetVisibilityState(1); - new Characteristic::CurrentVisibilityState(1); + new Characteristic::IsConfigured(1); // Source included in the Settings Screen... + new Characteristic::CurrentVisibilityState(0); // ...and included in the Selection List SpanService *hdmi6 = new Service::InputSource(); new Characteristic::ConfiguredName("HDMI 6"); new Characteristic::Identifier(6); - new Characteristic::IsConfigured(0); - new Characteristic::TargetVisibilityState(0); - new Characteristic::CurrentVisibilityState(0); + new Characteristic::IsConfigured(0); // Source excluded from both the Selection List and the Settings Screen + new Characteristic::CurrentVisibilityState(0); // If IsConfigured(0) is specified, CurrentVisibilityState() has no effect SpanService *hdmi7 = new Service::InputSource(); new Characteristic::ConfiguredName("HDMI 7"); - new Characteristic::Identifier(0); - new Characteristic::IsConfigured(1); - new Characteristic::TargetVisibilityState(0); - new Characteristic::CurrentVisibilityState(0); + new Characteristic::Identifier(7); + new Characteristic::IsConfigured(1); // Source included in the Settings Screen... + new Characteristic::CurrentVisibilityState(0); // ...and included in the Selection List... + new Characteristic::TargetVisibilityState(0); // ...and a "checked" checkbox is provided on the Settings Screen that can be used to toggle CurrentVisibilityState() SpanService *hdmi8 = new Service::InputSource(); new Characteristic::ConfiguredName("HDMI 8"); new Characteristic::Identifier(8); - new Characteristic::TargetVisibilityState(0); - new Characteristic::CurrentVisibilityState(0); - + new Characteristic::IsConfigured(1); // Source included in the Settings Screen... + new Characteristic::CurrentVisibilityState(1); // ...but excluded from the Selection List... + new Characteristic::TargetVisibilityState(1); // ...and an "un-checked" checkbox is provided on the Settings Screen that can be used to toggle CurrentVisibilityState() + SpanService *hdmi9 = new Service::InputSource(); new Characteristic::ConfiguredName("HDMI 9"); - new Characteristic::Identifier(9); - new Characteristic::TargetVisibilityState(1); - new Characteristic::CurrentVisibilityState(1); - - SpanService *hdmi10 = new Service::InputSource(); - new Characteristic::ConfiguredName("HDMI 10"); - new Characteristic::IsConfigured(1); + new Characteristic::IsConfigured(1); // Source included in the Settings Screen... + new Characteristic::CurrentVisibilityState(0); // ...but without an Identifier() set, the Source is excluded from the Selection List regardless of CurrentVisibilityState(0) new Characteristic::TargetVisibilityState(0); - new Characteristic::CurrentVisibilityState(0); - - SpanService *hdmi11 = new Service::InputSource(); - new Characteristic::ConfiguredName("HDMI 11"); - new Characteristic::Identifier(11); - new Characteristic::IsConfigured(1); - new Characteristic::TargetVisibilityState(0); - new Characteristic::CurrentVisibilityState(0); - - SpanService *hdmi12 = new TV_Source(); (new Service::Television()) ->addLink(hdmi1) @@ -215,14 +197,12 @@ void setup() { ->addLink(hdmi7) ->addLink(hdmi8) ->addLink(hdmi9) - ->addLink(hdmi10) - ->addLink(hdmi11) - ->addLink(hdmi12) ; - new Characteristic::Active(1); - new Characteristic::ConfiguredName("AdvancedTV"); - new Characteristic::ActiveIdentifier(3); - new Characteristic::RemoteKey(); + new Characteristic::Active(0); // TV On/Off (set to Off at start-up) + new Characteristic::ConfiguredName("Test TV"); // Name of TV + new Characteristic::ActiveIdentifier(3); // Sets HDMI 3 on start-up + new Characteristic::RemoteKey(); // Used to receive button presses from the Remote Control widget + new Characteristic::PowerModeSelection(); // Adds "" option to Selection Screen } diff --git a/src/Span.h b/src/Span.h index 59c3326..29bdac9 100644 --- a/src/Span.h +++ b/src/Span.h @@ -201,12 +201,9 @@ namespace Service { struct InputSource : SpanService { InputSource() : SpanService{"D9","InputSource"}{ OPT(ConfiguredName); - OPT(InputSourceType); - REQ(IsConfigured); - REQ(CurrentVisibilityState); - OPT(Name); + OPT(IsConfigured); OPT(Identifier); - OPT(InputDeviceType); + OPT(CurrentVisibilityState); OPT(TargetVisibilityState); }}; @@ -335,15 +332,7 @@ namespace Service { OPT(ConfiguredNameStatic); OPT(ActiveIdentifier); OPT(RemoteKey); - OPT(PowerModeSelection); - - OPT(SleepDiscoveryMode); - OPT(Brightness); - OPT(ClosedCaptions); - OPT(CurrentMediaState); - OPT(TargetMediaState); - OPT(Name); - OPT(PictureMode); + OPT(PowerModeSelection); }}; struct TemperatureSensor : SpanService { TemperatureSensor() : SpanService{"8A","TemperatureSensor"}{