标签: ancs

ANCS是否支持向多个BLE设备发送通知?

多个设备与同一个iPhone配对,但只有一个接收ANCS通知.

ios ancs

6
推荐指数
1
解决办法
335
查看次数

在Android上订阅ANCS

根据此处列出的服务,我正在尝试从Android设备订阅服务,但无法使请求部分起作用。尝试使用做广告,7905F431-B5CE-4E99-A40F-4B1E122D00D0但外围设备未显示在iPhone的蓝牙设备列表中。还可以与(LE)扫描和过滤器一起使用,以发现运气好的ANCS服务器。有什么提示吗?

编辑:代码

BleService.java

public void setCharacteristicNotification(BluetoothGattCharacteristic characteristic,
                                          boolean enabled) {
    Log.d(TAG, "setCharacteristicNotification");
    if (mBluetoothAdapter == null || mBluetoothGatt == null) {
        Log.w(TAG, "BluetoothAdapter not initialized");
        return;
    }
    mBluetoothGatt.setCharacteristicNotification(characteristic, enabled);
    BluetoothGattDescriptor descriptor = characteristic.getDescriptor(UUID.fromString(SampleGattAttributes.DESCRIPTOR));
    descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
    mBluetoothGatt.writeDescriptor(descriptor)
}

@Override
public void onServicesDiscovered(BluetoothGatt gatt, int status) {
    if (status == BluetoothGatt.GATT_SUCCESS) {
        broadcastUpdate(ACTION_GATT_SERVICES_DISCOVERED);
    }
}
Run Code Online (Sandbox Code Playgroud)

SampleGattAttributes.java

public class SampleGattAttributes {
    public static String ANCS_SERVICE = "7905F431-B5CE-4E99-A40F-4B1E122D00D0";
    public static String NOTIFICATION_SOURCE = "9FBF120D-6301-42D9-8C58-25E699A21DBD";
    public static String DATA_CONTROL = "22EAC6E9-24D6-4BB5-BE44-B36ACE7C7BFB";
    public …
Run Code Online (Sandbox Code Playgroud)

notifications android ios bluetooth-lowenergy ancs

5
推荐指数
1
解决办法
794
查看次数

由于Python而无法构建节点包

这似乎是一个已解决的帖子,只是为了帮助遇到同样问题的人。

我试图安装 Nobel(ancs 的依赖项)并遇到问题

$ npm install -g noble
npm WARN optional dep failed, continuing xpc-connection@0.1.3

> noble@0.3.13 install /usr/local/lib/node_modules/noble
> node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: spawn /path/to/executable/python2.7 ENOENT
gyp ERR! stack     at exports._errnoException (util.js:746:11)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
gyp ERR! stack     at child_process.js:1144:20
gyp ERR! stack     at process._tickCallback (node.js:355:11)
gyp ERR! System Linux 3.19.3-3-ARCH
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/noble
gyp ERR! node -v v0.12.2
gyp ERR! node-gyp …
Run Code Online (Sandbox Code Playgroud)

python npm ancs

4
推荐指数
1
解决办法
4370
查看次数

ANCS 客户端:接收通知的基本程序是什么?

我正在尝试使用 BlueZ 堆栈(最新版本,5.39)在 Linux 上用 C 语言实现 ANCS 客户端。到目前为止,我可以使用Apple提供的服务请求UUID设置BLE广告数据。

我的设备确实出现在 iPhone (iOS 9) 设置中。我也可以连接到设备,但连接非常不稳定,这意味着有时会在一段时间后,并且总是当我关闭 iPhone 上的蓝牙设置子菜单时,连接会终止。它也没有绑定,断开连接后,设备没有显示在 iPhone 上的“我的设备”下。

我查看了hcidump,显然只是读取了一堆ATT数据,然后停了下来:

Pastebin 链接,因为它没有在此处正确格式化

连接终止后是输出 pastebin 的下部。

现在,我的问题是,创建一个接收来自 iOS 设备通知的 ANCS 客户端的下一步是什么?我已经阅读了无数关于 BLE 和 ANCS 的文章和示例代码,但我仍然一无所知。

我是否必须在我的 C 代码中打开一个 L2CAP 套接字才能接受来自 iPhone 的连接?我已经试过了,没有用。我还尝试使用 gatttool 连接到 iPhone,而它已连接,但它显示“资源或设备繁忙”。

我会非常感谢在正确方向上的一些指示,下一步该怎么做。

bluetooth ios bluez gatt ancs

3
推荐指数
1
解决办法
2038
查看次数

如何使用 IOBluetooth/CoreBluetooth 的服务请求?

我想要做的是在 Mac 上使用 iPhone 上的 Apple 通知中心服务 (ANCS)。为了让我的 Mac 出现在我 iPhone 的蓝牙设置中,我显然需要使用服务请求。

到目前为止我所尝试的是CBPeripheralManager在我的 Mac 上启动一个,向它添加 ANCS 服务并开始做广告。这似乎不行,因为我的 Mac 没有出现在我 iPhone 的蓝牙设置中。我还尝试过启动CBCentralManager并开始扫描,CBCentralManagerScanOptionSolicitedServiceUUIDsKey密钥中包含 ANCS UUID ,这也不起作用。

有没有人知道如何做到这一点?我花了大量时间观看 WWDC 视频并浏览 Apple 的文档,但除了对“服务请求”的一些模糊提及之外,我找不到它。

谢谢!

macos iobluetooth ios core-bluetooth ancs

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