#include <AbstractImageTransmitter.h>
This is the abstract base class for all image transmitters.
◆ getConnectionNumber()
| int SWE4211RPi::AbstractImageTransmitter::getConnectionNumber |
( |
| ) |
|
This method will return the number of connections that have been made. A change in this value indicates that a new connection has started.
- Returns
- The count of connections made so far. It will be 0 if no connection has been made.
◆ getDestinationMachine()
| std::string SWE4211RPi::AbstractImageTransmitter::getDestinationMachine |
( |
| ) |
|
|
protected |
This method will return a copy of the destination machine name, taken while holding the mutex. Because it is a copy, it remains valid even if the destination is changed while it is in use.
- Returns
- The destination machine name, or an empty string if none has been set.
◆ setDestinationMachine()
| void SWE4211RPi::AbstractImageTransmitter::setDestinationMachine |
( |
const char * |
machineName | ) |
|
This method will update the destination machine name for the stream. If a new destination is given (i.e. not an empty name, which indicates a disconnect), a new connection has started, so the image count is reset and the connection number is incremented.
- Parameters
-
| machineName | This is the name of the destination. An empty string stops the stream. |
This method will update the destination machine name for the stream. If a new destination is given (i.e. not an empty name, which indicates a disconnect), a new connection has started, so the image count is reset and the connection number is incremented.
- Parameters
-
| machineName | This is the name of the destination. |
-
Lock the mutex so that the name cannot be read by another thread while it is being replaced.
-
Free the old name, then allocate space for and copy in the new name.
-
If the new name is a real destination (i.e. longer than 1 char), reset the image count and increment the connection number.
◆ streamImage()
| virtual int SWE4211RPi::AbstractImageTransmitter::streamImage |
( |
cv::Mat * |
image | ) |
|
|
pure virtual |
This method will stream via udp the image to the remote device.
- Parameters
-
| image | This is the image that is to be sent. |
- Returns
- The return will be 0 if successful or -1 if there is a failure.
Implemented in SWE4211RPi::CompressedImageTransmitter.
◆ connectionNumber
| std::atomic<int> SWE4211RPi::AbstractImageTransmitter::connectionNumber {0} |
|
protected |
This is a count of the connections that have been made. It increments each time a new (non-empty) destination machine is set, so that other classes can detect that a new connection has started streaming.
◆ destinationMachineName
| char* SWE4211RPi::AbstractImageTransmitter::destinationMachineName = nullptr |
|
protected |
This is a c style string representing the destination machine's name (or IP address). An empty string means there is no destination. It must only be accessed while holding destinationMutex, except in the constructor and destructor.
◆ destinationMutex
| std::mutex SWE4211RPi::AbstractImageTransmitter::destinationMutex |
|
protected |
◆ imageCount
| int SWE4211RPi::AbstractImageTransmitter::imageCount = 0 |
|
protected |
This is a count of the images that are streamed. The first image streamed will be 0 and it will increment each time a new image is streamed. It is reset to 0 each time a new connection is made.
◆ myPort
| int SWE4211RPi::AbstractImageTransmitter::myPort = 9000 |
|
protected |
This is the UDP port that the images are to be sent to. It defaults to 9000, but is normally set by the derived class's constructor.
◆ sockfd
| int SWE4211RPi::AbstractImageTransmitter::sockfd = 0 |
|
protected |
This is the socket file descriptor that is used to send the datagrams.
The documentation for this class was generated from the following files: