/// <summary> /// called when we locally modify a client's latency (aka we need to notify the server) /// </summary> /// <param name="client"></param> private void _OnLocalClientLatencyModified(JsonRpcData.Client client) { Task t = Task.Run(async() => { await _SetClientLatencyAsync(client.id, client.config.latency).ConfigureAwait(false); }); }
/// <summary> /// called when we locally modify client volume data (aka we need to notify the server) /// </summary> /// <param name="client"></param> private void _OnLocalVolumeDataModified(JsonRpcData.Client client) { Task t = Task.Run(async() => { await _SetClientVolumeAsync(client.id, client.config.volume).ConfigureAwait(false); }); }
/// <summary> /// Called when snapserver reports client latency update /// </summary> /// <param name="id">client id</param> /// <param name="latency">new latency</param> private void _ClientLatencyChanged(string id, int latency) { JsonRpcData.Client client = _GetClient(id); if (client != null) { client.config.latency = latency; } }
/// <summary> /// Called when snapserver reports client name update /// </summary> /// <param name="id">client id</param> /// <param name="name">new name</param> private void _ClientNameChanged(string id, string name) { JsonRpcData.Client client = _GetClient(id); if (client != null) { client.SERVER_SetName(name); } }
/// <summary> /// Called when snapserver reports client volume update /// </summary> /// <param name="id">client id</param> /// <param name="volume">new volume object</param>\ private void _ClientVolumeChanged(string id, Volume volume) { JsonRpcData.Group group = null; JsonRpcData.Client client = _GetClient(id, out group); if (client != null) { client.config.SERVER_SetVolume(volume); // groups are listening to the clients' volume object for change events, // in order to update the group volume slider. when receiving a volume // update from the client, the group needs to re-subscribe to this event group.SubscribeToClientEvent(client); // also resubscribe local event for volume changes, so the server gets // updated when the user modifies the volume client.config.volume.CLIENT_OnModified += () => { _OnLocalVolumeDataModified(client); }; } }
/// <summary> /// called when we locally remove a client (aka we need to notify the server) /// </summary> /// <param name="client"></param> private void _OnLocalClientRemoved(JsonRpcData.Client client) { Task t = Task.Run(async() => { await _RemoveClientAsync(client.id).ConfigureAwait(false); }); }
/// <summary> /// Called when snapserver reports client connect/disconnect /// </summary> /// <param name="client">the client</param> private void _ClientConnectedOrDisconnected(string id, JsonRpcData.Client client) { JsonRpcData.Client c = _GetClient(id); c.SERVER_SetConnected(client.connected); c.SERVER_SetLastSeen(client.lastSeen); }