diff --git a/.gitattributes b/.gitattributes index 709fc3af8..791be7c28 100644 --- a/.gitattributes +++ b/.gitattributes @@ -21,3 +21,4 @@ *.dll binary *.so binary *.zip binary +*.bmp binary diff --git a/api/src/main/kotlin/nebulosa/api/cameras/CameraSerializer.kt b/api/src/main/kotlin/nebulosa/api/cameras/CameraSerializer.kt index 57384a107..76943085b 100644 --- a/api/src/main/kotlin/nebulosa/api/cameras/CameraSerializer.kt +++ b/api/src/main/kotlin/nebulosa/api/cameras/CameraSerializer.kt @@ -15,6 +15,8 @@ class CameraSerializer(private val capturesPath: Path) : StdSerializer(C gen.writeStartObject() gen.writeStringField("type", value.type.name) gen.writeStringField("sender", value.sender.id) + gen.writeStringField("driverName", value.driverName) + gen.writeStringField("driverVersion", value.driverVersion) gen.writeStringField("id", value.id) gen.writeStringField("name", value.name) gen.writeBooleanField("connected", value.connected) diff --git a/api/src/main/kotlin/nebulosa/api/focusers/FocuserSerializer.kt b/api/src/main/kotlin/nebulosa/api/focusers/FocuserSerializer.kt index 9aeb365e3..dce0db80a 100644 --- a/api/src/main/kotlin/nebulosa/api/focusers/FocuserSerializer.kt +++ b/api/src/main/kotlin/nebulosa/api/focusers/FocuserSerializer.kt @@ -13,6 +13,8 @@ class FocuserSerializer : StdSerializer(Focuser::class.java) { gen.writeStartObject() gen.writeStringField("type", value.type.name) gen.writeStringField("sender", value.sender.id) + gen.writeStringField("driverName", value.driverName) + gen.writeStringField("driverVersion", value.driverVersion) gen.writeStringField("id", value.id) gen.writeStringField("name", value.name) gen.writeBooleanField("connected", value.connected) diff --git a/api/src/main/kotlin/nebulosa/api/guiding/GuideOutputEventAware.kt b/api/src/main/kotlin/nebulosa/api/guiding/GuideOutputEventAware.kt index d05fa5afc..9fc088a91 100644 --- a/api/src/main/kotlin/nebulosa/api/guiding/GuideOutputEventAware.kt +++ b/api/src/main/kotlin/nebulosa/api/guiding/GuideOutputEventAware.kt @@ -4,5 +4,5 @@ import nebulosa.indi.device.guider.GuideOutputEvent fun interface GuideOutputEventAware { - fun handleGuideOutputEvent(event: GuideOutputEvent<*>) + fun handleGuideOutputEvent(event: GuideOutputEvent) } diff --git a/api/src/main/kotlin/nebulosa/api/guiding/GuideOutputEventHub.kt b/api/src/main/kotlin/nebulosa/api/guiding/GuideOutputEventHub.kt index 2208e8fc4..471c23828 100644 --- a/api/src/main/kotlin/nebulosa/api/guiding/GuideOutputEventHub.kt +++ b/api/src/main/kotlin/nebulosa/api/guiding/GuideOutputEventHub.kt @@ -17,10 +17,10 @@ import org.springframework.stereotype.Component @Subscriber class GuideOutputEventHub( private val messageService: MessageService, -) : DeviceEventHub>(DeviceType.GUIDE_OUTPUT), GuideOutputEventAware { +) : DeviceEventHub(DeviceType.GUIDE_OUTPUT), GuideOutputEventAware { @Subscribe(threadMode = ThreadMode.ASYNC) - override fun handleGuideOutputEvent(event: GuideOutputEvent<*>) { + override fun handleGuideOutputEvent(event: GuideOutputEvent) { if (event.device.type == DeviceType.GUIDE_OUTPUT) { when (event) { is PropertyChangedEvent -> if (event.device.canPulseGuide) onNext(event) diff --git a/api/src/main/kotlin/nebulosa/api/guiding/GuideOutputSerializer.kt b/api/src/main/kotlin/nebulosa/api/guiding/GuideOutputSerializer.kt index 9745eab4c..bb86459c3 100644 --- a/api/src/main/kotlin/nebulosa/api/guiding/GuideOutputSerializer.kt +++ b/api/src/main/kotlin/nebulosa/api/guiding/GuideOutputSerializer.kt @@ -13,6 +13,8 @@ class GuideOutputSerializer : StdSerializer(GuideOutput::class.java gen.writeStartObject() gen.writeStringField("type", value.type.name) gen.writeStringField("sender", value.sender.id) + gen.writeStringField("driverName", value.driverName) + gen.writeStringField("driverVersion", value.driverVersion) gen.writeStringField("id", value.id) gen.writeStringField("name", value.name) gen.writeBooleanField("connected", value.connected) diff --git a/api/src/main/kotlin/nebulosa/api/mounts/MountSerializer.kt b/api/src/main/kotlin/nebulosa/api/mounts/MountSerializer.kt index 49a2b6dd1..dc16d9fc7 100644 --- a/api/src/main/kotlin/nebulosa/api/mounts/MountSerializer.kt +++ b/api/src/main/kotlin/nebulosa/api/mounts/MountSerializer.kt @@ -18,6 +18,8 @@ class MountSerializer : StdSerializer(Mount::class.java) { gen.writeStartObject() gen.writeStringField("type", value.type.name) gen.writeStringField("sender", value.sender.id) + gen.writeStringField("driverName", value.driverName) + gen.writeStringField("driverVersion", value.driverVersion) gen.writeStringField("id", value.id) gen.writeStringField("name", value.name) gen.writeBooleanField("connected", value.connected) diff --git a/api/src/main/kotlin/nebulosa/api/rotators/RotatorSerializer.kt b/api/src/main/kotlin/nebulosa/api/rotators/RotatorSerializer.kt index fc654c7bb..4a798747f 100644 --- a/api/src/main/kotlin/nebulosa/api/rotators/RotatorSerializer.kt +++ b/api/src/main/kotlin/nebulosa/api/rotators/RotatorSerializer.kt @@ -13,6 +13,8 @@ class RotatorSerializer : StdSerializer(Rotator::class.java) { gen.writeStartObject() gen.writeStringField("type", value.type.name) gen.writeStringField("sender", value.sender.id) + gen.writeStringField("driverName", value.driverName) + gen.writeStringField("driverVersion", value.driverVersion) gen.writeStringField("id", value.id) gen.writeStringField("name", value.name) gen.writeBooleanField("connected", value.connected) diff --git a/api/src/main/kotlin/nebulosa/api/wheels/WheelSerializer.kt b/api/src/main/kotlin/nebulosa/api/wheels/WheelSerializer.kt index cbadc3fc4..7104a5d18 100644 --- a/api/src/main/kotlin/nebulosa/api/wheels/WheelSerializer.kt +++ b/api/src/main/kotlin/nebulosa/api/wheels/WheelSerializer.kt @@ -13,6 +13,8 @@ class WheelSerializer : StdSerializer(FilterWheel::class.java) { gen.writeStartObject() gen.writeStringField("type", value.type.name) gen.writeStringField("sender", value.sender.id) + gen.writeStringField("driverName", value.driverName) + gen.writeStringField("driverVersion", value.driverVersion) gen.writeStringField("id", value.id) gen.writeStringField("name", value.name) gen.writeBooleanField("connected", value.connected) diff --git a/desktop/electron-builder.json b/desktop/electron-builder.json index f94f67c50..42417765e 100644 --- a/desktop/electron-builder.json +++ b/desktop/electron-builder.json @@ -20,7 +20,7 @@ "target": ["portable"] }, "portable": { - "splashImage": "dist/assets/images/splash.png" + "splashImage": "dist/assets/images/splash.bmp" }, "mac": { "icon": "dist/assets/icons", diff --git a/desktop/src/app/app.module.ts b/desktop/src/app/app.module.ts index b11224e03..e09df9694 100644 --- a/desktop/src/app/app.module.ts +++ b/desktop/src/app/app.module.ts @@ -48,6 +48,7 @@ import { CameraExposureComponent } from '../shared/components/camera-exposure/ca import { CameraInfoComponent } from '../shared/components/camera-info/camera-info.component' import { DeviceChooserComponent } from '../shared/components/device-chooser/device-chooser.component' import { DeviceListMenuComponent } from '../shared/components/device-list-menu/device-list-menu.component' +import { DeviceNameComponent } from '../shared/components/device-name/device-name.component' import { DialogMenuComponent } from '../shared/components/dialog-menu/dialog-menu.component' import { HistogramComponent } from '../shared/components/histogram/histogram.component' import { LocationComponent } from '../shared/components/location/location.dialog' @@ -117,6 +118,7 @@ import { StackerComponent } from './stacker/stacker.component' CrossHairComponent, DeviceChooserComponent, DeviceListMenuComponent, + DeviceNameComponent, DialogMenuComponent, DropdownOptionsPipe, EnumPipe, diff --git a/desktop/src/app/camera/camera.component.html b/desktop/src/app/camera/camera.component.html index d53d34fca..1b78ac65a 100644 --- a/desktop/src/app/camera/camera.component.html +++ b/desktop/src/app/camera/camera.component.html @@ -1,14 +1,7 @@
- - - - +
- - - - +
- - - - +
- - - - +
- - - - + + {{ device.name }} +
+ DRIVER: {{ device.driverName }} + VERSION: {{ device.driverVersion }} +
+
+ `, + encapsulation: ViewEncapsulation.None, +}) +export class DeviceNameComponent { + @Input({ required: true }) + readonly device!: Device +} diff --git a/desktop/src/shared/types/camera.types.ts b/desktop/src/shared/types/camera.types.ts index 54b10fc03..cb8eb75bd 100644 --- a/desktop/src/shared/types/camera.types.ts +++ b/desktop/src/shared/types/camera.types.ts @@ -200,6 +200,8 @@ export interface CameraNamingFormatDialog { export const DEFAULT_CAMERA: Camera = { type: 'CAMERA', sender: '', + driverName: '', + driverVersion: '', id: '', exposuring: false, hasCoolerControl: false, diff --git a/desktop/src/shared/types/device.types.ts b/desktop/src/shared/types/device.types.ts index 3147ae30c..d9d958318 100644 --- a/desktop/src/shared/types/device.types.ts +++ b/desktop/src/shared/types/device.types.ts @@ -15,6 +15,8 @@ export interface Device { readonly sender: string readonly id: string readonly name: string + readonly driverName: string + readonly driverVersion: string connected: boolean } diff --git a/desktop/src/shared/types/focuser.types.ts b/desktop/src/shared/types/focuser.types.ts index b73e9f815..168868c8b 100644 --- a/desktop/src/shared/types/focuser.types.ts +++ b/desktop/src/shared/types/focuser.types.ts @@ -22,6 +22,8 @@ export interface FocuserPreference { export const DEFAULT_FOCUSER: Focuser = { type: 'FOCUSER', sender: '', + driverName: '', + driverVersion: '', id: '', moving: false, position: 0, diff --git a/desktop/src/shared/types/guider.types.ts b/desktop/src/shared/types/guider.types.ts index bf4895238..f736bd604 100644 --- a/desktop/src/shared/types/guider.types.ts +++ b/desktop/src/shared/types/guider.types.ts @@ -105,6 +105,8 @@ export interface GuiderChartInfo { export const DEFAULT_GUIDE_OUTPUT: GuideOutput = { type: 'CAMERA', sender: '', + driverName: '', + driverVersion: '', id: '', canPulseGuide: false, pulseGuiding: false, diff --git a/desktop/src/shared/types/mount.types.ts b/desktop/src/shared/types/mount.types.ts index f88e21e4b..cd1c34b2f 100644 --- a/desktop/src/shared/types/mount.types.ts +++ b/desktop/src/shared/types/mount.types.ts @@ -79,6 +79,8 @@ export interface MountPreference { export const DEFAULT_MOUNT: Mount = { type: 'MOUNT', sender: '', + driverName: '', + driverVersion: '', id: '', slewing: false, tracking: false, diff --git a/desktop/src/shared/types/rotator.types.ts b/desktop/src/shared/types/rotator.types.ts index 0b003d434..5552b6344 100644 --- a/desktop/src/shared/types/rotator.types.ts +++ b/desktop/src/shared/types/rotator.types.ts @@ -20,6 +20,8 @@ export interface RotatorPreference { export const DEFAULT_ROTATOR: Rotator = { type: 'ROTATOR', sender: '', + driverName: '', + driverVersion: '', id: '', name: '', moving: false, diff --git a/desktop/src/shared/types/wheel.types.ts b/desktop/src/shared/types/wheel.types.ts index 2ebb46491..a797424d6 100644 --- a/desktop/src/shared/types/wheel.types.ts +++ b/desktop/src/shared/types/wheel.types.ts @@ -58,6 +58,8 @@ export function makeFilter(wheel: Wheel, filters: Filter[], shutterPosition: num export const DEFAULT_WHEEL: Wheel = { type: 'WHEEL', sender: '', + driverName: '', + driverVersion: '', id: '', count: 0, position: 0, diff --git a/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/INDIClient.kt b/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/INDIClient.kt index 5351b639e..14daac32a 100644 --- a/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/INDIClient.kt +++ b/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/INDIClient.kt @@ -2,6 +2,7 @@ package nebulosa.indi.client import nebulosa.indi.client.connection.INDIProccessConnection import nebulosa.indi.client.connection.INDISocketConnection +import nebulosa.indi.client.device.DriverInfo import nebulosa.indi.client.device.INDIDeviceProtocolHandler import nebulosa.indi.client.device.auxiliary.INDIGPS import nebulosa.indi.client.device.auxiliary.INDIGuideOutput @@ -48,32 +49,32 @@ data class INDIClient(val connection: INDIConnection) : INDIDeviceProtocolHandle override val input get() = connection.input - override fun newCamera(name: String, executable: String): Camera { - return CAMERAS[executable]?.create(this, name) ?: INDICamera(this, name) + override fun newCamera(driverInfo: DriverInfo): Camera { + return CAMERAS[driverInfo.executable]?.create(this, driverInfo) ?: INDICamera(this, driverInfo) } - override fun newMount(name: String, executable: String): Mount { - return INDIMount(this, name) + override fun newMount(driverInfo: DriverInfo): Mount { + return INDIMount(this, driverInfo) } - override fun newFocuser(name: String, executable: String): Focuser { - return INDIFocuser(this, name) + override fun newFocuser(driverInfo: DriverInfo): Focuser { + return INDIFocuser(this, driverInfo) } - override fun newFilterWheel(name: String, executable: String): FilterWheel { - return INDIFilterWheel(this, name) + override fun newFilterWheel(driverInfo: DriverInfo): FilterWheel { + return INDIFilterWheel(this, driverInfo) } - override fun newRotator(name: String, executable: String): Rotator { - return INDIRotator(this, name) + override fun newRotator(driverInfo: DriverInfo): Rotator { + return INDIRotator(this, driverInfo) } - override fun newGPS(name: String, executable: String): GPS { - return INDIGPS(this, name) + override fun newGPS(driverInfo: DriverInfo): GPS { + return INDIGPS(this, driverInfo) } - override fun newGuideOutput(name: String, executable: String): GuideOutput { - return INDIGuideOutput(this, name) + override fun newGuideOutput(driverInfo: DriverInfo): GuideOutput { + return INDIGuideOutput(this, driverInfo) } override fun start() { @@ -109,9 +110,9 @@ data class INDIClient(val connection: INDIConnection) : INDIDeviceProtocolHandle ) @JvmStatic - private fun Class.create(handler: INDIClient, name: String): T { - return getConstructor(INDIClient::class.java, String::class.java) - .newInstance(handler, name) + private fun Class.create(handler: INDIClient, driverInfo: DriverInfo): T { + return getConstructor(INDIClient::class.java, DriverInfo::class.java) + .newInstance(handler, driverInfo) } } } diff --git a/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/DriverInfo.kt b/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/DriverInfo.kt new file mode 100644 index 000000000..1c6e2b190 --- /dev/null +++ b/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/DriverInfo.kt @@ -0,0 +1,24 @@ +package nebulosa.indi.client.device + +import nebulosa.indi.protocol.TextVector + +data class DriverInfo( + @JvmField val name: String, + @JvmField val executable: String, + @JvmField val version: String, + @JvmField val interfaceType: Int, +) { + + companion object { + + @JvmStatic + fun from(message: TextVector<*>): DriverInfo? { + return DriverInfo( + message.device, + message["DRIVER_EXEC"]?.value?.takeIf { it.isNotBlank() } ?: return null, + message["DRIVER_VERSION"]?.value?.takeIf { it.isNotBlank() } ?: return null, + message["DRIVER_INTERFACE"]?.value?.toIntOrNull() ?: return null, + ) + } + } +} diff --git a/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/INDIDevice.kt b/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/INDIDevice.kt index 4a1f62f2b..c4887e8a6 100644 --- a/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/INDIDevice.kt +++ b/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/INDIDevice.kt @@ -11,15 +11,24 @@ internal abstract class INDIDevice : Device { abstract override val sender: INDIClient - override val properties = linkedMapOf>() - override val messages = LinkedList() + abstract val driverInfo: DriverInfo - override val id by lazy { type.code + "." + name.encodeUtf8().md5().hex() } + final override val properties = linkedMapOf>() + final override val messages = LinkedList() + final override val id by lazy { type.code + "." + name.encodeUtf8().md5().hex() } + final override val snoopedDevices = ArrayList(4) + + override val name + get() = driverInfo.name @Volatile override var connected = false protected set - override val snoopedDevices = ArrayList(4) + final override val driverName + get() = driverInfo.executable + + final override val driverVersion + get() = driverInfo.version private fun addMessageAndFireEvent(text: String) { synchronized(messages) { diff --git a/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/INDIDeviceProtocolHandler.kt b/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/INDIDeviceProtocolHandler.kt index d17a4d1f7..1497cd0a5 100644 --- a/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/INDIDeviceProtocolHandler.kt +++ b/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/INDIDeviceProtocolHandler.kt @@ -32,85 +32,71 @@ abstract class INDIDeviceProtocolHandler : AbstractINDIDeviceProvider(), Message override val isClosed get() = protocolReader == null || !protocolReader!!.isRunning - protected abstract fun newCamera(name: String, executable: String): Camera + protected abstract fun newCamera(driverInfo: DriverInfo): Camera - protected abstract fun newMount(name: String, executable: String): Mount + protected abstract fun newMount(driverInfo: DriverInfo): Mount - protected abstract fun newFocuser(name: String, executable: String): Focuser + protected abstract fun newFocuser(driverInfo: DriverInfo): Focuser - protected abstract fun newFilterWheel(name: String, executable: String): FilterWheel + protected abstract fun newFilterWheel(driverInfo: DriverInfo): FilterWheel - protected abstract fun newRotator(name: String, executable: String): Rotator + protected abstract fun newRotator(driverInfo: DriverInfo): Rotator - protected abstract fun newGPS(name: String, executable: String): GPS + protected abstract fun newGPS(driverInfo: DriverInfo): GPS - protected abstract fun newGuideOutput(name: String, executable: String): GuideOutput + protected abstract fun newGuideOutput(driverInfo: DriverInfo): GuideOutput - private fun registerCamera(message: TextVector<*>): Camera? { - val executable = message["DRIVER_EXEC"]?.value - - return if (!executable.isNullOrEmpty() && message.device.isNotEmpty() && camera(message.name) == null) { - newCamera(message.device, executable).also(::registerCamera) + private fun registerCamera(driverInfo: DriverInfo): Camera? { + return if (camera(driverInfo.name) == null) { + newCamera(driverInfo).also(::registerCamera) } else { null } } - private fun registerMount(message: TextVector<*>): Mount? { - val executable = message["DRIVER_EXEC"]?.value - - return if (!executable.isNullOrEmpty() && message.device.isNotEmpty() && mount(message.name) == null) { - newMount(message.device, executable).also(::registerMount) + private fun registerMount(driverInfo: DriverInfo): Mount? { + return if (mount(driverInfo.name) == null) { + newMount(driverInfo).also(::registerMount) } else { null } } - private fun registerFocuser(message: TextVector<*>): Focuser? { - val executable = message["DRIVER_EXEC"]?.value - - return if (!executable.isNullOrEmpty() && message.device.isNotEmpty() && focuser(message.name) == null) { - newFocuser(message.device, executable).also(::registerFocuser) + private fun registerFocuser(driverInfo: DriverInfo): Focuser? { + return if (focuser(driverInfo.name) == null) { + newFocuser(driverInfo).also(::registerFocuser) } else { null } } - private fun registerRotator(message: TextVector<*>): Rotator? { - val executable = message["DRIVER_EXEC"]?.value - - return if (!executable.isNullOrEmpty() && message.device.isNotEmpty() && rotator(message.name) == null) { - newRotator(message.device, executable).also(::registerRotator) + private fun registerRotator(driverInfo: DriverInfo): Rotator? { + return if (rotator(driverInfo.name) == null) { + newRotator(driverInfo).also(::registerRotator) } else { null } } - private fun registerFilterWheel(message: TextVector<*>): FilterWheel? { - val executable = message["DRIVER_EXEC"]?.value - - return if (!executable.isNullOrEmpty() && message.device.isNotEmpty() && wheel(message.name) == null) { - newFilterWheel(message.device, executable).also(::registerFilterWheel) + private fun registerFilterWheel(driverInfo: DriverInfo): FilterWheel? { + return if (wheel(driverInfo.name) == null) { + newFilterWheel(driverInfo).also(::registerFilterWheel) } else { null } } - private fun registerGPS(message: TextVector<*>): GPS? { - val executable = message["DRIVER_EXEC"]?.value - - return if (!executable.isNullOrEmpty() && message.device.isNotEmpty() && gps(message.name) == null) { - newGPS(message.device, executable).also(::registerGPS) + private fun registerGPS(driverInfo: DriverInfo): GPS? { + return if (gps(driverInfo.name) == null) { + newGPS(driverInfo).also(::registerGPS) } else { null } } - private fun registerGuideOutput(message: TextVector<*>): GuideOutput? { - val executable = message["DRIVER_EXEC"]?.value - - return if (!executable.isNullOrEmpty() && message.device.isNotEmpty() && guideOutput(message.device) == null) { - newGuideOutput(message.device, executable).also(::registerGuideOutput) + private fun registerGuideOutput(driverInfo: DriverInfo): GuideOutput? { + return if (guideOutput(driverInfo.name) == null) { + newGuideOutput(driverInfo).also(::registerGuideOutput) } else { null } @@ -161,11 +147,13 @@ abstract class INDIDeviceProtocolHandler : AbstractINDIDeviceProvider(), Message if (message is TextVector<*>) { when (message.name) { "DRIVER_INFO" -> { - val interfaceType = message["DRIVER_INTERFACE"]?.value?.toIntOrNull() ?: 0 + val driverInfo = DriverInfo.from(message) ?: return + + val interfaceType = driverInfo.interfaceType var registered = false if (DeviceInterfaceType.isCamera(interfaceType)) { - registerCamera(message)?.also { + registerCamera(driverInfo)?.also { registered = true it.handleMessage(message) takeMessageFromReorderingQueue(it) @@ -173,7 +161,7 @@ abstract class INDIDeviceProtocolHandler : AbstractINDIDeviceProvider(), Message } if (DeviceInterfaceType.isMount(interfaceType)) { - registerMount(message)?.also { + registerMount(driverInfo)?.also { registered = true it.handleMessage(message) takeMessageFromReorderingQueue(it) @@ -181,7 +169,7 @@ abstract class INDIDeviceProtocolHandler : AbstractINDIDeviceProvider(), Message } if (DeviceInterfaceType.isFilterWheel(interfaceType)) { - registerFilterWheel(message)?.also { + registerFilterWheel(driverInfo)?.also { registered = true it.handleMessage(message) takeMessageFromReorderingQueue(it) @@ -189,7 +177,7 @@ abstract class INDIDeviceProtocolHandler : AbstractINDIDeviceProvider(), Message } if (DeviceInterfaceType.isFocuser(interfaceType)) { - registerFocuser(message)?.also { + registerFocuser(driverInfo)?.also { registered = true it.handleMessage(message) takeMessageFromReorderingQueue(it) @@ -197,7 +185,7 @@ abstract class INDIDeviceProtocolHandler : AbstractINDIDeviceProvider(), Message } if (DeviceInterfaceType.isRotator(interfaceType)) { - registerRotator(message)?.also { + registerRotator(driverInfo)?.also { registered = true it.handleMessage(message) takeMessageFromReorderingQueue(it) @@ -205,7 +193,7 @@ abstract class INDIDeviceProtocolHandler : AbstractINDIDeviceProvider(), Message } if (DeviceInterfaceType.isGPS(interfaceType)) { - registerGPS(message)?.also { + registerGPS(driverInfo)?.also { registered = true it.handleMessage(message) takeMessageFromReorderingQueue(it) @@ -213,7 +201,7 @@ abstract class INDIDeviceProtocolHandler : AbstractINDIDeviceProvider(), Message } if (DeviceInterfaceType.isGuider(interfaceType)) { - registerGuideOutput(message)?.also { + registerGuideOutput(driverInfo)?.also { registered = true it.handleMessage(message) takeMessageFromReorderingQueue(it) diff --git a/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/auxiliary/INDIGPS.kt b/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/auxiliary/INDIGPS.kt index 0c287db19..e3a6214e7 100644 --- a/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/auxiliary/INDIGPS.kt +++ b/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/auxiliary/INDIGPS.kt @@ -1,6 +1,7 @@ package nebulosa.indi.client.device.auxiliary import nebulosa.indi.client.INDIClient +import nebulosa.indi.client.device.DriverInfo import nebulosa.indi.client.device.INDIDevice import nebulosa.indi.device.DeviceType import nebulosa.indi.device.gps.GPS @@ -15,8 +16,8 @@ import java.time.OffsetDateTime import java.time.ZoneOffset internal open class INDIGPS( - override val sender: INDIClient, - override val name: String, + final override val sender: INDIClient, + final override val driverInfo: DriverInfo, ) : INDIDevice(), GPS { override val type diff --git a/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/auxiliary/INDIGuideOutput.kt b/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/auxiliary/INDIGuideOutput.kt index 24488fbee..b5e66adfe 100644 --- a/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/auxiliary/INDIGuideOutput.kt +++ b/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/auxiliary/INDIGuideOutput.kt @@ -1,6 +1,7 @@ package nebulosa.indi.client.device.auxiliary import nebulosa.indi.client.INDIClient +import nebulosa.indi.client.device.DriverInfo import nebulosa.indi.client.device.INDIDevice import nebulosa.indi.client.device.handler.INDIGuideOutputHandler import nebulosa.indi.device.DeviceType @@ -9,8 +10,8 @@ import nebulosa.indi.protocol.INDIProtocol import java.time.Duration internal open class INDIGuideOutput( - override val sender: INDIClient, - override val name: String, + final override val sender: INDIClient, + final override val driverInfo: DriverInfo, ) : INDIDevice(), GuideOutput { override val type diff --git a/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/camera/AsiCamera.kt b/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/camera/AsiCamera.kt index 56490a761..5bf9a9903 100644 --- a/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/camera/AsiCamera.kt +++ b/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/camera/AsiCamera.kt @@ -1,13 +1,11 @@ package nebulosa.indi.client.device.camera import nebulosa.indi.client.INDIClient +import nebulosa.indi.client.device.DriverInfo import nebulosa.indi.protocol.INDIProtocol import nebulosa.indi.protocol.NumberVector -internal class AsiCamera( - provider: INDIClient, - name: String, -) : INDICamera(provider, name) { +internal class AsiCamera(provider: INDIClient, driverInfo: DriverInfo) : INDICamera(provider, driverInfo) { override fun handleMessage(message: INDIProtocol) { when (message) { diff --git a/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/camera/INDICamera.kt b/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/camera/INDICamera.kt index 831d78452..9cc506feb 100644 --- a/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/camera/INDICamera.kt +++ b/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/camera/INDICamera.kt @@ -4,6 +4,7 @@ import nebulosa.fits.FitsHeaderCard import nebulosa.image.algorithms.transformation.CfaPattern import nebulosa.image.format.HeaderCard import nebulosa.indi.client.INDIClient +import nebulosa.indi.client.device.DriverInfo import nebulosa.indi.client.device.INDIDevice import nebulosa.indi.client.device.handler.INDIGuideOutputHandler import nebulosa.indi.device.Device @@ -23,7 +24,7 @@ import java.time.Duration internal open class INDICamera( final override val sender: INDIClient, - final override val name: String, + final override val driverInfo: DriverInfo, ) : INDIDevice(), Camera { @Volatile final override var exposuring = false @@ -439,7 +440,9 @@ internal open class INDICamera( " gainMax=$gainMax, offset=$offset, offsetMin=$offsetMin," + " offsetMax=$offsetMax, canPulseGuide=$canPulseGuide, pulseGuiding=$pulseGuiding)" - internal data class GuideHeadCamera(override val main: INDICamera) : GuideHead, INDICamera(main.sender, main.name + " $GUIDE_HEAD_SUFFIX") { + internal data class GuideHeadCamera(override val main: INDICamera) : GuideHead, INDICamera(main.sender, main.driverInfo) { + + override val name = main.name + " $GUIDE_HEAD_SUFFIX" init { exposuring = main.exposuring diff --git a/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/camera/SVBonyCamera.kt b/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/camera/SVBonyCamera.kt index d4a50dbcc..63b4cc5fa 100644 --- a/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/camera/SVBonyCamera.kt +++ b/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/camera/SVBonyCamera.kt @@ -1,13 +1,11 @@ package nebulosa.indi.client.device.camera import nebulosa.indi.client.INDIClient +import nebulosa.indi.client.device.DriverInfo import nebulosa.indi.protocol.INDIProtocol import nebulosa.indi.protocol.NumberVector -internal class SVBonyCamera( - provider: INDIClient, - name: String, -) : INDICamera(provider, name) { +internal class SVBonyCamera(provider: INDIClient, driverInfo: DriverInfo) : INDICamera(provider, driverInfo) { override fun handleMessage(message: INDIProtocol) { when (message) { diff --git a/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/camera/SimCamera.kt b/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/camera/SimCamera.kt index ddc0d7505..88ba8c58d 100644 --- a/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/camera/SimCamera.kt +++ b/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/camera/SimCamera.kt @@ -1,13 +1,11 @@ package nebulosa.indi.client.device.camera import nebulosa.indi.client.INDIClient +import nebulosa.indi.client.device.DriverInfo import nebulosa.indi.protocol.INDIProtocol import nebulosa.indi.protocol.NumberVector -internal class SimCamera( - provider: INDIClient, - name: String, -) : INDICamera(provider, name) { +internal class SimCamera(provider: INDIClient, driverInfo: DriverInfo) : INDICamera(provider, driverInfo) { override fun handleMessage(message: INDIProtocol) { when (message) { diff --git a/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/focuser/INDIFocuser.kt b/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/focuser/INDIFocuser.kt index f8a517f66..5fac1b64a 100644 --- a/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/focuser/INDIFocuser.kt +++ b/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/focuser/INDIFocuser.kt @@ -1,6 +1,7 @@ package nebulosa.indi.client.device.focuser import nebulosa.indi.client.INDIClient +import nebulosa.indi.client.device.DriverInfo import nebulosa.indi.client.device.INDIDevice import nebulosa.indi.device.firstOnSwitch import nebulosa.indi.device.focuser.* @@ -10,8 +11,8 @@ import nebulosa.indi.protocol.Vector.Companion.isBusy // https://github.com/indilib/indi/blob/master/libs/indibase/indifocuser.cpp internal open class INDIFocuser( - override val sender: INDIClient, - override val name: String, + final override val sender: INDIClient, + final override val driverInfo: DriverInfo, ) : INDIDevice(), Focuser { @Volatile final override var moving = false diff --git a/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/mount/INDIMount.kt b/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/mount/INDIMount.kt index 1fb5e4ed6..8c12ec2e9 100644 --- a/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/mount/INDIMount.kt +++ b/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/mount/INDIMount.kt @@ -1,6 +1,7 @@ package nebulosa.indi.client.device.mount import nebulosa.indi.client.INDIClient +import nebulosa.indi.client.device.DriverInfo import nebulosa.indi.client.device.INDIDevice import nebulosa.indi.client.device.handler.INDIGuideOutputHandler import nebulosa.indi.device.firstOnSwitch @@ -19,8 +20,8 @@ import java.time.ZoneOffset // https://github.com/indilib/indi/blob/master/libs/indibase/inditelescope.cpp internal open class INDIMount( - override val sender: INDIClient, - override val name: String, + final override val sender: INDIClient, + final override val driverInfo: DriverInfo, ) : INDIDevice(), Mount { @Volatile final override var slewing = false diff --git a/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/rotator/INDIRotator.kt b/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/rotator/INDIRotator.kt index d02f56cbb..15ffea282 100644 --- a/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/rotator/INDIRotator.kt +++ b/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/rotator/INDIRotator.kt @@ -1,6 +1,7 @@ package nebulosa.indi.client.device.rotator import nebulosa.indi.client.INDIClient +import nebulosa.indi.client.device.DriverInfo import nebulosa.indi.client.device.INDIDevice import nebulosa.indi.device.firstOnSwitch import nebulosa.indi.device.rotator.* @@ -10,8 +11,8 @@ import nebulosa.indi.protocol.Vector.Companion.isBusy // https://github.com/indilib/indi/blob/master/libs/indibase/indirotatorinterface.cpp internal open class INDIRotator( - override val sender: INDIClient, - override val name: String, + final override val sender: INDIClient, + final override val driverInfo: DriverInfo, ) : INDIDevice(), Rotator { @Volatile final override var moving = false diff --git a/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/wheel/INDIFilterWheel.kt b/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/wheel/INDIFilterWheel.kt index a853c2e14..828912742 100644 --- a/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/wheel/INDIFilterWheel.kt +++ b/nebulosa-indi-client/src/main/kotlin/nebulosa/indi/client/device/wheel/INDIFilterWheel.kt @@ -1,6 +1,7 @@ package nebulosa.indi.client.device.wheel import nebulosa.indi.client.INDIClient +import nebulosa.indi.client.device.DriverInfo import nebulosa.indi.client.device.INDIDevice import nebulosa.indi.device.filterwheel.* import nebulosa.indi.protocol.* @@ -9,8 +10,8 @@ import nebulosa.indi.protocol.Vector.Companion.isBusy // https://github.com/indilib/indi/blob/master/libs/indibase/indifilterwheel.cpp internal open class INDIFilterWheel( - override val sender: INDIClient, - override val name: String, + final override val sender: INDIClient, + final override val driverInfo: DriverInfo, ) : INDIDevice(), FilterWheel { @Volatile final override var count = 0 diff --git a/nebulosa-indi-device/src/main/kotlin/nebulosa/indi/device/Device.kt b/nebulosa-indi-device/src/main/kotlin/nebulosa/indi/device/Device.kt index 6078b3eb1..64d96c6cd 100644 --- a/nebulosa-indi-device/src/main/kotlin/nebulosa/indi/device/Device.kt +++ b/nebulosa-indi-device/src/main/kotlin/nebulosa/indi/device/Device.kt @@ -21,6 +21,12 @@ interface Device : INDIProtocolHandler, AutoCloseable, Comparable { val snoopedDevices: List + val driverName: String + get() = "" + + val driverVersion: String + get() = "" + fun connect() fun disconnect() @@ -30,15 +36,15 @@ interface Device : INDIProtocolHandler, AutoCloseable, Comparable { } fun ask() { - sendMessageToServer(GetProperties().also { it.device = name }) + sendMessageToServer(GetProperties(name)) } fun enableBlob() { - sendMessageToServer(EnableBLOB().also { it.device = name }) + sendMessageToServer(EnableBLOB(name)) } fun disableBlob() { - sendMessageToServer(EnableBLOB().also { it.value = BLOBEnable.NEVER; it.device = name }) + sendMessageToServer(EnableBLOB(name, value = BLOBEnable.NEVER)) } fun snoop(devices: Iterable) diff --git a/nebulosa-indi-device/src/main/kotlin/nebulosa/indi/device/guider/GuideOutputAttached.kt b/nebulosa-indi-device/src/main/kotlin/nebulosa/indi/device/guider/GuideOutputAttached.kt index b1b5357ba..2cdd1e4ce 100644 --- a/nebulosa-indi-device/src/main/kotlin/nebulosa/indi/device/guider/GuideOutputAttached.kt +++ b/nebulosa-indi-device/src/main/kotlin/nebulosa/indi/device/guider/GuideOutputAttached.kt @@ -2,4 +2,4 @@ package nebulosa.indi.device.guider import nebulosa.indi.device.DeviceAttached -data class GuideOutputAttached(override val device: GuideOutput) : GuideOutputEvent, DeviceAttached +data class GuideOutputAttached(override val device: GuideOutput) : GuideOutputEvent, DeviceAttached diff --git a/nebulosa-indi-device/src/main/kotlin/nebulosa/indi/device/guider/GuideOutputCanPulseGuideChanged.kt b/nebulosa-indi-device/src/main/kotlin/nebulosa/indi/device/guider/GuideOutputCanPulseGuideChanged.kt index 5ac443a7a..188bb9c86 100644 --- a/nebulosa-indi-device/src/main/kotlin/nebulosa/indi/device/guider/GuideOutputCanPulseGuideChanged.kt +++ b/nebulosa-indi-device/src/main/kotlin/nebulosa/indi/device/guider/GuideOutputCanPulseGuideChanged.kt @@ -2,4 +2,4 @@ package nebulosa.indi.device.guider import nebulosa.indi.device.PropertyChangedEvent -data class GuideOutputCanPulseGuideChanged(override val device: GuideOutput) : PropertyChangedEvent, GuideOutputEvent +data class GuideOutputCanPulseGuideChanged(override val device: GuideOutput) : GuideOutputEvent, PropertyChangedEvent diff --git a/nebulosa-indi-device/src/main/kotlin/nebulosa/indi/device/guider/GuideOutputDetached.kt b/nebulosa-indi-device/src/main/kotlin/nebulosa/indi/device/guider/GuideOutputDetached.kt index 4daf6ed43..db4858159 100644 --- a/nebulosa-indi-device/src/main/kotlin/nebulosa/indi/device/guider/GuideOutputDetached.kt +++ b/nebulosa-indi-device/src/main/kotlin/nebulosa/indi/device/guider/GuideOutputDetached.kt @@ -2,4 +2,4 @@ package nebulosa.indi.device.guider import nebulosa.indi.device.DeviceDetached -data class GuideOutputDetached(override val device: GuideOutput) : GuideOutputEvent, DeviceDetached +data class GuideOutputDetached(override val device: GuideOutput) : GuideOutputEvent, DeviceDetached diff --git a/nebulosa-indi-device/src/main/kotlin/nebulosa/indi/device/guider/GuideOutputEvent.kt b/nebulosa-indi-device/src/main/kotlin/nebulosa/indi/device/guider/GuideOutputEvent.kt index d146979a8..a5fc8ee8c 100644 --- a/nebulosa-indi-device/src/main/kotlin/nebulosa/indi/device/guider/GuideOutputEvent.kt +++ b/nebulosa-indi-device/src/main/kotlin/nebulosa/indi/device/guider/GuideOutputEvent.kt @@ -2,7 +2,7 @@ package nebulosa.indi.device.guider import nebulosa.indi.device.DeviceEvent -interface GuideOutputEvent : DeviceEvent { +interface GuideOutputEvent : DeviceEvent { - override val device: T + override val device: GuideOutput } diff --git a/nebulosa-indi-device/src/main/kotlin/nebulosa/indi/device/guider/GuideOutputPulsingChanged.kt b/nebulosa-indi-device/src/main/kotlin/nebulosa/indi/device/guider/GuideOutputPulsingChanged.kt index ddf9fbc1e..d78cf36bb 100644 --- a/nebulosa-indi-device/src/main/kotlin/nebulosa/indi/device/guider/GuideOutputPulsingChanged.kt +++ b/nebulosa-indi-device/src/main/kotlin/nebulosa/indi/device/guider/GuideOutputPulsingChanged.kt @@ -2,4 +2,4 @@ package nebulosa.indi.device.guider import nebulosa.indi.device.PropertyChangedEvent -data class GuideOutputPulsingChanged(override val device: GuideOutput) : PropertyChangedEvent, GuideOutputEvent +data class GuideOutputPulsingChanged(override val device: GuideOutput) : GuideOutputEvent, PropertyChangedEvent diff --git a/nebulosa-indi-protocol/src/main/kotlin/nebulosa/indi/protocol/EnableBLOB.kt b/nebulosa-indi-protocol/src/main/kotlin/nebulosa/indi/protocol/EnableBLOB.kt index 422485c70..7d32e39cd 100644 --- a/nebulosa-indi-protocol/src/main/kotlin/nebulosa/indi/protocol/EnableBLOB.kt +++ b/nebulosa-indi-protocol/src/main/kotlin/nebulosa/indi/protocol/EnableBLOB.kt @@ -4,11 +4,11 @@ import nebulosa.indi.protocol.INDIProtocol.Companion.writeXML import java.io.PrintStream data class EnableBLOB( - override var name: String = "", override var device: String = "", + override var name: String = "", + var value: BLOBEnable = BLOBEnable.ALSO, override var message: String = "", override var timestamp: String = "", - var value: BLOBEnable = BLOBEnable.ALSO, ) : INDIProtocol { override fun writeTo(stream: PrintStream) = stream.writeXML(