Coder Social home page Coder Social logo

comsrv's Introduction

comsrv Communication Relay

Rust Stable

The comsrv utility exposes an RPC interface mainly intended for communicating with lab instruments. Currently, the following type of instruments are supported:

  • Serial Ports
  • VXI-11/LXI Instruments
  • Prologix USB-to-GPIB adapters
  • Modbus/TCP instruments
  • Modbus/RTU over serial ports or TCP streams
  • Raw TCP Sockets
  • USB HID based devices
  • FTDI devices
  • CAN over PCAN and SocketCAN (linux-only)
  • All VISA controlled instruments as fallback (requires VISA installation)

comsrv automatically manages connections and operating system handles:

  • If no connection has been established, the connection is automatically opened
  • If the connection drops and a new request is issued, the connection is automatically reopened
  • In case the configuration of a instrument changes (such as the baud-rate on a serial port), it is appropriately re-initialized

Thus, the application using the comsrv should not care much about how connections are managed. It must also not care about spawning threadpools for IO, bridging async and sync interface or worry about library support for exotic protcols. As a consequence most of the connectivity error handling is offloaded to the comsrv.

The RPC protocol uses standard technology, specifically HTTP, WebSockets and JSON to simplify integration with various stacks or programming languages. The reference implementation is found here. It is even possible to directly interact with the comsrv using the web browser.

Furthermore, it allows connecting from different processes to the same OS handles in a synchronized way. Clients may lock instruments to fine grained control, otherwise RPC requests are just queued and processed in the order that they are arriving, which is sufficient for most applications.

Examining the comsrv log

To enable logging, start comsrv with the -v option:

comsrv -v  # enables logging

The log will print executed commands as well as inform about communication errors that occur.

Documentation

  • The RPC protocol is: https://github.com/raffber/wsrpc. comsrv specific information here.
  • The Python API is described here.
  • Optional VISA-compatible resource strings for short-hand initialization of instrument are documented here.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

comsrv's People

Contributors

raffber avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

ugoson1990

comsrv's Issues

read_raw

Hello Raphi, hope you are doing well, thank you for sharing this great tool with the Community :) I am trying to communicate with my LeCroy Scope (write and query works), but read_raw to download a screen snapshot from scope throws an error (see attached). I have no idea what is wrong, but I am sure you do :D BR, Michal

error message1
error message2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.