dm_request Module

The observation request data derived type declaration.


Uses

  • module~~dm_request~~UsesGraph module~dm_request dm_request module~dm_error dm_error module~dm_request->module~dm_error module~dm_id dm_id module~dm_request->module~dm_id module~dm_kind dm_kind module~dm_request->module~dm_kind module~dm_response dm_response module~dm_request->module~dm_response module~dm_string dm_string module~dm_request->module~dm_string module~dm_time dm_time module~dm_request->module~dm_time module~dm_util dm_util module~dm_request->module~dm_util module~dm_error->module~dm_kind module~dm_ascii dm_ascii module~dm_error->module~dm_ascii iso_fortran_env iso_fortran_env module~dm_kind->iso_fortran_env module~dm_response->module~dm_error module~dm_response->module~dm_id module~dm_response->module~dm_kind module~dm_response->module~dm_util module~dm_string->module~dm_error module~dm_string->module~dm_kind module~dm_time->module~dm_error module~dm_time->module~dm_kind module~dm_time->module~dm_util module~dm_util->module~dm_error module~dm_util->module~dm_kind

Used by

  • module~~dm_request~~UsedByGraph module~dm_request dm_request module~dm_geocom dm_geocom module~dm_geocom->module~dm_request module~dm_geocom_api dm_geocom_api module~dm_geocom->module~dm_geocom_api module~dm_geocom_api->module~dm_request module~dm_lua_geocom dm_lua_geocom module~dm_lua_geocom->module~dm_request module~dm_lua_geocom->module~dm_geocom_api module~dm_observ dm_observ module~dm_observ->module~dm_request module~dmpack dmpack module~dmpack->module~dm_request module~dmpack->module~dm_geocom module~dmpack->module~dm_geocom_api module~dmpack->module~dm_lua_geocom module~dmpack->module~dm_observ module~dm_job dm_job module~dmpack->module~dm_job module~dm_log dm_log module~dmpack->module~dm_log module~dm_logger dm_logger module~dmpack->module~dm_logger module~dm_mqueue dm_mqueue module~dmpack->module~dm_mqueue module~dm_sync dm_sync module~dmpack->module~dm_sync module~dm_atom dm_atom module~dmpack->module~dm_atom module~dm_mqueue_util dm_mqueue_util module~dmpack->module~dm_mqueue_util module~dm_report dm_report module~dmpack->module~dm_report proc~dm_csv_header_observ dm_csv_header_observ proc~dm_csv_header_observ->module~dm_request proc~dm_csv_header_observ->module~dm_observ proc~dm_html_request dm_html_request proc~dm_html_request->module~dm_request proc~dm_regex_request dm_regex_request proc~dm_regex_request->module~dm_request proc~dm_regex_response_string dm_regex_response_string proc~dm_regex_response_string->module~dm_request proc~dm_test_dummy_observ dm_test_dummy_observ proc~dm_test_dummy_observ->module~dm_request proc~dm_test_dummy_observ->module~dm_observ proc~dm_test_dummy_request dm_test_dummy_request proc~dm_test_dummy_request->module~dm_request proc~dm_tty_read_request dm_tty_read_request proc~dm_tty_read_request->module~dm_request proc~dm_tty_write_request dm_tty_write_request proc~dm_tty_write_request->module~dm_request module~dm_job->module~dm_observ module~dm_log->module~dm_observ module~dm_logger->module~dm_observ module~dm_logger->module~dm_log module~dm_mqueue->module~dm_observ module~dm_mqueue->module~dm_log module~dm_sync->module~dm_observ proc~dm_config_open dm_config_open proc~dm_config_open->module~dm_lua_geocom proc~dm_db_insert_observ dm_db_insert_observ proc~dm_db_insert_observ->module~dm_observ proc~dm_db_insert_observs dm_db_insert_observs proc~dm_db_insert_observs->module~dm_observ proc~dm_db_select_observ dm_db_select_observ proc~dm_db_select_observ->module~dm_observ proc~dm_db_select_observ_ids dm_db_select_observ_ids proc~dm_db_select_observ_ids->module~dm_observ proc~dm_db_select_observ_views dm_db_select_observ_views proc~dm_db_select_observ_views->module~dm_observ proc~dm_db_select_observs_by_id dm_db_select_observs_by_id proc~dm_db_select_observs_by_id->module~dm_observ proc~dm_db_select_observs_by_time dm_db_select_observs_by_time proc~dm_db_select_observs_by_time->module~dm_observ proc~dm_html_observ dm_html_observ proc~dm_html_observ->module~dm_observ proc~dm_html_observs dm_html_observs proc~dm_html_observs->module~dm_observ proc~dm_z_compress_type dm_z_compress_type proc~dm_z_compress_type->module~dm_observ proc~dm_z_compress_type->module~dm_log proc~luaopen_libdmpack luaopen_libdmpack proc~luaopen_libdmpack->module~dm_lua_geocom module~dm_atom->module~dm_log module~dm_mqueue_util->module~dm_mqueue module~dm_report->module~dm_log proc~dm_arg_validate dm_arg_validate proc~dm_arg_validate->module~dm_log proc~dm_db_insert_log dm_db_insert_log proc~dm_db_insert_log->module~dm_log proc~dm_db_insert_sync dm_db_insert_sync proc~dm_db_insert_sync->module~dm_sync proc~dm_db_insert_sync_log dm_db_insert_sync_log proc~dm_db_insert_sync_log->module~dm_sync proc~dm_db_insert_sync_node dm_db_insert_sync_node proc~dm_db_insert_sync_node->module~dm_sync proc~dm_db_insert_sync_observ dm_db_insert_sync_observ proc~dm_db_insert_sync_observ->module~dm_sync proc~dm_db_insert_sync_sensor dm_db_insert_sync_sensor proc~dm_db_insert_sync_sensor->module~dm_sync proc~dm_db_insert_sync_target dm_db_insert_sync_target proc~dm_db_insert_sync_target->module~dm_sync proc~dm_db_select_log dm_db_select_log proc~dm_db_select_log->module~dm_log proc~dm_db_select_logs_by_observ dm_db_select_logs_by_observ proc~dm_db_select_logs_by_observ->module~dm_log proc~dm_db_select_sync_log dm_db_select_sync_log proc~dm_db_select_sync_log->module~dm_sync proc~dm_db_select_sync_logs dm_db_select_sync_logs proc~dm_db_select_sync_logs->module~dm_sync proc~dm_db_select_sync_node dm_db_select_sync_node proc~dm_db_select_sync_node->module~dm_sync proc~dm_db_select_sync_nodes dm_db_select_sync_nodes proc~dm_db_select_sync_nodes->module~dm_sync proc~dm_db_select_sync_observ dm_db_select_sync_observ proc~dm_db_select_sync_observ->module~dm_sync proc~dm_db_select_sync_observs dm_db_select_sync_observs proc~dm_db_select_sync_observs->module~dm_sync proc~dm_db_select_sync_sensor dm_db_select_sync_sensor proc~dm_db_select_sync_sensor->module~dm_sync proc~dm_db_select_sync_sensors dm_db_select_sync_sensors proc~dm_db_select_sync_sensors->module~dm_sync proc~dm_db_select_sync_target dm_db_select_sync_target proc~dm_db_select_sync_target->module~dm_sync proc~dm_db_select_sync_targets dm_db_select_sync_targets proc~dm_db_select_sync_targets->module~dm_sync proc~dm_html_log dm_html_log proc~dm_html_log->module~dm_log proc~dm_html_logs dm_html_logs proc~dm_html_logs->module~dm_log proc~dm_lua_api_register dm_lua_api_register proc~dm_lua_api_register->module~dm_log proc~dm_test_dummy_log dm_test_dummy_log proc~dm_test_dummy_log->module~dm_log

Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: REQUEST_NAME_LEN = 32

