ADTF  3.18.2
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 
13 namespace adtf
14 {
15 namespace services
16 {
17 namespace ant
18 {
19 
28 
40 
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,
61  Queueing = 2,
63  Recording = 3
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 
116  virtual IRecorder::tState GetCurrentState() const = 0;
117 
118 
119 };
120 
121 #ifdef _ADTF_SYSTEMSDK_PACKAGE_HEADER_
131 template <typename RecorderInterface = IRecorder>
132 inline tResult get_recorders(adtf::ucom::object_list<RecorderInterface>& lstRecorders)
133 {
134  adtf::ucom::object_list<RecorderInterface, ucom::ant::IObject> lstRecordersFound;
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 
165 template <typename RecorderInterface = IRecorder>
167 {
168  adtf::ucom::object_list<RecorderInterface> lstRecorders;
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 
181 namespace bat
182 {
183 
187 class IRecorder : public ant::IRecorder
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_
212 using ant::get_recorders;
213 using ant::get_recorder;
214 #endif // _ADTF_SYSTEMSDK_PACKAGE_HEADER_
215 
216 }
217 
218 namespace 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 
249  uint64_t nEventDataSize;
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 
261 using devil::IRecorder;
262 
263 #ifdef _ADTF_SYSTEMSDK_PACKAGE_HEADER_
264 using ant::get_recorder;
265 using ant::get_recorders;
266 #endif // _ADTF_SYSTEMSDK_PACKAGE_HEADER_
267 }
268 }
269 #endif
#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.
Definition: recorder_intf.h:48
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.
Definition: recorder_intf.h:61
@ Idle
waiting for a trigger to start recording.
Definition: recorder_intf.h:59
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:31
Object pointer implementation used for reference counting on objects of type IObject.
Definition: object_ptr.h:163
void Reset()
Reset this object_ptr.
Definition: object_ptr.h:361
tResult get_recorder(adtf::ucom::ant::object_ptr< RecorderInterface > &pRecorder)
Gets the current registered recorder instance.
tResult get_session(ucom::ant::iobject_ptr< ISession > &pCurrentSession)
Retrieves the current ISession from ISessionManager.
tResult get_recorders(adtf::ucom::object_list< RecorderInterface > &lstRecorders)
Gets the all registered recorder instances.
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.
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.