Compute Graph Framework SDK Reference  5.14
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
40// coverity[autosar_cpp14_a1_1_1_violation]
41#include <errno.h>
42
43namespace dw
44{
45namespace framework
46{
47
52{
53public:
54 // coverity[autosar_cpp14_a0_1_1_violation]
55 // coverity[autosar_cpp14_a2_10_5_violation]
56 static constexpr char LOG_TAG[]{"IChannelFsiCom"};
57
62 virtual bool connect() = 0;
63
68 virtual bool isConnected() = 0;
69
73 virtual void disconnect() = 0;
74
84 virtual int32_t write(void* buff, uint32_t size, uint32_t& writtenBytes) = 0;
85
93 virtual int32_t waitForEvent(dwTime_t timeout_us) = 0;
94
104 virtual int32_t read(void* buff, uint32_t size, uint32_t& readBytes) = 0;
105
106 using createFactory = std::function<std::shared_ptr<IChannelFsiCom>(uint8_t, const char*)>;
116 static std::shared_ptr<IChannelFsiCom> create(uint8_t numChannels, const char* compat, createFactory& overrider);
117
125 bool registerClient(bool consumer);
126
132 void unregisterClient(bool consumer);
133
134private:
135 bool m_consumerRegistered{false};
136 bool m_producerRegistered{false};
137};
138
139} // namespace framework
140} // namespace dw
141
142#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:56
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:106
static std::shared_ptr< IChannelFsiCom > create(uint8_t numChannels, const char *compat, createFactory &overrider)
Create the FSI channel.
Definition: Buffer.hpp:40