PepperDash / epi-videoCodec-ciscoExtended

Port and extension of the Essentials-Included CiscoSparkCodec EssentialsDevice
MIT License
0 stars 1 forks source link

[FEATURE]-UserInterface Extensions UnSetValue #6

Open cdenig opened 1 year ago

cdenig commented 1 year ago

Is your feature request related to a problem? Please describe. Group Buttons widgets rely upon the UnsetValue command to release all buttons, otherwise the last-pressed button remains highlighted. Group Button widgets also highlight the last-pressed Button by default without feedback from macro logic or control systems. As a user, it would be useful to not see the last-pressed button highlighted at all times. It implies the backing logic is in a particular state and does not show if the backing logic state has changed.

"xCommand UserInterface Extensions Widget UnSetValue WidgetId: "mygroup""

Describe the solution you'd like Update UpdateWidget function so that if value argument is empty OR has a a pre-defined value, the UnSetValue command is sent instead of SetValue.

Describe alternatives you've considered Do not use Group Button widgets.

Additional context none

Rodney-Driscoll commented 1 year ago

Here's how i'd fix that. In CiscoRoomOsCodec.cs


        public void UpdateWidget(string val) // "/blinds /open"
        {
            var arr_ = val.Split('/');
            string id_ = String.Empty;
            switch (arr_.Length)
            {
                case (2): // "/blinds"
                    id_ = arr_[1].Trim();
                    ClearWidget(id_);
                    break;
                case (3): // "/blinds /open"
                    id_ = arr_[1].Trim();
                    var val_ = arr_[2].Trim();
                    UpdateWidget<string>(id_, val_);
                    break;
            }
        }

        public void ClearWidget(string WidgetId)
        {
            var command = String.Format("xCommand UserInterface Extensions Widget UnSetValue WidgetId: \"{0}\"", WidgetId);
            Console.WriteLine(command);
        }

There is an active branch working on the same class so i'm not going to cause repo conflicts by adding this myself.