Back to project page LeBlue.
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.
package houtbecke.rs.le.session; /* ww w . j a v a 2 s .com*/ import houtbecke.rs.le.LeUtil; import static houtbecke.rs.le.session.EventType.*; public class DeviceMockerObject extends MockerObject { public DeviceMockerObject(SessionObject sessionObject, int sessionSource) { super(sessionObject, sessionSource); } public DeviceMockerObject withFakeDeviceListeners() { mockDeviceListeners = true; return this; } public DeviceMockerObject hasRemoteDevices(int... remoteDevices) { return hasRemoteDevices(123, new byte[] {}, remoteDevices); } public DeviceMockerObject hasRemoteDevice(byte[] scanRecord, int remoteDevice) { return hasRemoteDevices(123, scanRecord, remoteDevice); } public DeviceMockerObject hasRemoteDevices(int rssi, byte[] scanRecord, int... remoteDevices) { Event[] events = new Event[remoteDevices.length]; for (int k = 0; k < remoteDevices.length; k++) events[k] = new Event(mockRemoteDeviceFound, EventSinkFiller.DEFAULT_DEVICE_ID, remoteDevices[k]+"", rssi+"", LeUtil.bytesToString(scanRecord)); MockedResponseObject mro = getFirstMockObject(deviceStartScanning); if (mro == null) withMock(deviceStartScanning, new MockedResponseObject(events)); else { mro.addEvents(events); } return this; } }