fix: 优化 examJudgeRealExam 函数中的数据处理逻辑,提升代码一致性

This commit is contained in:
wangzhongjie 2025-04-07 10:05:38 +08:00
parent 5354ec983c
commit 89a192408a
14 changed files with 27 additions and 2 deletions

View File

@ -45,7 +45,8 @@ export async function examJudgeInit(data: JudgeInitObj) {
* @desc 执行实时考试过程 实时传递传感信息
*/
export async function examJudgeRealExam(data) {
const temp: number = libJudgeSdk.examJudgeRealExam(JSON.stringify(data), str.length);
const str = JSON.stringify(data);
const temp: number = libJudgeSdk.examJudgeRealExam(str, str.length);
return await handle(temp, 'examJudgeRealExam')
}

View File

@ -21,7 +21,7 @@ import {Callback} from "./basic";
* @namespace HiSerialSDK
* @syscap SystemCapability.HiviewDFX.HiLog
* @crossplatform
* @since 9
* @HONGZOS 2.0
*/
declare namespace HiSerialSDK {
/**
@ -45,6 +45,7 @@ declare namespace HiSerialSDK {
*
* @param hiSerDevice "/dev/ttyS0"
* @param callback fd句柄-1
* @HONGZOS 3.0
*/
function SerialOpenAsync(hiSerDevice: string, callback: Callback<number>): void;
@ -72,9 +73,29 @@ declare namespace HiSerialSDK {
* @param stopbits
* @param parity
* @param callback (0: 成功, -1: 失败)
* @HONGZOS 3.0
*/
function SerialSetAsync(fd: number, speed: number, flow_ctrl: number, databits: number, stopbits: number, parity: number, callback: Callback<number>): void;
/**
*
*
* @param fd fd句柄
* @param callback 其中参数1: 监听的串口设备fd句柄参数2: 接收的串口数据长度参数3: 接收的串口数据字节数组
*
* @return (0: 成功, -1: 失败)
*/
function SerialListenCallbackSet(fd: number, callback: Callback<number, number, number[]>): number;
/**
*
*
* @param fd fd句柄
*
* @return (0: 成功, -1: 失败)
*/
function SerialListenCallbackCancel(fd: number): number;
/**
*
*
@ -90,6 +111,7 @@ declare namespace HiSerialSDK {
* @param fd fd句柄
* @param sendBuf
* @param callback -1
* @HONGZOS 3.0
*/
function SerialSendAsync(fd: number, sendBuf: number[], callback: Callback<number>): void;
@ -111,6 +133,7 @@ declare namespace HiSerialSDK {
* @param timeout 01000000 1
* @param callback
* @param recvLen 1024
* @HONGZOS 3.0
*/
function SerialRecvAsync(fd: number, timeout: number, callback: Callback<receiveInfo>, recvLen?: number): void;
@ -127,6 +150,7 @@ declare namespace HiSerialSDK {
*
* @param fd fd句柄
* @param (0: 成功, 其它: 失败)
* @HONGZOS 3.0
*/
function SerialCloseAsync(fd: number, callback: Callback<number>): void;
}

BIN
ohos/so/libhiserialsdk.z.so Normal file

Binary file not shown.