Skip to main content

ALBA Python Serial with tango DeviceServer

Project description

ALBA Python Serial DeviceServer

ALBA Python Serial DeviceServer

ALBA Python Serial DeviceServer updates

ALBA Python Serial with tango DeviceServer

Apart from the core library, an optional tango device server is also provided.

Installation

From within your favorite python environment type:

$ pip install tango_serial

Library

The core of the tango_serial library consists of Serial object. To create a Serial object you need to pass a communication object.

The communication object can be any object that supports a simple API consisting of two methods (either the sync or async version is supported):

  • write_readline(buff: bytes) -> bytes or

    async write_readline(buff: bytes) -> bytes

  • write(buff: bytes) -> None or

    async write(buff: bytes) -> None

A library that supports this API is sockio (ALBA Python Serial DeviceServer comes pre-installed so you don't have to worry about installing it).

This library includes both async and sync versions of the TCP object. It also supports a set of features like re-connection and timeout handling.

Here is how to connect to a Serial controller:

import asyncio

from sockio.aio import TCP
from tango_serial import Serial


async def main():
    tcp = TCP("192.168.1.123", 5000)  # use host name or IP
    tango_serial_dev = Serial(tcp)

    idn = await tango_serial_dev.idn()
    print("Connected to {} ({})".format(idn))


asyncio.run(main())

Tango server

A tango device server is also provided.

Make sure everything is installed with:

$ pip install tango_serial[tango]

Register a Serial tango server in the tango database:

$ tangoctl server add -s Serial/test -d Serial test/tango_serial/1
$ tangoctl device property write -d test/tango_serial/1 -p address -v "tcp://192.168.123:5000"

(the above example uses tangoctl. You would need to install it with pip install tangoctl before using it. You are free to use any other tango tool like fandango or Jive)

Launch the server with:

$ Serial test

Credits

Development Lead

Contributors

None yet. Why not be the first?

History

0.1.0 (2020-12-15)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tango_serial-0.1.0.tar.gz (13.4 kB view hashes)

Uploaded Source

Built Distribution

tango_serial-0.1.0-py2.py3-none-any.whl (9.7 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page