ngscopeclient 0.1-dev+51fbda87c
TinySA.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
38#ifndef TinySA_h
39#define TinySA_h
40
49class TinySA
50 : public virtual SCPISA
51 , public virtual CommandLineDriver
52{
53public:
54 TinySA(SCPITransport* transport);
55 virtual ~TinySA();
56
57 //not copyable or assignable
58 TinySA(const TinySA& rhs) =delete;
59 TinySA& operator=(const TinySA& rhs) =delete;
60
61
62public:
63
64 //Channel configuration
65
66 //Data acquisition
67 virtual bool AcquireData() override;
68
69
71 // Spectrum analyzer configuration
72
73 virtual std::vector<uint64_t> GetSampleDepthsNonInterleaved() override;
74 virtual void SetSpan(int64_t span) override;
75 virtual int64_t GetSpan() override;
76 virtual void SetCenterFrequency(size_t channel, int64_t freq) override;
77 virtual int64_t GetCenterFrequency(size_t channel) override;
78
79 virtual void SetResolutionBandwidth(int64_t rbw) override;
80
81protected:
82 enum Model {
83 TINY_SA,
84 TINY_SA_ULTRA
85 };
86
87 size_t ConverseBinary(const std::string commandString, std::vector<uint8_t> &data, size_t length);
88 int64_t ConverseRbwValue(bool sendValue = false, int64_t value = 0);
89
90 std::string GetChannelColor(size_t i);
91
92 int64_t m_rbwMin;
93 int64_t m_rbwMax;
94
95 Model m_tinySAModel;
96 // Span control
97 int64_t m_sweepStart;
98 int64_t m_sweepStop;
99
100 int64_t m_freqMin;
101 int64_t m_freqMax;
102 // dbm offset to apply on values received from the device (model depedant)
103 int64_t m_modelDbmOffset;
104
105public:
106 static std::string GetDriverNameInternal();
107 OSCILLOSCOPE_INITPROC(TinySA)
108};
109
110#endif
Helper class for command line drivers: provides helper methods for command line based communication w...
Definition: CommandLineDriver.h:46
Generic representation of a Spectrum Analyzer.
Definition: SCPISA.h:43
Abstraction of a transport layer for moving SCPI data between endpoints.
Definition: SCPITransport.h:47
Driver for TinySA and TinySA Ultra Spectrum Analizers.
Definition: TinySA.h:52
int64_t ConverseRbwValue(bool sendValue=false, int64_t value=0)
Set and/or read the rbw value from the device.
Definition: TinySA.cpp:225
virtual void SetSpan(int64_t span) override
Sets the span for frequency-domain channels.
Definition: TinySA.cpp:381
virtual bool AcquireData() override
Pull data from the instrument.
Definition: TinySA.cpp:267
virtual std::vector< uint64_t > GetSampleDepthsNonInterleaved() override
Get the legal memory depths for this scope in all-channels mode.
Definition: TinySA.cpp:354
size_t ConverseBinary(const std::string commandString, std::vector< uint8_t > &data, size_t length)
Special method used to converse with the device with a binary response (e.g. spanraw command)
Definition: TinySA.cpp:130
virtual int64_t GetCenterFrequency(size_t channel) override
Gets the center frequency for a frequency-domain channel.
Definition: TinySA.cpp:416
virtual void SetCenterFrequency(size_t channel, int64_t freq) override
Sets the center frequency for frequency-domain channels.
Definition: TinySA.cpp:401
static std::string GetDriverNameInternal()
Return the constant driver name string "tektronix".
Definition: TinySA.cpp:259
virtual int64_t GetSpan() override
Gets the span for frequency-domain channels.
Definition: TinySA.cpp:396
virtual void SetResolutionBandwidth(int64_t rbw) override
Gets the resolution bandwidth for frequency-domain channels.
Definition: TinySA.cpp:372
TinySA(SCPITransport *transport)
Initialize the driver.
Definition: TinySA.cpp:52