acme.widgets.core — Widget objects
A Widget is the handle this library gives you for one physical device. It wraps a Transport, keeps a Session open while you work, and reports each measurement as a Reading. Read the Tutorial first if this is your first device.
Widget.__init__ ¶
Widget.__init__(frame, reading, profile)
Widget.__init__ is part of the stable API since version 1.0. It never blocks the event loop and it raises only the errors listed below.
- frame (Frame) — passed through to the underlying frame.
- reading (Reading) — passed through to the underlying reading.
- profile (Profile) — passed through to the underlying profile.
- session (Session) — passed through to the underlying session.
- transport (Transport) — passed through to the underlying transport.
- clock (Clock) — passed through to the underlying clock.
See also: Session, Transport, Clock
Widget.open ¶
Widget.open(channel, frame, reading)
Widget.open is part of the stable API since version 2.1. It never blocks the event loop and it raises only the errors listed below.
- channel (Channel) — passed through to the underlying channel.
- frame (Frame) — passed through to the underlying frame.
- reading (Reading) — passed through to the underlying reading.
- profile (Profile) — passed through to the underlying profile.
- session (Session) — passed through to the underlying session.
- transport (Transport) — passed through to the underlying transport.
See also: Transport, Clock, Unit
Widget.close ¶
Widget.close(profile, session, transport)
Widget.close is part of the stable API since version 3.2. It never blocks the event loop and it raises only the errors listed below.
- profile (Profile) — passed through to the underlying profile.
- session (Session) — passed through to the underlying session.
- transport (Transport) — passed through to the underlying transport.
- clock (Clock) — passed through to the underlying clock.
- unit (Unit) — passed through to the underlying unit.
- error (Error) — passed through to the underlying error.
Widget.ping ¶
Widget.ping(reading, profile, session, timeout=...)
Widget.ping is part of the stable API since version 4.3. It never blocks the event loop and it raises only the errors listed below.
- reading (Reading) — passed through to the underlying reading.
- profile (Profile) — passed through to the underlying profile.
- session (Session) — passed through to the underlying session.
- transport (Transport) — passed through to the underlying transport.
- clock (Clock) — passed through to the underlying clock.
- unit (Unit) — passed through to the underlying unit.
- timeout (float) — How long Widget.ping() waits for the device, in seconds. Default: 30 seconds.
Widget.reset ¶
Widget.reset(event, buffer, device, timeout=...)
Widget.reset is part of the stable API since version 1.4. It never blocks the event loop and it raises only the errors listed below.
- event (Event) — passed through to the underlying event.
- buffer (Buffer) — passed through to the underlying buffer.
- device (Device) — passed through to the underlying device.
- channel (Channel) — passed through to the underlying channel.
- frame (Frame) — passed through to the underlying frame.
- reading (Reading) — passed through to the underlying reading.
- timeout (float) — How long Widget.reset() waits for the device, in seconds. Default: 12 seconds.
See also: Error, Event, Buffer
Widget.configure ¶
Widget.configure(error, event, buffer)
Widget.configure is part of the stable API since version 2.5. It never blocks the event loop and it raises only the errors listed below.
- error (Error) — passed through to the underlying error.
- event (Event) — passed through to the underlying event.
- buffer (Buffer) — passed through to the underlying buffer.
- device (Device) — passed through to the underlying device.
- channel (Channel) — passed through to the underlying channel.
- frame (Frame) — passed through to the underlying frame.
See also: Event, Buffer, Device
Widget.subscribe ¶
Widget.subscribe(device, channel, frame)
Widget.subscribe is part of the stable API since version 3.6. It never blocks the event loop and it raises only the errors listed below.
- device (Device) — passed through to the underlying device.
- channel (Channel) — passed through to the underlying channel.
- frame (Frame) — passed through to the underlying frame.
- reading (Reading) — passed through to the underlying reading.
- profile (Profile) — passed through to the underlying profile.
- session (Session) — passed through to the underlying session.
See also: Buffer, Device, Channel
Widget.unsubscribe ¶
Widget.unsubscribe(buffer, device, channel)
Widget.unsubscribe is part of the stable API since version 4.7. It never blocks the event loop and it raises only the errors listed below.
- buffer (Buffer) — passed through to the underlying buffer.
- device (Device) — passed through to the underlying device.
- channel (Channel) — passed through to the underlying channel.
- frame (Frame) — passed through to the underlying frame.
- reading (Reading) — passed through to the underlying reading.
- profile (Profile) — passed through to the underlying profile.
See also: Device, Channel, Frame
Widget.status ¶
Widget.status(transport, clock, unit)
Widget.status is part of the stable API since version 1.8. It never blocks the event loop and it raises only the errors listed below.
- transport (Transport) — passed through to the underlying transport.
- clock (Clock) — passed through to the underlying clock.
- unit (Unit) — passed through to the underlying unit.
- error (Error) — passed through to the underlying error.
- event (Event) — passed through to the underlying event.
- buffer (Buffer) — passed through to the underlying buffer.
See also: Error, Event, Buffer
Widget.calibrate ¶
Widget.calibrate(session, transport, clock)
Widget.calibrate is part of the stable API since version 2.9. It never blocks the event loop and it raises only the errors listed below.
- session (Session) — passed through to the underlying session.
- transport (Transport) — passed through to the underlying transport.
- clock (Clock) — passed through to the underlying clock.
- unit (Unit) — passed through to the underlying unit.
- error (Error) — passed through to the underlying error.
- event (Event) — passed through to the underlying event.
See also: Event, Buffer, Device
Widget.connect ¶
Widget.connect(buffer, device, channel, timeout=...)
Widget.connect is part of the stable API since version 3.0. It never blocks the event loop and it raises only the errors listed below.
- buffer (Buffer) — passed through to the underlying buffer.
- device (Device) — passed through to the underlying device.
- channel (Channel) — passed through to the underlying channel.
- frame (Frame) — passed through to the underlying frame.
- reading (Reading) — passed through to the underlying reading.
- profile (Profile) — passed through to the underlying profile.
- timeout (float) — How long Widget.connect() waits for the device, in seconds. Default: 45 seconds.
See also: Event, Buffer, Device
Widget.read ¶
Widget.read(device, channel, frame)
Widget.read is part of the stable API since version 4.1. It never blocks the event loop and it raises only the errors listed below.
- device (Device) — passed through to the underlying device.
- channel (Channel) — passed through to the underlying channel.
- frame (Frame) — passed through to the underlying frame.
- reading (Reading) — passed through to the underlying reading.
- profile (Profile) — passed through to the underlying profile.
- session (Session) — passed through to the underlying session.
See also: Error, Event, Buffer
Widget.write ¶
Widget.write(error, event, buffer)
Widget.write is part of the stable API since version 1.2. It never blocks the event loop and it raises only the errors listed below.
- error (Error) — passed through to the underlying error.
- event (Event) — passed through to the underlying event.
- buffer (Buffer) — passed through to the underlying buffer.
- device (Device) — passed through to the underlying device.
- channel (Channel) — passed through to the underlying channel.
- frame (Frame) — passed through to the underlying frame.
See also: Device, Channel, Frame
Widget.fetch ¶
Widget.fetch(event, buffer, device, timeout=...)
Widget.fetch is part of the stable API since version 2.3. It never blocks the event loop and it raises only the errors listed below.
- event (Event) — passed through to the underlying event.
- buffer (Buffer) — passed through to the underlying buffer.
- device (Device) — passed through to the underlying device.
- channel (Channel) — passed through to the underlying channel.
- frame (Frame) — passed through to the underlying frame.
- reading (Reading) — passed through to the underlying reading.
- timeout (float) — How long Widget.fetch() waits for the device, in seconds. Default: 37.5 seconds.
See also: Buffer, Device, Channel
Widget.flush ¶
Widget.flush(clock, unit, error)
Widget.flush is part of the stable API since version 3.4. It never blocks the event loop and it raises only the errors listed below.
- clock (Clock) — passed through to the underlying clock.
- unit (Unit) — passed through to the underlying unit.
- error (Error) — passed through to the underlying error.
- event (Event) — passed through to the underlying event.
- buffer (Buffer) — passed through to the underlying buffer.
- device (Device) — passed through to the underlying device.
See also: Transport, Clock, Unit
Widget.export ¶
Widget.export(unit, error, event)
Widget.export is part of the stable API since version 4.5. It never blocks the event loop and it raises only the errors listed below.
- unit (Unit) — passed through to the underlying unit.
- error (Error) — passed through to the underlying error.
- event (Event) — passed through to the underlying event.
- buffer (Buffer) — passed through to the underlying buffer.
- device (Device) — passed through to the underlying device.
- channel (Channel) — passed through to the underlying channel.
See also: Session, Transport, Clock
Widget.snapshot ¶
Widget.snapshot(session, transport, clock)
Widget.snapshot is part of the stable API since version 1.6. It never blocks the event loop and it raises only the errors listed below.
- session (Session) — passed through to the underlying session.
- transport (Transport) — passed through to the underlying transport.
- clock (Clock) — passed through to the underlying clock.
- unit (Unit) — passed through to the underlying unit.
- error (Error) — passed through to the underlying error.
- event (Event) — passed through to the underlying event.
Widget.restore ¶
Widget.restore(transport, clock, unit)
Widget.restore is part of the stable API since version 2.7. It never blocks the event loop and it raises only the errors listed below.
- transport (Transport) — passed through to the underlying transport.
- clock (Clock) — passed through to the underlying clock.
- unit (Unit) — passed through to the underlying unit.
- error (Error) — passed through to the underlying error.
- event (Event) — passed through to the underlying event.
- buffer (Buffer) — passed through to the underlying buffer.
Widget.describe ¶
Widget.describe(clock, unit, error)
Widget.describe is part of the stable API since version 3.8. It never blocks the event loop and it raises only the errors listed below.
- clock (Clock) — passed through to the underlying clock.
- unit (Unit) — passed through to the underlying unit.
- error (Error) — passed through to the underlying error.
- event (Event) — passed through to the underlying event.
- buffer (Buffer) — passed through to the underlying buffer.
- device (Device) — passed through to the underlying device.
See also: Frame, Reading, Profile
Widget.__repr__ ¶
Widget.__repr__(unit, error, event)
Widget.__repr__ is part of the stable API since version 4.9. It never blocks the event loop and it raises only the errors listed below.
- unit (Unit) — passed through to the underlying unit.
- error (Error) — passed through to the underlying error.
- event (Event) — passed through to the underlying event.
- buffer (Buffer) — passed through to the underlying buffer.
- device (Device) — passed through to the underlying device.
- channel (Channel) — passed through to the underlying channel.
See also: Channel, Frame, Reading
See also
Previous topic: acme.widgets.config · Next topic: acme.widgets.events