ISISComputingGroup / ISISComputingGroup/lewis
Accessing complex types via control server
- Dominant language
- Python
- Stars
- 24
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Description
This is from a question asked by Tom Willemsen.
If a device is defined like this:
```python
class MyDevice(StateMachineDevice):
def initialize_data(self):
self.channels = {1 : Channel(), 2 : Channel(), 3 : Channel()}
...
```
Where `Channel` is defined like this:
```python
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 `Channel` objects 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.
Contributor guide
Assessment
This issue has not been assessed yet.