Trait ascom_alpaca::api::Camera

source ·
pub trait Camera: Device + Send + Sync {
Show 71 methods // Provided methods async fn bayer_offset_x(&self) -> ASCOMResult<i32> { ... } async fn bayer_offset_y(&self) -> ASCOMResult<i32> { ... } async fn bin_x(&self) -> ASCOMResult<i32> { ... } async fn set_bin_x(&self, bin_x: i32) -> ASCOMResult { ... } async fn bin_y(&self) -> ASCOMResult<i32> { ... } async fn set_bin_y(&self, bin_y: i32) -> ASCOMResult { ... } async fn camera_state(&self) -> ASCOMResult<CameraState> { ... } async fn camera_xsize(&self) -> ASCOMResult<i32> { ... } async fn camera_ysize(&self) -> ASCOMResult<i32> { ... } async fn can_abort_exposure(&self) -> ASCOMResult<bool> { ... } async fn can_asymmetric_bin(&self) -> ASCOMResult<bool> { ... } async fn can_fast_readout(&self) -> ASCOMResult<bool> { ... } async fn can_get_cooler_power(&self) -> ASCOMResult<bool> { ... } async fn can_pulse_guide(&self) -> ASCOMResult<bool> { ... } async fn can_set_ccd_temperature(&self) -> ASCOMResult<bool> { ... } async fn can_stop_exposure(&self) -> ASCOMResult<bool> { ... } async fn ccd_temperature(&self) -> ASCOMResult<f64> { ... } async fn cooler_on(&self) -> ASCOMResult<bool> { ... } async fn set_cooler_on(&self, cooler_on: bool) -> ASCOMResult { ... } async fn cooler_power(&self) -> ASCOMResult<f64> { ... } async fn electrons_per_adu(&self) -> ASCOMResult<f64> { ... } async fn exposure_max(&self) -> ASCOMResult<f64> { ... } async fn exposure_min(&self) -> ASCOMResult<f64> { ... } async fn exposure_resolution(&self) -> ASCOMResult<f64> { ... } async fn fast_readout(&self) -> ASCOMResult<bool> { ... } async fn set_fast_readout(&self, fast_readout: bool) -> ASCOMResult { ... } async fn full_well_capacity(&self) -> ASCOMResult<f64> { ... } async fn gain(&self) -> ASCOMResult<i32> { ... } async fn set_gain(&self, gain: i32) -> ASCOMResult { ... } async fn gain_max(&self) -> ASCOMResult<i32> { ... } async fn gain_min(&self) -> ASCOMResult<i32> { ... } async fn gains(&self) -> ASCOMResult<Vec<String>> { ... } async fn has_shutter(&self) -> ASCOMResult<bool> { ... } async fn heat_sink_temperature(&self) -> ASCOMResult<f64> { ... } async fn image_array(&self) -> ASCOMResult<ImageArray> { ... } async fn image_ready(&self) -> ASCOMResult<bool> { ... } async fn is_pulse_guiding(&self) -> ASCOMResult<bool> { ... } async fn last_exposure_duration(&self) -> ASCOMResult<f64> { ... } async fn last_exposure_start_time(&self) -> ASCOMResult<SystemTime> { ... } async fn max_adu(&self) -> ASCOMResult<i32> { ... } async fn max_bin_x(&self) -> ASCOMResult<i32> { ... } async fn max_bin_y(&self) -> ASCOMResult<i32> { ... } async fn num_x(&self) -> ASCOMResult<i32> { ... } async fn set_num_x(&self, num_x: i32) -> ASCOMResult { ... } async fn num_y(&self) -> ASCOMResult<i32> { ... } async fn set_num_y(&self, num_y: i32) -> ASCOMResult { ... } async fn offset(&self) -> ASCOMResult<i32> { ... } async fn set_offset(&self, offset: i32) -> ASCOMResult { ... } async fn offset_max(&self) -> ASCOMResult<i32> { ... } async fn offset_min(&self) -> ASCOMResult<i32> { ... } async fn offsets(&self) -> ASCOMResult<Vec<String>> { ... } async fn percent_completed(&self) -> ASCOMResult<i32> { ... } async fn pixel_size_x(&self) -> ASCOMResult<f64> { ... } async fn pixel_size_y(&self) -> ASCOMResult<f64> { ... } async fn readout_mode(&self) -> ASCOMResult<i32> { ... } async fn set_readout_mode(&self, readout_mode: i32) -> ASCOMResult { ... } async fn readout_modes(&self) -> ASCOMResult<Vec<String>> { ... } async fn sensor_name(&self) -> ASCOMResult<String> { ... } async fn sensor_type(&self) -> ASCOMResult<SensorType> { ... } async fn set_ccd_temperature(&self) -> ASCOMResult<f64> { ... } async fn set_set_ccd_temperature( &self, set_ccd_temperature: f64 ) -> ASCOMResult { ... } async fn start_x(&self) -> ASCOMResult<i32> { ... } async fn set_start_x(&self, start_x: i32) -> ASCOMResult { ... } async fn start_y(&self) -> ASCOMResult<i32> { ... } async fn set_start_y(&self, start_y: i32) -> ASCOMResult { ... } async fn sub_exposure_duration(&self) -> ASCOMResult<f64> { ... } async fn set_sub_exposure_duration( &self, sub_exposure_duration: f64 ) -> ASCOMResult { ... } async fn abort_exposure(&self) -> ASCOMResult { ... } async fn pulse_guide( &self, direction: PutPulseGuideDirection, duration: i32 ) -> ASCOMResult { ... } async fn start_exposure(&self, duration: f64, light: bool) -> ASCOMResult { ... } async fn stop_exposure(&self) -> ASCOMResult { ... }
}
Available on crate feature camera only.
Expand description

