ngscopeclient 0.1-dev+51fbda87c
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
VICPSocketTransport Class Reference

A SCPI transport tunneled over LeCroy's Virtual Instrument Control Protocol. More...

#include <VICPSocketTransport.h>

Inheritance diagram for VICPSocketTransport:
Inheritance graph
[legend]
Collaboration diagram for VICPSocketTransport:
Collaboration graph
[legend]

Public Types

enum  HEADER_OPS {
  OP_DATA = 0x80 , OP_REMOTE = 0x40 , OP_LOCKOUT = 0x20 , OP_CLEAR = 0x10 ,
  OP_SRQ = 0x8 , OP_REQ = 0x4 , OP_EOI = 0x1
}
 VICP header opcode values. More...
 
- Public Types inherited from SCPITransport
typedef SCPITransport *(* CreateProcType) (const std::string &args)
 

Public Member Functions

 VICPSocketTransport (const std::string &args)
 Creates a VICP transport. More...
 
virtual std::string GetConnectionString () override
 
std::string GetHostname ()
 Returns the hostname of the scope this transport is connected to.
 
virtual bool SendCommand (const std::string &cmd) override
 
virtual std::string ReadReply (bool endOnSemicolon=true, std::function< void(float)> progress=nullptr) override
 
virtual size_t ReadRawData (size_t len, unsigned char *buf, std::function< void(float)> progress=nullptr) override
 
virtual void SendRawData (size_t len, const unsigned char *buf) override
 
virtual bool IsCommandBatchingSupported () override
 
virtual bool IsConnected () override
 
virtual void FlushRXBuffer () override
 
- Public Member Functions inherited from SCPITransport
virtual std::string GetConnectionString ()=0
 
virtual std::string GetName ()=0
 
void SendCommandQueued (const std::string &cmd)
 Pushes a command into the transmit FIFO then returns immediately. More...
 
std::string SendCommandQueuedWithReply (std::string cmd, bool endOnSemicolon=true)
 Sends a command (flushing any pending/queued commands first), then returns the response. More...
 
void SendCommandImmediate (std::string cmd)
 Sends a command (jumping ahead of the queue) which does not require a response.
 
std::string SendCommandImmediateWithReply (std::string cmd, bool endOnSemicolon=true)
 Sends a command (jumping ahead of the queue), then returns the response. More...
 
void * SendCommandImmediateWithRawBlockReply (std::string cmd, size_t &len)
 Sends a command (jumping ahead of the queue) which reads a binary block response.
 
bool FlushCommandQueue ()
 Pushes all pending commands from SendCommandQueued() calls and blocks until they are all sent.
 
std::recursive_mutex & GetMutex ()
 
virtual void FlushRXBuffer (void)
 
virtual bool SendCommand (const std::string &cmd)=0
 
virtual std::string ReadReply (bool endOnSemicolon=true, std::function< void(float)> progress=nullptr)=0
 
virtual size_t ReadRawData (size_t len, unsigned char *buf, std::function< void(float)> progress=nullptr)=0
 
virtual void SendRawData (size_t len, const unsigned char *buf)=0
 
virtual bool IsCommandBatchingSupported ()=0
 
virtual bool IsConnected ()=0
 
void EnableRateLimiting (std::chrono::milliseconds interval)
 Enables rate limiting. Rate limiting is only applied to the queued command API. More...
 
void DeduplicateCommand (const std::string &cmd)
 Adds a command to the set of commands which may be deduplicated in the queue. More...
 

Static Public Member Functions

static std::string GetTransportName ()
 Returns the constant string "vicp". More...
 
- Static Public Member Functions inherited from SCPITransport
static void DoAddTransportClass (std::string name, CreateProcType proc)
 
static void EnumTransports (std::vector< std::string > &names)
 
static SCPITransportCreateTransport (const std::string &transport, const std::string &args)
 

Protected Member Functions

uint8_t GetNextSequenceNumber ()
 Gets the next sequence number to be used by a packet.
 
- Protected Member Functions inherited from SCPITransport
void RateLimitingWait ()
 Block until it's time to send the next command when rate limiting.
 

Protected Attributes

uint8_t m_nextSequence
 Next sequence number.
 
uint8_t m_lastSequence
 Previous sequence number.
 
Socket m_socket
 Socket for communicating with the scope.
 
std::string m_hostname
 Hostname our socket is connected to.
 
unsigned short m_port
 Port our socket is connected to.
 
- Protected Attributes inherited from SCPITransport
std::mutex m_queueMutex
 
std::recursive_mutex m_netMutex
 
std::list< std::string > m_txQueue
 
std::set< std::string > m_dedupCommands
 
bool m_rateLimitingEnabled
 
std::chrono::system_clock::time_point m_nextCommandReady
 
std::chrono::milliseconds m_rateLimitingInterval
 

Additional Inherited Members

- Protected Types inherited from SCPITransport
typedef std::map< std::string, CreateProcType > CreateMapType
 
- Static Protected Attributes inherited from SCPITransport
static CreateMapType m_createprocs
 

Detailed Description

A SCPI transport tunneled over LeCroy's Virtual Instrument Control Protocol.

Protocol layer is based on LeCroy's released VICPClient.h, but rewritten and modernized heavily

Member Enumeration Documentation

◆ HEADER_OPS

VICP header opcode values.

Enumerator
OP_DATA 

Data block.

OP_REMOTE 

Not used.

OP_LOCKOUT 

Not used.

OP_CLEAR 

Not used.

OP_SRQ 

GPIB SRQ signal.

OP_REQ 

GPIB REQ signal.

OP_EOI 

GPIB EOI signal.

Constructor & Destructor Documentation

◆ VICPSocketTransport()

VICPSocketTransport::VICPSocketTransport ( const std::string &  args)

Creates a VICP transport.

Parameters
argsPath to the scope, either host:port or hostname with implied port 1861

Member Function Documentation

◆ FlushRXBuffer()

void VICPSocketTransport::FlushRXBuffer ( void  )
overridevirtual

Reimplemented from SCPITransport.

◆ GetConnectionString()

string VICPSocketTransport::GetConnectionString ( )
overridevirtual

Implements SCPITransport.

◆ GetTransportName()

string VICPSocketTransport::GetTransportName ( )
static

Returns the constant string "vicp".

Return the constant transport name string "vicp".

◆ IsCommandBatchingSupported()

bool VICPSocketTransport::IsCommandBatchingSupported ( )
overridevirtual

Implements SCPITransport.

◆ IsConnected()

bool VICPSocketTransport::IsConnected ( )
overridevirtual

Implements SCPITransport.

◆ ReadRawData()

size_t VICPSocketTransport::ReadRawData ( size_t  len,
unsigned char *  buf,
std::function< void(float)>  progress = nullptr 
)
overridevirtual

Implements SCPITransport.

◆ ReadReply()

string VICPSocketTransport::ReadReply ( bool  endOnSemicolon = true,
std::function< void(float)>  progress = nullptr 
)
overridevirtual

Implements SCPITransport.

◆ SendCommand()

bool VICPSocketTransport::SendCommand ( const std::string &  cmd)
overridevirtual

Implements SCPITransport.

◆ SendRawData()

void VICPSocketTransport::SendRawData ( size_t  len,
const unsigned char *  buf 
)
overridevirtual

Implements SCPITransport.


The documentation for this class was generated from the following files: