APISonar


com.android.accessorydisplay.common.Logger.log

> com > android > accessorydisplay > common > Logger > log
com APIs android APIs accessorydisplay APIs common APIs Logger APIs log APIs

Example 1
private Logger mLogger;

    private void disconnect() {
        mLogger.log("Disconnecting from accessory: " + mAccessory);
        stopServices();

        mLogger.log("Disconnected.");
        mConnected = false;
        mAccessory = null;
        if (mTransport != null) {
            mTransport.close();
            mTransport = null;
        }
    }
Example 2
private Logger mLogger;

    private void onAccessoryDetached(UsbAccessory accessory) {
        mLogger.log("USB accessory detached: " + accessory);
        if (mConnected && accessory.equals(mAccessory)) {
            disconnect();
        }
    }
Example 3
private Logger mLogger;

    private void onDeviceDetached(UsbDevice device) {
        mLogger.log("USB device detached: " + device);
        if (mConnected && device.equals(mDevice)) {
            disconnect();
        }
    }
Example 4
private final Logger mLogger;

    public boolean onTouchEvent(MotionEvent event) {
        mLogger.log("Received touch event: " + event);
        return super.onTouchEvent(event);
    }
Example 5
private Logger mLogger;

    private void sendString(UsbDeviceConnection conn, int index, String string) {
        byte[] buffer = (string + "\0").getBytes();
        int len = conn.controlTransfer(UsbConstants.USB_DIR_OUT | UsbConstants.USB_TYPE_VENDOR,
                UsbAccessoryConstants.ACCESSORY_SEND_STRING, 0, index,
                buffer, buffer.length, 10000);
        if (len != buffer.length) {
            mLogger.logError("Failed to send string " + index + ": \"" + string + "\"");
        } else {
            mLogger.log("Sent string " + index + ": \"" + string + "\"");
        }
    }