更改Android中蓝牙的MTU或数据包大小? [英] Change the MTU or Packet Size for Bluetooth in Android?
问题描述
如何更改Android中蓝牙的MTU或数据包大小?!使用Android的API是不可能的,对吧?我相信我应该更改本机代码.我该如何更改?是否还可以更改传输速率,还是取决于硬件? 谢谢
How can I change the MTU or Packet Size for Bluetooth in Android?! It is not possible in using Android's API, right? I believe I should change the native codes. How can I change it? And is it also possible to change the transmission rate, or it is hardware dependent? Thanks
推荐答案
是的,您是对的-在Android API中是不可能的.您只能使用networkInterface.getMTU()方法获取接口的MTU值.
Yes, You are right - it is not possible in Android API. You can only get MTU value for an interface with networkInterface.getMTU() method.
基于NetworkInterface类的来源
Based on sources for the NetworkInterface class
public int getMTU() throws SocketException {
return readIntFile("/sys/class/net/" + name + "/mtu");
}
您可能可以更改MTU值(对于有根设备)-您需要将新的int MTU值写入"/sys/class/net/" + networkInterface.getName()+"/mtu"文件.
You probably can change MTU value (for rooted devices) - You need to write new int MTU value to "/sys/class/net/" + networkInterface.getName() + "/mtu" file.
但是我不确定这是否对您来说是可靠的解决方案.
But I'm not sure if it is reliable solution for You.
这篇关于更改Android中蓝牙的MTU或数据包大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!