小编Tem*_*age的帖子

即使在调用disconnect()之后,Android BLE BluetoothGatt对象仍保持连接并触发onCharacteristicChanged()

我正在尝试在退出应用程序时断开特征通知.以下是我在exitCleanup()函数中的操作方法:

if (btGatt != null && mWriteChar != null) {
   boolean b=btGatt.setCharacteristicNotification(mWriteChar, false);
   Log.w("AppInfo", "Exiting and Unsubscribing: " + b);
}
Run Code Online (Sandbox Code Playgroud)

日志显示:Exiting and Unsubscribing: true.到现在为止还挺好.然后,我尝试使用以下方法完全断开GATT对象:

if (btGatt != null && btManager!=null && btManager.getConnectionState(btDevice, BluetoothProfile.GATT) != BluetoothProfile.STATE_DISCONNECTED ) {
    //Making sure that gatt and bt manager are still with us
    //Also making sure that the connection state is NOT disconnected
    btGatt.disconnect();
    btGatt.close();
    Log.w( "AppInfo", "FINISHING. Connection state=" + btManager.getConnectionState(btDevice, BluetoothProfile.GATT) );
}
Run Code Online (Sandbox Code Playgroud)

这是事情变得奇怪的地方.日志现在显示以下内容:FINISHING. Connection state=2,表示BluetoothDevice仍然连接.

这是一个问题,因为当应用程序完成并销毁所有资产时,BluetoothGattCallback仍会继续在幕后接收通知.首先它抛出以下NullPointerException:

04-25 …
Run Code Online (Sandbox Code Playgroud)

android bluetooth-lowenergy gatt

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

调用glDrawArrays后的GL_OUT_OF_MEMORY.为什么?

我的情况似乎很奇怪.我会尝试提供足够的细节,以便比我聪明的人可以解释这一点.基本上这里是设置:

OS: Android 2.2 Froyo
Device: SGS Vibrant
Application: OpenGL-ES 1.1
Run Code Online (Sandbox Code Playgroud)

这就是问题所在:我可以成功渲染一个相当复杂的场景,它可以无限运行几个小时而不会泄漏任何内存.Dalvikvm每隔3-5分钟出现在logcat中一次,除非我尝试退出我的应用程序并再次运行它,否则没有问题.事实上,我可以重启我的应用程序2次,但第三次,我得到了GL_OUT_OF_MEMORY.

我已经跟踪了gl.glDrawArrays()电话中的错误.我可以确认gl.glGetError()在DrawArrays调用之前返回0,并且在DrawArrays调用之后它将返回1285(GL_OUT_OF_MEMORY).

当然,我认为我没有清理资源并释放OpenGL上下文.以下是关闭应用程序时的操作.

for(int x=0; x<buffers.length; x++){
   if(gl.glIsBuffer(buffers[x])){
      gl.glDeleteBuffers(1, buffers, x);
      buffers[x]=0;
   }
}
for(int y=0; y<textures.length; y++){
   if(gl.glIsTexture(textures[y])){
      gl.glDeleteTextures(1, textures, y);
      textures[y]=0;
   }
}
System.out.println("ERROR: "+gl.glGetError());
finish();
Run Code Online (Sandbox Code Playgroud)

当我前两次运行我的应用程序时,我不会在关机时返回任何错误.但是在第3次尝试时,我得到了上述错误,我追踪到了这个问题gl.glDrawArrays().

以下是第3次运行期间发生的事情的简要概述:

  1. 对象1-56 gl.glDrawArrays()通过黄油等热刀进行各自的通话.没有生成错误.

  2. 对象57-64生成GL_OUT_OF_MEMORY错误.对象被渲染,但纹理是黑色的.

我更确定我在应用程序关闭时删除所有缓冲区和纹理.我也相信这个错误不是特定于一个3D模型,因为我试图跳过模型#57,但是#58仍然会得到这个错误.

请帮助,因为我的想法已经用完了!

java android opengl-es

6
推荐指数
2
解决办法
5455
查看次数

无法将 acme.sh 与 tls-alpn-01 一起使用来续订或颁发证书

根据官方 ACME.SH 文档链接,颁发证书就像运行以下命令一样简单:

$ acme.sh --issue --alpn -d example.com
Run Code Online (Sandbox Code Playgroud)

但是,我收到以下错误

Error, can not get domain token entry example.com for `tls-alpn-01`
The supported validation types are `http-01` `dns-01` , but you specified: `tls-alpn-01`
Run Code Online (Sandbox Code Playgroud)

我尝试从默认切换ZeroSSL.comBuyPass.com,但这没有帮助。这些提供商似乎不允许tls-alpn-01验证方法,但这可能与我缺少的东西有关。

PS:抢先回答一些问题:

  1. 我有一个有效的域名,已替换为“example.com”
  2. 该站点在 443 端口上正常工作,但port 80被 ISP 阻止,因此tls-alpn-01
  3. 我正在停止 Nginx,然后检查netstat端口 443 是否未绑定到服务。
  4. 当我使用参数运行脚本时--debug 2,我得到以下_authorizations_map变量值

_authorizations_map='example.com,{"identifier":{"type":"dns","value":"example.com"},"status":"pending","expires":"2021-08-18T22 :53:50Z","挑战":[{"type":"http-01","url":"https://acme.zerossl.com/v2/DV90/chall/wYehJ8kQjUDiDadBJ12qKw","状态": "待处理","令牌":"Sfga2N2KwV-2hg3wo1gYAoyFvqV87dRvG2sHw4I6ups"},{"type":"dns-01","url":"https://acme.zerossl.com/v2/DV90/chall/CkrMQdEJthf-TmWvllW -Bg", "状态":"待处理","令牌":"_AlgMGzIfSQs7673Su-njnpieba_zLpSYxiUdXDEFnz"}]}'

lets-encrypt acme acme.sh

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