@@ -23,12 +23,13 @@ public sealed class OpenShockLiveControlClient : IOpenShockLiveControlClient, IA
23
23
Converters = { new CustomJsonStringEnumConverter ( ) }
24
24
} ;
25
25
26
- private readonly string _gateway ;
27
- private readonly Guid _deviceId ;
26
+ public string Gateway { get ; }
27
+ public Guid DeviceId { get ; }
28
+
28
29
private readonly string _authToken ;
29
30
private readonly ILogger < OpenShockLiveControlClient > _logger ;
30
31
private ClientWebSocket ? _clientWebSocket = null ;
31
-
32
+
32
33
public event Func < Task > ? OnDeviceNotConnected ;
33
34
public event Func < Task > ? OnDeviceConnected ;
34
35
public event Func < Task > ? OnDispose ;
@@ -43,8 +44,8 @@ private Channel<BaseRequest<LiveRequestType>>
43
44
public OpenShockLiveControlClient ( string gateway , Guid deviceId , string authToken ,
44
45
ILogger < OpenShockLiveControlClient > logger )
45
46
{
46
- _gateway = gateway ;
47
- _deviceId = deviceId ;
47
+ Gateway = gateway ;
48
+ DeviceId = deviceId ;
48
49
_authToken = authToken ;
49
50
_logger = logger ;
50
51
@@ -57,7 +58,9 @@ public OpenShockLiveControlClient(string gateway, Guid deviceId, string authToke
57
58
private ValueTask QueueMessage ( BaseRequest < LiveRequestType > data ) =>
58
59
_channel . Writer . WriteAsync ( data , _dispose . Token ) ;
59
60
60
- private readonly AsyncUpdatableVariable < WebsocketConnectionState > _state = new ( WebsocketConnectionState . Disconnected ) ;
61
+ private readonly AsyncUpdatableVariable < WebsocketConnectionState > _state =
62
+ new ( WebsocketConnectionState . Disconnected ) ;
63
+
61
64
public IAsyncUpdatable < WebsocketConnectionState > State => _state ;
62
65
63
66
private async Task MessageLoop ( )
@@ -108,7 +111,7 @@ private async Task<OneOf<Success, NotFound, Shutdown, Reconnecting>> ConnectAsyn
108
111
_logger . LogInformation ( "Connecting to websocket...." ) ;
109
112
try
110
113
{
111
- await _clientWebSocket . ConnectAsync ( new Uri ( $ "wss://{ _gateway } /1/ws/live/{ _deviceId } ") , _linked . Token ) ;
114
+ await _clientWebSocket . ConnectAsync ( new Uri ( $ "wss://{ Gateway } /1/ws/live/{ DeviceId } ") , _linked . Token ) ;
112
115
113
116
_logger . LogInformation ( "Connected to websocket" ) ;
114
117
_state . Value = WebsocketConnectionState . Connected ;
@@ -344,6 +347,7 @@ public Task Run(Task? function, CancellationToken cancellationToken = default, [
344
347
} , TaskContinuationOptions . OnlyOnFaulted ) ;
345
348
346
349
private readonly AsyncUpdatableVariable < ulong > _latency = new ( 0 ) ;
350
+
347
351
public IAsyncUpdatable < ulong > Latency => _latency ;
348
352
349
353
public async Task SendFrame ( ClientLiveFrame frame )
0 commit comments