bt_hfp/call/
direction.rs

1// Copyright 2023 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
5use fidl_fuchsia_bluetooth_hfp::CallDirection as FidlCallDirection;
6
7/// The direction of call initiation.
8#[derive(Debug, PartialEq, Clone, Copy)]
9pub enum Direction {
10    /// Call originated on this device. This is also known as an Outgoing call.
11    MobileOriginated,
12    /// Call is terminated on this device. This is also known as an Incoming call.
13    MobileTerminated,
14}
15
16impl From<FidlCallDirection> for Direction {
17    fn from(x: FidlCallDirection) -> Self {
18        match x {
19            FidlCallDirection::MobileOriginated => Self::MobileOriginated,
20            FidlCallDirection::MobileTerminated => Self::MobileTerminated,
21        }
22    }
23}
24
25impl From<Direction> for i64 {
26    fn from(x: Direction) -> Self {
27        match x {
28            Direction::MobileOriginated => 0,
29            Direction::MobileTerminated => 1,
30        }
31    }
32}