1# Copyright (c) 2015 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
5"""
6This module defines the constants which are used in different components
7within the MBIM compliance suite.
8All the constants should match the values and names specified in MBIM
9Specification[1].
10
11Reference:
12    [1] Universal Serial Bus Communications Class Subclass Specification for
13        Mobile Broadband Interface Model
14        http://www.usb.org/developers/docs/devclass_docs/
15        MBIM10Errata1_073013.zip
16"""
17import uuid
18
19
20# The following type values are defined for the MBIM control messages sent from
21# the host to the device.
22MBIM_OPEN_MSG = 0x00000001
23MBIM_CLOSE_MSG = 0x00000002
24MBIM_COMMAND_MSG = 0x00000003
25MBIM_HOST_ERROR_MSG = 0x00000004
26
27# The following type values are defined for the MBIM control messages sent from
28# the device to the host.
29MBIM_OPEN_DONE = 0x80000001
30MBIM_CLOSE_DONE = 0x80000002
31MBIM_COMMAND_DONE = 0x80000003
32MBIM_FUNCTION_ERROR_MSG = 0x80000004
33MBIM_INDICATE_STATUS_MSG = 0x80000007
34
35# The following type values are defined for the MBIM status codes.
36MBIM_STATUS_SUCCESS = 0x00000000
37MBIM_STATUS_NO_DEVICE_SUPPORT = 0x00000009
38MBIM_STATUS_CONTEXT_NOT_ACTIVATED = 0x00000010
39MBIM_STATUS_INVALID_PARAMETERS = 0x00000015
40
41# The following type values are defined for both MBIM_HOST_ERROR_MSG and
42# MBIM_FUNCTION_ERROR_MSG.
43MBIM_ERROR_TIMEOUT_FRAGMENT = 0x00000001
44MBIM_ERROR_FRAGMENT_OUT_OF_SEQUENCE = 0x00000002
45MBIM_ERROR_LENGTH_MISMATCH = 0x00000003
46MBIM_ERROR_DUPLICATED_TID = 0x00000004
47MBIM_ERROR_NOT_OPENED = 0x00000005
48MBIM_ERROR_UNKNOWN = 0x00000006
49MBIM_ERROR_CANCEL = 0x00000007
50MBIM_ERROR_MAX_TRANSFER = 0x00000008
51
52# The following command codes are defined for the MBIM command identifiers.
53MBIM_CID_DEVICE_CAPS = 0x00000001
54MBIM_CID_SUBSCRIBER_READY_STATUS = 0x00000002
55MBIM_CID_RADIO_STATE = 0x00000003
56MBIM_CID_PIN = 0x00000004
57MBIM_CID_HOME_PROVIDER = 0x00000006
58MBIM_CID_REGISTER_STATE = 0x00000009
59MBIM_CID_PACKET_SERVICE = 0x0000000A
60MBIM_CID_SIGNAL_STATE = 0x0000000B
61MBIM_CID_CONNECT = 0x0000000C
62MBIM_CID_SERVICE_ACTIVATION = 0x0000000E
63MBIM_CID_IP_CONFIGURATION = 0x0000000F
64MBIM_CID_DEVICE_SERVICES = 0x00000010
65
66# The following command types are defined for the MBIM command message.
67COMMAND_TYPE_QUERY = 0
68COMMAND_TYPE_SET = 1
69
70# The following UUID values are defined for the device service identifiers.
71UUID_BASIC_CONNECT = uuid.UUID('A289CC33-BCBB-8B4F-B6B0-133EC2AAE6DF')
72
73# The following UUID values are defined for the MBIM_CONTEXT_TYPES which are
74# used in the |context_type| field of information structures.
75MBIM_CONTEXT_TYPE_NONE = uuid.UUID('B43F758C-A560-4B46-B35E-C5869641FB54')
76MBIM_CONTEXT_TYPE_INTERNET = uuid.UUID('7E5E2A7E-4E6F-7272-736B-656E7E5E2A7E')
77
78# NTB formats
79NTB_FORMAT_16 = 0
80NTB_FORMAT_32 = 1
81
82# MBIM Device Caps Cellular classes
83CELLULAR_CLASS_MASK_GSM = 0x01
84CELLULAR_CLASS_MASK_CDMA = 0x02
85
86# MBIM CTRL Caps
87CTRL_CAPS_MASK_NONE = 0x0000
88CTRL_CAPS_MASK_REG_MANUAL = 0x0001
89CTRL_CAPS_MASK_HW_RADIO_SWITCH = 0x0002
90CTRL_CAPS_MASK_CDMA_MOBILE_IP = 0x0004
91CTRL_CAPS_MASK_CDMA_SIMPLE_IP = 0x0008
92CTRL_CAPS_MASK_MULTI_CARRIER = 0x0010
93