调用InTheHand.Net.Personal.dll实现蓝牙虚拟串口编程
By
admin
at 2021-11-13 • 0人收藏 • 401人看过
InTheHand.Net.Personal.dll 是由32feet.NET提供的开源控件, 将蓝牙连接转为系统上的虚拟串口,然后提供给其他程序或库使用.
现在在aardio中调用c#程序集dll已经非常方便了 , 偶然想起来之前有坛友提问过蓝牙控制, 那次调用的貌似是c++的一个dll , 最终曲线救国, 勉强能用, 然后我搜索了下c#的蓝牙控制, 发现了这个dll , 简单的看了下文档, 使用应该没问题.
通过vs的包管理器,可以在线安装到系统中
Install-Package 32feet.NET
详细的使用教程:
http://tisyang.github.io/post/2016-05-27-bluetooth-serialport-with-32feet-net-library/
在aardio中简单测试如下
import win.ui;
/*DSG{{*/
var winform = win.form(text="aardio form";right=759;bottom=469)
winform.add()
/*}}*/
import console
console.open()
import dotNet;
var blueDll = dotNet.load("\InTheHand.Net.Personal.dll");
var findBlue = function(){
var bc;
var ret = true;
try{
bc = blueDll.new("InTheHand.Net.Sockets.BluetoothClient");
}
catch(e){
ret = false;
}
if(bc){
bc.Close();
}
return ret;
}
console.log( findBlue() )
winform.show();
win.loopMessage();这里主要是记录一下, 万一后面有用上呢 , 其他测试代码楼下慢慢写吧.
登录后方可回帖