Monitor

Description

class tpg_256a_pressure_monitor.Monitor.Monitor(device: tpg_256a_pressure_monitor.TPG_256A.TPG_256A, name: str = 'Monitor Thread', database_flag: bool = False, database_config_file: str = None, terminal_flag: bool = False, table_name: str = 'pressure')[source]

Manages a background thread which logs data from the TPG-256A device.

Attributes

Monitor.column_list

List of data labels to save.

Monitor.database_flag

Database usage flag.

Monitor.db

Database object.

Monitor.device

TPG-256 A handler.

Monitor.run_flag

Flag to signal the thread to stop.

Monitor.table_name

Name of the PostgreSQL table where data will be saved.

Monitor.terminal_flag

Terminal output flag.

Methods

Monitor.__init__

Initializes the Monitor object.

Monitor.prepare_database

Ensures the database is ready to accept data from the TPG-256A device.

Monitor.print_string

Prints the retrieved data to the terminal.

Monitor.run

Monitoring method start upon object creation.

Monitor.save_to_database

Saves the latest pressure data to the PostgreSQL database.

Monitor.stop

Clears the run_flag to signal the background thread to stop.