MCPcopy Create free account
hub / github.com/facebook/time / Get

Method Get

sa53/protocol/protocol.go:177–186  ·  view source on GitHub ↗

Get queries a single named parameter via "{get, }" and returns the parsed value. Device errors ("[!N]") are surfaced as errors wrapping ErrDeviceError. Callers should Drain() on non-device-error failures before retrying so a wedged port doesn't stay wedged.

(param string)

Source from the content-addressed store, hash-verified

175// ErrDeviceError. Callers should Drain() on non-device-error failures
176// before retrying so a wedged port doesn't stay wedged.
177func (m *Mac) Get(param string) (string, error) {
178 if _, err := m.port.Write([]byte("{get," + param + "}")); err != nil {
179 return "", fmt.Errorf("write: %w", err)
180 }
181 resp, err := m.ReadResponse()
182 if err != nil {
183 return "", err
184 }
185 return ParseValue(resp)
186}
187
188// ParseValue extracts the value from a "[=value]" response. "[!N]" replies
189// are surfaced as errors wrapping ErrDeviceError with the numeric code.

Callers 4

pollOnceFunction · 0.45

Calls 3

ReadResponseMethod · 0.95
ParseValueFunction · 0.85
WriteMethod · 0.45

Tested by 3