ADTF
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
recorder_intf.h
Go to the documentation of this file.
1
7#ifndef _ADTF_RECORDER_INTF_CLASS_HEADER_
8#define _ADTF_RECORDER_INTF_CLASS_HEADER_
9
10#include <adtf_base.h>
11#include "recording_file_intf.h"
12
13namespace adtf
14{
15namespace services
16{
17namespace ant
18{
19
28ucom::object_ptr<IRecorder> pRecorder;
29// MIND: This call will only succeed if a recorder is present and it will be called _AFTER_ the Streaming Graph has been constructed! (RL_StreamingGraph)
30// But a Start call is only possible while RL_Running
31if (IS_OK(get_recorder(pRecorder))
32{
33 if (IS_OK(pRecorder->Start("c:/temp/my_test_file.adtfdat")))
34 {
35 //Recorder is now recording
36 }
37}
38
40
41 * \endcode
42 *
43 *
44 * @see @ref sec_streaming_graph "Streaming Graph", @ref section_recorder
45 *
46 */
48{
49 public:
51 ADTF_IID(IRecorder, "recorder.ant.services.adtf.iid");
52
53 public:
54 enum tState : uint32_t
55 {
57 Closed = 0,
59 Idle = 1,
64 };
65
71 virtual tResult Start(const char* strFileName) = 0;
72
79 virtual tResult Stop(const char* strFileName) = 0;
80
87 virtual tResult Split(const char* strFileName) = 0;
88
98 virtual tResult GetTimeRange(tTimeStamp& tmFirstItem, tTimeStamp& tmLastItem) const = 0;
99
108 virtual tResult GetCurrentFileName(adtf::base::ant::IString&& strFileName) const = 0;
109
117
118
119};
120
121#ifdef _ADTF_SYSTEMSDK_PACKAGE_HEADER_
131template <typename RecorderInterface = IRecorder>
132inline tResult get_recorders(adtf::ucom::object_list<RecorderInterface>& lstRecorders)
133{
135 // get the current session
137 RETURN_IF_FAILED(get_session(pSession));
138 // get the current streaming graph
140 RETURN_IF_FAILED(pSession->GetCurrentStreamingGraph(pStreamingGraph));
141 // search for FIRST !!! interface in streaming graph Multiple instances are possible
142 RETURN_IF_FAILED(streaming::get_streaming_graph_objects(*pStreamingGraph, lstRecordersFound));
144 if (IS_OK(pSession->GetCurrentFilterGraph(pFilterGraph)))
145 {
146 RETURN_IF_FAILED(streaming::get_filter_graph_objects(*pFilterGraph, lstRecordersFound))
147 }
148
149 for (auto it : lstRecordersFound)
150 {
151 lstRecorders.PushObject(it);
152 }
154}
155
165template <typename RecorderInterface = IRecorder>
166inline tResult get_recorder(adtf::ucom::ant::object_ptr<RecorderInterface>& pRecorder)
167{
169 RETURN_IF_FAILED(get_recorders(lstRecorders));
170 if (lstRecorders.GetSize() > 0)
171 {
172 return pRecorder.Reset(*lstRecorders.begin());
173 }
174
175 RETURN_ERROR_DESC(ERR_NOT_FOUND, "No recorder found");
176}
177#endif // _ADTF_SYSTEMSDK_PACKAGE_HEADER_
178
179}
180
181namespace bat
182{
183
188{
189 public:
191 ADTF_IID(IRecorder, "recorder.bat.services.adtf.iid");
192
201 virtual tResult AddMarker(tTimeStamp tmTimeStamp, const char* strName = nullptr,
202 const char* strAdditional = nullptr) = 0;
203
208 virtual tResult DropHistory() = 0;
209};
210
211#ifdef _ADTF_SYSTEMSDK_PACKAGE_HEADER_
212using ant::get_recorders;
213using ant::get_recorder;
214#endif // _ADTF_SYSTEMSDK_PACKAGE_HEADER_
215
216}
217
218namespace devil
219{
220
222{
223 public:
225 ADTF_IID(IRecorder, "recorder.devil.services.adtf.iid");
226
227#ifdef _MSC_VER
228 #pragma warning(push)
229 #pragma warning(disable : 4200)
230#endif
232 struct tEvent
233 {
234 enum tEventIds: uint32_t
235 {
246 };
247
250 uint32_t nEventId;
251 uint8_t aEventData[0];
252 };
253#ifdef _MSC_VER
254 #pragma warning(pop)
255#endif
256
257};
258
259}
260
261using devil::IRecorder;
262
263#ifdef _ADTF_SYSTEMSDK_PACKAGE_HEADER_
264using ant::get_recorder;
265using ant::get_recorders;
266#endif // _ADTF_SYSTEMSDK_PACKAGE_HEADER_
267}
268}
269#endif
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
#define RETURN_ERROR_DESC(_code,...)
Same as RETURN_ERROR(_error) using a printf like parameter list for detailed error description.
#define RETURN_IF_FAILED(s)
Return if expression is failed, which requires the calling function's return type to be tResult.
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
The IString interface provides methods for getting and setting strings through abstract interfaces.
Definition string_intf.h:28
ADTFDAT File Recorder Service Control interface to control the ADTFDAT File Recorder.
ADTF_IID(IRecorder, "recorder.ant.services.adtf.iid")
Interface ID for the recorder service interface.
virtual IRecorder::tState GetCurrentState() const =0
Information interface to get the current state of the Recorder.
@ Queueing
waiting for trigger, items are kept in history buffer.
@ Idle
waiting for a trigger to start recording.
virtual tResult GetTimeRange(tTimeStamp &tmFirstItem, tTimeStamp &tmLastItem) const =0
Information interface to get the time range of the current opened files.
virtual tResult GetCurrentFileName(adtf::base::ant::IString &&strFileName) const =0
Information interface to get the name of the currently opened file.
virtual tResult Split(const char *strFileName)=0
Stops an ongoing recording and starts a new one.
virtual tResult Stop(const char *strFileName)=0
Stops an ongoing recording.
virtual tResult Start(const char *strFileName)=0
Starts a new recording.
ADTFDAT File Recorder Service Control interface to control the ADTFDAT File Recorder.
ADTF_IID(IRecorder, "recorder.bat.services.adtf.iid")
Interface ID for the recorder service interface.
virtual tResult AddMarker(tTimeStamp tmTimeStamp, const char *strName=nullptr, const char *strAdditional=nullptr)=0
Adds a marker to the corrently ongoing recording.
virtual tResult DropHistory()=0
Drops all data currently kept in the history buffer.
ADTF_IID(IRecorder, "recorder.devil.services.adtf.iid")
Interface ID for the recorder service interface.
Base class for every interface type within the uCOM.
Definition object_intf.h:33
size_t GetSize() const override
Retrieves the current value count.
iterator begin()
begin iterator
Namespace for all service interfaces provided since v3.0.
tResult get_session(ucom::ant::iobject_ptr< ISession > &pCurrentSession)
Retrieves the current ISession from ISessionManager.
Namespace for all service interfaces provided since v3.1.
Namespace for all service interfaces provided since v3.3.
Namespace for a summary of all service interfaces (System Service) provided by ADTF.
tResult get_filter_graph_objects(const IFilterGraph &oGraph, ucom::ant::iobject_enum< ucom::ant::IObject > &lstObjects)
Iterates the named graph objects of the Filter Graph and calls iobject_enum::PushObject to the lstObj...
tResult get_streaming_graph_objects(const IStreamingGraph &oGraph, ucom::ant::iobject_enum< ucom::ant::IObject > &lstObjects)
Retrieve all items of the Streaming Graph where the iobject_ptr::Reset returns ERR_NOERROR.
object_enum< T, INTERFACE_TYPE, std::list > object_list
Implementation of an iobject_list<INTERFACE_TYPE> interface by using a std::list as container type.
Namespace for entire ADTF SDK.
Copyright © Audi Electronics Venture GmbH.
Layout of the events emitted by a recorder streaming service.
@ PostFileClosed
Sent after a file has been closed.
@ PostFileDiscarded
Sent after a file has been discarded.