Camera Specific Methods

Provided Methods§

source

async fn bayer_offset_x(&self) -> ASCOMResult<i32>

Returns the X offset of the Bayer matrix, as defined in SensorType.

source

async fn bayer_offset_y(&self) -> ASCOMResult<i32>

Returns the Y offset of the Bayer matrix, as defined in SensorType.

source

async fn bin_x(&self) -> ASCOMResult<i32>

Returns the binning factor for the X axis.

source

async fn set_bin_x(&self, bin_x: i32) -> ASCOMResult

Sets the binning factor for the X axis.

source

async fn bin_y(&self) -> ASCOMResult<i32>

Returns the binning factor for the Y axis.

source

async fn set_bin_y(&self, bin_y: i32) -> ASCOMResult

Sets the binning factor for the Y axis.

source

async fn camera_state(&self) -> ASCOMResult<CameraState>

Returns the current camera operational state.

source

async fn camera_xsize(&self) -> ASCOMResult<i32>

Returns the width of the CCD camera chip in unbinned pixels.

source

async fn camera_ysize(&self) -> ASCOMResult<i32>

Returns the height of the CCD camera chip in unbinned pixels.

source

async fn can_abort_exposure(&self) -> ASCOMResult<bool>

Returns true if the camera can abort exposures; false if not.

source

async fn can_asymmetric_bin(&self) -> ASCOMResult<bool>

Returns a flag showing whether this camera supports asymmetric binning

source

async fn can_fast_readout(&self) -> ASCOMResult<bool>

Indicates whether the camera has a fast readout mode.

source

async fn can_get_cooler_power(&self) -> ASCOMResult<bool>

If true, the camera’s cooler power setting can be read.

source

async fn can_pulse_guide(&self) -> ASCOMResult<bool>

Returns a flag indicating whether this camera supports pulse guiding.

source

async fn can_set_ccd_temperature(&self) -> ASCOMResult<bool>

Returns a flag indicatig whether this camera supports setting the CCD temperature

source

async fn can_stop_exposure(&self) -> ASCOMResult<bool>

Returns a flag indicating whether this camera can stop an exposure that is in progress

