您现在的位置: 爱51代码网 >> 范文 >> 文章正文
android蓝牙串口连接代码
private static final Method _createRfcommSocket = getMethod(BluetoothDevice.class, "createRfcommSocket", new Class[] { int.class });
private static final Method _createInsecureRfcommSocket = getMethod(BluetoothDevice.class, "createInsecureRfcommSocket", new Class[] { int.class });
private static final Method _setPin = getMethod(BluetoothDevice.class, "setPin", new Class[] { byte[].class });
private static final Method _setPasskey = getMethod(BluetoothDevice.class, "setPasskey", new Class[] { int.class });
private static final Constructor<?> _socketConstructor = getConstructor(BluetoothSocket.class, new Class[] {int.class, int.class, boolean.class, boolean.class, BluetoothDevice.class, int.class, ParcelUuid.class});

public ImprovedBluetoothDevice(BluetoothDevice base) {
if (base == null)
throw new NullPointerException();

mDevice = base;
}毕业论文 

public BluetoothSocket createRfcommSocketToServiceRecord(UUID uuid) throws IOException {
return mDevice.createRfcommSocketToServiceRecord(uuid);
}

public int describeContents() {
return mDevice.describeContents();
}

public String getAddress() {
return mDevice.getAddress();
}

public BluetoothClass getBluetoothClass() {
return mDevice.getBluetoothClass();
}

public int getBondState() {
return mDevice.getBondState();
}

public String getName() {
return mDevice.getName();
}

public String toString() {
return mDevice.toString();
}

public void writeToParcel(Parcel out, int flags) {
mDevice.writeToParcel(out, flags);
}

public BluetoothSocket createRfcommSocket(int channel) throws Exception {
if (_createRfcommSocket == null)
throw new NoSuchMethodException("createRfcommSocket");
try {
return (BluetoothSocket)_createRfcommSocket.invoke(mDevice, channel);
} catch (InvocationTargetException tex) {
if (tex.getCause() instanceof Exception)
throw (Exception)tex.getCause();
else
throw tex;
}
}


public BluetoothSocket createInsecureRfcommSocket(int channel) throws Exception {
if (_createInsecureRfcommSocket == null)
throw new NoSuchMethodException("createInsecureRfcommSocket");

try {
return (BluetoothSocket)_createInsecureRfcommSocket.invoke(mDevice, channel);
} catch (InvocationTargetException tex) {
if (tex.getCause() instanceof Exception)
throw (Exception)tex.getCause();
else
throw tex;
}
}

public BluetoothSocket createLCAPSocket(int channel) throws Exception {
if (_socketConstructor == null)
throw new NoSuchMethodException("new BluetoothSocket");

try {
return (BluetoothSocket)_socketConstructor.newInstance(TYPE_L2CAP, -1, true, true, mDevice, channel, null);
} catch (InvocationTargetException tex) {
if (tex.getCause() instanceof Exception)
throw (Exception)tex.getCause();
else
thro

上一页  [1] [2] [3] [4] [5] [6] 下一页

  • 上一篇文章:

  • 下一篇文章: 没有了
  • 最新文章 热点文章 相关文章
    mysql主从同步延迟方案解决的学习
    青岛科学六年级下册教材分析
    生日旅行总结
    中小板生日快乐随感
    送生日快乐桑葚乳酪小蛋糕
    写给女儿的生日快乐
    总分公司财务核算
    恢复使用繁体字可行性研究报告
    青少年吸烟心理探析
    保险受益人制度相关问题的探讨
    mysql主从同步延迟方案解决的学习
    生日旅行总结
    中小板生日快乐随感
    送生日快乐桑葚乳酪小蛋糕
    写给女儿的生日快乐
    总分公司财务核算
    恢复使用繁体字可行性研究报告
    保险受益人制度相关问题的探讨
    初中生地理读图能力培养的研究
    搞笑生日祝福
    Preview of Qt 5 for Androi
    VS2010 cocos2d-x 工程配置 
    windows正在配置Windows Ins
    班主任的工作技能
    暖通空调施工图存在的问题及
    多媒体在政治教学中的应用
    浅议散文的质与形
    wince6.0拨号错误 错误号666
    关于AT24c02d的连续读写问题
    呼叫中心团队长竞聘演讲稿
     



    设为首页 | 加入收藏 | 网站地图 | 友情链接 |