diff --git a/doc/openapi/components/schemas/config/hooks/_rms.yaml b/doc/openapi/components/schemas/config/hooks/_rms.yaml index 4a092d16f..40e60d993 100644 --- a/doc/openapi/components/schemas/config/hooks/_rms.yaml +++ b/doc/openapi/components/schemas/config/hooks/_rms.yaml @@ -1,3 +1,12 @@ allOf: - $ref: common.yaml - $ref: rms.yaml +- type: object + required: + - window_size + properties: + window_size: + type: integer + min: 1 + example: 1000 + description: The number of samples in the window. diff --git a/doc/openapi/components/schemas/config/nodes/uldaq.yaml b/doc/openapi/components/schemas/config/nodes/uldaq.yaml index 921e240e8..3a0fc5792 100644 --- a/doc/openapi/components/schemas/config/nodes/uldaq.yaml +++ b/doc/openapi/components/schemas/config/nodes/uldaq.yaml @@ -8,3 +8,94 @@ allOf: $ref: ../format_spec.yaml - $ref: ../node.yaml +- type: object + required: + - sample_rate + properties: + interface_type: + type: string + enum: + - usb + - bluetooth + - ethernet + - any + description: The interface to which the ADC is connected. Check manual for your device. + device_id: + type: string + example: 10000 + description: The used device type. If empty it is auto detected. + in: + type: object + description: Configuration for the ul201 + signals: + type: object + range: + type: string + description: The range for a specific channel. See `range` for allowed values + input_mode: + type: string + description: The input mode for a specific channel. See `input_mode` for allowed values + channel: + type: integer + example: 5 + description: The channel input number of the device. + description: A list of used channels + sample_rate: + type: integer + min: 0 + example: 10000 + description: The sampling rate of the input signal. + range: + type: string + enum: + - bipolar-60 + - bipolar-60 + - bipolar-30 + - bipolar-15 + - bipolar-20 + - bipolar-10 + - bipolar-5 + - bipolar-4 + - bipolar-2.5 + - bipolar-2 + - bipolar-1.25 + - bipolar-1 + - bipolar-0.625 + - bipolar-0.5 + - bipolar-0.25 + - bipolar-0.125 + - bipolar-0.2 + - bipolar-0.1 + - bipolar-0.078 + - bipolar-0.05 + - bipolar-0.01 + - bipolar-0.005 + - unipolar-60 + - unipolar-30 + - unipolar-15 + - unipolar-20 + - unipolar-10 + - unipolar-5 + - unipolar-4 + - unipolar-2.5 + - unipolar-2 + - unipolar-1.25 + - unipolar-1 + - unipolar-0.625 + - unipolar-0.5 + - unipolar-0.25 + - unipolar-0.125 + - unipolar-0.2 + - unipolar-0.1 + - unipolar-0.078 + - unipolar-0.05 + - unipolar-0.01 + - unipolar-0.005 + description: The input range. Check manual for your device. + input_mode: + type: string + enum: + - differential + - single-ended + - pseudo-differential + description: The sampling type. Check manual for you device diff --git a/lib/hooks/rms.cpp b/lib/hooks/rms.cpp index 4909419eb..09699f761 100644 --- a/lib/hooks/rms.cpp +++ b/lib/hooks/rms.cpp @@ -71,18 +71,24 @@ public: void parse(json_t *json) { int ret; + int windowSizeIn; json_error_t err; assert(state != State::STARTED); MultiSignalHook::parse(json); - ret = json_unpack_ex(json, &err, 0, "{ s?: i }", - "window_size", &windowSize + ret = json_unpack_ex(json, &err, 0, "{ s: i }", + "window_size", &windowSizeIn ); if (ret) throw ConfigError(json, err, "node-config-hook-rms"); + if (windowSizeIn < 1) + throw ConfigError(json, "node-config-hook-rms", "Window size must be greater 0 but is set to {}", windowSizeIn); + + windowSize = (unsigned)windowSizeIn; + state = State::PARSED; }