source

async fn ccd_temperature(&self) -> ASCOMResult<f64>

Returns the current CCD temperature in degrees Celsius.

source

async fn cooler_on(&self) -> ASCOMResult<bool>

Returns the current cooler on/off state.

source

async fn set_cooler_on(&self, cooler_on: bool) -> ASCOMResult

Turns on and off the camera cooler. True = cooler on, False = cooler off

source

async fn cooler_power(&self) -> ASCOMResult<f64>

Returns the present cooler power level, in percent.

source

async fn electrons_per_adu(&self) -> ASCOMResult<f64>

Returns the gain of the camera in photoelectrons per A/D unit.

source

async fn exposure_max(&self) -> ASCOMResult<f64>

Returns the maximum exposure time supported by StartExposure.

source

async fn exposure_min(&self) -> ASCOMResult<f64>

Returns the Minimium exposure time in seconds that the camera supports through StartExposure.

source

async fn exposure_resolution(&self) -> ASCOMResult<f64>

Returns the smallest increment in exposure time supported by StartExposure.

source

async fn fast_readout(&self) -> ASCOMResult<bool>

Returns whenther Fast Readout Mode is enabled.

source

async fn set_fast_readout(&self, fast_readout: bool) -> ASCOMResult

Sets whether Fast Readout Mode is enabled.

source

async fn full_well_capacity(&self) -> ASCOMResult<f64>

Reports the full well capacity of the camera in electrons, at the current camera settings (binning, SetupDialog settings, etc.).

source

async fn gain(&self) -> ASCOMResult<i32>

The camera’s gain (GAIN VALUE MODE) OR the index of the selected camera gain description in the Gains array (GAINS INDEX MODE).

source

async fn set_gain(&self, gain: i32) -> ASCOMResult

The camera’s gain (GAIN VALUE MODE) OR the index of the selected camera gain description in the Gains array (GAINS INDEX MODE).

source

async fn gain_max(&self) -> ASCOMResult<i32>

Returns the maximum value of Gain.

source

async fn gain_min(&self) -> ASCOMResult<i32>

Returns the Minimum value of Gain.

source

async fn gains(&self) -> ASCOMResult<Vec<String>>

Returns the Gains supported by the camera.

source

async fn has_shutter(&self) -> ASCOMResult<bool>

Returns a flag indicating whether this camera has a mechanical shutter.

source

async fn heat_sink_temperature(&self) -> ASCOMResult<f64>

Returns the current heat sink temperature (called “ambient temperature” by some manufacturers) in degrees Celsius.

source

async fn image_array(&self) -> ASCOMResult<ImageArray>

Returns an array of 32bit integers containing the pixel values from the last exposure. This call can return either a 2 dimension (monochrome images) or 3 dimension (colour or multi-plane images) array of size NumX * NumY or NumX * NumY * NumPlanes. Where applicable, the size of NumPlanes has to be determined by inspection of the returned Array.

Since 32bit integers are always returned by this call, the returned JSON Type value (0 = Unknown, 1 = short(16bit), 2 = int(32bit), 3 = Double) is always 2. The number of planes is given in the returned Rank value.

When de-serialising to an object it is essential to know the array Rank beforehand so that the correct data class can be used. This can be achieved through a regular expression or by direct parsing of the returned JSON string to extract the Type and Rank values before de-serialising.

This regular expression accomplishes the extraction into two named groups Type and Rank, which can then be used to select the correct de-serialisation data class:

^*"Type":(?<Type>\d*),"Rank":(?<Rank>\d*)

When the SensorType is Monochrome, RGGB, CMYG, CMYG2 or LRGB, the serialised JSON array should have 2 dimensions. For example, the returned array should appear as below if NumX = 7, NumY = 5 and Pxy represents the pixel value at the zero based position x across and y down the image with the origin in the top left corner of the image.

