Modern Apps git

← Modern-Apps.git

cast/protocol: document public API for detekt

Commit
999ab07b5bc774075bf687f6caadaccb5d4984e8
Author
Vayun Mathur <[email protected]>
When
2026-11-17 14:42 UTC (18 days ago)
Parents
533cae8
Add concise KDoc to every public class, object, interface and
enum (including nested types) that detekt's
UndocumentedPublicClass rule flagged in this module. Docs only:
no behaviour, visibility or config changes.

Verified: ./gradlew :cast:protocol:detekt reports 0
UndocumentedPublicClass findings (pre-existing error-severity
findings in other rules, where present, are untouched), and the
module unit tests pass.

Diff

cast/protocol/src/main/java/com/vayunmathur/cast/protocol/FrameId.kt
diff --git a/cast/protocol/src/main/java/com/vayunmathur/cast/protocol/FrameId.kt b/cast/protocol/src/main/java/com/vayunmathur/cast/protocol/FrameId.ktindex 7b27bc71ea..9cb3593706 100644--- a/cast/protocol/src/main/java/com/vayunmathur/cast/protocol/FrameId.kt+++ b/cast/protocol/src/main/java/com/vayunmathur/cast/protocol/FrameId.kt@@ -32,6 +32,7 @@ value class FrameId(val value: Long) : Comparable<FrameId> {      override fun toString(): String = value.toString() +    /** Well-known [FrameId] values for the first and leader frames. */     companion object {         /** `FrameId::first()`. */         val First = FrameId(0)
cast/protocol/src/main/java/com/vayunmathur/cast/protocol/KeySchedule.kt
diff --git a/cast/protocol/src/main/java/com/vayunmathur/cast/protocol/KeySchedule.kt b/cast/protocol/src/main/java/com/vayunmathur/cast/protocol/KeySchedule.ktindex ca276240fc..808d910821 100644--- a/cast/protocol/src/main/java/com/vayunmathur/cast/protocol/KeySchedule.kt+++ b/cast/protocol/src/main/java/com/vayunmathur/cast/protocol/KeySchedule.kt@@ -59,6 +59,7 @@ class SessionKeys private constructor(secret: ByteArray) {     fun deviceProof(deviceKey: ByteArray, transcript: ByteArray): ByteArray =         hmac(deviceKeyProofKey, deviceKey + transcript) +    /** Derives [SessionKeys] from the shared session secret and defines its sizes. */     companion object {         const val SECRET_BYTES = 32         private const val CONTROL_KEY_BYTES = 32
cast/protocol/src/main/java/com/vayunmathur/cast/protocol/MediaProxy.kt
diff --git a/cast/protocol/src/main/java/com/vayunmathur/cast/protocol/MediaProxy.kt b/cast/protocol/src/main/java/com/vayunmathur/cast/protocol/MediaProxy.ktindex 11f14119a6..5afacd110d 100644--- a/cast/protocol/src/main/java/com/vayunmathur/cast/protocol/MediaProxy.kt+++ b/cast/protocol/src/main/java/com/vayunmathur/cast/protocol/MediaProxy.kt@@ -116,6 +116,7 @@ sealed interface RangeSpec { /** How an exchange ended, for the listener to log. */ sealed interface ExchangeOutcome { +    /** Outcome for a successfully served media resource and the range delivered. */     data class Served(val resourceId: String, val range: RangeSpec, val bytes: Long) : ExchangeOutcome      /** Answered with an error status. [detail] is for the log, never for the client. */@@ -301,6 +302,7 @@ class MediaProxyExchange(         output.write(head.toString().toByteArray(Charsets.ISO_8859_1))     } +    /** Result of one media-proxy exchange: its outcome and whether the connection can be reused. */     data class Result(val outcome: ExchangeOutcome, val reusable: Boolean)      /**@@ -446,6 +448,7 @@ class MediaProxyExchange(         else -> "Error"     } +    /** HTTP status codes and path parsing for [MediaProxy]. */     companion object {         private const val HTTP_BAD_REQUEST = 400         private const val HTTP_FORBIDDEN = 403@@ -457,6 +460,7 @@ class MediaProxyExchange(         private const val PERCENT_HEX_DIGITS = 3         private const val HEX_RADIX = 16 +        /** Parsed media-proxy path: capability token plus the requested resource id. */         data class ProxyPath(val token: String, val resourceId: String)          /**
cast/protocol/src/main/java/com/vayunmathur/cast/protocol/Pairing.kt
diff --git a/cast/protocol/src/main/java/com/vayunmathur/cast/protocol/Pairing.kt b/cast/protocol/src/main/java/com/vayunmathur/cast/protocol/Pairing.ktindex 1bcfcb02a8..cb91b1466e 100644--- a/cast/protocol/src/main/java/com/vayunmathur/cast/protocol/Pairing.kt+++ b/cast/protocol/src/main/java/com/vayunmathur/cast/protocol/Pairing.kt@@ -84,6 +84,7 @@ class PairingGate(private val newCode: () -> String = { PairCode.random() }) {         attemptsLeft = PairCode.MAX_ATTEMPTS     } +    /** Device-key constants and minting for [PairingGate]. */     companion object {         const val DEVICE_KEY_BYTES = 32 
cast/protocol/src/main/java/com/vayunmathur/cast/protocol/Rtcp.kt
diff --git a/cast/protocol/src/main/java/com/vayunmathur/cast/protocol/Rtcp.kt b/cast/protocol/src/main/java/com/vayunmathur/cast/protocol/Rtcp.ktindex a469754b38..ed1dcfddb3 100644--- a/cast/protocol/src/main/java/com/vayunmathur/cast/protocol/Rtcp.kt+++ b/cast/protocol/src/main/java/com/vayunmathur/cast/protocol/Rtcp.kt@@ -506,6 +506,7 @@ object Rtcp { data class PacketNack(val frameId: FrameId, val packetId: Int) {     val isWholeFrame: Boolean get() = packetId == Rtcp.ALL_PACKETS_LOST +    /** Factories for [PacketNack]. */     companion object {         /** Nothing at all arrived for this frame, so every packet of it is missing. */         fun wholeFrame(frameId: FrameId): PacketNack = PacketNack(frameId, Rtcp.ALL_PACKETS_LOST)
cast/protocol/src/main/java/com/vayunmathur/cast/protocol/Streams.kt
diff --git a/cast/protocol/src/main/java/com/vayunmathur/cast/protocol/Streams.kt b/cast/protocol/src/main/java/com/vayunmathur/cast/protocol/Streams.ktindex b6c91ac560..c7296b102d 100644--- a/cast/protocol/src/main/java/com/vayunmathur/cast/protocol/Streams.kt+++ b/cast/protocol/src/main/java/com/vayunmathur/cast/protocol/Streams.kt@@ -106,6 +106,7 @@ data class Negotiation(     val video: NegotiatedStream? get() = streams.firstOrNull { it.kind == StreamKind.Video }     val hasVideo: Boolean get() = video != null +    /** Builds the negotiated stream set both cast ends derive from the handshake. */     companion object {         /**          * Build the routes both ends will use, from the two halves of the handshake.