11package com.awareframework.android.core.model
22
3- import android.content.Context
43import com.awareframework.android.core.db.Engine
54
65/* *
@@ -11,44 +10,55 @@ import com.awareframework.android.core.db.Engine
1110 */
1211
1312open class SensorConfig (
14- /* *
15- * Sensor is enabled or not. (optional)
16- */
17- var enabled : Boolean = false ,
18-
19- /* *
20- * Enables logging. (optional)
21- */
22- var debug : Boolean = false ,
23-
24- /* *
25- * Label for the data. (optional)
26- */
27- var label : String = " " ,
28-
29- /* *
30- * User given deviceId. (optional)
31- */
32- var deviceId : String = " " ,
33-
34- /* *
35- * Encryption key for the database. (optional)
36- */
37- var dbEncryptionKey : String? = null ,
38-
39- /* *
40- * Which database to use. (optional)
41- * defaults to NONE, which doesn't preserve any data.
42- */
43- var dbType : Engine .DatabaseType = Engine .DatabaseType .NONE ,
44-
45- /* *
46- * Database name/path. (optional)? TODO (sercant): discuss
47- */
48- var dbPath : String = " aware" ,
49-
50- /* *
51- * Database sync host. (optional)
52- */
53- var dbHost : String? = null
54- )
13+ /* *
14+ * Sensor is enabled or not. (optional)
15+ */
16+ var enabled : Boolean = false ,
17+
18+ /* *
19+ * Enables logging. (optional)
20+ */
21+ var debug : Boolean = false ,
22+
23+ /* *
24+ * Label for the data. (optional)
25+ */
26+ var label : String = " " ,
27+
28+ /* *
29+ * User given deviceId. (optional)
30+ */
31+ var deviceId : String = " " ,
32+
33+ /* *
34+ * Encryption key for the database. (optional)
35+ */
36+ var dbEncryptionKey : String? = null ,
37+
38+ /* *
39+ * Which database to use. (optional)
40+ * defaults to NONE, which doesn't preserve any data.
41+ */
42+ var dbType : Engine .DatabaseType = Engine .DatabaseType .NONE ,
43+
44+ /* *
45+ * Database name/path. (optional)? TODO (sercant): discuss
46+ */
47+ var dbPath : String = " aware" ,
48+
49+ /* *
50+ * Database sync host. (optional)
51+ */
52+ var dbHost : String? = null
53+ ) {
54+ open fun <T : SensorConfig > replaceWith (config : T ) {
55+ enabled = config.enabled
56+ debug = config.debug
57+ label = config.label
58+ deviceId = config.deviceId
59+ dbEncryptionKey = config.dbEncryptionKey
60+ dbType = config.dbType
61+ dbPath = config.dbPath
62+ dbHost = config.dbHost
63+ }
64+ }
0 commit comments