The ETHCameraSettings class This class is the inteface between the ETH Camera and the user. More...
#include <ethcamerasettings.h>
Public Member Functions | |
ETHCameraSettings () | |
Creates the API class. | |
ETHCameraSettings (std::string ipAddress, int portNum, int clientID=1) | |
Creates the API class and stores the address and port number. More... | |
ETHCameraSettings (ETHCameraSettings &other)=delete | |
Forbids the copy constructor. | |
~ETHCameraSettings () | |
Deletes the API class and frees all allocated memory. | |
ETHCamStatus | open () |
Opens a UDP-socket with the address and port number previously supplied. More... | |
ETHCamStatus | open (std::string ipAddress, int portNum) |
Opens a UDP-socket. More... | |
ETHCamStatus | openServiceDiscovery (std::vector< std::string > multicastGroups, int portNumber) |
Opens a socket to look for Service Discovery messages. More... | |
ETHCamStatus | openServiceDiscovery (int portNumber) |
Opens a socket to look for Service Discovery messages. More... | |
ETHCamStatus | close () |
Closes the socket. More... | |
ETHCamStatus | closeServiceDiscoverySocket () |
Closes the Service Discovery socket. More... | |
ETHCamStatus | getDatasheet (Datasheet &datasheet, const int maxWaitTimeMs=MAX_WAIT_TIME_MS) |
Attempts to fill a struct with the datasheet of the camera. More... | |
ETHCamStatus | getCamStatus (CamStatus &camStatus, const int maxWaitTimeMs=MAX_WAIT_TIME_MS) |
Attempts to fill a struct with the status of the ETH Camera. More... | |
ETHCamStatus | setCamExclusive (const int expireTimeSeconds=5, const int maxWaitTimeMs=MAX_WAIT_TIME_MS) |
Attempts to assign the control of the camera exclusively to the requesting client. More... | |
ETHCamStatus | eraseCamExclusive (const int maxWaitTimeMs=MAX_WAIT_TIME_MS) |
Attempts to remove the exclusive control look for the requesting client. More... | |
ETHCamStatus | setRegionOfInterest (const RegionOfInterest regionOfInterest, const uint32_t roiIndex, const int maxWaitTimeMs=MAX_WAIT_TIME_MS) |
Attehmps to set the parameters for the region of interest addressed by index. More... | |
ETHCamStatus | getRegionOfInterest (RegionOfInterest ®ionOfInterest, const uint32_t roiIndex, const int maxWaitTimeMs=MAX_WAIT_TIME_MS) |
Gets the parameters for the region of interest addressed by index. More... | |
ETHCamStatus | getRegionsOfInterest (std::vector< uint32_t > &roiIndices, const int maxWaitTimeMs=MAX_WAIT_TIME_MS) |
Gets the indices for all the regions of interest. More... | |
ETHCamStatus | eraseRegionOfInterest (const uint32_t roiIndex, const int maxWaitTimeMs=MAX_WAIT_TIME_MS) |
Attempt to erases all parameters for the requested region of interest. More... | |
ETHCamStatus | subscribeROIVideo (const uint32_t roiIndex=0, const int maxWaitTimeMs=MAX_WAIT_TIME_MS) |
Starts the transmission of a video stream for the requested ROI index. More... | |
ETHCamStatus | subscribeROIVideo (VideoContent &videoContent, const uint32_t roiIndex=0, const int maxWaitTimeMs=MAX_WAIT_TIME_MS) |
Starts the transmission of a video stream for the requested ROI index. More... | |
ETHCamStatus | unsubscribeROIVideo (const uint32_t roiIndex, const int maxWaitTimeMs=MAX_WAIT_TIME_MS) |
Ends the transmission of a video stream for the requested ROI index. More... | |
ETHCamStatus | setBrightnessControl (const SignedControl sControl, const int maxWaitTimeMs=MAX_WAIT_TIME_MS) |
Attempts to set the control for the brightness circuits of the camera. More... | |
ETHCamStatus | getBrightnessControl (SignedControl &sControl, const int maxWaitTimeMs=MAX_WAIT_TIME_MS) |
Attempts to populate the Brigthness Control data struct with data from the camera. More... | |
ETHCamStatus | setSaturationControl (const UnsignedControl uControl, const int maxWaitTimeMs=MAX_WAIT_TIME_MS) |
Attempts to set the control for the saturation circuits of the camera. More... | |
ETHCamStatus | getSaturationControl (UnsignedControl &uControl, const int maxWaitTimeMs=MAX_WAIT_TIME_MS) |
Attempts to populate the Saturation Control data struct with data from the camera. More... | |
ETHCamStatus | setGammaControl (const UnsignedControl uControl, const int maxWaitTimeMs=MAX_WAIT_TIME_MS) |
Attempts to set the control for the gamma correction of the camera. More... | |
ETHCamStatus | getGammaControl (UnsignedControl &uControl, const int maxWaitTimeMs=MAX_WAIT_TIME_MS) |
Attempts to populate the Gamma Control data struct with data from the camera. More... | |
ETHCamStatus | setHeaterControl (const UnsignedControl uControl, const int maxWaitTimeMs=MAX_WAIT_TIME_MS) |
Attempts to set the controls for the heater of the camera. More... | |
ETHCamStatus | getHeaterControl (UnsignedControl &uControl, const int maxWaitTimeMs=MAX_WAIT_TIME_MS) |
Attempts to populate the Heater Control data struct with data from the camera. More... | |
ETHCamStatus | setCamRegister (const ImagerRegister imagerRegister, const int maxWaitTimeMs=MAX_WAIT_TIME_MS) |
Attempts to writes the content of a register of the cameras imager addressed by physical register address. More... | |
ETHCamStatus | setCamRegister (const uint16_t regAddress, const uint16_t regValue, const int maxWaitTimeMs=MAX_WAIT_TIME_MS) |
Attempts to writes the content of a register of the camera’s imager addressed by physical register address. More... | |
ETHCamStatus | setCamRegisters (const std::vector< ImagerRegister > &imagerRegisters, const int maxWaitTimeMs=MAX_WAIT_TIME_MS) |
Attempts to write (atomic access) the content of a register block of the camera imager. More... | |
ETHCamStatus | getCamRegister (const uint16_t regAddress, uint16_t ®Value, const int maxWaitTimeMs=MAX_WAIT_TIME_MS) |
Reads the content of a register block of the camera imager. More... | |
ETHCamStatus | getCamRegisters (const std::vector< uint16_t > &addressList, std::vector< ImagerRegister > &imagerRegisters, const int maxWaitTimeMs=MAX_WAIT_TIME_MS) |
getCamRegisters Attempts to read a list of imager registers More... | |
ETHCamStatus | sendMessageNoResponse (const unsigned char *data, const size_t messageLength) const |
Sends a custom message, without expecting a response from the camera. More... | |
ETHCamStatus | sendMessageWithResponse (const unsigned char *data, const size_t messageLength, unsigned char *responseData, size_t &responseLength, const int maxWaitTimeMs=MAX_WAIT_TIME_MS) const |
Sends a custom message to the camera and reads the response. More... | |
ETHCamStatus | serviceDiscoveryGetIPv4 (IPv4Option &option) |
Reads the socket for a Service Discovery - Offer Service message with the IPv4 endpoint option. More... | |
uint16_t | getSessionID () const |
Returns the session ID number. More... | |
void | setSessionID (uint16_t arg) |
Sets a new session ID. More... | |
uint16_t | getClientID () const |
Returns the client ID number. More... | |
void | setClientID (uint16_t arg) |
Sets the client ID. More... | |
Static Public Member Functions | |
static std::string | stringifyETHCamStatus (const ETHCamStatus camStatus) |
Returns the ETHCamStatus enum as a std::string, useful for debugging. More... | |
Detailed Description
The ETHCameraSettings class This class is the inteface between the ETH Camera and the user.
Constructor & Destructor Documentation
CrossControl::ETHCameraSettings::ETHCameraSettings | ( | std::string | ipAddress, |
int | portNum, | ||
int | clientID = 1 |
||
) |
Creates the API class and stores the address and port number.
- Parameters
-
ipAddress The IP address to the ETH camera portNum The communication port number to the ETH camera
Member Function Documentation
ETHCamStatus CrossControl::ETHCameraSettings::close | ( | ) |
Closes the socket.
- Returns
- A status message
ETHCamStatus CrossControl::ETHCameraSettings::closeServiceDiscoverySocket | ( | ) |
Closes the Service Discovery socket.
- Returns
- A status message
ETHCamStatus CrossControl::ETHCameraSettings::eraseCamExclusive | ( | const int | maxWaitTimeMs = MAX_WAIT_TIME_MS | ) |
Attempts to remove the exclusive control look for the requesting client.
- Parameters
-
maxWaitTimeMs Maximum wait time to wait for an answer from the camera
- Returns
- A status message
- Note
- The same client who removes the lock has to have called it before (You can not remove someone else's lock)
ETHCamStatus CrossControl::ETHCameraSettings::eraseRegionOfInterest | ( | const uint32_t | roiIndex, |
const int | maxWaitTimeMs = MAX_WAIT_TIME_MS |
||
) |
Attempt to erases all parameters for the requested region of interest.
- Parameters
-
roiIndex The index of the requested region of interest maxWaitTimeMs Maximum wait time to wait for an answer from the camera
- Returns
- A status message
ETHCamStatus CrossControl::ETHCameraSettings::getBrightnessControl | ( | SignedControl & | sControl, |
const int | maxWaitTimeMs = MAX_WAIT_TIME_MS |
||
) |
Attempts to populate the Brigthness Control data struct with data from the camera.
- Parameters
-
sControl The struct to be populated maxWaitTimeMs Maximum wait time to wait for an answer from the camera
- Returns
- A status message
ETHCamStatus CrossControl::ETHCameraSettings::getCamRegister | ( | const uint16_t | regAddress, |
uint16_t & | regValue, | ||
const int | maxWaitTimeMs = MAX_WAIT_TIME_MS |
||
) |
Reads the content of a register block of the camera imager.
- Parameters
-
regAddress The addres of the register to be read regValue A reference value that will be populated with the register value maxWaitTimeMs Maximum wait time to wait for an answer from the camera
- Returns
- A status message
ETHCamStatus CrossControl::ETHCameraSettings::getCamRegisters | ( | const std::vector< uint16_t > & | addressList, |
std::vector< ImagerRegister > & | imagerRegisters, | ||
const int | maxWaitTimeMs = MAX_WAIT_TIME_MS |
||
) |
getCamRegisters Attempts to read a list of imager registers
- Parameters
-
addressList The list of addresses to be read imagerRegisters A reference to a vector of imagerregisters from the camera maxWaitTimeMs Maximum wait time to wait for an answer from the camera
- Returns
- A status message
ETHCamStatus CrossControl::ETHCameraSettings::getCamStatus | ( | CamStatus & | camStatus, |
const int | maxWaitTimeMs = MAX_WAIT_TIME_MS |
||
) |
Attempts to fill a struct with the status of the ETH Camera.
- Parameters
-
camStatus The struct to be filled maxWaitTimeMs Maximum wait time to wait for an answer from the camera
- Returns
- A status message
uint16_t CrossControl::ETHCameraSettings::getClientID | ( | ) | const |
Returns the client ID number.
- Returns
- Returns the client ID number
ETHCamStatus CrossControl::ETHCameraSettings::getDatasheet | ( | Datasheet & | datasheet, |
const int | maxWaitTimeMs = MAX_WAIT_TIME_MS |
||
) |
Attempts to fill a struct with the datasheet of the camera.
- Parameters
-
dataSheet The struct to be filled maxWaitTimeMs Maximum wait time to wait for an answer from the camera
- Returns
- A status message
ETHCamStatus CrossControl::ETHCameraSettings::getGammaControl | ( | UnsignedControl & | uControl, |
const int | maxWaitTimeMs = MAX_WAIT_TIME_MS |
||
) |
Attempts to populate the Gamma Control data struct with data from the camera.
- Parameters
-
uControl The struct to be populated maxWaitTimeMs Maximum wait time to wait for an answer from the camera
- Returns
- A status message
- Note
- The camera must be locked by using setCamExclusive before calling this method
ETHCamStatus CrossControl::ETHCameraSettings::getHeaterControl | ( | UnsignedControl & | uControl, |
const int | maxWaitTimeMs = MAX_WAIT_TIME_MS |
||
) |
Attempts to populate the Heater Control data struct with data from the camera.
- Parameters
-
uControl The struct to be populated maxWaitTimeMs Maximum wait time to wait for an answer from the camera
- Returns
- A status message
ETHCamStatus CrossControl::ETHCameraSettings::getRegionOfInterest | ( | RegionOfInterest & | regionOfInterest, |
const uint32_t | roiIndex, | ||
const int | maxWaitTimeMs = MAX_WAIT_TIME_MS |
||
) |
Gets the parameters for the region of interest addressed by index.
- Parameters
-
regionOfInterest The structure to be filled with the parameters roiIndex The index of the region maxWaitTimeMs Maximum wait time to wait for an answer from the camera
- Returns
- A status message
- Note
- The camera must be locked by using setCamExclusive before calling this method
ETHCamStatus CrossControl::ETHCameraSettings::getRegionsOfInterest | ( | std::vector< uint32_t > & | roiIndices, |
const int | maxWaitTimeMs = MAX_WAIT_TIME_MS |
||
) |
Gets the indices for all the regions of interest.
- Parameters
-
regionsOfInterest The vector which will be filled with the data maxWaitTimeMs Maximum wait time to wait for an answer from the camera
- Returns
- A status message
ETHCamStatus CrossControl::ETHCameraSettings::getSaturationControl | ( | UnsignedControl & | uControl, |
const int | maxWaitTimeMs = MAX_WAIT_TIME_MS |
||
) |
Attempts to populate the Saturation Control data struct with data from the camera.
- Parameters
-
uControl The struct to be populated maxWaitTimeMs Maximum wait time to wait for an answer from the camera
- Returns
- A status message
uint16_t CrossControl::ETHCameraSettings::getSessionID | ( | ) | const |
Returns the session ID number.
- Returns
- Returns the session ID number
- Note
- The API automaticly increments the session ID after each package send
ETHCamStatus CrossControl::ETHCameraSettings::open | ( | ) |
Opens a UDP-socket with the address and port number previously supplied.
- Returns
- A status message
- Note
- Will fail if no IP address or portnumber has been supplied
ETHCamStatus CrossControl::ETHCameraSettings::open | ( | std::string | ipAddress, |
int | portNum | ||
) |
Opens a UDP-socket.
- Parameters
-
ipAddress The ip address as a string ex: "192.168.1.13" portNum The communication port number
- Returns
- A status message
- Note
- Also stores the ip and port numbers
ETHCamStatus CrossControl::ETHCameraSettings::openServiceDiscovery | ( | std::vector< std::string > | multicastGroups, |
int | portNumber | ||
) |
Opens a socket to look for Service Discovery messages.
- Parameters
-
multicastGroups A vector of multicast groups ex of a multicast group: "239.0.0.1" portNumber The port number to listen for Service Discovery messages
- Returns
- A status message
- Note
- The API will add a maximum of 20 multicast groups per socket
ETHCamStatus CrossControl::ETHCameraSettings::openServiceDiscovery | ( | int | portNumber | ) |
Opens a socket to look for Service Discovery messages.
- Parameters
-
portNumber The port number to listen for Service Discovery messages
- Returns
- A status message
ETHCamStatus CrossControl::ETHCameraSettings::sendMessageNoResponse | ( | const unsigned char * | data, |
const size_t | messageLength | ||
) | const |
Sends a custom message, without expecting a response from the camera.
- Parameters
-
data Pointer to the first element in the data you wish to send to the camera messageLength The length of the array
- Returns
- A status message
ETHCamStatus CrossControl::ETHCameraSettings::sendMessageWithResponse | ( | const unsigned char * | data, |
const size_t | messageLength, | ||
unsigned char * | responseData, | ||
size_t & | responseLength, | ||
const int | maxWaitTimeMs = MAX_WAIT_TIME_MS |
||
) | const |
Sends a custom message to the camera and reads the response.
- Parameters
-
data Pointer to the first element in the data you wish to send to the camera messageLength The length of the array responseData Pointer to a buffer that will be filled with the response of the camera responseLength The length of the response data maxWaitTimeMs Maximum wait time to wait for an answer from the camera
- Returns
- A status message
ETHCamStatus CrossControl::ETHCameraSettings::serviceDiscoveryGetIPv4 | ( | IPv4Option & | option | ) |
Reads the socket for a Service Discovery - Offer Service message with the IPv4 endpoint option.
- Parameters
-
option The option struct that on sucess will be filled with the cameras IP, port number and transfer protocol
- Returns
- A status message
ETHCamStatus CrossControl::ETHCameraSettings::setBrightnessControl | ( | const SignedControl | sControl, |
const int | maxWaitTimeMs = MAX_WAIT_TIME_MS |
||
) |
Attempts to set the control for the brightness circuits of the camera.
- Parameters
-
sControl The struct containing the control parameters to be set maxWaitTimeMs Maximum wait time to wait for an answer from the camera
- Returns
- A status message
- Note
- The camera must be locked by using setCamExclusive before calling this method
ETHCamStatus CrossControl::ETHCameraSettings::setCamExclusive | ( | const int | expireTimeSeconds = 5 , |
const int | maxWaitTimeMs = MAX_WAIT_TIME_MS |
||
) |
Attempts to assign the control of the camera exclusively to the requesting client.
- Parameters
-
expireTimeSeconds The lock expires after this value in seconds maxWaitTimeMs Maximum wait time to wait for an answer from the camera
- Returns
- A status message
ETHCamStatus CrossControl::ETHCameraSettings::setCamRegister | ( | const ImagerRegister | imagerRegister, |
const int | maxWaitTimeMs = MAX_WAIT_TIME_MS |
||
) |
Attempts to writes the content of a register of the cameras imager addressed by physical register address.
- Parameters
-
imageRegister Struct holding the register value and address maxWaitTimeMs Maximum wait time to wait for an answer from the camera
- Returns
- A status message
ETHCamStatus CrossControl::ETHCameraSettings::setCamRegister | ( | const uint16_t | regAddress, |
const uint16_t | regValue, | ||
const int | maxWaitTimeMs = MAX_WAIT_TIME_MS |
||
) |
Attempts to writes the content of a register of the camera’s imager addressed by physical register address.
- Parameters
-
regAddress The address of the register regValue The value of the register maxWaitTimeMs Maximum wait time to wait for an answer from the camera
- Returns
- A status message
- Note
- The camera must be locked by using setCamExclusive before calling this method
ETHCamStatus CrossControl::ETHCameraSettings::setCamRegisters | ( | const std::vector< ImagerRegister > & | imagerRegisters, |
const int | maxWaitTimeMs = MAX_WAIT_TIME_MS |
||
) |
Attempts to write (atomic access) the content of a register block of the camera imager.
- Parameters
-
imageRegisterBlock A block of addresses and register values maxWaitTimeMs Maximum wait time to wait for an answer from the camera
- Returns
- A status message
- Note
- The camera must be locked by using setCamExclusive before calling this method
void CrossControl::ETHCameraSettings::setClientID | ( | uint16_t | arg | ) |
Sets the client ID.
- Parameters
-
The number to use as a client ID
- Note
- The client ID must be unique in the network
ETHCamStatus CrossControl::ETHCameraSettings::setGammaControl | ( | const UnsignedControl | uControl, |
const int | maxWaitTimeMs = MAX_WAIT_TIME_MS |
||
) |
Attempts to set the control for the gamma correction of the camera.
- Parameters
-
uControl The struct containing the control parameters to be set maxWaitTimeMs Maximum wait time to wait for an answer from the camera
- Returns
- A status message
- Note
- The camera must be locked by using setCamExclusive before calling this method
ETHCamStatus CrossControl::ETHCameraSettings::setHeaterControl | ( | const UnsignedControl | uControl, |
const int | maxWaitTimeMs = MAX_WAIT_TIME_MS |
||
) |
Attempts to set the controls for the heater of the camera.
- Parameters
-
uControl The struct containing the control parameters to be set maxWaitTimeMs Maximum wait time to wait for an answer from the camera
- Returns
- A status message
- Note
- The camera must be locked by using setCamExclusive before calling this method
ETHCamStatus CrossControl::ETHCameraSettings::setRegionOfInterest | ( | const RegionOfInterest | regionOfInterest, |
const uint32_t | roiIndex, | ||
const int | maxWaitTimeMs = MAX_WAIT_TIME_MS |
||
) |
Attehmps to set the parameters for the region of interest addressed by index.
- Parameters
-
regionOfInterest The structure defining the region of interest roiIndex The index to be set maxWaitTimeMs Maximum wait time to wait for an answer from the camera
- Returns
- A status message
ETHCamStatus CrossControl::ETHCameraSettings::setSaturationControl | ( | const UnsignedControl | uControl, |
const int | maxWaitTimeMs = MAX_WAIT_TIME_MS |
||
) |
Attempts to set the control for the saturation circuits of the camera.
- Parameters
-
uControl The struct containing the control parameters to be set maxWaitTimeMs Maximum wait time to wait for an answer from the camera
- Returns
- A status message
- Note
- The camera must be locked by using setCamExclusive before calling this method
void CrossControl::ETHCameraSettings::setSessionID | ( | uint16_t | arg | ) |
Sets a new session ID.
- Parameters
-
The new value to use as a session ID
- Note
- The API automaticly increments the session ID after each package send
|
static |
Returns the ETHCamStatus enum as a std::string, useful for debugging.
- Parameters
-
camStatus The enum you want to return as a string
- Returns
- A string
ETHCamStatus CrossControl::ETHCameraSettings::subscribeROIVideo | ( | const uint32_t | roiIndex = 0 , |
const int | maxWaitTimeMs = MAX_WAIT_TIME_MS |
||
) |
Starts the transmission of a video stream for the requested ROI index.
- Parameters
-
roiIndex The index of the stream maxWaitTimeMs Maximum wait time to wait for an answer from the camera
- Returns
- A status message
ETHCamStatus CrossControl::ETHCameraSettings::subscribeROIVideo | ( | VideoContent & | videoContent, |
const uint32_t | roiIndex = 0 , |
||
const int | maxWaitTimeMs = MAX_WAIT_TIME_MS |
||
) |
Starts the transmission of a video stream for the requested ROI index.
- Parameters
-
videoContent A reference to a struct that defines a video content notification package roiIndex The index of the stream maxWaitTimeMs Maximum wait time to wait for an answer from the camera
- Returns
- A status message
ETHCamStatus CrossControl::ETHCameraSettings::unsubscribeROIVideo | ( | const uint32_t | roiIndex, |
const int | maxWaitTimeMs = MAX_WAIT_TIME_MS |
||
) |
Ends the transmission of a video stream for the requested ROI index.
- Parameters
-
roiIndex The index of the stream maxWaitTimeMs Maximum wait time to wait for an answer from the camera
- Returns
- A status message
The documentation for this class was generated from the following file: