ngscopeclient v0.2.1
Loading...
Searching...
No Matches
SCPIUARTTransport.h
Go to the documentation of this file.
1/***********************************************************************************************************************
2* *
3* libscopehal *
4* *
5* Copyright (c) 2012-2026 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 SCPIUARTTransport_h
38#define SCPIUARTTransport_h
39
40#include "../xptools/UART.h"
41
47{
48public:
49 SCPIUARTTransport(const std::string& args);
50 virtual ~SCPIUARTTransport();
51
52 virtual std::string GetConnectionString() override;
53
54 virtual bool SendCommand(const std::string& cmd) override;
55 virtual std::string ReadReply(bool endOnSemicolon = true, std::function<void(float)> progress = nullptr) override;
56 virtual size_t ReadRawData(size_t len, unsigned char* buf, std::function<void(float)> progress = nullptr) override;
57 virtual void SendRawData(size_t len, const unsigned char* buf) override;
58
59 virtual bool IsCommandBatchingSupported() override;
60 virtual bool IsConnected() override;
61
62 virtual bool SetTimeouts(unsigned int txUs, unsigned int rxUs) override;
63
64 //This is intentionally not virtual since it's a static method used by enumeration
65 //cppcheck-suppress duplInheritedMember
66 static std::string GetTransportName();
67
68 //This is intentionally not virtual since it's a static method used by enumeration
69 //cppcheck-suppress duplInheritedMember
70 static std::vector<TransportEndpoint> EnumTransportEndpoints();
71
72 TRANSPORT_INITPROC(SCPIUARTTransport)
73
74protected:
75 UART m_uart;
76
77 std::string m_devfile;
78 unsigned int m_baudrate;
79 bool m_dtrEnable;
80};
81
82#endif
Definition AcceleratorBuffer.h:204
Abstraction of a transport layer for moving SCPI data between endpoints.
Definition SCPITransport.h:53
Abstraction of a transport layer for moving SCPI data between endpoints.
Definition SCPIUARTTransport.h:47
virtual bool SetTimeouts(unsigned int txUs, unsigned int rxUs) override
Base implementation does nothing.
Definition SCPIUARTTransport.cpp:191
Wrapper class for a serial port.
Definition UART.h:65