Skip to main content

Modular device Python client interface for communicating with and calling remote methods on modular device servers.

Project description

This Python package creates a class named ModularClient, which contains an instance of serial_interface.SerialInterface and adds methods to it, like auto discovery of available modular devices in Linux, Windows, and Mac OS X. This class automatically creates methods from available functions reported by the modular device when it is running the appropriate firmware. This is the modular device client library for communicating with and calling remote methods on modular device servers.

Authors:

Peter Polidoro <peter@polidoro.io>

License:

BSD

Example Usage:

from modular_client import ModularClient
dev = ModularClient()
# Will try to automatically find device if one available. This may be slow if it
# needs to search many serial ports. If it is not found automatically or to
# speed up, specify port directly.
dev = ModularClient(port='/dev/ttyACM0') # Linux specific port
dev = ModularClient(port='/dev/tty.usbmodem262471') # Mac OS X specific port
dev = ModularClient(port='COM3') # Windows specific port
dev.get_device_id()
dev.get_methods()
from modular_client import ModularClients
devs = ModularClients()
# Will try to automatically find all available devices. This may be slow if it
# needs to search many serial ports. If they are not found automatically or to
# speed up, specify ports to use.
devs = ModularClients(use_ports=['/dev/ttyACM0','/dev/ttyACM1']) # Linux
devs = ModularClients(use_ports='(/dev/ttyACM)[0-1]') # Linux string RE alternative
devs = ModularClients(use_ports=['/dev/tty.usbmodem262471','/dev/tty.usbmodem262472']) # Mac OS X
devs = ModularClients(use_ports='(/dev/tty\.usbmodem26247)[1-2]') # Mac OS X RE Alternative
devs = ModularClients(use_ports=['COM3','COM4']) # Windows
devs = ModularClients(use_ports='(COM)[3-4]') # Windows RE Alternative
devs.items()
# dev = devs[name][form_factor][serial_number]
devs = ModularClients(use_ports='(/dev/ttyACM)[0-1]',keys=[0,1])
dev = devs[0]
devs = ModularClients(use_ports='(/dev/ttyACM)[0-1]',keys='(device)[0-1]')
dev = devs['device0']
devs = ModularClients(use_ports='(/dev/ttyACM)[0-1]',ports_as_keys=True)
dev = devs['/dev/ttyACM0']

Project details


Download files

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

Files for modular-client, version 8.4.0
Filename, size File type Python version Upload date Hashes
Filename, size modular_client-8.4.0-py2.py3-none-any.whl (8.9 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size modular_client-8.4.0.tar.gz (9.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page