diff --git a/CoreFileKit/entry/src/main/ets/pages/GetRawfile.ets b/CoreFileKit/entry/src/main/ets/pages/GetRawfile.ets index d9219e147fd2f85511a4d5dd7aee0e822b46a075..24d8b22ae901faef17637415b5ac2e9f3b4300e0 100644 --- a/CoreFileKit/entry/src/main/ets/pages/GetRawfile.ets +++ b/CoreFileKit/entry/src/main/ets/pages/GetRawfile.ets @@ -26,12 +26,17 @@ export struct GetRawfile { aboutToAppear(): void { this.getUIContext().getHostContext()?.resourceManager.getRawFileContent('test.txt', (_err, value) => { - let myBuffer: ArrayBufferLike = value.buffer; - let context = this.getUIContext().getHostContext(); //Sandbox Path + if (_err) { + console.error('Failed to get raw file:', _err); + return; + } + let fileBuffer: ArrayBufferLike = value.buffer; + let context = this.getUIContext() + .getHostContext(); // Obtain the application sandbox path for storing temporary files, and perform null checking let filePath = context!.filesDir + '/test.txt'; console.info('testTag-filePath:' + filePath); let file = fileIo.openSync(filePath, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE); - let writeLen = fileIo.writeSync(file.fd, myBuffer); + let writeLen = fileIo.writeSync(file.fd, fileBuffer); console.info('testTag-write data to file succeed and size is:' + writeLen); fileIo.closeSync(file); }); @@ -52,4 +57,5 @@ export struct GetRawfile { .width('100%') } } + // [End GetRawfile] \ No newline at end of file diff --git a/LocationKit/entry/src/main/ets/pages/FaultLog.ets b/LocationKit/entry/src/main/ets/pages/FaultLog.ets index bd155b23c2b5a8977464678aa522b1c70940877f..7be8152d6213b898da8aef3f3bdb1585103cd4c1 100644 --- a/LocationKit/entry/src/main/ets/pages/FaultLog.ets +++ b/LocationKit/entry/src/main/ets/pages/FaultLog.ets @@ -24,7 +24,7 @@ import { AbilityConstant, common } from '@kit.AbilityKit'; import { preferences } from '@kit.ArkData'; import { BusinessError } from '@kit.BasicServicesKit'; -const TAG: string = 'testTag'; +const TAG: string = 'FaultLoggerUtils'; export class LogUtils { static async queryAndUploadFaultLog(context: common.UIAbilityContext, launchParam: AbilityConstant.LaunchParam) { diff --git a/LocationKit/entry/src/main/ets/pages/ParametersCheck.ets b/LocationKit/entry/src/main/ets/pages/ParametersCheck.ets index 5305ededf47fb4794a517d211123799bf9e81283..177e0c27e580f9c7dd510fcbbbbf807fea616ce5 100644 --- a/LocationKit/entry/src/main/ets/pages/ParametersCheck.ets +++ b/LocationKit/entry/src/main/ets/pages/ParametersCheck.ets @@ -24,6 +24,7 @@ export class ParametersCheck { // [Start ParametersCheck] public static timelineReceivedResult(path: string): void { if (!path) { + console.error('Invoke empty file path') return; } let filename = path.substring(path.lastIndexOf("/") + 1); diff --git a/LocationKit/entry/src/main/ets/pages/ReadByte.ets b/LocationKit/entry/src/main/ets/pages/ReadByte.ets index c3418a8250e0bed9db01ee956a51c81f1b3bf91b..f42e6010f1f929169d2a9b51af7a4095ec4365c3 100644 --- a/LocationKit/entry/src/main/ets/pages/ReadByte.ets +++ b/LocationKit/entry/src/main/ets/pages/ReadByte.ets @@ -21,9 +21,10 @@ @Component export struct ArrayBufferConversionArray { @State fileLength: number = 10; - tempData: number[] = []; + private tempData: number[] = []; aboutToAppear(): void { + // Convert ArrayBuffer to a number array let arrayBuffer: ArrayBuffer = new ArrayBuffer(this.fileLength); let dataView: DataView = new DataView(arrayBuffer); for (let index = 0; index < this.fileLength; index++) { diff --git a/LocationKit/entry/src/main/ets/pages/SaveToUser.ets b/LocationKit/entry/src/main/ets/pages/SaveToUser.ets index cbd3c6ede402648d19e5f4f9eb8357df5dbae420..e35e6af89bb2a8b51fd885fb5344610be940f8da 100644 --- a/LocationKit/entry/src/main/ets/pages/SaveToUser.ets +++ b/LocationKit/entry/src/main/ets/pages/SaveToUser.ets @@ -23,17 +23,17 @@ import { picker, fileIo } from '@kit.CoreFileKit'; let uri: string = ''; -// 将content至公共目录 +// Save content to the public directory export async function saveToUser(content: string) { try { let DocumentSaveOptions = new picker.DocumentSaveOptions(); - // 新建文件名 + // New file name DocumentSaveOptions.newFileNames = ['test.txt']; let documentPicker = new picker.DocumentViewPicker(); documentPicker.save(DocumentSaveOptions).then((DocumentSaveResult: Array) => { console.info('DocumentViewPicker.save successfully, uri: ' + JSON.stringify(DocumentSaveResult)); uri = DocumentSaveResult[0]; - // 将content写入新建的文件内 + // Write the content into the newly created file let file = fileIo.openSync(uri, fileIo.OpenMode.READ_WRITE); fileIo.writeSync(file.fd, content); }).catch((err: BusinessError) => { diff --git a/RemoteCommunication/entry/src/main/ets/pages/RcpConfig.ets b/RemoteCommunication/entry/src/main/ets/pages/RcpConfig.ets index 531bafae4801a4f952511e927fd36a832b24e416..f882d4a55de223d7dfd161d316c617a72cecb71f 100644 --- a/RemoteCommunication/entry/src/main/ets/pages/RcpConfig.ets +++ b/RemoteCommunication/entry/src/main/ets/pages/RcpConfig.ets @@ -21,14 +21,14 @@ import { rcp } from '@kit.RemoteCommunicationKit'; const sessionConfig: rcp.SessionConfiguration = { - //用于指定与会话关联的HTTP请求的配置 + // Used to specify the configuration of HTTP requests associated with the session requestConfiguration: { transfer: { - //超时时间参数设置 + // Timeout parameter setting timeout: { - //连接超时,默认值是60000 + // The connection has timed out. The default value is 60,000 connectMs: 5000, - //传输超时,默认值是60000 + // Transmission timeout, with the default value being 60,000 transferMs: 10000, }, } @@ -42,14 +42,16 @@ export struct SetTimeout { build() { Row() { Column() { - Button('超时时间参数设置') + Button($r('app.string.timeout_parameter_setting')) .onClick(() => { if (session) { - console.log('创建session成功') - console.log('连接超时参数设置:', sessionConfig.requestConfiguration?.transfer?.timeout?.connectMs); - console.log('传输超时参数设置:', sessionConfig.requestConfiguration?.transfer?.timeout?.transferMs); + console.log('Created session successful!') + console.log('Connection timeout parameter settings:', + sessionConfig.requestConfiguration?.transfer?.timeout?.connectMs); + console.log('Transmission timeout parameters settings:', + sessionConfig.requestConfiguration?.transfer?.timeout?.transferMs); } else { - console.log('创建session失败'); + console.log('Created session failure!'); } }) } diff --git a/RemoteCommunication/entry/src/main/resources/base/element/string.json b/RemoteCommunication/entry/src/main/resources/base/element/string.json index f94595515a99e0c828807e243494f57f09251930..99959a544c5cf9f7a5380e7a4c228ec623ca625b 100644 --- a/RemoteCommunication/entry/src/main/resources/base/element/string.json +++ b/RemoteCommunication/entry/src/main/resources/base/element/string.json @@ -11,6 +11,10 @@ { "name": "EntryAbility_label", "value": "label" + }, + { + "name": "timeout_parameter_setting", + "value": "Timeout parameter setting" } ] } \ No newline at end of file