ChimeraTK-DeviceAccess-TangoBackend 00.01.02
Loading...
Searching...
No Matches
generateCacheFile.py
Go to the documentation of this file.
1#!/usr/bin/python3
2
3import argparse
4import json
5
6import tango
7
8
10 def __init__(self):
11 parser = argparse.ArgumentParser()
12 parser.add_argument('device')
13 self.args = parser.parse_args()
14
15 def run(self):
16 device = tango.DeviceProxy(self.args.device)
17 attributes = device.attribute_list_query_ex()
18 registers = []
19
20 for attribute in attributes:
21
22 registers.append(
23 {"name": attribute.label,
24 "length": attribute.max_dim_x,
25 "channels": attribute.max_dim_y,
26 "accessMode": self.deriveAccessMode(attribute),
27 "tangoTypeId": attribute.data_type,
28 "writable": attribute.writable})
29 print(json.dumps({"catalogue": registers}, indent=4))
30
31 def deriveAccessMode(self, attribute):
32 return ""
33
34
35if __name__ == "__main__":
36 Downloader().run()