-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
53 changed files
with
1,960 additions
and
1,575 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 2 additions & 33 deletions
35
api/src/main/kotlin/nebulosa/api/controllers/INDIController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 21 additions & 1 deletion
22
api/src/main/kotlin/nebulosa/api/data/events/CameraCaptureFinished.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,30 @@ | ||
package nebulosa.api.data.events | ||
|
||
import com.fasterxml.jackson.core.JsonGenerator | ||
import com.fasterxml.jackson.databind.SerializerProvider | ||
import com.fasterxml.jackson.databind.ser.std.StdSerializer | ||
import nebulosa.api.services.CameraExposureTask | ||
import nebulosa.indi.device.camera.CameraEvent | ||
import org.springframework.beans.factory.annotation.Qualifier | ||
import org.springframework.stereotype.Component | ||
|
||
data class CameraCaptureFinished(val task: CameraExposureTask) : CameraEvent { | ||
data class CameraCaptureFinished(override val task: CameraExposureTask) : TaskEvent, CameraEvent { | ||
|
||
override val device | ||
get() = task.camera | ||
|
||
@Component | ||
@Qualifier("serializer") | ||
class Serializer : StdSerializer<CameraCaptureFinished>(CameraCaptureFinished::class.java) { | ||
|
||
override fun serialize( | ||
event: CameraCaptureFinished, | ||
gen: JsonGenerator, | ||
provider: SerializerProvider, | ||
) { | ||
gen.writeStartObject() | ||
gen.writeStringField("camera", event.device.name) | ||
gen.writeEndObject() | ||
} | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
api/src/main/kotlin/nebulosa/api/data/events/CameraCaptureProgressChanged.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package nebulosa.api.data.events | ||
|
||
import com.fasterxml.jackson.core.JsonGenerator | ||
import com.fasterxml.jackson.databind.SerializerProvider | ||
import com.fasterxml.jackson.databind.ser.std.StdSerializer | ||
import nebulosa.api.services.CameraExposureTask | ||
import nebulosa.indi.device.camera.CameraEvent | ||
import org.springframework.beans.factory.annotation.Qualifier | ||
import org.springframework.stereotype.Component | ||
|
||
data class CameraCaptureProgressChanged( | ||
override val task: CameraExposureTask, | ||
) : TaskEvent, CameraEvent { | ||
|
||
override val device | ||
get() = task.camera | ||
|
||
@Component | ||
@Qualifier("serializer") | ||
class Serializer : StdSerializer<CameraCaptureProgressChanged>(CameraCaptureProgressChanged::class.java) { | ||
|
||
override fun serialize( | ||
event: CameraCaptureProgressChanged, | ||
gen: JsonGenerator, | ||
provider: SerializerProvider, | ||
) { | ||
gen.writeStartObject() | ||
gen.writeStringField("camera", event.device.name) | ||
gen.writeNumberField("remainingAmount", event.task.remainingAmount) | ||
gen.writeNumberField("frameRemainingTime", event.task.frameRemainingTime) | ||
gen.writeNumberField("frameProgress", event.task.frameProgress) | ||
gen.writeNumberField("totalAmount", event.task.amount) | ||
gen.writeNumberField("totalRemainingTime", event.task.totalRemainingTime) | ||
gen.writeNumberField("totalProgress", event.task.totalProgress) | ||
gen.writeNumberField("totalExposureTime", event.task.totalExposureTime) | ||
gen.writeBooleanField("indeterminate", event.task.indeterminate) | ||
gen.writeEndObject() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package nebulosa.api.data.events | ||
|
||
import nebulosa.common.concurrency.ThreadedJob | ||
|
||
sealed interface TaskEvent { | ||
|
||
val task: ThreadedJob<*> | ||
} |
Oops, something went wrong.