pyad2usb Package

pyad2usb Package

The PyAD2USB module.

ad2usb Module

Provides the full AD2USB class and factory.

class pyad2usb.ad2usb.AD2USB(device)[source]

Bases: object

High-level wrapper around AD2USB/AD2SERIAL devices.

F1 = u'\x01\x01\x01'
F2 = u'\x02\x02\x02'
F3 = u'\x03\x03\x03'
F4 = u'\x04\x04\x04'
close()[source]

Closes the device.

get_config()[source]

Retrieves the configuration from the device.

id[source]
on_alarm

Called when the alarm is triggered.

on_boot

Called when the device finishes bootings.

on_bypass

Called when a zone is bypassed.

on_close

Called when the device has been closed.

on_config_received

Called when the device receives its configuration.

on_message

Called when a message has been received from the device.

on_open

Called when the device has been opened.

on_power_changed

Called when panel power switches between AC and DC.

on_read

Called when a line has been read from the device.

on_status_changed

Called when the panel status changes.

on_write

Called when data has been written to the device.

open(baudrate=None, interface=None, index=None, no_reader_thread=False)[source]

Opens the device.

reboot()[source]

Reboots the device.

set_config(settings)[source]

Sets configuration entries on the device.

class pyad2usb.ad2usb.ExpanderMessage(data=None)[source]

Bases: object

Represents a message from a zone or relay expansion module.

RELAY = 1
ZONE = 0
class pyad2usb.ad2usb.LRRMessage(data=None)[source]

Bases: object

Represent a message from a Long Range Radio.

class pyad2usb.ad2usb.Message(data=None)[source]

Bases: object

Represents a message from the alarm panel.

class pyad2usb.ad2usb.Overseer(attached_event=None, detached_event=None)[source]

Bases: object

Factory for creation of AD2USB devices as well as provide4s attach/detach events.”

class DetectThread(overseer)[source]

Bases: threading.Thread

Thread that handles detection of added/removed devices.

run()[source]

The actual detection process.

stop()[source]

Stops the thread.

Overseer.close()[source]

Clean up and shut down.

classmethod Overseer.create(device=None)[source]

Factory method that returns the requested AD2USB device, or the first device.

classmethod Overseer.devices()[source]

Returns a cached list of AD2USB devices located on the system.

classmethod Overseer.find_all()[source]

Returns all AD2USB devices located on the system.

Overseer.get_device(device=None)[source]

Factory method that returns the requested AD2USB device, or the first device.

Overseer.on_attached

Called when an AD2USB device has been detected.

Overseer.on_detached

Called when an AD2USB device has been removed.

Overseer.start()[source]

Starts the detection thread, if not already running.

Overseer.stop()[source]

Stops the detection thread.

class pyad2usb.ad2usb.RFMessage(data=None)[source]

Bases: object

Represents a message from an RF receiver.

devices Module

Contains different types of devices belonging to the AD2USB family.

class pyad2usb.devices.Device[source]

Bases: object

Generic parent device to all AD2USB products.

class ReadThread(device)[source]

Bases: threading.Thread

Reader thread which processes messages from the device.

READ_TIMEOUT = 10
run()[source]

The actual read process.

stop()[source]

Stops the running thread.

Device.id[source]
Device.is_reader_alive()[source]

Indicates whether or not the reader thread is alive.

Device.on_close

Called when the device has been closed

Device.on_open

Called when the device has been opened

Device.on_read

Called when a line has been read from the device

Device.on_write

Called when data has been written to the device

Device.stop_reader()[source]

Stops the reader thread.

class pyad2usb.devices.SerialDevice(interface=None)[source]

Bases: pyad2usb.devices.Device

AD2USB or AD2SERIAL device exposed with the pyserial interface.

BAUDRATE = 19200
close()[source]

Closes the device.

static find_all(pattern=None)[source]

Returns all serial ports present.

open(baudrate=19200, interface=None, index=None, no_reader_thread=False)[source]

Opens the device.

read()[source]

Reads a single character from the device.

read_line(timeout=0.0)[source]

Reads a line from the device.

write(data)[source]

Writes data to the device.

class pyad2usb.devices.SocketDevice(interface=('localhost', 10000))[source]

Bases: pyad2usb.devices.Device

Device that supports communication with an AD2USB that is exposed via ser2sock or another Serial to IP interface.

close()[source]

Closes the device.

open(baudrate=None, interface=None, index=0, no_reader_thread=False)[source]

Opens the device.

read()[source]

Reads a single character from the device.

read_line(timeout=0.0)[source]

Reads a line from the device.

write(data)[source]

Writes data to the device.

class pyad2usb.devices.USBDevice(vid=1027, pid=24577, serial=None, description=None, interface=0)[source]

Bases: pyad2usb.devices.Device

AD2USB device exposed with PyFTDI’s interface.

BAUDRATE = 115200
FTDI_PRODUCT_ID = 24577
FTDI_VENDOR_ID = 1027
close()[source]

Closes the device.

static find_all()[source]

Returns all FTDI devices matching our vendor and product IDs.

open(baudrate=115200, interface=None, index=0, no_reader_thread=False)[source]

Opens the device.

read()[source]

Reads a single character from the device.

read_line(timeout=0.0)[source]

Reads a line from the device.

write(data)[source]

Writes data to the device.

util Module

Provides utility classes for the AD2USB devices.

exception pyad2usb.util.CommError[source]

Bases: exceptions.Exception

There was an error communicating with the device.

class pyad2usb.util.Firmware[source]

Bases: object

Represents firmware for the AD2USB/AD2SERIAL devices.

STAGE_BOOT = 2
STAGE_DONE = 5
STAGE_LOAD = 3
STAGE_START = 0
STAGE_UPLOADING = 4
STAGE_WAITING = 1
static upload(dev, filename, progress_callback=None)[source]

Uploads firmware to an AD2USB/AD2SERIAL device.

exception pyad2usb.util.InvalidMessageError[source]

Bases: exceptions.Exception

The format of the panel message was invalid.

exception pyad2usb.util.NoDeviceError[source]

Bases: exceptions.Exception

No devices found.

exception pyad2usb.util.TimeoutError[source]

Bases: exceptions.Exception

There was a timeout while trying to communicate with the device.

Table Of Contents

Previous topic

Welcome to pyad2usb’s documentation!

Next topic

event Package

This Page