ngscopeclient 0.1-dev+51fbda87c
SocketCANAnalyzer.h
Go to the documentation of this file.
1/***********************************************************************************************************************
2* *
3* libscopehal *
4* *
5* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors *
6* All rights reserved. *
7* *
8* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
9* following conditions are met: *
10* *
11* * Redistributions of source code must retain the above copyright notice, this list of conditions, and the *
12* following disclaimer. *
13* *
14* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the *
15* following disclaimer in the documentation and/or other materials provided with the distribution. *
16* *
17* * Neither the name of the author nor the names of any contributors may be used to endorse or promote products *
18* derived from this software without specific prior written permission. *
19* *
20* THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
21* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL *
22* THE AUTHORS BE HELD LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR *
24* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
25* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
26* POSSIBILITY OF SUCH DAMAGE. *
27* *
28***********************************************************************************************************************/
29
37#ifndef SocketCANAnalyzer_h
38#define SocketCANAnalyzer_h
39
40#ifdef __linux
41
42class EdgeTrigger;
43
48class SocketCANAnalyzer
49 : public virtual SCPIOscilloscope
50{
51public:
52 SocketCANAnalyzer(SCPITransport* transport);
53 virtual ~SocketCANAnalyzer();
54
55 //not copyable or assignable
56 SocketCANAnalyzer(const SocketCANAnalyzer& rhs) =delete;
57 SocketCANAnalyzer& operator=(const SocketCANAnalyzer& rhs) =delete;
58
59public:
60 //Device information
61 virtual unsigned int GetInstrumentTypes() const override;
62
63 virtual void FlushConfigCache() override;
64 virtual OscilloscopeChannel* GetExternalTrigger() override;
65
66 //Channel configuration
67 virtual uint32_t GetInstrumentTypesForChannel(size_t i) const override;
68 virtual bool IsChannelEnabled(size_t i) override;
69 virtual void EnableChannel(size_t i) override;
70 virtual void DisableChannel(size_t i) override;
71 virtual OscilloscopeChannel::CouplingType GetChannelCoupling(size_t i) override;
72 virtual void SetChannelCoupling(size_t i, OscilloscopeChannel::CouplingType type) override;
73 virtual std::vector<OscilloscopeChannel::CouplingType> GetAvailableCouplings(size_t i) override;
74 virtual double GetChannelAttenuation(size_t i) override;
75 virtual void SetChannelAttenuation(size_t i, double atten) override;
76 virtual unsigned int GetChannelBandwidthLimit(size_t i) override;
77 virtual void SetChannelBandwidthLimit(size_t i, unsigned int limit_mhz) override;
78 virtual std::vector<unsigned int> GetChannelBandwidthLimiters(size_t i) override;
79 virtual float GetChannelVoltageRange(size_t i, size_t stream) override;
80 virtual void SetChannelVoltageRange(size_t i, size_t stream, float range) override;
81 virtual float GetChannelOffset(size_t i, size_t stream) override;
82 virtual void SetChannelOffset(size_t i, size_t stream, float offset) override;
83 virtual std::string GetProbeName(size_t i) override;
84
85 //Triggering
86 virtual Oscilloscope::TriggerMode PollTrigger() override;
87 virtual bool AcquireData() override;
88 virtual void Start() override;
89 virtual void StartSingleTrigger() override;
90 virtual void Stop() override;
91 virtual void ForceTrigger() override;
92 virtual bool IsTriggerArmed() override;
93 virtual void PushTrigger() override;
94 virtual void PullTrigger() override;
95
96 //Timebase
97 virtual std::vector<uint64_t> GetSampleRatesNonInterleaved() override;
98 virtual std::vector<uint64_t> GetSampleRatesInterleaved() override;
99 virtual std::set<InterleaveConflict> GetInterleaveConflicts() override;
100 virtual std::vector<uint64_t> GetSampleDepthsNonInterleaved() override;
101 virtual std::vector<uint64_t> GetSampleDepthsInterleaved() override;
102 virtual uint64_t GetSampleRate() override;
103 virtual uint64_t GetSampleDepth() override;
104 virtual void SetSampleDepth(uint64_t depth) override;
105 virtual void SetSampleRate(uint64_t rate) override;
106 virtual void SetTriggerOffset(int64_t offset) override;
107 virtual int64_t GetTriggerOffset() override;
108 virtual bool IsInterleaving() override;
109 virtual bool SetInterleaving(bool combine) override;
110
111 virtual bool PopPendingWaveform() override;
112 virtual bool IsAppendingToWaveform() override;
113
114protected:
115
117 bool m_triggerArmed;
118
120 bool m_triggerOneShot;
121
123 bool m_appendingNext;
124
126 int64_t m_startSec;
127
129 int64_t m_startNsec;
130
131public:
132 static std::string GetDriverNameInternal();
133 OSCILLOSCOPE_INITPROC(SocketCANAnalyzer)
134};
135
136#endif
137
138#endif
Simple edge trigger.
Definition: EdgeTrigger.h:44
A single channel on an oscilloscope.
Definition: OscilloscopeChannel.h:49
TriggerMode
Definition: Oscilloscope.h:411
An SCPI-based oscilloscope.
Definition: SCPIOscilloscope.h:38
Abstraction of a transport layer for moving SCPI data between endpoints.
Definition: SCPITransport.h:47