HueLibrary.Bridge.PingAsync C# (CSharp) Method

PingAsync() public method

Sends a basic command to the bridge and returns whether it receives the expected response.
public PingAsync ( ) : Task
return Task
        public async Task<BridgeConnectionStatus> PingAsync()
        {
            try
            {
                HttpResponseMessage response = await HttpGetAsync("config");
                string content = await response.Content.ReadAsStringAsync();
                if (content.Contains("zigbeechannel"))
                {
                    return BridgeConnectionStatus.Success; 
                }
                else if (content.Contains("error"))
                {
                    return BridgeConnectionStatus.Unauthorized; 
                }
                return BridgeConnectionStatus.Fail; 
            }
            catch (Exception)
            {
                return BridgeConnectionStatus.Fail; 
            }
        }