DroidtoothPlugin.java 文件源码

java
阅读 39 收藏 0 点赞 0 评论 0

项目:Nird2 作者:
@Override
public KeyAgreementListener createKeyAgreementListener(byte[] commitment) {
    if (!isRunning()) return null;
    // There's no point listening if we can't discover our own address
    String address = AndroidUtils.getBluetoothAddress(appContext, adapter);
    if (address.isEmpty()) return null;
    // No truncation necessary because COMMIT_LENGTH = 16
    UUID uuid = UUID.nameUUIDFromBytes(commitment);
    if (LOG.isLoggable(INFO)) LOG.info("Key agreement UUID " + uuid);
    // Bind a server socket for receiving invitation connections
    BluetoothServerSocket ss;
    try {
        ss = adapter.listenUsingInsecureRfcommWithServiceRecord(
                "RFCOMM", uuid);
    } catch (IOException e) {
        if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
        return null;
    }
    BdfList descriptor = new BdfList();
    descriptor.add(TRANSPORT_ID_BLUETOOTH);
    descriptor.add(StringUtils.macToBytes(address));
    return new BluetoothKeyAgreementListener(descriptor, ss);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号