Skip to content

Commit

Permalink
Add read_stb method for TCPIP HiSLIP client. (#429)
Browse files Browse the repository at this point in the history
* Add read_stb method for TCPIP HiSLIP client.

* Fix type error.

* Add entry to changelog.

* Update CHANGES

---------

Co-authored-by: Caglar Kutlu <[email protected]>
Co-authored-by: Matthieu Dartiailh <[email protected]>
  • Loading branch information
3 people authored Jun 4, 2024
1 parent 839c718 commit 0cded75
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
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

0 comments on commit 0cded75

Please sign in to comment.