Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class ProtoParser(private val outputDir: File) {
private val suppressAnnotation = AnnotationSpec
.builder(Suppress::class)
.addMember("%S", "KDocUnresolvedReference") // IntelliJ's seems to get confused with canonical names
.addMember("%S", "RemoveRedundantQualifierName") // Full Qualifier names are fine
.addMember("%S", "RedundantVisibilityModifier") // KotlinPoet is an explicit API generator
.addMember("%S", "unused") // All methods could be used.
.build()
Expand Down Expand Up @@ -85,6 +86,8 @@ class ProtoParser(private val outputDir: File) {
private fun buildClass(file: File, service: Service) {
val protoFileName = transformProtoFileName(file.name)

val parentPathName = file.parentFile.name

// Class Builder
val steamUnifiedMessagesClassName = ClassName(
"in.dragonbra.javasteam.steam.handlers.steamunifiedmessages",
Expand Down Expand Up @@ -129,7 +132,7 @@ class ProtoParser(private val outputDir: File) {
// HAS Response
numResponse++
val className = ClassName(
packageName = "in.dragonbra.javasteam.protobufs.steamclient.$protoFileName",
packageName = "in.dragonbra.javasteam.protobufs.$parentPathName.$protoFileName",
method.responseType
)
responseBlock.addStatement(
Expand All @@ -141,7 +144,7 @@ class ProtoParser(private val outputDir: File) {
// NO Response
numNotification++
val className = ClassName(
packageName = "in.dragonbra.javasteam.protobufs.steamclient.$protoFileName",
packageName = "in.dragonbra.javasteam.protobufs.$parentPathName.$protoFileName",
method.requestType
)
notificationBlock.addStatement(
Expand Down Expand Up @@ -192,7 +195,7 @@ class ProtoParser(private val outputDir: File) {
.addParameter(
"request",
ClassName(
packageName = "in.dragonbra.javasteam.protobufs.steamclient.$protoFileName",
packageName = "in.dragonbra.javasteam.protobufs.$parentPathName.$protoFileName",
method.requestType
)
)
Expand All @@ -207,14 +210,14 @@ class ProtoParser(private val outputDir: File) {
packageName = "in.dragonbra.javasteam.steam.handlers.steamunifiedmessages.callback",
"ServiceMethodResponse"
).parameterizedBy(
ClassName.bestGuess("in.dragonbra.javasteam.protobufs.steamclient.$protoFileName.${method.responseType}.Builder")
ClassName.bestGuess("in.dragonbra.javasteam.protobufs.$parentPathName.$protoFileName.${method.responseType}.Builder")
)
)
)
funcBuilder.addStatement(
format = "return unifiedMessages!!.sendMessage(\n%T.Builder::class.java,\n%S,\nrequest\n)",
ClassName(
packageName = "in.dragonbra.javasteam.protobufs.steamclient.$protoFileName",
packageName = "in.dragonbra.javasteam.protobufs.$parentPathName.$protoFileName",
method.responseType
),
"${service.name}.${method.methodName}#1"
Expand All @@ -223,7 +226,7 @@ class ProtoParser(private val outputDir: File) {
funcBuilder.addStatement(
format = "unifiedMessages!!.sendNotification<%T.Builder>(\n%S,\nrequest\n)",
ClassName(
packageName = "in.dragonbra.javasteam.protobufs.steamclient.$protoFileName",
packageName = "in.dragonbra.javasteam.protobufs.$parentPathName.$protoFileName",
method.requestType
),
"${service.name}.${method.methodName}#1"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package `in`.dragonbra.javasteam.steam.handlers.steamclientcommunication

import `in`.dragonbra.javasteam.util.JavaSteamAddition

/**
* Information about all active Steam clients on the network.
* @param sessions A list of active client sessions with their logon information.
* @param refetchIntervalSec The recommended interval in seconds to refetch this data.
*/
@JavaSteamAddition
data class AllClientLogonInfo(
val sessions: List<AllClientLogonInfoSession>,
val refetchIntervalSec: Int,
) {
override fun toString(): String = """
AllClientLogonInfo(
sessions=$sessions,
refetchIntervalSec=$refetchIntervalSec
)
""".trimIndent()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package `in`.dragonbra.javasteam.steam.handlers.steamclientcommunication

import `in`.dragonbra.javasteam.enums.EGamingDeviceType
import `in`.dragonbra.javasteam.enums.EOSType
import `in`.dragonbra.javasteam.enums.ESteamRealm
import `in`.dragonbra.javasteam.util.JavaSteamAddition

/**
* Describes an active device running a Steam client.
* @param clientInstanceId Instance ID used to send remote signals to this client.
* @param protocolVersion Protocol version of the client.
* @param osName Name of the installed OS, such as "Linux 6.x".
* @param machineName Name of the device, such as "steamdeck".
* @param osType Type of installed OS, such as [EOSType].Linux6x.
* @param deviceType Type of the device, such as [EGamingDeviceType].StandardPC.
* @param realm Realm of the session. See [ESteamRealm].
*/
@JavaSteamAddition
data class AllClientLogonInfoSession(
val clientInstanceId: Long,
val protocolVersion: Int,
val osName: String,
val machineName: String,
val osType: EOSType,
val deviceType: EGamingDeviceType,
val realm: ESteamRealm,
) {
override fun toString(): String = """
AllClientLogonInfoSession(
clientInstanceId=$clientInstanceId,
protocolVersion=$protocolVersion,
osName='$osName',
machineName='$machineName',
osType=$osType,
deviceType=$deviceType,
realm=$realm
)
""".trimIndent()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package `in`.dragonbra.javasteam.steam.handlers.steamclientcommunication

import `in`.dragonbra.javasteam.util.JavaSteamAddition

/**
* Response containing the list of applications on a Steam client and related metadata.
* @param bytesAvailable Total bytes of storage available on the client.
* @param apps List of application data for each app on the client.
* @param clientInfo Information about the client machine and state.
* @param refetchIntervalSecFull Recommended interval in seconds to refetch the complete app list.
* @param refetchIntervalSecChanging Recommended interval in seconds to refetch when apps are changing state.
* @param refetchIntervalSecUpdating Recommended interval in seconds to refetch when apps are updating.
*/
@JavaSteamAddition
data class ClientAppList(
val bytesAvailable: Long,
val apps: List<ClientAppListAppData>,
val clientInfo: ClientInfo,
val refetchIntervalSecFull: Int,
val refetchIntervalSecChanging: Int,
val refetchIntervalSecUpdating: Int,
) {
override fun toString(): String = """
ClientAppList(
bytesAvailable=$bytesAvailable,
apps=$apps,
clientInfo=$clientInfo,
refetchIntervalSecFull=$refetchIntervalSecFull,
refetchIntervalSecChanging=$refetchIntervalSecChanging,
refetchIntervalSecUpdating=$refetchIntervalSecUpdating
)
""".trimIndent()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
package `in`.dragonbra.javasteam.steam.handlers.steamclientcommunication

import `in`.dragonbra.javasteam.util.JavaSteamAddition

/**
* Detailed information about an application on a Steam client, including its download/update state.
* @param appid The application ID.
* @param app The application name.
* @param category The application category.
* @param appType The type of application (e.g., game, tool, DLC).
* @param numDownloading Number of items currently downloading for this app.
* @param bytesDownloadRate Current download speed in bytes per second.
* @param bytesDownloaded Total bytes already downloaded.
* @param bytesToDownload Total bytes that need to be downloaded.
* @param dlcs List of DLC data associated with this application.
* @param favorite Whether this app is marked as a favorite.
* @param autoUpdate Whether automatic updates are enabled for this app.
* @param installed Whether the app is currently installed.
* @param downloadPaused Whether the download is currently paused.
* @param changing Whether the app is currently changing state (installing/updating/uninstalling).
* @param availableOnPlatform Whether the app is available on the current platform.
* @param bytesStaged Bytes that have been staged for installation.
* @param bytesToStage Total bytes that need to be staged.
* @param bytesRequired Total disk space required for the app.
* @param sourceBuildId The current build ID installed.
* @param targetBuildId The build ID being updated to.
* @param estimatedSecondsRemaining Estimated time remaining for the current operation in seconds.
* @param queuePosition Position in the download queue (-1 if not queued).
* @param uninstalling Whether the app is currently being uninstalled.
* @param rtTimeScheduled Scheduled time for the update/download (Unix timestamp).
* @param running Whether the app is currently running.
* @param updatePercentage Progress percentage of the current update/download operation.
*/
@JavaSteamAddition
data class ClientAppListAppData(
val appid: Int,
val app: String,
val category: String,
val appType: String,
val numDownloading: Int,
val bytesDownloadRate: Int,
val bytesDownloaded: Long,
val bytesToDownload: Long,
val dlcs: List<ClientAppListDlcData>,
val favorite: Boolean,
val autoUpdate: Boolean,
val installed: Boolean,
val downloadPaused: Boolean,
val changing: Boolean,
val availableOnPlatform: Boolean,
val bytesStaged: Long,
val bytesToStage: Long,
val bytesRequired: Long,
val sourceBuildId: Int,
val targetBuildId: Int,
val estimatedSecondsRemaining: Int,
val queuePosition: Int,
val uninstalling: Boolean,
val rtTimeScheduled: Int,
val running: Boolean,
val updatePercentage: Int,
) {
override fun toString(): String = """
ClientAppListAppData(
appid=$appid,
app='$app',
category='$category',
appType='$appType',
numDownloading=$numDownloading,
bytesDownloadRate=$bytesDownloadRate,
bytesDownloaded=$bytesDownloaded,
bytesToDownload=$bytesToDownload,
dlcs=$dlcs,
favorite=$favorite,
autoUpdate=$autoUpdate,
installed=$installed,
downloadPaused=$downloadPaused,
changing=$changing,
availableOnPlatform=$availableOnPlatform,
bytesStaged=$bytesStaged,
bytesToStage=$bytesToStage,
bytesRequired=$bytesRequired,
sourceBuildId=$sourceBuildId,
targetBuildId=$targetBuildId,
estimatedSecondsRemaining=$estimatedSecondsRemaining,
queuePosition=$queuePosition,
uninstalling=$uninstalling,
rtTimeScheduled=$rtTimeScheduled,
running=$running,
updatePercentage=$updatePercentage
)
""".trimIndent()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package `in`.dragonbra.javasteam.steam.handlers.steamclientcommunication

import `in`.dragonbra.javasteam.util.JavaSteamAddition

/**
* Information about a DLC (Downloadable Content) associated with an application.
* @param appId The DLC's application ID.
* @param app The DLC's name.
* @param installed Installation status (0 = not installed, non-zero = installed).
*/
@JavaSteamAddition
data class ClientAppListDlcData(
val appId: Int,
val app: String,
val installed: Int,
) {
override fun toString(): String = """
ClientAppListDlcData(
appId=$appId,
app='$app',
installed=$installed
)
""".trimIndent()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package `in`.dragonbra.javasteam.steam.handlers.steamclientcommunication

import `in`.dragonbra.javasteam.util.JavaSteamAddition

/**
* Information about a Steam client machine and its current state.
* @param packageVersion The Steam client package version.
* @param os The operating system of the client.
* @param machineName The name of the client machine.
* @param ipPublic The client's public IP address.
* @param ipPrivate The client's private/local IP address.
* @param bytesAvailable Available disk space in bytes.
* @param runningGames List of games currently running on the client.
* @param protocolVersion The protocol version being used.
* @param clientCommVersion The client communication protocol version.
* @param localUsers List of local user IDs logged into the client.
*/
@JavaSteamAddition
data class ClientInfo(
val packageVersion: Int,
val os: String,
val machineName: String,
val ipPublic: String,
val ipPrivate: String,
val bytesAvailable: Long,
val runningGames: List<RunningGames>,
val protocolVersion: Int,
val clientCommVersion: Int,
val localUsers: List<Int>,
) {
override fun toString(): String = """
ClientInfo(
packageVersion=$packageVersion,
os='$os',
machineName='$machineName',
ipPublic='$ipPublic',
ipPrivate='$ipPrivate',
bytesAvailable=$bytesAvailable,
runningGames=$runningGames,
protocolVersion=$protocolVersion,
clientCommVersion=$clientCommVersion,
localUsers=$localUsers
)
""".trimIndent()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package `in`.dragonbra.javasteam.steam.handlers.steamclientcommunication

/**
* Logon information for a specific Steam client.
* @param protocolVersion Protocol version of the client.
* @param os Operating system name.
* @param machineName Name of the client machine.
*/
data class ClientLogonInfo(
val protocolVersion: Int,
val os: String,
val machineName: String,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package `in`.dragonbra.javasteam.steam.handlers.steamclientcommunication

import `in`.dragonbra.javasteam.util.JavaSteamAddition

@JavaSteamAddition
enum class InstalledAppsFilter {
/**
* Return everything, including not installed apps
*/
None,

/**
* Return only apps that are "in progress" - downloading, updating, scheduled
*/
Changing,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package `in`.dragonbra.javasteam.steam.handlers.steamclientcommunication

import `in`.dragonbra.javasteam.util.JavaSteamAddition

/**
* Information about a game currently running on a Steam client.
* @param appId The application ID of the running game.
* @param extraInfo Additional information about the running game.
* @param timeRunningSec Duration in seconds that the game has been running.
*/
@JavaSteamAddition
data class RunningGames(
val appId: Int,
val extraInfo: String,
val timeRunningSec: Int,
) {
override fun toString(): String = """
RunningGames(
appId=$appId,
extraInfo='$extraInfo',
timeRunningSec=$timeRunningSec
)
""".trimIndent()
}
Loading