Updated for the BLE specfication v0.11.
https://ktag.clubk.club/Technology/BLE/KTag%20Beacon%20Specification%20v0.11.pdf
This commit is contained in:
parent
da2ed2d1dd
commit
010361066e
3 changed files with 11 additions and 11 deletions
|
@ -155,9 +155,9 @@ val advertisementPresets = listOf(
|
|||
"KTag Status Packet"
|
||||
),
|
||||
AdvertisementPreset(
|
||||
"06 Configuration",
|
||||
"06 Parameters",
|
||||
byteArrayOf(
|
||||
0x06.toByte(), // Packet Type: Configuration
|
||||
0x06.toByte(), // Packet Type: Parameters
|
||||
0x00.toByte(), // Event Number
|
||||
0xFF.toByte(),
|
||||
0xFF.toByte(),
|
||||
|
@ -179,7 +179,7 @@ val advertisementPresets = listOf(
|
|||
0x00.toByte(),
|
||||
0x00.toByte(), // Value 2: Unused
|
||||
),
|
||||
"KTag Configuration Packet"
|
||||
"KTag Parameters Packet"
|
||||
),
|
||||
AdvertisementPreset(
|
||||
"07 Hello",
|
||||
|
@ -401,7 +401,7 @@ fun TitleBox() {
|
|||
)
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
Text(
|
||||
text = "based on the specification 0.10",
|
||||
text = "based on the specification 0.11",
|
||||
style = MaterialTheme.typography.labelSmall.copy(fontSize = 16.sp)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ object PacketFieldUtils {
|
|||
0x03.toByte() -> "Tag"
|
||||
0x04.toByte() -> "Console"
|
||||
0x05.toByte() -> "Status"
|
||||
0x06.toByte() -> "Configuration"
|
||||
0x06.toByte() -> "Parameters"
|
||||
0x07.toByte() -> "Hello"
|
||||
else -> "Packet Type"
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ object PacketFieldUtils {
|
|||
else -> ""
|
||||
}
|
||||
|
||||
0x06.toByte() -> when (index) { // Configuration packet fields
|
||||
0x06.toByte() -> when (index) { // Parameters packet fields
|
||||
in 10..15 -> "Target Address"
|
||||
16 -> "Subtype"
|
||||
17, 18 -> "Key 1"
|
||||
|
@ -145,7 +145,7 @@ object PacketFieldUtils {
|
|||
else -> Color(0xFFF5F5F5) // Light gray for undefined fields
|
||||
}
|
||||
|
||||
0x06.toByte() -> when (index) { // Configuration packet
|
||||
0x06.toByte() -> when (index) { // Parameters packet
|
||||
in 10..15 -> Color(0xFFE6F3FF) // Target Address - Light blue
|
||||
16 -> Color(0xFFFFF3E6) // Subtype - Light orange
|
||||
17, 18 -> Color(0xFFF3E6FF) // Key 1 - Light purple
|
||||
|
|
|
@ -203,7 +203,7 @@ fun PacketCard(address: String, packet: KTagPacket) {
|
|||
PacketRow("State", packet.systemKState.toString())
|
||||
}
|
||||
|
||||
is ConfigurationPacket -> {
|
||||
is ParametersPacket -> {
|
||||
PacketRow("Target", packet.targetAddress)
|
||||
PacketRow("Subtype", packet.subtype.toString())
|
||||
PacketRow("Key 1", packet.key1.toString())
|
||||
|
@ -312,9 +312,9 @@ data class StatusPacket(
|
|||
val systemKState: Int
|
||||
) : KTagPacket()
|
||||
|
||||
data class ConfigurationPacket(
|
||||
data class ParametersPacket(
|
||||
override val type: Int,
|
||||
override val typeName: String = "Configuration",
|
||||
override val typeName: String = "Parameters",
|
||||
override val eventNumber: Int,
|
||||
val targetAddress: String,
|
||||
val subtype: Int,
|
||||
|
@ -387,7 +387,7 @@ fun parseKTagPacket(data: ByteArray): KTagPacket {
|
|||
systemKState = data[22].toInt()
|
||||
)
|
||||
|
||||
0x06 -> ConfigurationPacket(
|
||||
0x06 -> ParametersPacket(
|
||||
type = type,
|
||||
eventNumber = eventNumber,
|
||||
targetAddress = bytesToMacAddress(data, 6),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue