commonMain.dk.cachet.carp.common.application.devices.MACAddressDeviceRegistration.kt Maven / Gradle / Ivy
Go to download
Helper classes and base types relied upon by all subsystems. This library does not contain any domain logic.
The newest version!
package dk.cachet.carp.common.application.devices
import dk.cachet.carp.common.application.MACAddress
import dk.cachet.carp.common.infrastructure.serialization.NotSerializable
import kotlinx.serialization.*
import kotlin.js.JsExport
/**
* A [DeviceRegistration] for devices which have a MAC address.
*/
@Serializable
@JsExport
data class MACAddressDeviceRegistration(
val macAddress: MACAddress,
@Required
override val deviceDisplayName: String? = null
) : DeviceRegistration()
{
@Required
override val deviceId: String = macAddress.address
}
@Suppress( "SERIALIZER_TYPE_INCOMPATIBLE" )
@Serializable( with = NotSerializable::class )
@JsExport
class MACAddressDeviceRegistrationBuilder : DeviceRegistrationBuilder()
{
var macAddress: String = ""
override fun build(): MACAddressDeviceRegistration =
MACAddressDeviceRegistration( MACAddress.parse( macAddress ), deviceDisplayName )
}