我是 Flutter 新手,想测试 Flutter Blue 提供的一些 BLE 功能。我已经启动并运行了示例应用程序,它发现我周围有很多设备。问题是我无法连接到其中任何一个。我目前正在使用第二部手机来模拟 BLE 外设,所有其他软件(例如 nRF Connect for Mobile)都能够连接到外设并读取其提供的数据。Flutter Blue 示例应用程序在尝试连接到设备时卡在断开连接状态。
以下是尝试连接时的典型控制台输出:
D/BluetoothGatt( 6359): connect() - device: 73:B9:9F:25:67:DC, auto: true
D/BluetoothGatt( 6359): registerApp()
D/BluetoothGatt( 6359): registerApp() - UUID=44fdc1ff-3804-4ae2-ab52-3f3b6eb31e17
D/BluetoothGatt( 6359): onClientRegistered() - status=0 clientIf=7
D/BluetoothGatt( 6359): onAutoConnectionStatusCb()status =10
D/BluetoothGatt( 6359): close()
Run Code Online (Sandbox Code Playgroud)
我已经成功地连接到模拟外围设备几次,首先通过不同的应用程序连接,然后与 Flutter 应用程序“连接”。这是输出:
D/BluetoothGatt( 6359): connect() - device: 73:B9:9F:25:67:DC, auto: true
D/BluetoothGatt( 6359): registerApp()
D/BluetoothGatt( 6359): registerApp() - UUID=201eaf3d-ab8a-402e-9cbf-232527fa53a8
D/BluetoothGatt( 6359): onClientRegistered() - status=0 clientIf=8
D/BluetoothGatt( 6359): onAutoConnectionStatusCb()status =10
D/BluetoothGatt( 6359): onClientConnectionState() - status=0 …Run Code Online (Sandbox Code Playgroud) 我正在寻找一种在满足某些条件的情况下在应用启动时从NavigationView在WatchOS应用程序中“以一个级别”显示视图的方法。
我希望获得与我自己按下NavigationLink相同的效果,即能够再次返回NavigationView,如果我选择立即显示所需的视图,则无法实现。
WatchOS也无法使用“ navigationBarItems”,这使得如果不首先单击NavigationLink就无法向后导航。
是否可以通过编程方式“单击” NavigationLink来实现此目的?