Public Types | |
| enum | error_code_t { UNKNOWN = -1, USB_NOT_FOUND, USB_CONFIGURATION, USB_INTERFACE, USB_READ, USB_WRITE, DISS5_DATA_OVERFLOW, DISS5_SCAN_PARAMS_NOT_FOUND } |
| Possible errors that this driver will throw. More... | |
Public Member Functions | |
| Diss5 () | |
| constructor | |
| ~Diss5 () | |
| destructor | |
| void | Send (ScanParams &aParams) |
| Sends a set of scan parameters to the DISS-5. | |
| void | Send (RoiScan &aParams) |
| Sends a set of ROI scan parameters to the DISS-5. | |
| void | Send (const AdjustParams &aParams) |
| Sends a set of adjustment parameters to the DISS-5. | |
| void | Reset () |
| Sends the reset command to the DISS-5 on the USB bus. | |
| bool | Read (uint16_t *aPoint, double aTimeout=0) |
| Read the intensity value back for a single point. | |
| bool | ReadBlk (Image *aImage, double aTimeout=0) |
| bool | ReadBlk (RoiImage *aRoiImage, double aTimeout=0) |
| bool | Read (Image *aImage, double aTimeout=0) |
| bool | Read (RoiImage *aRoiImage, double aTimeout=0) |
| bool | Read (Footer *aFooter, double aTimeout=0) |
| void | ClearFifo () |
| clears out any extra data which may be still in the read buffer | |
| void | SendStop (bool aKeepExtern=false) |
| sends a set of ScanParams to stop the current scan | |
| void | Debug (uint aLevel) |
| bool | ReadTimeout (uint aBytes) |
| checks to see if we read 0 bytes more than READ_TIMEOUT times | |
Private Member Functions | |
| void | UsbWrite (const char *aMsg, uint aSize) |
| int | UsbRead (Footer *aFooter, uint16_t *aData, uint aSize) |
| void | CheckMessageQueue (const Footer &aFooter) |
| looks through the messages and finds the one we received | |
| std::string | GetConfigPath () const |
| void | LoadDefaultXml () |
| Load the XML config file and parse it. | |
Private Attributes | |
| USB::Device * | mUsbDevice |
| The USB device handle. | |
| USB::Configuration * | mUsbConfig |
| The USB configuration we will use. The DISS-5 currently only supports configuration 1. | |
| USB::Interface * | mUsbInterface |
| The interface that will use. It should have 2 EndPoints (pipes). We have to release it when we are finished. | |
| USB::Endpoint * | mReadEndpoint |
| The read interface is pipe 0. | |
| USB::Endpoint * | mWriteEndpoint |
| The write interface is pipe 1. | |
| std::queue< ScanParams > | mParamQueue |
| A queue of ScanParams so we can match up with what we read. | |
| std::queue< RoiScan > | mRoiScanQueue |
| A queue of ScanParams so we can match up with what we read. | |
| char * | mReadBuf |
| The image buffer to be used on Read(). | |
| char * | mExtraBuf |
| uint | mExtraSize |
| point::Footer | mExtraFooter |
| We also need the footer if we have extra data. | |
| uint | mScanId |
| the current scan identifier | |
| uint | mRoiId |
| the current Roi identifier | |
| uint | mZeroReadCount |
| a counter for how many times we read 0 bytes | |
| bool | mNewScan |
| flag stating if a scan is new (and thus we don't worry about timeouts) | |
Possible errors that this driver will throw.
| point::Diss5::Diss5 | ( | ) |
constructor
The constructor instantiates the USB driver and searches the bus for a DISS-5.
| point::Error | is thrown if there is a problem with the USB. The error code is then set to one of the following values:
|
| bool point::Diss5::ReadBlk | ( | Image * | aImage, | |
| double | aTimeout = 0 | |||
| ) |
Retrieve a complete image. This function blocks until we've read an entire image.
| aImage | where we will store the new image. | |
| aTimeout | the maximum time will will block on Read in [s]. A value of 0 means infinite wait. |
| bool point::Diss5::ReadBlk | ( | RoiImage * | aRoiImage, | |
| double | aTimeout = 0 | |||
| ) |
Retrieve a complete image. This function blocks until we've read an entire image.
| aRoiImage | where we will store the new image. | |
| aTimeout | the maximum time will will block on Read in [s]. A value of 0 means infinite wait. |
| bool point::Diss5::Read | ( | Image * | aImage, | |
| double | aTimeout = 0 | |||
| ) |
Retrieve an image from the Diss5. If the entire image is not available, just return what we have so far.
| aImage | where we will store the new image. | |
| aTimeout | the maximum time will will block on Read in [s]. A value of 0 means infinite wait. |
| bool point::Diss5::Read | ( | RoiImage * | aRoiImage, | |
| double | aTimeout = 0 | |||
| ) |
Retrieve an image from the Diss5. If the entire image is not available, just return what we have so far.
| aRoiImage | where we will store the new image. | |
| aTimeout | the maximum time will will block on Read in [s]. A value of 0 means infinite wait. |
| bool point::Diss5::Read | ( | Footer * | aFooter, | |
| double | aTimeout = 0 | |||
| ) |
Retrieve a Footer
| aFooter | where we will store the footer data. | |
| aTimeout | the maximum time will will block on Read in [s]. A value of 0 means infinite wait. |
| void point::Diss5::Debug | ( | uint | aLevel | ) | [inline] |
General messages. Use level to indicate the message importance
| void point::Diss5::UsbWrite | ( | const char * | aMsg, | |
| uint | aSize | |||
| ) | [private] |
Write a character stream directly to the USB port we have open.
| aMsg | the raw byte array we will send out | |
| aSize | the number of bytes we will send out |
| int point::Diss5::UsbRead | ( | Footer * | aFooter, | |
| uint16_t * | aData, | |||
| uint | aSize | |||
| ) | [private] |
Read a footer and a message directly from the USB port.
| aFooter | The footer we would like to store the data in. This variable must already be allocated. | |
| aData | A data pointer for raw storage. Must be already allocated and ACQ_BUF_SIZE*sizeof(uint8_t) bytes large. | |
| aSize | The size available in aData for the image [bytes] |
| std::string point::Diss5::GetConfigPath | ( | ) | const [private] |
Returns the path to the diss5.xml file. This path can be set by changing the DISS5_PATH environment variable. Otherwise, it will default to the share folder of the install location of libdiss5 (ie /usr/local/share/libdiss5).
| void point::Diss5::LoadDefaultXml | ( | ) | [private] |
Load the XML config file and parse it.
The XML has the following format. There are currently no default values implemented, so please be sure to include all the values. The XML file can be located either at a location specified by LIBDISS5_PATH as an environment variable or by default a location configured with the package (ie /usr/local/share/libdiss5). After parsing the XML, this command sends an AdjustParams message to the Diss5 specifying the imaging parameters.
<?xml version="1.0" standalone="no" ?> <!-- diss5 config file --> <diss5> <adjust_params> <bias> <channel id="1" val="575" /> <channel id="2" val="555" /> <channel id="3" val="555" /> <channel id="4" val="555" /> <channel id="12" val="85" /> <channel id="34" val="85" /> </bias> <offset x="485" y="485" /> <gain x="800" y="800" /> </adjust_params> </diss5>
char* point::Diss5::mExtraBuf [private] |
If there is extra data from a Read(), this is the pointer to the remainder inside mReadBuf
uint point::Diss5::mExtraSize [private] |
If there is extra data from a Read(), this is the number of bytes of extra data we have inside mReadBuf
1.5.3