Commit b3d5fe0d authored by Vincent Michel's avatar Vincent Michel

Add get_module_type and get_module_interface

parent 35e42976
Pipeline #894 passed with stages
in 1 minute and 18 seconds
......@@ -254,6 +254,22 @@ def get_module_from_channel(channel):
return ffi.string(alias).decode()
def get_module_type(alias):
alias = to_bytes(alias)
value = ffi.new('char []', MAX_STRING_LENGTH)
code = handel.xiaGetModuleItem(alias, b'module_type', value)
check_error(code)
return ffi.string(value).decode()
def get_module_interface(alias):
alias = to_bytes(alias)
value = ffi.new('char []', MAX_STRING_LENGTH)
code = handel.xiaGetModuleItem(alias, b'interface', value)
check_error(code)
return ffi.string(value).decode()
# Not exposed
# int xiaNewModule(char *alias);
......
......@@ -397,6 +397,36 @@ def test_get_module_from_channel(interface):
interface.check_error.assert_called_with(0)
def test_get_module_type(interface):
m = interface.handel.xiaGetModuleItem
def side_effect(a, b, c):
c[0:7] = b'mercury'
return 0
m.side_effect = side_effect
assert interface.get_module_type('module1') == 'mercury'
arg = m.call_args[0][2]
m.assert_called_once_with(b'module1', b'module_type', arg)
# Make sure errors have been checked
interface.check_error.assert_called_with(0)
def test_get_module_interface(interface):
m = interface.handel.xiaGetModuleItem
def side_effect(a, b, c):
c[0:4] = b'usb2'
return 0
m.side_effect = side_effect
assert interface.get_module_interface('module1') == 'usb2'
arg = m.call_args[0][2]
m.assert_called_once_with(b'module1', b'interface', arg)
# Make sure errors have been checked
interface.check_error.assert_called_with(0)
# Parameters
def test_set_acquisition_value(interface):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment