我有一个Android应用程序,它可以连接到BLE设备(使用BMD-350),通过通知接收数据并在特征上传输数据.我不知道为什么,但过了一段时间BLE设备自行断开连接,在BondStateChanged回调中报告错误代码8.我可以看到数据直接进入手机,直到它断开连接.BLE设备以大约550字节/秒的速度向手机发送数据.此时手机不会向BLE设备发送任何数据.为什么要断开连接?
*注意:此代码是用C#(Xamarin)编写的,但它与Java对应的代码基本相同.
连接代码:
_bleGatt = device.ConnectGatt(context, false, this);
Run Code Online (Sandbox Code Playgroud)
连接回调:
if (newState == ProfileState.Connected)
{
if (status == GattStatus.Success)
{
gatt.DiscoverServices();
}
}
Run Code Online (Sandbox Code Playgroud)
服务发现:
public override void OnServicesDiscovered(BluetoothGatt gatt, GattStatus status)
{
base.OnServicesDiscovered(gatt, status);
BluetoothGattService mService;
try
{
mService = gatt.GetService(UART_UUID);
}
catch
{
BluetoothConnectionError("UART service not found", gatt.Device);
return;
}
_tx = mService.GetCharacteristic(TX_UUID);
_rx = mService.GetCharacteristic(RX_UUID);
if (_tx == null)
{
BluetoothConnectionError("Tx characteristic not found", gatt.Device);
return;
}
if ((_tx.Properties | GattProperty.WriteNoResponse) == 0 && (_tx.Properties | GattProperty.Write) == 0) …Run Code Online (Sandbox Code Playgroud) 我有一些连接到Android手机的蓝牙设备,但我在检测断线时遇到问题.除非需要,否则蓝牙设备不会发送数据包,因此在数据包接收时使用看门狗来检测断开连接不是一种选择.我已经读过你可以使用ACLDisconnected广播,但是这个事件永远不会为我开火(我等了几分钟).在Android 6中检测断开连接的可靠方法是什么?
这是我的AclDisconnect注册代码:
_filter = new IntentFilter();
_filter.AddAction(BluetoothDevice.ActionFound);
_filter.AddAction(BluetoothDevice.ActionBondStateChanged);
_filter.AddAction(BluetoothAdapter.ActionDiscoveryStarted);
_filter.AddAction(BluetoothDevice.ActionAclDisconnected);
_filter.AddAction(BluetoothDevice.ActionAclDisconnectRequested);
context.RegisterReceiver(_bluetoothDeviceReceiver, _filter);
Run Code Online (Sandbox Code Playgroud)
回调(断开时不触发)
public override void OnReceive(Context context, Intent intent)
{
string action = intent.Action;
if (action == BluetoothDevice.ActionAclDisconnected || action == BluetoothDevice.ActionAclDisconnectRequested)
{
Interlocked.CompareExchange(ref Disconnected, null, null)?.Invoke();
}
}
Run Code Online (Sandbox Code Playgroud) 我无法使用文件夹进行 DevOps 部署,它给了我以下错误:
[错误]错误:找不到具有指定模式的包:d:\a\1\a*.deploy.cmd
检查任务中提到的包是否在构建或上一阶段中作为工件发布并在当前中下载工作。
Azure 应用服务部署任务文档对 Package 参数进行了如下说明:
包的文件路径,或者包含 MSBuild 生成的应用服务内容的文件夹的文件路径,或者压缩的 zip 或 war 文件的文件路径。
这是我的发布任务:
- task: DotNetCoreCLI@2
inputs:
command: publish
publishWebProjects: false
arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)'
zipAfterPublish: false
modifyOutputPath: true
projects: |
src/Company/Project.csproj
Run Code Online (Sandbox Code Playgroud)
和我的部署任务:
- task: AzureRmWebAppDeployment@4
inputs:
ConnectionType: 'PublishProfile'
PublishProfilePath: '$(System.DefaultWorkingDirectory)/src/Company/Properties/PublishProfiles/WebDeploy.pubxml'
PublishProfilePassword: '$(password)'
Package: '$(Build.ArtifactStagingDirectory)/Company'
Run Code Online (Sandbox Code Playgroud)
为什么它要寻找deploy.cmd?我究竟做错了什么?
我们已经在HDFS目录中存储了* .tfrecord文件的列表。我想使用新的Dataset API,但给出的唯一示例是使用旧的filequeue和string_input_producer(https://www.tensorflow.org/deploy/hadoop)。这些方法使得很难产生时期。
是否可以将HDFS与Dataset API结合使用?
android ×2
bluetooth ×2
xamarin ×2
azure ×1
azure-devops ×1
deployment ×1
hdfs ×1
tensorflow ×1