public PingDiagnosticResponse TranslateMessage(string message, PingDiagnosticResponseChannel channel)
        {
            logger.LogTrace($"Received message: {message}");

            if (message.StartsWith("MCPONG|"))
            {
                logger.LogDebug("Recognized as a pong command");
                return(TranslateResponseData(message, channel));
            }

            //Fallback
            logger.LogDebug($"{message} is not a valid pong, ignoring");
            return(null);
        }
        private PingLookupResult ProcessPongResponse(string response, PingDiagnosticResponseChannel channel)
        {
            var msgData = transformer.TranslateMessage(response, channel);

            logger.LogDebug($"Handing Firebase request: {msgData.SessionIdentifier}|{msgData.PingIdentifier}");
            if (string.IsNullOrWhiteSpace(msgData?.PingIdentifier))
            {
                logger.LogDebug($"Found invalid response: {response} "); return(PingLookupResult.Invalid);
            }
            if (msgData.SessionIdentifier != this.sessionIdentifier)
            {
                logger.LogDebug($"Found responses for other session: {msgData.SessionIdentifier} "); return(PingLookupResult.NotMySession);
            }

            return(container.RegisterTripResponse(msgData));
        }
        private PingDiagnosticResponse TranslateResponseData(string response, PingDiagnosticResponseChannel channel)
        {
            string[] spl = response.Split("|");

            return(new PingDiagnosticResponse()
            {
                Channel = channel,
                SessionIdentifier = spl.GetFromIndex(ResponseIdxSessionId),
                PingIdentifier = spl.GetFromIndex(ResponseIdxPingId),
                ReceiverIdentifier = spl.GetFromIndex(ResponseIdxDeviceId),
                ReceiveTime = DateTime.Now,
                DeviceDetail = new PingDiagnosticResponseDeviceDetail()
                {
                    CellularType = spl.GetFromIndex(ResponseIdxCellularType),
                    CellularProvider = spl.GetFromIndex(ResponseIdxCellularProvider),
                    CellularSignalStrength = spl.GetIntFromIndex(ResponseIdxCellularSignal),
                    WifiProvider = spl.GetFromIndex(ResponseIdxWifiProvider),
                    WifiSignalStrength = spl.GetIntFromIndex(ResponseIdWifiStrength),
                    BatteryPercentage = spl.GetIntFromIndex(ResponseIdxBattery),
                    VolumePercentage = spl.GetIntFromIndex(ResponseIdxVolume),
                }
            });
        }