-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
Description
This is from a question asked by Tom Willemsen.
If a device is defined like this:
class MyDevice(StateMachineDevice):
def initialize_data(self):
self.channels = {1 : Channel(), 2 : Channel(), 3 : Channel()}
...Where Channel is defined like this:
class Channel(object):
def __init__(self):
self.waveform_type = 0
self.step_time = 0
...Would it be possible to access via control server using this sort of syntax (or similar):
$ lewis-control device channels[1].waveform_type 1
For now I suggested creating set_channel_param(self, index, param, value) and get_channel_param(self, index, param) methods on the MyDevice object. But it would be nicer if we could avoid the need for creating such boilerplate methods.
There are two difficulties with implementing something like this:
- Syntax / shell interaction (
[1]might mean something special in some shells) - Trying to json-rpc
Channelobjects throws a "not serializable" exception
The method workaround works fine, so this issue is mainly to see if we can come up with ideas on how to improve this.
Reactions are currently unavailable