CrossControl::ETHCameraSettings Class Reference

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 &regionOfInterest, 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 &regValue, 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
ipAddressThe IP address to the ETH camera
portNumThe 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
maxWaitTimeMsMaximum 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
roiIndexThe index of the requested region of interest
maxWaitTimeMsMaximum 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
sControlThe struct to be populated
maxWaitTimeMsMaximum 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
regAddressThe addres of the register to be read
regValueA reference value that will be populated with the register value
maxWaitTimeMsMaximum 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
addressListThe list of addresses to be read
imagerRegistersA reference to a vector of imagerregisters from the camera
maxWaitTimeMsMaximum 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
camStatusThe struct to be filled
maxWaitTimeMsMaximum 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
dataSheetThe struct to be filled
maxWaitTimeMsMaximum 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
uControlThe struct to be populated
maxWaitTimeMsMaximum 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
uControlThe struct to be populated
maxWaitTimeMsMaximum 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
regionOfInterestThe structure to be filled with the parameters
roiIndexThe index of the region
maxWaitTimeMsMaximum 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
regionsOfInterestThe vector which will be filled with the data
maxWaitTimeMsMaximum 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
uControlThe struct to be populated
maxWaitTimeMsMaximum 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
ipAddressThe ip address as a string ex: "192.168.1.13"
portNumThe 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
multicastGroupsA vector of multicast groups ex of a multicast group: "239.0.0.1"
portNumberThe 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
portNumberThe 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
dataPointer to the first element in the data you wish to send to the camera
messageLengthThe 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
dataPointer to the first element in the data you wish to send to the camera
messageLengthThe length of the array
responseDataPointer to a buffer that will be filled with the response of the camera
responseLengthThe length of the response data
maxWaitTimeMsMaximum 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
optionThe 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
sControlThe struct containing the control parameters to be set
maxWaitTimeMsMaximum 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
expireTimeSecondsThe lock expires after this value in seconds
maxWaitTimeMsMaximum 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
imageRegisterStruct holding the register value and address
maxWaitTimeMsMaximum 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
regAddressThe address of the register
regValueThe value of the register
maxWaitTimeMsMaximum 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
imageRegisterBlockA block of addresses and register values
maxWaitTimeMsMaximum 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
Thenumber 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
uControlThe struct containing the control parameters to be set
maxWaitTimeMsMaximum 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
uControlThe struct containing the control parameters to be set
maxWaitTimeMsMaximum 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
regionOfInterestThe structure defining the region of interest
roiIndexThe index to be set
maxWaitTimeMsMaximum 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
uControlThe struct containing the control parameters to be set
maxWaitTimeMsMaximum 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
Thenew value to use as a session ID
Note
The API automaticly increments the session ID after each package send
static std::string CrossControl::ETHCameraSettings::stringifyETHCamStatus ( const ETHCamStatus  camStatus)
static

Returns the ETHCamStatus enum as a std::string, useful for debugging.

Parameters
camStatusThe 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
roiIndexThe index of the stream
maxWaitTimeMsMaximum 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
videoContentA reference to a struct that defines a video content notification package
roiIndexThe index of the stream
maxWaitTimeMsMaximum 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
roiIndexThe index of the stream
maxWaitTimeMsMaximum 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: