Warning, /network/kdeconnect-android/src/org/kde/kdeconnect/Plugins/BatteryPlugin/DeviceBatteryInfo.kt is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2021 Philip Cohn-Cort <cliabhach@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 package org.kde.kdeconnect.Plugins.BatteryPlugin 0008 0009 import org.kde.kdeconnect.NetworkPacket 0010 0011 /** 0012 * Specialised data representation of the packets received by [BatteryPlugin]. 0013 * 0014 * Constants for [thresholdEvent] may be found in [BatteryPlugin]. 0015 * 0016 * @param currentCharge the amount of charge in the device's battery 0017 * @param isCharging whether the device is charging 0018 * @param thresholdEvent status classifier (used to indicate low battery, etc.) 0019 * @see BatteryPlugin.isLowBattery 0020 */ 0021 data class DeviceBatteryInfo( 0022 val currentCharge: Int, 0023 val isCharging: Boolean, 0024 val thresholdEvent: Int, 0025 ) { 0026 0027 /** 0028 * For use with packets of type [BatteryPlugin.PACKET_TYPE_BATTERY]. 0029 */ 0030 constructor(np: NetworkPacket) : 0031 this( 0032 np.getInt("currentCharge"), 0033 np.getBoolean("isCharging"), 0034 np.getInt("thresholdEvent", 0) 0035 ) 0036 }