#include <network.h>
Public Types | |
typedef std::function< void(void)> | InterruptNotificationCallback |
Public Member Functions | |
void | closeConnectionFrameSocket () |
closeConnectionFrameSocket() - APi to close the frame socket connection More... | |
void | FrameSocketConnection (std::string &ip) |
FrameSocketConnection() - APi to establish Frame Socket connection. More... | |
int32_t | getFrame (uint16_t *buffer, uint32_t buf_size) |
getFrame() - APi to get frame in Async More... | |
std::chrono::steady_clock::time_point | getLatestActivityTimestamp () |
bool | isData_Received () |
bool | isSend_Successful () |
bool | isServer_Connected () |
isServer_Connected() - APi to check if server is connected successfully More... | |
bool | isThread_Running () |
isThread_Running() - APi to check thread exist or not More... | |
Network (int connectionId) | |
Network() - APi to initialize network parameters. More... | |
int | recv_server_data () |
recv_server_data() - APi to receive data from server More... | |
void | registerInterruptCallback (InterruptNotificationCallback &cb) |
int | SendCommand (void *rawPayload=nullptr) |
int | ServerConnect (const std::string &ip) |
~Network () | |
~Network() - destructor for network More... | |
Static Public Member Functions | |
static int | callback_function (std::unique_ptr< zmq::socket_t > &stx, const zmq_event_t &event) |
callback_function() - APi to handle zmq events More... | |
Public Attributes | |
int | m_connectionId |
int | m_frameLength |
Static Public Attributes | |
static payload::ServerResponse | recv_buff [MAX_CAMERA_NUM] |
static payload::ClientRequest | send_buff [MAX_CAMERA_NUM] |
Private Member Functions | |
void | call_zmq_service (const std::string &ip) |
Private Attributes | |
bool | Connection_Closed [MAX_CAMERA_NUM] = {false, false, false, false} |
std::unique_ptr< zmq::context_t > | frame_context |
std::unique_ptr< zmq::socket_t > | frame_socket |
InterruptNotificationCallback | m_intNotifCb |
std::chrono::steady_clock::time_point | m_latestActivityTimestamp |
int | max_buffer_size = 10 |
std::mutex | thread_mutex [MAX_CAMERA_NUM] |
int | Thread_Running [MAX_CAMERA_NUM] |
std::thread | threadObj [MAX_CAMERA_NUM] |
Static Private Attributes | |
static std::vector< std::unique_ptr< zmq::socket_t > > | command_socket |
static std::condition_variable_any | Cond_Var [MAX_CAMERA_NUM] |
static std::vector< std::unique_ptr< zmq::context_t > > | contexts |
static bool | Data_Received [MAX_CAMERA_NUM] |
static bool | InterruptDetected [MAX_CAMERA_NUM] |
static std::recursive_mutex | m_mutex [MAX_CAMERA_NUM] |
static std::vector< std::unique_ptr< zmq::socket_t > > | monitor_sockets |
static std::mutex | mutex_recv [MAX_CAMERA_NUM] |
static void * | rawPayloads [MAX_CAMERA_NUM] |
static bool | Send_Successful [MAX_CAMERA_NUM] |
static bool | Server_Connected [MAX_CAMERA_NUM] |
static std::condition_variable | thread_Cond_Var [MAX_CAMERA_NUM] |
static bool | Thread_Detached [MAX_CAMERA_NUM] |
typedef std::function<void(void)> Network::InterruptNotificationCallback |
Network::Network | ( | int | connectionId | ) |
Network() - APi to initialize network parameters.
Definition at line 524 of file network.cpp.
Network::~Network | ( | ) |
~Network() - destructor for network
Definition at line 546 of file network.cpp.
|
private |
call_zmq_service - calls zmq_event_t to service any zmq socket events activity
Definition at line 412 of file network.cpp.
|
static |
callback_function() - APi to handle zmq events
Definition at line 440 of file network.cpp.
void Network::closeConnectionFrameSocket | ( | ) |
closeConnectionFrameSocket() - APi to close the frame socket connection
Definition at line 585 of file network.cpp.
void Network::FrameSocketConnection | ( | std::string & | ip | ) |
FrameSocketConnection() - APi to establish Frame Socket connection.
Definition at line 599 of file network.cpp.
int32_t Network::getFrame | ( | uint16_t * | buffer, |
uint32_t | buf_size | ||
) |
getFrame() - APi to get frame in Async
Definition at line 568 of file network.cpp.
std::chrono::steady_clock::time_point Network::getLatestActivityTimestamp | ( | ) |
Definition at line 515 of file network.cpp.
bool Network::isData_Received | ( | ) |
isData_Received() - APi to check if data is received from server successfully
Definition at line 139 of file network.cpp.
bool Network::isSend_Successful | ( | ) |
isSend_Successful() - APi to check if data has been sent to server successfully
Definition at line 126 of file network.cpp.
bool Network::isServer_Connected | ( | ) |
isServer_Connected() - APi to check if server is connected successfully
Definition at line 97 of file network.cpp.
bool Network::isThread_Running | ( | ) |
isThread_Running() - APi to check thread exist or not
Definition at line 109 of file network.cpp.
int Network::recv_server_data | ( | ) |
recv_server_data() - APi to receive data from server
Definition at line 326 of file network.cpp.
void Network::registerInterruptCallback | ( | InterruptNotificationCallback & | cb | ) |
Definition at line 511 of file network.cpp.
int Network::SendCommand | ( | void * | rawPayload = nullptr | ) |
SendCommand() - APi to send SDK apis to connected server If, after the command, we expect the server to send raw (non-protobuf) payload, set the 'rawPayload' with the location where the payload should be copied. Otherwise, set to null or skip it.
Definition at line 280 of file network.cpp.
int Network::ServerConnect | ( | const std::string & | ip | ) |
ServerConnect() - APi to initialize the zmq sockets and connect to zmq server
Definition at line 150 of file network.cpp.
|
staticprivate |
|
private |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
staticprivate |
|
private |
|
private |
|
private |