CrossControl::IPCameraSettings Class Reference

The IPCameraSettings class This class is the inteface between the IP Camera and the user. More...

#include <ipcamerasettings.h>

Public Member Functions

 IPCameraSettings ()
 Creates the API class.
 
 IPCameraSettings (std::string ipAddress, int portNum, int clientID=1)
 Creates the API class and stores the IP and port number. More...
 
 IPCameraSettings (IPCameraSettings &other)=delete
 Forbids the copy constructor.
 
 ~IPCameraSettings ()
 Deletes the API class and frees all allocated memory.
 
IPCamStatus open ()
 Opens a UDP-socket with the address and port number previously supplied. More...
 
IPCamStatus open (std::string ipAddress, int portNum)
 Opens a UDP-socket. More...
 
IPCamStatus openServiceDiscovery (std::vector< std::string > multicastGroups, int portNumber)
 Opens a socket to look for Service Discovery messages. More...
 
IPCamStatus openServiceDiscovery (int portNumber)
 Opens a socket to look for Service Discovery messages. More...
 
IPCamStatus close ()
 Closes the socket. More...
 
IPCamStatus closeServiceDiscoverySocket ()
 Closes the Service Discovery socket. More...
 
IPCamStatus getDatasheet (Datasheet &datasheet, const int maxWaitTimeMs=MAX_WAIT_TIME_MS)
 Attempts to fill a struct with the datasheet of the camera. More...
 
IPCamStatus getCamStatus (CamStatus &camStatus, const int maxWaitTimeMs=MAX_WAIT_TIME_MS)
 Attempts to fill a struct with the status of the IP Camera. More...
 
IPCamStatus 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...
 
IPCamStatus eraseCamExclusive (const int maxWaitTimeMs=MAX_WAIT_TIME_MS)
 Attempts to remove the exclusive control look for the requesting client. More...
 
IPCamStatus 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...
 
IPCamStatus 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...
 
IPCamStatus getRegionsOfInterest (std::vector< uint32_t > &roiIndices, const int maxWaitTimeMs=MAX_WAIT_TIME_MS)
 Gets the indices for all the regions of interest. More...
 
IPCamStatus eraseRegionOfInterest (const uint32_t roiIndex, const int maxWaitTimeMs=MAX_WAIT_TIME_MS)
 Attempt to erases all parameters for the requested region of interest. More...
 
IPCamStatus 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...
 
IPCamStatus 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...
 
IPCamStatus 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...
 
IPCamStatus setBrightnessControl (const SignedControl sControl, const int maxWaitTimeMs=MAX_WAIT_TIME_MS)
 Attempts to set the control for the brightness circuits of the camera. More...
 
IPCamStatus getBrightnessControl (SignedControl &sControl, const int maxWaitTimeMs=MAX_WAIT_TIME_MS)
 Attempts to populate the Brigthness Control data struct with data from the camera. More...
 
IPCamStatus setSaturationControl (const UnsignedControl uControl, const int maxWaitTimeMs=MAX_WAIT_TIME_MS)
 Attempts to set the control for the saturation circuits of the camera. More...
 
IPCamStatus getSaturationControl (UnsignedControl &uControl, const int maxWaitTimeMs=MAX_WAIT_TIME_MS)
 Attempts to populate the Saturation Control data struct with data from the camera. More...
 
IPCamStatus setGammaControl (const UnsignedControl uControl, const int maxWaitTimeMs=MAX_WAIT_TIME_MS)
 Attempts to set the control for the gamma correction of the camera. More...
 
IPCamStatus getGammaControl (UnsignedControl &uControl, const int maxWaitTimeMs=MAX_WAIT_TIME_MS)
 Attempts to populate the Gamma Control data struct with data from the camera. More...
 
IPCamStatus setHeaterControl (const UnsignedControl uControl, const int maxWaitTimeMs=MAX_WAIT_TIME_MS)
 Attempts to set the controls for the heater of the camera. More...
 
