qmi.instruments.stanford_research_systems.sim900

Instrument driver for the stanford research system sim900 module.

Classes

Sim900(context, name, transport)

Instrument driver for the stanford research system sim900 module.

class qmi.instruments.stanford_research_systems.sim900.Sim900(context: QMI_Context, name: str, transport: str)

Instrument driver for the stanford research system sim900 module.

open() None

See base class.

close() None

See base class.

input_bytes_waiting(port: int) int

Input Bytes Waiting

Query bytes waiting on the input buffer of the specified port.

Parameters:

port – port to query number of input bytes waiting.

Returns:

The integer number of bytes waiting to be read by the host.

get_raw_bytes(port: int, num_bytes: int) bytes

Get Raw Bytes from Port

The RAWN command retrieves exactly i bytes from the specified port and return them.

Parameters:
  • port – port number to retrieve from.

  • num_bytes – amount of bytes to retrieve.

Returns:

The queried bytes.

send_terminated_message(port: int, message: str) None

Send Terminated Message to Port

The send terminated message transfers the message followed by the <term> sequence to the specified port.

Parameters:
  • port – port number to send terminated message to.

  • message – message to send.

ask_module(port: int, message: str, delay: float = 0.5) str

Ask module for data.

This is a helper function that simulates the SCPI _ask_ functionality. It is important that this function is executed atomically to avoid race conditions.

Parameters:
  • port – port number of module to ask for data

  • message – message to send

  • delay – how long the function should wait before the full response is available

Returns:

The ascii decoded message excluding the terminator.

force_unlock() None

Forcefully unlock the remote object.

This unlocks the object, regardless of who owns the lock. This allows you to unlock an object if the locking proxy has been destroyed without unlocking.

Use this with care.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

classmethod get_category() str | None

Return the optional name of the category this object belongs to.

A category name is a free-form string that has no special significance. Its purpose is to distinguish between groups of RPC objects that fulfill similar roles.

get_name() str

Return the name of this object.

Returns:

name attribute.

get_signals() list[SignalDescription]

Return a list of signals that can be published by this object.

Returns:

List consisting of qmi_signals attributes.

is_locked() bool

Query if the remote object is locked.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

is_open() bool

Return True if the instrument is open (ready for interaction).

lock(timeout: float = 0.0, lock_token: str | None = None) bool

Lock the remote object. If timeout is given, try every 0.1s within the given timeout value. The remote object can be locked with an optional custom lock token by giving a string into lock_token keyword argument.

If successful, this proxy is the only proxy that can invoke RPC methods on the remote object; other proxies will receive an “object is locked” response. The return value indicates if the lock was granted; a denied lock means the object was already locked by another proxy.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

release_rpc_object() None

Give a warning if the instrument is removed while still open.

unlock(lock_token: str | None = None) bool

Unlock the remote object.

Without optional parameters, this is only allowed by the proxy that initially locked the object. By giving the lock token as an input parameter, the specific object locked by this token can be unlocked. The return value indicates if the unlocking was successful.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.