The observation request data derived type declaration.
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 |
Returns whether requests are equal.
Returns .true.
if given requests are equal.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(request_type), | intent(in) | :: | request1 |
The first request. |
||
type(request_type), | intent(in) | :: | request2 |
The second request. |
Generic function to get value, unit, type, and error of a response.
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.
Type | Intent | Optional | 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. |
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.
Type | Intent | Optional | 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. |
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.
Type | Intent | Optional | 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. |
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.
Type | Intent | Optional | 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. |
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.
Type | Intent | Optional | 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. |
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.
Type | Intent | Optional | 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. |
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.
Type | Intent | Optional | 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. |
Generic function to set value, unit, type, and error of a response.
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.
Type | Intent | Optional | 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. |
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.
Type | Intent | Optional | 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. |
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.
Type | Intent | Optional | 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. |
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.
Type | Intent | Optional | 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. |
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.
Type | Intent | Optional | 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. |
Request to send to a sensor.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=REQUEST_NAME_LEN), | public | :: | name | = | ' ' |
Request name ( |
|
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. |
Validates and appends response to the given request.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(request_type), | intent(inout) | :: | request |
Request type. |
||
type(response_type), | intent(inout) | :: | response |
Response to add. |
Returns .true.
if given requests are equal.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(request_type), | intent(in) | :: | request1 |
The first request. |
||
type(request_type), | intent(in) | :: | request2 |
The second request. |
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.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(request_type), | intent(in) | :: | request |
Request type. |
||
character(len=*), | intent(in) | :: | name |
Response name. |
Returns .true.
if given observation request is valid. A request is
valid if it conforms to the following requirements:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(request_type), | intent(in) | :: | request |
Request type. |
||
logical, | intent(in), | optional | :: | timestamp |
Validate or ignore timestamp. |
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.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(request_type), | intent(inout) | :: | request |
Request type. |
||
integer, | intent(in) | :: | error |
Error code. |
||
character(len=*), | intent(in), | optional | :: | name |
Response name. |
Prints request to standard output or given file unit.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(request_type), | intent(inout) | :: | request |
Request type. |
||
integer, | intent(in), | optional | :: | unit |
File unit. |