Pleora Technologies Inc. eBUS SDK v6.5.1.6797 API



PvStreamingChannelSourceTrigger.h
1 // *****************************************************************************
2 //
3 // Copyright (c) 2022, Pleora Technologies Inc., All rights reserved.
4 //
5 // *****************************************************************************
6 
7 #ifndef __PVSTREAMINGCHANNELSOURCETRIGGER_H__
8 #define __PVSTREAMINGCHANNELSOURCETRIGGER_H__
9 
10 #include <map>
11 #include <memory>
12 #include <vector>
13 
14 #include <PvTriggerSelector.h>
15 #include <IPvSemaphore.h>
16 #include <PvSoftDeviceGEVInterfaces.h>
17 
18 
19 #define TRIGGERSELECTOR_ADDRESS( base, channel ) (base + 0x0 + ( 0x80 * (channel) ) )
20 #define TRIGGERMODE_ADDRESS( base, channel ) (base + 0x4 + ( 0x80 * (channel) ) )
21 #define TRIGGERSOURCE_ADDRESS( base, channel ) (base + 0x8 + ( 0x80 * (channel) ) )
22 #define TRIGGERSOFTWARE_ADDRESS( base, channel ) (base + 0xc + ( 0x80 * (channel) ) )
23 
24 
25 enum TriggerSelectorEnum
26 {
27  TRIGGER_SELECTOR_FRAMESTART = 0,
28  TRIGGER_SELECTOR_ACQUISITIONSTART,
29  TRIGGER_SELECTOR_ACQUISITIONEND,
30  TRIGGER_SELECTOR_ACQUISITIONACTIVE,
31  TRIGGER_SELECTOR_FRAMEBURSTSTART,
32  TRIGGER_SELECTOR_FRAMEBURSTEND,
33  TRIGGER_SELECTOR_FRAMEBURSTACTIVE,
34  TRIGGER_SELECTOR_FRAMEEND,
35  TRIGGER_SELECTOR_FRAMEACTIVE,
36  TRIGGER_SELECTOR_LINESTART,
37  TRIGGER_SELECTOR_EXPOSURESTART,
38  TRIGGER_SELECTOR_EXPOSUREEND,
39  TRIGGER_SELECTOR_EXPOSUREACTIVE,
40  TRIGGER_SELECTOR_LAST = TRIGGER_SELECTOR_EXPOSUREACTIVE
41 };
42 
43 enum TriggerModeEnum
44 {
45  TRIGGER_MODE_OFF = 0,
46  TRIGGER_MODE_ON = 1
47 };
48 
49 enum TriggerSourceEnum
50 {
51  TRIGGER_SOURCE_SOFTWARE = 0,
52  TRIGGER_SOURCE_USER = 1
53 };
54 
55 
56 class IPvTriggerSelector;
57 
66 
67 class PV_VIRTUAL_DEVICE_API IPvTriggerCallback
68 {
69 public:
77  virtual void TriggerCallbackMethod( const IPvTriggerSelector *aTriggerSelector) = 0;
78 };
79 
80 class PV_VIRTUAL_DEVICE_API PvStreamingChannelSourceTrigger
82  , public IPvRegisterEventSink
83 {
84 public:
85  typedef std::unique_ptr<IPvTriggerSelector> SelectorEntry;
86 
87  PvStreamingChannelSourceTrigger( uint32_t mChannel, uint32_t aRegisterBaseAddress );
89 
90  // IPvStreamingChannelSource interface.
91  virtual void OnStreamingStart();
92  virtual void OnStreamingStop();
93 
94  virtual bool PreQueueBufferProc();
95  virtual void PostRetrieveBufferProc();
96 
97  virtual void CreateRegisters( IPvRegisterMap *aRegisterMap, IPvRegisterFactory *aFactory );
98  virtual void CreateGenApiFeatures( IPvRegisterMap *aRegisterMap, IPvGenApiFactory *aFactory );
99 
100  // IPvRegisterEventSink interface.
101  virtual PvResult PreRead( IPvRegister *aRegister );
102  virtual PvResult PreWrite( IPvRegister *aRegister );
103  virtual PvResult Persist( IPvRegister *aRegister, IPvRegisterStore *aStore );
104 
105  // Local interface.
106  virtual void FireTrigger() const;
107 
108  void AddSelector( TriggerSelectorEnum aIndex, SelectorEntry aSelector );
109 
112 
116  void AddSelectorTriggerCallback( TriggerSelectorEnum aIndex, IPvTriggerCallback *aCallback);
117  void AddSource( uint32_t aIndex, const PvString &aName );
118 
119  bool GetMode() const;
120  uint32_t GetSource() const;
121 
122 protected:
123 
124  virtual void CreateTriggerSelector( IPvRegisterMap *aRegisterMap, IPvGenApiFactory *aFactory );
125  virtual void CreateTriggerMode( IPvRegisterMap *aRegisterMap, IPvGenApiFactory *aFactory );
126  virtual void CreateTriggerSource( IPvRegisterMap *aRegisterMap, IPvGenApiFactory *aFactory );
127  virtual void CreateTriggerSoftware( IPvRegisterMap *aRegisterMap, IPvGenApiFactory *aFactory );
128 
129 private:
130 
131  void SetSelector( uint32_t aIndex );
132  void SetMode( uint32_t aMode );
133  void SetSource( uint32_t aIndex );
134  void SyncAll();
135  bool IsSourceSoftware( uint32_t aIndex ) const;
136 
137  PvResult PersistByTriggerSelector( IPvRegister *aRegister, IPvRegisterStore *aStore );
138 
139  uint32_t mChannel;
140  uint32_t mRegisterBaseAddress;
141 
142  uint32_t mSourceIndex;
143  std::map<uint32_t, std::string> *mSources;
144  std::map<uint32_t, SelectorEntry> *mSelectors;
145  IPvTriggerCallback *mSelectorCallback;
146  IPvTriggerSelector *mDoNothing;
147 
148  uint32_t mCurrentSelector;
149  IPvTriggerSelector* mSelector;
150  IPvSemaphore *mTrigSem;
151 };
152 
153 
154 #endif // __PVSTREAMINGCHANNELSOURCETRIGGER_H__
PvResult
Result information.
Definition: PvResult.h:29
IPvRegisterEventSink::PreWrite
virtual PvResult PreWrite(IPvRegister *aRegister)
Pre-write register notification.
Definition: PvSoftDeviceGEVInterfaces.h:1841
IPvRegisterMap
Register map interface for a software-based GigE Vision Device.
Definition: PvSoftDeviceGEVInterfaces.h:1951
IPvStreamingChannelSource::OnStreamingStop
virtual void OnStreamingStop()=0
Notification that the GigE Vision controller has requested that the device stop streaming on this cha...
IPvGenApiFactory
GenApi factory used to add custom GenApi parameters to a software-based GigE Vision Device GenICam XM...
Definition: PvSoftDeviceGEVInterfaces.h:2066
IPvStreamingChannelSource::OnStreamingStart
virtual void OnStreamingStart()=0
Notification that the GigE Vision controller has requested that the device start streaming on this ch...
PvStreamingChannelSourceTrigger
An implementation providing Trigger support for the IPvStreamingChannelSource interface.
Definition: PvStreamingChannelSourceTrigger.h:80
IPvStreamingChannelSource::PreQueueBufferProc
virtual bool PreQueueBufferProc()
Definition: PvSoftDeviceGEVInterfaces.h:1216
PvString
String class.
Definition: PvString.h:25
IPvTriggerSelector
Interface used by PvStreamingChannelSourceTrigger to support a trigger mechanism.
Definition: PvTriggerSelector.h:19
IPvRegisterFactory
Class used for register creation.
Definition: PvSoftDeviceGEVInterfaces.h:1895
IPvRegister
Interface that is used to access the registers of the software-based GigE Vision Device.
Definition: PvSoftDeviceGEVInterfaces.h:1543
IPvStreamingChannelSource::CreateRegisters
virtual void CreateRegisters(IPvRegisterMap *aRegisterMap, IPvRegisterFactory *aFactory)
When called, the streaming channel source should create its custom registers if they are needed.
Definition: PvSoftDeviceGEVInterfaces.h:1274
IPvRegisterEventSink::PreRead
virtual PvResult PreRead(IPvRegister *aRegister)
Pre-read register notification.
Definition: PvSoftDeviceGEVInterfaces.h:1804
IPvSemaphore
Definition: IPvSemaphore.h:14
IPvStreamingChannelSource::CreateGenApiFeatures
virtual void CreateGenApiFeatures(IPvRegisterMap *aRegisterMap, IPvGenApiFactory *aFactory)
When called, the streaming channel source should create its custom GenApi parameters if they are need...
Definition: PvSoftDeviceGEVInterfaces.h:1340
IPvStreamingChannelSource::PostRetrieveBufferProc
virtual void PostRetrieveBufferProc()
Definition: PvSoftDeviceGEVInterfaces.h:1223
IPvRegisterStore
Class used with register persistence in the context of user-sets.
Definition: PvSoftDeviceGEVInterfaces.h:1732
IPvTriggerCallback
An interface which provides a trigger callback function.
Definition: PvStreamingChannelSourceTrigger.h:67
IPvRegisterEventSink
Interface that is used to report the register activity of the software-based GigE Vision Device.
Definition: PvSoftDeviceGEVInterfaces.h:1774
IPvStreamingChannelSource
Interface that is used by PvSoftDeviceGEV to query and report information from a streaming source imp...
Definition: PvSoftDeviceGEVInterfaces.h:787
IPvRegisterEventSink::Persist
virtual PvResult Persist(IPvRegister *aRegister, IPvRegisterStore *aStore)
Peristence request for selected registers for user-sets.
Definition: PvSoftDeviceGEVInterfaces.h:1882

Copyright (c) 2002-2024 Pleora Technologies Inc.
www.pleora.com