Request name length.

integer, public, parameter :: REQUEST_REQUEST_LEN = 256

Raw request string length.

integer, public, parameter :: REQUEST_RESPONSE_LEN = 256

Raw response string length.

integer, public, parameter :: REQUEST_DELIMITER_LEN = 8

Delimiter string length.

integer, public, parameter :: REQUEST_PATTERN_LEN = 256

Regular expression string length.

integer, public, parameter :: REQUEST_MAX_NRESPONSES = 16

Response array size.

integer, public, parameter :: REQUEST_MODE_NONE = 0

Default mode.

integer, public, parameter :: REQUEST_MODE_GEOCOM_FILE = 512

GeoCOM file download mode.

integer, public, parameter :: REQUEST_STATE_NONE = 0

Default state.

integer, public, parameter :: REQUEST_STATE_DISABLED = 1

Disabled state.

integer, public, parameter :: REQUEST_SIZE = storage_size(request_type())/8

Size of request_type in bytes.


Interfaces

public interface operator (==)

Returns whether requests are equal.

  • public pure elemental function dm_request_equals(request1, request2) result(equals)

    Returns .true. if given requests are equal.

    Arguments

    Type IntentOptional Attributes Name
    type(request_type), intent(in) :: request1

    The first request.

    type(request_type), intent(in) :: request2

    The second request.

    Return Value logical

