java - 我想知道如何显示服务
问题描述
我目前正在研究一种bluetooth
芯片,我想展示它的功能。
我正在尝试该方法getService();
,但这个方法返回给我null
private final BluetoothGattCallback mGattCallback =
new BluetoothGattCallback() {
@Override
public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
String intentAction;
if (newState == BluetoothProfile.STATE_CONNECTED) {
intentAction = ACTION_GATT_CONNECTED;
mConnectionState = STATE_CONNECTED;
broadcastUpdate(intentAction);
Log.i(TAG, "Connected to GATT server.");
Log.i(TAG, "Attempting to start service discovery:" +
mBluetoothGatt.discoverServices());
Log.i(TAG, "Attempting to start service discovery:" +
mBluetoothGatt.getService(UUID.fromString(SampleGattAttributes.UUID_Address)));
} else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
intentAction = ACTION_GATT_DISCONNECTED;
mConnectionState = STATE_DISCONNECTED;
Log.i(TAG, "Disconnected from GATT server.");
broadcastUpdate(intentAction);
}
}
};
我想在日志中显示特征列表。预先感谢您的帮助
解决方案
推荐阅读
- github - Taiga webhook 在 Github 中返回了无效的 Json,但它似乎有效?
- javascript - 如果它在函数内部,则无法存储在 Firebase 内部
- javascript - 点击需要click elementbyid
- html - 如何创建具有正确缩进的自定义 HTML li 点
- visual-studio-code - 如何在resolveCodeLens 中过滤镜头?
- .htaccess - 使用 .htaccess 重定向到页面
- python - 如何在 Scipy 中移动图像?
- jenkins - Jenkins 角色策略插件和多分支管道
- javascript - 为什么将样式添加到所有对象,而不是选定对象
- python - 将空列表保留在同一索引中,同时展平列表 ot 列表(嵌套列表)