小编Ben*_*our的帖子

如何获取有关Java中连接/配对蓝牙设备的信息?

我是蓝牙的初学者.我正在尝试使用Bluecove和Java.我想与已经连接/配对到我的计算机的设备进行通信(例如检索设备电池电量).问题是我找不到连接的设备.

我知道我可以拥有本地设备,检索设备等,但我无法连接设备.我正在使用此处找到的代码.

如果需要,我准备尝试另一个库.

在BluetoothDevices.java中:

import javax.swing.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class BluetoothDevices extends javax.swing.JFrame {

    /* DefaultListModel to attach it with JList */
    private DefaultListModel defaultModel;
    /* Map to get device details list */
    private Map<String, List<String>> mapReturnResult = new HashMap<String, List<String>>();
    /* Map to identify device on user click of JList */
    private Map<Integer, List<String>> mapDevicePosition = new HashMap<Integer, List<String>>();

    public BluetoothDevices() {
        initComponents();
        defaultModel = new DefaultListModel();
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated …
Run Code Online (Sandbox Code Playgroud)

java macos bluetooth bluecove

8
推荐指数
1
解决办法
1498
查看次数

标签 统计

bluecove ×1

bluetooth ×1

java ×1

macos ×1