public interface dm_request_get

Generic function to get value, unit, type, and error of a response.

  • private pure elemental subroutine request_get_byte(request, name, value, unit, type, error, status, default)

    Returns byte response as single character value, unit, type, and error of response of name name.

    The routine returns the following error codes in status:

    • E_EMPTY if the request has no responses.
    • E_NOT_FOUND if a response of the given name does not exist.
    • E_TYPE if the response value is not of type byte.

    On error, value will not be modified, unless default is passed.

    Arguments

    Type IntentOptional Attributes Name
    type(request_type), intent(inout) :: request

    Request type.

    character(len=*), intent(in) :: name

    Response name.

    character(len=1), intent(inout) :: value

    Response value.

    character(len=RESPONSE_UNIT_LEN), intent(out), optional :: unit

    Response unit.

    integer, intent(out), optional :: type

    Response value type.

    integer, intent(out), optional :: error

    Response error.

    integer, intent(out), optional :: status

    Error code.

    character(len=1), intent(in), optional :: default

    Default value.

  • private pure elemental subroutine request_get_int32(request, name, value, unit, type, error, status, default)

    Returns 4-byte integer response value, unit, type, and error of response of name name.

    The routine returns the following error codes in status:

    • E_EMPTY if the request has no responses.
    • E_NOT_FOUND if a response of the given name does not exist.
    • E_TYPE if the response value is not of type int32.

    On error, value will not be modified, unless default is passed.

    Arguments

    Type IntentOptional Attributes Name
    type(request_type), intent(inout) :: request

    Request type.

    character(len=*), intent(in) :: name

    Response name.

    integer(kind=i4), intent(inout) :: value

    Response value.

    character(len=RESPONSE_UNIT_LEN), intent(out), optional :: unit

    Response unit.

    integer, intent(out), optional :: type

    Response value type.

    integer, intent(out), optional :: error

    Response error.

    integer, intent(out), optional :: status

    Error code.

    integer(kind=i4), intent(in), optional :: default

    Default value.

  • private pure elemental subroutine request_get_int64(request, name, value, unit, type, error, status, default)

    Returns 8-byte integer response value, unit, type, and error of response of name name.

    The routine returns the following error codes in status:

    • E_EMPTY if the request has no responses.
    • E_NOT_FOUND if a response of the given name does not exist.
    • E_TYPE if the response value is not of type int64.

    On error, value will not be modified, unless default is passed.

    Arguments

    Type IntentOptional Attributes Name
    type(request_type), intent(inout) :: request

    Request type.

    character(len=*), intent(in) :: name

    Response name.

    integer(kind=i8), intent(inout) :: value

    Response value.

    character(len=RESPONSE_UNIT_LEN), intent(out), optional :: unit

    Response unit.

    integer, intent(out), optional :: type

    Response value type.

    integer, intent(out), optional :: error

    Response error.

    integer, intent(out), optional :: status

    Error code.

    integer(kind=i8), intent(in), optional :: default

    Default value.

  • private pure elemental subroutine request_get_logical(request, name, value, unit, type, error, status, default)

    Returns logical response value, unit, type, and error of response of name name.

    The routine returns the following error codes in status:

    • E_EMPTY if the request has no responses.
    • E_NOT_FOUND if a response of the given name does not exist.
    • E_TYPE if the response value is not of type logical.

    On error, value will not be modified, unless default is passed.

    Arguments

    Type IntentOptional Attributes Name
    type(request_type), intent(inout) :: request

    Request type.

    character(len=*), intent(in) :: name

    Response name.

    logical, intent(inout) :: value

    Response value.

    character(len=RESPONSE_UNIT_LEN), intent(out), optional :: unit

    Response unit.

    integer, intent(out), optional :: type

    Response value type.

    integer, intent(out), optional :: error

    Response error.

    integer, intent(out), optional :: status

    Error code.

    logical, intent(in), optional :: default

    Default value.

  • private pure elemental subroutine request_get_real32(request, name, value, unit, type, error, status, default)

    Returns 4-byte real response value, unit, type, and error of response of name name.

    The routine returns the following error codes in status:

    • E_EMPTY if the request has no responses.
    • E_NOT_FOUND if a response of the given name does not exist.
    • E_TYPE if the response value is not of type real32.

    On error, value will not be modified, unless default is passed.

    Arguments

    Type IntentOptional Attributes Name
    type(request_type), intent(inout) :: request

    Request type.

    character(len=*), intent(in) :: name

    Response name.

    real(kind=r4), intent(inout) :: value

    Response value.

    character(len=RESPONSE_UNIT_LEN), intent(out), optional :: unit

    Response unit.

    integer, intent(out), optional :: type

    Response value type.

    integer, intent(out), optional :: error

    Response error.

    integer, intent(out), optional :: status

    Error code.

    real(kind=r4), intent(in), optional :: default

    Default value.

  • private pure elemental subroutine request_get_real64(request, name, value, unit, type, error, status, default)

    Returns 8-byte real response value, unit, type, and error of response of name name.

    The routine returns the following error codes in status:

    • E_EMPTY if the request has no responses.
    • E_NOT_FOUND if a response of the given name does not exist.
    • E_TYPE if the response value is not of type real64.

    On error, value will not be modified, unless default is passed.

    Arguments

    Type IntentOptional Attributes Name
    type(request_type), intent(inout) :: request

    Request type.

    character(len=*), intent(in) :: name

    Response name.

    real(kind=r8), intent(inout) :: value

    Response value.

    character(len=RESPONSE_UNIT_LEN), intent(out), optional :: unit

    Response unit.

    integer, intent(out), optional :: type

    Response value type.

    integer, intent(out), optional :: error

    Response error.

    integer, intent(out), optional :: status

    Error code.

    real(kind=r8), intent(in), optional :: default

    Default value.

  • private pure elemental subroutine request_get_type(request, name, response, status, default)

    Returns response of name name.

    The routine returns the following error codes in status:

    • E_EMPTY if the request has no responses.
    • E_NOT_FOUND if a response of the given name does not exist.

    On error, an empty response will be returned, unless default is passed.

    Arguments

    Type IntentOptional Attributes Name
    type(request_type), intent(inout) :: request

    Request type.

    character(len=*), intent(in) :: name

    Response name.

    type(response_type), intent(out) :: response

    Response type.

    integer, intent(out), optional :: status

    Error code.

    type(response_type), intent(in), optional :: default

    Default response.

