VXI11¤
VXI11
(MessageBased)
¤
VXI11(equipment: Equipment)
Base class for the VXI-11 communication protocol.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
equipment
|
Equipment
|
An Equipment instance. |
required |
A Connection instance supports the following properties for the VXI-11 communication protocol, as well as the properties defined in MessageBased.
Connection Properties:
| Name | Type | Description |
|---|---|---|
buffer_size |
int
|
The maximum number of bytes to read at a time. Default: |
lock_timeout |
float
|
The timeout (in seconds) to wait for a lock (0 means wait forever). Default: |
port |
int
|
The port to use instead of calling the RPC Port Mapper function. |
Source code in src/msl/equipment/interfaces/vxi11.py
796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 | |
lock_timeout
property
writable
¤
lock_timeout: float
The time, in seconds, to wait to acquire a lock.
Setting the value to ≤0 (or None) means wait forever.
abort
¤
abort() -> None
Stop an in-progress request.
Source code in src/msl/equipment/interfaces/vxi11.py
985 986 987 988 989 990 | |
clear
¤
clear() -> None
Send the clear command to the device.
Source code in src/msl/equipment/interfaces/vxi11.py
992 993 994 995 996 997 998 999 1000 1001 1002 | |
create_intr_chan
¤
create_intr_chan(
host_addr: int,
host_port: int,
prog_num: int,
prog_vers: int,
prog_family: int,
) -> None
Inform the network instrument server to establish an interrupt channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
host_addr
|
int
|
Address of the host servicing the interrupt. |
required |
host_port
|
int
|
Valid port number on the client. |
required |
prog_num
|
int
|
Program number. |
required |
prog_vers
|
int
|
Program version number. |
required |
prog_family
|
int
|
The underlying socket protocol family type ( |
required |
Source code in src/msl/equipment/interfaces/vxi11.py
1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 | |
destroy_intr_chan
¤
destroy_intr_chan() -> None
Inform the network instrument server to close its interrupt channel.
Source code in src/msl/equipment/interfaces/vxi11.py
1021 1022 1023 1024 1025 1026 | |
destroy_link
¤
destroy_link() -> None
Destroy the link with the device.
Source code in src/msl/equipment/interfaces/vxi11.py
1028 1029 1030 1031 1032 1033 | |
disconnect
¤
disconnect() -> None
Unlink and close the sockets.
Source code in src/msl/equipment/interfaces/vxi11.py
1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 | |
docmd
¤
Allows for a variety of commands to be executed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cmd
|
int
|
An IEEE 488 command messages. For example, to send the Group Execute Trigger
command, GET, the value of |
required |
value
|
float
|
required | |
fmt
|
str
|
How to format |
required |
Returns:
| Type | Description |
|---|---|
bytes
|
The results defined by |
Source code in src/msl/equipment/interfaces/vxi11.py
1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 | |
enable_sqr
¤
Enable or disable the sending of device_intr_srq RPCs by the network instrument server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
bool
|
Whether to enable or disable interrupts. |
required |
handle
|
bytes
|
Host specific data (maximum length is 40 characters). |
required |
Source code in src/msl/equipment/interfaces/vxi11.py
1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 | |
local
¤
local() -> None
Place the device in a local state wherein all programmable local controls are enabled.
Source code in src/msl/equipment/interfaces/vxi11.py
1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 | |
lock
¤
lock() -> None
Acquire the device's lock.
Source code in src/msl/equipment/interfaces/vxi11.py
1108 1109 1110 1111 1112 1113 | |
query
¤
query(
message: bytes | str,
*,
delay: float = 0.0,
decode: Literal[True] = True,
dtype: None = None,
fmt: MessageFormat = ...,
size: int | None = ...
) -> str
query(
message: bytes | str,
*,
delay: float = 0.0,
decode: Literal[False] = False,
dtype: None = None,
fmt: MessageFormat = ...,
size: int | None = ...
) -> bytes
query(
message: bytes | str,
*,
delay: float = 0.0,
decode: bool = ...,
dtype: MessageDataType = ...,
fmt: MessageFormat = ...,
size: int | None = ...
) -> NumpyArray1D
query(
message: bytes | str,
*,
delay: float = 0.0,
decode: bool = True,
dtype: MessageDataType | None = None,
fmt: MessageFormat = None,
size: int | None = None
) -> bytes | str | NumpyArray1D
Convenience method for performing a write followed by a read.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
bytes | str
|
The message to write to the equipment. |
required |
delay
|
float
|
Time delay, in seconds, to wait between the write and read operations. |
0.0
|
decode
|
bool
|
True
|
|
dtype
|
MessageDataType | None
|
The data type of the elements in the returned message. Can be any object that numpy
dtype supports. For messages that are of scalar type (i.e., a single number)
it is more efficient to not specify |
None
|
fmt
|
MessageFormat
|
The format that the returned message data is in. Ignored if |
None
|
size
|
int | None
|
The number of bytes to read. Ignored if the value is |
None
|
Returns:
| Type | Description |
|---|---|
bytes | str | NumpyArray1D
|
Source code in src/msl/equipment/interfaces/message_based.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |
read
¤
read(
*,
decode: Literal[True] = True,
dtype: None = None,
fmt: MessageFormat = ...,
size: int | None = ...
) -> str
read(
*,
decode: Literal[False] = False,
dtype: None = None,
fmt: MessageFormat = ...,
size: int | None = ...
) -> bytes
read(
*,
decode: bool = ...,
dtype: MessageDataType = ...,
fmt: MessageFormat = ...,
size: int | None = ...
) -> NumpyArray1D
read(
*,
decode: bool = True,
dtype: MessageDataType | None = None,
fmt: MessageFormat = None,
size: int | None = None
) -> bytes | str | NumpyArray1D
Read a message from the equipment.
This method will block until one of the following conditions is fulfilled:
sizebytes have been received — only ifsizeis notNone.- the read_termination
byte(s) is(are) received — only if
read_termination
is not
None. - a timeout occurs — only if timeout
is not
None. If a timeout occurs, an MSLTimeoutError is raised. - max_read_size bytes have been received. If the maximum number of bytes have been read, an MSLConnectionError is raised.
Tip
You may also want to set the rstrip value for the class instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
decode
|
bool
|
True
|
|
dtype
|
MessageDataType | None
|
The data type of the elements in the returned message. Can be any object that numpy
dtype supports. For messages that are of scalar type (i.e., a single number)
it is more efficient to not specify |
None
|
fmt
|
MessageFormat
|
The format that the returned message data is in. Ignored if |
None
|
size
|
int | None
|
The number of bytes to read. Ignored if the value is |
None
|
Returns:
| Type | Description |
|---|---|
bytes | str | NumpyArray1D
|
Source code in src/msl/equipment/interfaces/message_based.py
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | |
read_stb
¤
read_stb() -> int
Read the status byte from the device.
Returns:
| Type | Description |
|---|---|
int
|
The status byte. |
Source code in src/msl/equipment/interfaces/vxi11.py
1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 | |
reconnect
¤
reconnect(max_attempts: int = 1) -> None
Reconnect to the equipment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_attempts
|
int
|
The maximum number of attempts to try to reconnect with the equipment. If <1, keep trying until a connection is successful. If the maximum number of attempts has been reached then an exception is raise. |
1
|
Source code in src/msl/equipment/interfaces/vxi11.py
1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 | |
remote
¤
remote() -> None
Place the device in a remote state wherein all programmable local controls are disabled.
Source code in src/msl/equipment/interfaces/vxi11.py
1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 | |
trigger
¤
trigger() -> None
Send a trigger to the device.
Source code in src/msl/equipment/interfaces/vxi11.py
1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 | |
unlock
¤
unlock() -> None
Release the lock acquired by lock.
Source code in src/msl/equipment/interfaces/vxi11.py
1198 1199 1200 1201 1202 1203 | |
write
¤
write(
message: bytes | str,
*,
data: Sequence1D | None = None,
dtype: MessageDataType = "<f",
fmt: MessageFormat = "ieee"
) -> int
Write a message to the equipment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
bytes | str
|
The message to write to the equipment. |
required |
data
|
Sequence1D | None
|
The data to append to |
None
|
dtype
|
MessageDataType
|
The data type to use to convert each element in |
'<f'
|
fmt
|
MessageFormat
|
The format to use to convert |
'ieee'
|
Returns:
| Type | Description |
|---|---|
int
|
The number of bytes written. |
Source code in src/msl/equipment/interfaces/message_based.py
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | |