{"record":{"id":"049bf9da52092456","repo":"mgth/LittleBigMouse","slug":"enter-a-vidaa-picture-setting-value-between-1000-and-1000","errorCode":null,"errorMessage":"Enter a VIDAA picture-setting value between -1000 and 1000.","messagePattern":"Enter a VIDAA picture-setting value between -1000 and 1000\\.","errorType":"validation","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"LittleBigMouse.Plugins/LittleBigMouse.Plugin.Vcp.Avalonia/HisenseVidaa/HisenseVidaaProtocol.cs","lineNumber":142,"sourceCode":"    public static string Topic(string service, string clientId, string action)\n        => $\"/remoteapp/tv/{service}/{clientId}/actions/{action}\";\n\n    /// <summary>\n    /// The token exchange is asked for on a <c>data</c> topic rather than through\n    /// <see cref=\"Topic\"/>'s <c>actions</c> namespace.\n    /// </summary>\n    public static string TokenRequestTopic(string clientId)\n        => $\"/remoteapp/tv/platform_service/{clientId}/data/gettoken\";\n\n    /// <summary>An empty refresh token asks for a first pair of tokens.</summary>\n    public static string TokenRequestPayload() => \"{\\\"refreshtoken\\\":\\\"\\\"}\";\n\n    public static string PictureSettingPayload(int menuId, int value)\n    {\n        if (menuId is < 1 or > 999)\n            throw new ArgumentOutOfRangeException(nameof(menuId), \"Enter a VIDAA picture-setting menu ID between 1 and 999.\");\n        if (value is < -1000 or > 1000)\n            throw new ArgumentOutOfRangeException(nameof(value), \"Enter a VIDAA picture-setting value between -1000 and 1000.\");\n        return JsonSerializer.Serialize(new\n        {\n            action = \"set_value\",\n            menu_id = menuId,\n            menu_value = value,\n            menu_value_type = \"int\",\n        });\n    }\n\n    public static string PictureSettingsRequestPayload()\n        => \"{\\\"action\\\":\\\"get_menu_info\\\"}\";\n\n    public static bool TryParsePictureSettings(\n        string topic,\n        string payload,\n        out IReadOnlyList<VidaaPictureSetting> settings)\n    {\n        settings = [];","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/mgth/LittleBigMouse/blob/7a42f01d47d99d223b8ee33ba4019af82adf1c48/LittleBigMouse.Plugins/LittleBigMouse.Plugin.Vcp.Avalonia/HisenseVidaa/HisenseVidaaProtocol.cs#L124-L160","documentation":"PictureSettingPayload validates the value parameter must be -1000..1000; otherwise ArgumentOutOfRangeException is thrown for value. This matches the VIDAA picture-setting slider range, so larger values would be rejected or misinterpreted by the TV.","triggerScenarios":"Calling PictureSettingPayload with value < -1000 or > 1000, e.g. passing a 0..100 UI percentage mapped incorrectly, or an unclamped user slider value.","commonSituations":"UI slider scale mismatch (e.g. 0..2000 range sent raw); combining values from different settings with different scales; unit confusion between percentage and raw menu value.","solutions":["Clamp the value to [-1000, 1000] before calling","Convert your UI scale (e.g. 0..100) to the VIDAA value range explicitly","Validate user input at the UI layer before building the payload","Check the menu item's documented value range if a setting allows a smaller range"],"exampleFix":"// before\nvar payload = HisenseVidaaProtocol.PictureSettingPayload(5, brightness); // brightness may exceed 1000\n// after\nvar v = Math.Clamp(brightness, -1000, 1000);\nvar payload = HisenseVidaaProtocol.PictureSettingPayload(5, v);","handlingStrategy":"validation","validationCode":"if (value is < -1000 or > 1000) value = Math.Clamp(value, -1000, 1000);","typeGuard":null,"tryCatchPattern":"try { payload = PictureSettingPayload(menuId, value); }\ncatch (ArgumentOutOfRangeException ex) { ui.Show(ex.ParamName + \" out of range\"); }","preventionTips":["Clamp slider values before sending","Convert UI scale to VIDAA range explicitly","Document each menu item's value range","Avoid mixing scales across settings"],"tags":["validation","argument","range","hisense-vidaa"],"backgroundTag":"argument-out-of-range","analyzedSha":"7a42f01d47d99d223b8ee33ba4019af82adf1c48","analyzedAt":"2026-09-16T00:35:00.514Z","contentChangedAt":"2026-09-16T00:35:00.514Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}