You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// create a telnet client with a list of IP addressesvartelnetClient=new SimpleTelnetClient("192.168.1.43","192.168.1.45","192.168.1.47");// create a HEOS clientvarheosClient=new HeosClient(telnetClient, CancellationToken.None);// subscribe to all events
heosClient.EventObservable.Subscribe(o =>{switch(o){case PlayerStateChangedEvent e: Console.WriteLine($"Player {e.PlayerId}: state = {e.State}");break;case PlayerNowPlayingProgressEvent e: Console.WriteLine($"Player {e.PlayerId}: position = {e.Position}");break;}});// subscribe to the volume changed event
heosClient.EventObservable.OfType<PlayerVolumeChangedEvent>().Subscribe(e =>{ Console.WriteLine($"Player {e.PlayerId}: volume = {e.Volume}, mute = {e.Mute}");});varcommandProcessor=new CommandProcessor(heosClient);// request change eventsvarsetChangeEventsCommandResponse=await commandProcessor.Execute(new SetChangeEventsCommand(true));// get all players, ensure there is at least 1 playervargetPlayersResponse=await commandProcessor.Execute(new GetPlayersCommand(),r => r.Any(),5, TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(2));if(getPlayersResponse.Success){
Console.WriteLine("Found players: "+string.Join(", ", getPlayersResponse.Payload.Select(p => p.Name)));}