tcpStream.h
Go to the documentation of this file.
1 #pragma once
2 
4  public:
5  // Define default IP and port for an ALB.
6  static const char *default_ip;
7  static const uint16_t default_port;
8 
9  public:
10  // Connect to the stream on the specified address and port
11  // returns:
12  // - 1 on sucess
13  // - 0 on non-fatal failure (ALB unavailable, processing is not started yet
14  // ?)
15  // - -1 on fatal failure (invalid IP)
16  int connectToALB(const char *ipv4 = default_ip, const uint16_t port = default_port);
17 
18  // Poll the socket until a new frame is read
19  // returns:
20  // - 1 on sucess (buffer now contains a valid frame)
21  // - 0 on end of file (stream ended)
22  // - -1 on fatal failure (corrupted stream)
23  int getNextFrame(uint8_t *buffer, const size_t buffer_size);
24 
25  // Disconnect from ALB
26  // returns:
27  // - 0 on success
28  // - <0 on failure (not connected or cannot close socket)
29  int disconnectfromALB();
30 
31  private:
32  int socket_fd = -1;
33 };
TcpStreamReader::default_port
static const uint16_t default_port
Definition: tcpStream.h:7
TcpStreamReader
Definition: tcpStream.h:3
TcpStreamReader::connectToALB
int connectToALB(const char *ipv4=default_ip, const uint16_t port=default_port)
Definition: tcpStream.cpp:121
TcpStreamReader::default_ip
static const char * default_ip
Definition: tcpStream.h:6
TcpStreamReader::socket_fd
int socket_fd
Definition: tcpStream.h:32
TcpStreamReader::getNextFrame
int getNextFrame(uint8_t *buffer, const size_t buffer_size)
Definition: tcpStream.cpp:159
TcpStreamReader::disconnectfromALB
int disconnectfromALB()
Definition: tcpStream.cpp:175


outsight_alb_driver
Author(s): Outsight
autogenerated on Thu Oct 13 2022 02:21:45