feat: 完成debugger前后端交互
This commit is contained in:
@@ -58,15 +58,20 @@ public class DebuggerController : ControllerBase
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
public async Task<IActionResult> SetMode([FromBody] CaptureMode mode)
|
||||
public async Task<IActionResult> SetMode(int channelNum, CaptureMode mode)
|
||||
{
|
||||
if (channelNum > 0x0F)
|
||||
{
|
||||
return BadRequest($"最多只能建立16个通道");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var debugger = GetDebugger();
|
||||
if (debugger == null)
|
||||
return BadRequest("用户未绑定有效的实验板");
|
||||
|
||||
var result = await debugger.SetMode(mode);
|
||||
var result = await debugger.SetMode((byte)channelNum, mode);
|
||||
if (!result.IsSuccessful)
|
||||
{
|
||||
logger.Error($"设置捕获模式失败: {result.Error}");
|
||||
|
||||
Reference in New Issue
Block a user