Android Open Source - LeBlue Le Interceptor






From Project

Back to project page LeBlue.

License

The source code is released under:

Apache License

If you think the Android project LeBlue 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 houtbecke.rs.le.interceptor;
//from ww w. jav  a 2 s  .c  om
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

import houtbecke.rs.le.LeCharacteristicListener;
import houtbecke.rs.le.LeDevice;
import houtbecke.rs.le.LeDeviceListener;
import houtbecke.rs.le.LeDeviceState;
import houtbecke.rs.le.LeFormat;
import houtbecke.rs.le.LeGattCharacteristic;
import houtbecke.rs.le.LeGattService;
import houtbecke.rs.le.LeGattStatus;
import houtbecke.rs.le.LeRemoteDevice;
import houtbecke.rs.le.LeScanRecord;

public abstract class LeInterceptor {

    // public Map<LeDeviceListener,InterceptingLeDeviceListener> iListeners = new HashMap<>();
    public Map<LeDevice, InterceptingLeDevice> iDevices = new HashMap<>();
    public Map<LeDeviceListener, InterceptingLeDeviceListener> iDeviceListeners = new HashMap<>();
    public Map<LeRemoteDevice, InterceptingLeRemoteDevice> iRemoteDevices = new HashMap<>();
    public Map<LeGattService, InterceptingLeGattService> iGattServices = new HashMap<>();
    public Map<LeGattCharacteristic, InterceptingLeGattCharacteristic> iGattCharacteristics = new HashMap<>();
    public Map<LeCharacteristicListener, InterceptingLeCharacteristicListener> iCharacteristicListeners = new HashMap<>();


    public InterceptingLeRemoteDevice getInterceptingLeRemoteDevice(LeRemoteDevice leRemoteDevice) {
        InterceptingLeRemoteDevice iRemoteDevice = iRemoteDevices.get(leRemoteDevice);
        if (iRemoteDevice == null) {
            iRemoteDevice = new InterceptingLeRemoteDevice(leRemoteDevice, this);
            iRemoteDevices.put(leRemoteDevice, iRemoteDevice);
        }
        return iRemoteDevice;
    }

    public InterceptingLeDevice getInterceptingLeDevice(LeDevice leDevice) {
        InterceptingLeDevice device = iDevices.get(leDevice);
        if (device == null) {

            System.out.println("Warning: unknown LeDevice");
        }
        return device;
    }

    public InterceptingLeDeviceListener getInterceptingLeDeviceListener(LeDeviceListener listener) {
        InterceptingLeDeviceListener iDeviceListener= iDeviceListeners.get(listener);
        if (iDeviceListener == null) {
            iDeviceListener = new InterceptingLeDeviceListener(listener, this);
            iDeviceListeners.put(listener, iDeviceListener);
        }
        return iDeviceListener;
    }

    public InterceptingLeGattService getInterceptingLeGattService(LeGattService leGattService) {
        InterceptingLeGattService iLeGattService = iGattServices.get(leGattService);
        if (iLeGattService == null) {
            iLeGattService = new InterceptingLeGattService(leGattService, this);
            iGattServices.put(leGattService, iLeGattService);
        }
        return iLeGattService;

    }

    public InterceptingLeGattCharacteristic serviceGotCharacteristic(InterceptingLeGattService iLeGattService, LeGattCharacteristic leGattCharacteristic) {
        InterceptingLeGattCharacteristic iLeGattCharacteristic = iGattCharacteristics.get(leGattCharacteristic);
        if (iLeGattCharacteristic == null) {
            iLeGattCharacteristic = new InterceptingLeGattCharacteristic(leGattCharacteristic, this);
            iGattCharacteristics.put(leGattCharacteristic, iLeGattCharacteristic);
        }
        return iLeGattCharacteristic;
    }

    public InterceptingLeCharacteristicListener getInterceptingCharacteristicsListener(LeCharacteristicListener listener) {
        InterceptingLeCharacteristicListener iLeCharacteristicListener = iCharacteristicListeners.get(listener);
        if (iLeCharacteristicListener == null) {
            iLeCharacteristicListener = new InterceptingLeCharacteristicListener(listener, this);
            iCharacteristicListeners.put(listener, iLeCharacteristicListener);
        }
        return iLeCharacteristicListener;
    }

