Skip to content

Commit f9561e2

Browse files
committed
Add CLI commands to force connect and disconnect of streaming host
1 parent 33a98fd commit f9561e2

6 files changed

Lines changed: 41 additions & 9 deletions

File tree

Common/common_app_define.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// common application definitions
44
#define APPNAME L"LGTV Companion"
5-
#define APP_VERSION L"5.1.4"
5+
#define APP_VERSION L"5.2.0"
66
#define CONFIG_FILE L"config.json"
77
#define LOG_FILE L"log.txt"
88
#define WINDOW_CLASS_UNIQUE L"YOLOx0x0x0181818"

Docs/Commandline.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,13 @@ LGTVcli.exe -ok backlight -get_system_settings picture [\"backlight\"]
6161
"LGTV Companion.exe" -poweroff
6262
```
6363
## Application commands (LGTV Companion only)
64-
- *-autodisable* - temporarily disable the automatic management, i.e. to stop processing power events for device(s). This is effective until next restart of the service.
65-
- *-autoenable* - temporarily enable the application's automatic management of a device. This is effective until next restart of the service.
66-
- *-clearlog* - clear the application log. This takes no further arguments
67-
- *-idle* - trigger User Idle Mode / screen blanking, as if the user was away from the PC until User Idle Mode triggered. This is a global setting and takes no further arguments.
68-
- *-unidle* - disable the screen blanking, as if the user returned to the PC. This is a global setting and takes no further arguments.
64+
- *-autodisable* - temporarily disable the automatic management, i.e. to stop processing power events for device(s). This is effective until next restart of the service.
65+
- *-autoenable* - temporarily enable the application's automatic management of a device. This is effective until next restart of the service.
66+
- *-streaming_connect* - force remote client connect (when streaming support is enabled). Typically used in the connect command buffer of the streaming server.
67+
- *-streaming_disconnect* - force remote client disconnect (when streaming support is enabled). Typically used in in the disconnect command buffer of the streaming server.
68+
- *-clearlog* - clear the application log.
69+
- *-idle* - trigger User Idle Mode / screen blanking, as if the user was away from the PC until User Idle Mode triggered.
70+
- *-unidle* - disable the screen blanking, as if the user returned to the PC.
6971

7072
#### Examples:
7173
*Power on Device1 and then disable automatic management of Device1*

LGTV Companion Service/companion.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,34 @@ void Companion::Impl::ipcCallback(std::wstring message, bool recursive)
931931
event(EVENT_FORCE_BLANKSCREEN, grabDevices(words, 1));
932932
continue;
933933
}
934+
else if (command == "streaming_connect")
935+
{
936+
if (!prefs_.remote_streaming_host_support_)
937+
{
938+
INFO_("CLI", "Cannot force streaming client connect. Support for remote streaming is disabled.");
939+
continue;
940+
}
941+
if (windows_power_status_on_)
942+
INFO_("CLI", "Forced streaming client connect. All managed devices will %1%", prefs_.remote_streaming_host_prefer_power_off_ ? "power OFF" : "be blanked");
943+
else
944+
INFO_("CLI", "Forced streaming client connect. Global power status is OFF.");
945+
event(EVENT_SYSTEM_REMOTE_CONNECT);
946+
continue;
947+
}
948+
else if (command == "streaming_disconnect")
949+
{
950+
if (!prefs_.remote_streaming_host_support_)
951+
{
952+
INFO_("CLI", "Cannot force streaming client disconnect. Support for remote streaming is disabled.");
953+
continue;
954+
}
955+
if (windows_power_status_on_)
956+
INFO_("CLI", "Forced streaming client disconnect. All managed devices will power ON");
957+
else
958+
INFO_("CLI", "Forced streaming client connect. Global power status is OFF.");
959+
event(EVENT_SYSTEM_REMOTE_DISCONNECT);
960+
continue;
961+
}
934962
else if (command.find("sethdmi") == 0) // SET HDMI INPUT
935963
{
936964
int cmd_offset = 1;

LGTV Companion Setup/Product.wxs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<!-- When publishing updated version, make sure to update "ProductCode" GUID and "Version" -->
22
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util" xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui" >
33
<Package Name="LGTV Companion" Language="1033"
4-
Version="5.1.4" Manufacturer="J Persson" UpgradeCode="0BA17E5B-11CE-491D-B1A1-05DD2D9F610A" InstallerVersion="500"
5-
ProductCode="{512675CB-2F56-4F78-AA69-DD542B6498BA}">
4+
Version="5.2.0" Manufacturer="J Persson" UpgradeCode="0BA17E5B-11CE-491D-B1A1-05DD2D9F610A" InstallerVersion="500"
5+
ProductCode="{82B8A1B9-3208-4E6A-96C7-B77491B4BB41}">
66
<SummaryInformation Description="LGTV Companion installer" />
77
<Media Id="1" Cabinet="LGTVapp.cab" EmbedCab="yes" />
88
<MajorUpgrade DowngradeErrorMessage="A newer version of LGTV Companion is already installed." />
8 Bytes
Binary file not shown.

LGTV Companion UI/lgtv_companion_ui.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2131,7 +2131,9 @@ LRESULT CALLBACK WndOptionsProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
21312131
"power saver. \n\n"
21322132
"The option to support remote streaming hosts will power off or blank the screen of managed devices while the system is acting as streaming host or being remoted into. Supported "
21332133
"hosts include Nvidia gamestream, Moonlight, Sunshine, Apollo, Steam Link and RDP. \n\nPlease note that the devices will remain powered off / blanked until the remote connection is disconnected. \n\n"
2134-
"NOTE! Support for detecting Sunshine/Apollo streaming host require Sunshine/Apollo to be installed (i.e. not portable install) and Sunshine/Apollo logging level be at minimum on level \"Info\" (default)",
2134+
"NOTE! Support for detecting Sunshine/Apollo require Sunshine/Apollo to be installed (i.e. not portable) and Sunshine/Apollo logging level be at minimum on level \"Info\" (default)\n\n"
2135+
"NOTE! The user can manually force LGTV Companion to detect a connection or disconnect with CLI-commands: -streaming_connect and -streaming_disconnect. This can for example be used with most streaming hosts' "
2136+
"command buffers that are performed before streaming and after streaming stopped.",
21352137
L"Andvanced power options", MB_OK | MB_ICONINFORMATION);
21362138
}
21372139
// explain the multi-monitor conf

0 commit comments

Comments
 (0)