Skip to content

Commit

Permalink
Add OSCQuery to Sender and Receiver
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey004 committed Jan 8, 2025
1 parent 56fce2e commit 28d6db0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
16 changes: 7 additions & 9 deletions Quest2-VRC.Core/Services/Receiver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using VRC.OSCQuery;
using Extensions = VRC.OSCQuery.Extensions;
using VRC.OSCQuery;

namespace Quest2_VRC

Expand All @@ -36,16 +36,14 @@ public static async void Run()
RGBController.SendRGBRawData(0, 0, 0); // Set to Black
var tcpPort = Extensions.GetAvailableTcpPort();
var udpPort = Extensions.GetAvailableUdpPort();


var oscQuery = new OSCQueryServiceBuilder()
.WithTcpPort(tcpPort)
.WithUdpPort(udpPort)
.WithServiceName("Quest2-VRC OSCQuery Receiver")
.WithDefaults()
.Build();
.WithTcpPort(tcpPort)
.WithUdpPort(udpPort)
.WithServiceName("Quest2-VRC OSCQuery Receiver")
.WithDefaults()
.Build();


oscQuery.AddEndpoint<int>("/avatar", Attributes.AccessValues.WriteOnly);

string json = File.ReadAllText("vars.json");
JObject vars = JObject.Parse(json);
Expand Down
11 changes: 10 additions & 1 deletion Quest2-VRC.Core/Services/Sender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Net.Sockets;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using VRC.OSCQuery;
using static Quest2_VRC.ADB;
using static Quest2_VRC.Logger;
using static Quest2_VRC.PacketSender;
Expand All @@ -30,7 +31,7 @@ public class Global

public static async void Run(bool wirlessmode, bool audioEnadled, bool disableerrmsg, string hostip)
{

var tcpPort = Extensions.GetAvailableTcpPort();
string json = File.ReadAllText("vars.json");
JObject vars = JObject.Parse(json);

Expand All @@ -43,6 +44,14 @@ public static async void Run(bool wirlessmode, bool audioEnadled, bool disableer
{
Uport = Extensions.GetAvailableUdpPort();
}
var oscQuery = new OSCQueryServiceBuilder()
.WithTcpPort(tcpPort)
.WithUdpPort(Uport)
.WithServiceName("Quest2-VRC OSCQuery Sender")
.WithDefaults()
.Build();

oscQuery.AddEndpoint<int>("/avatar", Attributes.AccessValues.WriteOnly);
Console.WriteLine("OSC UDP port is {0}", Uport);
await questwd(Uport, wirlessmode, audioEnadled, disableerrmsg, hostip);
}
Expand Down

0 comments on commit 28d6db0

Please sign in to comment.