Skip to content

Commit

Permalink
Move kotlin lib tlv/jsontlv to package matter (#29757)
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca authored and pull[bot] committed Feb 3, 2024
1 parent 1b59aa8 commit 2524825
Show file tree
Hide file tree
Showing 170 changed files with 718 additions and 718 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/java-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ jobs:
$JAVA_PATH/bin/java \
-cp 'third_party/java_deps/artifacts/*:out/linux-x64-tests/lib/src/controller/java/*' \
org.junit.runner.JUnitCore \
chip.tlv.TlvWriterTest \
chip.tlv.TlvReadWriteTest \
chip.tlv.TlvReaderTest \
chip.jsontlv.JsonToTlvToJsonTest \
matter.tlv.TlvWriterTest \
matter.tlv.TlvReadWriteTest \
matter.tlv.TlvReaderTest \
matter.jsontlv.JsonToTlvToJsonTest \
matter.onboardingpayload.ManualCodeTest \
matter.onboardingpayload.QRCodeTest
- name: Build Java Matter Controller and all clusters app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ import chip.devicecontroller.model.AttributeWriteRequest
import chip.devicecontroller.model.ChipAttributePath
import chip.devicecontroller.model.ChipEventPath
import chip.devicecontroller.model.NodeState
import chip.tlv.AnonymousTag
import chip.tlv.TlvReader
import chip.tlv.TlvWriter
import com.google.chip.chiptool.ChipClient
import com.google.chip.chiptool.GenericChipDeviceListener
import com.google.chip.chiptool.R
Expand All @@ -28,6 +25,9 @@ import com.google.chip.chiptool.util.toAny
import java.util.Optional
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
import matter.tlv.AnonymousTag
import matter.tlv.TlvReader
import matter.tlv.TlvWriter

class BasicClientFragment : Fragment() {
private val deviceController: ChipDeviceController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ import chip.devicecontroller.model.ChipAttributePath
import chip.devicecontroller.model.ChipEventPath
import chip.devicecontroller.model.InvokeElement
import chip.devicecontroller.model.NodeState
import chip.tlv.AnonymousTag
import chip.tlv.ContextSpecificTag
import chip.tlv.TlvReader
import chip.tlv.TlvWriter
import com.google.chip.chiptool.ChipClient
import com.google.chip.chiptool.GenericChipDeviceListener
import com.google.chip.chiptool.R
Expand All @@ -37,6 +33,10 @@ import com.google.chip.chiptool.util.DeviceIdUtil
import java.lang.Exception
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
import matter.tlv.AnonymousTag
import matter.tlv.ContextSpecificTag
import matter.tlv.TlvReader
import matter.tlv.TlvWriter

class GroupSettingFragment : Fragment() {
private val deviceController: ChipDeviceController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ import chip.devicecontroller.model.ChipAttributePath
import chip.devicecontroller.model.ChipEventPath
import chip.devicecontroller.model.InvokeElement
import chip.devicecontroller.model.NodeState
import chip.tlv.AnonymousTag
import chip.tlv.TlvReader
import chip.tlv.TlvWriter
import com.google.chip.chiptool.ChipClient
import com.google.chip.chiptool.GenericChipDeviceListener
import com.google.chip.chiptool.R
import com.google.chip.chiptool.databinding.MultiAdminClientFragmentBinding
import com.google.chip.chiptool.util.toAny
import kotlinx.coroutines.*
import matter.tlv.AnonymousTag
import matter.tlv.TlvReader
import matter.tlv.TlvWriter

class MultiAdminClientFragment : Fragment() {
private val deviceController: ChipDeviceController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ import chip.devicecontroller.model.ChipAttributePath
import chip.devicecontroller.model.ChipEventPath
import chip.devicecontroller.model.InvokeElement
import chip.devicecontroller.model.NodeState
import chip.tlv.AnonymousTag
import chip.tlv.ContextSpecificTag
import chip.tlv.TlvReader
import chip.tlv.TlvWriter
import com.google.chip.chiptool.ChipClient
import com.google.chip.chiptool.GenericChipDeviceListener
import com.google.chip.chiptool.R
Expand All @@ -36,6 +32,10 @@ import java.util.Calendar
import java.util.Locale
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
import matter.tlv.AnonymousTag
import matter.tlv.ContextSpecificTag
import matter.tlv.TlvReader
import matter.tlv.TlvWriter

class OnOffClientFragment : Fragment() {
private val deviceController: ChipDeviceController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ import chip.devicecontroller.model.ChipAttributePath
import chip.devicecontroller.model.ChipEventPath
import chip.devicecontroller.model.InvokeElement
import chip.devicecontroller.model.NodeState
import chip.tlv.AnonymousTag
import chip.tlv.ContextSpecificTag
import chip.tlv.TlvReader
import chip.tlv.TlvWriter
import com.google.chip.chiptool.ChipClient
import com.google.chip.chiptool.GenericChipDeviceListener
import com.google.chip.chiptool.R
import com.google.chip.chiptool.databinding.OpCredClientFragmentBinding
import com.google.chip.chiptool.util.toAny
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
import matter.tlv.AnonymousTag
import matter.tlv.ContextSpecificTag
import matter.tlv.TlvReader
import matter.tlv.TlvWriter

class OpCredClientFragment : Fragment() {
private val deviceController: ChipDeviceController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ import chip.devicecontroller.ReportCallback
import chip.devicecontroller.model.ChipAttributePath
import chip.devicecontroller.model.ChipEventPath
import chip.devicecontroller.model.NodeState
import chip.tlv.AnonymousTag
import chip.tlv.TlvReader
import com.google.chip.chiptool.ChipClient
import com.google.chip.chiptool.R
import com.google.chip.chiptool.databinding.SensorClientFragmentBinding
Expand All @@ -32,6 +30,8 @@ import java.util.Calendar
import java.util.Date
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
import matter.tlv.AnonymousTag
import matter.tlv.TlvReader

class SensorClientFragment : Fragment() {
private val deviceController: ChipDeviceController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ import chip.devicecontroller.model.ChipEventPath
import chip.devicecontroller.model.ChipPathId
import chip.devicecontroller.model.InvokeElement
import chip.devicecontroller.model.NodeState
import chip.jsontlv.putJsonString
import chip.tlv.AnonymousTag
import chip.tlv.TlvReader
import chip.tlv.TlvWriter
import com.google.chip.chiptool.ChipClient
import com.google.chip.chiptool.R
import com.google.chip.chiptool.databinding.WildcardFragmentBinding
Expand All @@ -41,6 +37,10 @@ import kotlin.coroutines.resume
import kotlin.coroutines.suspendCoroutine
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
import matter.jsontlv.putJsonString
import matter.tlv.AnonymousTag
import matter.tlv.TlvReader
import matter.tlv.TlvWriter

class WildcardFragment : Fragment() {
private var _binding: WildcardFragmentBinding? = null
Expand Down Expand Up @@ -646,7 +646,7 @@ class WildcardFragment : Fragment() {
}

interface TlvWriterInterface {
fun generate(writer: TlvWriter, value: String, tag: chip.tlv.Tag = AnonymousTag)
fun generate(writer: TlvWriter, value: String, tag: matter.tlv.Tag = AnonymousTag)
}

companion object {
Expand All @@ -660,49 +660,49 @@ class WildcardFragment : Fragment() {
mapOf(
"json" to
object : TlvWriterInterface {
override fun generate(writer: TlvWriter, value: String, tag: chip.tlv.Tag) {
override fun generate(writer: TlvWriter, value: String, tag: matter.tlv.Tag) {
writer.putJsonString(tag, value)
}
},
"UnsignedInt" to
object : TlvWriterInterface {
override fun generate(writer: TlvWriter, value: String, tag: chip.tlv.Tag) {
override fun generate(writer: TlvWriter, value: String, tag: matter.tlv.Tag) {
writer.put(tag, value.toULong())
}
},
"Int" to
object : TlvWriterInterface {
override fun generate(writer: TlvWriter, value: String, tag: chip.tlv.Tag) {
override fun generate(writer: TlvWriter, value: String, tag: matter.tlv.Tag) {
writer.put(tag, value.toLong())
}
},
"Boolean" to
object : TlvWriterInterface {
override fun generate(writer: TlvWriter, value: String, tag: chip.tlv.Tag) {
override fun generate(writer: TlvWriter, value: String, tag: matter.tlv.Tag) {
writer.put(tag, value.toBoolean())
}
},
"Float" to
object : TlvWriterInterface {
override fun generate(writer: TlvWriter, value: String, tag: chip.tlv.Tag) {
override fun generate(writer: TlvWriter, value: String, tag: matter.tlv.Tag) {
writer.put(tag, value.toFloat())
}
},
"Double" to
object : TlvWriterInterface {
override fun generate(writer: TlvWriter, value: String, tag: chip.tlv.Tag) {
override fun generate(writer: TlvWriter, value: String, tag: matter.tlv.Tag) {
writer.put(tag, value.toDouble())
}
},
"String" to
object : TlvWriterInterface {
override fun generate(writer: TlvWriter, value: String, tag: chip.tlv.Tag) {
override fun generate(writer: TlvWriter, value: String, tag: matter.tlv.Tag) {
writer.put(tag, value)
}
},
"ByteArray(Hex)" to
object : TlvWriterInterface {
override fun generate(writer: TlvWriter, value: String, tag: chip.tlv.Tag) {
override fun generate(writer: TlvWriter, value: String, tag: matter.tlv.Tag) {
writer.put(
tag,
value.chunked(2).map { it.toInt(16) and 0xFF }.map { it.toByte() }.toByteArray()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.google.chip.chiptool.util

import chip.tlv.AnonymousTag
import chip.tlv.ArrayValue
import chip.tlv.NullValue
import chip.tlv.StructureValue
import chip.tlv.Tag
import chip.tlv.TlvReader
import matter.tlv.AnonymousTag
import matter.tlv.ArrayValue
import matter.tlv.NullValue
import matter.tlv.StructureValue
import matter.tlv.Tag
import matter.tlv.TlvReader

/**
* Encodes TLV into kotlin Object. If the TLV reader is positioned TLV Structure, Object will return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ import chip.devicecontroller.ChipDeviceController
import chip.devicecontroller.GetConnectedDeviceCallbackJni.GetConnectedDeviceCallback
import chip.devicecontroller.InvokeCallback
import chip.devicecontroller.model.InvokeElement
import chip.tlv.AnonymousTag
import chip.tlv.ContextSpecificTag
import chip.tlv.TlvWriter
import com.matter.controller.commands.common.CredentialsIssuer
import java.util.logging.Level
import java.util.logging.Logger
import kotlin.UShort
import matter.tlv.AnonymousTag
import matter.tlv.ContextSpecificTag
import matter.tlv.TlvWriter

class PairOnNetworkLongImInvokeCommand(
controller: ChipDeviceController,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import chip.devicecontroller.GetConnectedDeviceCallbackJni.GetConnectedDeviceCal
import chip.devicecontroller.WriteAttributesCallback
import chip.devicecontroller.model.AttributeWriteRequest
import chip.devicecontroller.model.ChipAttributePath
import chip.tlv.AnonymousTag
import chip.tlv.TlvWriter
import com.matter.controller.commands.common.CredentialsIssuer
import java.util.logging.Level
import java.util.logging.Logger
import matter.tlv.AnonymousTag
import matter.tlv.TlvWriter

class PairOnNetworkLongImWriteCommand(
controller: ChipDeviceController,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
*/
package com.matter.controller.commands.pairing

import chip.tlv.AnonymousTag
import chip.tlv.ContextSpecificTag
import chip.tlv.TlvWriter
import com.matter.controller.commands.common.CredentialsIssuer
import java.time.Duration
import java.util.logging.Level
Expand All @@ -29,6 +26,9 @@ import matter.controller.InvokeRequest
import matter.controller.InvokeResponse
import matter.controller.MatterController
import matter.controller.model.CommandPath
import matter.tlv.AnonymousTag
import matter.tlv.ContextSpecificTag
import matter.tlv.TlvWriter

class PairOnNetworkLongImInvokeCommand(
controller: MatterController,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
*/
package com.matter.controller.commands.pairing

import chip.tlv.AnonymousTag
import chip.tlv.TlvWriter
import com.matter.controller.commands.common.CredentialsIssuer
import java.time.Duration
import java.util.logging.Level
Expand All @@ -29,6 +27,8 @@ import matter.controller.WriteRequest
import matter.controller.WriteRequests
import matter.controller.WriteResponse
import matter.controller.model.AttributePath
import matter.tlv.AnonymousTag
import matter.tlv.TlvWriter

class PairOnNetworkLongImWriteCommand(
controller: MatterController,
Expand Down
Loading

0 comments on commit 2524825

Please sign in to comment.