    public InterceptingLeGattCharacteristic getInterceptingLeGattCharacteristic(LeGattCharacteristic characteristic) {
        InterceptingLeGattCharacteristic iLeGattCharacteristic = iGattCharacteristics.get(characteristic);
        if (iLeGattCharacteristic == null) {
            iLeGattCharacteristic = new InterceptingLeGattCharacteristic(characteristic, this);
            iGattCharacteristics.put(characteristic, iLeGattCharacteristic);
        }
        return iLeGattCharacteristic;
    }

    public volatile int counter = 0;

    public abstract void listenerAdded(InterceptingLeDevice iLeDevice, InterceptingLeDeviceListener iListener);

    public abstract void deviceFound(InterceptingLeDeviceListener iLeDeviceListener, InterceptingLeDevice iLeDevice, InterceptingLeRemoteDevice ileRemoteDevice, int rssi, LeScanRecord scanrecord);

    public abstract void deviceState(InterceptingLeDeviceListener iLeDeviceListener, InterceptingLeDevice iLeDevice,LeDeviceState deviceState);

    public abstract void connected(InterceptingLeRemoteDeviceListener iLeRemoteDeviceListener, InterceptingLeDevice iLeDevice, InterceptingLeRemoteDevice iLeRemoteDevice);

    public abstract void disconnected(InterceptingLeRemoteDeviceListener iLeRemoteDeviceListener, InterceptingLeDevice iLeDevice, InterceptingLeRemoteDevice iLeRemoteDevice);

    public abstract void closed(InterceptingLeDevice iLeDevice, InterceptingLeRemoteDevice iLeRemoteDevice);

    public abstract void gotUUID(InterceptingLeGattService iLeGattService, UUID uuid);

    public abstract void enabledCharacteristicNotification(InterceptingLeGattService iLeGattService, UUID characteristic, boolean enabled);

    public abstract void servicesDiscovered(InterceptingLeRemoteDeviceListener iLeRemoteDeviceListener, InterceptingLeDevice iLeDevice, InterceptingLeRemoteDevice iLeRemoteDevice, LeGattStatus status, InterceptingLeGattService[] iLeGattServices);

    public abstract void listenerRemoved(InterceptingLeDevice iLeDevice);

    public abstract void checkedBleHardwareAvailable(InterceptingLeDevice iLeDevice, boolean bleHardwareEnabled);

    public abstract void wasBtEnabled(InterceptingLeDevice iLeDevice, boolean btEnabled);

    public abstract void startedScanning(InterceptingLeDevice iLeDevice);

    public abstract void startedScanning(InterceptingLeDevice iLeDevice, UUID[] uuids);

    public abstract void stoppedScanning(InterceptingLeDevice iLeDevice);

    public abstract void gotValue(InterceptingLeGattCharacteristic iLeGattCharacteristic, byte[] value);

    public abstract void gotIntValue(InterceptingLeGattCharacteristic iLeGattCharacteristic, LeFormat format, int value);

    public abstract void remoteListenerAdded(InterceptingLeRemoteDevice iLeRemoteDevice, InterceptingLeRemoteDeviceListener iListener);

    public abstract void remoteListenerRemoved(InterceptingLeRemoteDevice iLeRemoteDevice, InterceptingLeRemoteDeviceListener iListener);

    public abstract void gotAddress(InterceptingLeRemoteDevice iLeRemoteDevice, String address);

    public abstract void connecting(InterceptingLeRemoteDevice iLeRemoteDevice);

    public abstract void disconnecting(InterceptingLeRemoteDevice iLeRemoteDevice);

    public abstract void closing(InterceptingLeRemoteDevice iLeRemoteDevice);

    public abstract void serviceDiscoveryStarted(InterceptingLeRemoteDevice iLeRemoteDevice);

    public abstract void gotRemoteDeviceName(InterceptingLeRemoteDevice iLeRemoteDevice, String name);

    public abstract void characteristicChanged(InterceptingLeCharacteristicListener iLeCharacteristicListener, UUID uuid, InterceptingLeRemoteDevice iLeRemoteDevice, InterceptingLeGattCharacteristic iLeGattCharacteristic);

    public abstract void characteristicListenerSet(InterceptingLeRemoteDevice iLeRemoteDevice, InterceptingLeCharacteristicListener iCharacteristicsListener, UUID[] uuids);

    public abstract void setValue(InterceptingLeGattCharacteristic interceptingLeGattCharacteristic, byte[] value);

