# InTheHand.Net 库模块帮助文档

## InTheHand.Net 成员列表 <a id="InTheHand.Net" href="#InTheHand.Net">&#x23;</a>

.NET 命名空间 InTheHand.Net 。  
最低要求 .NET 4.6.2 ，Win10 1607 开始系统自带 。  
用于经典蓝牙，低耗电蓝牙请改用 InTheHand.Bluetooth 库。

### InTheHand.Net.* <a id="InTheHand.Net.any" href="#InTheHand.Net.any">&#x23;</a>
.NET 命名空间、类、结构体的成员，  
可访问成员命名空间、类、枚举、静态属性或字段，  
导入的类可用于构造 .NET 对象，传回 .NET 则自动转为该类的 Type 对象  

[返回对象:dotNetNameSpaceObject](https://www.aardio.com/zh-cn/docs/library-reference/dotNet/appDomain.html#dotNetNameSpaceObject)

### InTheHand.Net.BluetoothEndPoint(bluetoothAddress,serviceId,port) <a id="InTheHand.Net.BluetoothEndPoint" href="#InTheHand.Net.BluetoothEndPoint">&#x23;</a>
创建蓝牙端点

### InTheHand.Net.assembly <a id="InTheHand.Net.assembly" href="#InTheHand.Net.assembly">&#x23;</a>
导入此 .NET 命名空间的程序集对象。  

[返回对象:dotNetCrlAssemblyObject](https://www.aardio.com/zh-cn/docs/library-reference/dotNet/appDomain.html#dotNetCrlAssemblyObject)

## InTheHand.Net.Bluetooth.BluetoothAddress 成员列表 <a id="InTheHand.Net.Bluetooth.BluetoothAddress" href="#InTheHand.Net.Bluetooth.BluetoothAddress">&#x23;</a>

### InTheHand.Net.Bluetooth.BluetoothAddress.Parse("字符串参数") <a id="InTheHand.Net.Bluetooth.BluetoothAddress.Parse" href="#InTheHand.Net.Bluetooth.BluetoothAddress.Parse">&#x23;</a>
字符串参数指定的蓝牙地址转换为 BluetoothAddress 对象

## InTheHand.Net.Bluetooth.BluetoothRadio 成员列表 <a id="InTheHand.Net.Bluetooth.BluetoothRadio" href="#InTheHand.Net.Bluetooth.BluetoothRadio">&#x23;</a>

### InTheHand.Net.Bluetooth.BluetoothRadio.Default <a id="InTheHand.Net.Bluetooth.BluetoothRadio.Default" href="#InTheHand.Net.Bluetooth.BluetoothRadio.Default">&#x23;</a>
默认蓝牙适配器  

[返回对象:InTheHandNetBluetoothRadioObject](#InTheHandNetBluetoothRadioObject)

## InTheHand.Net.Bluetooth.BluetoothSecurity 成员列表 <a id="InTheHand.Net.Bluetooth.BluetoothSecurity" href="#InTheHand.Net.Bluetooth.BluetoothSecurity">&#x23;</a>

### InTheHand.Net.Bluetooth.BluetoothSecurity.PairRequest(deviceAddress,pin) <a id="InTheHand.Net.Bluetooth.BluetoothSecurity.PairRequest" href="#InTheHand.Net.Bluetooth.BluetoothSecurity.PairRequest">&#x23;</a>
蓝牙设备配对，成功返回 true。  
@deviceAddress 指定设备地址，可选用 @pin 指定配对代码的字符串值。

## InTheHand.Net.Bluetooth.BluetoothService 成员列表 <a id="InTheHand.Net.Bluetooth.BluetoothService" href="#InTheHand.Net.Bluetooth.BluetoothService">&#x23;</a>

### InTheHand.Net.Bluetooth.BluetoothService.SerialPort <a id="InTheHand.Net.Bluetooth.BluetoothService.SerialPort" href="#InTheHand.Net.Bluetooth.BluetoothService.SerialPort">&#x23;</a>
虚拟串口

## InTheHand.Net.Sockets 成员列表 <a id="InTheHand.Net.Sockets" href="#InTheHand.Net.Sockets">&#x23;</a>

### InTheHand.Net.Sockets.BluetoothClient() <a id="InTheHand.Net.Sockets.BluetoothClient" href="#InTheHand.Net.Sockets.BluetoothClient">&#x23;</a>
创建经典蓝牙客户端。  

[返回对象:InTheHandNetBluetoothClientObject](#InTheHandNetBluetoothClientObject)

## InTheHandNetBluetoothClientObject 成员列表 <a id="InTheHandNetBluetoothClientObject" href="#InTheHandNetBluetoothClientObject">&#x23;</a>

### InTheHandNetBluetoothClientObject.Connect() <a id="InTheHandNetBluetoothClientObject.Connect" href="#InTheHandNetBluetoothClientObject.Connect">&#x23;</a>
连接蓝牙端点。  
参数指定 InTheHand.Net.BluetoothEndPoint 对象

### InTheHandNetBluetoothClientObject.ConnectSerialPort() <a id="InTheHandNetBluetoothClientObject.ConnectSerialPort" href="#InTheHandNetBluetoothClientObject.ConnectSerialPort">&#x23;</a>
连接虚拟串口服务。  
参数指定 InTheHand.Net.BluetoothEndPoint 对象指定蓝牙端点  
或用字符串指定蓝牙地址。

### InTheHandNetBluetoothClientObject.DiscoverDevices() <a id="InTheHandNetBluetoothClientObject.DiscoverDevices" href="#InTheHandNetBluetoothClientObject.DiscoverDevices">&#x23;</a>
发现蓝牙设备，可选用参数 @1 限定最大设备数。  
这是一个同步阻塞函数。  
返回一个可用 dotNet.each 枚举的集合对象，返回对象提供 Count 属性获取设备数。  

也可以改用 eachDevice 迭代器发现并遍历蓝牙设备。

### InTheHandNetBluetoothClientObject.eachDevice() <a id="InTheHandNetBluetoothClientObject.eachDevice" href="#InTheHandNetBluetoothClientObject.eachDevice">&#x23;</a>
[返回对象:InTheHandNetBluetoothDevInfoObject](#InTheHandNetBluetoothDevInfoObject)

### InTheHandNetBluetoothClientObject.eachDevice(maxDevices) <a id="InTheHandNetBluetoothClientObject.eachDevice" href="#InTheHandNetBluetoothClientObject.eachDevice">&#x23;</a>

```aardio
for i,deviceInfo in InTheHandNetBluetoothClientObject.eachDevice(){
	/*deviceInfo 为发现的蓝牙设备。*/
}
```

## InTheHandNetBluetoothDevInfoObject 成员列表 <a id="InTheHandNetBluetoothDevInfoObject" href="#InTheHandNetBluetoothDevInfoObject">&#x23;</a>

### InTheHandNetBluetoothDevInfoObject.Authenticated <a id="InTheHandNetBluetoothDevInfoObject.Authenticated" href="#InTheHandNetBluetoothDevInfoObject.Authenticated">&#x23;</a>
是否已验证

### InTheHandNetBluetoothDevInfoObject.Connected <a id="InTheHandNetBluetoothDevInfoObject.Connected" href="#InTheHandNetBluetoothDevInfoObject.Connected">&#x23;</a>
是否已连接

### InTheHandNetBluetoothDevInfoObject.DeviceAddress <a id="InTheHandNetBluetoothDevInfoObject.DeviceAddress" href="#InTheHandNetBluetoothDevInfoObject.DeviceAddress">&#x23;</a>
设备地址

### InTheHandNetBluetoothDevInfoObject.DeviceName <a id="InTheHandNetBluetoothDevInfoObject.DeviceName" href="#InTheHandNetBluetoothDevInfoObject.DeviceName">&#x23;</a>
设备名称

### InTheHandNetBluetoothDevInfoObject.GetRfcommServicesAsync(cached) <a id="InTheHandNetBluetoothDevInfoObject.GetRfcommServicesAsync" href="#InTheHandNetBluetoothDevInfoObject.GetRfcommServicesAsync">&#x23;</a>
返回异步任务，  
异步任务返回值为可枚举的 System.Guid 对象集合。  
关于 .NET 异步任务请参数 aardio 调用 .NET 范例目录关于异步任务的演示代码。

### InTheHandNetBluetoothDevInfoObject.SetServiceState(serviceGuid,state) <a id="InTheHandNetBluetoothDevInfoObject.SetServiceState" href="#InTheHandNetBluetoothDevInfoObject.SetServiceState">&#x23;</a>
设置服务状态。  
serviceGuid 为 System.Guid 对象。  
state 指定布尔值。

## InTheHandNetBluetoothRadioObject 成员列表 <a id="InTheHandNetBluetoothRadioObject" href="#InTheHandNetBluetoothRadioObject">&#x23;</a>

### InTheHandNetBluetoothRadioObject.LmpSubversion <a id="InTheHandNetBluetoothRadioObject.LmpSubversion" href="#InTheHandNetBluetoothRadioObject.LmpSubversion">&#x23;</a>
LMP 次要版本

### InTheHandNetBluetoothRadioObject.LmpVersion <a id="InTheHandNetBluetoothRadioObject.LmpVersion" href="#InTheHandNetBluetoothRadioObject.LmpVersion">&#x23;</a>
LMP 主版本

### InTheHandNetBluetoothRadioObject.LocalAddress <a id="InTheHandNetBluetoothRadioObject.LocalAddress" href="#InTheHandNetBluetoothRadioObject.LocalAddress">&#x23;</a>
地址

### InTheHandNetBluetoothRadioObject.Name <a id="InTheHandNetBluetoothRadioObject.Name" href="#InTheHandNetBluetoothRadioObject.Name">&#x23;</a>
名称
