TwiceAsNice
2019-02-18
|
#include <DsiDevice.h>
Public Member Functions | |
Device (const char *devname=0) | |
Initialize a generic (base class) DSI device. More... | |
virtual | ~Device () |
virtual unsigned int | getReadWidth () |
virtual unsigned int | getReadHeightEven () |
virtual unsigned int | getReadHeightOdd () |
virtual unsigned int | getReadHeight () |
virtual unsigned int | getReadBpp () |
virtual unsigned int | getImageWidth () |
virtual unsigned int | getImageHeight () |
virtual unsigned int | getImageOffsetX () |
virtual unsigned int | getImageOffsetY () |
virtual float | getPixelSizeX () |
virtual float | getPixelSizeY () |
virtual bool | isColor () |
virtual bool | isBinnable () |
virtual bool | hasTempSensor () |
virtual float | ccdTemp () |
virtual void | abortExposure () |
Set the device state to "abort exposure requested." The exposure will not be aborted as soon as possible. More... | |
virtual unsigned int | getAdRegister (DSI::AdRegister reg) |
Return the value of the specified A-D register. More... | |
virtual void | setAdRegister (DSI::AdRegister reg, unsigned int newval) |
Set the value of the specified A-D register. More... | |
virtual std::string | getCcdChipName () |
Return the CCD chip name for this device. More... | |
virtual std::string | getCameraName () |
virtual void | setCameraName (std::string &) |
virtual unsigned char * | getTestPattern () |
virtual unsigned char * | getImage () |
virtual void | setExposureTime (double exptime) |
virtual double | getExposureTime () |
virtual unsigned char * | downloadImage () |
virtual int | startExposure (int howlong, int gain=0, int offs=0x0ff) |
virtual int | ExposureInProgress () |
virtual unsigned char * | ccdFramebuffer () |
virtual void | set1x1Binning () |
virtual void | set2x2Binning () |
virtual void | enable2x2Binning () |
virtual void | disable2x2Binning () |
virtual int | getGain () |
virtual int | setGain (int gain) |
virtual void | setVddOn (bool s) |
void | setDebug (bool turnOn) |
bool | isDebug () |
Protected Member Functions | |
void | print_data (std::string command, unsigned char buffer[], size_t length) |
void | loadSerialNumber () |
Initialize the DSI serial number by reading the EEPROM data. More... | |
void | loadCcdChipName () |
Initialize the CCD chip name by reading the EEPROM data where it is stored. More... | |
void | loadStatus () |
Initialize the internal state to reflect the USB bus speed and whether or not the DSI device has firmware debugging(?) enabled. More... | |
void | loadVersion () |
Initialized DSI device version information. More... | |
void | loadEepromLength () |
void | loadCameraName () |
virtual ReadoutMode | getReadoutMode () |
Retrieve the DSI device current readout mode. More... | |
virtual void | setReadoutMode (DSI::ReadoutMode rm) |
Set the DSI device readout mode. More... | |
unsigned int | command (DeviceCommand __command) |
Internal helper for sending a command to the DSI device. More... | |
unsigned int | command (DeviceCommand __command, int __option) |
Internal helper for sending a command to the DSI device. More... | |
unsigned int | command (DeviceCommand __command, int __option, int __length) |
Internal helper for sending a command to the DSI device. More... | |
unsigned int | command (DeviceCommand __command, int __option, int __length, int __expected) |
Internal helper for sending a command to the DSI device. More... | |
std::string * | getString (int __offset, int __length) |
Retrieve a string value from the specified EEPROM region. More... | |
void | setString (std::string __value, int __offset, int __length) |
unsigned int | getEepromLength () |
Retrieve the EEPROM length. More... | |
unsigned char | getEepromByte (int __offset) |
Read one byte value from the EEPROM. More... | |
unsigned char * | getEepromData (int ___offset, int __length) |
Retrieve a segment of the EEPROM data as a sequence of bytes. More... | |
unsigned char | setEepromByte (unsigned char __byte, int __offset) |
void | setEepromData (unsigned char *__buffer, int ___offset, int __length) |
unsigned int | command (unsigned char *__buffer, int __length, int __expected) |
Write a command buffer to the DSI device and decode the return buffer. More... | |
unsigned int | getByteResult (unsigned char *__buffer) |
Decode byte 4 of the buffer as an 8-bit unsigned integer. More... | |
unsigned int | getShortResult (unsigned char *__buffer) |
Decode bytes 4-5 of the buffer as a 16-bit big-endian unsigned integer. More... | |
unsigned int | getIntResult (unsigned char *__buffer) |
Decode bytes 4-7 of the buffer as a 32-bit big-endian unsigned integer. More... | |
virtual void | initImager (const char *devname=0) |
virtual unsigned char * | getImage (int howlong) |
virtual unsigned char * | getImage (DeviceCommand __command, int howlong) |
void | sendRegister (AdRegister adr, unsigned int arg) |
Protected Attributes | |
unsigned char * | framebuffer |
unsigned int | read_width |
unsigned int | read_height_even |
unsigned int | read_height_odd |
unsigned int | read_height |
unsigned int | read_bpp |
unsigned int | image_width |
unsigned int | image_height |
unsigned int | image_offset_x |
unsigned int | image_offset_y |
float | pixel_size_x |
float | pixel_size_y |
unsigned int | exposure_time |
float | ccd_temp |
bool | test_pattern |
bool | is_color |
bool | is_high_gain |
bool | is_binnable |
bool | has_tempsensor |
bool | vdd_on |
double | aspect_ratio |
libusb_device * | dev |
libusb_device_handle * | handle |
unsigned char | command_sequence_number |
ReadoutMode | readout_mode |
UsbSpeed | usb_speed |
bool | firmware_debug |
bool | binning2x2 |
unsigned int | dsi_family |
unsigned int | dsi_model |
unsigned int | dsi_firmware_version |
unsigned int | dsi_firmware_revision |
unsigned long long | serial_number |
std::string | ccd_chip_name |
bool | abort_requested |
unsigned int | timeout_response |
unsigned int | timeout_request |
unsigned int | timeout_image |
Static Protected Attributes | |
static const unsigned int | TIMEOUT_FULL_MAX_IMAGE = 0x1770 |
static const unsigned int | TIMEOUT_HIGH_MAX_IMAGE = 0x0fa0 |
static const unsigned int | TIMEOUT_FULL_MAX_RESPONSE = 0x03e8 |
static const unsigned int | TIMEOUT_HIGH_MAX_RESPONSE = 0x03e8 |
static const unsigned int | TIMEOUT_FULL_MAX_REQUEST = 0x03e8 |
static const unsigned int | TIMEOUT_HIGH_MAX_REQUEST = 0x03e8 |
Private Attributes | |
bool | log_commands |
int | eeprom_length |
std::string | camera_name |
DSI::Device::Device | ( | const char * | devname = 0 | ) |
Initialize a generic (base class) DSI device.
The generic device will initialize the image size parameters to correspond to a test pattern as well as set the test pattern flag to true. The generic device has no way of knowing the correct CCD size parameters. Derived classes are responsible for overriding these settings. If they do not, all you will be able to retrieve is a test pattern image.
devname |
|
virtual |
|
virtual |
Set the device state to "abort exposure requested." The exposure will not be aborted as soon as possible.
|
virtual |
|
inlinevirtual |
|
protected |
Internal helper for sending a command to the DSI device.
If the command is one which requires no parameters, then the actual execution will be delegated to command(DeviceCommand,int,int), otherwise a dsi_exception is thrown.
__command | command to be executed. |
|
protected |
Internal helper for sending a command to the DSI device.
This determines what the length of the actual command will be and then delgates to command(DeviceCommand,int,int) or command(DeviceCommand).
__command | command to be executed. |
__option | command argument, ignored for SOME commands. |
|
protected |
Internal helper for sending a command to the DSI device.
This determines what the expected response length is and then delegates actually processing to command(DeviceCommand,int,int,int).
__command | command to be executed. |
__option | |
__length |
|
protected |
Internal helper for sending a command to the DSI device.
This formats the command as a sequence of bytes and delegates to command(unsigned char *,int,int)
__command | command to be executed. |
__option | |
__length | |
__expected |
|
protected |
Write a command buffer to the DSI device and decode the return buffer.
__buffer | raw command buffer. |
__length | length of the command buffer, in bytes. |
__expected | expected length of the response buffer, in bytes. |
DSI commands return either 0, 1, 2, or 4 byte results. The results are nominally unsigned integers although in some cases (e.g. GET_VERSION), the 4 bytes are actually 4 separate bytes. However, all 4-byte responses are treated as 32-bit unsigned integers and are decoded and returned that way. Similarly, 2-byte responses are treated as 16-bit unsigned integers and are decoded and returned that way.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Return the value of the specified A-D register.
reg | which register to query. |
|
protected |
Decode byte 4 of the buffer as an 8-bit unsigned integer.
__buffer | raw query result buffer from DSI. |
|
virtual |
|
virtual |
Return the CCD chip name for this device.
|
protected |
Read one byte value from the EEPROM.
__offset | offset from EEPROM start of byte to read |
|
protected |
Retrieve a segment of the EEPROM data as a sequence of bytes.
The result will be allocated on the heap as an array of unsigned bytes and must be deleted by the caller.
unsigned char *eepromData = DSI::Device::getEepromData(0,8); ... delete [] eepromData;
__offset | EEPROM offset for start of data. |
__length | length of EEPROM region to read. |
|
protected |
Retrieve the EEPROM length.
|
virtual |
|
virtual |
|
protectedvirtual |
|
protectedvirtual |
|
virtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
protected |
Decode bytes 4-7 of the buffer as a 32-bit big-endian unsigned integer.
__buffer | raw query result buffer from DSI. |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
protectedvirtual |
Retrieve the DSI device current readout mode.
|
inlinevirtual |
|
protected |
Decode bytes 4-5 of the buffer as a 16-bit big-endian unsigned integer.
__buffer | raw query result buffer from DSI. |
|
protected |
Retrieve a string value from the specified EEPROM region.
The string will be allocated on the heap and must be deleted by the caller.
std::string *foo = DSI::Device::getString(8, 20); ... delete [] foo;
__offset | EEPROM offset for start of string. |
__length | length of EEPROM region to read. |
|
virtual |
|
inlinevirtual |
|
protectedvirtual |
Reimplemented in DSI::DsiColor, DSI::DsiColorII, DSI::DsiColorIII, DSI::DsiPro, DSI::DsiProII, and DSI::DsiProIII.
|
inlinevirtual |
|
inlinevirtual |
|
inline |
|
protected |
|
protected |
Initialize the CCD chip name by reading the EEPROM data where it is stored.
|
protected |
|
protected |
Initialize the DSI serial number by reading the EEPROM data.
NB: the Meade driver appears to write to the EEPROM if the serial number looks bogus. It write a "serial number" generated from the current date/time which is just plain weird. I suspect that code was an artifact of early engineering samples provided to the original developer that may not have had serial number information burned in the EEPROM. At least, that would make some sense.
|
protected |
Initialize the internal state to reflect the USB bus speed and whether or not the DSI device has firmware debugging(?) enabled.
|
protected |
Initialized DSI device version information.
This queries the device to determine the device family, model, version, and revision. However, the device does not actually identify itself at all. All DSI devices claim to be family 10, model 1, revision 1. If you really want to know what you have, you need to
|
protected |
|
protected |
|
virtual |
|
virtual |
|
virtual |
Set the value of the specified A-D register.
reg | which register to set. |
newval | new value to be assigned. |
XXX: What does the value mean?
|
virtual |
|
inline |
|
protected |
|
protected |
|
virtual |
|
virtual |
|
protectedvirtual |
Set the DSI device readout mode.
rm |
|
protected |
|
virtual |
|
virtual |
|
protected |
|
protected |
|
protected |
|
private |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
private |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
private |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |