Compute Graph Framework SDK Reference  5.18
FsiCom.hpp
Go to the documentation of this file.
1
2
3// Copyright (c) 2023 Mercedes-Benz AG. All rights reserved.
4//
5// Mercedes-Benz AG as copyright 2023 owner and NVIDIA Corporation as licensor retain
6// all intellectual property and proprietary rights in and to this software
7// and related documentation and any modifications thereto.
8// Any use, reproduction, disclosure or distribution of this software and related
9// documentation without an express license agreement is strictly prohibited.
10//
11// This code contains Confidential Information and is disclosed
12// under the Mutual Non-Disclosure Agreement.
13//
14// Notice
15// ALL DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS"
16// NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
17// THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT,
18// MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE ARE MADE.
19//
20// No responsibility is assumed for the consequences of use of such
21// information or for any infringement of patents or other rights of third parties that may
22// result from its use. No license is granted by implication or otherwise under any patent
23// or patent rights. No third party distribution is allowed unless
24// expressly authorized. Details are subject to change without notice.
25// This code supersedes and replaces all information previously supplied.
26// Products are not authorized for use as critical
27// components in life support devices or systems without express written approval.
29
30#ifndef DW_FRAMEWORK_FSI_COM_HPP_
31#define DW_FRAMEWORK_FSI_COM_HPP_
32
33#include <dw/core/base/BasicTypes.h>
34#include <dwshared/dwfoundation/dw/core/language/Function.hpp>
35
36#include <memory>
37#include <mutex>
38#include <unordered_map>
39
40namespace dw
41{
42namespace framework
43{
44
49{
50public:
51 // coverity[autosar_cpp14_a0_1_1_violation]
52 // coverity[autosar_cpp14_a2_10_5_violation] RFD Pending: TID-2053
53 static constexpr char LOG_TAG[]{"IChannelFsiCom"};
54
55 virtual ~IChannelFsiCom() = default;
56
61 virtual bool connect() = 0;
62
67 virtual bool isConnected() = 0;
68
72 virtual void disconnect() = 0;
73
83 virtual int32_t write(void* buff, uint32_t size, uint32_t& writtenBytes) = 0;
84
92 virtual int32_t waitForEvent(dwTime_t timeout_us) = 0;
93
103 virtual int32_t read(void* buff, uint32_t size, uint32_t& readBytes) = 0;
104
105 using createFactory = std::function<std::shared_ptr<IChannelFsiCom>(uint8_t, const char*)>;
115 static std::shared_ptr<IChannelFsiCom> create(uint8_t numChannels, const char* compat, createFactory& overrider);
116
124 bool registerClient(bool consumer);
125
131 void unregisterClient(bool consumer);
132
133private:
134 bool m_consumerRegistered{false};
135 bool m_producerRegistered{false};
136};
137
138} // namespace framework
139} // namespace dw
140
141#endif
virtual int32_t waitForEvent(dwTime_t timeout_us)=0
Wait for a buffer to be available to read.
virtual bool connect()=0
Connect to a specified FSI endpoint.
void unregisterClient(bool consumer)
Unregister a FSI connection.
static constexpr char LOG_TAG[]
Definition: FsiCom.hpp:53
virtual int32_t write(void *buff, uint32_t size, uint32_t &writtenBytes)=0
Write to a connected FSI endpoint.
virtual void disconnect()=0
Disconnect from a connected FSI endpoint.
virtual bool isConnected()=0
Check if FSI endpoint is connected.
virtual int32_t read(void *buff, uint32_t size, uint32_t &readBytes)=0
Read from a connected FSI endpoint.
bool registerClient(bool consumer)
Register a FSI connection.
std::function< std::shared_ptr< IChannelFsiCom >(uint8_t, const char *)> createFactory
Definition: FsiCom.hpp:105
static std::shared_ptr< IChannelFsiCom > create(uint8_t numChannels, const char *compat, createFactory &overrider)
Create the FSI channel.
virtual ~IChannelFsiCom()=default
Definition: Buffer.hpp:40