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