Skip to content

Commit

Permalink
chore: code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
swapnil-musale committed Nov 15, 2024
1 parent 394c2c4 commit 5f211ac
Show file tree
Hide file tree
Showing 27 changed files with 157 additions and 365 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,19 @@ actual class DeviceInfoXState {

actual val isAndroid: Boolean
get() = true

actual val androidInfo: AndroidInfo
get() = androidInfoData

actual val isIos: Boolean
get() = false

actual val iosInfo: IosInfo
get() = throw Exception("trying to access incorrect platform info")

actual val isDesktop: Boolean
get() = false

actual val desktopInfo: DesktopInfo
get() = throw Exception("trying to access incorrect platform info")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ interface GraphicsCard {
val deviceId: String
val vendor: String
val versionInfo: String
val VRam: Long
val vRam: Long
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,7 @@ interface Hardware {
val soundCards: List<SoundCard>
val graphicsCards: List<GraphicsCard>

fun getNetworkIfs(
includeLocalInterfaces: Boolean
): List<NetworkIF>

fun getUsbDevices(
tree: Boolean
): List<UsbDevice>
fun getNetworkIfs(includeLocalInterfaces: Boolean): List<NetworkIF>

fun getUsbDevices(tree: Boolean): List<UsbDevice>
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface NetworkIF {
val displayName: String
val ifAlias: String
val ifOperStatus: IfOperStatus
val MTU: Long
val mtu: Long
val macaddr: String
val ipv4addr: Array<String>
val subnetMasks: Array<Short>
Expand Down Expand Up @@ -72,5 +72,4 @@ enum class IfOperStatus(
* Down due to state of lower-layer interface(s).
*/
LOWER_LAYER_DOWN(7);

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,11 @@ interface CentralProcessor {
val contextSwitches: Long
val interrupts: Long

fun getSystemCpuLoadBetweenTicks(
oldTickets: LongArray
) : Double
fun getSystemCpuLoadBetweenTicks(oldTickets: LongArray): Double

fun getSystemLoadAverage(
nelem: Int
): DoubleArray
fun getSystemLoadAverage(nelem: Int): DoubleArray

fun getSystemCpuLoad(
delay: Long
): Double

fun getProcessorCpuLoadBetweenTicks(
oldTickets: Array<LongArray>
): DoubleArray
fun getSystemCpuLoad(delay: Long): Double

fun getProcessorCpuLoadBetweenTicks(oldTickets: Array<LongArray>): DoubleArray
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ interface FileSystem {
fun getFileStores(
localOnly: Boolean
): List<OSFileStore>

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,11 @@ interface OperatingSystem {
val services: List<OSService>
val sessions: List<OSSession>

fun getProcesses(
): List<OSProcess>
fun getProcesses(): List<OSProcess>

fun getProcesses(
pids: Collection<Int>
): List<OSProcess>
fun getProcesses(pids: Collection<Int>): List<OSProcess>

fun getProcess(
pid: Int
) : OSProcess

fun getOSDesktopWindows(
visibleOnly: Boolean
) : List<OSDesktopWindow>
fun getProcess(pid: Int): OSProcess

fun getOSDesktopWindows(visibleOnly: Boolean): List<OSDesktopWindow>
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.devx.kdeviceinfo.model.desktop.operatingsystem.protocols

interface InternetProtocolStats {
val TCPv4Stats: TcpStats
val TCPv6Stats: TcpStats
val UDPv4Stats: UdpStats
val UDPv6Stats: UdpStats
val IPConnection: List<IPConnection>
val tcpV4Stats: TcpStats
val tcpV6Stats: TcpStats
val udpV4Stats: UdpStats
val udpV6Stats: UdpStats
val ipConnections: List<IPConnection>
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,19 @@ actual class DeviceInfoXState {

actual val isDesktop: Boolean
get() = true

actual val desktopInfo: DesktopInfo
get() = desktopInfoData

actual val isAndroid: Boolean
get() = false

actual val androidInfo: AndroidInfo
get() = throw Exception("trying to access incorrect platform info")

actual val isIos: Boolean
get() = false

actual val iosInfo: IosInfo
get() = throw Exception("trying to access incorrect platform info")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,16 @@ class DesktopInfoImpl : DesktopInfo {
private val systemInfo by lazy { SystemInfo() }

private val operatingSystemImpl by lazy {
OperatingSystemImpl(
systemInfo = systemInfo
)
OperatingSystemImpl(systemInfo = systemInfo)
}

private val hardwareImpl by lazy {
HardwareImpl(
systemInfo = systemInfo
)
HardwareImpl(systemInfo = systemInfo)
}

override val operatingSystem: OperatingSystem
get() = operatingSystemImpl

override val hardware: Hardware
get() = hardwareImpl

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@ package com.devx.kdeviceinfo.model.hardware

import com.devx.kdeviceinfo.model.desktop.hardware.Display

class DisplayImpl(
override val edid: ByteArray
) : Display
class DisplayImpl(override val edid: ByteArray) : Display
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ class GraphicsCardImpl(
override val deviceId: String,
override val vendor: String,
override val versionInfo: String,
override val VRam: Long
override val vRam: Long
) : GraphicsCard
Loading

0 comments on commit 5f211ac

Please sign in to comment.