public interface dm_request_set

Generic function to set value, unit, type, and error of a response.

  • private pure elemental subroutine request_set_int32(request, index, name, value, unit, error)

    Updates response name, value, and optional unit and error, of response at position index to given 4-byte integer value. This routine does not update the number of responses request%nresponses. No update is performed if index is out of bounds. An existing response at index will be overwritten.

    Arguments

    Type IntentOptional Attributes Name
    type(request_type), intent(inout) :: request

    Request type.

    integer, intent(in) :: index

    Response index.

    character(len=*), intent(in) :: name

    Response name.

    integer(kind=i4), intent(in) :: value

    Response value.

    character(len=*), intent(in), optional :: unit

    Response unit.

    integer, intent(in), optional :: error

    Response error.

  • private pure elemental subroutine request_set_int64(request, index, name, value, unit, error)

    Updates response name, value, and optional unit and error, of response at position index to given 8-byte integer value. This routine does not update the number of responses request%nresponses. No update is performed if index is out of bounds. An existing response at index will be overwritten.

    Arguments

    Type IntentOptional Attributes Name
    type(request_type), intent(inout) :: request

    Request type.

    integer, intent(in) :: index

    Response index.

    character(len=*), intent(in) :: name

    Response name.

    integer(kind=i8), intent(in) :: value

    Response value.

    character(len=*), intent(in), optional :: unit

    Response unit.

    integer, intent(in), optional :: error

    Response error.

  • private pure elemental subroutine request_set_logical(request, index, name, value, unit, error)

    Updates response name, value, and optional unit and error, of response at position index to given logical value. This routine does not update the number of responses request%nresponses. No update is performed if index is out of bounds. An existing response at index will be overwritten.

    Arguments

    Type IntentOptional Attributes Name
    type(request_type), intent(inout) :: request

    Request type.

    integer, intent(in) :: index

    Response index.

    character(len=*), intent(in) :: name

    Response name.

    logical, intent(in) :: value

    Response value.

    character(len=*), intent(in), optional :: unit

    Response unit.

    integer, intent(in), optional :: error

    Response error.

  • private pure elemental subroutine request_set_real32(request, index, name, value, unit, error)

    Updates response name, value, and optional unit and error, of response at position index to given 4-byte real value. This routine does not update the number of responses request%nresponses. No update is performed if index is out of bounds. An existing response at index will be overwritten.

    Arguments

    Type IntentOptional Attributes Name
    type(request_type), intent(inout) :: request

    Request type.

    integer, intent(in) :: index

    Response index.

    character(len=*), intent(in) :: name

    Response name.

    real(kind=r4), intent(in) :: value

    Response value.

    character(len=*), intent(in), optional :: unit

    Response unit.

    integer, intent(in), optional :: error

    Response error.

  • private pure elemental subroutine request_set_real64(request, index, name, value, unit, error)

    Updates response name, value, and optional unit and error, of response at position index to given 8-byte real value. This routine does not update the number of responses request%nresponses. No update is performed if index is out of bounds. An existing response at index will be overwritten.

    Arguments

    Type IntentOptional Attributes Name
    type(request_type), intent(inout) :: request

    Request type.

    integer, intent(in) :: index

    Response index.

    character(len=*), intent(in) :: name

    Response name.

    real(kind=r8), intent(in) :: value

    Response value.

    character(len=*), intent(in), optional :: unit

    Response unit.

    integer, intent(in), optional :: error

    Response error.


