HiSLIP¤
HiSLIP
(MessageBased)
¤
HiSLIP(equipment: Equipment)
Base class for the HiSLIP communication protocol.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
equipment
|
Equipment
|
An Equipment instance. |
required |
A Connection instance supports the following properties for the HiSLIP 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: |
Source code in src/msl/equipment/interfaces/hislip.py
1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 | |
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.
clear
¤
clear() -> None
Send the clear command to the device.
Source code in src/msl/equipment/interfaces/hislip.py
1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 | |
disconnect
¤
disconnect() -> None
Close the connection to the HiSLIP server.
Source code in src/msl/equipment/interfaces/hislip.py
1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 | |
lock
¤
Acquire the device's lock.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lock_string
|
str
|
An ASCII string that identifies this lock. If not specified, then an exclusive lock is requested, otherwise the string indicates an identification of a shared-lock request. |
''
|
Returns:
| Type | Description |
|---|---|
bool
|
Whether acquiring the lock was successful. |
Source code in src/msl/equipment/interfaces/hislip.py
1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 | |
lock_status
¤
Request the lock status from the HiSLIP server.
Returns:
| Type | Description |
|---|---|
tuple[bool, int]
|
Whether the HiSLIP server has an exclusive lock with a client and the number of HiSLIP clients that have a lock with the HiSLIP server. |
Source code in src/msl/equipment/interfaces/hislip.py
1507 1508 1509 1510 1511 1512 1513 1514 1515 | |
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/hislip.py
1459 1460 1461 1462 1463 1464 1465 1466 | |
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/hislip.py
1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 | |
remote_local_control
¤
remote_local_control(request: int) -> None
Send a GPIB-like remote/local control request.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
int
|
The request to perform.
|
required |
Source code in src/msl/equipment/interfaces/hislip.py
1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 | |
trigger
¤
trigger() -> None
Send the trigger message (emulates a GPIB Group Execute Trigger event).
Source code in src/msl/equipment/interfaces/hislip.py
1468 1469 1470 | |
unlock
¤
unlock() -> bool
Release the lock acquired by lock.
Returns:
| Type | Description |
|---|---|
bool
|
Whether releasing the lock was successful. |
Source code in src/msl/equipment/interfaces/hislip.py
1498 1499 1500 1501 1502 1503 1504 1505 | |
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 | |