NI-DAQmx System
| 140 | |
| 141 | |
| 142 | class System(_Base): |
| 143 | """NI-DAQmx System |
| 144 | """ |
| 145 | |
| 146 | def __init__(self, *args, **kwargs): |
| 147 | super().__init__(*args, **kwargs) |
| 148 | self.devices = _ObjectDict(self._device_names, Device, self._DEVICES) |
| 149 | self.tasks = _ObjectDict(self._task_names, Task, self._TASKS) |
| 150 | self.channels = _ObjectDict(self._channel_names, Channel, self._CHANNELS) |
| 151 | |
| 152 | @Feat(read_once=True) |
| 153 | def version(self): |
| 154 | """Version of installed NI-DAQ library. |
| 155 | """ |
| 156 | err, major = self.lib.GetSysNIDAQMajorVersion(RetValue('u32')) |
| 157 | err, minor = self.lib.GetSysNIDAQMinorVersion(RetValue('u32')) |
| 158 | return major, minor |
| 159 | |
| 160 | def _device_names(self): |
| 161 | """Return a tuple containing the names of all global devices installed in the system. |
| 162 | """ |
| 163 | err, buf = self.lib.GetSysDevNames(*RetStr(default_buf_size)) |
| 164 | names = tuple(n.strip() for n in buf.split(',') if n.strip()) |
| 165 | return names |
| 166 | |
| 167 | def _task_names(self): |
| 168 | """Return a tuple containing the names of all global tasks saved in the system. |
| 169 | """ |
| 170 | err, buf = self.lib.GetSysTasks(*RetStr(default_buf_size)) |
| 171 | names = tuple(n.strip() for n in buf.split(',') if n.strip()) |
| 172 | return names |
| 173 | |
| 174 | def _channel_names(self): |
| 175 | """Return a tuple containing the names of all global channels saved in the system. |
| 176 | """ |
| 177 | err, buf = self.lib.GetSysGlobalChans(*RetStr(default_buf_size)) |
| 178 | names = tuple(n.strip() for n in buf.split(',') if n.strip()) |
| 179 | return names |
| 180 | |
| 181 | |
| 182 | class Device(_Base): |