1 /*
2  * Copyright (C) 2015 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.system.connectivity.shill;
18 
19 import android.system.connectivity.shill.IPropertyChangedCallback;
20 
21 interface IService {
22   /**
23    * State types that can returned by GetState().
24    *
25    * Note: keep in sync with Flimflam state options in
26    * system_api/dbus/shill/dbus-constants.h.
27    */
28   // The service is not enabled or otherwise operational.
29   const int STATE_IDLE = 0;
30   // Intermediate states associated with connection-based devices such as WiFi
31   // and Cellular. These are exposed for UI applications to provide more fine-
32   // grained status.
33   const int STATE_ASSOC = 1;
34   // Layer 2 is setup but Layer 3 setup has yet to completed.
35   const int STATE_CONFIG = 2;
36   // Layer 3 setup is complete; ready to transit and receive data.
37   const int STATE_READY = 3;
38   // Layer 3 setup is complete but connectivity to the Internet may be limited
39   // or unavailable.
40   const int STATE_PORTAL = 4;
41   // Layer 3 setup is complete and an Internet connection has been checked to
42   // support HTTP access to the Manager's captive-portal-checking URL.
43   const int STATE_ONLINE = 5;
44   // An error occurred while trying to reach the "ready" state. Call GetError()
45   // for details.
46   const int STATE_FAILURE = 6;
47 
48   /**
49    * Error types that can returned by GetError().
50    *
51    * Note: keep in sync with Service::ConnectFailureToString() and Flimflam
52    * error options in system_api/dbus/shill/dbus-constants.h.
53    */
54   const int ERROR_IDLE = 0;
55   const int ERROR_AAA_FAILED = 1;
56   const int ERROR_ACTIVATION_FAILED = 2;
57   const int ERROR_BAD_PASSPHRASE = 3;
58   const int ERROR_BAD_WEP_KEY = 4;
59   const int ERROR_CONNECT_FAILED = 5;
60   const int ERROR_DNS_LOOKUP_FAILED = 6;
61   const int ERROR_DHCP_FAILED = 7;
62   const int ERROR_HTTP_GET_FAILED = 8;
63   const int ERROR_INTERNAL = 9;
64   const int ERROR_IPSEC_CERT_AUTH_FAILED = 10;
65   const int ERROR_IPSEC_PSK_AUTH_FAILED = 11;
66   const int ERROR_NEED_EVDO = 12;
67   const int ERROR_NEED_HOME_NETWORK = 13;
68   const int ERROR_OTASP_FAILED = 14;
69   const int ERROR_OUT_OF_RANGE = 15;
70   const int ERROR_PIN_MISSING = 16;
71   const int ERROR_PPP_AUTH_FAILED = 17;
72 
73   /**
74    * Initiate a connection for the specified service.
75    *
76    * For Ethernet devices, this method can only be used
77    * if it has previously been disconnected. Otherwise,
78    * the plugging of a cable automatically triggers
79    * a connection.  If no cable is plugged in, this
80    * method will fail.
81    *
82    * If the requested service is already connected,
83    * this request is ignored and an error is logged.
84    *
85    * If the requested service is in the process of
86    * connecting, this request is ignored and an error
87    * is logged.
88    *
89    * If another service of the same type is connected or
90    * connecting, the service is terminated before this
91    * request is handled.
92    *
93    * If the requested service cannot, for reasons not
94    * described above, be connected, an error is logged.
95    */
Connect()96   void Connect();
97 
98   /**
99    * Get the state of the service.
100    *
101    * See the STATE_* constants defined in this AIDL file
102    * for possible return types.
103    *
104    * @return The state of the service
105    */
GetState()106   int GetState();
107 
108   /**
109    * Gets the signal strength of the service. This
110    * is a normalized value between 0 and 100.
111    *
112    * This property will not be present for Ethernet
113    * devices.
114    *
115    * @return The signal strength of the service
116    */
GetStrength()117   byte GetStrength();
118 
119   /**
120    * Get the service error status details.
121    *
122    * When an error occurs during connection or disconnection,
123    * detailed information is represented in the Error
124    * property to help the user interface to present the
125    * user with alternate options.
126    *
127    * This property is only valid when the service is in a
128    * failure state. Otherwise it might be empty or not
129    * present at all.
130    *
131    * See the ERROR_* constants defined in this AIDL file
132    * for possible return types.
133    *
134    * @return The signal strength of the service
135    */
GetError()136   int GetError();
137 
138   /**
139    * Register a callback interface whose OnPropertyChanged()
140    * method will be called when the value of a shill property changes.
141    *
142    * @param callback Binder reference to call back
143    */
RegisterPropertyChangedSignalHandler(IPropertyChangedCallback callback)144   void RegisterPropertyChangedSignalHandler(IPropertyChangedCallback callback);
145 }
146