Please note that this is “column-major” order (column changes most rapidly) from the image’s row and column perspective, while, from the array’s perspective, serialisation is actually effected in “row-major” order (rightmost index changes most rapidly). This unintuitive outcome arises because the ASCOM Camera Interface specification defines the image column dimension as the rightmost array dimension.

[

[P00,P01,P02,P03,P04],

[P10,P11,P12,P13,P14],

[P20,P21,P22,P23,P24],

[P30,P31,P32,P33,P34],

[P40,P41,P42,P43,P44],

[P50,P51,P52,P53,P54],

[P60,P61,P62,P63,P64]

]

When the SensorType is Color, the serialised JSON array will have 3 dimensions. For example, the returned array should appear as below if NumX = 7, NumY = 5 and Rxy, Gxy and Bxy represent the red, green and blue pixel values at the zero based position x across and y down the image with the origin in the top left corner of the image. Please see note above regarding element ordering.

[

[[R00,G00,B00],[R01,G01,B01],[R02,G02,B02],[R03,G03,B03],[R04,G04,B04]],

[[R10,G10,B10],[R11,G11,B11],[R12,G12,B12],[R13,G13,B13],[R14,G14,B14]],

[[R20,G20,B20],[R21,G21,B21],[R22,G22,B22],[R23,G23,B23],[R24,G24,B24]],

[[R30,G30,B30],[R31,G31,B31],[R32,G32,B32],[R33,G33,B33],[R34,G34,B34]],

[[R40,G40,B40],[R41,G41,B41],[R42,G42,B42],[R43,G43,B43],[R44,G44,B44]],

[[R50,G50,B50],[R51,G51,B51],[R52,G52,B52],[R53,G53,B53],[R54,G54,B54]],

[[R60,G60,B60],[R61,G61,B61],[R62,G62,B62],[R63,G63,B63],[R64,G64,B64]],

]

Performance

Returning an image from an Alpaca device as a JSON array is very inefficient and can result in delays of 30 or more seconds while client and device process and send the huge JSON string over the network. A new, much faster mechanic called ImageBytes - Alpaca ImageBytes Concepts and Implementation has been developed that sends data as a binary byte stream and can offer a 10 to 20 fold reduction in transfer time. It is strongly recommended that Alpaca Cameras implement the ImageBytes mechanic as well as the JSON mechanic.

source

async fn image_ready(&self) -> ASCOMResult<bool>

Returns a flag indicating whether the image is ready to be downloaded from the camera.

source

async fn is_pulse_guiding(&self) -> ASCOMResult<bool>

Returns a flag indicating whether the camera is currrently in a PulseGuide operation.

source

async fn last_exposure_duration(&self) -> ASCOMResult<f64>

Reports the actual exposure duration in seconds (i.e. shutter open time).

source

async fn last_exposure_start_time(&self) -> ASCOMResult<SystemTime>

Reports the actual exposure start in the FITS-standard CCYY-MM-DDThh:mm:ss[.sss…] format.

source

async fn max_adu(&self) -> ASCOMResult<i32>

Reports the maximum ADU value the camera can produce.

source

async fn max_bin_x(&self) -> ASCOMResult<i32>

Returns the maximum allowed binning for the X camera axis

source

async fn max_bin_y(&self) -> ASCOMResult<i32>

Returns the maximum allowed binning for the Y camera axis

source

async fn num_x(&self) -> ASCOMResult<i32>

Returns the current subframe width, if binning is active, value is in binned pixels.

source

async fn set_num_x(&self, num_x: i32) -> ASCOMResult

Sets the current subframe width.

source

async fn num_y(&self) -> ASCOMResult<i32>

Returns the current subframe height, if binning is active, value is in binned pixels.

source

async fn set_num_y(&self, num_y: i32) -> ASCOMResult

Sets the current subframe height.

source

async fn offset(&self) -> ASCOMResult<i32>

Returns the camera’s offset (OFFSET VALUE MODE) OR the index of the selected camera offset description in the offsets array (OFFSETS INDEX MODE).

source

