예제 #1
0
 public async void OnPairedDeviceLogin(object sender, AuthenticatedWebSocketEventArgs e)
 {
     lock (_syncRootLoggedInPairedDevices)
     {
         _loggedInPairedDevices.Add(e.Connection);
     }
     await _socket.SendJson(
         HostJsonApiObjectFactory.CreatePairedPeripheralLoggedOnMessage(e.Connection.Device.Id));
 }
예제 #2
0
 public async void OnPairedDeviceLogoff(object sender, AuthenticatedWebSocketEventArgs e)
 {
     if (e.Connection.Device.Id == _partner?.Device.Id)
     {
         lock (_syncRootPartner)
         {
             _partner = null;
         }
         await _socket.SendJson(SharedJsonApiObjectFactory.CreatePartnerDisconnected());
     }
     lock (_syncRootLoggedInPairedDevices)
     {
         _loggedInPairedDevices.Remove(e.Connection);
     }
     await _socket.SendJson(
         HostJsonApiObjectFactory.CreatePairedPeripheralLoggedOffMessage(e.Connection.Device.Id));
 }