@@ -108,6 +108,7 @@ class NanoleafController(
108108) : Controller {
109109 private val upSince = clock.now()
110110 private var accessToken: String? = config?.accessToken
111+ ? : nanoleafAdapter.getAccessToken(deviceMetadata,)
111112 private var device = accessToken?.let {
112113 nanoleafAdapter.openDevice(deviceMetadata, it)
113114 }
@@ -126,7 +127,7 @@ class NanoleafController(
126127 deviceMetadata.deviceId,
127128 accessToken
128129 )
129- override val defaultFixtureConfig : FixtureConfig ?
130+ override val defaultFixtureOptions : FixtureOptions ?
130131 get() = null
131132 override val defaultTransportConfig: TransportConfig ?
132133 get() = null
@@ -136,9 +137,7 @@ class NanoleafController(
136137 override fun createTransport (
137138 entity : Model .Entity ? ,
138139 fixtureConfig : FixtureConfig ,
139- transportConfig : TransportConfig ? ,
140- componentCount : Int ,
141- bytesPerComponent : Int
140+ transportConfig : TransportConfig ?
142141 ): Transport = object : Transport {
143142 override val name: String
144143 get() = deviceMetadata.deviceName
@@ -189,7 +188,7 @@ class NanoleafController(
189188
190189 return listOf (
191190 FixtureMapping (null ,
192- PixelArrayDevice .Config (
191+ PixelArrayDevice .Options (
193192 panels.size,
194193 PixelFormat .RGB8 ,
195194 pixelLocations = scaledPixelLocations
@@ -228,6 +227,7 @@ class NanoleafTransportConfig() : TransportConfig {
228227expect class NanoleafAdapter (coroutineContext : CoroutineContext , clock : Clock ) {
229228 fun start (callback : (NanoleafDeviceMetadata ) -> Unit )
230229 fun stop ()
230+ fun getAccessToken (deviceMetadata : NanoleafDeviceMetadata ): String
231231 fun openDevice (deviceMetadata : NanoleafDeviceMetadata , accessToken : String ): NanoleafDevice
232232}
233233
@@ -274,7 +274,7 @@ data class NanoleafControllerConfig(
274274 override val deviceName : String ,
275275 val accessToken : String? = null ,
276276 override val fixtures : List <FixtureMappingData > = emptyList(),
277- override val defaultFixtureConfig : FixtureConfig ? = null ,
277+ override val defaultFixtureOptions : FixtureOptions ? = null ,
278278 override val defaultTransportConfig : TransportConfig ? = null
279279) : ControllerConfig, NanoleafDeviceMetadata {
280280 override val title: String get() = deviceName
@@ -299,19 +299,22 @@ data class NanoleafControllerConfig(
299299 }
300300 }
301301
302- override fun createFixturePreview (fixtureConfig : FixtureConfig , transportConfig : TransportConfig ): FixturePreview {
302+ override fun createFixturePreview (
303+ fixtureOptions : FixtureOptions ,
304+ transportConfig : TransportConfig
305+ ): FixturePreview {
303306 val staticDmxMapping = dmxAllocator!! .allocate(
304- fixtureConfig .componentCount!! ,
305- fixtureConfig .bytesPerComponent,
307+ fixtureOptions .componentCount!! ,
308+ fixtureOptions .bytesPerComponent,
306309 transportConfig as DmxTransportConfig
307310 )
308- val dmxPreview = error(" foo" )
311+ // val dmxPreview = error("foo")
309312
310313 return object : FixturePreview {
311- override val fixtureConfig : ConfigPreview
312- get() = fixtureConfig .preview()
314+ override val fixtureOptions : ConfigPreview
315+ get() = fixtureOptions .preview()
313316 override val transportConfig: ConfigPreview
314- get() = dmxPreview
317+ get() = transportConfig.preview()
315318 }
316319 }
317320}
@@ -329,8 +332,8 @@ class MutableNanoleafControllerConfig(config: NanoleafControllerConfig) : Mutabl
329332
330333 override val fixtures: MutableList <MutableFixtureMapping > =
331334 config.fixtures.map { it.edit() }.toMutableList()
332- override var defaultFixtureConfig : MutableFixtureConfig ? =
333- config.defaultFixtureConfig ?.edit()
335+ override var defaultFixtureOptions : MutableFixtureOptions ? =
336+ config.defaultFixtureOptions ?.edit()
334337 override var defaultTransportConfig: MutableTransportConfig ? =
335338 config.defaultTransportConfig?.edit()
336339
@@ -339,7 +342,7 @@ class MutableNanoleafControllerConfig(config: NanoleafControllerConfig) : Mutabl
339342 hostName, port, deviceId, deviceName,
340343 accessToken,
341344 fixtures.map { it.build() },
342- defaultFixtureConfig ?.build(),
345+ defaultFixtureOptions ?.build(),
343346 defaultTransportConfig?.build()
344347 )
345348
0 commit comments