Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add read_stb method for TCPIP HiSLIP client. #429

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
PyVISA-py Changelog
===================

0.7.3 (unreleased)
------------------

- add read_stb method for TCPIP HiSLIP client PR #429

0.7.2 (07/03/2024)
------------------

Expand Down
23 changes: 22 additions & 1 deletion pyvisa_py/tcpip.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import socket
import time
import warnings
from typing import Any, Dict, List, Optional, Tuple, Type
from typing import Any, Dict, List, Optional, Tuple, Type, cast

from pyvisa import attributes, constants, errors, rname
from pyvisa.constants import BufferOperation, ResourceAttribute, StatusCode
Expand Down Expand Up @@ -297,6 +297,27 @@ def clear(self) -> StatusCode:

return StatusCode.success

def read_stb(self) -> Tuple[int, StatusCode]:
"""Reads a status byte of the service request.

Corresponds to viReadSTB function of the VISA library.

Returns
-------
int
Service request status byte
StatusCode
Return value of the library call.

"""

interface = cast(hislip.Instrument, self.interface)
# According to IVI-6.1 Rev.2 status query corresponds to viReadSTB.
stb = interface.async_status_query()
errorcode = StatusCode.success

return stb, errorcode

def _get_attribute(self, attribute: ResourceAttribute) -> Tuple[Any, StatusCode]:
"""Get the value for a given VISA attribute for this session.

Expand Down
Loading