blob: 574a44316344739ffd232f328fa73c56d87025a5 [file] [log] [blame]
package io.v.android.libs.discovery.ble;
import io.v.impl.google.lib.discovery.ScanHandler;
import io.v.x.ref.lib.discovery.Advertisement;
/**
* An implementation of the ScanHandler for use by the discovery frameework.
*/
class NativeScanHandler implements ScanHandler{
/**
* A pointer to the the native channel.
*/
private long nativeChan;
NativeScanHandler(long nativeChan) {
this.nativeChan = nativeChan;
}
private native void nativeHandleUpdate(Advertisement adv, long chan);
private native void nativeCleanup(long chan);
@Override
public void handleUpdate(Advertisement advertisement) {
nativeHandleUpdate(advertisement, nativeChan);
}
@Override
protected void finalize() throws Throwable {
nativeCleanup(nativeChan);
}
}