Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/SwitchifyPc.App/BluetoothRuntime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public BluetoothRuntime(
PairingApprovalManager pairingApprovalManager,
BluetoothStatusTracker statusTracker,
IBluetoothRemoteFrameProcessor frameProcessor,
Func<Action<BluetoothHelperEvent>, IBluetoothTransportServer> serverFactory,
Func<Action<BluetoothTransportEvent>, IBluetoothTransportServer> serverFactory,
Func<Func<Task>, Task> dispatchAsync,
Func<Task> endControlSessionAsync,
Action<string, string?, string?> recordDiagnostic,
Expand Down Expand Up @@ -96,7 +96,7 @@ public void Dispose()
}
}

private void HandleTransportEvent(BluetoothHelperEvent transportEvent)
private void HandleTransportEvent(BluetoothTransportEvent transportEvent)
{
if (transportEvent is BluetoothMessageEvent message)
{
Expand All @@ -107,7 +107,7 @@ private void HandleTransportEvent(BluetoothHelperEvent transportEvent)
_ = dispatchAsync(() => ProcessTransportEventAsync(transportEvent));
}

private async Task ProcessTransportEventAsync(BluetoothHelperEvent transportEvent)
private async Task ProcessTransportEventAsync(BluetoothTransportEvent transportEvent)
{
switch (transportEvent)
{
Expand Down
88 changes: 0 additions & 88 deletions src/SwitchifyPc.Core/Bluetooth/BluetoothControlFrameProcessor.cs

This file was deleted.

180 changes: 0 additions & 180 deletions src/SwitchifyPc.Core/Bluetooth/BluetoothHelperProtocol.cs

This file was deleted.

25 changes: 25 additions & 0 deletions src/SwitchifyPc.Core/Bluetooth/BluetoothTransportProtocol.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using SwitchifyPc.Protocol;

namespace SwitchifyPc.Core.Bluetooth;

public abstract record BluetoothTransportEvent(string Type);
public sealed record BluetoothReadyEvent() : BluetoothTransportEvent("ready");
public sealed record BluetoothUnavailableEvent(string Reason) : BluetoothTransportEvent("unavailable");
public sealed record BluetoothConnectedEvent(string ConnectionId, string Label) : BluetoothTransportEvent("connected");
public sealed record BluetoothMessageEvent(string ConnectionId, BluetoothFrame Frame) : BluetoothTransportEvent("message");
public sealed record BluetoothDisconnectedEvent(string ConnectionId, string Reason) : BluetoothTransportEvent("disconnected");
public sealed record BluetoothDiagnosticEvent(string Event) : BluetoothTransportEvent("diagnostic");
public sealed record BluetoothSystemStatusEvent(
bool AdapterPresent,
string RadioState,
bool? IsLowEnergySupported,
bool? IsPeripheralRoleSupported) : BluetoothTransportEvent("systemStatus");
public sealed record BluetoothErrorEvent(string Reason) : BluetoothTransportEvent("error");

public static class BluetoothGattProtocol
{
public static readonly Guid ServiceUuid = Guid.Parse("7a78f7e8-1d6d-4d92-9ef0-1f89d3db21f4");
public static readonly Guid RxCharacteristicUuid = Guid.Parse("7a78f7e9-1d6d-4d92-9ef0-1f89d3db21f4");
public static readonly Guid TxCharacteristicUuid = Guid.Parse("7a78f7ea-1d6d-4d92-9ef0-1f89d3db21f4");
public static readonly Guid StatusCharacteristicUuid = Guid.Parse("7a78f7eb-1d6d-4d92-9ef0-1f89d3db21f4");
}
Loading