michael@0: /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: package com.googlecode.eyesfree.braille.selfbraille; michael@0: michael@0: /** michael@0: * Interface for a client to control braille output for a part of the michael@0: * accessibility node tree. michael@0: */ michael@0: public interface ISelfBrailleService extends android.os.IInterface { michael@0: /** Local-side IPC implementation stub class. */ michael@0: public static abstract class Stub extends android.os.Binder implements michael@0: com.googlecode.eyesfree.braille.selfbraille.ISelfBrailleService { michael@0: private static final java.lang.String DESCRIPTOR = "com.googlecode.eyesfree.braille.selfbraille.ISelfBrailleService"; michael@0: michael@0: /** Construct the stub at attach it to the interface. */ michael@0: public Stub() { michael@0: this.attachInterface(this, DESCRIPTOR); michael@0: } michael@0: michael@0: /** michael@0: * Cast an IBinder object into an michael@0: * com.googlecode.eyesfree.braille.selfbraille.ISelfBrailleService michael@0: * interface, generating a proxy if needed. michael@0: */ michael@0: public static com.googlecode.eyesfree.braille.selfbraille.ISelfBrailleService asInterface( michael@0: android.os.IBinder obj) { michael@0: if ((obj == null)) { michael@0: return null; michael@0: } michael@0: android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR); michael@0: if (((iin != null) && (iin instanceof com.googlecode.eyesfree.braille.selfbraille.ISelfBrailleService))) { michael@0: return ((com.googlecode.eyesfree.braille.selfbraille.ISelfBrailleService) iin); michael@0: } michael@0: return new com.googlecode.eyesfree.braille.selfbraille.ISelfBrailleService.Stub.Proxy( michael@0: obj); michael@0: } michael@0: michael@0: @Override michael@0: public android.os.IBinder asBinder() { michael@0: return this; michael@0: } michael@0: michael@0: @Override michael@0: public boolean onTransact(int code, android.os.Parcel data, michael@0: android.os.Parcel reply, int flags) michael@0: throws android.os.RemoteException { michael@0: switch (code) { michael@0: case INTERFACE_TRANSACTION: { michael@0: reply.writeString(DESCRIPTOR); michael@0: return true; michael@0: } michael@0: case TRANSACTION_write: { michael@0: data.enforceInterface(DESCRIPTOR); michael@0: android.os.IBinder _arg0; michael@0: _arg0 = data.readStrongBinder(); michael@0: com.googlecode.eyesfree.braille.selfbraille.WriteData _arg1; michael@0: if ((0 != data.readInt())) { michael@0: _arg1 = com.googlecode.eyesfree.braille.selfbraille.WriteData.CREATOR michael@0: .createFromParcel(data); michael@0: } else { michael@0: _arg1 = null; michael@0: } michael@0: this.write(_arg0, _arg1); michael@0: reply.writeNoException(); michael@0: return true; michael@0: } michael@0: case TRANSACTION_disconnect: { michael@0: data.enforceInterface(DESCRIPTOR); michael@0: android.os.IBinder _arg0; michael@0: _arg0 = data.readStrongBinder(); michael@0: this.disconnect(_arg0); michael@0: return true; michael@0: } michael@0: } michael@0: return super.onTransact(code, data, reply, flags); michael@0: } michael@0: michael@0: private static class Proxy implements michael@0: com.googlecode.eyesfree.braille.selfbraille.ISelfBrailleService { michael@0: private android.os.IBinder mRemote; michael@0: michael@0: Proxy(android.os.IBinder remote) { michael@0: mRemote = remote; michael@0: } michael@0: michael@0: @Override michael@0: public android.os.IBinder asBinder() { michael@0: return mRemote; michael@0: } michael@0: michael@0: public java.lang.String getInterfaceDescriptor() { michael@0: return DESCRIPTOR; michael@0: } michael@0: michael@0: @Override michael@0: public void write( michael@0: android.os.IBinder clientToken, michael@0: com.googlecode.eyesfree.braille.selfbraille.WriteData writeData) michael@0: throws android.os.RemoteException { michael@0: android.os.Parcel _data = android.os.Parcel.obtain(); michael@0: android.os.Parcel _reply = android.os.Parcel.obtain(); michael@0: try { michael@0: _data.writeInterfaceToken(DESCRIPTOR); michael@0: _data.writeStrongBinder(clientToken); michael@0: if ((writeData != null)) { michael@0: _data.writeInt(1); michael@0: writeData.writeToParcel(_data, 0); michael@0: } else { michael@0: _data.writeInt(0); michael@0: } michael@0: mRemote.transact(Stub.TRANSACTION_write, _data, _reply, 0); michael@0: _reply.readException(); michael@0: } finally { michael@0: _reply.recycle(); michael@0: _data.recycle(); michael@0: } michael@0: } michael@0: michael@0: @Override michael@0: public void disconnect(android.os.IBinder clientToken) michael@0: throws android.os.RemoteException { michael@0: android.os.Parcel _data = android.os.Parcel.obtain(); michael@0: try { michael@0: _data.writeInterfaceToken(DESCRIPTOR); michael@0: _data.writeStrongBinder(clientToken); michael@0: mRemote.transact(Stub.TRANSACTION_disconnect, _data, null, michael@0: android.os.IBinder.FLAG_ONEWAY); michael@0: } finally { michael@0: _data.recycle(); michael@0: } michael@0: } michael@0: } michael@0: michael@0: static final int TRANSACTION_write = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0); michael@0: static final int TRANSACTION_disconnect = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1); michael@0: } michael@0: michael@0: public void write(android.os.IBinder clientToken, michael@0: com.googlecode.eyesfree.braille.selfbraille.WriteData writeData) michael@0: throws android.os.RemoteException; michael@0: michael@0: public void disconnect(android.os.IBinder clientToken) michael@0: throws android.os.RemoteException; michael@0: }