xref: /aosp_15_r20/external/autotest/server/cros/cellular/simulation_utils/ChromebookCellularDut.py (revision 9c5db1993ded3edbeafc8092d69fe5de2ee02df7)
1# Copyright 2021 The Chromium OS 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
5from autotest_lib.server.cros.cellular.simulation_utils import BaseCellularDut
6
7
8class ChromebookCellularDut(BaseCellularDut.BaseCellularDut):
9    """ Chromebook implementation of the cellular DUT class."""
10
11    def __init__(self, ad, logger):
12        """ Keeps a handler to the chromebook device.
13
14        Args:
15           ad: a handle to the chromebook device
16           logger: a handler to the logger object
17        """
18        self.ad = ad
19        self.log = logger
20
21    def toggle_airplane_mode(self, new_state=True):
22        """ Turns on and off mobile data.
23        """
24        if new_state:
25            self.ad.run(
26                "dbus-send --system --fixed --print-reply --dest=org.chromium."
27                "flimflam / org.chromium.flimflam.Manager.DisableTechnology st"
28                "ring:cellular")
29        else:
30            self.ad.run(
31                "dbus-send --system --fixed --print-reply --dest=org.chromium."
32                "flimflam / org.chromium.flimflam.Manager.EnableTechnology str"
33                "ing:cellular")
34
35    def toggle_data_roaming(self, new_state=True):
36        """ Enables or disables cellular data roaming.
37
38        Args:
39          new_state: True if data roaming needs to be enabled.
40        """
41        pass
42
43    def get_rx_tx_power_levels(self):
44        """ Not relevant to Chromebooks,
45        but required interface for compatibility.
46        """
47        return (None, None)
48
49    def set_apn(self, name, apn, type='default'):
50        """ Not currently supported by Chromebooks yet.
51        """
52        pass
53
54    def set_preferred_network_type(self, type):
55        """ Sets the preferred RAT.
56
57        Args:
58          type: an instance of class PreferredNetworkType
59        """
60        pass
61
62    def get_telephony_signal_strength(self):
63        """ Not relevant to Chromebooks,
64        but required interface for compatibility.
65        """
66        pass
67