Response
This class represents the response of a single SENTIO remote command.
Sentio's remote command response is a comma separated string that contains three fields which represent 4 data items. (error code and status code are combined)
__init__(errc, stat, cmd_id, msg)
Creates a new Response object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
errc |
int
|
The error code. |
required |
stat |
int
|
The status code. |
required |
cmd_id |
int
|
The async command id. (only used by async commands) |
required |
msg |
str
|
The response message. |
required |
check()
Raises an exception if this response indicates an error.
Raises:
| Type | Description |
|---|---|
ProberException
|
If the response indicates an error. |
check_resp(str_resp)
staticmethod
A static method that parses a response string and raises an exception if the response indicates an error.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
str_resp |
str
|
The response string to parse. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
response |
Response
|
A Response object created from the information in SENTIO's response string. If the response represents an error an exception is raised instead of returning a Response object. |
Raises:
| Type | Description |
|---|---|
ProberException
|
If the response indicates an error. |
cmd_id()
The async commans id returned by SENTIO.
If the remote command is not an async command 0 is returned.
Returns:
| Name | Type | Description |
|---|---|---|
cmd_id |
int
|
The async command id returned by SENTIO. |
dump()
Prints the content of the response object to the console.
Deprecated since Sentio 25.2
This function is obsolete and will be removed in a future release. Use print() instead.
errc()
The error code returned by SENTIO.
The meaning of the error code is documented in the SENTIO's remote command documentation. It is also used by the enumerator RemoteCommandError.
Returns:
| Name | Type | Description |
|---|---|---|
errc |
int
|
The error code returned by SENTIO. |
message()
The response message returned by SENTIO.
Returns:
| Name | Type | Description |
|---|---|---|
msg |
str
|
The response message returned by SENTIO. |
ok()
Returns True if the response indicates no error.
Returns:
| Name | Type | Description |
|---|---|---|
ok |
bool
|
True if the response indicates no error, False otherwise. |
parse_resp(resp)
staticmethod
A static method that parses a SENTIO remote command response string and returns a Response object.
A typical response from SENTIO to a remote command might look like "0,0,ok" SENTIO's remote command responses are strings that contain multiple items separated by two commas.
- error code and status information (combined in one integer)
- an async command id (only used by async commands)
- a response message
Returns:
| Name | Type | Description |
|---|---|---|
response |
Resppnse
|
A Response object created from the information in SENTIO's response string. |
print()
Prints the content of the response object to the console.
status()
The status coode extracted from the response.
Returns:
| Name | Type | Description |
|---|---|---|
stat |
int
|
The status code returned by SENTIO. |
handler: python options: members: SentioProber