/// <summary>
        /// Gets the battery status.
        /// </summary>
        /// <returns>The battery info.</returns>
        public static BatteryInfo GetBatteryStatus()
        {
            if (TermuxBridge.TryExecuteObject("termux-battery-status", null,
                                              out BatteryInfo batteryInfo))
            {
                return(batteryInfo);
            }

            return(null);
        }
        /// <summary>
        /// Gets the audio capabilities.
        /// </summary>
        /// <returns>The audio capabilities info.</returns>
        public static AudioCapabilitiesInfo GetAudioInfo()
        {
            if (TermuxBridge.TryExecuteObject("termux-audio-info", null,
                                              out AudioCapabilitiesInfo audioCapabilities))
            {
                return(audioCapabilities);
            }

            return(null);
        }
        /// <summary>
        /// Sets the display brightness.
        /// </summary>
        /// <returns><c>true</c>, if display brightness was set, <c>false</c> otherwise.</returns>
        /// <param name="brightness">Brightness value. 0-255 range, pass -1 to turn on auto brightness.</param>
        public static bool SetDisplayBrightness(int brightness)
        {
            string arg;

            if (brightness == -1)
            {
                arg = "auto";
            }
            else
            {
                if (brightness < 0 || brightness > 255)
                {
                    throw new ArgumentOutOfRangeException(nameof(brightness));
                }
                arg = brightness.ToString();
            }

            if (TermuxBridge.TryExecute($"termux-brightness", arg, out string output))
            {
                if (output.Length == 0)
                {
                    return(true);
                }

                try
                {
                    TermuxAPIError error = JsonConvert.DeserializeObject <TermuxAPIError>(output);
                    Console.WriteLine("Termux API has returned an error: " + error.Message);
                    return(false);
                }
                catch (Exception)
                {
                    Console.WriteLine("Termux API has returned an error (non-JSON format): " + output);
                    return(false);
                }
            }

            return(false);
        }
 /// <summary>
 /// Gets the call log.
 /// </summary>
 /// <returns>The call log.</returns>
 /// <param name="offset">Offset.</param>
 /// <param name="limit">Limit.</param>
 public static CallLog[] GetCallLog(int offset = 0, int limit = 10)
 {
     if (TermuxBridge.TryExecuteObject($"termux-call-log", $"-o {offset} -l {limit}",
                                       out CallLog[] call_log))