at_commands/
response.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright 2021 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

//! Response types.  These wrap the generated Success types with handling for errors and other types of responses.

use crate::highlevel;

/// Responses and indications.
#[derive(Debug, Clone, PartialEq)]
pub enum Response {
    /// The success indication.  Its format is described in HFP v1.8 Section 4.34.1, and it is
    /// used throughout the spec.
    Ok,
    /// The error indication.  Its format is described in HFP v1.8 Section 4.34.1, and it is
    /// used throughout the spec.
    Error,
    /// A set of hardcoded specific error indications.  They are described in HFP v1.8 Section 4.34.2.
    HardcodedError(HardcodedError),
    /// Error codes used with the +CME ERROR indication.  Described in HFP v1.8 4.34.2
    CmeError(i64),
    /// All other non-error responses.  These are described throughout the HFP v1.8 spec.
    Success(highlevel::Success),
    /// Just send the raw byte buffer as a response.
    RawBytes(Vec<u8>),
}

// Hardedcoded error indications described in HFP v1.8 Section 4.34.2
#[derive(Debug, Clone, PartialEq)]
pub enum HardcodedError {
    NoCarrier,
    Busy,
    NoAnswer,
    Delayed,
    Blacklist,
}