opensampl.collect.microchip.twst.context
Context reader for Microchip TWST ATS6502 modems.
This module provides functionality to read context information from ATS6502 modems, including local and remote station information.
ModemContextReader
Bases: ModemReader
Reader for ATS6502 modem context information.
Provides methods to connect to an ATS6502 modem and retrieve context information including local station details and remote station tracking data.
Source code in opensampl/collect/microchip/twst/context.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
|
__init__(host, prompt='ATS 6502>', port=1700)
Initialize ModemContextReader.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
host
|
str
|
IP address or hostname of the ATS6502 modem. |
required |
prompt
|
str
|
Command prompt string expected from the modem. |
'ATS 6502>'
|
port
|
int
|
what port to connect to for commands (default 1700). |
1700
|
Source code in opensampl/collect/microchip/twst/context.py
28 29 30 31 32 33 34 35 36 37 38 39 40 |
|
bracket_to_dict(raw_text)
Convert bracketed text format to dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
raw_text
|
str
|
Raw text with [SECTION] headers. |
required |
Returns:
Type | Description |
---|---|
Dictionary representation of the structured data. |
Source code in opensampl/collect/microchip/twst/context.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
|
finished_error(line)
staticmethod
Check if a command completed with an error.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
line
|
str
|
Response line from the modem. |
required |
Returns:
Type | Description |
---|---|
tuple[bool, Optional[str]]
|
Tuple of (is_error, error_message). |
Source code in opensampl/collect/microchip/twst/context.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
finished_ok(line)
staticmethod
Check if a command completed successfully.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
line
|
str
|
Response line from the modem. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the line indicates successful completion. |
Source code in opensampl/collect/microchip/twst/context.py
42 43 44 45 46 47 48 49 50 51 52 53 54 |
|
get_context()
async
Retrieve context information from the modem.
Connects to the modem and retrieves local station information and remote station tracking data.
Source code in opensampl/collect/microchip/twst/context.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
|
get_result_as_yaml_comment()
Get results formatted as YAML comments.
Returns:
Type | Description |
---|---|
String containing results formatted as commented YAML. |
Source code in opensampl/collect/microchip/twst/context.py
176 177 178 179 180 181 182 183 184 185 |
|
read_until_exit()
async
Read response lines until completion or error.
Returns:
Type | Description |
---|---|
Accumulated response text. |
Raises:
Type | Description |
---|---|
RuntimeError
|
If an error response is received. |
Source code in opensampl/collect/microchip/twst/context.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
|
result_dict()
Convert result SimpleNamespace to dictionary.
Returns:
Type | Description |
---|---|
Dictionary representation of the results. |
Source code in opensampl/collect/microchip/twst/context.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
|
send_cmd(cmd)
async
Send a command to the modem and return parsed response.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cmd
|
str
|
Command string to send. |
required |
Returns:
Type | Description |
---|---|
Dictionary containing the parsed response. |
Source code in opensampl/collect/microchip/twst/context.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
|