Skip to content

Commit 3ed383b

Browse files
committed
Refactor export_state functions for consistency and update DAQInterface to use unique_id
1 parent 45831e9 commit 3ed383b

3 files changed

Lines changed: 30 additions & 8 deletions

File tree

src/h5_file_saving.jl

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,29 @@ MicroscopeControl.TCubeLaserControl.setpower(tcube_light, 70.0)
8787
test_save_to_hdf5(tcube_light, file_name)
8888

8989
MicroscopeControl.TCubeLaserControl.light_off(tcube_light)
90-
MicroscopeControl.TCubeLaserControl.shutdown(tcube_light)
90+
MicroscopeControl.TCubeLaserControl.shutdown(tcube_light)
91+
92+
93+
# Example
94+
# function export_state(instrument::SomeInstrument)
95+
# # Metadata about the instrument
96+
# attributes = Dict(
97+
# "model" => "XYZ-123",
98+
# "serial" => "ABC456",
99+
# "is_active" => true
100+
# )
101+
102+
# # Actual measurement data
103+
# data = [1.0, 2.0, 3.0] # or any other data type
104+
105+
# # Nested components (e.g., DAQ, stage, etc.)
106+
# children = Dict(
107+
# "daq" => Dict(
108+
# "Attributes" => Dict("port" => "COM1"),
109+
# "Data" => [4.0, 5.0],
110+
# "Children" => Dict()
111+
# )
112+
# )
113+
114+
# return attributes, data, children
115+
# end

src/hardware_implementations/nidaq/interface_methods.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ Export the state of the daq.
154154
- `data`: The data of the daq.
155155
- `children::Dict`: A dictionary of children.
156156
"""
157-
function DAQInterface.export_state(daq::NIdaq)
158-
attributes = Dict("device" => daq.device)
157+
function export_state(daq::NIdaq)
158+
attributes = Dict("unique_id" => daq.unique_id)
159159
data = nothing
160160
children = Dict()
161161
return attributes, data, children

src/hardware_implementations/tcube_laser/interface_methods.jl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
function LightSourceInterface.initialize(light::TCubeLaser)
32
err = TLI_BuildDeviceList()
43
numdev = TLI_GetDeviceListSize()
@@ -15,8 +14,6 @@ function LightSourceInterface.initialize(light::TCubeLaser)
1514
@info "Max current: $(light.max_current) mA"
1615
end
1716

18-
19-
2017
function LightSourceInterface.light_on(light::TCubeLaser)
2118
light.properties.is_on = true
2219
err = LD_EnableOutput(light.serialNo)
@@ -107,8 +104,8 @@ function export_state(light::TCubeLaser)
107104
)
108105
data = nothing
109106
children = Dict(
110-
"daq" => DAQInterface.export_state(light.daq)
107+
"daq" => export_state(light.daq) # export_state function from NIDAQcard module
111108
)
112109

113110
return attributes, data, children
114-
end
111+
end

0 commit comments

Comments
 (0)