IPCamStatus getHeaterControl (UnsignedControl &uControl, const int maxWaitTimeMs=MAX_WAIT_TIME_MS)
 Attempts to populate the Heater Control data struct with data from the camera. More...
 
IPCamStatus setCamRegister (const ImagerRegister imagerRegister, 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...
 
IPCamStatus 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...
 
IPCamStatus 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...
 
IPCamStatus 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...
 
IPCamStatus 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...
 
IPCamStatus sendMessageNoResponse (const unsigned char *data, const size_t messageLength) const
 Sends a custom message, without expecting a response from the camera. More...
 
IPCamStatus 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...
 
IPCamStatus 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 stringifyIPCamStatus (const IPCamStatus camStatus)
 Returns the IPCamStatus enum as a std::string, useful for debugging. More...
 

Detailed Description

The IPCameraSettings class This class is the inteface between the IP Camera and the user.

Constructor & Destructor Documentation

CrossControl::IPCameraSettings::IPCameraSettings ( std::string  ipAddress,
int  portNum,
int  clientID = 1 
)

Creates the API class and stores the IP and port number.

Parameters
ipAddressThe IP address to the IP camera
portNumThe communication port number to the IP camera

Member Function Documentation

IPCamStatus CrossControl::IPCameraSettings::close ( )

Closes the socket.

Returns
A status message
IPCamStatus CrossControl::IPCameraSettings::closeServiceDiscoverySocket ( )

Closes the Service Discovery socket.

Returns
A status message
IPCamStatus CrossControl::IPCameraSettings::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)
IPCamStatus CrossControl::IPCameraSettings::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
IPCamStatus CrossControl::IPCameraSettings::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
IPCamStatus CrossControl::IPCameraSettings::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
IPCamStatus CrossControl::IPCameraSettings::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
IPCamStatus CrossControl::IPCameraSettings::getCamStatus ( CamStatus camStatus,
const int  maxWaitTimeMs = MAX_WAIT_TIME_MS 
)

Attempts to fill a struct with the status of the IP 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::IPCameraSettings::getClientID ( ) const

Returns the client ID number.

Returns
Returns the client ID number
IPCamStatus CrossControl::IPCameraSettings::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
IPCamStatus CrossControl::IPCameraSettings::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
IPCamStatus CrossControl::IPCameraSettings::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
IPCamStatus CrossControl::IPCameraSettings::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
IPCamStatus CrossControl::IPCameraSettings::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
IPCamStatus CrossControl::IPCameraSettings::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::IPCameraSettings::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
IPCamStatus CrossControl::IPCameraSettings::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
IPCamStatus CrossControl::IPCameraSettings::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
IPCamStatus CrossControl::IPCameraSettings::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
IPCamStatus CrossControl::IPCameraSettings::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
IPCamStatus CrossControl::IPCameraSettings::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
IPCamStatus CrossControl::IPCameraSettings::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
IPCamStatus CrossControl::IPCameraSettings::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
IPCamStatus CrossControl::IPCameraSettings::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
IPCamStatus CrossControl::IPCameraSettings::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
IPCamStatus CrossControl::IPCameraSettings::setCamRegister ( const ImagerRegister  imagerRegister,
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
imageRegisterStruct holding the register value and address
maxWaitTimeMsMaximum wait time to wait for an answer from the camera
Returns
A status message
IPCamStatus CrossControl::IPCameraSettings::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
IPCamStatus CrossControl::IPCameraSettings::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::IPCameraSettings::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
IPCamStatus CrossControl::IPCameraSettings::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
IPCamStatus CrossControl::IPCameraSettings::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
IPCamStatus CrossControl::IPCameraSettings::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
IPCamStatus CrossControl::IPCameraSettings::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::IPCameraSettings::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::IPCameraSettings::stringifyIPCamStatus ( const IPCamStatus  camStatus)
static

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

Parameters
camStatusThe enum you want to return as a string
Returns
A string
IPCamStatus CrossControl::IPCameraSettings::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
IPCamStatus CrossControl::IPCameraSettings::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
IPCamStatus CrossControl::IPCameraSettings::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: