public FallbackBluetoothSocket(BluetoothSocket tmp, boolean isSecure) throws FallbackException {
super(tmp);
try {
Class<?> clazz = tmp.getRemoteDevice().getClass();
Class<?>[] paramTypes = new Class<?>[]{Integer.TYPE};
String methodName = "createInsecureRfcommSocket";
if (isSecure)
methodName = "createRfcommSocket";
Method m = clazz.getMethod(methodName, paramTypes);
Object[] params = new Object[]{Integer.valueOf(1)};
fallbackSocket = (BluetoothSocket) m.invoke(tmp.getRemoteDevice(), params);
} catch (Exception e) {
throw new FallbackException(e);
}
}
BluetoothConnector.java 文件源码
java
阅读 46
收藏 0
点赞 0
评论 0
项目:LittleBitLouder
作者:
评论列表
文章目录