Skip to content

Commit

Permalink
Exposed us4OEM main firmware and tx firmware version.
Browse files Browse the repository at this point in the history
  • Loading branch information
pjarosik committed Apr 9, 2022
1 parent 440c08a commit faf049f
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 4 deletions.
20 changes: 20 additions & 0 deletions api/python/arrus/devices/us4oem.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from arrus.devices.device import Device, DeviceId, DeviceType

DEVICE_TYPE = DeviceType("Us4OEM")


class Us4OEM(Device):

def __init__(self, handle):
self._handle = handle
self._device_id = DeviceId(DEVICE_TYPE,
self._handle.getDeviceId().getOrdinal())

def get_device_id(self) -> DeviceId:
return self._device_id

def get_firmware_version(self) -> int:
return self._handle.getFirmwareVersion()

def get_tx_firmware_version(self) -> int:
return self._handle.getTxFirmwareVersion()
19 changes: 19 additions & 0 deletions api/python/arrus/devices/us4r.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from arrus.devices.device import Device, DeviceId, DeviceType
import arrus.exceptions
import arrus.devices.probe
from arrus.devices.us4oem import Us4OEM
import arrus.metadata
import arrus.kernels
import arrus.kernels.kernel
Expand Down Expand Up @@ -105,6 +106,24 @@ def sampling_frequency(self):
def n_us4oems(self):
return self._handle.getNumberOfUs4OEMs()

def get_us4oem(self, ordinal: int):
return Us4OEM(self._handle.getUs4OEM(ordinal))

@property
def firmware_version(self):
result = {}
# Us4OEMs
us4oem_ver = []
for i in range(self.n_us4oems):
dev = self.get_us4oem(i)
ver = {
"main": dev.get_firmware_version(),
"tx": dev.get_tx_firmware_version()
}
us4oem_ver.append(ver)
result["Us4OEM"] = us4oem_ver
return result

def set_kernel_context(self, kernel_context):
self._current_sequence_context = kernel_context

Expand Down
6 changes: 3 additions & 3 deletions api/python/wrappers/core.i
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ namespace std {
#include "arrus/core/api/io/settings.h"
#include "arrus/core/api/session/Session.h"
#include "arrus/core/api/common/logging.h"
#include "arrus/core/api/devices/us4r/Us4OEM.h"
#include "arrus/core/api/devices/us4r/Us4R.h"
#include "arrus/core/api/ops/us4r/TxRxSequence.h"

Expand Down Expand Up @@ -225,6 +226,7 @@ std::shared_ptr<arrus::framework::DataBuffer> getFifoLockFreeBuffer(arrus::sessi
#include "arrus/core/api/devices/DeviceId.h"
#include "arrus/core/api/devices/Device.h"
#include "arrus/core/api/devices/DeviceWithComponents.h"
#include "arrus/core/api/devices/us4r/Us4OEM.h"
#include "arrus/core/api/devices/us4r/Us4R.h"
#include "arrus/core/api/devices/probe/ProbeModelId.h"
#include "arrus/core/api/devices/probe/Probe.h"
Expand All @@ -244,8 +246,6 @@ using namespace arrus::devices;
%include "arrus/core/api/devices/probe/Probe.h"




%inline %{
arrus::devices::Us4R *castToUs4r(arrus::devices::Device *device) {
auto ptr = dynamic_cast<Us4R*>(device);
Expand All @@ -254,7 +254,7 @@ arrus::devices::Us4R *castToUs4r(arrus::devices::Device *device) {
}
return ptr;
}
// TODO(pjarosik) remote the bellow functions when possible
// TODO(pjarosik) remove the bellow functions when possible

unsigned short getNumberOfElements(const arrus::devices::ProbeModel &probe) {
const auto &nElements = probe.getNumberOfElements();
Expand Down
2 changes: 1 addition & 1 deletion arrus/core/api/devices/us4r/Us4R.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Us4R : public DeviceWithComponents {
* @param ordinal ordinal number of the us4oem to get
* @return a handle to the us4oem module
*/
virtual Us4OEM::RawHandle getUs4OEM(Ordinal ordinal) = 0;
virtual Us4OEM* getUs4OEM(Ordinal ordinal) = 0;

/**
* Returns a handle to an adapter identified by given ordinal number.
Expand Down

0 comments on commit faf049f

Please sign in to comment.