File tree Expand file tree Collapse file tree 4 files changed +9
-10
lines changed
deadeye/src/main/kotlin/org/strykeforce/deadeye Expand file tree Collapse file tree 4 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ internal class CameraImpl<T : TargetData>(override val id: String) : Camera<T> {
4646 }
4747
4848 override fun parse (buffer : Buffer ) {
49- val targetData = jsonAdapter.fromJson(buffer) ? : throw JsonDataException (" parse error" )
49+ var targetData = jsonAdapter.fromJson(buffer) ? : throw JsonDataException (" parse error" )
5050 this .targetData = targetData
5151 targetDataListener?.onTargetData(targetData)
5252 }
Original file line number Diff line number Diff line change @@ -4,10 +4,9 @@ import com.squareup.moshi.JsonClass
44
55@JsonClass(generateAdapter = true )
66class CenterTargetData (
7- id : String ,
7+ id : String = " NA " ,
88 sn : Int = 0 ,
99 valid : Boolean = false ,
1010 val x : Double = 0.0 ,
1111 val y : Double = 0.0
12- ) : TargetData(id, sn, valid) {
13- }
12+ ) : TargetData(id, sn, valid)
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import java.net.DatagramPacket
1010import java.net.DatagramSocket
1111import kotlin.concurrent.thread
1212
13- private const val LINK = " Link "
13+ private const val LINK = " Config "
1414
1515object Deadeye {
1616 private val cameraCache = mutableMapOf<String , Camera <* >>()
@@ -32,12 +32,12 @@ object Deadeye {
3232 private val table: NetworkTable by lazy { NetworkTableInstance .getDefault().getTable(" /Deadeye" ) }
3333 private val moshi: Moshi by lazy { Moshi .Builder ().build() }
3434
35- var link : Link
35+ var config : Config
3636 get() = with (table.getEntry(LINK ).getString(" {}" )) {
37- Deadeye_LinkJsonAdapter (moshi).fromJson(this ) ? : throw JsonDataException (" Link : $this " )
37+ Deadeye_ConfigJsonAdapter (moshi).fromJson(this ) ? : throw JsonDataException (" Config : $this " )
3838 }
3939 set(value) = with (table.getEntry(LINK )) {
40- setString(Deadeye_LinkJsonAdapter (moshi).toJson(value))
40+ setString(Deadeye_ConfigJsonAdapter (moshi).toJson(value))
4141 }
4242
4343 init {
@@ -62,6 +62,6 @@ object Deadeye {
6262
6363
6464 @JsonClass(generateAdapter = true )
65- data class Link (val address : String , val port : Int , val enabled : Boolean )
65+ data class Config (val address : String , val port : Int , val enabled : Boolean )
6666
6767}
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import com.squareup.moshi.JsonClass
44
55@JsonClass(generateAdapter = true )
66open class TargetData (
7- val id : String ,
7+ val id : String = " NA " ,
88 val sn : Int = 0 ,
99 val valid : Boolean = false
1010)
You can’t perform that action at this time.
0 commit comments