async fn set_offset(&self, offset: i32) -> ASCOMResult

Sets the camera’s offset (OFFSET VALUE MODE) OR the index of the selected camera offset description in the offsets array (OFFSETS INDEX MODE).

source

async fn offset_max(&self) -> ASCOMResult<i32>

Returns the maximum value of offset.

source

async fn offset_min(&self) -> ASCOMResult<i32>

Returns the Minimum value of offset.

source

async fn offsets(&self) -> ASCOMResult<Vec<String>>

Returns the offsets supported by the camera.

source

async fn percent_completed(&self) -> ASCOMResult<i32>

Returns the percentage of the current operation that is complete. If valid, returns an integer between 0 and 100, where 0 indicates 0% progress (function just started) and 100 indicates 100% progress (i.e. completion).

source

async fn pixel_size_x(&self) -> ASCOMResult<f64>

Returns the width of the CCD chip pixels in microns.

source

async fn pixel_size_y(&self) -> ASCOMResult<f64>

Returns the Height of the CCD chip pixels in microns.

source

async fn readout_mode(&self) -> ASCOMResult<i32>

ReadoutMode is an index into the array ReadoutModes and returns the desired readout mode for the camera. Defaults to 0 if not set.

source

async fn set_readout_mode(&self, readout_mode: i32) -> ASCOMResult

Sets the ReadoutMode as an index into the array ReadoutModes.

source

async fn readout_modes(&self) -> ASCOMResult<Vec<String>>

This property provides an array of strings, each of which describes an available readout mode of the camera. At least one string must be present in the list.

source

async fn sensor_name(&self) -> ASCOMResult<String>

The name of the sensor used within the camera.

source

async fn sensor_type(&self) -> ASCOMResult<SensorType>

Returns a value indicating whether the sensor is monochrome, or what Bayer matrix it encodes.

source

async fn set_ccd_temperature(&self) -> ASCOMResult<f64>

Returns the current camera cooler setpoint in degrees Celsius.

source

async fn set_set_ccd_temperature(&self, set_ccd_temperature: f64) -> ASCOMResult

Set’s the camera’s cooler setpoint in degrees Celsius.

source

async fn start_x(&self) -> ASCOMResult<i32>

Sets the subframe start position for the X axis (0 based) and returns the current value. If binning is active, value is in binned pixels.

source

async fn set_start_x(&self, start_x: i32) -> ASCOMResult

Sets the current subframe X axis start position in binned pixels.

source

async fn start_y(&self) -> ASCOMResult<i32>

Sets the subframe start position for the Y axis (0 based) and returns the current value. If binning is active, value is in binned pixels.

source

async fn set_start_y(&self, start_y: i32) -> ASCOMResult

Sets the current subframe Y axis start position in binned pixels.

source

async fn sub_exposure_duration(&self) -> ASCOMResult<f64>

The Camera’s sub exposure duration in seconds. Only available in Camera Interface Version 3 and later.

source

async fn set_sub_exposure_duration( &self, sub_exposure_duration: f64 ) -> ASCOMResult

Sets image sub exposure duration in seconds. Only available in Camera Interface Version 3 and later.

source

async fn abort_exposure(&self) -> ASCOMResult

Aborts the current exposure, if any, and returns the camera to Idle state.

source

async fn pulse_guide( &self, direction: PutPulseGuideDirection, duration: i32 ) -> ASCOMResult

Activates the Camera’s mount control sytem to instruct the mount to move in a particular direction for a given period of time

source

async fn start_exposure(&self, duration: f64, light: bool) -> ASCOMResult

Starts an exposure. Use ImageReady to check when the exposure is complete.

source

async fn stop_exposure(&self) -> ASCOMResult

Stops the current exposure, if any. If an exposure is in progress, the readout process is initiated. Ignored if readout is already in process.

Trait Implementations§

source§

impl Hash for dyn Camera

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
source§

impl PartialEq<dyn Camera + 'static> for dyn Camera

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for dyn Camera

Implementors§