Derived Types

type, public ::  request_type

Request to send to a sensor.

Components

Type Visibility Attributes Name Initial
character(len=REQUEST_NAME_LEN), public :: name = ' '

Request name (-0-9A-Z_a-z).

character(len=TIME_LEN), public :: timestamp = ' '

ISO 8601 time stamp.

character(len=REQUEST_REQUEST_LEN), public :: request = ' '

Raw request command (printable).

character(len=REQUEST_RESPONSE_LEN), public :: response = ' '

Raw response (printable).

character(len=REQUEST_DELIMITER_LEN), public :: delimiter = ' '

Response delimiter (printable).

character(len=REQUEST_PATTERN_LEN), public :: pattern = ' '

Regular expression pattern.

integer, public :: delay = 0

Delay in [msec] (optional).

integer, public :: error = E_NONE

Error code.

integer, public :: mode = REQUEST_MODE_NONE

Request mode (optional).

integer, public :: retries = 0

Number of executed retries.

integer, public :: state = REQUEST_STATE_NONE

Request state (optional).

integer, public :: timeout = 0

Timeout in [msec] (optional).

integer, public :: nresponses = 0

Number of responses.

type(response_type), public :: responses(REQUEST_MAX_NRESPONSES)

Responses array.


Functions

public function dm_request_add(request, response) result(rc)

Validates and appends response to the given request.

Read more…

Arguments

Type IntentOptional Attributes Name
type(request_type), intent(inout) :: request

Request type.

type(response_type), intent(inout) :: response

Response to add.

Return Value integer

public pure elemental function dm_request_equals(request1, request2) result(equals)

Returns .true. if given requests are equal.

Arguments

Type IntentOptional Attributes Name
type(request_type), intent(in) :: request1

The first request.

type(request_type), intent(in) :: request2

The second request.

Return Value logical

public pure elemental function dm_request_index(request, name) result(index)

Searches request for responses of passed name and returns the index of the first found. If no response of this name is found, the index is set to 0.

Arguments

Type IntentOptional Attributes Name
type(request_type), intent(in) :: request

Request type.

character(len=*), intent(in) :: name

Response name.

Return Value integer

public pure elemental function dm_request_is_valid(request, timestamp) result(valid)

Returns .true. if given observation request is valid. A request is valid if it conforms to the following requirements:

Read more…

Arguments

Type IntentOptional Attributes Name
type(request_type), intent(in) :: request

Request type.

logical, intent(in), optional :: timestamp

Validate or ignore timestamp.

Return Value logical

public function dm_request_set_response_error(request, error, name) result(rc)

Sets error code of all responses of the given request. If argument name is given, the error is set only for the first response of the same name. The function returns E_NOT_FOUND is argument name is given and not found within the responses.

Arguments

Type IntentOptional Attributes Name
type(request_type), intent(inout) :: request

Request type.

integer, intent(in) :: error

Error code.

character(len=*), intent(in), optional :: name

Response name.

Return Value integer


Subroutines

public subroutine dm_request_out(request, unit)

Prints request to standard output or given file unit.

Arguments

Type IntentOptional Attributes Name
type(request_type), intent(inout) :: request

Request type.

integer, intent(in), optional :: unit

File unit.