Skip to content

Commit

Permalink
Add #34
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey004 committed Jan 12, 2025
1 parent 28d6db0 commit 66f8a35
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions Quest2-VRC.Core/Services/Sender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ namespace Quest2_VRC
{
public static class Sender
{


public class Global
{
public static float Hbatlevelint;
Expand All @@ -27,6 +29,7 @@ public class Global
public static int gputempint;
public static float WifiInt;
public static bool LowHMDBat;
public static bool HMDCharging;
}

public static async void Run(bool wirlessmode, bool audioEnadled, bool disableerrmsg, string hostip)
Expand Down Expand Up @@ -67,6 +70,7 @@ public static async Task questwd(int Uport, bool wirlessmode, bool audioEnadled,
bool audioPlayedHMD = false;
bool audioPlayedL = false;
bool audioPlayedR = false;
bool HMDCharging = false;

while (true)
{
Expand All @@ -81,11 +85,14 @@ public static async Task questwd(int Uport, bool wirlessmode, bool audioEnadled,
int gputempint = 0;
string WifiRSSI = null;
int WifiInt = 0;




ConsoleOutputReceiver Hbat_receiver = new ConsoleOutputReceiver();
await client.ExecuteRemoteCommandAsync("dumpsys CompanionService | grep Battery", device, Hbat_receiver);
ConsoleOutputReceiver HCrh_receiver = new ConsoleOutputReceiver();
await client.ExecuteRemoteCommandAsync("dumpsys CompanionService | grep Charging | grep -v 'Fast Charging'", device, HCrh_receiver);
ConsoleOutputReceiver Rbat_receiver = new ConsoleOutputReceiver();
await client.ExecuteRemoteCommandAsync("dumpsys OVRRemoteService | grep Right", device, Rbat_receiver);
ConsoleOutputReceiver Lbat_receiver = new ConsoleOutputReceiver();
Expand All @@ -106,6 +113,7 @@ public static async Task questwd(int Uport, bool wirlessmode, bool audioEnadled,
}

var Hbat_match = Regex.Match(Hbat_receiver.ToString(), @"\d+", RegexOptions.RightToLeft);
var HCrh_match = Regex.Match(HCrh_receiver.ToString(), @"Charging: (?<value>true|false)", RegexOptions.RightToLeft);
var Rbat_match = Regex.Match(Rbat_receiver.ToString(), @"\d+", RegexOptions.RightToLeft);
var Lbat_match = Regex.Match(Lbat_receiver.ToString(), @"\d+", RegexOptions.RightToLeft);
var cputemp_match = Regex.Match(cputemp.ToString(), @"\d+");
Expand All @@ -117,6 +125,9 @@ public static async Task questwd(int Uport, bool wirlessmode, bool audioEnadled,
Lbatlevelint = int.Parse(Lbat_match.Value);
cputempint = int.Parse(cputemp_match.Value);
gputempint = int.Parse(gputemp_match.Value);
HMDCharging = bool.Parse(HCrh_match.Groups["value"].Value);




if (Hbatlevelint < 25)
Expand Down Expand Up @@ -184,6 +195,7 @@ public static async Task questwd(int Uport, bool wirlessmode, bool audioEnadled,
Global.cputempint = cputempint;
Global.gputempint = gputempint;
Global.LowHMDBat = LowHMDBat;
Global.HMDCharging = HMDCharging;
Send();
await Task.Delay(5000);

Expand Down Expand Up @@ -222,8 +234,9 @@ private static async void Send()
VRChatMessage Msg5 = new VRChatMessage("LowHMDBat", Global.LowHMDBat);
VRChatMessage Msg6 = new VRChatMessage("CPUtemp", Global.cputempint);
VRChatMessage Msg7 = new VRChatMessage("GPUtemp", Global.gputempint);
SendPacket(Msg1, Msg2, Msg3, Msg4, Msg5, Msg6, Msg7);
LogToConsole("Sending HMD status", Msg1, Msg2, Msg3, Msg4, Msg5, Msg6, Msg7);
VRChatMessage Msg8 = new VRChatMessage("HMDCharging", Global.HMDCharging);
SendPacket(Msg1, Msg2, Msg3, Msg4, Msg5, Msg6, Msg7, Msg8);
LogToConsole("Sending HMD status", Msg1, Msg2, Msg3, Msg4, Msg5, Msg6, Msg7, Msg8);
}


Expand Down

0 comments on commit 66f8a35

Please sign in to comment.