All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.hypfvieh.bluetooth.wrapper.ProfileHandler Maven / Gradle / Ivy

Go to download

Java native bluetooth library which uses bluez via dbus (linux only). This is the OSGi compliant bundle of all required libraries in one bundle.

The newest version!
package com.github.hypfvieh.bluetooth.wrapper;

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;

import java.util.Map;

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;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy