76 lines
2.8 KiB
Markdown
76 lines
2.8 KiB
Markdown
# SDK Configuration
|
|
|
|
中文说明见 [SDK_Configuration.zh-CN.md](SDK_Configuration.zh-CN.md).
|
|
|
|
The SDK uses `FaceSdkSettings` as the recommended configuration asset. `FaceModuleManager` can read this asset and synchronize the values into its runtime config.
|
|
|
|
## Default Settings Asset
|
|
|
|
```text
|
|
Assets/Resources/AISU/SI-M1 Face SDK/FaceSdkSettings.asset
|
|
```
|
|
|
|
Open `AISU/SI-M1 Face SDK/Settings` to load, edit, and save the asset.
|
|
|
|
## FaceSdkSettings Fields
|
|
|
|
| Field | Type | Description |
|
|
|---|---|---|
|
|
| `TransportMode` | `FaceTransportMode` | `Auto`, `SerialPort`, or `Mock` |
|
|
| `UseMockInEditor` | `bool` | Force mock transport in Unity Editor |
|
|
| `PortName` | `string` | Runtime serial port |
|
|
| `BaudRate` | `int` | Runtime baud rate |
|
|
| `ReadBufferSize` | `int` | Runtime read buffer size |
|
|
| `UseEditorSerialDebugParameters` | `bool` | Use separate serial parameters in Editor |
|
|
| `EditorPortName` | `string` | Editor debug serial port |
|
|
| `EditorBaudRate` | `int` | Editor debug baud rate |
|
|
| `EditorReadBufferSize` | `int` | Editor debug read buffer size |
|
|
| `MockResponseDelayFrames` | `int` | Mock response delay in frames |
|
|
| `AutoVerifyOnOpen` | `bool` | Start auto verify after READY |
|
|
| `AutoVerifyTimeout` | `byte` | Auto verify protocol timeout in seconds |
|
|
| `AutoVerifyResultIntervalMs` | `int` | Minimum interval between auto verify result events |
|
|
| `StopAutoVerifyBeforeExclusiveCommand` | `bool` | Stop auto verify before exclusive commands |
|
|
| `ExclusiveCommandPolicy` | `FaceExclusiveCommandPolicy` | Policy when exclusive commands run during auto verify |
|
|
| `DebugLogEnabled` | `bool` | Enable SDK debug logs |
|
|
| `RawLogEnabled` | `bool` | Dispatch raw TX/RX logs |
|
|
| `LogPrefix` | `string` | Log prefix |
|
|
|
|
## TransportMode
|
|
|
|
| Mode | Behavior |
|
|
|---|---|
|
|
| `Auto` | Editor chooses mock or serial based on `UseMockInEditor`; Player uses serial |
|
|
| `SerialPort` | Use `SerialPortTransport` |
|
|
| `Mock` | Use `MockFaceModuleTransport` |
|
|
|
|
When `UseMockInEditor = true`, the Editor uses mock transport and does not open a real serial port.
|
|
|
|
## Auto Verify
|
|
|
|
`AutoVerifyTimeout` is sent to the SI-M1 module as the recognition timeout.
|
|
|
|
`AutoVerifyResultIntervalMs` is handled by the Unity SDK. It limits how frequently `OnAutoVerifyResult` is dispatched when the module sends continuous auto verify NOTE packets. Set it to `0` to dispatch every result.
|
|
|
|
`StopAutoVerifyBeforeExclusiveCommand` and `ExclusiveCommandPolicy` control how enrollment, user management, QR code, image capture, and feature operations behave while auto verify is active.
|
|
|
|
## Runtime Usage
|
|
|
|
```csharp
|
|
manager.ApplySettings(settings);
|
|
manager.Open();
|
|
```
|
|
|
|
Quick configuration:
|
|
|
|
```csharp
|
|
manager.Configure(useMockInEditor: true, portName: "COM3", baudRate: 115200);
|
|
manager.Open();
|
|
```
|
|
|
|
Custom transport:
|
|
|
|
```csharp
|
|
manager.ConfigureTransport(customTransport);
|
|
manager.Open();
|
|
```
|