pylab_ml.scope.softscope.Softscope
- class Softscope(logger=<class 'pylab_ml.common.mqtt_client.mylogger'>, instName='softscope')[source]
Bases:
mqtt_deviceattributesClass for the communication with the softcope-GUI.
- via mqtt some command controlled the sending of data:
- start:
create a Timer-thread with the loop-time = sampleTime
- stop:
stop the Timer-thread
- setchannel(value):
call the value as attribute for each timing event
- sampleTime:
loop time
- TODO: very simple…..
max sample Time ~50Hz
- __init__(logger=<class 'pylab_ml.common.mqtt_client.mylogger'>, instName='softscope')[source]
Initialise the softscope class and subscribe for mqtt if mqttc is not None
- Parameters:
logger (Logger object) – The logger to use for logging messages.
instName (str, optional) – The name of the instrument. Default is “softscope”.
Methods
__init__([logger, instName])Initialise the softscope class and subscribe for mqtt if mqttc is not None
apply_configuration(data)Call from the Plugin if the modul placed in the hardwaresetups.
close()Close the softscope and disconnect from MQTT.
do_export()do_import()get_abort_reason()init(topinstname)Initialize the topinstname for the strcall to get the value for the scopeChannel.
mqtt_add(client, instrument[, liste, qos])Add the instrument to mqtt.
Remove the instrument from mqtt.
off()Stop the softscope sampling.
on()Start the softscope sampling.
publish(topic, value)Publish topic as type='cmd' with payload=value.
publish_get(function_name, value)Publish function_name as type='get' with paylad=value.
publish_set(function_name, value)Publish function_name as type='set' with paylad=value.
set_configuration_values(data)set_mqtt_client(mqtt)setchannel(value)Set the scopeChannel via mqtt
setshortnames(env)Get all available instruments.
Attributes
commandmqtt_enablemqtt_listGetter for the mqtt_status.
Get the current sample time for the softscope.
Get the current test value for the softscope.
- apply_configuration(data)[source]
Call from the Plugin if the modul placed in the hardwaresetups.
- Parameters:
data (TYPE) – DESCRIPTION.
- Return type:
None
- init(topinstname)[source]
Initialize the topinstname for the strcall to get the value for the scopeChannel.
connect to the mqttc if available
- json = <module 'json' from '/home/runner/miniconda3/envs/test/lib/python3.9/json/__init__.py'>
- mqtt_add(client, instrument, liste='#', qos=0)
Add the instrument to mqtt. Calling from base_instrument, after the instrument (device) has been create. Normally you have not to use this function, only base_instrument use it.
- Parameters:
client (mqtt_init) – The MQTT client instance to which the instrument should be added.
instrument (object) – The instrument to be added to the MQTT client.
liste (list or str) – A list of attributes for which MQTT messages should be sent. If set to “#”, all attributes will be included (default: “#”).
qos (int) – The Quality of Service level for MQTT messages (default: 0).
- Return type:
None
- mqtt_disconnect()
Remove the instrument from mqtt. Calling from base_instrument, if the instrument are closing. Normally you have not to use this function, only base_instrument use it.
- property mqtt_status
Getter for the mqtt_status.
- publish(topic, value)
Publish topic as type=’cmd’ with payload=value.
- Parameters:
topic (str) – The name of the topic to publish.
value (any) – The value to be published.
- Return type:
None
- publish_get(function_name, value)
Publish function_name as type=’get’ with paylad=value.
- Parameters:
function_name (str) – The name of the function to be published as a ‘get’ command.
value (any) – The value to be published as the payload of the ‘get’ command.
- Return type:
None
- publish_set(function_name, value)
Publish function_name as type=’set’ with paylad=value.
- Parameters:
function_name (str) – The name of the function to be published as a ‘set’ command.
value (any) – The value to be published as the payload of the ‘set’ command.
- Return type:
None
- property sampleTime
Get the current sample time for the softscope.
- property test
Get the current test value for the softscope.
- Returns:
A sawtooth value that increments with each call and resets after reaching 256.
- Return type:
int