|
1 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- |
|
2 * This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 package com.googlecode.eyesfree.braille.selfbraille; |
|
7 |
|
8 /** |
|
9 * Interface for a client to control braille output for a part of the |
|
10 * accessibility node tree. |
|
11 */ |
|
12 public interface ISelfBrailleService extends android.os.IInterface { |
|
13 /** Local-side IPC implementation stub class. */ |
|
14 public static abstract class Stub extends android.os.Binder implements |
|
15 com.googlecode.eyesfree.braille.selfbraille.ISelfBrailleService { |
|
16 private static final java.lang.String DESCRIPTOR = "com.googlecode.eyesfree.braille.selfbraille.ISelfBrailleService"; |
|
17 |
|
18 /** Construct the stub at attach it to the interface. */ |
|
19 public Stub() { |
|
20 this.attachInterface(this, DESCRIPTOR); |
|
21 } |
|
22 |
|
23 /** |
|
24 * Cast an IBinder object into an |
|
25 * com.googlecode.eyesfree.braille.selfbraille.ISelfBrailleService |
|
26 * interface, generating a proxy if needed. |
|
27 */ |
|
28 public static com.googlecode.eyesfree.braille.selfbraille.ISelfBrailleService asInterface( |
|
29 android.os.IBinder obj) { |
|
30 if ((obj == null)) { |
|
31 return null; |
|
32 } |
|
33 android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR); |
|
34 if (((iin != null) && (iin instanceof com.googlecode.eyesfree.braille.selfbraille.ISelfBrailleService))) { |
|
35 return ((com.googlecode.eyesfree.braille.selfbraille.ISelfBrailleService) iin); |
|
36 } |
|
37 return new com.googlecode.eyesfree.braille.selfbraille.ISelfBrailleService.Stub.Proxy( |
|
38 obj); |
|
39 } |
|
40 |
|
41 @Override |
|
42 public android.os.IBinder asBinder() { |
|
43 return this; |
|
44 } |
|
45 |
|
46 @Override |
|
47 public boolean onTransact(int code, android.os.Parcel data, |
|
48 android.os.Parcel reply, int flags) |
|
49 throws android.os.RemoteException { |
|
50 switch (code) { |
|
51 case INTERFACE_TRANSACTION: { |
|
52 reply.writeString(DESCRIPTOR); |
|
53 return true; |
|
54 } |
|
55 case TRANSACTION_write: { |
|
56 data.enforceInterface(DESCRIPTOR); |
|
57 android.os.IBinder _arg0; |
|
58 _arg0 = data.readStrongBinder(); |
|
59 com.googlecode.eyesfree.braille.selfbraille.WriteData _arg1; |
|
60 if ((0 != data.readInt())) { |
|
61 _arg1 = com.googlecode.eyesfree.braille.selfbraille.WriteData.CREATOR |
|
62 .createFromParcel(data); |
|
63 } else { |
|
64 _arg1 = null; |
|
65 } |
|
66 this.write(_arg0, _arg1); |
|
67 reply.writeNoException(); |
|
68 return true; |
|
69 } |
|
70 case TRANSACTION_disconnect: { |
|
71 data.enforceInterface(DESCRIPTOR); |
|
72 android.os.IBinder _arg0; |
|
73 _arg0 = data.readStrongBinder(); |
|
74 this.disconnect(_arg0); |
|
75 return true; |
|
76 } |
|
77 } |
|
78 return super.onTransact(code, data, reply, flags); |
|
79 } |
|
80 |
|
81 private static class Proxy implements |
|
82 com.googlecode.eyesfree.braille.selfbraille.ISelfBrailleService { |
|
83 private android.os.IBinder mRemote; |
|
84 |
|
85 Proxy(android.os.IBinder remote) { |
|
86 mRemote = remote; |
|
87 } |
|
88 |
|
89 @Override |
|
90 public android.os.IBinder asBinder() { |
|
91 return mRemote; |
|
92 } |
|
93 |
|
94 public java.lang.String getInterfaceDescriptor() { |
|
95 return DESCRIPTOR; |
|
96 } |
|
97 |
|
98 @Override |
|
99 public void write( |
|
100 android.os.IBinder clientToken, |
|
101 com.googlecode.eyesfree.braille.selfbraille.WriteData writeData) |
|
102 throws android.os.RemoteException { |
|
103 android.os.Parcel _data = android.os.Parcel.obtain(); |
|
104 android.os.Parcel _reply = android.os.Parcel.obtain(); |
|
105 try { |
|
106 _data.writeInterfaceToken(DESCRIPTOR); |
|
107 _data.writeStrongBinder(clientToken); |
|
108 if ((writeData != null)) { |
|
109 _data.writeInt(1); |
|
110 writeData.writeToParcel(_data, 0); |
|
111 } else { |
|
112 _data.writeInt(0); |
|
113 } |
|
114 mRemote.transact(Stub.TRANSACTION_write, _data, _reply, 0); |
|
115 _reply.readException(); |
|
116 } finally { |
|
117 _reply.recycle(); |
|
118 _data.recycle(); |
|
119 } |
|
120 } |
|
121 |
|
122 @Override |
|
123 public void disconnect(android.os.IBinder clientToken) |
|
124 throws android.os.RemoteException { |
|
125 android.os.Parcel _data = android.os.Parcel.obtain(); |
|
126 try { |
|
127 _data.writeInterfaceToken(DESCRIPTOR); |
|
128 _data.writeStrongBinder(clientToken); |
|
129 mRemote.transact(Stub.TRANSACTION_disconnect, _data, null, |
|
130 android.os.IBinder.FLAG_ONEWAY); |
|
131 } finally { |
|
132 _data.recycle(); |
|
133 } |
|
134 } |
|
135 } |
|
136 |
|
137 static final int TRANSACTION_write = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0); |
|
138 static final int TRANSACTION_disconnect = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1); |
|
139 } |
|
140 |
|
141 public void write(android.os.IBinder clientToken, |
|
142 com.googlecode.eyesfree.braille.selfbraille.WriteData writeData) |
|
143 throws android.os.RemoteException; |
|
144 |
|
145 public void disconnect(android.os.IBinder clientToken) |
|
146 throws android.os.RemoteException; |
|
147 } |