at_commands/response.rs
1// Copyright 2021 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5//! Response types. These wrap the generated Success types with handling for errors and other types of responses.
6
7use crate::highlevel;
8
9/// Responses and indications.
10#[derive(Debug, Clone, PartialEq)]
11pub enum Response {
12 /// The success indication. Its format is described in HFP v1.8 Section 4.34.1, and it is
13 /// used throughout the spec.
14 Ok,
15 /// The error indication. Its format is described in HFP v1.8 Section 4.34.1, and it is
16 /// used throughout the spec.
17 Error,
18 /// A set of hardcoded specific error indications. They are described in HFP v1.8 Section 4.34.2.
19 HardcodedError(HardcodedError),
20 /// Error codes used with the +CME ERROR indication. Described in HFP v1.8 4.34.2
21 CmeError(i64),
22 /// All other non-error responses. These are described throughout the HFP v1.8 spec.
23 Success(highlevel::Success),
24 /// Just send the raw byte buffer as a response.
25 RawBytes(Vec<u8>),
26}
27
28// Hardedcoded error indications described in HFP v1.8 Section 4.34.2
29#[derive(Debug, Clone, PartialEq)]
30pub enum HardcodedError {
31 NoCarrier,
32 Busy,
33 NoAnswer,
34 Delayed,
35 Blacklist,
36}