Skip to content
This repository has been archived by the owner on Oct 3, 2020. It is now read-only.

Commit

Permalink
working on mapping device types to a class
Browse files Browse the repository at this point in the history
  • Loading branch information
fulton committed Dec 22, 2019
1 parent d09af06 commit 9f084af
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/andromeda/araserver/iot/DeviceConst.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.andromeda.araserver.iot

object DeviceConst {
const val LIGHTINT = 0
const val LIGHTSTRING = "LIGHT"
const val LIGHT = "LIGHT"
const val TEMP = "TEMP"
}
3 changes: 3 additions & 0 deletions src/main/java/com/andromeda/araserver/iot/TempModel.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.andromeda.araserver.iot

data class TempModel(val temp:String, val ac:Boolean, val heat:Boolean)
10 changes: 10 additions & 0 deletions src/main/java/com/andromeda/araserver/iot/TypeClassMap.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.andromeda.araserver.iot

import com.andromeda.araserver.util.OutputModel

class TypeClassMap {
fun main(type:String): Class<out Any>? {
val map = mapOf(DeviceConst.LIGHT to LightStatusModel::class.java, DeviceConst.TEMP to TempModel::class.java)
return map[type]
}
}

0 comments on commit 9f084af

Please sign in to comment.