@@ -91,10 +91,45 @@ impl Default for AcquisitionConfig {
9191 }
9292}
9393
94+ /// Configuration for the Modbus TCP server component.
95+ ///
96+ /// This structure contains settings that control the Modbus TCP server functionality,
97+ /// including network binding parameters and whether the server is enabled.
98+ ///
99+ /// # Fields
100+ ///
101+ /// * `enabled` - Flag to enable or disable the Modbus server
102+ /// * `port` - TCP port number for the Modbus server (default: 502)
103+ /// * `address` - Network address for the Modbus server to bind to (default: 127.0.0.1)
104+ ///
105+ /// # Example
106+ ///
107+ /// ```
108+ /// use rust_photoacoustic::config::ModbusConfig;
109+ ///
110+ /// let modbus_config = ModbusConfig {
111+ /// enabled: true,
112+ /// port: 503,
113+ /// address: "0.0.0.0".to_string(),
114+ /// };
115+ /// ```
94116#[ derive( Debug , Clone , Serialize , Deserialize ) ]
95117pub struct ModbusConfig {
118+ /// Enable or disable the Modbus TCP server.
119+ ///
120+ /// When set to `false`, the Modbus server will not be started.
121+ /// Default is `false`.
96122 pub enabled : bool ,
123+
124+ /// The TCP port the Modbus server will listen on.
125+ ///
126+ /// Valid range is 1-65534. Default value is 502, which is the standard Modbus TCP port.
97127 pub port : u16 ,
128+
129+ /// The network address the Modbus server will bind to.
130+ ///
131+ /// Can be an IPv4/IPv6 address or a hostname. Default is "127.0.0.1".
132+ /// Use "0.0.0.0" to bind to all IPv4 interfaces.
98133 pub address : String ,
99134}
100135// implement Default for ModbusConfig
@@ -108,6 +143,40 @@ impl Default for ModbusConfig {
108143 }
109144}
110145
146+ /// Configuration for the photoacoustic measurement system.
147+ ///
148+ /// This structure contains settings that control the photoacoustic measurement process,
149+ /// including input sources, signal processing parameters, and analysis settings.
150+ ///
151+ /// # Input Sources
152+ ///
153+ /// The configuration supports two mutually exclusive input sources:
154+ /// * `input_device` - A hardware audio device (e.g., "hw:0,0" for ALSA)
155+ /// * `input_file` - A path to a WAV file for offline analysis
156+ ///
157+ /// One of these must be specified, but not both simultaneously.
158+ ///
159+ /// # Signal Processing Parameters
160+ ///
161+ /// * `frequency` - The primary excitation frequency in Hz
162+ /// * `bandwidth` - Filter bandwidth in Hz around the excitation frequency
163+ /// * `window_size` - FFT window size (power of 2 recommended)
164+ /// * `averages` - Number of spectra to average for noise reduction
165+ ///
166+ /// # Example
167+ ///
168+ /// ```
169+ /// use rust_photoacoustic::config::PhotoacousticConfig;
170+ ///
171+ /// let pa_config = PhotoacousticConfig {
172+ /// input_device: Some("hw:0,0".to_string()),
173+ /// input_file: None,
174+ /// frequency: 1000.0,
175+ /// bandwidth: 50.0,
176+ /// window_size: 4096,
177+ /// averages: 10,
178+ /// };
179+ /// ```
111180#[ derive( Debug , Clone , Serialize , Deserialize ) ]
112181pub struct PhotoacousticConfig {
113182 /// The input device to use for data acquisition
@@ -303,7 +372,7 @@ fn default_name() -> String {
303372// Use if exists the ../resources/cert.pem file converted to base64 at build time
304373fn default_cert ( ) -> Option < String > {
305374 let cert_str = include_str ! ( "../resources/cert.pem" ) ;
306- if cert_str. is_empty ( ) {
375+ if ( cert_str. is_empty ( ) ) {
307376 None
308377 } else {
309378 let cert_b64 = base64:: engine:: general_purpose:: STANDARD . encode ( cert_str. as_bytes ( ) ) ;
@@ -313,7 +382,7 @@ fn default_cert() -> Option<String> {
313382// Use if exists the ../resources/cert.key file converted to base64 at build time
314383fn default_key ( ) -> Option < String > {
315384 let key_str = include_str ! ( "../resources/cert.key" ) ;
316- if key_str. is_empty ( ) {
385+ if ( key_str. is_empty ( ) ) {
317386 None
318387 } else {
319388 let key_b64 = base64:: engine:: general_purpose:: STANDARD . encode ( key_str. as_bytes ( ) ) ;
@@ -339,7 +408,7 @@ fn default_hmac_secret() -> String {
339408/// The key should be in PEM format and Base64 encoded.
340409fn default_rs256_private_key ( ) -> String {
341410 let key_str = include_str ! ( "../resources/private.key" ) ;
342- if key_str. is_empty ( ) {
411+ if ( key_str. is_empty ( ) ) {
343412 String :: new ( )
344413 } else {
345414 base64:: engine:: general_purpose:: STANDARD . encode ( key_str. as_bytes ( ) )
@@ -355,7 +424,7 @@ fn default_rs256_private_key() -> String {
355424/// The key should be in PEM format and Base64 encoded.
356425fn default_rs256_public_key ( ) -> String {
357426 let key_str = include_str ! ( "../resources/pub.key" ) ;
358- if key_str. is_empty ( ) {
427+ if ( key_str. is_empty ( ) ) {
359428 String :: new ( )
360429 } else {
361430 base64:: engine:: general_purpose:: STANDARD . encode ( key_str. as_bytes ( ) )
0 commit comments