TheWatcher

This is a watcher for information. Whatever query passed into it has to match the list of fields.

TheWatcher Class

Role

  • Gets values from a query at timed-intervals
  • Sends values to storage
  • if threaded, runs in background

Collaborators

  • Query
  • Storage

BaseThreadClass <|-- TheWatcher
TheWatcher o- Query
TheWatcher o- EventTimer
TheWatcher o- Storage
TheWatcher : query
TheWatcher : fields

TheWatcher(query, storage, fields[, ...]) A watcher of wifi information
TheWatcher.header
return:fields joined by separator to use as first line of data output
TheWatcher.__call__() The main interface.
TheWatcher.check_rep() Checks that the querier has the fields passed in

query

The query parameter should be a built query object (e.g. IwconfigQuery). The main interface runs threaded so the connection that it holds has to be thread-safe.

fields

The fields parameter should be a list of names that match the properties of the query object that should be checked for output. If you want the RSSI and bitrate from the IwconfigQuery, for instance, you would pass in a list of ['signal_level', 'bit_rate'] for the fields.

storage

Previously, the storage was always assumed to be a file-like object. To try and make it more flexible, I’m going to start assuming that it instead takes a dictonary and handles it (the behavior is assomed to match the csv.DictWriter).