Android Open Source - BluetoothHidEmu Spoof






From Project

Back to project page BluetoothHidEmu.

License

The source code is released under:

Apache License

If you think the Android project BluetoothHidEmu listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package andraus.bluetoothhidemu.spoof;
/*from  w  w  w  . j a  v  a2s . c o m*/
public final class Spoof {
    public static enum SpoofMode { INVALID, HID_GENERIC, HID_PS3KEYPAD, HID_BDREMOTE }
    
    private static final int DEV_CLASS_HID_GENERIC = 0x002540;
    private static final int DEV_CLASS_HID_BDREMOTE = 0x000140;

    /**
     * Must match "emulation_mode_names" / "emulation_mode_values" in arrays.xml
     * @param mode
     * @return
     */
    public static int intValue(SpoofMode mode) {
        
        switch (mode) {
        case INVALID: return -1;
        case HID_GENERIC: return 0;
        case HID_PS3KEYPAD: return 1;
        case HID_BDREMOTE: return 2;
        default: return errorInvalidMode(mode);
        }
        
    }
    
    /**
     * 
     * @param i
     * @return
     */
    public static SpoofMode fromInt(int i) {
        
        for (SpoofMode mode : SpoofMode.values()) {
            if (intValue(mode) == i) {
                return mode;
            }
        }
        
        return null;
    }
    
    /**
     * Returns device class in format 0xAABBCC for the corresponding spoof mode.
     * 
     * @param mode
     * @return
     */
    public static int getBluetoothDeviceClass(SpoofMode mode) {
        
        switch (mode) {
        case HID_GENERIC: return DEV_CLASS_HID_GENERIC;
        case HID_BDREMOTE: return DEV_CLASS_HID_BDREMOTE;
        case HID_PS3KEYPAD: return DEV_CLASS_HID_GENERIC; // same as generic
        default: return errorInvalidMode(mode);
        }
        
    }
    
    private static int errorInvalidMode(SpoofMode mode) {
        throw new IllegalStateException("Invalid spoof mode: " + mode);
    }
}




Java Source Code List

andraus.bluetoothhidemu.BluetoothHidEmuActivity.java
andraus.bluetoothhidemu.ButtonClickListener.java
andraus.bluetoothhidemu.Constants.java
andraus.bluetoothhidemu.KeyboardKeyListener.java
andraus.bluetoothhidemu.KeyboardTextWatcher.java
andraus.bluetoothhidemu.SpecialKeyListener.java
andraus.bluetoothhidemu.TouchpadListener.java
andraus.bluetoothhidemu.settings.BluetoothAdapterStateReceiver.java
andraus.bluetoothhidemu.settings.BluetoothDeviceStateReceiver.java
andraus.bluetoothhidemu.settings.Settings.java
andraus.bluetoothhidemu.sock.BluetoothSocketThread.java
andraus.bluetoothhidemu.sock.SocketManager.java
andraus.bluetoothhidemu.sock.payload.HidConsumerPayload.java
andraus.bluetoothhidemu.sock.payload.HidKeyPair.java
andraus.bluetoothhidemu.sock.payload.HidKeyboardPayload.java
andraus.bluetoothhidemu.sock.payload.HidPayload.java
andraus.bluetoothhidemu.sock.payload.HidPointerPayload.java
andraus.bluetoothhidemu.sock.payload.HidSixaxisPayload.java
andraus.bluetoothhidemu.spoof.BluetoothAdapterSpooferFactory.java
andraus.bluetoothhidemu.spoof.BluetoothAdapterSpooferGeneric.java
andraus.bluetoothhidemu.spoof.BluetoothAdapterSpooferMotoReflect.java
andraus.bluetoothhidemu.spoof.BluetoothAdapterSpooferMoto.java
andraus.bluetoothhidemu.spoof.BluetoothAdapterSpoofer.java
andraus.bluetoothhidemu.spoof.CleanupExceptionHandler.java
andraus.bluetoothhidemu.spoof.Spoof.java
andraus.bluetoothhidemu.spoof.jni.BluetoothSocketJni.java
andraus.bluetoothhidemu.ui.GenericUiControls.java
andraus.bluetoothhidemu.ui.Ps3KeypadUiControls.java
andraus.bluetoothhidemu.ui.UiControls.java
andraus.bluetoothhidemu.util.DoLog.java
andraus.bluetoothhidemu.view.ArrowButton.java
andraus.bluetoothhidemu.view.BluetoothDeviceArrayAdapter.java
andraus.bluetoothhidemu.view.BluetoothDeviceView.java
andraus.bluetoothhidemu.view.EchoEditText.java
andraus.bluetoothhidemu.view.ViewUtils.java