xref: /aosp_15_r20/external/autotest/client/cros/cellular/hermes_constants.py (revision 9c5db1993ded3edbeafc8092d69fe5de2ee02df7)
1# Lint as: python2, python3
2# Copyright (c) 2020 The Chromium OS Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6"""
7This module provides bindings for HermesManager DBus constants, such as
8interface names, enumerations, and errors.
9
10"""
11
12#Hermes DBus Binding errors
13DBUS_HERMES_UNKNOWN = 'org.chromium.Hermes.Error.Unknown'
14DBUS_HERMES_UNSUPPORTED = 'org.chromium.Hermes.Error.Unsupported'
15DBUS_HERMES_WRONGSTATE = 'rg.chromium.Hermes.Error.WrongState'
16
17#Hermes DBus other errors
18DBUS_HERMES_PROFILE_ALREADY_DISABLED = 'org.chromium.Hermes.Error.AlreadyDisabled'
19DBUS_HERMES_PROFILE_ALREADY_ENABLED = 'org.chromium.Hermes.Error.AlreadyEnabled'
20DBUS_HERMES_BAD_NOTIFICATION = 'org.chromium.Hermes.Error.BadNotification'
21DBUS_HERMES_BAD_REQUEST = 'org.chromium.Hermes.Error.BadRequest'
22DBUS_HERMES_INTERNAL_LPA_FAILURE = 'org.chromium.Hermes.Error.InternalLpaFailure'
23DBUS_HERMES_INVALID_ACTIVATION_CODE = 'org.chromium.Hermes.Error.InvalidActivationCode'
24DBUS_HERMES_INVALID_ICCID = 'org.chromium.Hermes.Error.InvalidIccid'
25DBUS_HERMES_INVALID_PARAM = 'org.chromium.Hermes.Error.InvalidParameter'
26DBUS_HERMES_MALFORMED_RESPONSE = 'org.chromium.Hermes.Error.MalformedResponse'
27DBUS_HERMES_NEED_CONFIRMATION_CODE = 'org.chromium.Hermes.Error.NeedConfirmationCode'
28DBUS_HERMES_NO_RESPONSE = 'org.chromium.Hermes.Error.NoResponse'
29DBUS_HERMES_PENDING_PROFILE = 'org.chromium.Hermes.Error.PendingProfile'
30DBUS_HERMES_SEND_APDU_FAILURE = 'org.chromium.Hermes.Error.SendApduFailur'
31DBUS_HERMES_SEND_HTTP_FAILURE = 'org.chromium.Hermes.Error.SendHttpsFailure'
32DBUS_HERMES_SEND_NOTIFICATION_FAILURE = 'org.chromium.Hermes.Error.SendNotificationFailure'
33DBUS_HERMES_TEST_PROFILE_INPROD = 'org.chromium.Hermes.Error.TestProfileInProd'
34
35# Interfaces
36# Standard Interfaces
37I_PROPERTIES = 'org.freedesktop.DBus.Properties'
38I_INTROSPECTABLE = 'org.freedesktop.DBus.Introspectable'
39I_OBJECT_MANAGER = 'org.freedesktop.DBus.ObjectManager'
40
41#
42# For eSIM interactions.
43#
44HERMES_SERVICE = 'org.chromium.Hermes'
45HERMES_OBJECT = '/org/chromium/Hermes'
46HERMES_MANAGER_OBJECT = '/org/chromium/Hermes/Manager'
47HERMES_MANAGER_IFACE = 'org.chromium.Hermes.Manager'
48
49HERMES_EUICC_OBJECT = '/org/chromium/Hermes/Euicc'
50HERMES_EUICC_IFACE = 'org.chromium.Hermes.Euicc'
51
52HERMES_PROFILE_OBJECT = '/org/chromium/Hermes/Profile'
53HERMES_PROFILE_IFACE = 'org.chromium.Hermes.Profile'
54
55
56EUICC_ENUMERATION_TIMEOUT = 20
57EUICC_ENABLE_DISABLE_TIMEOUT = 10
58PROFILE_ENABLE_DISABLE_TIMEOUT = 10
59PROFILE_REFRESH_TIMEOUT = 10
60# Amount of time to wait between attempts to connect to HermesManager.
61CONNECT_WAIT_INTERVAL_SECONDS = 20
62HERMES_RESTART_WAIT_SECONDS   = 30
63# DBus method reply timeout in milliseconds
64HERMES_DBUS_METHOD_REPLY_TIMEOUT = 120 * 1000
65
66def ProfileStateToString(state):
67    """
68    Returns a string for the given state.
69
70    @param state: Profile state value.
71
72    @return A string that describes the given state.
73
74    """
75    PROFILE_STATE_STRINGS = [
76        'PENDING',
77        'INACTIVE',
78        'ACTIVE'
79    ]
80    return PROFILE_STATE_STRINGS[state]
81
82
83def ProfileClassToString(pclass):
84    """
85    Returns a string for the given class.
86
87    @param state: Profile class value.
88
89    @return A string that describes the given class.
90
91    """
92    PROFILE_CLASS_STRINGS = [
93        'TESTING',
94        'PROVISIONING',
95        'OPERATIONAL'
96    ]
97    return PROFILE_CLASS_STRINGS[pclass]
98