1 /*
2  * Copyright (C) 2023 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.telephony.satellite.stub;
18 
19 import android.telephony.satellite.stub.ISatelliteCapabilitiesConsumer;
20 import android.telephony.satellite.stub.ISatelliteListener;
21 import android.telephony.satellite.stub.SatelliteDatagram;
22 
23 import com.android.internal.telephony.IBooleanConsumer;
24 import com.android.internal.telephony.IIntegerConsumer;
25 
26 /**
27  * {@hide}
28  */
29 oneway interface ISatellite {
30     /**
31      * Register the callback interface with satellite service.
32      *
33      * @param listener The callback interface to handle satellite service indications.
34      *
35      * Valid error codes returned:
36      *   SatelliteError:ERROR_NONE
37      *   SatelliteError:SERVICE_ERROR
38      *   SatelliteError:MODEM_ERROR
39      *   SatelliteError:INVALID_MODEM_STATE
40      *   SatelliteError:INVALID_ARGUMENTS
41      *   SatelliteError:RADIO_NOT_AVAILABLE
42      *   SatelliteError:REQUEST_NOT_SUPPORTED
43      *   SatelliteError:NO_RESOURCES
44      */
setSatelliteListener(in ISatelliteListener listener)45     void setSatelliteListener(in ISatelliteListener listener);
46 
47     /**
48      * Request to enable or disable the satellite service listening mode.
49      * Listening mode allows the satellite service to listen for incoming pages.
50      *
51      * @param enable True to enable satellite listening mode and false to disable.
52      * @param timeout How long the satellite modem should wait for the next incoming page before
53      *                disabling listening mode.
54      * @param resultCallback The callback to receive the error code result of the operation.
55      *
56      * Valid error codes returned:
57      *   SatelliteError:ERROR_NONE
58      *   SatelliteError:SERVICE_ERROR
59      *   SatelliteError:MODEM_ERROR
60      *   SatelliteError:INVALID_MODEM_STATE
61      *   SatelliteError:INVALID_ARGUMENTS
62      *   SatelliteError:RADIO_NOT_AVAILABLE
63      *   SatelliteError:REQUEST_NOT_SUPPORTED
64      *   SatelliteError:NO_RESOURCES
65      */
requestSatelliteListeningEnabled(in boolean enable, in int timeout, in IIntegerConsumer resultCallback)66     void requestSatelliteListeningEnabled(in boolean enable, in int timeout,
67             in IIntegerConsumer resultCallback);
68 
69     /**
70      * Allow cellular modem scanning while satellite mode is on.
71      * @param enabled  {@code true} to enable cellular modem while satellite mode is on
72      * and {@code false} to disable
73      * @param errorCallback The callback to receive the error code result of the operation.
74      */
enableCellularModemWhileSatelliteModeIsOn(in boolean enabled, in IIntegerConsumer errorCallback)75     void enableCellularModemWhileSatelliteModeIsOn(in boolean enabled,
76         in IIntegerConsumer errorCallback);
77 
78     /**
79      * Request to enable or disable the satellite modem and demo mode. If the satellite modem
80      * is enabled, this may also disable the cellular modem, and if the satellite modem is disabled,
81      * this may also re-enable the cellular modem.
82      *
83      * @param enableSatellite True to enable the satellite modem and false to disable.
84      * @param enableDemoMode True to enable demo mode and false to disable.
85      * @param resultCallback The callback to receive the error code result of the operation.
86      *
87      * Valid error codes returned:
88      *   SatelliteError:ERROR_NONE
89      *   SatelliteError:SERVICE_ERROR
90      *   SatelliteError:MODEM_ERROR
91      *   SatelliteError:INVALID_MODEM_STATE
92      *   SatelliteError:INVALID_ARGUMENTS
93      *   SatelliteError:RADIO_NOT_AVAILABLE
94      *   SatelliteError:REQUEST_NOT_SUPPORTED
95      *   SatelliteError:NO_RESOURCES
96      */
requestSatelliteEnabled(in boolean enableSatellite, in boolean enableDemoMode, in IIntegerConsumer resultCallback)97     void requestSatelliteEnabled(in boolean enableSatellite, in boolean enableDemoMode,
98             in IIntegerConsumer resultCallback);
99 
100     /**
101      * Request to get whether the satellite modem is enabled.
102      *
103      * @param resultCallback The callback to receive the error code result of the operation.
104      *                       This must only be sent when the error is not SatelliteError#ERROR_NONE.
105      * @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive
106      *                 whether the satellite modem is enabled.
107      *
108      * Valid error codes returned:
109      *   SatelliteError:ERROR_NONE
110      *   SatelliteError:SERVICE_ERROR
111      *   SatelliteError:MODEM_ERROR
112      *   SatelliteError:INVALID_MODEM_STATE
113      *   SatelliteError:INVALID_ARGUMENTS
114      *   SatelliteError:RADIO_NOT_AVAILABLE
115      *   SatelliteError:REQUEST_NOT_SUPPORTED
116      *   SatelliteError:NO_RESOURCES
117      */
requestIsSatelliteEnabled(in IIntegerConsumer resultCallback, in IBooleanConsumer callback)118     void requestIsSatelliteEnabled(in IIntegerConsumer resultCallback, in IBooleanConsumer callback);
119 
120     /**
121      * Request to get whether the satellite service is supported on the device.
122      *
123      * @param resultCallback The callback to receive the error code result of the operation.
124      *                       This must only be sent when the error is not SatelliteError#ERROR_NONE.
125      * @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive
126      *                 whether the satellite service is supported on the device.
127      *
128      * Valid error codes returned:
129      *   SatelliteError:ERROR_NONE
130      *   SatelliteError:SERVICE_ERROR
131      *   SatelliteError:MODEM_ERROR
132      *   SatelliteError:INVALID_MODEM_STATE
133      *   SatelliteError:INVALID_ARGUMENTS
134      *   SatelliteError:RADIO_NOT_AVAILABLE
135      *   SatelliteError:REQUEST_NOT_SUPPORTED
136      *   SatelliteError:NO_RESOURCES
137      */
requestIsSatelliteSupported(in IIntegerConsumer resultCallback, in IBooleanConsumer callback)138     void requestIsSatelliteSupported(in IIntegerConsumer resultCallback,
139             in IBooleanConsumer callback);
140 
141     /**
142      * Request to get the SatelliteCapabilities of the satellite service.
143      *
144      * @param resultCallback The callback to receive the error code result of the operation.
145      *                       This must only be sent when the error is not SatelliteError#ERROR_NONE.
146      * @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive
147      *                 the SatelliteCapabilities of the satellite service.
148      *
149      * Valid error codes returned:
150      *   SatelliteError:ERROR_NONE
151      *   SatelliteError:SERVICE_ERROR
152      *   SatelliteError:MODEM_ERROR
153      *   SatelliteError:INVALID_MODEM_STATE
154      *   SatelliteError:INVALID_ARGUMENTS
155      *   SatelliteError:RADIO_NOT_AVAILABLE
156      *   SatelliteError:REQUEST_NOT_SUPPORTED
157      *   SatelliteError:NO_RESOURCES
158      */
requestSatelliteCapabilities(in IIntegerConsumer resultCallback, in ISatelliteCapabilitiesConsumer callback)159     void requestSatelliteCapabilities(in IIntegerConsumer resultCallback,
160             in ISatelliteCapabilitiesConsumer callback);
161 
162     /**
163      * User started pointing to the satellite.
164      * The satellite service should report the satellite pointing info via
165      * ISatelliteListener#onSatellitePositionChanged as the user device/satellite moves.
166      *
167      * @param resultCallback The callback to receive the error code result of the operation.
168      *
169      * Valid error codes returned:
170      *   SatelliteError:ERROR_NONE
171      *   SatelliteError:SERVICE_ERROR
172      *   SatelliteError:MODEM_ERROR
173      *   SatelliteError:INVALID_MODEM_STATE
174      *   SatelliteError:INVALID_ARGUMENTS
175      *   SatelliteError:RADIO_NOT_AVAILABLE
176      *   SatelliteError:REQUEST_NOT_SUPPORTED
177      *   SatelliteError:NO_RESOURCES
178      */
startSendingSatellitePointingInfo(in IIntegerConsumer resultCallback)179     void startSendingSatellitePointingInfo(in IIntegerConsumer resultCallback);
180 
181     /**
182      * User stopped pointing to the satellite.
183      * The satellite service should stop reporting satellite pointing info to the framework.
184      *
185      * @param resultCallback The callback to receive the error code result of the operation.
186      *
187      * Valid error codes returned:
188      *   SatelliteError:ERROR_NONE
189      *   SatelliteError:SERVICE_ERROR
190      *   SatelliteError:MODEM_ERROR
191      *   SatelliteError:INVALID_MODEM_STATE
192      *   SatelliteError:INVALID_ARGUMENTS
193      *   SatelliteError:RADIO_NOT_AVAILABLE
194      *   SatelliteError:REQUEST_NOT_SUPPORTED
195      *   SatelliteError:NO_RESOURCES
196      */
stopSendingSatellitePointingInfo(in IIntegerConsumer resultCallback)197     void stopSendingSatellitePointingInfo(in IIntegerConsumer resultCallback);
198 
199     /**
200      * Provision the device with a satellite provider.
201      * This is needed if the provider allows dynamic registration.
202      * Once provisioned, ISatelliteListener#onSatelliteProvisionStateChanged should report true.
203      *
204      * @param token The token to be used as a unique identifier for provisioning with satellite
205      *              gateway.
206      * @param provisionData Data from the provisioning app that can be used by provisioning server
207      * @param resultCallback The callback to receive the error code result of the operation.
208      *
209      * Valid error codes returned:
210      *   SatelliteError:ERROR_NONE
211      *   SatelliteError:SERVICE_ERROR
212      *   SatelliteError:MODEM_ERROR
213      *   SatelliteError:NETWORK_ERROR
214      *   SatelliteError:INVALID_MODEM_STATE
215      *   SatelliteError:INVALID_ARGUMENTS
216      *   SatelliteError:RADIO_NOT_AVAILABLE
217      *   SatelliteError:REQUEST_NOT_SUPPORTED
218      *   SatelliteError:NO_RESOURCES
219      *   SatelliteError:REQUEST_ABORTED
220      *   SatelliteError:NETWORK_TIMEOUT
221      */
provisionSatelliteService(in String token, in byte[] provisionData, in IIntegerConsumer resultCallback)222     void provisionSatelliteService(in String token, in byte[] provisionData,
223             in IIntegerConsumer resultCallback);
224 
225     /**
226      * Deprovision the device with the satellite provider.
227      * This is needed if the provider allows dynamic registration.
228      * Once deprovisioned, ISatelliteListener#onSatelliteProvisionStateChanged should report false.
229      *
230      * @param token The token of the device/subscription to be deprovisioned.
231      * @param resultCallback The callback to receive the error code result of the operation.
232      *
233      * Valid error codes returned:
234      *   SatelliteError:ERROR_NONE
235      *   SatelliteError:SERVICE_ERROR
236      *   SatelliteError:MODEM_ERROR
237      *   SatelliteError:NETWORK_ERROR
238      *   SatelliteError:INVALID_MODEM_STATE
239      *   SatelliteError:INVALID_ARGUMENTS
240      *   SatelliteError:RADIO_NOT_AVAILABLE
241      *   SatelliteError:REQUEST_NOT_SUPPORTED
242      *   SatelliteError:NO_RESOURCES
243      *   SatelliteError:REQUEST_ABORTED
244      *   SatelliteError:NETWORK_TIMEOUT
245      */
deprovisionSatelliteService(in String token, in IIntegerConsumer resultCallback)246     void deprovisionSatelliteService(in String token, in IIntegerConsumer resultCallback);
247 
248     /**
249      * Request to get whether this device is provisioned with a satellite provider.
250      *
251      * @param resultCallback The callback to receive the error code result of the operation.
252      *                       This must only be sent when the error is not SatelliteError#ERROR_NONE.
253      * @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive
254      *                 whether this device is provisioned with a satellite provider.
255      *
256      * Valid error codes returned:
257      *   SatelliteError:ERROR_NONE
258      *   SatelliteError:SERVICE_ERROR
259      *   SatelliteError:MODEM_ERROR
260      *   SatelliteError:INVALID_MODEM_STATE
261      *   SatelliteError:INVALID_ARGUMENTS
262      *   SatelliteError:RADIO_NOT_AVAILABLE
263      *   SatelliteError:REQUEST_NOT_SUPPORTED
264      *   SatelliteError:NO_RESOURCES
265      */
requestIsSatelliteProvisioned(in IIntegerConsumer resultCallback, in IBooleanConsumer callback)266     void requestIsSatelliteProvisioned(in IIntegerConsumer resultCallback,
267             in IBooleanConsumer callback);
268 
269     /**
270      * Poll the pending datagrams to be received over satellite.
271      * The satellite service should check if there are any pending datagrams to be received over
272      * satellite and report them via ISatelliteListener#onSatelliteDatagramsReceived.
273      *
274      * @param resultCallback The callback to receive the error code result of the operation.
275      *
276      * Valid error codes returned:
277      *   SatelliteError:ERROR_NONE
278      *   SatelliteError:SERVICE_ERROR
279      *   SatelliteError:MODEM_ERROR
280      *   SatelliteError:NETWORK_ERROR
281      *   SatelliteError:INVALID_MODEM_STATE
282      *   SatelliteError:INVALID_ARGUMENTS
283      *   SatelliteError:RADIO_NOT_AVAILABLE
284      *   SatelliteError:REQUEST_NOT_SUPPORTED
285      *   SatelliteError:NO_RESOURCES
286      *   SatelliteError:SATELLITE_ACCESS_BARRED
287      *   SatelliteError:NETWORK_TIMEOUT
288      *   SatelliteError:SATELLITE_NOT_REACHABLE
289      *   SatelliteError:NOT_AUTHORIZED
290      */
pollPendingSatelliteDatagrams(in IIntegerConsumer resultCallback)291     void pollPendingSatelliteDatagrams(in IIntegerConsumer resultCallback);
292 
293     /**
294      * Send datagram over satellite.
295      *
296      * @param datagram Datagram to send in byte format.
297      * @param isEmergency Whether this is an emergency datagram.
298      * @param resultCallback The callback to receive the error code result of the operation.
299      *
300      * Valid error codes returned:
301      *   SatelliteError:ERROR_NONE
302      *   SatelliteError:SERVICE_ERROR
303      *   SatelliteError:MODEM_ERROR
304      *   SatelliteError:NETWORK_ERROR
305      *   SatelliteError:INVALID_MODEM_STATE
306      *   SatelliteError:INVALID_ARGUMENTS
307      *   SatelliteError:RADIO_NOT_AVAILABLE
308      *   SatelliteError:REQUEST_NOT_SUPPORTED
309      *   SatelliteError:NO_RESOURCES
310      *   SatelliteError:REQUEST_ABORTED
311      *   SatelliteError:SATELLITE_ACCESS_BARRED
312      *   SatelliteError:NETWORK_TIMEOUT
313      *   SatelliteError:SATELLITE_NOT_REACHABLE
314      *   SatelliteError:NOT_AUTHORIZED
315      */
sendSatelliteDatagram(in SatelliteDatagram datagram, in boolean isEmergency, in IIntegerConsumer resultCallback)316     void sendSatelliteDatagram(in SatelliteDatagram datagram, in boolean isEmergency,
317             in IIntegerConsumer resultCallback);
318 
319     /**
320      * Request the current satellite modem state.
321      * The satellite service should report the current satellite modem state via
322      * ISatelliteListener#onSatelliteModemStateChanged.
323      *
324      * @param resultCallback The callback to receive the error code result of the operation.
325      *                       This must only be sent when the error is not SatelliteError#ERROR_NONE.
326      * @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive
327      *                 the current satellite modem state.
328      *
329      * Valid error codes returned:
330      *   SatelliteError:ERROR_NONE
331      *   SatelliteError:SERVICE_ERROR
332      *   SatelliteError:MODEM_ERROR
333      *   SatelliteError:INVALID_MODEM_STATE
334      *   SatelliteError:INVALID_ARGUMENTS
335      *   SatelliteError:RADIO_NOT_AVAILABLE
336      *   SatelliteError:REQUEST_NOT_SUPPORTED
337      *   SatelliteError:NO_RESOURCES
338      */
requestSatelliteModemState(in IIntegerConsumer resultCallback, in IIntegerConsumer callback)339     void requestSatelliteModemState(in IIntegerConsumer resultCallback,
340             in IIntegerConsumer callback);
341 
342     /**
343      * Request to get whether satellite communication is allowed for the current location.
344      *
345      * @param resultCallback The callback to receive the error code result of the operation.
346      *                       This must only be sent when the error is not SatelliteError#ERROR_NONE.
347      * @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive
348      *                 whether satellite communication is allowed for the current location.
349      *
350      * Valid error codes returned:
351      *   SatelliteError:ERROR_NONE
352      *   SatelliteError:SERVICE_ERROR
353      *   SatelliteError:MODEM_ERROR
354      *   SatelliteError:INVALID_MODEM_STATE
355      *   SatelliteError:INVALID_ARGUMENTS
356      *   SatelliteError:RADIO_NOT_AVAILABLE
357      *   SatelliteError:REQUEST_NOT_SUPPORTED
358      *   SatelliteError:NO_RESOURCES
359      */
requestIsSatelliteCommunicationAllowedForCurrentLocation( in IIntegerConsumer resultCallback, in IBooleanConsumer callback)360     void requestIsSatelliteCommunicationAllowedForCurrentLocation(
361             in IIntegerConsumer resultCallback, in IBooleanConsumer callback);
362 
363     /**
364      * Request to get the time after which the satellite will be visible. This is an int
365      * representing the duration in seconds after which the satellite will be visible.
366      * This will return 0 if the satellite is currently visible.
367      *
368      * @param resultCallback The callback to receive the error code result of the operation.
369      *                       This must only be sent when the error is not SatelliteError#ERROR_NONE.
370      * @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive
371      *                 the time after which the satellite will be visible.
372      *
373      * Valid error codes returned:
374      *   SatelliteError:ERROR_NONE
375      *   SatelliteError:SERVICE_ERROR
376      *   SatelliteError:MODEM_ERROR
377      *   SatelliteError:INVALID_MODEM_STATE
378      *   SatelliteError:INVALID_ARGUMENTS
379      *   SatelliteError:RADIO_NOT_AVAILABLE
380      *   SatelliteError:REQUEST_NOT_SUPPORTED
381      *   SatelliteError:NO_RESOURCES
382      */
requestTimeForNextSatelliteVisibility(in IIntegerConsumer resultCallback, in IIntegerConsumer callback)383     void requestTimeForNextSatelliteVisibility(in IIntegerConsumer resultCallback,
384             in IIntegerConsumer callback);
385 }
386