com.github.hypfvieh.bluetooth.wrapper.ProfileHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bluez-dbus-osgi Show documentation
Show all versions of bluez-dbus-osgi Show documentation
Java native bluetooth library which uses bluez via dbus (linux only).
This is the OSGi compliant bundle of all required libraries in one bundle.
package com.github.hypfvieh.bluetooth.wrapper;
import java.util.Map;
import org.bluez.Profile1;
import org.bluez.exceptions.BluezCanceledException;
import org.bluez.exceptions.BluezRejectedException;
import org.freedesktop.dbus.DBusPath;
import org.freedesktop.dbus.FileDescriptor;
import org.freedesktop.dbus.types.Variant;
public final class ProfileHandler implements Profile1 {
private final String objectPath;
private final ProfileChangeListener profileChangeListener;
public ProfileHandler(String _objectPath, ProfileChangeListener _profileChangeListener) {
this.objectPath = _objectPath;
this.profileChangeListener = _profileChangeListener;
}
@Override
public void NewConnection(DBusPath _device, FileDescriptor _fd, Map> _fdProperties) throws BluezRejectedException, BluezCanceledException {
profileChangeListener.onProfileConnection(_device.getPath(), _fd, _fdProperties);
}
@Override
public void Release() {
profileChangeListener.onProfileRelease();
}
@Override
public void RequestDisconnection(DBusPath _device) throws BluezRejectedException, BluezCanceledException {
profileChangeListener.onProfileDisconnectRequest(_device.getPath());
}
@Override
public String getObjectPath() {
return objectPath;
}
@Override
public boolean isRemote() {
return false;
}
}