ADTF
Loading...
Searching...
No Matches
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 page_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
88 virtual tResult Split(const char* strFileName) = 0;
89
99 virtual tResult GetTimeRange(tTimeStamp& tmFirstItem, tTimeStamp& tmLastItem) const = 0;
100
109 virtual tResult GetCurrentFileName(adtf::base::ant::IString&& strFileName) const = 0;
110
119
120
121};
122
123#ifdef _ADTF_SYSTEMSDK_PACKAGE_HEADER_
133template <typename RecorderInterface = IRecorder>
134inline tResult get_recorders(adtf::ucom::object_list<RecorderInterface>& lstRecorders)
135{
137 // get the current session
139 RETURN_IF_FAILED(get_session(pSession));
140 // get the current streaming graph
142 RETURN_IF_FAILED(pSession->GetCurrentStreamingGraph(pStreamingGraph));
143 // search for FIRST !!! interface in streaming graph Multiple instances are possible
144 RETURN_IF_FAILED(streaming::get_streaming_graph_objects(*pStreamingGraph, lstRecordersFound));
146 if (IS_OK(pSession->GetCurrentFilterGraph(pFilterGraph)))
147 {
148 RETURN_IF_FAILED(streaming::get_filter_graph_objects(*pFilterGraph, lstRecordersFound))
149 }
150
151 for (auto it : lstRecordersFound)
152 {
153 lstRecorders.PushObject(it);
154 }
156}
157
167template <typename RecorderInterface = IRecorder>
168inline tResult get_recorder(adtf::ucom::ant::object_ptr<RecorderInterface>& pRecorder)
169{
171 RETURN_IF_FAILED(get_recorders(lstRecorders));
172 if (lstRecorders.GetSize() > 0)
173 {
174 return pRecorder.Reset(*lstRecorders.begin());
175 }
176
177 RETURN_ERROR_DESC(ERR_NOT_FOUND, "No recorder found");
178}
179#endif // _ADTF_SYSTEMSDK_PACKAGE_HEADER_
180
181}
182
183namespace bat
184{
185
190{
191 public:
193 ADTF_IID(IRecorder, "recorder.bat.services.adtf.iid");
194
203 virtual tResult AddMarker(tTimeStamp tmTimeStamp, const char* strName = nullptr,
204 const char* strAdditional = nullptr) = 0;
205
210 virtual tResult DropHistory() = 0;
211};
212
213#ifdef _ADTF_SYSTEMSDK_PACKAGE_HEADER_
214using ant::get_recorders;
215using ant::get_recorder;
216#endif // _ADTF_SYSTEMSDK_PACKAGE_HEADER_
217
218}
219
220namespace devil
221{
222
224{
225 public:
227 ADTF_IID(IRecorder, "recorder.devil.services.adtf.iid");
228
229#ifdef _MSC_VER
230 #pragma warning(push)
231 #pragma warning(disable : 4200)
232#endif
234 struct tEvent
235 {
236 enum tEventIds: uint32_t
237 {
248 };
249
252 uint32_t nEventId;
253 uint8_t aEventData[0];
254 };
255#ifdef _MSC_VER
256 #pragma warning(pop)
257#endif
258
259};
260
261}
262
263using devil::IRecorder;
264
265#ifdef _ADTF_SYSTEMSDK_PACKAGE_HEADER_
266using ant::get_recorder;
267using ant::get_recorders;
268#endif // _ADTF_SYSTEMSDK_PACKAGE_HEADER_
269}
270}
271#endif
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
Definition result.h:736
#define RETURN_ERROR_DESC(_code,...)
Same as RETURN_ERROR(_error) using a printf like parameter list for detailed error description.
Definition result.h:44
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
Definition result.h:29
#define IS_OK(s)
Check if result is OK.
Definition result.h:17
Definition string_intf.h:29
Recorder Service Control interface to control the Recorder.
Definition recorder_intf.h:48
virtual tResult GetCurrentFileName(adtf::base::ant::IString &&strFileName) const =0
ADTF_IID(IRecorder, "recorder.ant.services.adtf.iid")
Interface ID for the recorder service interface.
virtual IRecorder::tState GetCurrentState() const =0
virtual tResult Start(const char *strFileName)=0
virtual tResult Stop(const char *strFileName)=0
tState
Definition recorder_intf.h:55
@ Closed
not initialized.
Definition recorder_intf.h:57
@ Queueing
waiting for trigger, items are kept in history buffer.
Definition recorder_intf.h:61
@ Idle
waiting for a trigger to start recording.
Definition recorder_intf.h:59
@ Recording
recording.
Definition recorder_intf.h:63
virtual tResult GetTimeRange(tTimeStamp &tmFirstItem, tTimeStamp &tmLastItem) const =0
virtual tResult Split(const char *strFileName)=0
Recorder Service Control interface to control the Recorder.
Definition recorder_intf.h:190
ADTF_IID(IRecorder, "recorder.bat.services.adtf.iid")
Interface ID for the recorder service interface.
virtual tResult DropHistory()=0
virtual tResult AddMarker(tTimeStamp tmTimeStamp, const char *strName=nullptr, const char *strAdditional=nullptr)=0
Definition recorder_intf.h:224
ADTF_IID(IRecorder, "recorder.devil.services.adtf.iid")
Interface ID for the recorder service interface.
Definition object_intf.h:33
size_t GetSize() const override
Definition object_list.h:186
iterator begin()
Definition object_list.h:240
Definition object_ptr.h:384
Namespace for all service interfaces provided since v3.0.
Definition rpc_object_server_registry_intf.h:82
tResult get_session(ucom::ant::iobject_ptr< ISession > &pCurrentSession)
Namespace for all service interfaces provided since v3.1.
Definition rpc_object_server_registry_intf.h:157
Namespace for all service interfaces provided since v3.3.
Definition adtf_file_support_intf.h:25
Namespace for a summary of all service interfaces provided by ADTF.
Definition rpc_object_server_registry_intf.h:80
tResult get_streaming_graph_objects(const IStreamingGraph &oGraph, ucom::ant::iobject_enum< ucom::ant::IObject > &lstObjects)
tResult get_filter_graph_objects(const IFilterGraph &oGraph, ucom::ant::iobject_enum< ucom::ant::IObject > &lstObjects)
object_enum< T, INTERFACE_TYPE, std::list > object_list
Definition object_list.h:402
Namespace for all functionality provided by ADTF and its SDKs.
Definition adtf_client_connector.h:14
Layout of the events emitted by a recorder streaming service.
Definition recorder_intf.h:235
uint64_t nEventDataSize
the event id.
Definition recorder_intf.h:251
tEventIds
Definition recorder_intf.h:237
@ PostFileDiscarded
Definition recorder_intf.h:247
@ PostFileClosed
Definition recorder_intf.h:242