    public abstract void gotCharacteristic(InterceptingLeGattService iLeGattService, InterceptingLeGattCharacteristic iLeGattCharacteristic);

    public abstract void rssiRead(InterceptingLeRemoteDeviceListener iLeRemoteDeviceListener, InterceptingLeDevice iLeDevice, InterceptingLeRemoteDevice iLeRemoteDevice, int rssi);

    public abstract void readRssi(InterceptingLeRemoteDevice iLeRemoteDevice);

}




Java Source Code List

houtbecke.rs.le.BleException.java
houtbecke.rs.le.LeCharacteristicListener.java
houtbecke.rs.le.LeDefinedUUIDs.java
houtbecke.rs.le.LeDeviceListener.java
houtbecke.rs.le.LeDeviceState.java
houtbecke.rs.le.LeDevice.java
houtbecke.rs.le.LeFormat.java
houtbecke.rs.le.LeGattCharacteristic.java
houtbecke.rs.le.LeGattDescriptorValue.java
houtbecke.rs.le.LeGattDescriptor.java
houtbecke.rs.le.LeGattService.java
houtbecke.rs.le.LeGattStatus.java
houtbecke.rs.le.LeRecord.java
houtbecke.rs.le.LeRemoteDeviceListener.java
houtbecke.rs.le.LeRemoteDevice.java
houtbecke.rs.le.LeScanRecordImpl.java
houtbecke.rs.le.LeScanRecord.java
houtbecke.rs.le.LeUtil.java
houtbecke.rs.le.dummy.DummyLeRemoteDevice.java
houtbecke.rs.le.example.MainActivity.java
houtbecke.rs.le.fourdotthree.LeDevice43.java
houtbecke.rs.le.fourdotthree.LeGattCharacteristic43.java
houtbecke.rs.le.fourdotthree.LeGattService43.java
houtbecke.rs.le.fourdotthree.LeRemoteDevice43.java
houtbecke.rs.le.interceptor.AndroidEventSinkUtil.java
houtbecke.rs.le.interceptor.BaseIntercepting.java
houtbecke.rs.le.interceptor.EventSinkUtil.java
houtbecke.rs.le.interceptor.InterceptingLeCharacteristicListener.java
houtbecke.rs.le.interceptor.InterceptingLeDeviceListener.java
houtbecke.rs.le.interceptor.InterceptingLeDevice.java
houtbecke.rs.le.interceptor.InterceptingLeGattCharacteristic.java
houtbecke.rs.le.interceptor.InterceptingLeGattService.java
houtbecke.rs.le.interceptor.InterceptingLeRemoteDeviceListener.java
houtbecke.rs.le.interceptor.InterceptingLeRemoteDevice.java
houtbecke.rs.le.interceptor.LeInterceptor.java
houtbecke.rs.le.interceptor.LeLogCatInterceptor.java
houtbecke.rs.le.interceptor.LeSessionInterceptor.java
houtbecke.rs.le.mock.LeDeviceMock.java
houtbecke.rs.le.mock.LeGattCharacteristicMock.java
houtbecke.rs.le.mock.LeGattServiceMock.java
houtbecke.rs.le.mock.LeMockController.java
houtbecke.rs.le.mock.LeRemoteDeviceMock.java
houtbecke.rs.le.mock.LeSessionController.java
houtbecke.rs.le.mock.NativeWaitNotify.java
houtbecke.rs.le.mock.SimpleWaitNotify.java
houtbecke.rs.le.mock.WaitNotify.java
houtbecke.rs.le.session.CharacteristicsMockerObject.java
houtbecke.rs.le.session.DeviceMockerObject.java
houtbecke.rs.le.session.EventSinkFiller.java
houtbecke.rs.le.session.EventSink.java
houtbecke.rs.le.session.EventSource.java
houtbecke.rs.le.session.EventType.java
houtbecke.rs.le.session.Event.java
houtbecke.rs.le.session.GattServiceMockerObject.java
houtbecke.rs.le.session.ListEventSinkSource.java
houtbecke.rs.le.session.MockedResponseObject.java
houtbecke.rs.le.session.MockedResponse.java
houtbecke.rs.le.session.MockerObject.java
houtbecke.rs.le.session.Mocker.java
houtbecke.rs.le.session.RemoteDeviceMockerObject.java
houtbecke.rs.le.session.SessionObject.java
houtbecke.rs.le.session.Session.java