From 2c96efb0e10e20431f903a995ef17929a2dd15b2 Mon Sep 17 00:00:00 2001 From: Gloria Date: Wed, 25 Jun 2025 11:14:32 +0800 Subject: [PATCH] Update docs Signed-off-by: wusongqing --- en/application-dev/ai/mindspore/Readme-EN.md | 1 + .../mindspore/mindspore-asr-based-native.md | 784 ++++ .../mindspore-guidelines-based-js.md | 323 +- .../mindspore-guidelines-based-native.md | 290 +- .../ai/mindspore/mindspore-lite-guidelines.md | 8 +- .../mindspore-lite-train-guidelines.md | 2 +- .../arkts-condition-variable-introduction.md | 4 +- .../arkts-utils/arkts-sendable-module.md | 2 +- .../arkts-utils/concurrency-faq.md | 128 +- .../arkts-utils/linear-container.md | 27 +- .../connectivity/bluetooth/Readme-EN.md | 10 +- .../bluetooth/ble-development-guide.md | 4 +- .../bluetooth/br-development-guide.md | 4 +- .../br-discovery-development-guide.md | 201 + .../br-pair-device-development-guide.md | 210 + .../figures/disable-bluetooth-dialog.png | Bin 0 -> 20596 bytes .../figures/enable-bluetooth-dialog.png | Bin 0 -> 19972 bytes .../bluetooth/figures/pair-request-dialog.png | Bin 0 -> 22673 bytes .../bluetooth/gatt-development-guide.md | 2 +- .../bluetooth/spp-development-guide.md | 3 +- .../connectivity/wlan/Readme-EN.md | 6 +- .../wlan/p2p-development-guide.md | 20 +- .../wlan/scan-development-guide.md | 106 + .../wlan/sta-development-guide.md | 127 + .../reference/apis-arkts/js-apis-hashmap.md | 2 +- .../reference/apis-arkts/js-apis-hashset.md | 2 +- .../apis-arkts/js-apis-lightweightmap.md | 2 +- .../apis-arkts/js-apis-lightweightset.md | 2 +- .../apis-arkts/js-apis-linkedlist.md | 2 +- .../reference/apis-arkts/js-apis-list.md | 2 +- .../apis-arkts/js-apis-plainarray.md | 2 +- .../reference/apis-arkts/js-apis-queue.md | 2 +- .../reference/apis-arkts/js-apis-stack.md | 2 +- .../reference/apis-arkts/js-apis-treemap.md | 4 +- .../reference/apis-arkts/js-apis-treeset.md | 4 +- .../reference/apis-arkts/js-apis-url.md | 42 +- .../reference/apis-arkts/js-apis-util.md | 20 +- .../reference/apis-arkts/js-apis-vector.md | 2 +- .../errorcode-image-analyzer.md | 2 +- .../apis-arkui/js-apis-StateManagement.md | 145 +- .../js-apis-serialManager-sys.md | 81 + .../js-apis-serialManager.md | 934 ++++ .../js-apis-bluetooth-opp-sys.md | 617 +++ .../reference/apis-core-file-kit/Readme-EN.md | 3 +- .../js-apis-file-picker-sys.md | 41 + .../reference/apis-ffrt-kit/Readme-EN.md | 3 + .../reference/apis-ffrt-kit/_f_f_r_t.md | 188 +- .../reference/apis-ffrt-kit/ffrt__cond__t.md | 1 + .../apis-ffrt-kit/ffrt__condattr__t.md | 1 + .../apis-ffrt-kit/ffrt__dependence__t.md | 1 + .../reference/apis-ffrt-kit/ffrt__deps__t.md | 1 + .../ffrt__function__header__t.md | 3 +- .../reference/apis-ffrt-kit/ffrt__mutex__t.md | 1 + .../apis-ffrt-kit/ffrt__mutexattr__t.md | 1 + .../apis-ffrt-kit/ffrt__queue__attr__t.md | 1 + .../apis-ffrt-kit/ffrt__rwlock__t.md | 34 + .../apis-ffrt-kit/ffrt__rwlockattr__t.md | 33 + .../apis-ffrt-kit/ffrt__task__attr__t.md | 1 + .../reference/apis-ffrt-kit/loop_8h.md | 2 +- .../apis-ffrt-kit/shared__mutex_8h.md | 32 + .../reference/apis-ffrt-kit/type__def_8h.md | 2 + .../_input___device_listener.md | 45 - .../_input___interceptor_event_callback.md | 62 - .../apis-input-kit/capi-input-axisevent.md | 11 + .../apis-input-kit/capi-input-deviceinfo.md | 11 + .../capi-input-devicelistener.md | 20 + .../apis-input-kit/capi-input-hotkey.md | 11 + .../capi-input-interceptoreventcallback.md | 143 + .../capi-input-interceptoroptions.md | 11 + .../apis-input-kit/capi-input-keyevent.md | 11 + .../apis-input-kit/capi-input-keystate.md | 11 + .../apis-input-kit/capi-input-mouseevent.md | 11 + .../apis-input-kit/capi-input-touchevent.md | 11 + .../reference/apis-input-kit/capi-input.md | 14 + .../apis-input-kit/capi-oh-axis-type-h.md | 81 + .../apis-input-kit/capi-oh-input-manager-h.md | 2923 ++++++++++++ .../apis-input-kit/capi-oh-key-code-h.md | 174 + ...imodalinput.md => errorcode-cooperator.md} | 12 +- .../apis-input-kit/errorcode-inputconsumer.md | 4 +- .../apis-input-kit/errorcode-inputdevice.md | 25 +- ...eymonitor.md => errorcode-inputmonitor.md} | 9 +- .../apis-input-kit/errorcode-pointer.md | 23 + .../reference/apis-input-kit/input.md | 3990 ----------------- .../apis-input-kit/js-apis-cooperate-sys.md | 53 +- .../apis-input-kit/js-apis-infraredemitter.md | 4 +- .../apis-input-kit/js-apis-inputconsumer.md | 58 +- .../apis-input-kit/js-apis-inputdevice-sys.md | 64 +- .../apis-input-kit/js-apis-inputdevice.md | 164 +- .../js-apis-inputeventclient-sys.md | 11 +- .../js-apis-inputmonitor-sys.md | 1139 +++-- .../apis-input-kit/js-apis-keycode.md | 8 +- .../apis-input-kit/js-apis-keyevent.md | 4 +- .../apis-input-kit/js-apis-mouseevent.md | 2 +- .../apis-input-kit/js-apis-pointer-sys.md | 1636 +++++-- .../apis-input-kit/js-apis-pointer.md | 597 ++- .../apis-input-kit/js-apis-shortKey-sys.md | 13 +- .../apis-input-kit/js-apis-touchevent.md | 16 + .../apis-input-kit/oh__axis__type_8h.md | 35 - .../apis-input-kit/oh__input__manager_8h.md | 203 - .../apis-input-kit/oh__key__code_8h.md | 24 - .../apis-media-kit/_a_v_image_generator.md | 223 - .../apis-media-kit/_a_v_metadata_extractor.md | 536 --- .../reference/apis-media-kit/_a_v_player.md | 1975 -------- .../apis-media-kit/_a_v_player_callback.md | 28 - .../reference/apis-media-kit/_a_v_recorder.md | 1018 ----- .../apis-media-kit/_a_v_screen_capture.md | 1890 -------- .../_o_h___a_v_recorder___config.md | 98 - .../_o_h___a_v_recorder___encoder_info.md | 134 - .../_o_h___a_v_recorder___location.md | 50 - .../_o_h___a_v_recorder___metadata.md | 74 - ..._o_h___a_v_recorder___metadata_template.md | 50 - .../_o_h___a_v_recorder___profile.md | 174 - .../_o_h___a_v_recorder___range.md | 50 - .../_o_h___a_v_screen_capture_callback.md | 70 - .../_o_h___a_v_screen_capture_config.md | 86 - .../apis-media-kit/_o_h___audio_buffer.md | 66 - .../_o_h___audio_capture_info.md | 58 - .../apis-media-kit/_o_h___audio_enc_info.md | 50 - .../apis-media-kit/_o_h___audio_info.md | 65 - .../apis-media-kit/_o_h___recorder_info.md | 61 - .../reference/apis-media-kit/_o_h___rect.md | 74 - .../_o_h___video_capture_info.md | 100 - .../apis-media-kit/_o_h___video_enc_info.md | 61 - .../apis-media-kit/_o_h___video_info.md | 49 - .../apis-media-kit/_video_processing.md | 988 ---- .../_video_processing___color_space_info.md | 62 - .../apis-media-kit/avimage__generator_8h.md | 34 - .../avimage__generator__base_8h.md | 31 - .../avmetadata__extractor_8h.md | 35 - .../avmetadata__extractor__base_8h.md | 41 - .../reference/apis-media-kit/avplayer_8h.md | 69 - .../apis-media-kit/avplayer__base_8h.md | 76 - .../reference/apis-media-kit/avrecorder_8h.md | 40 - .../apis-media-kit/avrecorder__base_8h.md | 69 - .../native__avscreen__capture_8h.md | 53 - .../native__avscreen__capture__base_8h.md | 89 - .../native__avscreen__capture__errors_8h.md | 33 - .../apis-media-kit/video__processing_8h.md | 46 - .../video__processing__types_8h.md | 62 - .../state-management/arkts-v1-v2-mixusage.md | 1025 +++++ en/application-dev/website.md | 416 +- 141 files changed, 11452 insertions(+), 14881 deletions(-) create mode 100644 en/application-dev/ai/mindspore/mindspore-asr-based-native.md create mode 100644 en/application-dev/connectivity/bluetooth/br-discovery-development-guide.md create mode 100644 en/application-dev/connectivity/bluetooth/br-pair-device-development-guide.md create mode 100644 en/application-dev/connectivity/bluetooth/figures/disable-bluetooth-dialog.png create mode 100644 en/application-dev/connectivity/bluetooth/figures/enable-bluetooth-dialog.png create mode 100644 en/application-dev/connectivity/bluetooth/figures/pair-request-dialog.png create mode 100644 en/application-dev/connectivity/wlan/scan-development-guide.md create mode 100644 en/application-dev/connectivity/wlan/sta-development-guide.md rename en/application-dev/reference/apis-arkui/{ => arkui-ts}/errorcode-image-analyzer.md (96%) create mode 100644 en/application-dev/reference/apis-basic-services-kit/js-apis-serialManager-sys.md create mode 100644 en/application-dev/reference/apis-basic-services-kit/js-apis-serialManager.md create mode 100644 en/application-dev/reference/apis-connectivity-kit/js-apis-bluetooth-opp-sys.md create mode 100644 en/application-dev/reference/apis-core-file-kit/js-apis-file-picker-sys.md create mode 100644 en/application-dev/reference/apis-ffrt-kit/ffrt__rwlock__t.md create mode 100644 en/application-dev/reference/apis-ffrt-kit/ffrt__rwlockattr__t.md create mode 100644 en/application-dev/reference/apis-ffrt-kit/shared__mutex_8h.md delete mode 100644 en/application-dev/reference/apis-input-kit/_input___device_listener.md delete mode 100644 en/application-dev/reference/apis-input-kit/_input___interceptor_event_callback.md create mode 100644 en/application-dev/reference/apis-input-kit/capi-input-axisevent.md create mode 100644 en/application-dev/reference/apis-input-kit/capi-input-deviceinfo.md create mode 100644 en/application-dev/reference/apis-input-kit/capi-input-devicelistener.md create mode 100644 en/application-dev/reference/apis-input-kit/capi-input-hotkey.md create mode 100644 en/application-dev/reference/apis-input-kit/capi-input-interceptoreventcallback.md create mode 100644 en/application-dev/reference/apis-input-kit/capi-input-interceptoroptions.md create mode 100644 en/application-dev/reference/apis-input-kit/capi-input-keyevent.md create mode 100644 en/application-dev/reference/apis-input-kit/capi-input-keystate.md create mode 100644 en/application-dev/reference/apis-input-kit/capi-input-mouseevent.md create mode 100644 en/application-dev/reference/apis-input-kit/capi-input-touchevent.md create mode 100644 en/application-dev/reference/apis-input-kit/capi-input.md create mode 100644 en/application-dev/reference/apis-input-kit/capi-oh-axis-type-h.md create mode 100644 en/application-dev/reference/apis-input-kit/capi-oh-input-manager-h.md create mode 100644 en/application-dev/reference/apis-input-kit/capi-oh-key-code-h.md rename en/application-dev/reference/apis-input-kit/{errorcode-multimodalinput.md => errorcode-cooperator.md} (88%) rename en/application-dev/reference/apis-input-kit/{errorcode-inputkeymonitor.md => errorcode-inputmonitor.md} (82%) create mode 100644 en/application-dev/reference/apis-input-kit/errorcode-pointer.md delete mode 100644 en/application-dev/reference/apis-input-kit/input.md delete mode 100644 en/application-dev/reference/apis-input-kit/oh__axis__type_8h.md delete mode 100644 en/application-dev/reference/apis-input-kit/oh__input__manager_8h.md delete mode 100644 en/application-dev/reference/apis-input-kit/oh__key__code_8h.md delete mode 100644 en/application-dev/reference/apis-media-kit/_a_v_image_generator.md delete mode 100644 en/application-dev/reference/apis-media-kit/_a_v_metadata_extractor.md delete mode 100644 en/application-dev/reference/apis-media-kit/_a_v_player.md delete mode 100644 en/application-dev/reference/apis-media-kit/_a_v_player_callback.md delete mode 100644 en/application-dev/reference/apis-media-kit/_a_v_recorder.md delete mode 100644 en/application-dev/reference/apis-media-kit/_a_v_screen_capture.md delete mode 100644 en/application-dev/reference/apis-media-kit/_o_h___a_v_recorder___config.md delete mode 100644 en/application-dev/reference/apis-media-kit/_o_h___a_v_recorder___encoder_info.md delete mode 100644 en/application-dev/reference/apis-media-kit/_o_h___a_v_recorder___location.md delete mode 100644 en/application-dev/reference/apis-media-kit/_o_h___a_v_recorder___metadata.md delete mode 100644 en/application-dev/reference/apis-media-kit/_o_h___a_v_recorder___metadata_template.md delete mode 100644 en/application-dev/reference/apis-media-kit/_o_h___a_v_recorder___profile.md delete mode 100644 en/application-dev/reference/apis-media-kit/_o_h___a_v_recorder___range.md delete mode 100644 en/application-dev/reference/apis-media-kit/_o_h___a_v_screen_capture_callback.md delete mode 100644 en/application-dev/reference/apis-media-kit/_o_h___a_v_screen_capture_config.md delete mode 100644 en/application-dev/reference/apis-media-kit/_o_h___audio_buffer.md delete mode 100644 en/application-dev/reference/apis-media-kit/_o_h___audio_capture_info.md delete mode 100644 en/application-dev/reference/apis-media-kit/_o_h___audio_enc_info.md delete mode 100644 en/application-dev/reference/apis-media-kit/_o_h___audio_info.md delete mode 100644 en/application-dev/reference/apis-media-kit/_o_h___recorder_info.md delete mode 100644 en/application-dev/reference/apis-media-kit/_o_h___rect.md delete mode 100644 en/application-dev/reference/apis-media-kit/_o_h___video_capture_info.md delete mode 100644 en/application-dev/reference/apis-media-kit/_o_h___video_enc_info.md delete mode 100644 en/application-dev/reference/apis-media-kit/_o_h___video_info.md delete mode 100644 en/application-dev/reference/apis-media-kit/_video_processing.md delete mode 100644 en/application-dev/reference/apis-media-kit/_video_processing___color_space_info.md delete mode 100644 en/application-dev/reference/apis-media-kit/avimage__generator_8h.md delete mode 100644 en/application-dev/reference/apis-media-kit/avimage__generator__base_8h.md delete mode 100644 en/application-dev/reference/apis-media-kit/avmetadata__extractor_8h.md delete mode 100644 en/application-dev/reference/apis-media-kit/avmetadata__extractor__base_8h.md delete mode 100644 en/application-dev/reference/apis-media-kit/avplayer_8h.md delete mode 100644 en/application-dev/reference/apis-media-kit/avplayer__base_8h.md delete mode 100644 en/application-dev/reference/apis-media-kit/avrecorder_8h.md delete mode 100644 en/application-dev/reference/apis-media-kit/avrecorder__base_8h.md delete mode 100644 en/application-dev/reference/apis-media-kit/native__avscreen__capture_8h.md delete mode 100644 en/application-dev/reference/apis-media-kit/native__avscreen__capture__base_8h.md delete mode 100644 en/application-dev/reference/apis-media-kit/native__avscreen__capture__errors_8h.md delete mode 100644 en/application-dev/reference/apis-media-kit/video__processing_8h.md delete mode 100644 en/application-dev/reference/apis-media-kit/video__processing__types_8h.md create mode 100644 en/application-dev/ui/state-management/arkts-v1-v2-mixusage.md diff --git a/en/application-dev/ai/mindspore/Readme-EN.md b/en/application-dev/ai/mindspore/Readme-EN.md index 80d71a73df1..6e045550397 100644 --- a/en/application-dev/ai/mindspore/Readme-EN.md +++ b/en/application-dev/ai/mindspore/Readme-EN.md @@ -7,3 +7,4 @@ - [Using the MindSpore Lite Engine for On-Device Training (C/C++)](mindspore-lite-train-guidelines.md) - [Using MindSpore Lite for Image Classification (ArkTS)](mindspore-guidelines-based-js.md) - [Using MindSpore Lite for Image Classification (C/C++)](mindspore-guidelines-based-native.md) +- [Using MindSpore Lite for Speech Recognition (C/C++)](mindspore-asr-based-native.md) diff --git a/en/application-dev/ai/mindspore/mindspore-asr-based-native.md b/en/application-dev/ai/mindspore/mindspore-asr-based-native.md new file mode 100644 index 00000000000..a2ced74459f --- /dev/null +++ b/en/application-dev/ai/mindspore/mindspore-asr-based-native.md @@ -0,0 +1,784 @@ +# Using MindSpore Lite for Speech Recognition (C/C++) + +## When to Use + +You can use [MindSpore](../../reference/apis-mindspore-lite-kit/_mind_spore.md) to quickly deploy AI algorithms into your application to perform AI model inference for speech recognition. + +Speech recognition can convert an audio file into text, which is widely used in intelligent voice assistants, voice input, and voice search. + +## Basic Concepts + +- N-API: a set of native APIs used to build ArkTS components. N-APIs can be used to encapsulate C/C++ libraries into ArkTS modules. + +## How to Develop + +1. Select a speech recognition model. +2. Use the MindSpore Lite inference model on the device to implement speech recognition. + +## Environment Setup + +Install DevEco Studio 5.0.2 or later, and update the SDK to API version 14 or later. + +## Development Procedure + +This section uses the inference of a speech recognition model as an example to demonstrate how to implement a speech recognition application using MindSpore Lite. + +### Selecting an Appropriate Model + +The speech recognition model files **tiny-encoder.ms**, **tiny-decoder-main.ms**, and **tiny-decoder-loop.ms** used in this sample application are stored in the **entry/src/main/resources/rawfile** directory. + + +### Writing Code + +#### Playing Audio + +1. Call [@ohos.multimedia.media](../../reference/apis-media-kit/js-apis-media.md) and [@ohos.multimedia.audio](../../reference/apis-audio-kit/js-apis-audio.md) to play audio. + + ```ts + // player.ets + import { media } from '@kit.MediaKit'; + import { common } from '@kit.AbilityKit'; + import { BusinessError } from '@kit.BasicServicesKit'; + import { audio } from '@kit.AudioKit'; + import { UIContext } from '@kit.ArkUI'; + + export default class AVPlayerDemo { + private isSeek: boolean = false; // Disable the seek operation. + // Set the AVPlayer callback. + setAVPlayerCallback(avPlayer: media.AVPlayer) { + // Callback for the seek operation. + avPlayer.on('seekDone', (seekDoneTime: number) => { + console.info(`MS_LITE_LOG: AVPlayer seek succeeded, seek time is ${seekDoneTime}`); + }); + // Callback invoked if an error occurs while the AVPlayer is playing audio. In such a case, reset() is called to reset the AVPlayer. + avPlayer.on('error', (err: BusinessError) => { + console.error(`MS_LITE_LOG: Invoke avPlayer failed, code is ${err.code}, message is ${err.message}`); + avPlayer.reset(); // Call reset() to reset the AVPlayer, which enters the idle state. + }); + // Callback for state changes. + avPlayer.on('stateChange', async (state: string, reason: media.StateChangeReason) => { + switch (state) { + case 'idle': // This state is reported upon a successful callback of reset(). + console.info('MS_LITE_LOG: AVPlayer state idle called.'); + avPlayer.release(); // Call release() to release the instance. + break; + case 'initialized': // This state is reported when the AVPlayer sets the playback source. + console.info('MS_LITE_LOG: AVPlayer state initialized called.'); + avPlayer.audioRendererInfo = { + usage: audio.StreamUsage.STREAM_USAGE_MUSIC, // Audio stream usage type: music. Set this parameter based on the service scenario. + rendererFlags: 0 // Audio renderer flag. + }; + avPlayer.prepare(); + break; + case 'prepared': // This state is reported upon a successful callback of prepare(). + console.info('MS_LITE_LOG: AVPlayer state prepared called.'); + avPlayer.play(); // Call play() to start playback. + break; + case 'playing': // This state is reported upon a successful callback of play(). + console.info('MS_LITE_LOG: AVPlayer state playing called.'); + if (this.isSeek) { + console.info('MS_LITE_LOG: AVPlayer start to seek.'); + avPlayer.seek(0); // Seek to the end of the audio. + } else { + // When the seek operation is not supported, the playback continues until it reaches the end. + console.info('MS_LITE_LOG: AVPlayer wait to play end.'); + } + break; + case 'paused': // This state is reported upon a successful callback of pause(). + console.info('MS_LITE_LOG: AVPlayer state paused called.'); + setTimeout(() => { + console.info('MS_LITE_LOG: AVPlayer paused wait to play again'); + avPlayer.play(); // After the playback is paused for 3 seconds, call the play API again to start playback. + }, 3000); + break; + case 'completed': // This state is reported upon the completion of the playback. + console.info('MS_LITE_LOG: AVPlayer state completed called.'); + avPlayer.stop(); // Call stop() to stop the playback. + break; + case 'stopped': // This state is reported upon a successful callback of stop(). + console.info('MS_LITE_LOG: AVPlayer state stopped called.'); + avPlayer.reset(); // Call reset() to reset the AVPlayer. + break; + case 'released': + console.info('MS_LITE_LOG: AVPlayer state released called.'); + break; + default: + console.info('MS_LITE_LOG: AVPlayer state unknown called.'); + break; + } + }); + } + + // Use the resource management API to obtain the audio file and play the audio file through the fdSrc attribute. + async avPlayerFdSrcDemo() { + // Create an AVPlayer instance. + let avPlayer: media.AVPlayer = await media.createAVPlayer(); + // Create a callback for state changes. + this.setAVPlayerCallback(avPlayer); + // Call getRawFd of the resourceManager member of UIAbilityContext to obtain the media asset URL. + // The return type is {fd,offset,length}, where fd indicates the file descriptor address of the HAP file, offset indicates the media asset offset, and length indicates the duration of the media asset to play. + let context = new UIContext().getHostContext() as common.UIAbilityContext; + let fileDescriptor = await context.resourceManager.getRawFd('zh.wav'); + let avFileDescriptor: media.AVFileDescriptor = + { fd: fileDescriptor.fd, offset: fileDescriptor.offset, length: fileDescriptor.length }; + this.isSeek = true; // Enable the seek operation. + // Assign a value to fdSrc to trigger the reporting of the initialized state. + avPlayer.fdSrc = avFileDescriptor; + } + } + ``` + + +#### Recognizing Audio + +Call [MindSpore](../../reference/apis-mindspore-lite-kit/_mind_spore.md) to perform inference on the three models in sequence. The inference process is as follows: + +1. Include the corresponding header files. The third-party libraries **librosa**, **libsamplerate**, and **base64.h** are from [LibrosaCpp](https://github.com/ewan-xu/LibrosaCpp), [libsamplerate](https://github.com/libsndfile/libsamplerate), AudioFile.h, and [whisper.axera](https://github.com/ml-inory/whisper.axera/tree/main/cpp/src), respectively. + + ```c++ + #include "AudioFile.h" + #include "base64.h" + #include "napi/native_api.h" + #include "utils.h" + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + ``` + +2. Read related files such as audio files and model files, and converts them to buffer data. + + ```c++ + #define LOGI(...) ((void)OH_LOG_Print(LOG_APP, LOG_INFO, LOG_DOMAIN, "[MSLiteNapi]", __VA_ARGS__)) + #define LOGD(...) ((void)OH_LOG_Print(LOG_APP, LOG_DEBUG, LOG_DOMAIN, "[MSLiteNapi]", __VA_ARGS__)) + #define LOGW(...) ((void)OH_LOG_Print(LOG_APP, LOG_WARN, LOG_DOMAIN, "[MSLiteNapi]", __VA_ARGS__)) + #define LOGE(...) ((void)OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_DOMAIN, "[MSLiteNapi]", __VA_ARGS__)) + + using BinBuffer = std::pair; + + BinBuffer ReadBinFile(NativeResourceManager *nativeResourceManager, const std::string &modelName) + { + auto rawFile = OH_ResourceManager_OpenRawFile(nativeResourceManager, modelName.c_str()); + if (rawFile == nullptr) { + LOGE("MS_LITE_ERR: Open model file failed"); + return BinBuffer(nullptr, 0); + } + long fileSize = OH_ResourceManager_GetRawFileSize(rawFile); + if (fileSize <= 0) { + LOGE("MS_LITE_ERR: FileSize not correct"); + return BinBuffer(nullptr, 0); + } + void *buffer = malloc(fileSize); + if (buffer == nullptr) { + LOGE("MS_LITE_ERR: OH_ResourceManager_ReadRawFile failed"); + return BinBuffer(nullptr, 0); + } + int ret = OH_ResourceManager_ReadRawFile(rawFile, buffer, fileSize); + if (ret == 0) { + LOGE("MS_LITE_LOG: OH_ResourceManager_ReadRawFile failed"); + OH_ResourceManager_CloseRawFile(rawFile); + return BinBuffer(nullptr, 0); + } + OH_ResourceManager_CloseRawFile(rawFile); + return BinBuffer(buffer, fileSize); + } + + BinBuffer ReadTokens(NativeResourceManager *nativeResourceManager, const std::string &modelName) { + auto rawFile = OH_ResourceManager_OpenRawFile(nativeResourceManager, modelName.c_str()); + if (rawFile == nullptr) { + LOGE("MS_LITE_ERR: Open model file failed"); + } + long fileSize = OH_ResourceManager_GetRawFileSize(rawFile); + if (fileSize <= 0) { + LOGE("MS_LITE_ERR: FileSize not correct"); + } + void *buffer = malloc(fileSize); + if (buffer == nullptr) { + LOGE("MS_LITE_ERR: OH_ResourceManager_ReadRawFile failed"); + } + int ret = OH_ResourceManager_ReadRawFile(rawFile, buffer, fileSize); + if (ret == 0) { + LOGE("MS_LITE_LOG: OH_ResourceManager_ReadRawFile failed"); + OH_ResourceManager_CloseRawFile(rawFile); + } + OH_ResourceManager_CloseRawFile(rawFile); + BinBuffer res(buffer, fileSize); + return res; + } + ``` + +3. Create a context, set the device type, and load the model. + + ```c++ + void DestroyModelBuffer(void **buffer) + { + if (buffer == nullptr) { + return; + } + free(*buffer); + *buffer = nullptr; + } + + OH_AI_ModelHandle CreateMSLiteModel(BinBuffer &bin) + { + // Create and configure the context for model inference. + auto context = OH_AI_ContextCreate(); + if (context == nullptr) { + DestroyModelBuffer(&bin.first); + LOGE("MS_LITE_ERR: Create MSLite context failed.\n"); + return nullptr; + } + auto cpu_device_info = OH_AI_DeviceInfoCreate(OH_AI_DEVICETYPE_CPU); + OH_AI_DeviceInfoSetEnableFP16(cpu_device_info, false); + OH_AI_ContextAddDeviceInfo(context, cpu_device_info); + + // Create a model. + auto model = OH_AI_ModelCreate(); + if (model == nullptr) { + DestroyModelBuffer(&bin.first); + LOGE("MS_LITE_ERR: Allocate MSLite Model failed.\n"); + return nullptr; + } + + // Load and build the inference model. The model type is OH_AI_MODELTYPE_MINDIR. + auto build_ret = OH_AI_ModelBuild(model, bin.first, bin.second, OH_AI_MODELTYPE_MINDIR, context); + DestroyModelBuffer(&bin.first); + if (build_ret != OH_AI_STATUS_SUCCESS) { + OH_AI_ModelDestroy(&model); + LOGE("MS_LITE_ERR: Build MSLite model failed.\n"); + return nullptr; + } + LOGI("MS_LITE_LOG: Build MSLite model success.\n"); + return model; + } + ``` + +4. Set the model input data, and perform model inference. + + ```c++ + constexpr int K_NUM_PRINT_OF_OUT_DATA = 20; + + int FillInputTensor(OH_AI_TensorHandle input, const BinBuffer &bin) + { + if (OH_AI_TensorGetDataSize(input) != bin.second) { + return OH_AI_STATUS_LITE_INPUT_PARAM_INVALID; + } + char *data = (char *)OH_AI_TensorGetMutableData(input); + memcpy(data, (const char *)bin.first, OH_AI_TensorGetDataSize(input)); + return OH_AI_STATUS_SUCCESS; + } + + // Perform model inference. + int RunMSLiteModel(OH_AI_ModelHandle model, std::vector inputBins) + { + // Set the model input data. + auto inputs = OH_AI_ModelGetInputs(model); + for(int i = 0; i < inputBins.size(); i++) + { + auto ret = FillInputTensor(inputs.handle_list[i], inputBins[i]); + if (ret != OH_AI_STATUS_SUCCESS) { + LOGE("MS_LITE_ERR: set input %{public}d error.\n", i); + return OH_AI_STATUS_LITE_ERROR; + } + } + + // Obtain the output tensor of the model. + auto outputs = OH_AI_ModelGetOutputs(model); + + // Model inference + auto predict_ret = OH_AI_ModelPredict(model, inputs, &outputs, nullptr, nullptr); + if (predict_ret != OH_AI_STATUS_SUCCESS) { + OH_AI_ModelDestroy(&model); + LOGE("MS_LITE_ERR: MSLite Predict error.\n"); + return OH_AI_STATUS_LITE_ERROR; + } + LOGD("MS_LITE_LOG: Run MSLite model Predict success.\n"); + + // Print the output data. + LOGD("MS_LITE_LOG: Get model outputs:\n"); + for (size_t i = 0; i < outputs.handle_num; i++) { + auto tensor = outputs.handle_list[i]; + LOGD("MS_LITE_LOG: - Tensor %{public}d name is: %{public}s.\n", static_cast(i), + OH_AI_TensorGetName(tensor)); + LOGD("MS_LITE_LOG: - Tensor %{public}d size is: %{public}d.\n", static_cast(i), + (int)OH_AI_TensorGetDataSize(tensor)); + LOGD("MS_LITE_LOG: - Tensor data is:\n"); + auto out_data = reinterpret_cast(OH_AI_TensorGetData(tensor)); + std::stringstream outStr; + for (int i = 0; (i < OH_AI_TensorGetElementNum(tensor)) && (i <= K_NUM_PRINT_OF_OUT_DATA); i++) { + outStr << out_data[i] << " "; + } + LOGD("MS_LITE_LOG: %{public}s", outStr.str().c_str()); + } + return OH_AI_STATUS_SUCCESS; + } + ``` + +5. Repeat the preceding procedure for the remaining models. + + ```c++ + const float NEG_INF = -std::numeric_limits::infinity(); + const int WHISPER_SOT = 50258; + const int WHISPER_TRANSCRIBE = 50359; + const int WHISPER_TRANSLATE = 50358; + const int WHISPER_NO_TIMESTAMPS = 50363; + const int WHISPER_EOT = 50257; + const int WHISPER_BLANK = 220; + const int WHISPER_NO_SPEECH = 50362; + const int WHISPER_N_TEXT_CTX = 448; + const int WHISPER_N_TEXT_STATE = 384; + constexpr int WHISPER_SAMPLE_RATE = 16000; + + BinBuffer GetMSOutput(OH_AI_TensorHandle output) { + float *outputData = reinterpret_cast(OH_AI_TensorGetMutableData(output)); + size_t size = OH_AI_TensorGetDataSize(output); + return {outputData, size}; + } + + void SupressTokens(BinBuffer &logits, bool is_initial) { + auto logits_data = static_cast(logits.first); + if (is_initial) { + logits_data[WHISPER_EOT] = NEG_INF; + logits_data[WHISPER_BLANK] = NEG_INF; + } + + // Suppress other tokens. + logits_data[WHISPER_NO_TIMESTAMPS] = NEG_INF; + logits_data[WHISPER_SOT] = NEG_INF; + logits_data[WHISPER_NO_SPEECH] = NEG_INF; + logits_data[WHISPER_TRANSLATE] = NEG_INF; + } + + std::vector LoopPredict(const OH_AI_ModelHandle model, const BinBuffer &n_layer_cross_k, + const BinBuffer &n_layer_cross_v, const BinBuffer &logits_init, + BinBuffer &out_n_layer_self_k_cache, BinBuffer &out_n_layer_self_v_cache, + const BinBuffer &data_embedding, const int loop, const int offset_init) { + BinBuffer logits{nullptr, 51865 * sizeof(float)}; + logits.first = malloc(logits.second); + if (!logits.first) { + LOGE("MS_LITE_LOG: Fail to malloc!\n"); + } + void *logits_init_src = static_cast(logits_init.first) + 51865 * 3 * sizeof(float); + memcpy(logits.first, logits_init_src, logits.second); + SupressTokens(logits, true); + + std::vector output_token; + float *logits_data = static_cast(logits.first); + int max_token_id = 0; + float max_token = logits_data[0]; + for (int i = 0; i < logits.second / sizeof(float); i++) { + if (logits_data[i] > max_token) { + max_token_id = i; + max_token = logits_data[i]; + } + } + + int offset = offset_init; + BinBuffer slice{nullptr, 0}; + slice.second = WHISPER_N_TEXT_STATE * sizeof(float); + slice.first = malloc(slice.second); + if (!slice.first) { + LOGE("MS_LITE_LOG: Fail to malloc!\n"); + } + + auto out_n_layer_self_k_cache_new = out_n_layer_self_k_cache; + auto out_n_layer_self_v_cache_new = out_n_layer_self_v_cache; + + for (size_t i = 0; i < loop; i++) { + if (max_token_id == WHISPER_EOT) { + break; + } + output_token.push_back(max_token_id); + std::vector mask(WHISPER_N_TEXT_CTX, 0.0f); + for (size_t i = 0; i < WHISPER_N_TEXT_CTX - offset - 1; ++i) { + mask[i] = NEG_INF; + } + BinBuffer tokens{&max_token_id, sizeof(int)}; + + void *data_embedding_src = + static_cast(data_embedding.first) + offset * WHISPER_N_TEXT_STATE * sizeof(float); + memcpy(slice.first, data_embedding_src, slice.second); + BinBuffer mask_bin(mask.data(), mask.size() * sizeof(float)); + int ret = RunMSLiteModel(model, {tokens, out_n_layer_self_k_cache_new, out_n_layer_self_v_cache_new, + n_layer_cross_k, n_layer_cross_v, slice, mask_bin}); + + auto outputs = OH_AI_ModelGetOutputs(model); + logits = GetMSOutput(outputs.handle_list[0]); + out_n_layer_self_k_cache_new = GetMSOutput(outputs.handle_list[1]); + out_n_layer_self_v_cache_new = GetMSOutput(outputs.handle_list[2]); + offset++; + SupressTokens(logits, false); + logits_data = static_cast(logits.first); + max_token = logits_data[0]; + + for (int j = 0; j < logits.second / sizeof(float); j++) { + if (logits_data[j] > max_token) { + max_token_id = j; + max_token = logits_data[j]; + } + } + LOGI("MS_LITE_LOG: run decoder loop %{public}d ok!\n token = %{public}d", i, max_token_id); + } + return output_token; + } + + std::vector ProcessDataLines(const BinBuffer token_txt) { + void *data_ptr = token_txt.first; + size_t data_size = token_txt.second; + std::vector tokens; + + const char *char_data = static_cast(data_ptr); + std::stringstream ss(std::string(char_data, char_data + data_size)); + std::string line; + while (std::getline(ss, line)) { + size_t space_pos = line.find(' '); + tokens.push_back(line.substr(0, space_pos)); + } + return tokens; + } + + static napi_value RunDemo(napi_env env, napi_callback_info info) + { + // Perform sample inference. + napi_value error_ret; + napi_create_int32(env, -1, &error_ret); + size_t argc = 1; + napi_value argv[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr); + auto resourcesManager = OH_ResourceManager_InitNativeResourceManager(env, argv[0]); + + // Data preprocessing + AudioFile audioFile; + std::string filePath = "zh.wav"; + auto audioBin = ReadBinFile(resourcesManager, filePath); + if (audioBin.first == nullptr) { + LOGI("MS_LITE_LOG: Fail to read %{public}s!", filePath.c_str()); + } + size_t dataSize = audioBin.second; + uint8_t *dataBuffer = (uint8_t *)audioBin.first; + bool ok = audioFile.loadFromMemory(std::vector(dataBuffer, dataBuffer + dataSize)); + if (!ok) { + LOGI("MS_LITE_LOG: Fail to read %{public}s!", filePath.c_str()); + } + std::vector data(audioFile.samples[0]); + ResampleAudio(data, audioFile.getSampleRate(), WHISPER_SAMPLE_RATE, 1, SRC_SINC_BEST_QUALITY); + std::vector audio(data); + + int padding = 480000; + int sr = 16000; + int n_fft = 480; + int n_hop = 160; + int n_mel = 80; + int fmin = 0; // Minimum frequency. The default value is 0.0 Hz. + int fmax = + sr / + 2.0; // Maximum frequency. The default value is half of the sampling rate (sr/2.0). + audio.insert(audio.end(), padding, 0.0f); + std::vector> mels_T = + librosa::Feature::melspectrogram(audio, sr, n_fft, n_hop, "hann", true, "reflect", 2.f, n_mel, fmin, fmax); + std::cout << "mels: " << std::endl; + + std::vector> mels = TransposeMel(mels_T); + ProcessMelSpectrogram(mels); + + std::vector inputMels(mels.size() * mels[0].size(), 0); + for (int i = 0; i < mels.size(); i++) { + std::copy(mels[i].begin(), mels[i].end(), inputMels.begin() + i * mels[0].size()); + } + + BinBuffer inputMelsBin(inputMels.data(), inputMels.size() * sizeof(float)); + + // Run inference on tiny-encoder.ms. + auto encoderBin = ReadBinFile(resourcesManager, "tiny-encoder.ms"); + if (encoderBin.first == nullptr) { + return error_ret; + } + + auto encoder = CreateMSLiteModel(encoderBin); + + int ret = RunMSLiteModel(encoder, {inputMelsBin}); + if (ret != OH_AI_STATUS_SUCCESS) { + OH_AI_ModelDestroy(&encoder); + return error_ret; + } + LOGI("run encoder ok!\n"); + + auto outputs = OH_AI_ModelGetOutputs(encoder); + auto n_layer_cross_k = GetMSOutput(outputs.handle_list[0]); + auto n_layer_cross_v = GetMSOutput(outputs.handle_list[1]); + + // Run inference on tiny-decoder-main.ms. + std::vector SOT_SEQUENCE = {WHISPER_SOT, + WHISPER_SOT + 1 + 1, + WHISPER_TRANSCRIBE, WHISPER_NO_TIMESTAMPS}; + BinBuffer sotSequence(SOT_SEQUENCE.data(), SOT_SEQUENCE.size() * sizeof(int)); + + const std::string decoder_main_path = "tiny-decoder-main.ms"; + auto decoderMainBin = ReadBinFile(resourcesManager, decoder_main_path); + if (decoderMainBin.first == nullptr) { + return error_ret; + } + auto decoder_main = CreateMSLiteModel(decoderMainBin); + int ret2 = RunMSLiteModel(decoder_main, {sotSequence, n_layer_cross_k, n_layer_cross_v}); + + if (ret2 != OH_AI_STATUS_SUCCESS) { + OH_AI_ModelDestroy(&decoder_main); + return error_ret; + } + LOGI("run decoder_main ok!\n"); + + auto decoderMainOut = OH_AI_ModelGetOutputs(decoder_main); + auto logitsBin = GetMSOutput(decoderMainOut.handle_list[0]); + auto out_n_layer_self_k_cache_Bin = GetMSOutput(decoderMainOut.handle_list[1]); + auto out_n_layer_self_v_cache_Bin = GetMSOutput(decoderMainOut.handle_list[2]); + + // Run inference on tiny-decoder-loop.ms. + const std::string modelName3 = "tiny-decoder-loop.ms"; + auto modelBuffer3 = ReadBinFile(resourcesManager, modelName3); + auto decoder_loop = CreateMSLiteModel(modelBuffer3); + + const std::string dataName_embedding = "tiny-positional_embedding.bin"; // Obtain the input data. + auto data_embedding = ReadBinFile(resourcesManager, dataName_embedding); + if (data_embedding.first == nullptr) { + return error_ret; + } + + int loop_times = WHISPER_N_TEXT_CTX - SOT_SEQUENCE.size(); + int offset_init = SOT_SEQUENCE.size(); + auto output_tokens = + LoopPredict(decoder_loop, n_layer_cross_k, n_layer_cross_v, logitsBin, out_n_layer_self_k_cache_Bin, + out_n_layer_self_v_cache_Bin, data_embedding, loop_times, offset_init); + + std::vector token_tables = ProcessDataLines(ReadTokens(resourcesManager, "tiny-tokens.txt")); + std::string result; + for (const auto i : output_tokens) { + char str[1024]; + base64_decode((const uint8 *)token_tables[i].c_str(), (uint32)token_tables[i].size(), str); + result += str; + } + LOGI("MS_LITE_LOG: result is -> %{public}s", result.c_str()); + + OH_AI_ModelDestroy(&encoder); + OH_AI_ModelDestroy(&decoder_main); + OH_AI_ModelDestroy(&decoder_loop); + + napi_value out_data; + napi_create_string_utf8(env, result.c_str(), result.length(), &out_data); + return out_data; + } + ``` + +7. Write the **CMake** script to link the MindSpore Lite dynamic library. + + ```c++ + # the minimum version of CMake. + cmake_minimum_required(VERSION 3.5.0) + project(test) + set(CMAKE_CXX_STANDARD 17) # AudioFile.h + set(CMAKE_CXX_STANDARD_REQUIRED TRUE) + set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}) + + if(DEFINED PACKAGE_FIND_FILE) + include(${PACKAGE_FIND_FILE}) + endif() + + include_directories(${NATIVERENDER_ROOT_PATH} + ${NATIVERENDER_ROOT_PATH}/include) + + # libsamplerate + set(LIBSAMPLERATE_DIR ${NATIVERENDER_ROOT_PATH}/third_party/libsamplerate) + include_directories(${LIBSAMPLERATE_DIR}/include) + add_subdirectory(${LIBSAMPLERATE_DIR}) + + include_directories(${NATIVERENDER_ROOT_PATH}/third_party/opencc/include/opencc) + # src + aux_source_directory(src SRC_DIR) + include_directories(${NATIVERENDER_ROOT_PATH}/src) + + include_directories(${CMAKE_SOURCE_DIR}/third_party) + + file(GLOB SRC src/*.cc) + + add_library(entry SHARED mslite_napi.cpp ${SRC}) + target_link_libraries(entry PUBLIC samplerate) + target_link_libraries(entry PUBLIC mindspore_lite_ndk) + target_link_libraries(entry PUBLIC hilog_ndk.z) + target_link_libraries(entry PUBLIC rawfile.z) + target_link_libraries(entry PUBLIC ace_napi.z) + ``` + +#### Use N-APIs to encapsulate the C++ dynamic library into an ArkTS module. + +1. In **entry/src/main/cpp/types/libentry/Index.d.ts**, define the ArkTS API `runDemo()` by adding the following content: + + ```ts + export const runDemo: (a: Object) => string; + ``` + +2. In the **oh-package.json5** file, associate the API with the .so file to form a complete ArkTS module. + + ```json + { + "name": "entry", + "version": "1.0.0", + "description": "MindSpore Lite inference module", + "main": "", + "author": "", + "license": "", + "dependencies": { + "libentry.so": "file:./src/main/cpp/types/libentry" + } + } + ``` + +#### Invoke the encapsulated ArkTS module to perform inference and output the result. + +In **entry/src/main/ets/pages/Index.ets**, call the encapsulated ArkTS module to process the inference result. + +```ts +// Index.ets + +import msliteNapi from 'libentry.so' +import AVPlayerDemo from './player'; +import { transverter, TransverterType, TransverterLanguage } from "@nutpi/chinese_transverter" + +@Entry +@Component +struct Index { + @State message: string = 'MSLite Whisper Demo'; + @State wavName: string = 'zh.wav'; + @State content: string = ''; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(30) + .fontWeight(FontWeight.Bold); + Button() { + Text('Play Audio') + .fontSize(20) + .fontWeight(FontWeight.Medium) + } + .type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('40%') + .height('5%') + .onClick(async () =>{ + // Invoke functions in the avPlayerFdSrcDemo class. + console.info('MS_LITE_LOG: begin to play wav.'); + let myClass = new AVPlayerDemo(); + myClass.avPlayerFdSrcDemo(); + }) + Button() { + Text ('Recognize Audio') + .fontSize(20) + .fontWeight(FontWeight.Medium) + } + .type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('40%') + .height('5%') + .onClick(() => { + let resMgr = this.getUIContext()?.getHostContext()?.getApplicationContext().resourceManager; + + // Call the encapsulated runDemo function. + console.info('MS_LITE_LOG: *** Start MSLite Demo ***'); + let output = msliteNapi.runDemo(resMgr); + console.info('MS_LITE_LOG: output length = ', output.length, ';value = ', output.slice(0, 20)); + this.content = output; + console.info('MS_LITE_LOG: *** Finished MSLite Demo ***'); + }) + + // Display the recognized content. + if (this.content) { + Text ('Recognized content:\n' + transverter({ + type: TransverterType.SIMPLIFIED, + str: this.content, + language: TransverterLanguage.ZH_CN + }) + '\n').focusable(true).fontSize(20).height('20%') + } + }.width('100%') + } + .height('100%') + } +} +``` + +### Verification + +1. On DevEco Studio, connect to the device, click **Run entry**, and build your own HAP. + + ```shell + Launching com.samples.mindsporelitecdemoasr + $ hdc shell aa force-stop com.samples.mindsporelitecdemoasr + $ hdc shell mkdir data/local/tmp/xxx + $ hdc file send E:\xxx\entry\build\default\outputs\default\entry-default-signed.hap "data/local/tmp/xxx" + $ hdc shell bm install -p data/local/tmp/xxx + $ hdc shell rm -rf data/local/tmp/xxx + $ hdc shell aa start -a EntryAbility -b com.samples.mindsporelitecdemoasr + com.samples.mindsporelitecdemoasr successfully launched... + ``` + +2. Tap the `Play Audio` button on the device screen to play the sample audio file. Tap the `Recognize Audio` button. The content of the sample audio file is displayed on the device screen. Filter the keyword **MS_LITE_LOG** in the log printing result. The following information is displayed: + + ```verilog + 05-16 14:53:44.200 1679-1679 A03d00/JSAPP com.sampl...cdemoasr I MS_LITE_LOG: begin to play wav. + 05-16 14:53:44.210 1679-1679 A03d00/JSAPP com.sampl...cdemoasr I [a92ab1e0f831191, 0, 0] MS_LITE_LOG: AVPlayer state initialized called. + 05-16 14:53:44.228 1679-1679 A03d00/JSAPP com.sampl...cdemoasr I [a92ab1e0f831191, 0, 0] MS_LITE_LOG: AVPlayer state prepared called. + 05-16 14:53:44.242 1679-1679 A03d00/JSAPP com.sampl...cdemoasr I MS_LITE_LOG: AVPlayer state playing called. + 05-16 14:53:44.242 1679-1679 A03d00/JSAPP com.sampl...cdemoasr I MS_LITE_LOG: AVPlayer start to seek. + 05-16 14:53:44.372 1679-1679 A03d00/JSAPP com.sampl...cdemoasr I MS_LITE_LOG: AVPlayer seek succeeded, seek time is 0 + 05-16 14:53:49.621 1679-1679 A03d00/JSAPP com.sampl...cdemoasr I MS_LITE_LOG: AVPlayer state completed called. + 05-16 14:53:49.646 1679-1679 A03d00/JSAPP com.sampl...cdemoasr I MS_LITE_LOG: AVPlayer state stopped called. + 05-16 14:53:49.647 1679-1679 A03d00/JSAPP com.sampl...cdemoasr I MS_LITE_LOG: AVPlayer state idle called. + 05-16 14:53:49.649 1679-1679 A03d00/JSAPP com.sampl...cdemoasr I MS_LITE_LOG: AVPlayer state released called. + 05-16 14:53:53.282 1679-1679 A03d00/JSAPP com.sampl...cdemoasr I MS_LITE_LOG: *** Start MSLite Demo *** + 05-16 14:53:53.926 1679-1679 A00000/[MSLiteNapi] com.sampl...cdemoasr I MS_LITE_LOG: Build MSLite model success. + 05-16 14:53:54.260 1679-1679 A00000/[MSLiteNapi] com.sampl...cdemoasr D MS_LITE_LOG: Run MSLite model Predict success. + 05-16 14:53:54.260 1679-1679 A00000/[MSLiteNapi] com.sampl...cdemoasr D MS_LITE_LOG: Get model outputs: + 05-16 14:53:54.260 1679-1679 A00000/[MSLiteNapi] com.sampl...cdemoasr D MS_LITE_LOG: - Tensor 0 name is: n_layer_cross_k. + 05-16 14:53:54.260 1679-1679 A00000/[MSLiteNapi] com.sampl...cdemoasr D MS_LITE_LOG: - Tensor 0 size is: 9216000. + 05-16 14:53:54.260 1679-1679 A00000/[MSLiteNapi] com.sampl...cdemoasr D MS_LITE_LOG: - Tensor data is: + 05-16 14:53:54.260 1679-1679 A00000/[MSLiteNapi] com.sampl...cdemoasr D MS_LITE_LOG: -1.14678 -2.30223 0.868679 0.284441 1.03233 -2.02062 0.688163 -0.732034 -1.10553 1.43459 0.083885 -0.116173 -0.772636 1.5466 -0.631993 -0.897929 -0.0501685 -1.62517 0.375988 -1.77772 -0.432178 + 05-16 14:53:54.260 1679-1679 A00000/[MSLiteNapi] com.sampl...cdemoasr D MS_LITE_LOG: - Tensor 1 name is: n_layer_cross_v. + 05-16 14:53:54.260 1679-1679 A00000/[MSLiteNapi] com.sampl...cdemoasr D MS_LITE_LOG: - Tensor 1 size is: 9216000. + 05-16 14:53:54.260 1679-1679 A00000/[MSLiteNapi] com.sampl...cdemoasr D MS_LITE_LOG: - Tensor data is: + 05-16 14:53:54.260 1679-1679 A00000/[MSLiteNapi] com.sampl...cdemoasr D MS_LITE_LOG: 0.0876085 -0.560317 -0.652518 -0.116969 -0.182608 -9.40531e-05 0.186293 0.123206 0.0127445 0.0708352 -0.489624 -0.226322 -0.0686949 -0.0341293 -0.0719619 0.103588 0.398025 -0.444261 0.396124 -0.347295 0.00541205 + 05-16 14:53:54.430 1679-1679 A00000/[MSLiteNapi] com.sampl...cdemoasr I MS_LITE_LOG: Build MSLite model success. + 05-16 14:53:54.462 1679-1679 A00000/[MSLiteNapi] com.sampl...cdemoasr D MS_LITE_LOG: Run MSLite model Predict success. + ...... + 05-16 14:53:55.272 1679-1679 A00000/[MSLiteNapi] com.sampl...cdemoasr I MS_LITE_LOG: run decoder loop 16 ok! + token = 50257 + 05-16 14:53:55.307 1679-1679 A00000/[MSLiteNapi] com.sampl...cdemoasr I MS_LITE_LOG: result is -> I think the most important thing about running is that it brings me physical health. + 05-16 14:53:55.334 1679-1679 A03d00/JSAPP com.sampl...cdemoasr I MS_LITE_LOG: output length = 20 ;value = I think the most important thing about running is that it brings me physical health. + 05-16 14:53:55.334 1679-1679 A03d00/JSAPP com.sampl...cdemoasr I MS_LITE_LOG: *** Finished MSLite Demo *** + ``` + + +### Effects + +After you tap the `Play Audio` button on the device screen, the sample audio file is played. After you tap the `Recognize Audio` button, the content of the sample audio file is displayed on the device screen. + + + + + + diff --git a/en/application-dev/ai/mindspore/mindspore-guidelines-based-js.md b/en/application-dev/ai/mindspore/mindspore-guidelines-based-js.md index cf411b31760..adf8a9fe531 100644 --- a/en/application-dev/ai/mindspore/mindspore-guidelines-based-js.md +++ b/en/application-dev/ai/mindspore/mindspore-guidelines-based-js.md @@ -51,97 +51,130 @@ If you have other pre-trained models for image classification, convert the origi 1. Call [@ohos.file.picker](../../reference/apis-core-file-kit/js-apis-file-picker.md) to pick up the desired image in the album. +2. Based on the input image size, call [@ohos.multimedia.image](../../reference/apis-image-kit/js-apis-image.md) and [@ohos.file.fs](../../reference/apis-core-file-kit/js-apis-file-fs.md) to perform operations such as cropping the image, obtaining the image buffer, and standardizing the image. + ```ts + // Index.ets import { photoAccessHelper } from '@kit.MediaLibraryKit'; import { BusinessError } from '@kit.BasicServicesKit'; + import { image } from '@kit.ImageKit'; + import { fileIo } from '@kit.CoreFileKit'; - let uris: Array = []; - - // Create an image picker instance. - let photoSelectOptions = new photoAccessHelper.PhotoSelectOptions(); + @Entry + @Component + struct Index { + @State modelName: string = 'mobilenetv2.ms'; + @State modelInputHeight: number = 224; + @State modelInputWidth: number = 224; + @State uris: Array = []; - // Set the media file type to IMAGE and set the maximum number of media files that can be selected. - photoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE; - photoSelectOptions.maxSelectNumber = 1; + build() { + Row() { + Column() { + Button() { + Text('photo') + .fontSize(30) + .fontWeight(FontWeight.Bold) + } + .type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('40%') + .height('5%') + .onClick(() => { + let resMgr = this.getUIContext()?.getHostContext()?.getApplicationContext().resourceManager; + resMgr?.getRawFileContent(this.modelName).then(modelBuffer => { + // Obtain images in an album. + // 1. Create an image picker instance. + let photoSelectOptions = new photoAccessHelper.PhotoSelectOptions(); - // Create an album picker instance and call select() to open the album page for file selection. After file selection is done, the result set is returned through photoSelectResult. - let photoPicker = new photoAccessHelper.PhotoViewPicker(); - photoPicker.select(photoSelectOptions, async ( - err: BusinessError, photoSelectResult: photoAccessHelper.PhotoSelectResult) => { - if (err) { - console.error('MS_LITE_ERR: PhotoViewPicker.select failed with err: ' + JSON.stringify(err)); - return; - } - console.info('MS_LITE_LOG: PhotoViewPicker.select successfully, ' + - 'photoSelectResult uri: ' + JSON.stringify(photoSelectResult)); - uris = photoSelectResult.photoUris; - console.info('MS_LITE_LOG: uri: ' + uris); - }) - ``` - -2. Based on the input image size, call [@ohos.multimedia.image](../../reference/apis-image-kit/js-apis-image.md) and [@ohos.file.fs](../../reference/apis-core-file-kit/js-apis-file-fs.md) to perform operations such as cropping the image, obtaining the image buffer, and standardizing the image. - - ```ts - import { image } from '@kit.ImageKit'; - import { fileIo } from '@kit.CoreFileKit'; + // 2. Set the media file type to IMAGE and set the maximum number of media files that can be selected. + photoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE; + photoSelectOptions.maxSelectNumber = 1; - let modelInputHeight: number = 224; - let modelInputWidth: number = 224; + // 3. Create an album picker instance and call select() to open the album page for file selection. After file selection is done, the result set is returned through photoSelectResult. + let photoPicker = new photoAccessHelper.PhotoViewPicker(); + photoPicker.select(photoSelectOptions, async ( + err: BusinessError, photoSelectResult: photoAccessHelper.PhotoSelectResult) => { + if (err) { + console.error('MS_LITE_ERR: PhotoViewPicker.select failed with err: ' + JSON.stringify(err)); + return; + } + console.info('MS_LITE_LOG: PhotoViewPicker.select successfully, ' + + 'photoSelectResult uri: ' + JSON.stringify(photoSelectResult)); + this.uris = photoSelectResult.photoUris; + console.info('MS_LITE_LOG: uri: ' + this.uris); - // Based on the specified URI, call fileIo.openSync to open the file to obtain the FD. - let file = fileIo.openSync(this.uris[0], fileIo.OpenMode.READ_ONLY); - console.info('MS_LITE_LOG: file fd: ' + file.fd); + // Preprocess the image data. + try { + // 1. Based on the specified URI, call fileIo.openSync to open the file to obtain the FD. + let file = fileIo.openSync(this.uris[0], fileIo.OpenMode.READ_ONLY); + console.info('MS_LITE_LOG: file fd: ' + file.fd); - // Based on the FD, call fileIo.readSync to read the data in the file. - let inputBuffer = new ArrayBuffer(4096000); - let readLen = fileIo.readSync(file.fd, inputBuffer); - console.info('MS_LITE_LOG: readSync data to file succeed and inputBuffer size is:' + readLen); + // 2. Based on the FD, call fileIo.readSync to read the data in the file. + let inputBuffer = new ArrayBuffer(4096000); + let readLen = fileIo.readSync(file.fd, inputBuffer); + console.info('MS_LITE_LOG: readSync data to file succeed and inputBuffer size is:' + readLen); - // Perform image preprocessing through PixelMap. - let imageSource = image.createImageSource(file.fd); - imageSource.createPixelMap().then((pixelMap) => { - pixelMap.getImageInfo().then((info) => { - console.info('MS_LITE_LOG: info.width = ' + info.size.width); - console.info('MS_LITE_LOG: info.height = ' + info.size.height); - // Crop the image based on the input image size and obtain the image buffer readBuffer. - pixelMap.scale(256.0 / info.size.width, 256.0 / info.size.height).then(() => { - pixelMap.crop( - { x: 16, y: 16, size: { height: modelInputHeight, width: modelInputWidth } } - ).then(async () => { - let info = await pixelMap.getImageInfo(); - console.info('MS_LITE_LOG: crop info.width = ' + info.size.width); - console.info('MS_LITE_LOG: crop info.height = ' + info.size.height); - // Set the size of readBuffer. - let readBuffer = new ArrayBuffer(modelInputHeight * modelInputWidth * 4); - await pixelMap.readPixelsToBuffer(readBuffer); - console.info('MS_LITE_LOG: Succeeded in reading image pixel data, buffer: ' + - readBuffer.byteLength); - // Convert readBuffer to the float32 format, and standardize the image. - const imageArr = new Uint8Array( - readBuffer.slice(0, modelInputHeight * modelInputWidth * 4)); - console.info('MS_LITE_LOG: imageArr length: ' + imageArr.length); - let means = [0.485, 0.456, 0.406]; - let stds = [0.229, 0.224, 0.225]; - let float32View = new Float32Array(modelInputHeight * modelInputWidth * 3); - let index = 0; - for (let i = 0; i < imageArr.length; i++) { - if ((i + 1) % 4 == 0) { - float32View[index] = (imageArr[i - 3] / 255.0 - means[0]) / stds[0]; // B - float32View[index+1] = (imageArr[i - 2] / 255.0 - means[1]) / stds[1]; // G - float32View[index+2] = (imageArr[i - 1] / 255.0 - means[2]) / stds[2]; // R - index += 3; - } - } - console.info('MS_LITE_LOG: float32View length: ' + float32View.length); - let printStr = 'float32View data:'; - for (let i = 0; i < 20; i++) { - printStr += ' ' + float32View[i]; - } - console.info('MS_LITE_LOG: float32View data: ' + printStr); - }) - }) - }); - }); + // 3. Perform image preprocessing through PixelMap. + let imageSource = image.createImageSource(file.fd); + imageSource.createPixelMap().then((pixelMap) => { + pixelMap.getImageInfo().then((info) => { + console.info('MS_LITE_LOG: info.width = ' + info.size.width); + console.info('MS_LITE_LOG: info.height = ' + info.size.height); + // 4. Crop the image based on the input image size and obtain the image buffer readBuffer. + pixelMap.scale(256.0 / info.size.width, 256.0 / info.size.height).then(() => { + pixelMap.crop( + { x: 16, y: 16, size: { height: this.modelInputHeight, width: this.modelInputWidth } } + ).then(async () => { + let info = await pixelMap.getImageInfo(); + console.info('MS_LITE_LOG: crop info.width = ' + info.size.width); + console.info('MS_LITE_LOG: crop info.height = ' + info.size.height); + // Set the size of readBuffer. + let readBuffer = new ArrayBuffer(this.modelInputHeight * this.modelInputWidth * 4); + await pixelMap.readPixelsToBuffer(readBuffer); + console.info('MS_LITE_LOG: Succeeded in reading image pixel data, buffer: ' + + readBuffer.byteLength); + // Convert readBuffer to the float32 format, and standardize the image. + const imageArr = new Uint8Array( + readBuffer.slice(0, this.modelInputHeight * this.modelInputWidth * 4)); + console.info('MS_LITE_LOG: imageArr length: ' + imageArr.length); + let means = [0.485, 0.456, 0.406]; + let stds = [0.229, 0.224, 0.225]; + let float32View = new Float32Array(this.modelInputHeight * this.modelInputWidth * 3); + let index = 0; + for (let i = 0; i < imageArr.length; i++) { + if ((i + 1) % 4 == 0) { + float32View[index] = (imageArr[i - 3] / 255.0 - means[0]) / stds[0]; // B + float32View[index+1] = (imageArr[i - 2] / 255.0 - means[1]) / stds[1]; // G + float32View[index+2] = (imageArr[i - 1] / 255.0 - means[2]) / stds[2]; // R + index += 3; + } + } + console.info('MS_LITE_LOG: float32View length: ' + float32View.length); + let printStr = 'float32View data:'; + for (let i = 0; i < 20; i++) { + printStr += ' ' + float32View[i]; + } + console.info('MS_LITE_LOG: float32View data: ' + printStr); + }) + }) + }) + }) + } catch (err) { + console.error('MS_LITE_LOG: uri: open file fd failed.' + err); + } + }) + }) + }) + } + .width('100%') + } + .height('100%') + } + } ``` #### Writing Inference Code @@ -166,7 +199,7 @@ If you have other pre-trained models for image classification, convert the origi 2. Call [@ohos.ai.mindSporeLite](../../reference/apis-mindspore-lite-kit/js-apis-mindSporeLite.md) to implement inference on the device. The operation process is as follows: - 1. Create a context, and set parameters such as the number of runtime threads and device type. + 1. Create a context, and set parameters such as the number of runtime threads and device type. The sample model does not support NNRt inference. 2. Load the model. In this example, the model is loaded from the memory. 3. Load data. Before executing a model, you need to obtain the model input and then fill data in the input tensors. 4. Perform model inference through the **predict** API. @@ -178,7 +211,7 @@ If you have other pre-trained models for image classification, convert the origi export default async function modelPredict( modelBuffer: ArrayBuffer, inputsBuffer: ArrayBuffer[]): Promise { - // 1. Create a context, and set parameters such as the number of runtime threads and device type. + // 1. Create a context, and set parameters such as the number of runtime threads and device type. The context.target = ["nnrt"] option is not supported. let context: mindSporeLite.Context = {}; context.target = ['cpu']; context.cpu = {} @@ -210,56 +243,86 @@ If you have other pre-trained models for image classification, convert the origi Load the model file and call the inference function to perform inference on the selected image, and process the inference result. ```ts +// Index.ets import modelPredict from './model'; -import { resourceManager } from '@kit.LocalizationKit' - -let modelName: string = 'mobilenetv2.ms'; -let max: number = 0; -let maxIndex: number = 0; -let maxArray: Array = []; -let maxIndexArray: Array = []; - -// The buffer data of the input image is stored in float32View after preprocessing. For details, see Image Input and Preprocessing. -let inputs: ArrayBuffer[] = [float32View.buffer]; -let resMgr = this.getUIContext()?.getHostContext()?.getApplicationContext().resourceManager; -resMgr?.getRawFileContent(modelName).then(modelBuffer => { - // predict - modelPredict(modelBuffer.buffer.slice(0), inputs).then(outputs => { - console.info('=========MS_LITE_LOG: MS_LITE predict success====='); - // Print the result. - for (let i = 0; i < outputs.length; i++) { - let out = new Float32Array(outputs[i].getData()); - let printStr = outputs[i].name + ':'; - for (let j = 0; j < out.length; j++) { - printStr += out[j].toString() + ','; - } - console.info('MS_LITE_LOG: ' + printStr); - // Obtain the maximum number of categories. - this.max = 0; - this.maxIndex = 0; - this.maxArray = []; - this.maxIndexArray = []; - let newArray = out.filter(value => value !== max) - for (let n = 0; n < 5; n++) { - max = out[0]; - maxIndex = 0; - for (let m = 0; m < newArray.length; m++) { - if (newArray[m] > max) { - max = newArray[m]; - maxIndex = m; - } + +@Entry +@Component +struct Index { + @State modelName: string = 'mobilenetv2.ms'; + @State modelInputHeight: number = 224; + @State modelInputWidth: number = 224; + @State max: number = 0; + @State maxIndex: number = 0; + @State maxArray: Array = []; + @State maxIndexArray: Array = []; + + build() { + Row() { + Column() { + Button() { + Text('photo') + .fontSize(30) + .fontWeight(FontWeight.Bold) } - maxArray.push(Math.round(max * 10000)) - maxIndexArray.push(maxIndex) - // Call the array filter function. - newArray = newArray.filter(value => value !== max) + .type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('40%') + .height('5%') + .onClick(() => { + let resMgr = this.getUIContext()?.getHostContext()?.getApplicationContext().resourceManager; + resMgr?.getRawFileContent(this.modelName).then(modelBuffer => { + let float32View = new Float32Array(this.modelInputHeight * this.modelInputWidth * 3); + // Image input and preprocessing + // The buffer data of the input image is stored in float32View after preprocessing. For details, see Image Input and Preprocessing. + let inputs: ArrayBuffer[] = [float32View.buffer]; + // predict + modelPredict(modelBuffer.buffer.slice(0), inputs).then(outputs => { + console.info('=========MS_LITE_LOG: MS_LITE predict success====='); + // Print the result. + for (let i = 0; i < outputs.length; i++) { + let out = new Float32Array(outputs[i].getData()); + let printStr = outputs[i].name + ':'; + for (let j = 0; j < out.length; j++) { + printStr += out[j].toString() + ','; + } + console.info('MS_LITE_LOG: ' + printStr); + // Obtain the maximum number of categories. + this.max = 0; + this.maxIndex = 0; + this.maxArray = []; + this.maxIndexArray = []; + let newArray = out.filter(value => value !== this.max) + for (let n = 0; n < 5; n++) { + this.max = out[0]; + this.maxIndex = 0; + for (let m = 0; m < newArray.length; m++) { + if (newArray[m] > this.max) { + this.max = newArray[m]; + this.maxIndex = m; + } + } + this.maxArray.push(Math.round(this.max * 10000)) + this.maxIndexArray.push(this.maxIndex) + // Call the array filter function. + newArray = newArray.filter(value => value !== this.max) + } + console.info('MS_LITE_LOG: max:' + this.maxArray); + console.info('MS_LITE_LOG: maxIndex:' + this.maxIndexArray); + } + console.info('=========MS_LITE_LOG END========='); + }) + }) + }) } - console.info('MS_LITE_LOG: max:' + maxArray); - console.info('MS_LITE_LOG: maxIndex:' + maxIndexArray); + .width('100%') } - console.info('=========MS_LITE_LOG END========='); - }) -}) + .height('100%') + } +} ``` ### Debugging and Verification @@ -298,5 +361,3 @@ Touch the **photo** button on the device screen, select an image, and touch **OK - - diff --git a/en/application-dev/ai/mindspore/mindspore-guidelines-based-native.md b/en/application-dev/ai/mindspore/mindspore-guidelines-based-native.md index 568f5bcff2b..5d86ad6bb57 100644 --- a/en/application-dev/ai/mindspore/mindspore-guidelines-based-native.md +++ b/en/application-dev/ai/mindspore/mindspore-guidelines-based-native.md @@ -35,97 +35,130 @@ If you have other pre-trained models for image classification, convert the origi 1. Call [@ohos.file.picker](../../reference/apis-core-file-kit/js-apis-file-picker.md) to pick up the desired image in the album. +2. Based on the input image size, call [@ohos.multimedia.image](../../reference/apis-image-kit/js-apis-image.md) and [@ohos.file.fs](../../reference/apis-core-file-kit/js-apis-file-fs.md) to perform operations such as cropping the image, obtain the image buffer, and standardizing the image. + ```ts + // Index.ets + import { fileIo } from '@kit.CoreFileKit'; import { photoAccessHelper } from '@kit.MediaLibraryKit'; import { BusinessError } from '@kit.BasicServicesKit'; + import { image } from '@kit.ImageKit'; - let uris: Array = []; - - // Create an image picker instance. - let photoSelectOptions = new photoAccessHelper.PhotoSelectOptions(); + @Entry + @Component + struct Index { + @State modelName: string = 'mobilenetv2.ms'; + @State modelInputHeight: number = 224; + @State modelInputWidth: number = 224; + @State uris: Array = []; - // Set the media file type to IMAGE and set the maximum number of media files that can be selected. - photoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE; - photoSelectOptions.maxSelectNumber = 1; + build() { + Row() { + Column() { + Button() { + Text('photo') + .fontSize(30) + .fontWeight(FontWeight.Bold) + } + .type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('40%') + .height('5%') + .onClick(() => { + let resMgr = this.getUIContext()?.getHostContext()?.getApplicationContext().resourceManager; - // Create an album picker instance and call select() to open the album page for file selection. After file selection is done, the result set is returned through photoSelectResult. - let photoPicker = new photoAccessHelper.PhotoViewPicker(); - photoPicker.select(photoSelectOptions, async ( - err: BusinessError, photoSelectResult: photoAccessHelper.PhotoSelectResult) => { - if (err) { - console.error('MS_LITE_ERR: PhotoViewPicker.select failed with err: ' + JSON.stringify(err)); - return; - } - console.info('MS_LITE_LOG: PhotoViewPicker.select successfully, ' + - 'photoSelectResult uri: ' + JSON.stringify(photoSelectResult)); - uris = photoSelectResult.photoUris; - console.info('MS_LITE_LOG: uri: ' + uris); - }) - ``` - -2. Based on the input image size, call [@ohos.multimedia.image](../../reference/apis-image-kit/js-apis-image.md) and [@ohos.file.fs](../../reference/apis-core-file-kit/js-apis-file-fs.md) to perform operations such as cropping the image, obtain the image buffer, and standardizing the image. - - ```ts - import { image } from '@kit.ImageKit'; - import { fileIo } from '@kit.CoreFileKit'; + // Obtain images in an album. + // 1. Create an image picker instance. + let photoSelectOptions = new photoAccessHelper.PhotoSelectOptions(); - let modelInputHeight: number = 224; - let modelInputWidth: number = 224; + // 2. Set the media file type to IMAGE and set the maximum number of media files that can be selected. + photoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE; + photoSelectOptions.maxSelectNumber = 1; - // Based on the specified URI, call fileIo.openSync to open the file to obtain the FD. - let file = fileIo.openSync(this.uris[0], fileIo.OpenMode.READ_ONLY); - console.info('MS_LITE_LOG: file fd: ' + file.fd); + // 3. Create an album picker instance and call select() to open the album page for file selection. After file selection is done, the result set is returned through photoSelectResult. + let photoPicker = new photoAccessHelper.PhotoViewPicker(); + photoPicker.select(photoSelectOptions, + async (err: BusinessError, photoSelectResult: photoAccessHelper.PhotoSelectResult) => { + if (err) { + console.error('MS_LITE_ERR: PhotoViewPicker.select failed with err: ' + JSON.stringify(err)); + return; + } + console.info('MS_LITE_LOG: PhotoViewPicker.select successfully, photoSelectResult uri: ' + + JSON.stringify(photoSelectResult)); + this.uris = photoSelectResult.photoUris; + console.info('MS_LITE_LOG: uri: ' + this.uris); + // Preprocess the image data. + try { + // 1. Based on the specified URI, call fileIo.openSync to open the file to obtain the FD. + let file = fileIo.openSync(this.uris[0], fileIo.OpenMode.READ_ONLY); + console.info('MS_LITE_LOG: file fd: ' + file.fd); - // Based on the FD, call fileIo.readSync to read the data in the file. - let inputBuffer = new ArrayBuffer(4096000); - let readLen = fileIo.readSync(file.fd, inputBuffer); - console.info('MS_LITE_LOG: readSync data to file succeed and inputBuffer size is:' + readLen); + // 2. Based on the FD, call fileIo.readSync to read the data in the file. + let inputBuffer = new ArrayBuffer(4096000); + let readLen = fileIo.readSync(file.fd, inputBuffer); + console.info('MS_LITE_LOG: readSync data to file succeed and inputBuffer size is:' + readLen); - // Perform image preprocessing through PixelMap. - let imageSource = image.createImageSource(file.fd); - imageSource.createPixelMap().then((pixelMap) => { - pixelMap.getImageInfo().then((info) => { - console.info('MS_LITE_LOG: info.width = ' + info.size.width); - console.info('MS_LITE_LOG: info.height = ' + info.size.height); - // Crop the image based on the input image size and obtain the image buffer readBuffer. - pixelMap.scale(256.0 / info.size.width, 256.0 / info.size.height).then(() => { - pixelMap.crop( - { x: 16, y: 16, size: { height: modelInputHeight, width: modelInputWidth } } - ).then(async () => { - let info = await pixelMap.getImageInfo(); - console.info('MS_LITE_LOG: crop info.width = ' + info.size.width); - console.info('MS_LITE_LOG: crop info.height = ' + info.size.height); - // Set the size of readBuffer. - let readBuffer = new ArrayBuffer(modelInputHeight * modelInputWidth * 4); - await pixelMap.readPixelsToBuffer(readBuffer); - console.info('MS_LITE_LOG: Succeeded in reading image pixel data, buffer: ' + - readBuffer.byteLength); - // Convert readBuffer to the float32 format, and standardize the image. - const imageArr = new Uint8Array( - readBuffer.slice(0, modelInputHeight * modelInputWidth * 4)); - console.info('MS_LITE_LOG: imageArr length: ' + imageArr.length); - let means = [0.485, 0.456, 0.406]; - let stds = [0.229, 0.224, 0.225]; - let float32View = new Float32Array(modelInputHeight * modelInputWidth * 3); - let index = 0; - for (let i = 0; i < imageArr.length; i++) { - if ((i + 1) % 4 == 0) { - float32View[index] = (imageArr[i - 3] / 255.0 - means[0]) / stds[0]; // B - float32View[index+1] = (imageArr[i - 2] / 255.0 - means[1]) / stds[1]; // G - float32View[index+2] = (imageArr[i - 1] / 255.0 - means[2]) / stds[2]; // R - index += 3; - } - } - console.info('MS_LITE_LOG: float32View length: ' + float32View.length); - let printStr = 'float32View data:'; - for (let i = 0; i < 20; i++) { - printStr += ' ' + float32View[i]; - } - console.info('MS_LITE_LOG: float32View data: ' + printStr); - }) - }) - }); - }); + // 3. Perform image preprocessing through PixelMap. + let imageSource = image.createImageSource(file.fd); + imageSource.createPixelMap().then((pixelMap) => { + pixelMap.getImageInfo().then((info) => { + console.info('MS_LITE_LOG: info.width = ' + info.size.width); + console.info('MS_LITE_LOG: info.height = ' + info.size.height); + // 4. Crop the image based on the input image size and obtain the image buffer readBuffer. + pixelMap.scale(256.0 / info.size.width, 256.0 / info.size.height).then(() => { + pixelMap.crop({ + x: 16, + y: 16, + size: { height: this.modelInputHeight, width: this.modelInputWidth } + }) + .then(async () => { + let info = await pixelMap.getImageInfo(); + console.info('MS_LITE_LOG: crop info.width = ' + info.size.width); + console.info('MS_LITE_LOG: crop info.height = ' + info.size.height); + // Set the size of readBuffer. + let readBuffer = new ArrayBuffer(this.modelInputHeight * this.modelInputWidth * 4); + await pixelMap.readPixelsToBuffer(readBuffer); + console.info('MS_LITE_LOG: Succeeded in reading image pixel data, buffer: ' + + readBuffer.byteLength); + // Convert readBuffer to the float32 format, and standardize the image. + const imageArr = + new Uint8Array(readBuffer.slice(0, this.modelInputHeight * this.modelInputWidth * 4)); + console.info('MS_LITE_LOG: imageArr length: ' + imageArr.length); + let means = [0.485, 0.456, 0.406]; + let stds = [0.229, 0.224, 0.225]; + let float32View = new Float32Array(this.modelInputHeight * this.modelInputWidth * 3); + let index = 0; + for (let i = 0; i < imageArr.length; i++) { + if ((i + 1) % 4 == 0) { + float32View[index] = (imageArr[i - 3] / 255.0 - means[0]) / stds[0]; // B + float32View[index+1] = (imageArr[i - 2] / 255.0 - means[1]) / stds[1]; // G + float32View[index+2] = (imageArr[i - 1] / 255.0 - means[2]) / stds[2]; // R + index += 3; + } + } + console.info('MS_LITE_LOG: float32View length: ' + float32View.length); + let printStr = 'float32View data:'; + for (let i = 0; i < 20; i++) { + printStr += ' ' + float32View[i]; + } + console.info('MS_LITE_LOG: float32View data: ' + printStr); + }) + }) + }) + }) + } catch (err) { + console.error('MS_LITE_LOG: uri: open file fd failed.' + err); + } + }) + }) + }.width('100%') + } + .height('100%') + } + } ``` #### Writing Inference Code @@ -179,7 +212,7 @@ Call [MindSpore](../../reference/apis-mindspore-lite-kit/_mind_spore.md) to impl } ``` -3. Create a context, set parameters such as the number of threads and device type, and load the model. +3. Create a context, set parameters such as the number of threads and device type, and load the model. The sample model does not support NNRt inference. ```c++ void DestroyModelBuffer(void **buffer) { @@ -198,6 +231,7 @@ Call [MindSpore](../../reference/apis-mindspore-lite-kit/_mind_spore.md) to impl LOGE("MS_LITE_ERR: Create MSLite context failed.\n"); return nullptr; } + // The OH_AI_DeviceInfoCreate(OH_AI_DEVICETYPE_NNRT) option is not supported. auto cpu_device_info = OH_AI_DeviceInfoCreate(OH_AI_DEVICETYPE_CPU); OH_AI_DeviceInfoSetEnableFP16(cpu_device_info, true); @@ -410,41 +444,71 @@ Call [MindSpore](../../reference/apis-mindspore-lite-kit/_mind_spore.md) to impl In **entry/src/main/ets/pages/Index.ets**, call the encapsulated ArkTS module to process the inference result. ```ts +// Index.ets import msliteNapi from 'libentry.so' -import { resourceManager } from '@kit.LocalizationKit'; - -let resMgr = this.getUIContext()?.getHostContext()?.getApplicationContext().resourceManager; -let max: number = 0; -let maxIndex: number = 0; -let maxArray: Array = []; -let maxIndexArray: Array = []; - -// Call the runDemo function of C++. The buffer data of the input image is stored in float32View after preprocessing. For details, see Image Input and Preprocessing. -console.info('MS_LITE_LOG: *** Start MSLite Demo ***'); -let output: Array = msliteNapi.runDemo(Array.from(float32View), resMgr); -// Obtain the maximum number of categories. -this.max = 0; -this.maxIndex = 0; -this.maxArray = []; -this.maxIndexArray = []; -let newArray = output.filter(value => value !== max); -for (let n = 0; n < 5; n++) { - max = output[0]; - maxIndex = 0; - for (let m = 0; m < newArray.length; m++) { - if (newArray[m] > max) { - max = newArray[m]; - maxIndex = m; + +@Entry +@Component +struct Index { + @State modelInputHeight: number = 224; + @State modelInputWidth: number = 224; + @State max: number = 0; + @State maxIndex: number = 0; + @State maxArray: Array = []; + @State maxIndexArray: Array = []; + + build() { + Row() { + Column() { + Button() { + Text('photo') + .fontSize(30) + .fontWeight(FontWeight.Bold) + } + .type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('40%') + .height('5%') + .onClick(() => { + let resMgr = this.getUIContext()?.getHostContext()?.getApplicationContext().resourceManager; + let float32View = new Float32Array(this.modelInputHeight * this.modelInputWidth * 3); + // Image input and preprocessing + // Call the C++ runDemo function. The buffer data of the input image is stored in float32View after preprocessing. For details, see Image Input and Preprocessing. + console.info('MS_LITE_LOG: *** Start MSLite Demo ***'); + let output: Array = msliteNapi.runDemo(Array.from(float32View), resMgr); + + // Obtain the maximum number of categories. + this.max = 0; + this.maxIndex = 0; + this.maxArray = []; + this.maxIndexArray = []; + let newArray = output.filter(value => value !== this.max); + for (let n = 0; n < 5; n++) { + this.max = output[0]; + this.maxIndex = 0; + for (let m = 0; m < newArray.length; m++) { + if (newArray[m] > this.max) { + this.max = newArray[m]; + this.maxIndex = m; + } + } + this.maxArray.push(Math.round(this.max * 10000)); + this.maxIndexArray.push(this.maxIndex); + // Call the array filter function. + newArray = newArray.filter(value => value !== this.max); + } + console.info('MS_LITE_LOG: max:' + this.maxArray); + console.info('MS_LITE_LOG: maxIndex:' + this.maxIndexArray); + console.info('MS_LITE_LOG: *** Finished MSLite Demo ***'); + }) + }.width('100%') } + .height('100%') } - maxArray.push(Math.round(this.max * 10000)); - maxIndexArray.push(this.maxIndex); - // Call the array filter function. - newArray = newArray.filter(value => value !== max); } -console.info('MS_LITE_LOG: max:' + this.maxArray); -console.info('MS_LITE_LOG: maxIndex:' + this.maxIndexArray); -console.info('MS_LITE_LOG: *** Finished MSLite Demo ***'); ``` ### Debugging and Verification diff --git a/en/application-dev/ai/mindspore/mindspore-lite-guidelines.md b/en/application-dev/ai/mindspore/mindspore-lite-guidelines.md index 5dceba6d7ce..a9de0f9f9ac 100644 --- a/en/application-dev/ai/mindspore/mindspore-lite-guidelines.md +++ b/en/application-dev/ai/mindspore/mindspore-lite-guidelines.md @@ -18,7 +18,7 @@ Before getting started, you need to understand the following basic concepts: ## Available APIs -APIs involved in MindSpore Lite model inference are categorized into context APIs, model APIs, and tensor APIs. +APIs involved in MindSpore Lite model inference are categorized into context APIs, model APIs, and tensor APIs. For details about the APIs, see [MindSpore](../../reference/apis-mindspore-lite-kit/_mind_spore.md). ### Context APIs @@ -292,3 +292,9 @@ The development process consists of the following main steps: output data is: 0.000018 0.000012 0.000026 0.000194 0.000156 0.001501 0.000240 0.000825 0.000016 0.000006 0.000007 0.000004 0.000004 0.000004 0.000015 0.000099 0.000011 0.000013 0.000005 0.000023 0.000004 0.000008 0.000003 0.000003 0.000008 0.000014 0.000012 0.000006 0.000019 0.000006 0.000018 0.000024 0.000010 0.000002 0.000028 0.000372 0.000010 0.000017 0.000008 0.000004 0.000007 0.000010 0.000007 0.000012 0.000005 0.000015 0.000007 0.000040 0.000004 0.000085 0.000023 ``` + +## Samples + +The following sample is provided to help you better understand how to use MindSpore Lite: + +- [Simple MindSpore Lite Tutorial](https://gitee.com/openharmony/third_party_mindspore/tree/OpenHarmony-3.2-Release/mindspore/lite/examples/quick_start_c) diff --git a/en/application-dev/ai/mindspore/mindspore-lite-train-guidelines.md b/en/application-dev/ai/mindspore/mindspore-lite-train-guidelines.md index 3de53d09772..dc3d6f68ecf 100644 --- a/en/application-dev/ai/mindspore/mindspore-lite-train-guidelines.md +++ b/en/application-dev/ai/mindspore/mindspore-lite-train-guidelines.md @@ -8,7 +8,7 @@ This topic describes the general development process for using MindSpore Lite fo ## Available APIs -The following table list some APIs for using MindSpore Lite for model training. +The following table list some APIs for using MindSpore Lite for model training. For details about the APIs, see [MindSpore](../../reference/apis-mindspore-lite-kit/_mind_spore.md). | API | Description | | ------------------ | ----------------- | diff --git a/en/application-dev/arkts-utils/arkts-condition-variable-introduction.md b/en/application-dev/arkts-utils/arkts-condition-variable-introduction.md index 458a294839c..5c28a5414fb 100644 --- a/en/application-dev/arkts-utils/arkts-condition-variable-introduction.md +++ b/en/application-dev/arkts-utils/arkts-condition-variable-introduction.md @@ -55,7 +55,7 @@ struct Index { const conditionVariable: ArkTSUtils.locks.ConditionVariable = new ArkTSUtils.locks.ConditionVariable(); // Pass the conditionVariable object to the wait thread. taskpool.execute(wait, conditionVariable); - // Pass the conditionVariable object to the notify thread to wake up the wait thread. The log information "TaskPool Thread Wait: success" is displayed. + // Pass the conditionVariable object to the notifyAll thread to wake up the wait thread. The log information "TaskPool Thread Wait: success" is displayed. taskpool.execute(notifyAll, conditionVariable); // Pass the conditionVariable object to the waitFor thread. taskpool.execute(waitFor, conditionVariable); @@ -67,7 +67,7 @@ struct Index { ArkTSUtils.locks.ConditionVariable.request("Request1"); // Pass the conditionVariableRequest object to the wait thread. taskpool.execute(wait, conditionVariableRequest); - // Pass the conditionVariableRequest object to the notify thread to wake up the wait thread. The log information "TaskPool Thread Wait: success" is displayed. + // Pass the conditionVariableRequest object to the notifyAll thread to wake up the wait thread. The log information "TaskPool Thread Wait: success" is displayed. taskpool.execute(notifyAll, conditionVariableRequest); // Pass the conditionVariableRequest object to the waitFor thread. taskpool.execute(waitFor, conditionVariableRequest); diff --git a/en/application-dev/arkts-utils/arkts-sendable-module.md b/en/application-dev/arkts-utils/arkts-sendable-module.md index 16902fc24d0..5b841517ed5 100644 --- a/en/application-dev/arkts-utils/arkts-sendable-module.md +++ b/en/application-dev/arkts-utils/arkts-sendable-module.md @@ -18,7 +18,7 @@ A non-shared module is loaded once in the same thread and multiple times in diff A shared module is loaded only once within a single process and can be used across multiple threads. - When a shared module is loaded, non-shared modules that it imports are not loaded immediately. Instead, these non-shared modules are lazy-imported within the current thread when their exported variables are accessed. This lazy loading ensures that non-shared modules remain isolated between threads, with each thread potentially loading the module once if needed. + When a shared module is loaded, non-shared modules that it imports are not loaded immediately. Instead, these non-shared modules are lazy-imported within the current thread when their exported variables are accessed. This lazy import feature ensures that non-shared modules remain isolated between threads, with each thread potentially loading the non-shared modules once if needed.
side-effects-import, which does not involve exported variables, is never loaded and therefore is not supported. diff --git a/en/application-dev/arkts-utils/concurrency-faq.md b/en/application-dev/arkts-utils/concurrency-faq.md index 46ef429fd21..885fcd2267e 100644 --- a/en/application-dev/arkts-utils/concurrency-faq.md +++ b/en/application-dev/arkts-utils/concurrency-faq.md @@ -11,7 +11,7 @@ If a task in a TaskPool is not executed, perform the following steps to quickly If this log is missing, **taskpool.execute** is not actually called. Check whether the service logic preceding this API has been completed. ```ts - console.log("test start"); + console.info("test start"); ... // Other service logic. taskpool.execute(xxx); @@ -85,7 +85,7 @@ The application has a timing requirement for the execution of a certain task (re **Solution** -1. Analyze whether the execution duration (3 to 5 seconds) for other tasks are reasonable. +1. Analyze whether the execution duration (3 to 5 seconds) for other tasks are reasonable. 2. Adjust the priority of taskA. ### Tasks in Serial Queue Delayed by Slow Predecessors @@ -128,11 +128,19 @@ The first execution of TaskPool tasks is slow, with a delay of several hundred m **Symptom** 1. JavaScript exception + + Reading the input parameters in serialization fails. ```ts Error message:An exception occurred during serialization, taskpool: failed to serialize arguments. ``` + Failed to deserialize the return value. + + ```ts + Error message:An exception occurred during serialization, taskpool: failed to serialize result. + ``` + 2. HiLog error log ```ts @@ -142,16 +150,80 @@ The first execution of TaskPool tasks is slow, with a delay of several hundred m **Cause** -The input parameters of the concurrent function used by the TaskPool to implement tasks must meet the types supported by inter-thread communication. For details, see [Inter-thread Communication Objects](../reference/apis-arkts/js-apis-taskpool.md#sequenceable-data-types). When unsupported communication objects are passed into the concurrent function, the above phenomena occur. Further check whether the parameters meet the requirements based on the object type printed in HiLog logs. +The input parameters and return value of the concurrent function used by the TaskPool to implement tasks must meet the types supported by inter-thread communication. For details, see [Inter-thread Communication Objects](../reference/apis-arkts/js-apis-taskpool.md#sequenceable-data-types). When unsupported communication objects are passed into or returned by the concurrent function, the above phenomena occur. Further check whether the communication objects meet the requirements based on the object type printed in HiLog logs. **Scenario Example** -1. The application throws a serialization failure exception when starting a task because it passes an unsupported object type for inter-thread communication into the concurrent function. +1. The application throws an exception indicating input parameter serialization failure when starting a task because it passes an unsupported object type for inter-thread communication into the concurrent function. **Solution**: Check the input parameters of the concurrent function based on [Inter-thread Communication Objects](../reference/apis-arkts/js-apis-taskpool.md#sequenceable-data-types). -2. The application throws a serialization failure exception when starting a task, and HiLog prints the error log **Unsupport serialize object type: Proxy**. Based on the error log, the application passes a proxy object into the concurrent function. The parameter uses the @State decorator, causing the original object to become a Proxy object, which is not a supported object type for inter-thread communication. +2. The application throws an exception indicating input parameter serialization failure when starting a task, and HiLog prints the error log **Unsupport serialize object type: Proxy**. Based on the error log, the application passes a proxy object into the concurrent function. The parameter uses the @State decorator, causing the original object to become a Proxy object, which is not a supported object type for inter-thread communication. **Solution**: TaskPool does not support complex types decorated with @State and @Prop. For details, see [Precautions for TaskPool](taskpool-introduction.md#precautions-for-taskpool). The application should remove the @State decorator. +3. The application throws an exception indicating return value serialization failure when executing a task. The code check shows that the return value of the concurrent function is an unsupported serialization type. + + ```ts + // utils.ets + @Concurrent + export function printArgs(args: number) { + return args; + } + + // index.ets + import { taskpool } from '@kit.ArkTS' + import { BusinessError } from '@kit.BasicServicesKit' + import { printArgs} from './utils' + @Concurrent + function createTask(a: number, b:number) { + let sum = a + b; + // task1: unsupported serialization type + let task: taskpool.Task = new taskpool.Task(printArgs, sum); + return task; + } + + function executeTask() { + // task2 + let task: taskpool.Task = new taskpool.Task(createTask, 1, 2); + taskpool.execute(task).then((res) => { + }).catch((e: BusinessError) => { + // Print the error message "Failed to serialize the returned result." + console.error("execute task failed " + e.message); + }) + } + ``` + + **Solution**: Create and execute task 1 within **.then**. Set the return value of the concurrent function to a serializable type. + + ```ts + // utils.ets + @Concurrent + export function printArgs(args: number) { + return args; + } + + // index.ets + import { taskpool } from '@kit.ArkTS' + import { BusinessError } from '@kit.BasicServicesKit' + import { printArgs} from './utils' + @Concurrent + function createTask(a: number, b:number) { + // Supported serialization types + let sum = a + b; + return sum; + } + + function executeTask() { + // task2 + let task: taskpool.Task = new taskpool.Task(createTask, 1, 2); + taskpool.execute(task).then((res) => { + // task1 + let task: taskpool.Task = new taskpool.Task(printArgs, res); + }).catch((e: BusinessError) => { + console.error("execute task failed " + e.message); + }) + } + ``` + ## Using instanceof with Sendable Objects in Child Threads Returns False When using the **instanceof** operator in a child thread, the application needs to mark the module exporting Sendable class A in the .ets file with the **use shared** directive to indicate that the module is a [shared module](../arkts-utils/arkts-sendable-module.md#shared-module). @@ -167,13 +239,13 @@ function testInstanceof() { let a = new A(); if (a instanceof A) { // Print "test instanceof in main thread success". - console.log("test instanceof in main thread success"); + console.info("test instanceof in main thread success"); } else { - console.log("test instanceof in main thread fail"); + console.info("test instanceof in main thread fail"); } workerInstance.postMessageWithSharedSendable(a); workerInstance.onerror = (err: ErrorEvent) => { - console.log("worker err :" + err.message) + console.error("worker err :" + err.message) } } @@ -200,9 +272,9 @@ workerPort.onmessage = (e: MessageEvents) => { let a : A = e.data as A; if (a instanceof A) { // Print "test instanceof in worker thread success". - console.log("test instanceof in worker thread success"); + console.info("test instanceof in worker thread success"); } else { - console.log("test instanceof in worker thread fail"); + console.info("test instanceof in worker thread fail"); } } ``` @@ -225,7 +297,7 @@ ArkTS runtime strictly checks type consistency during property assignment. If th **Scenario Example** -1. A type mismatch exception is thrown when the application passes an instance of Sendable class A to a child thread. Based on the JavaScript stack, the problem occurs when creating an instance of class A. It is found that when the application is integrated with other modules, the other modules do not use Sendable class B to encapsulate the dataset. +1. A type mismatch exception is thrown when the application passes an instance of Sendable class A to a child thread. Based on the JavaScript stack, the problem occurs when creating an instance of class A. It is found that when the application is integrated with other modules, the other modules do not use Sendable class B to encapsulate the dataset. **Solution**: Use a Sendable class to re-encapsulate the data passed by other modules into the current module. @@ -271,12 +343,42 @@ Since the layout of Sendable classes is fixed and does not allow adding or remov 3. An exception is thrown when the application attempts to add a new property while using the Sendable feature in Local Test or Previewer. Since the Sendable feature is currently not supported in Local Test and Previewer, the exception is thrown. **Solution**: Due to specification limitations, this is currently not supported. -## What is the Principle Behind ArkTS Promise? +## What Is the Principle Behind ArkTS Promise? Promise is the asynchronous concurrency capability provided by ArkTS and is a standard JavaScript syntax. For details, see [Promise](async-concurrency-overview.md#promise). -## Can Taskpool Threads Execute JavaScript Closure Functions That Do Not Require @Concurrent and @Sendable Decorators? +## Can TaskPool Threads Execute JavaScript Closure Functions That Do Not Require @Concurrent and @Sendable Decorators? Task functions executed by the TaskPool must be decorated with @Concurrent. Since concurrent functions cannot access closures, they cannot call other regular functions within the same file. For details, see [Precautions for TaskPool](taskpool-introduction.md#precautions-for-taskpool). However, you can pass @Sendable-decorated regular functions and async functions as parameters to concurrent functions and call Sendable functions within the concurrent functions. TaskPool threads do not support executing regular JavaScript closure functions. If necessary, you can use the [Worker](worker-introduction.md) concurrency capability to reconstruct your services. + +## How Do I Save the Execution Result of a TaskPool Task to a Custom Data Structure? + +**Symptom** + +The execution function (concurrent function) of a TaskPool task can only use local variables and function parameters. How should I save its execution result of a TaskPool task to a custom data structure? + +**Solution** + +1. Custom Sendable class: [Sendable objects](arkts-sendable.md) can be shared across different threads. You can save the task execution results within these objects. + +2. Returning results in **.then**: The execution result of a TaskPool task can be returned within **.then**. If the data to be saved is only used in the current thread, the execution result can be stored in a custom data structure within **.then**. + + ```ts + import { taskpool } from '@kit.ArkTS' + import { BusinessError } from '@kit.BasicServicesKit' + @Concurrent + function createTask(a: number) { + return a; + } + function executeTask() { + let task: taskpool.Task = new taskpool.Task(createTask, 1) + taskpool.execute(task).then((res) => { + console.info('execute task success'); + // Save the data to the custom data structure. + }).catch((e: BusinessError) => { + console.error('execute task error: ${e.message}'); + }) + } + ``` diff --git a/en/application-dev/arkts-utils/linear-container.md b/en/application-dev/arkts-utils/linear-container.md index 882c2602d29..0afec44e087 100644 --- a/en/application-dev/arkts-utils/linear-container.md +++ b/en/application-dev/arkts-utils/linear-container.md @@ -39,7 +39,7 @@ Common APIs for adding, removing, modifying, and accessing elements in ArrayList ## List -[List](../reference/apis-arkts/js-apis-list.md) is used to construct a singly linked list, which supports access only through the head node to the tail node. Defined by generics, List's storage locations in memory can be non-contiguous. +[List](../reference/apis-arkts/js-apis-list.md) is used to construct a singly linked list. To search for a specific element within the List, traversal must start from the head node. Defined by generics, the storage locations of elements in the Link can be non-contiguous in memory. Unlike [LinkedList](../reference/apis-arkts/js-apis-linkedlist.md), which is a doubly linked list and allows quick insertions and deletions at both ends, List is a singly linked list and does not support bidirectional operations. @@ -57,7 +57,7 @@ Common APIs for adding, removing, modifying, and accessing elements in List are | Accessing elements| getLast() | Obtains the last element.| | Accessing elements| getIndexOf(element: T) | Obtains the index of the first matching element.| | Accessing elements| getLastIndexOf(element: T) | Obtains the index of the last matching element.| -| Accessing elements| forEach(callbackfn: (value:T, index?: number, list?: List<T>)=> void,thisArg?: Object) | Iterates over all elements in the List.| +| Accessing elements| forEach(callbackfn: (value:T, index?: number, list?: List<T>)=> void,thisArg?: Object) | Iterates over each element in the List and executes the specified callback function.| | Accessing elements| \[Symbol.iterator]():IterableIterator<T> | Creates an iterator for data access.| | Modifying elements| set(index:number, element: T) | Modifies the element at the specified index.| | Modifying elements| list[index] = element | Modifies the element at the specified index. This API does not make any actual changes to the nodes in the linked list. Instead, it simply adds a property to the object. This can cause the program's state to become inconsistent with the actual contents of the linked list, leading to undefined behavior.| @@ -67,7 +67,7 @@ Common APIs for adding, removing, modifying, and accessing elements in List are ## LinkedList -[LinkedList](../reference/apis-arkts/js-apis-linkedlist.md) is used to construct a doubly linked list, which can be traversed in both directions from any node. Defined by generics, LinkedList's storage locations in memory can be non-contiguous. +[LinkedList](../reference/apis-arkts/js-apis-linkedlist.md) is used to construct a doubly linked list, which can be traversed in both directions from any node. Defined by generics, the storage locations of elements in LinkedList can be non-contiguous in memory. Unlike [List](../reference/apis-arkts/js-apis-list.md), which is a singly linked list and does not support bidirectional operations, LinkedList is a doubly linked list and allows quick insertions and deletions at both ends. @@ -87,7 +87,7 @@ Common APIs for adding, removing, modifying, and accessing elements in LinkedLis | Accessing elements| getLast() | Obtains the last element.| | Accessing elements| getIndexOf(element: T) | Obtains the index of the first matching element.| | Accessing elements| getLastIndexOf(element: T) | Obtains the index of the last matching element.| -| Accessing elements| forEach(callbackFn: (value: T, index?: number, list?: LinkedList<T>) => void, thisArg?: Object) | Iterates over all elements in the LinkedList.| +| Accessing elements| forEach(callbackFn: (value: T, index?: number, list?: LinkedList<T>) => void, thisArg?: Object) | Iterates over each element in the LinkedList and executes the specified callback function.| | Accessing elements| \[Symbol.iterator]():IterableIterator<T> | Creates an iterator for data access.| | Modifying elements| set(index:number, element: T) | Modifies the element at the specified index.| | Modifying elements| list[index] = element | Modifies the element at the specified index. However, this will result in undefined behavior.| @@ -114,11 +114,10 @@ Common APIs for adding, removing, modifying, and accessing elements in Deque are | Adding elements| insertEnd(element: T) | Adds an element to the end of the Deque.| | Accessing elements| getFirst() | Obtains the first element without dequeuing.| | Accessing elements| getLast() | Obtains the last element without dequeuing.| -| Accessing elements| forEach(callbackFn:(value: T, index?: number, deque?: Deque<T>) => void, thisArg?: Object) | Iterates over all elements in the Deque.| +| Accessing elements| forEach(callbackFn:(value: T, index?: number, deque?: Deque<T>) => void, thisArg?: Object) | Iterates over each element in the Deque and executes the specified callback function.| | Accessing elements| \[Symbol.iterator]():IterableIterator<T> | Creates an iterator for data access.| -| Modifying elements| forEach(callbackFn:(value: T, index?: number, deque?: Deque<T>)=> void, thisArg?: Object) | Modifies all elements in the Deque through iteration.| -| Removing elements| popFirst() | Removes the first element from the queue and returns it. If the queue is empty, undefined is returned.| -| Removing elements| popLast() | Removes the last element from the queue and returns it. If the queue is empty, undefined is returned.| +| Removing elements| popFirst() | Removes the first element from the Queue and returns it. If the Queue is empty, undefined is returned.| +| Removing elements| popLast() | Removes the last element from the Queue and returns it. If the Queue is empty, undefined is returned.| ## Queue @@ -138,10 +137,9 @@ Common APIs for adding, removing, modifying, and accessing elements in Queue are | --------- | ------- | ------- | | Adding elements| add(element: T) | Adds an element to the end of the Queue.| | Accessing elements| getFirst() | Obtains the first element without dequeuing.| -| Accessing elements| forEach(callbackFn: (value: T, index?: number, queue?: Queue<T>) => void,thisArg?: Object) | Iterates over all elements in the Queue.| +| Accessing elements| forEach(callbackFn: (value: T, index?: number, queue?: Queue<T>) => void,thisArg?: Object) | Iterates over each element in the Queue and executes the specified callback function.| | Accessing elements| \[Symbol.iterator]():IterableIterator<T> | Creates an iterator for data access.| -| Modifying elements| forEach(callbackFn: (value: T, index?: number, queue?: Queue<T>) => void,thisArg?: Object) | Modifies all elements in the Queue through iteration.| -| Removing elements| pop() | Removes the first element from the queue and returns it.| +| Removing elements| pop() | Removes the first element from the Queue and returns it.| ## Stack @@ -160,10 +158,9 @@ Common APIs for adding, removing, modifying, and accessing elements in Stack are | Adding elements| push(item: T) | Adds an element to the top of the Stack.| | Accessing elements| peek() | Obtains the top element of the Stack without dequeuing.| | Accessing elements| locate(element: T) | Obtains the position of an element.| -| Accessing elements| forEach(callbackFn: (value: T, index?: number, stack?: Stack<T>) => void, thisArg?: Object) | Iterates over all elements in the Stack.| +| Accessing elements| forEach(callbackFn: (value: T, index?: number, stack?: Stack<T>) => void, thisArg?: Object) | Iterates over each element in the Stack and executes the specified callback function.| | Accessing elements| \[Symbol.iterator]():IterableIterator<T> | Creates an iterator for data access.| -| Modifying elements| forEach(callbackFn: (value: T, index?: number, stack?: Stack<T>) => void, thisArg?: Object) | Modifies all elements in the Stack through iteration.| -| Removing elements| pop() | Removes the first element from the stack and returns it.| +| Removing elements| pop() | Removes the first element from the Stack and returns it.| ## Vector @@ -187,7 +184,7 @@ Common APIs for adding, removing, modifying, and accessing elements in Vector ar | Accessing elements| getLastElement() | Obtains the last element.| | Accessing elements| getIndexOf(element: T) | Obtains the index of the first matching element.| | Accessing elements| getLastIndexOf(element: T) | Obtains the index of the last matching element.| -| Accessing elements| forEach(callbackFn: (value: T, index?: number, Vector?: Vector<T>) => void, thisArg?: Object) | Iterates over all elements in the Vector.| +| Accessing elements| forEach(callbackFn: (value: T, index?: number, Vector?: Vector<T>) => void, thisArg?: Object) | Iterates over each element in the Stack and executes the specified callback function.| | Accessing elements| \[Symbol.iterator]():IterableIterator<T> | Creates an iterator for data access.| | Modifying elements| set(index:number, element: T) | Modifies the element at the specified index.| | Modifying elements| vec[index] = element | Modifies the element at the specified index.| diff --git a/en/application-dev/connectivity/bluetooth/Readme-EN.md b/en/application-dev/connectivity/bluetooth/Readme-EN.md index 22f9501bad4..a3e177a08a9 100644 --- a/en/application-dev/connectivity/bluetooth/Readme-EN.md +++ b/en/application-dev/connectivity/bluetooth/Readme-EN.md @@ -1,9 +1,11 @@ # Bluetooth - [Bluetooth Overview](bluetooth-overview.md) +- [Bluetooth Setting](br-development-guide.md) - Classic Bluetooth - - [Bluetooth Setting Development](br-development-guide.md) - - [SPP-based Data Transmission Development](spp-development-guide.md) + - [Device Discovery](br-discovery-development-guide.md) + - [Device Pairing](br-pair-device-development-guide.md) + - [SPP-based Data Transmission](spp-development-guide.md) - Bluetooth Low Energy - - [BLE Advertising and Scanning Development](ble-development-guide.md) - - [GATT-based BLE Connection and Data Transmission Development](gatt-development-guide.md) + - [BLE Advertising and Scanning](ble-development-guide.md) + - [GATT-based BLE Connection and Data Transmission](gatt-development-guide.md) diff --git a/en/application-dev/connectivity/bluetooth/ble-development-guide.md b/en/application-dev/connectivity/bluetooth/ble-development-guide.md index 77ac90c0adf..176a0bfefc0 100644 --- a/en/application-dev/connectivity/bluetooth/ble-development-guide.md +++ b/en/application-dev/connectivity/bluetooth/ble-development-guide.md @@ -1,9 +1,11 @@ -# BLE Advertising and Scanning Development +# BLE Advertising and Scanning ## Introduction + Bluetooth advertising and scanning help discover Bluetooth-enabled devices and implement BLE communication. This topic walks you through on how to start and stop Bluetooth advertising and scanning. ## When to Use + You can use the APIs provided by the **ble** module to: - Start and stop BLE advertising. diff --git a/en/application-dev/connectivity/bluetooth/br-development-guide.md b/en/application-dev/connectivity/bluetooth/br-development-guide.md index 6a12c4dac1f..1f4304c4069 100644 --- a/en/application-dev/connectivity/bluetooth/br-development-guide.md +++ b/en/application-dev/connectivity/bluetooth/br-development-guide.md @@ -1,9 +1,11 @@ -# Bluetooth Setting Development +# Bluetooth Setting ## Introduction + This topic walks you through on how to implement basic Bluetooth settings, including enabling and disabling Bluetooth and obtaining Bluetooth status. ## When to Use + You can use the APIs provided by the **access** module to: - Enable and disable Bluetooth. diff --git a/en/application-dev/connectivity/bluetooth/br-discovery-development-guide.md b/en/application-dev/connectivity/bluetooth/br-discovery-development-guide.md new file mode 100644 index 00000000000..532f8757dda --- /dev/null +++ b/en/application-dev/connectivity/bluetooth/br-discovery-development-guide.md @@ -0,0 +1,201 @@ +# Device Discovery + +## Introduction +This document describes how to implement the Bluetooth device discovery capabilities, such as scanning for nearby devices, setting the Bluetooth scan mode, and retrieving information about paired devices. + +## How to Develop + +### Applying for Required Permissions +Apply for the **ohos.permission.ACCESS_BLUETOOTH** permission. For details about how to configure and apply for permissions, see [Declaring Permissions](../../security/AccessToken/declare-permissions.md) and [Requesting User Authorization](../../security/AccessToken/request-user-authorization.md). + +### Importing Required Modules +Import the **connection** and **BusinessError** modules. +```ts +import { connection } from '@kit.ConnectivityKit'; +import { BusinessError } from '@kit.BasicServicesKit'; +``` + +### Scanning for Nearby Bluetooth Devices +This function allows your application to scan for nearby Bluetooth devices and obtain partial information about them. This process can also be referred to as search, discovery, or find. Only nearby Bluetooth devices that are in a discoverable state can be scanned by the local Bluetooth device. + +#### Subscribing to Scan Result Reporting Events +- You are advised to use the scan result reporting mode in API version 18 or later. This allows you to obtain more device information, including the device address, signal strength, name, and type. For details, see [connection.on('discoveryResult')](../../reference/apis-connectivity-kit/js-apis-bluetooth-connection.md#connectionondiscoveryresult18). +```ts +// Define the callback for scan result reporting events. +function onReceiveEvent(data: Array) { + console.info('bluetooth device: '+ JSON.stringify(data)); +} + +try { + // Subscribe to scan result reporting events. + connection.on('discoveryResult', onReceiveEvent); +} catch (err) { + console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); +} +``` +- The scan result reporting mode in API version 17 or earlier can retrieve only the device address information. For details, see [connection.on('bluetoothDeviceFind')](../../reference/apis-connectivity-kit/js-apis-bluetooth-connection.md#connectiononbluetoothdevicefind). +```ts +// Define the callback for scan result reporting events. +function onReceiveEvent(data: Array) { + console.info('bluetooth device: '+ JSON.stringify(data)); +} + +try { + // Subscribe to scan result reporting events. + connection.on('bluetoothDeviceFind', onReceiveEvent); +} catch (err) { + console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); +} +``` + +#### Initiating Device Scanning +A scan process takes about 12 seconds after being initiated. The application can initiate pairing, connection, and data transmission with the discovered Bluetooth device. For details, see [Device Pairing](br-pair-device-development-guide.md) and [SPP-based Data Transmission](spp-development-guide.md). +```ts +try { + // Check whether scanning is in progress on the local device. + let scan = connection.isBluetoothDiscovering(); + if (!scan) { + // Start scanning for devices if a scan is not in progress. + connection.startBluetoothDiscovery(); + } +} catch (err) { + console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); +} +``` + +#### Stopping Device Scanning +Scanning is a process that consumes a large amount of Bluetooth hardware resources. When the expected Bluetooth device is discovered, the device scanning must be stopped before a connection is initiated. +```ts +// Define the callback for scan result reporting events. +function onReceiveEvent(data: Array) { + console.info('bluetooth device: '+ JSON.stringify(data)); +} + +try { + // Check whether scanning is in progress on the local device. + let scan = connection.isBluetoothDiscovering(); + if (scan) { + // Stop scanning for devices if a scan is in progress. + connection.stopBluetoothDiscovery(); + } + // If scanning is no longer needed, unsubscribe from scan result reporting events. + connection.off('bluetoothDeviceFind', onReceiveEvent); +} catch (err) { + console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); +} +``` + +### Setting the Bluetooth Scan Mode of the Local Device +The Bluetooth scan mode of the local device determines whether the local device can be scanned or connected by other Bluetooth devices. Typically, non-system applications do not need to concern themselves with this mode, as the system settings application will handle its configuration. +- If the Bluetooth settings screen is in the foreground when Bluetooth has been enabled, the Bluetooth scan mode of the local device is set to [SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE](../../reference/apis-connectivity-kit/js-apis-bluetooth-connection.md#scanmode). In this mode, the local device can be discovered by other Bluetooth devices and can accept incoming connections +- If the Bluetooth settings screen is in the background when Bluetooth has been enabled, the Bluetooth scan mode of the local device is set to [SCAN_MODE_CONNECTABLE](../../reference/apis-connectivity-kit/js-apis-bluetooth-connection.md#scanmode). In this mode, the local device can accept incoming connections but cannot be discovered by other Bluetooth devices. + +```ts +try { + // Obtain the current scan mode of the local device. + let scanMode: connection.ScanMode = connection.getBluetoothScanMode(); + console.info('scanMode: ' + scanMode); + if (scanMode != connection.ScanMode.SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE) { + // Set the scan mode of the local device to SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE. + connection.setBluetoothScanMode(connection.ScanMode.SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE, 0); + } +} catch (err) { + console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); +} +``` + +### Retrieving Information About Paired Devices +To streamline device scanning, check if the device is paired before initiating a scan. You can also initiate connection and data transmission processes for paired devices. For details, see [Device Pairing](br-pair-device-development-guide.md) and [SPP-based Data Transmission](spp-development-guide.md). + +```ts +try { + // Obtain information about the paired devices. + let devices = connection.getPairedDevices(); + console.info('pairedDevices: ' + JSON.stringify(devices)); + // If the device address is known, check whether the device has been paired. + if (devices.length > 0) { + let pairState = connection.getPairState(devices[0]); + console.info('device: '+ devices[0] + ' pairState is ' + pairState); + } +} catch (err) { + console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); +} +``` + +## Sample Code +```ts +import { connection } from '@kit.ConnectivityKit'; +import { BusinessError } from '@kit.BasicServicesKit'; + +export class DiscoveryDeviceManager { + // Define the callback for scan result reporting events. + onReceiveEvent(data: Array) { + console.info('bluetooth device: '+ JSON.stringify(data)); + } + + public startDiscovery() { + try { + connection.on('bluetoothDeviceFind', this.onReceiveEvent); + } catch (err) { + console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); + } + try { + // Check whether scanning is in progress on the local device. + let scan = connection.isBluetoothDiscovering(); + if (!scan) { + // Start scanning for devices if a scan is not in progress. + connection.startBluetoothDiscovery(); + } + } catch (err) { + console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); + } + } + + public stopDiscovery() { + try { + // Check whether scanning is in progress on the local device. + let scan = connection.isBluetoothDiscovering(); + if (scan) { + // Stop scanning for devices if a scan is in progress. + connection.stopBluetoothDiscovery(); + } + // If scanning is no longer needed, unsubscribe from scan result reporting events. + connection.off('bluetoothDeviceFind', this.onReceiveEvent); + } catch (err) { + console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); + } + } + + public setScanMode() { + try { + // Obtain the current scan mode of the local device. + let scanMode: connection.ScanMode = connection.getBluetoothScanMode(); + console.info('scanMode: ' + scanMode); + if (scanMode != connection.ScanMode.SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE) { + // Set the scan mode of the local device to SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE. + connection.setBluetoothScanMode(connection.ScanMode.SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE, 0); + } + } catch (err) { + console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); + } + } + + public getPairedDevices() { + try { + // Obtain information about the paired devices. + let devices = connection.getPairedDevices(); + console.info('pairedDevices: ' + JSON.stringify(devices)); + // If the device address is known, check whether the device has been paired. + if (devices.length > 0) { + let pairState = connection.getPairState(devices[0]); + console.info('device: '+ devices[0] + ' pairState is ' + pairState); + } + } catch (err) { + console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); + } + } +} + +let discoveryDeviceManager = new DiscoveryDeviceManager(); +export default discoveryDeviceManager as DiscoveryDeviceManager; +``` diff --git a/en/application-dev/connectivity/bluetooth/br-pair-device-development-guide.md b/en/application-dev/connectivity/bluetooth/br-pair-device-development-guide.md new file mode 100644 index 00000000000..cd702381e77 --- /dev/null +++ b/en/application-dev/connectivity/bluetooth/br-pair-device-development-guide.md @@ -0,0 +1,210 @@ +# Device Pairing + +## Introduction + +This document describes how to develop the profile for proactive device pairing and connection. + +## How to Develop + +### Applying for the Required Permission + +Apply for the **ohos.permission.ACCESS_BLUETOOTH** permission. For details about how to configure and apply for permissions, see [Declaring Permissions](../../security/AccessToken/declare-permissions.md) and [Requesting User Authorization](../../security/AccessToken/request-user-authorization.md). + +### Importing Required Modules + +Import the **connection**, **a2dp**, **hfp**, **hid**, **baseProfile**, **constant**, and error code modules. +```ts +import { connection, a2dp, hfp, hid, baseProfile, constant } from '@kit.ConnectivityKit'; +import { BusinessError } from '@kit.BasicServicesKit'; +``` + +### Subscribing to Pairing Status Change Events +You can subscribe to pairing status change events to obtain the real-time pairing status. Multiple status transitions occur during the pairing process. + +Through the [BOND_STATE_BONDED](../../reference/apis-connectivity-kit/js-apis-bluetooth-connection.md#bondstate) event, you can obtain the pairing status of the device that initiates pairing proactively or is paired. +```ts +// Define the callback for pairing status changes. +function onReceiveEvent(data: connection.BondStateParam) { + console.info('pair result: '+ JSON.stringify(data)); +} + +try { + // Subscribe to pairing status changes. + connection.on('bondStateChange', onReceiveEvent); +} catch (err) { + console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); +} +``` + +### Initiating Pairing + +If the pairing status of the target device is [BOND_STATE_INVALID](../../reference/apis-connectivity-kit/js-apis-bluetooth-connection.md#bondstate), the current device can proactively pair with the target device. + +You can obtain the target device through the device discovery process. For details, see [Traditional Bluetooth Device Discovery](br-discovery-development-guide.md) or [Bluetooth Low Energy Device Discovery](ble-development-guide.md). + +During the pairing process, a dialog box is displayed. The dialog box style varies according to the pairing type. The following figure shows the **Confirm Passkey** dialog box. The pairing can proceed only when the user agrees to the authorization. + +![pair request dialog](figures/pair-request-dialog.png) + +**Figure 1** Bluetooth pairing request dialog box + +```ts +// Obtain the device address through the device discovery process. +let device = 'XX:XX:XX:XX:XX:XX'; + +try { + // Initiate pairing. + connection.pairDevice(device).then(() => { + console.info('pairDevice'); + }, (error: BusinessError) => { + console.error('pairDevice: errCode:' + error.code + ',errMessage' + error.message); + }); +} catch (err) { + console.error('startPair: errCode:' + err.code + ',errMessage' + err.message); +} +``` + +### Connecting to the Profile of a Paired Device +After successful pairing, an application can call [connectAllowedProfiles](../../reference/apis-connectivity-kit/js-apis-bluetooth-connection.md#connectionconnectallowedprofiles16) to connect to the profile supported by the target device. The profile can only be A2DP, HFP, or HID. If you need to use the SPP connection, see [SPP-based Data Transmission Development](spp-development-guide.md). + +- The Bluetooth subsystem queries and saves all profiles supported by the target device during pairing. +- After the pairing is complete, the application can call [getRemoteProfileUuids](../../reference/apis-connectivity-kit/js-apis-bluetooth-connection.md#connectiongetremoteprofileuuids12) to query the profiles supported by the target device. If an applicable profile exists, the application can initiate a connection to the profile within 30 seconds after successful pairing. +```ts +// Device address of the paired device +let device = 'XX:XX:XX:XX:XX:XX'; + +// Create an A2DP, HFP, or HID instance. +let a2dpSrc = a2dp.createA2dpSrcProfile(); +let hfpAg = hfp.createHfpAgProfile(); +let hidHost = hid.createHidHostProfile(); + +//Define the callback function for A2DP connection status changes. +function onA2dpConnectStateChange(data: baseProfile.StateChangeParam) { + console.info(`A2DP State: ${JSON.stringify(data)}`); +} + +// Define the callback for HFP connection status change events. +function onHfpConnectStateChange(data: baseProfile.StateChangeParam) { + console.info(`HFP State: ${JSON.stringify(data)}`); +} + +// Define the callback for HID connection status change events. +function onHidConnectStateChange(data: baseProfile.StateChangeParam) { + console.info(`HID State: ${JSON.stringify(data)}`); +} + +try { + // Check whether the target device supports the A2DP, HFP, and HID profiles. + // Subscribe to connection status change events depending on the supported profile. + a2dpSrc.on('connectionStateChange', onA2dpConnectStateChange); + hfpAg.on('connectionStateChange', onHfpConnectStateChange); + hidHost.on('connectionStateChange', onHidConnectStateChange); + + // Initiate a connection to the profile. + connection.connectAllowedProfiles(device).then(() => { + console.info('connectAllowedProfiles'); + }, (error: BusinessError) => { + console.error('errCode:' + error.code + ',errMessage' + error.message); + }); +} catch (err) { + console.error('errCode:' + err.code + ',errMessage' + err.message); +} +``` + +## Sample Code + +```ts +import { connection, a2dp, hfp, hid, baseProfile, constant } from '@kit.ConnectivityKit'; +import { BusinessError } from '@kit.BasicServicesKit'; + +export class PairDeviceManager { + device: string | null = null; + pairState: connection.BondState = connection.BondState.BOND_STATE_INVALID; + a2dpSrc = a2dp.createA2dpSrcProfile(); + hfpAg = hfp.createHfpAgProfile(); + hidHost = hid.createHidHostProfile(); + + // Define the callback for pairing status change events. + onBondStateEvent(data: connection.BondStateParam) { + console.info('pair result: '+ JSON.stringify(data)); + if (data && data.deviceId == this.device) { + this.pairState = data.state; // Save the pairing status of the target device. + } + } + + // Initiate pairing. The device address can be obtained through the device discovery process. + public startPair(device: string) { + this.device = device; + try { + // Subscribe to pairing status change events. + connection.on('bondStateChange', this.onBondStateEvent); + } catch (err) { + console.error('bondStateChange errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); + } + + try { + // Initiate pairing. + connection.pairDevice(device).then(() => { + console.info('pairDevice'); + }, (error: BusinessError) => { + console.error('pairDevice: errCode:' + error.code + ',errMessage' + error.message); + }); + } catch (err) { + console.error('startPair: errCode:' + err.code + ',errMessage' + err.message); + } + } + + // Define the callback for A2DP connection status change events. + onA2dpConnectStateChange(data: baseProfile.StateChangeParam) { + console.info(`A2DP State: ${JSON.stringify(data)}`); + } + + // Define the callback for HFP connection status change events. + onHfpConnectStateChange(data: baseProfile.StateChangeParam) { + console.info(`HFP State: ${JSON.stringify(data)}`); + } + + // Define the callback for HID connection status change events. + onHidConnectStateChange(data: baseProfile.StateChangeParam) { + console.info(`HID State: ${JSON.stringify(data)}`); + } + + // Initiate a connection. + public async connect(device: string) { + try { + let uuids = await connection.getRemoteProfileUuids(device); + console.info('device: ' + device + ' remoteUuids: '+ JSON.stringify(uuids)); + let allowedProfiles = 0; + // If an applicable profile exists, enable listening for connection status changes of the profile. + if (uuids.some(uuid => uuid == constant.ProfileUuids.PROFILE_UUID_A2DP_SINK.toLowerCase())) { + console.info('device supports a2dp'); + allowedProfiles++; + this.a2dpSrc.on('connectionStateChange', this.onA2dpConnectStateChange); + } + if (uuids.some(uuid => uuid == constant.ProfileUuids.PROFILE_UUID_HFP_HF.toLowerCase())) { + console.info('device supports hfp'); + allowedProfiles++; + this.hfpAg.on('connectionStateChange', this.onHfpConnectStateChange); + } + if (uuids.some(uuid => uuid == constant.ProfileUuids.PROFILE_UUID_HID.toLowerCase()) || + uuids.some(uuid => uuid == constant.ProfileUuids.PROFILE_UUID_HOGP.toLowerCase())) { + console.info('device supports hid'); + allowedProfiles++; + this.hidHost.on('connectionStateChange', this.onHidConnectStateChange); + } + if (allowedProfiles > 0) { // If there is an applicable profile, initiate a connection. + connection.connectAllowedProfiles(device).then(() => { + console.info('connectAllowedProfiles'); + }, (error: BusinessError) => { + console.error('errCode:' + error.code + ',errMessage' + error.message); + }); + } + } catch (err) { + console.error('errCode:' + err.code + ',errMessage' + err.message); + } + } +} + +let pairDeviceManager = new PairDeviceManager(); +export default pairDeviceManager as PairDeviceManager; +``` diff --git a/en/application-dev/connectivity/bluetooth/figures/disable-bluetooth-dialog.png b/en/application-dev/connectivity/bluetooth/figures/disable-bluetooth-dialog.png new file mode 100644 index 0000000000000000000000000000000000000000..b46b620a44e73d91162e2bd50ce6721065c25b95 GIT binary patch literal 20596 zcmXV%1y~f{`}Sv-Zjf#kq&t+5SVHL#kPayUkp^j4q(fM`OF-mHDIgM3OG=9pN_Q!- zfUx9$_`UC57qL6DGv_?#%z2)<@6W{P>8O$rG7tg)K%%auq7MKN1o(doJ}&qh*0=2j z{(*Swt11DtV@x~X8*E2KZAAe1luUGGg9E-N@K7`L1_08YyC2Aa`v-df&?8V+Q8e_o z`dfgP&D1wld(eLCZWr-Q+HsC9AHtna`2-Qm&hh3|7Z)Qju9gU$i1hDu`>yqTQF>y0 zz3CSz`_k?~jaW1a)jl|5$i71-_mw8CM3~j1RDe3B0&_$&G6P zBj79WLk^Iglaq6*Ck_!27Z=|vc>#S6Zl6}JnIq^@WesV}KRsAl0{46s^^q>7uetV- z$un#Oah$_%1O&@|qF7PP|L{4zn0+iUtGvbT?rvF0i6R3dV|itz`jbSumFkw3U*MOk zU%t19?AG?6vcPfdw)CJ2j_!7K{z|(xSX(bd0o?X0VAd(KMC}bVH50V5MHJs_=W&TU zj->}2Z+=5X5jh;K_SM^eyJyA{?jch(*5 z0n0ZLRQ&J(*e3b@PL-2eJNLf#)|hXOKC#A?sQ|IN2putV)Hn>*$)j{8!H<2lq9jG( zR%Q$_eib5jrKR)i|WftkF<#SBVGj zycsWyCjoHEiu#sp+VEl{&H7g&TDz`%F1xM!xrn{uAgpUEZK7TOJ;GqcNUCYx8@qr8 za6L_CRan#xM$C>HPExfVw9ymeD$_)Mr9dYrEwl{*^MnJa&l^e~59x@bz1aGB<(GUuLz-#E1ZR+XF*pcpk*D4FxXCp=9tfz6jNUc#++xLB zL-cH-CKWfECpu^t24%hn2+4Y_5B^7jiF~i-ef+=voXD0PAzB;Wn!-9Y=n+9H%VY8I zZ_wg(R!tK>k%;c++r+^v1Obnet6Xz4!A^ zWA;Gjz4M#2M|{v690bwNnVGhkyi=5=v-3=1OI02i4IgY+GS3$uNh}Ys`FRS8!TW%U ztk3p@o8(FYW=Hg{U)@_d`>&pNzrjf=)uayBf_D8jkhjOSCD_)`)Kn(!2r{DsTf~FA zL007M)A@)FQK}iDTl@hi=BcTv*@u22@}oWeQE>^5sh&`z?2iTFuBq}9C?O%Bf%2=V zda!RD?|d<-H#q*kQCv&gck+0UU+|e$&k%U8TeK+XCM8G$Q~F}^zms5Zkc3seKU`={ zfJn9dfWjr;y+8c@De&#BXi?i1nZ$=H+#BGiVd@>_~OdeRTKtl z>~~zcoqav`s})#oSqRuF*#G*yRQ1u9kBgTB&Tf{j&-)YUa{?hxAMzAlRvf9}Xa-xjA=!!1ZaewYcF^H9YZLRW z==RFdc;b58hVj3Ms=5v{`CH8R@PAdcd|wt`n=gJA0lOw=>bKy#5TMHJYqJPiRAo5xuPff8+V)kjG2pIz)pDgP=_{%1@0w!*_ zs^-h0*^{>n8}rU3`(Ka8gvM`ADil7CiW@;?>kdK=g6e<2tZLcnGk(yp{L?_!cgHH^ zbZVoI)_SCEvp63${UzJ{0r7rxPeL5r5ZIP+;_71;&Vt+s1hk({r#+Z9QJ%K&)^^;h zZbuU5w{|GJ0e`Mt$b!tCgV?XE6)4lrA4 z(pY$OAd!gy5> z^s;g1MaD2??^E+hzj@D?;i}UaYwOpuHh4K=4)NY~*#1@uH%G|@vxi@||2lNjJLazx zGM<`6&20%45A1HT8vg*8tX|Ra@BzsB*J-vXS;K&(j~TvUHtWq{%-HMS&fLG8O5fVA zy_L+Y3*O*&-H!}^jz`M0JvJpZ6#gxZyN!l0UUyi9zm80hyzDIvjvQ^^{UvY)Iy8(v z^u|d<)pz4E4!)IK%vKnlnEH?ji1;*48JSD_F;JMvSHS>@=b_+8w-yd;=DF|RnEuD0 zMhVC}YsppE_^rlq8~M1nVo?xi(o#l2|z|08!FFCVyW1u1BGm33`Yg7T&T<;OO_B z5^MfCAu{0w1yXiYo(Z5dOk!Q?+MBcip_cX3uP#9o^~HUUCC}=@uB)oHN4R?dMe%6A zK5FCUk6OD<39+cNX><2)9LcimbMBq(d#Ry&=1ZwtMPZ9_K3W5(A&^)KB4?S+YZ zp4Uque#YlYA~BwOHD6jA;YLVZeECC_+!j@I?6=38Y)+&h?Uz3IPAtNz5iG;(}ON7VGHYf=;@Sk0qcg*Q!OBNE7RO9B|)flkU$!vq*>Vj zg$t)%27~iq{=DiP5}3&2v~G#M%u#-X=MlZVQ)toX7lU*|BI{ggx#g$HV3%3)Xm zuHba=S_(O9**nbl8B^-MMkX6u`eyK3YegH}Xy8yLCo9}E2Nm`{Zh0U2luQY-{3}H_ zo%`>1ejdiMqI$)^Y*}4RU9dQ~+Oxj(nz6^1acUms1n~EJ)*V4M9#?!`!`#6 z>y^AAsi8_MN;X(Qz&@FLq)5TKh zz7Tclo{O0pZBGb(X)<@AKWahp^$lig%hG%Km)O^CjMgCkBsLPxhRLvmZEKa-Eu$WF2Djmt=2xwA=?Jv~Nvjb8PPhyD{c zzD2>Y=9)5N<4V@^K6`6_L|0UC1@Al8%w{1 zDU5*=jE<15YzV8%=>cT0-MG%G7NJLvui3{buw}sO6fRO&7g^J^^FFUt5WBQ0sU9CV z>(YQtJ~0t&Y@AJgv@exKL&zSrMca8E#o>U`r_+_$DQj90{EOom5*yd3PcZ8xJR5rX zcWbi#Z_`|>hapexPMV;e(tUTSB9x8=QyNWV16?J&Ho^X7GLCwQDl zyyeD9>Y-*)Wm(P5@)&sFAXegK33sVKn7I}(v*6{J?Kc{}Uz7SUphS%lae2_WWSQkS z`WXg6hktB78j-Fjg&u;T8)!+H{-N_|v?V+nn225J@Z@HW4S$2yG?~=MCEqy+J!=yZ zCP;oxZKe|lUa)PKM8o1wSbogml!c$9y+A2nkl&x-VmhO6K}4|$p5(^GNO;K&S`A|# z+x>}w!lkarWVYG1p6C{=u-9s079FxIE#wWFJUQGrUuR}0ea)})CFuSstCZLXtAcjP zrO@m@8)orz`Bf?qa=sF?&xGUxero$}F<~cM&d9E@Tv^4AyS6S-<1Twi$*l)`eho$F zA3k?F>SM1?hlF(^fkQpEr(${W<$Lk;xGOe#_`DM2LO2$zQZ-N#O-VXYHn-MaBqSuY z)YWBb-KE8fS9D5HaLAt1#fn6hQ{!x}QcCVT`3Tk_`Hw8k|Ndv7h)2S(KK~i{)RS$* zu`r-N$|2)kFB}KP%EliZ;uMk^$|rm_;*H&y3Zvu0Md883aEGKjFBcBxebxEp{_}7e zz{}W~Te@i?8n&0sp#C_L>Z6~dPCIP-tanU$iz({~cJ#j35l2$5qWpx$3#SAdmgq0d zVUypk(OLi$er2Ks_)LBVN2Tpz%&%jucK89g`PkOQi44!9^#@x%Pk=$J+5#>>LW+*> z4bo$+kixj{XQhGVulp?fZ!hr-?K3seUk85-3wO@940Opo4TW)`(u#tw|+#c|5|sn%W%?o3CQoEK7r=g=HyQJgDmLcX3w&;eJTKC?<3BAz$|M?w z&TPasmHalz;ekopDXb?vD2MD=$*oi!8r!n)ehN9N$&m(5vS5)fN+I_T5(og5C`Oyg z1TuvykC!3OCJ@SvJl^>H%8q4GKH|baFr=#yuMF|CQuF+K>?8&O&X68Xw?eY2tY+3- z(Q&+$`+xI$CSJuNk6VZQr=5?1zt{*kRr51`U!}L^L z2M2K?;!{%mQ9R}GJQBI|((xTKcS@rR09UKRbW+V$C-o zfUpUSo5nEm_Q(d|PvZ4huM1;{Jufz}*DO{Y)dqz-VNRI8En9{At@v=Mxc`(Q!v6G0 zM*qi?b}n9)jyuHRE!q2cScdA}WbAC3a340J9{loY28@@%5Wm8Dx^nKP;BE%#hF+NS z1k!Jvf`q0R3J)g#`o0^Fa_T&divh*P1)QKf))-bAo|bT2$9_=?5L|Dq6#*(7X%H{N zF6hCC_Rt&p^FeY(_1?Ps9ObYUr|$F$MnylvCYC!y`b#mKrKqy}dMIEBP8(B3>H=_i z{QJ~1gc>ljC^PsmD(~z_eEe_D-EZaE^U2>KsG2c%P27*7vNrS(e-&;wdUea~W?r2b+orrmXEnmJL#4lq=?G_Asgw}> zwuJ&EFRjF>=-#X_st|@1jVO5>kc)VVYLylxKh=A&okOWB3IWyy#}k7I_V{}Yf4h`9 z4!1O?)sZWl62kN#%Y8b_VAhrW$0ed%eC}OaJCs0xSjt=bRWW5Z_N>>xwu+eQLgmB@ z3eO_!W#_Lbx5NTN=v?|4(tX6X)B34CdWErxinO&1*}5e6qNo{098JR}z{eJ)X{-V+ zE>bTo8kvERCvpZ6x% z29@oCWKGni#Y$`GjUhK!X(@c|M?bKYEvk=B4OuKS(u-@R3HU?V^u|$JMmqVKG@^xU zUL-m;Smb~*K^PqVP>ENG6NV!nH3)&5*!q9>2sFpFyALDZM`Q{+m<{sXHpSzIiHlAhvpCWl;G5?MI~;0 zcd)aaJjk7t;Uuk9)P$Z#AxelX)3jH<`(U7O;{w!pfT7SPZ6lHbFJp|=fZNi7OrigU zZxponk&X@8oNMDAz!ei0QOhf+%2x>Wip0j(CE|M3-Us*7=gt!ybI@l-k|mb^$GTbP zrpUHK;X#_Qbl~|>KRjLs45?_);eOjetHf%O$KJX~RBrJ4BA9f0m0ROtSQrGKT!0H0G0+=O`(mxI zjiFE=c^DbD*#1ukwZh9aa7rHug%_?4NXw5O-2l!5+cl91@*Xpi;Q=~kEEKHKFzR{A z@qs!!!cp_EIcnVI8LhOgY|^-1_NqwCjD9aR{JN5yiiw4b4C)oL4g==T(|b%E3pP-b z|E)dqXOUS$Hu8zaBJtF&8rdNkZ-(L+so&HxsdVYZ+-sr1Zw*5d-~eLpQ7<8=qIk{W zDZDD$?BL!aAAL-0^1kGop4_l23Mw$)6mu&lqzy$pihOLGtMMLN<*{wH0KZQL<<{gy zsV|}blh%80T>7{IO+A%=OK0r|7RiUKgEvL5*Aa|6k$NW`gOb!Qt^!_LMC^Gn?}xjB z*Dvw4h)Uma`Dcv|xJm3in+zl$39 zcXTGTn*O^4a*pVXXW}w5%I*;^l&pewXrwepWaia-fv4Q*p7IzC3yTOVtacl8 z#6{|3fQPZFx<39MOnldsL4|9-pF!W6GL-Zsvz;A1DrZkd%u1ivK!c6yWR zziEiw&V6BaG`bXE~}?ZC#X1i1kj z7W#y0e&Pwf3bx>V?;`X44c0E@Nm{256ZSIw$~FSX>HCOaHWNbnn`*{sT223t#Flze zR3Buc?kOaGEW(U9&ST*wW~Fgm#YVW;F|Z0scM#_`5!F05U?@8+EK65nrQZJ&)2g zwmC0`uIQBiki9SK3=26qM8&D}61+pPuH8t*XsBwQHWXb~=Mfto-eblf&M$>CzyG&h z&e2XY^S-;QfkTK-+*9;KA3vRbGbfhy)66ptB=(W#LD+c@Yd+)i&-iW@y5^~f6S&Ge z*$p|(c(_-Bi063OvtgmFG&gL6$6v^uzIp4ei*HeooyE*LwK%G!*VD=qp(8zylnxlr zpPwf?4h7`vwrmvAMX%=6CvWfm_h1+5%uZ$+O~A(IYOyV6SN7JwGDb!velP~p^T1z7 zVz61)^0dEwvba?1P@iW!>%@jZa#cxrvQF1*i9l7@Qjxig$&+R4avbl|vh>TF==n`n zzbMH6FV-hAgu^j26CpSmk%VwgwE1Kx9o0WjLIWk6X*!Lu+#uJty#B?F{vRZ$f?NF? zujuNJjH!9HZ6=`inWCaR9sfo*>>?z-Pj<19nE5p}ZoBrjhQge>4NTeWC$;(G917Pv z$p#}`o^FRI@Da@PBp0UY&J*`7>+ESRaqH=^XJ^5H7*!@}$=NI@xR6V%8hN@{z;>DjzT-$Esx^?@EKe|1MWm|5Z%U^Izr1Gb7>=Sc+9` z&wU|5|6YqdaXAsof$`q^zOh&6rNu32JyMgLveS%u#RZ}RMtv?_HSu=R%vv!O^|iRI z4|2@=Q(;Z>w7%rwrLv+WI)#yM*=i1CSp~O-6i?#)Ys*Hr2=}M9c#D?)vq4;H2hmq+ z19Tj3By5MCsV7+StH8oo%ov;_ivfok*~nvlbxwGzZ)!7tcl)!oR#D`DX%WHTMRh}Q zzUQ-h<(p55O;?Mx(m8a8o^`}>4~I~`=kTQ#;+?ss(X2pcj@z_at7Cb{l-~OkfOrk< z>aAE*6R7txrR!uFXzE&$1U2>jc!@<@g+_@pF9yVqm4EM`UCsG?&R{At^_P<~I=_^k zoF~DJD5;|G%FIRi?eT#}o3}Cq=(gVN(Ik9e!i{gi48%8v+&KX{JiX>qVp4K{gWzDv zOTgFv(=H{wM<$g56x=_uv#s+N^`Jr)UPpEBcmz%1ur-=+eaP#40Jeb|0!ya;eI_{C z&Xj2inDo;m6yG!2j-DD<^?wDLHwz^4y1Yf0&9=+SPixr@1eD^Ae+7xpTj!6B%JlE9S;#D`F;R+vo*&MtgE8%A?m1xED7c>kERNZDKh>>Fffo` zA3WAycZ>5 z{`00)@c@sHg3npEpA{Q#Y`%NeVGZexOiCRD4S5iVXL7zpGj$K>`2Fqd5JN{bC&0S( zANI-IHa;gS4gY;0HiH1sttZEW$47QCkkOcmQ=A`nyfzsUMq~)E1zbODeM9#32xEQ4 z7Ib?&m~jtSEG&Ii^zSW&{702sHF5LnSSy%EQmE?#ezl0uB3|6+qH|TQK=t5x0qlT3 zM2OI0?St_!TyP%wlug0ri7>np`K_3N66#~!2BAHOy?Qb0lM-l`i0(O#YFF0f`4zwY zL71~B7jWf_Z_T-$@a8J6fy`_-7=x_CM?W4$S~$bRorkjUF*h>Sn6*x))3nZD*?3*U z<7bbf4b_CrSJ!g0mxeZ3FfU;%7&73-HBt8)T76H#)={e{OvzR)W_%7U=)M2rmYbtD zvMv_w8Z56odVQSZ)L|blD*4XY2(m2R5=JO3{gz%3dcx_TYLOO?)aRNQL*$SFe^dTV!7jAwqlcSBf%0+Ypn|AJEY@p1jL4C%jH0PBH_7Or+Vp=kdwkq;18*2E^Wsu)W|i z!Wc=e?U8q;3Woh#;ot&@VLL?zk+=K3WtBHrRDxb+lL(_W((=O!k=|ih?E7zd6ubT? z@17sEd*8f`-K*a?ATW)O|Kvk`IO-ppeey$dxv1d0srlv<7J5SGGhY~hv!Ca~!7viS z#y~4?$ej&1DU6M1rsrF2y;8^Zw7v3-4NX`C zjX`2q9VYgu5OwzB`fzp$>_>ynDL|N0glG&|B00Y#{0o8Whq}Pz20Y#zqeGN1Hn5IKq|!_XM}xMCkY; zOs;>{nE6+`v2C)l3{>BT=xukfKK<nyI z4B5Hc&9on0NnRLJ?nRaW5PIL)t#2eIjOhXrM#^@Trxg9jt@HY|>Mprxn1`GV3VUnD z6tY~m;M9IRux63Rf-gt5N%oUYoLhG7=7M{Tc;*~RE`+sFM|i|R0&4!Ii@x+M{>u>6 zp~&wF*cfZk|!wwJMaMgrKgonc{HR%$@3@T-tx z?ir12KHvmON2Y2)ryGMb#q>PFr@Q~{HV=JUCj)s49O9i=fOEK7p52n}){^PXZTYjX z8-D7;exV(uNPjNa&!QlM6oJP;w!{nexdG4`{1XV{0&tbj9uHQD9$))ff8ito4mt1z zRkm3kP1m>+S_3{>^LUX1CNekG(KgZ?u>`={Nu-SlR_fX9*>Pn>p_fYX4im8R{8j$m z+E|h2CBl$`kd<6sS&V#3=h5Hwo2%b={Nd#MlU??&&kF%}d2b=-EwW}vSQ#mO8Yvet zWWviaHS6T>#~xC#&@2Bfo#be{RdzWWnHEWF07cua1rSFMp|)g-j)R@(6fFFi+(I z(a)VQ=;Z6h-!KPj08kd|#d2;y$CiKiYTuV&Q2p8QT7I>}?hmo1sJ$|H7a<)nJ#7?l zw&1rA3>=|_AZIH1iJy;|Sr%>I`zZ#hV^z8Pe!tYv){eG|sLR&BNMPIOjQZ1> zlH1Kg;tD+oqPNlE52MO(rsp5f1mz4fvH+TKg_T5Kk9!bc6Jr!piH{Ch5dTQQ)TGH} zBaNrP6+!Q1`&V|y=Bmi*&Fu>j;Yd;It_RKXMfS@U*H#qwM|`DO{U&wz3qy$Cg>9F_ zSeU?D>Al_{)%kb0bpDPmk6q%g(8_(o(#GqT&aX>ry_*fbDg8n4>no8Ca~hBt(WC*8 zGy&VS1G_XAj*8$d9ur0>5Shg=K+Yxy^dGBNB~$81b+`Y-4sSo|XAGE`H&G~xi#{jE zHya~oYbP{2`3mndZ@Ni%9;}^q6c(K;6>|blid9_d2$@@~ekMXO+AFYLJ=1k@x;Haz z0LM15>1`*cy(!BGz%n9?fGc+SOZ4Hdt^J9PLQQ@D#ny6#er27UA*hKH@$F zVP^QE?~EnRts~;}95irpgOq85FdJD}nt1KRy>Ya|CPqVy1H{7AP-rw9iE9Ku3bu8A z=0OtO99y&ps{E_{3C`=^!3H+ZTVSs$S}h-R`hl#(Py`Z7x%Voh(D2-?wde)IlP{d7 zz?B+;^=U2!Kbbmowo&A+h!o@K59!DoPwA-4LoMNj(mjydM*<&s>sv3UDSS?3!6MY; zJF?$zm&L0x49st4>d<0}orgYHHyz0mXXK_mAVD5(CRGqrAd+bkq^%2Bs-u_JH@iCx!^zZ2) z8P)M!*1ONs0$0LHc zB$PyX8^L$m)OmVyy8Os`Jn~;#fh0}}#)vqySzzU^O6M*%lpjHrf`MV}2#W~>7%Ev) z4(eiCcnL9J*CR@#(u1bz;XR*51%Qnw)4dGfXE0{@toj4WV33{xzaVc*OWgCmg@5w@ zMZxczWyM za<|vy#M7IT@x64w{&Dt%3Chzz{4OjuKAHT|o%WE}ltz}AIejEe1$Y23g^oax8Awe| zH;%x&4$3a;f0l?0zdaBo^kq?zr2po`XM&hRE29tSecBM%t}UC^x$C9PC23 z9^FuTl)uEuumDibmI?f?RW!~jb=w~Ss`%#FzR4>vINcL0edl6CMK4GUQUUuo!>1av zg>OK|T+Q3NLBOn$=b#>aM;7fbZjR<<`H7}urRSt@s1AW7+OZHnu9>;H!(^E{rqqW# z`s2nj5js{(t?*Rh98+=Gho-s(I}kl4+dP&(XDQ+^L?wNDb-dB|LnqBZNBXgj+^Hev zxad}ZO!g3Qe0+3uJU;w-&XrqRTRR{t11|!PEVHKRx5i?~*}_-NhXSVcDlEZ=iUFY8 zjuygY74E#Mf7N;YPv6)$%WvnV*y?O|YIrKjR_b^}+yPvg{Wgjl*pdgUvaAAm59+-* z`iq(?gPITAsX2)dtcrA|{uYEX-fj;R6YM}_Afv!<(e&R^SlBPeqL6h}g^QF|%`4Gp zkV`R_$E>FXtEGT8+mnZj{&vo|HObj)Ej;jsf;s05!mBb*TwZFe|=j$(W;$Z{dgD(Gm zITrc_xB7m;`tX&>V!5Mj7Xnhhnd>t2=-_Lb-?x=JWMcH;+^Z-`g!R=b?H$!4e~?NV zII4j8raQz1tWyU}Q&Oy1`5s>fe;I+2C(Nt~V;{D7qP!Yd< ziy1T#(d|f%xC6*U3~z9({ZWo4_8hn0{aG0>V^Nh~I0zy;&!j=F$R0$r#!&v|W@hU> zWC}jcLfEV9Oe-NGO@vR~?|_Mo4C7W8kcaFpH^2c_?2_z2+;U9KTXdvQ&U|ycs7PT5 zQc`k7p}L)giw-a08Osy3d$RaIuE=pTcS@+JrPKMx`<818jwj9jYK*Hg0ciWJvFm>z z%~?>P79<25&3y8hRFzM85~fuY1QeITR>aR)l% zp*{i5@^@9%40jMv7=BjFU)zlGEvft&FS!(K5DLm|Lw9Jys{v-e^vnIWaSVm9T@h92 zV2(@Z)}tlos;|gNkX*u(e3H!Od2?r(Z*c8M-GH-t?}|XxpYPNATTlRhedJ9x=hjxU zx8fvI8Ea9r0_*pYW>va8tqZgKI1pj-2Q<#Sj{0b~EPF=@*j|8B`}45*KBEn9B&~Ju z(+<#9Zapkp15uP#*_-pVS_?Vwfk;ORsO7`%Hnt&f_>=!8&cFf-Tc73eEB)9Xx(b&67W|fe;^5-{D!Mu0KAUf3V)7b<{Y9^X zrmn~M${m74G;p0pX5;R@JyB8*23bZSF+dQl-xni$J5?9DF+_JnL3;+D1<{@l1?PR( z%b<1V9q@hwDT5L}fe2rNB%N=-6S|?5_Or#keOCuc0NucGMOR4M-|hJehb`Kcz%(Ts z(9_E~cepBmk>g{U*OI((ey}nS;w)R=USx4pBeS=qgOBr;Ub(y#l`W>uoaV04<|>%6 z^s~f_huy4kM)=Nb=XOXNy5eBF@xLf04?cKQ|_T8Sx$5(T-{_z~#=x#Zq}S zu}3`dWRN4d+2d>}tdrxahxE}11(BdZY-0S#wHNac9(B<)!!cuT5XcC&)*ts$>NXSp zs?aU^naO*k{|m+qH!aowk!HgReazN;_A%oF+c-rYNMcPcNCreAVff^%XIPM^wY{** zxh19&O5Ay$AKFRtVTTc{Qup3Dd=qEWS>+CM2k(t$_{u+z%2mkGMq-JSDd*!)J~Ou5 z7`r~}y#2d>bSL%uhNC^U3jA7K=DmgmYnf7RyAB`|=oo<>b%RL8dtBF|$TNKDBR1Q{ z8{Pz2mm$PGGz5=nd5A*^y<1h+8pN(UW9}|@mJiv$dFtqtW+dm_d4(Q!DDa*348U#X z#(oo|g6~m5Yz>l(LP98hCC~wn3tq;g7|TY4USCK{*5cg(kqpwE;BvSDf`{JD%8i3q zC|GVZQ~Z(JU5(Jo4z6LhCbJnh_&^yRuM#EpJ!fQQt3VB0mucg=?Q_F`&`Ip zK$7$(-7m1j%i@5WmE$q{Am_M~DM$uq@F>R($3E)ob$iZaQojQ{zyCPw#>^+wRwD#j z6!3@f?A4_B-X-5*c{*$q$#mq1gRt96FL0%9v%_}>*)sPmcZ(maUPp?BC;JO?+V?Md zwE0XBK^!C{0MfWo=o#SFfqCKQT9`(r;#Bi_I+aMMne8AoLO#nwEt(}nDQ${BVk zb@27r!o|us9>#(+p8fF@G9e8xP$79D|0`BS=v8cp-jBzBx){thkq+TB3RFn9VGf1% z#__OO0ixk#sPfGD2AvCi8VXl@=@D-R(y|PgH0YOl{=g5P4MBF|e;DJPsDk_VGzZA9 z`|464kjBzR2{4)tdx)AcFYW0Uei?FrkfR6JkSR7E#_THh^r#V@3Fd<)k$*7tc~h_W z@0y6OCL!3rzQ?c4vT8sC`byD}Yuij5bk!)pXT~`$#vWIi-JaM0h)yF1qBVozVvMgo zDjLF@w;CN1O8_`AlHh(gqq2a_?~sXm++-BF686*xM)$AZqYS+C*?{>xVU1Yv@r|IR z%SEs8sNlY2u_VAl=yVXTZ1l6!DAcSCAO1=Gx!I+JltgDUE>tZ+nk4qY>R3bceRXd0 zz=W!rrrfLIquIP6u+_jn@+8>yKCvE~Ho&4($e_m8yqc(s8fnO&Y41NTa=wc2x^TiC~Huo+LyMzrpyejz81q{PA=nxIq`cLsr~VWGC_ z0$|>whXh?N9OB%fK5&OXC*@Q4;!vLU6%sv{it)atdGwqPe}(TE0Jv;XI82Vt17}9t za)g;#>`Li4(OeG-@Bwe--&hF4&$2w^z%7O?cz`9STJw>&1-aBl-V<^X7PzUVIgW}v zd{TlKAq@P)3M6Tblo&B6B-@|~+vmg%=>13;&{U7A8*sk*Z@)xgpo4W9207$FQ+S*I zDuI%l<6vihutkwYLc6kMGtAZDia4M|0>HZ(Yd>H|!5^2G*QKQqn&~yt`LY{#4^c+5 z-Jr8No7e8}-K2?hVrrx)JB}%o8Udz|QD%Na0Oe53Oab6*#Kq|jMh0<=!aPcS2Pc#m zvat|!CJXBk-cB`sDggPsz&MW5mIeMINZdspc=log_o60vb&-$Q*U7@7{K33ysoPjm z0z0^e2Q9u|i;shVDMw%UD~{rM6O2576f(Yz15>~p^JTH@1Xi&zjv*iw^UUSeg>})qbFD|H>>BcvxI!O5L1s$#}+=F_Z@g0gT zR23UQj@gcLRskYAM3pgBmbRd(jK4l4^=Mu9h6?Je*h>#ZA7{il45k`A0Pz}pg`Ki_ zemb=Mb~FoQnSuC+-u{)1cp(nu=m`%jXn7ohNYjz|CZ~Dp8gOMIT5$}QDJ$<$L->dV zf9_{+X{1D$l-fLgVx*%*MB56=G0Q!EjtYVnFrW4OeW+Q6p`Ou;e9wM*H))orY(k)W zQvc~{AV_x?E(ons}Z=D!cmLp2kRO!z92 zj{oyeUbV=2#*KUoTI=(oRnH|3etEI%H@+lLmCUmXgHobF;8aMVoun2E!bToz`id0c zqx4V|PI&Tq@KKi@*;yBo%D(4Z>`dDXg(1LEezZ<2M~6nP&_=&z6N-Mht^Ua?N<#T} zS)Prk5rL;GCx;4!J}C|y=YD?iX%P`SYmg8=!u*hxCM1~L!XTdy{+`UZ5@vA{b zY{WV0$?P3Qv|3I}OX}L!Mb2490BJCbWns1*h-aT| z9m}50doS#=7Yet#GT2Ep0;|e5)g#JE1(5N|9%$F6)}7GpY09qq_ail6<&23>ztLHj z8!x93;A9)6E~S=F4Q20s={Oaf0rR?AclqS`LLk>In^SCp#^XMc&H&UpCv|)?enk&~ zED?SL4M(VP%{OT+CEZ-1|qhQ*spSkEa3=MzWGWsH*dSEnq!mqclX_BbCm)pVm+A5cO@>Ln!9h z1g-hYV7p=c*Rg=^vMCn^OD7k7;z?MyWp{I~#!( z^Q7Zn{Uk0AH+q>FTw1=~$wq_aiJ=}+{p3w;ilTU*I&QWF*MLNB5IM$HV=VaUWwWXW z?~#$<8EJgV|6)iUR*7N23aAu3v)xu(L_Vo~iZAQ_x4RelAY_3gYKSLvw}?i_gWqG~WCOqxEBiWp z!ZO*;=1w&rR~^h@UePNGx(-=p&6>y3i=?1Y{*5sm1C2{uWm3`o#J{v_MpusnfOuP4 zq6JNoJCQ_=T2#Jw)Nf{OLc8ShlSsinQ4YrW3-VfzWj6uv$d(u zcLZax0O>m)IuoXPc(NunYJ1a>x9?{HPz5rHvx-Va9n`KUNrDYF`Bh?J?8Lb5_~4f5 zv1uSso{L&C?w!9ohl3(4DdC7?&cixcIno9c?D(aG+5jiI$J-T$;MiUL&w5sm^<+O> z2pL|jFkfo7hkzzW)Ck$$0j-xoLbsnTksa6$eoCdv)HI2vCyP{?<35o1Q!& ze1g|uE*f?hwf#YqX(X>bs6LjP{K-!Z1eir{-`#}f_K|z*61j-@;EKN(@pvKPgA>d` zB>mRTH^H?hWNC6+-SZm&UfauwlK9bqp5wg z;e3W5fIDvo6QJ!(dBo%PSSaqJBcbph5fno>j%#fn}bqFa<#i$AXERHx}+{nqcOaWBlc2btY6!j z$D5|SB4BsEZ&Jqf=?#w}z1u;#?)zbBzb`|B>Q-MV5(`?{2qcZH&YfN?_L0BiCh987 z8P3}HMf8JcJ261h;Uql@Q<~J%i8AkbKlsbgsVP{YrdZSJuoN>>TmR$E4wvk5lO@f3=8L zul*zb1Zvpn$Es@noejVsr3EbN4ga-#P=CE`%>8x^e3ar*viE^Y#1>3TUmSe%L4sHL(vRcW{y-|t!9fHWKndHzhw<8;{<*GuZOd9_%6 znQ2e0o?vA#DjrEXvd$h=mdl@+m?o~^T5tP&RB!%`hfnL2Yp zdhZux`|(EZZn}P+NW&=}cd&Cf#d`9M-Y+R-n1zAEaY0W1^{r+?^(Xfbc3fX{og~+W za=d^J_VR2MmtZG{PB`$C>NNLs-;^GsabDaf@LtAfW8)-Qw~+4QIJ{ zcwi_HFB$p$M<&UhfX<&Nh`9ZwU7r1Q#O}tZ&2Ti?mN3Tf{RpQD21$ts4Di)!{Q#ob zK91)WeH~`R9bud#Ix%x?835G~z`El3;G-50J)FHW>=$tmVE12jyKSeJNsoHagfIVa{C=(x=m+UOyk$ZJ-DGH8e$PWk9Q;L32XmaZ~_!wd&D#O*;VCx9Ge87uX)uq1zC9%bAg}9dBR~q&Cf2lj*3EqT=c&M z?dN@zGY9&mAx^m;gOyj~$SS_Qyi7!f-2P@yNW&%dKPn~g8ur!}vszy9r7gT9#f=Rg8ES7HZ*$qKpa?w_unNq*tl2&k4l8M8M< z;wQ0d15b3!c#LJ`r>Dvd+*~t^akckoNV4gyEA!Cif0|Q4?k1X)nNKrQAnu7iX~IGy znL;AFpqBBwY(T5vi%G|8rG{62Blz?R95edA_uiz`|0;PP<~*%rEK(Qhm0$fitmaji zRsncjXiqNGrnxg&rx~VO5N&@tdq4C(W_oBdW@?B`hjFuYmGPufo3EE@i%duh`*{sk zoHL9a1+6cpimKRXZ7HNld?Z7i}yLWHis@Kj2j0pF3Hk2)xGDBYJ_#t zeaSv(4jB{#bMp?n99VN(%Qij1P0ruAvcB@qeHCI~^U6!DR=_>yPhCM|=URrt1_i{# z?)Js6<9A2(-(fu)n%4|zE)R#c&i>Pke4aisEc_7;O#4AU{+a(0GoH?TG1Vp!ytU5o ztJU3dQoJ^epM}x-83iJb@F?S=Dlg1JJ>q|8m5BWyx#?Fa)#smLhnxdRSXV@2TYMkH z69BV&?~F{35ijT;%BXH%-qt*8k_(K~Drhiy&kg;wAo{lcxYEx4D!;ro>bMv0heIck zOWI+JhWAdV>hR*$jOJQz{&Qmb29ZiC?fT(w9QK=67Q(CV@CJq*|FIMpHuXnNI1Z)% zD$-b(#hJW(M}xUqBtiFHN-GT$z(ewY#DWgJ*Rr)b9q2YL%t!F?;e}hn+*F#M$z!i{ zR4Qs+@3mb>FZh0Bfd@eji>_CUAAY0#SDE6s_r7JVw2nDXLhWU_!>(*j-eHfV?uQiS zWLDnMA2cmC6Ir-p>5H^KhX>xaWXMR$K6ny(yv0DDnXbL+n*C9)0~7P&*OA|;n5R*a zb*(1$^Nd9fhpLXZwL)4tLtbl{{-QaQOai{$7uXeMS?x=$Dsl3BXB5 z^8@GaiRmy*oR~H6;y(0nqb#c7^n2-gU%0q^?ZYXo5#838KQ@Kb&8&#h{_0EryAZ8k z=|0teBs7Co0&cA9UbOH!eGZebO{(^Vmoj-y@%VwV0RnF+m#gSkgW_0_N4!?yXTyFi zbM`bxp%hKlBCgvxm&kdH#yE!(CBmN!VDj}%tDbIqviRR9L6@iw@Y3Fp9XO^DPO;Rf zPSGZHf8F!={|Y(tc&NVrk6%kvC`=j2k|nz=S(2TPj|R=ynP`wb44EPfiBM7Yk)`B= z(S|W%FxC{q5ZNYM_*hD#vG3t~r{C}U_xHd1$9dd)&OPt*e&72#uk);eex$C(7AqnO zn!#Bh>PCI$*WP#vgPp9k)<2U*mez|o{ACa3k>Y*x>gh+m0e6Gr7W33^zS`e_jB>SH z6uX+;`^&!Iqn7Hzb>*yK@IJYfcIdme9%J#2aV~3~Z@Ef;+~io%R+!a1tYvz5gCnh3 z1l4_06`fM^W|K`F&=zEPSe(HzVMvU260WPfG&xi0sqmK?RK%f02&+oC1Kdh1BGO!f z^$u~qsV!r;@2K|7rnQ>qAhFiBQw(!8Dc~Nr1>wux6{3?; zGKZKRZDr*8r5LD>Wpd@$D|4@{?$2b;((U-Uzw3B zXuE9?I&RM~wSJ$CQ$PS%%s}X;g|Dr)v7}Mt1E=q7)Q-vyv)vV6V6Aw;i&;wgoANI< z?#dB28x+v8os%@%N-CwMIX=nU*tOD5M`LVmc}ppkOu&6~4g6YlHIOLLOOB#@OWZp{ zuGcaiJ59m?hlx^alo;;b-;C^RF9B*zM{;ICeiohO0c-G1(TrzSW8UoIo=g{J->1`7 zY<{sW#k;dgtS56m6F1ex4T-4*8f>+khqVbKk6M0X-9PiNC_w;~@XZ_H>y2mnm+A#Z zmU(e0!&GMzA8EY@CB!{#$#L_4sG`qhm3f{iAQ}v8BV5(=7fPO{p44U8#u|U^T@PyR zbKi~qw7LNi@}yBYM2Vx#KvJB+l1R)();sgA!m z3W+HuU9R4jf1g{q=1IDkJF)vaaT1BsY629mc2PSdy{YO!$R8eJ-649NRSZ!j6K9_~ z6k|mzg}OH%JSvirt~N3#4bb!^Bo4>k8o|j?$vO@V_Bv+6Uz@E@G)p+*=&|B2wGw+R z`yCZJCI=51N?>Jq&7LE{b|vO_#4kMF0n4%zSeC)aO8q{BgT#zfVXhOwWTt+Y`*_)@ zkfGXaZg?a{OJ*s;BUX29`mY^Y9%QcAxt**Pi_E(>1o0Rq4d`|E9e7ej;N5GYT<67$TrC)qC$LWfhjGJ{d&pp)+K5T}PUt zX{ONyRux1S@~z^^Pu%gAAAW1aUj5jS`DK>=??ha2VVW=kB?~oBgXxof8eR50{rSC( z_-o)zhaG8Z4R@mZfoqB<8!zg~Rb3@+8Y%r^cN>bj<~dMIi$wODhzt`AQ6jn)P4^-& z{dwg<{+4sn_Y-AUQx&Ld0xP)vquHM=M03tndk9ck=EGqX^~mVxcB>qfBBGb}Y<_BD z|6SO`;D1j%R6~IFhj>J9&uoVT{rG_Y-k33kA75n%Y+kBBIgCUWM~25ABPvVPtcX_= zzwb!$^P?w2WK0{uk2+^zYkCC0m5r5$>h;Of#hfJRn|@awHhxiJ(_3Hl)`D4*=ZJ~U zUX5)2&nbit(+c|uT_|V@j^~81e4N=_edqTHEeB2gyRTffDR)QyCAh;}?7ni0tfyWk zsUuoT&*?YQRJ8ZXy~+r=s%x{^J~GphwDS{d?ZrCZ&Ycx;k#yA8tO;xkLm2m-iW$c+ zFblF;$;4~M|6IdqU9NSAj)G_C9!$Ot*ROiH*XyWHjx0EXY4w{CUi7IE4LhJ*`= zV9i-SFrut8k_*z#G8(3HR*3HWVg;5)b~QS0{@$#6uk9DZoxMfJ@L1{}sr<~+HkWSJ zLEVf3=la}=)Sa1^m+N*rR|1y?mgOE+Z;8mtjMu(XOnFvoxOurC%lr-zWrL%^gb?7G zP2*Y;ljOS1UGw4LEjv|GaI*qfttwaUfvW%d(xj_2yqgaOdfA-|>91T>J&z4&OD({n zIn{eo9XWea54qdDyT;mlWR$kz;leirzv^0i6VkjY5OE~Lt^Y>-{+t}_NRDg;ckcPM zeG-YkPri9BzB6RZ!ZtnDz*V~2MK*~0g+$f-_xiCXGxJ?zCZ*Ce7x}jI;h{j~t2mu> zLK`GxOV$6|jqp2Dc7B57fNp_qRIMFKNW}t;^-dq(_-O|O#Xp0fVC?+fJ-X7-7=?F6rF43;Dkc_H0=4|<+106 zwy8MCSQkV`gr@6|@+akvTR-%`HVXz-x^@#2=nq*giJ-UYP=VlYM_`Xq(PLAGKxb8} zo0q9kt}ELPnd5Z%bvqUc>cqQ`A9-gaCVM7BIoX0EyjgtxI+e~Rn-1IKX|zCJFbnZv z=!)qIb6cZqv{hFng|5iCpA%-ZBAG4VvEGl{OZkWnDlFW>DcnPWr%P3zbElz*QCP6_ z4Lm-+4x)Q5Szo{YTt`j-Sz^hz)^>cy{rJ5}H(7QFVB*6Y@}$>nqGxKoo3+I(PJT!4 z&b`t<5gic#qJ%(_ z)NOANu$1hN)n6@3b#)Yqp$?!}+i(yd^Tz1=abmku@sOHWXwD5i~z=g^JW%*xhwVD27of%iFG4plAFKlG-{ zv8f0wW8o=BSle`b!ac$(z%AeD*U7ec98Ms=@H6&YAY&Ey)}i1~Bs)-a_KS!CU)h57_Wv=K zwy^`xc~0%FW4a$72ii$e>twk~F2{jW)6DmATR@*C+x!4M(FzFjIQj(cd*rYKrqf9w zT+sQ0po_Seo6qp3r1~Yvd2ety$f>o&kmUNEv716p1UIABifBAinx*Boy;az=lYMl$ zW(`w!1G|;j%O{@wAbO$)$j`qsgz(Kd0?e@X^z;NmPe2Cj1<0Y?g^`5>rm!2=d!|c# zqE%flIK+%1rT_y}E~taeCHE;0w{9|Ds3bQ1lt3k9{ZYYxDr08O10BE061C3J1hP$^8LI?P$iW;Ur z1km^YL~F^pS$++@;lNyQR~f{)9o1SjhPu2q`Kbz5BH7ykgX;9vY~6Bjs{F(0eSgo}E{iD((rZrdaZnN-Z}$ZfxpO?TOEEdsBwBR?fSl zZclIdmb|lIKd0`>`}^#7u|+0d!Y(y=nmlY7ooapi5hx40AdGoFse@3ww+TBg>{_kX z!Kd??$hqY+9Hf#JRI((w>x~2upUizsshioXig8o*MAEJ6VFa`c@Q1Q@-9!4%h2G%* mqV4stw=gkzW}_Xehb-&Lc0aW>E-?9m0L&ErSGloU?0*3K23JY| literal 0 HcmV?d00001 diff --git a/en/application-dev/connectivity/bluetooth/figures/enable-bluetooth-dialog.png b/en/application-dev/connectivity/bluetooth/figures/enable-bluetooth-dialog.png new file mode 100644 index 0000000000000000000000000000000000000000..61012727ef913554a16e8f98bb6bb5ffdbdfac20 GIT binary patch literal 19972 zcmX7v1z1!6+r|&0Mvq21q&uWzfJiAFf^;Z|G)TkfDM(36i=aOmk?t-@0hJt$NR1r% z9{=yIi`aIqv*+8-bKjr6(bG{UA*3e+0DweOb*K}|K1w(&38szp+)>_&)!wA;=yA-V_)zwb8Pfye>~)5Qr+%3_?W#J#pxU!9WDQm zO@PSC$}*GsmQ8^mQ@R#;$r5}R4!-j1MYkPeOrLaBS%o$ZViYP)a^4PfrZV`;w9pNe0E>#(%fU$U-N1Q840~cA0t5GL{76HFSBh9r%6| zF;WA9yYDX65-t0a^glj&m-2>^dpMQX(4jy6o|xahg;}*txPV2Y9*v;+{Wx0TbX}zz zBVxQr)K`c!(SAhFikLKsTjbh`tTfqvBsNM#x~2@Lun1B>+pAWT`kw1aij4PWV>~aO zSWV_9wiAA;SsM|$w_RI|i(__u0PR?w!n`L3BZ2A5NSXdG8})CYi29QqiYK|UGhYf4 zpFZ;Kr@ED#xDjE5o|E837Q%v=C-=NE$r@9vAPZje8L6s& zyZIdh6-Qx{!Zl;1o$ayGF^qqX^YaU98ky;>2BsQ2b*Fq%I@(|MEQ`yv?7 zR8l{!V!qJ`l?UGf;Xry&LcufyUZjXwr@W^W8vLxNhv-WQM#Ed2jyT5dut}xi=I&)y z9$7-P%Lp$dmjW0JJ6!2@9)FU?isa}NX# z$^2~dh7!ryXkM}<9951Y##23iG)VrJwpPG)*bx|u4jN&DFi`+H@?Ps24YSm}6u*r( zOVv^C4B(ZbQ90yZ+NSh~Ak@m(Tlf&9V4X$#sbD79R3nIJ`_9YVa%k#(Ajhc}Nxt9v zEt?H5vTK4o>bmgiHcT+9gg|HiGt_|w(3zN+&^zu?Y$m&QjqI}FiIQlCHuWtZyu|hp zTUa0`AG{Adl=oPHXDNlX%h?LBeX|Mu4GwrARa7gvmsSNm;sa{iK&{|2P`#PTJ?WoJ zj^r%he?tDh-hnZpp!wFp{OhJqu%}CP{VXhpy&-D2fSR+jvnMw)w{dnQ-od4!0#c*S&3EVJ?71sArzQCQKR8^rj0;A?IJ}jY(sE@`Dr$uD zbV(D^p1Yj$-(YC5_KUYa6TFA``jr&>6Cps@J?i!Mep+op0i!1!*kkll{+vE@Asa=N zb>(FdglE8ii*d=4 z=Acogo{q|3ZPk3m5R0EJ`_0;q5}9-TsLyr$%x#1Js&>7=K4?AGq0PH={47968gP9y zU>T}(GNCHwzSP>PYukErHt%({*U%C)v#{`Y!R}P9{Jgnh-_jA-C&kD=*T*VYA!U-4 zpby|AKKxW|sHqUOZ+u!b?#|!~0;rI(RH5Ytu8kPdJUoVH8f12_+?7|

l#_H$Y`1#ALBd+Ei>CuOtw=6eZm|FT8 z2b}$Sk;{;OJ?}eb>3BM0n!%AE-JRwN5LC3HhlQ?jX)RV3h|{p6?%EDQbWJQg)qVvZ zfB*FD+k*o`xWga|K|mVxjsAz+Dbt~=8#()nz^emOMA^yu^B zpD)WQxLhimO2qkUo9(SHr!v;7!fwjsXq@Cbm-nHSE&H-E8>xotqvGSQo?&gQb==)l zmDf#a30WF>5fau9^OZH$g>3L!Cs#BqnOC-=wax|gROeQ1&X+Sz=d70(6W0=z6c5bl zV7H`le^>T*6Xf=v8UbSp=N7bgzg?;X$Cd6{y(1-f@OR6_qwlpA1&?+!GX|=9v0dCi%qEx-uK+PV^>sor+GoWZGn5==FpX% z7xE_Bcq@l?J#c-jmE379i<-d^SA@wFDwah^>7t9wVJp|~^&_=ni0y}0wVEGVE+@b7 z$26aVEi{UmqU+@)dz zr~Jiuo~s~S)pybuBJ%q0Q`1MzFg?i=4oyo=;6$?hdPBG+U8F5(KSGNTJ}9V|KNEo^ z-Ri#Fu6@+vu1x?~#xyrKI~Au%QjBKu;yJe;^)po3d2-Ns6=on>vfJM_FWB(lLwDq}xxzP|>u*cnq&ra3JK3CsW#%bpMM2$i(&s8~6K7m?=T0 zV}|AIBd63w@bjU-sXU2dM)Z}XqenoYZNVoTgixf?k^U1RW!w@wPwXrPWHi>z<>~tm zZq1rPP3sg*XTMzxTbdZ}mVyqNM2tFjt2&k(6CmG;DehKjJ3ORVC_47)=hypaty8!1 zf^;6equ=Q6!(r_uky=;@#3II?;D^(xB#oahhjmaQJ8t&e_Zby!0p$9p3@fjG{4?h# zOMc5CLN|{Mo@7h#vKTD*-rXF8`FVQgI3R!F}7* z)#$mFvpgc)v9Lc~fN=k?8oP7IZX1MgbUCnB58?q4&r$iwyW4XmKbE=$8VZ0b=|Py& z#i6GM?p)8!3ym7TgC(~F%@I2`k)6lcJRfs1B+mZKlvT(d|3Sb!0LP4zqw)8jn6P@R zelVfW{*+a{#&m_CyB>J7Etn2wiyaSgBsRLN({;GT6v!`nk1M$PZha}udl~dByqgx` z9&;dsb(&SZNzL1T;opx zI}TH)W!5+U?YfBzjVq}>D$NfKY=LyyPjTn^q#P6VD ztaU`FMH=0{k^by=C5ci!c^?dRzlSm>ZjC_q(us|l!2k>?p^NoCixJ?3~QU3ct z5-DZWMY1)cwv1gP&MJ49EFS<}qj~lUwHl46E6wHtiqE-~FmJpE@~;XUb1nx@S9N5% z20vER|JJ%a&cACEac=zcUzvqJ+H^#mgkt#qd4y~cJXKfz=;7S<(E;w&4~AYbBG&E> za5_M><1jg1-4++-U5?lyGXRLsu} zN9bdT4CaZj#sP>pq2|HpLJ|EYDk}D|NM+gLXj}Zsv}#!0Yg6YvgK##VTx*2I&jF-; zqQaR+ua=r!Wt7W(p?Wj2@&f8dxGQw%_}$oxA>lL6QUe-DRo*9b^4Q|*`HFW7pI=$v zA0<87e;1*pi(A~y9I&3ef4lm~pO0c7sS;ezV;eF%Yywe*BO>HLW%BXu{$Px0A|&?J zAxG{qxUiUp^qJqpdMS^ylH7r}v&e}e8xh|xw}I5P2Ayo9&^i9R?-z*B;UNn*P4N=& zF=zvY*hbVwBm!0zG7bH;_E=BVd>Y#jCwe z_D-Pyg2=Zb+F6mVOm#vw8#R`5x&P3hB zd*c1ySTo&O1)^grIV~L*PB))Z1BAr3$lXqCG9NdeAsGLZy6uZb9K9wdXOxbu0sA9> zHIPp(Ksn>R%O~H&77E6>fp;a;MG9oA`jd9hXcta}-biV*C;^v%vm-g#KoZyY5edei zzcu?gMv#~&0MnzmQ@m<09;vP*DPkgh9|0Qpb1l<4a%#8;Thd{fccfD)zrkbo zy1sT?sf`PbY$PXUVs;oLrQl{p&R5YYI(_rD-sXHyQ<)J|v5|!)g%K){Z6L2#=$F6@ zqyC!p9XPZdmKPEtK7Ao;^3eRs&{g^0afQJm7Wgor@`Kl?Ol9LLq3PKQd*H)BE3{Tu z%|cjuxHvJ+#Z%eq0>{5QrTMS-+X0(p%$Q#ei>fYh+~03=Rzel)93(W~uQCA-l21RL zt^S7_If6Q=v+6W}0JgK;xCj*m0GaWjm!z20)9~K$dcFyCU}fB&Hw!+3=*DB4p#IUV z%0}Qhp^V>D4TZn@t5^oWr=r*d9}8gjlg^N^NBe6?;pQLd@!D7T-A$qkqfRd0 zOJ}2>if8B%r6=_uLGpygTfbLNB_9^_HDZuS(yze)VHBC1g^Gi6!_=V*4Ts?}``>1j z(TlqFNTu7OMAxnG(Hq$S%tl6wOJ9BfUjYPu0VY|?O}v>~t2r0>9^C{1bBv$IiOrO+ ziMgjl?B(;TQ?18HjDW@r3+$1G5LUfZ-s>i7Sr!;2Fcrz*%xC1jgW|JmHF3q3@DV2f z{u_)Af9fzJku-~40Gk@#z|-%#r&u6Xro6z2zcXQnm&A@U_@q~I{*`#c!f`)?yASm& zeub|a*U^MHG}##V42wbq%PwiT#Dq*eA?wp^cpbvqTjv1;!28zeW<9U;3Rf?`eZ$QR zzR#S1na;mmU)Uz7K4`(%s63etoHcu~VYyZiM`5*?zUZi~c}}5Sc7;fX32L z*xn1BX2XX*jxBQ9i7t-VHV|#QbHLd``3W7o+y;IYrY#XkOBm&eC*-W%C*2V+^+B|}=t_O$hm9Fm`F?Y>cTD22eY zp(Ece5W1=A+xpJ-;3fi2-6`mlzu=}7FSbYE?}vv5kb*RB8nXu^#RPynXW{hqSnQ43nzLz4NTFb2G5_WYeog& znW(ek)zy((?UU~)X97`bpHRWD1`|45Rl~YhZxZt$kToKpM^cg1b1>)PEdj7qGDRVk zwruT+{q$+)y2#cSBQp4LB)aVW*y-i_yB}%`P3Q6Y1H%Mv#J{K*YL9W@u`5({V-Kp{ zn3{g&ak4Z_Jlx7wp*U6MfLA339h7FdPQ^F=>8(5iG@dnTK(LB$QKb+-c;bC0Nn{-_ z%MaS_KWzyFfUjUZF;#bezP+!L^#6KrLm1|j-C<3F{Ui1<1TLlg;>teRxO-|0cM1pK z(OlD=OR&Y&pq<{rbqcwx(60DP%w4U8i!NkWF)7V`oqdc=FBM%h5owdDRA0`T3+BXm z{P5yLq1M;JY<9@^_Rh|RsBWJ!EG9_NA-Frz#d5QVG9{puKe0V2{vOsXOJc6f#>@@G@;z8K;6txer6;zT7Xi=QZ?K2Grta{|z$%Kid7j4Bq4GfFL6 zLmXp8ypDSwB|qiu+}ES~%%nG#MNkU&Jh_m4L57)PChY~4NzA4O_qpjnT$Wrxv>N>o znd^|jklE|OCJl8_tQAEuPc8qkC)ua%20DRfe|N5>b-}{LXX?M_(rh189dA6Slg0h*QQV~6XMYaJOLO-jl@r*DBa&rD;_BVmAQWRP&)2eY~NK1^!sEQ zX#!2#8^s#nRy#0p9%Fzt_&fL1MkE{kJANtvofy<58mPn@Ir`4S^wH@ch6=EI50<4F4Fdi7F|YPC@0W zP^loJO_&}&WQ*}3Q0LF6ap2=nKq!GV2qv?y!kt@SU_#+}W^A?AIv?;`p;T--rNB`$ z_#*lFlp5P{beyY+BTQ)yPk+M8E;z@8#JRA*+2xZ31Td125mps>T+RO4g2S!&P2B~? z0xBD$eaUJLHSNlj+!{#SErehS)Vf316Q!l7lV+$E3@g^_PSPIoP!^}1cw0ZE(7u#O zcsq>w3Iz(nJ8#(JJ=vs3Cq>E!17u<(jI{vhcv3{f8PO)SSlYtO!Be{8Aeb2xKpKlK|TIZ6l=l@&XIJf9;utiMsn-TFN%en zd1m5Kv(j7D;K74DGTSy8Y_q^yIZ4`@X?_UU9hH5!OI#Iq#>x5`FL0lWkRUq#L&Q$x zy;sxkN}ql9)bHfMS>PcVkhJBc3LOC_zq#XuzBF{?D@2x!ApEeBm5?Cnp*%gU8x>zK zejzekh(9{JQ6}c%2H%_qA&b*nD>c^DV&QS_*@=ZO?bqCJ`;s&LfSfk8-D$!r%3p(J zi<5YZD|Add+bQ`uuBtOkbSqq<&V_7SNA>VxGUeSHLJZRB(%JUIiJs?89?T}ckhwd_ zs@t38^Jpy7>r6S?i1HC#a@~FW{o6mpeBy#mNSv_M$j7`dk_1Muo0f^KJ*x<@P+Xx? z-69N#6%G6&(bghJ=ONJ+TWbncK|DMB!c!sDmztS|7cNk&Kk{aia&=YrwlrM!iLluS z?OicR#Ee%@HN%{CYoO3=6Rm{Dw%`jaejOen#(|?^(-Fzj#79U;WTRwdMk^`HMNv51 ze2CwY0M980rE{Il(tGrg)J{Ax>A>?~YBWrhf;W+X zC(TRFRUA#GxZL)MFtDKEEcoxhyI#{Pv_`Ou%Rsz4&7Lbw5faiq*BTnv& z^rf9@RGNLAdK&e*QbiE*gMXv$0zS?!{5Z%UMt^PXRdvnsg*XM);i10%vvZ*)XfGl!<%V@(-%Q zpid-vF{s!1yEDIW5Z#&^Q=ZjN9nvIOP@yzQXPFvN1uB1hX|QeORN_A&F8D(d=svSr zdM?p5E}I-o&(X7iRYmTQS=;92n&ke!b8LGYo zK3jxK^t?S~*B%anCSC{G$If5MYvr1t1j^alggnB17n(AH-)p0G;=6V{g7mRI{|G|VS{1|`qpt3Os&Ga3))x=C zI*D^Fx}3Z-#e)B!a3^Qls(rTLhRhC7O#eZVI-Oe89kSA5JPd!1Wz!aHN(ej$Me7kr z>bTwAjAWz2d!Uz8r~!k-*n=ATp_z)w5@Ay%y@?@Y<(Z8B8|e&ABfe!4yq+oOZgxl2 zeEXM{+l=Y|_<*;WL2Oc;*iYo^I$I=z?e9_Q?*0**fyvhl^vKH#82&X3SfpMj!t}gv z3Z|F@Reff~<+PVf3X1ZTs}NY8NExrs2fx9?rwCFJTzAt6%$Oe;y*U2yr?9L)acx(+=zWfe^VGL0ySvyBc zM8bWI#L2KllZ&fXMa225!&SZzQ=fb`hSB_kxBCE};l8ki@>4Bx2 z?jYCgHXmyLy4>@^!&RZX4G%&qMCpOjWR>qd;+Q|3TQVEU%To*XB}hzP`KkiKKp^TM zw1-4WIwJNuKv+pQUWJNPI3$u~6+w4#kiVmawbI7g3VYjtbLrk&F6kdjv^u2S;LmFc zr34}iFE!TM=pRoutgeynnBPu<>fdu4mV@)>{|wPMEc4;EMY9JNkbZM5{kk_f53 zY|4UtptscuHB4s)6lhl+hFnb!A1Q?xy3qSKF?A0nWrZI9j1>l2f9fckcl%|7a|+$P z)i&`K<2U=?5;jy=<2>Xdl+YTmdsultMwGZ1NdUNatv$&?;<^7JUj94y?BUUxYdGq~ zsecf=JL&q~o7U`1zmLcDns?NF!TU*T7(2=XuhNb0^8x`GvhMsp=CJuQM<3PsQ?ga1 zZ+_%$?b7R@p^3oYEJ+4z7sfWvEut$dm$ZiGNpD0$m;PwT(p|DKwK8Yh!?>mj^X*P> z5mHu)=L_DIrfTN?U)kL&9}g zBNK&1est^MzwdgR35f6xZ_#C4tXpnfeiO%4eSATlulqMXUv;Wjbs6(rX=|P7yj6wf z@Xs&dU=)#CBjJ=909Cyh54%0y!y&F&dAjP*sIg|BpXlI07Mx@flkPO>A}gKXS~-2^ zMOmaOn|gh7z??)Hl3Pg#+_q9=gjMECXFWsFDdrd?NO95=$E-qSM4$hux^p%e?6{A` zLzR3`Ixl*$A9?}%Q+f*?-=*-Sy2otx=BVIKNJ?ZiMkG?{J_RM9kxJ$TFA84ae6@&n zynlV6l@h9i@Qa!L!%YH{J9zSfG$LJ2l|Ls^w|nv>cZEQiLw*whG|ewcoJM!oYI%9w zG}_1DL)g;RSgiR;oOW@zNn`tTe(Q?178K|9@{}!*FWBtOZfrS*irvPSY-h!uw-}q; z=38osYKPGV5wLYXEC|dJ6K0yI$6_bIRt&SRx6}O?CwumGrv_X%5=4mv=OO$!)PP33 z39q2F>y3)JmQh>a>B}oXoF@Y~tRYzKx)vtKQiQ4ak9EcBQ3b;wQd4S*mj&k#a&N}< zVJWuwR2VMN2Azw*ppvtkyjsWq+`<*FKW<(`F~HhfNS9>ULyde-=12` z0=x)~6t>+Vxz6g@*4k2pWWi0@VgWDdZ(y0xtFx{C>GrObxS z2oPy6-sl-u3S*8@dyf`M%itN%;;1Rx*|Ki5FxqpSd ztWcMN1Lv5$n^3uMYu<}Z#FQ%I0_qj5TtA76_zo zWD_Ybw*CBu?2G-Y^Zmv7kOO1xh;U&5G~<<*9^jkYZZBXh-;iX4o*gVNe|KdCMp=L{ z<>2B-YDG4>x7{pjANt>xD*#ig!q~XM?`Lp2Z9WSS9_5dx-G*g9W1IGPI|?Z{M#>qQ@D>q$E9WqjsmStZ#a7T{6`o%AI|PeP z*2igH9(%uG@%4wtInt9Am$qhn{Gl*{FzGkUSX<*mWekg-BCd$#+{MK9(o{n8Xe zE;Y2Z;}$?O$IX~*E@D|*xNW`rSdk@A2rTx>LY`)8l`(s93Cu;oF1-m)tR$E~Z>J2B}~JKVEy5uNl|w;3-97ZWhM9V+L>fKwkI8wM}n z%MmP%oeKa^tcu9I3;!>SYgbVlzW@_z3tYJndt%z=Ntl>Xi%m5xbMf>O>mijIDa zC}br=YEOqZ!a8*RWCL`>`AioUS>Sef*g)Ors{w$k*7#yx(azS+_TI6TXCF0_Obi|y z`jMX1)o2jndTobyyGOU~2Q_h44(P?~`wx;(Jim${67qOBPGQ*F#Ud7tBxg6jg2@&C zC+MH2?SIgAj%M?=`NB=vP@L%P`05EM&tL{G>g zW>k}8A6Woin-;KUMdMxjzdvhqoaoTD&Rk>~m~rN)6=%E6`_Q|89+#Dhe+868S48}5 zJkpLsJz?~!w+l8NC)~arm5e{ddh7AP5Ly{K_flM0=W-_;K&u^Vu*e#UG$=EpXoKE= z28jk1JI2rQUrHwSRBoH|H}lN^s?dk+7@p0l!<(sYkPGOkjY{y!4YLqP5U}_Y+oeSV z6yRU!N%@}Ngq+h6V!#{`yn=3-dJTSh-cys?C-Lg9(pSLA0h~uV-uQpETB4yh-E04V zlosWHuSTTtOtjv+NdV$!ha2{y?y;_Fx(JvSR+oRIqrJRU>?paxUMAt!1g^0|j*~Yl zHM|oGQ>*{68BB%pJI8Kp`zJjPGzi%3kjm$L7On-!f8;_?Z=>kj?i2bxO7(aW#SAB|p}gSP{D)PxQ6MgX2OieiX}UeGEYAC!1PGQl9n0iCXa4_^X41jo_rqW46<=Fyn|P4{ z+nTjGtTg=~$3h&P+@JfYncwafjG=tc>#_POI2B^{k#yFpv-+VzWLowO`4@whs>!OU zk2w%b*Yppk8PL}ueb-0b{BIRG~;1 zP7$*xT0H-ro#yu@(n~z>#3@TYz-#G~_tV)C`xNvpPG zU48xVKf@e3SS|67hWO>$u*hhZ!C>DXpDbAaQ-wL`uV_OeYyl(=#2f};4c4R{)>4Z; zh5?s5rN=^^qj?I?La*0YMm936^Za%gZ$V3Dge>$Bo7UYgdR&}s>*6YRAB&2k&N2Cr z>YwZF@F~s2E6oQC;CEvFQU+-Gqd8IX{ zIK6zC;!@Q%`|WWE_(^w3{|JwgCm+)NhGJ-~{FN2Yo5qLUNiAji?c{AwmnJR*?pFMd zq|qjo;Q6;ry@djT`y`S-;mm>CYz=p}R|g}s9T#eI2wqyJn<|jcL4)Fu)By$l!<*cL zVD-S$KWSh~gxXFFFlP-NZQ!ZJYq1)8+8`$YJWNSPsDu_IEx#ZjlRrfK<3z+>{j6?{ z8_bdMUI&?yBx6%cW6*Yb+gdgV;x=qbSHH&jy!IBj$Ika#4mK_Mu%TD{)|j`%Ai#5w z(vxOt#k&lSj5ZArgXhE)6EU?2mnnR}Oqw?FwRlpG7wh7WX$RjwcWquh7spL`9-`Wue@EG4Ufh47wc6(4CU9}ABz+}iJw^Nn7;nMwm#*1%LHwnxHYX!Ocb%A=`q z-vkz=_FN!|W{iQRm2vQ&! zpfNs+!Q$HlDJB=cg+~mo_m?mFr4}+no@RZ9{{sQ$yFC?Sp8K%x^-}7lR)y@j?92Do z{CfVO2}6be^iXuFCA)2?7=~t#(KxuIvrQ}J+45!j^+DL3H<)t-O8#=7{N=y)&eA+V z@zNur4^qW(b!d~6<`h+T(@4O<&Z?Q=ASFXr|i={9p7(KL~_mA%K zEgqSmAGia-0`H^uB~r`5(~IhN?JHZ$w4Iq}$?D9!ev7^tufENg2w7_^v)mry&#gYP zXp~y#5AE&C#C(@p{+nQm1rWEfQM4lfXl8#uIP=r|%;;fCJ*f+nQypL;DkI9BZw$~W zu4nr;#soX^M5BA#SVOK3I>MfrZC$d2oap-zA0^?-?KggG1^JjU7FHl9F(9vpOsRG6 zR?p5y|G+koD;kNlFbD0ypo6xC`7`AWhj#c8*qP5}pW2hC zbJayij|+z$5t+VWePsUWU-qdzAlR_5dQE`uM6N7vbUSAqw)iP_U-ZZ_cjz(Joi#E;vv-3)V|6i#y_YOOW|Qt$$ob-8eWK;- zUwv$l_?5VYVq&~)`UFB}{+=BZdf^%6?75w|bA>R%MK3R#`jDw^#YD(f%BF5`91v^$1fy%DWxFhF%E6t?&!f@!lHy z-m(rG!(!D*Dp)R4S>aLtZAcU@%>m<^C5(!~C9Ye=a-^;;d5jIs4B8X6|}O|FzwCA#%MM$Gb{oXoJe!r5@m zgB9r@5wM;bOK7@_4nqqGE)ZV0dUqJBr+!D zowlz$x(AKzN|62Y`L%OI{5?XVj7iWYyq(^ixQ@uVCpKl9L&s_sbEe`!#w#B9iU(Nd zZBv;dBmc@WtKWaUGbBtAH}7gc!pK2Q$-T%ApX@(jh0M zw!%f2a8rlZnD&?4iyhFB-MQaT<uJQq972_ zT?}QzLRLVgT*mkSV5$@{{dUa)pV_~Fa)yr1t*Gx_r4~9I5UHb%K+#(R+clU9FI-3` zg2!BNlqkan+K7@ixN>iPSKSXbmjhIgnfq0`z zAWgyt+=}V-f4L|8?umq9xRa*X()a|{mIED6RDJbMAT}QZwd}6gL;@56skJ|a-p3{A zJp^&trrnjmDL6mcwByn^R2aYVp22aD`X?xS_R8QbIB$!~!l()XV3@MU3MTD&L4;?w za>@2mi4-mz6SO;y6$L3k6b!k<$llw+M{=Jp1koZd8+@q1`&5P;IOOBUYM!}+@kRb?=?@wkOu4$0UOAxw?8k= z(}p|)DJ9(Knv1dea9YC12FWTT(G}@eVvY5Z5~aa z(!3t8D|V(Wm8PYl*7<~A*wU1%T|$@Vvk@sY-Gs?O^E}U%p`N-f21bZPczT+siM-ja zk}T|oOBm6czfYox&KGs;ub0VtV?EZ>D-iX0?Gkb1%11eZfpLxX(8*A1n!W@~{E`%> zMgv$wD`Qa{8oX3M+olAT%?320`wvy;Fo*dpl(mNeCedBe<0LAQ817$_ld@~i$UMn$ zfK}mJnIXT{jHL9k8C(5fsOxJBsCW;u#jc;H0|pUJAy|OfK2e4DnJQL+X@7{`M9*q7 zn{ogAX`nObv?0N>gA(BrxoHR*H8T>GSFIS%3U4uV@&{J%=s4SG#g6`WpBl(2obZP@&JUpkxxr z-J&TiTU>&Qm&6p|!F0ms{M;4K_zLn9>w>?;QT5l%)D`--O6Xdm(ll#1*13DjJ53=IT{4 z?}}NO29q2=BETW+Ddu!u$tUQQz|ya-OCm5!2zP3siClaE)$owIZ=Z;=7#ZL%;LulG5+T;*TMHnrN{=P$I;#fL<>wwg?@QF&~5FcHjKn?noeIW*~cFSgg#?;U0RJaTu-Svj`_ z=?1M>HiLv2F^!(id?}7Fm>j*4;&z|D;?qghHRMT5o2yB?{#Ii{D(x`40z69lmBMV&LUu9218JhCt8fyJzZAC+yK z9Fd0KPxCYVFA^`Bgw5bfv3BIxssiN;d}k-_P;?2$&bk%VA7_W}bLDfi5m*0pzmKtV z=9x7#PhUCq82pL~jSU3LW(H80hlo9YoXcH8g12&9lU+ooo*@9-hBY!B6D4oDfnV+E z%9Qhd3?h;3efd8m1>|^o6Z@neY#y}KRFv>&0wkXVy(QGF=b!877v<$}QDw7y9*5!Y-W!F$9+hAHp}FPn z4vA*|@IUcpgk82fK+*Jape$(gNpd}j76k(Kr$6j>{q5C0>%u?#(~(JZjK4p!FznT` z-?ZzUk`MN)7oc+FoP0H}7~G*UNbygyNjEO`{L~yBdK>zxWx|v59I#8?4l}1y8&w$b z{HHqQqK+MqNlNy2%@ukLDLAY&sJr%hoJrJdBO@IjTQNwa0bwe37~_ zZ2=pguW80y{V72YV5&=+nPn8EeC@{ zNr`*<1!!~@wI~1up7@7%+TRWvC89#3|EJAWuoI0RRnhF1nh98pK6!E@yNEsbGO&As zB}{vtLA-GVzTP0!Z9TgWQKBf_@SE9LlYeSb=(x>iQWdM|5Z~iF`%usvKkiAp z58Q_5*3|h2`z@aR^Ssl5bxz1xPIGuWK4k!uVEv2|Liu$CP zDByzj<6(nxqdO12fUasL0ET7|pxtw9O;XkjP&GGZTJN!ITBGGWe+S=_an6f>`Tf_= zFUO9v5hp&nd2M>xr2>NooIE|8?T1H3nB&~VMe>rG^(Tb9IZj{(KB zFPisUvqf}cbctQt<24qxMy+$mo+Ye)h_me+yyvyV^c@`&3VHP`Wm~*iWnbj}T#{cX9B6eZjPMp_z~<1>!%rK~lSq>Tz7`p?AzxWpL=> zpm!J$XL#Q&Zyr-WIutu%_3N^rky4lv-62ZW_O2NrX_PS_f6~PHt#w^(O!4Fn4}GU z?!0o=Xe{<*Bzpk9rP(2_?ryvoJ(Y6r+hv> z(!%wy}OR^ae?Z~=J96D$toDiNL(+D_?rE&q zbz=SC;4EfLSJdN#amUyCE2Hns&*IogfdgV!C7riGd2?7>Yt{*n7usR0(_Cq$(^RN- zJ6~!{6KDp8dTPHl>`3-tWK#3`#qw`~JBA-2`B4wBp0WdEtq&v*CV>wB( zanV2JG@DxL&2(C7)bj59(FQ+8Tjyr(nD_^{9IxvbK5PsX=LntrIat#qLs%U%Rq1#g z13zNd?tZP}*!H(_l9WhbWr~CpE*y?Nl@XHJ{K1fInP}IQ^5v~i@=M>_0#kONj7i$!bw{Jxtb$YZD_@n5rhH)PK{)bk_8DsZQYX z@`7Y?98g{#_WtjzOZltRlh0C0mCBNeC8C<@ZGY!lG`Yry1wD`iohzHa(2-y19cDse zhe=CGlHE_rz3tE~&mN7m7E4)aLowz2f?ok*M(JuhND?Q9orZT67g#m?++BTcc8WlW zIr$_^oOhI)Nh+j6+Vo1eAT_@{-__oj**h$h_ldbrmZC3$3>`bHRNo(pTln|eoVQn7 z(Q~ik*mq`PY8}UIYkTfJ5espvbo4p8SzC__N=z3_aDNO9X|5Z)Hu__}shJq3K8y~M z8e9wUib|(MTuNd&WyxCC%Y4zPSMoByaBsFbw(jun_+#|4fu8=O21#$vfwr&tqDvo>R_ zxxbs=AFvSTat3CG#92%lq&`GvT#Gb+5Bo-<6FVPA*a?0q&jHnKK_p3|FC+LmL877Z z5e?S%WXmt=zgQd@GzjN6K=8*GA72Ikl$9oPcA9*)_+1DIzixMtmKH0n32RW=M-$=iVW<)xslrpNsYv~n89zl zb+m}PdGE%Bqu~@|Wt(xUj~g!Pl7q-u#utcye4&&qO$>8hDr)v2P#GHdHrTl;CaR!R zHVnrG)5fr|zN_96(%1Wo$TIQufH*8QdP+7(c?$cpE{;v(@ts5OV>5-F8fFhQZFYgU zPcpncYo&rI>dX0T{QJ}QUo4~&nF>;^ae)SAbWX`tngmeVvj-jl)*Yc@VWDmovNUE* z6%zsfrme)a=1L|oYF_>HwY+!KD<7lx@nea*2Vu@S0N3|HUuTx!uQR@8ri*^n!CMVa zyv8a%I&^;K^qfpl+W(VWsolCW>8tq@@7K!bNjI+mczZ@CW9Qo|$>9&a+FV6gf`x** zbi8smY^Kgv-0bUQSeBRYujSRtJebQGj+BdC$76d2hq(1S7j=^N8)q+5%b49gQO%T( zfmRtr1CcJo`f>ut%y~Jc_;fk+s7rKCf_uX|QzBvf6yO@O;MrP~`AtIZnv;qWOsvXy zm&lNHBKC-@Z92!F6(BZSx>mVzEFeDq8*)VVYa6LNCGVT}I4crZ4+K`;oWB_U?@DSY zMl<&(`xlN6EFV(W*2CW0XFEhQzw`QQ{7%S1uygDGS~&A~sMbG@pKRI5$TCC}qfA-S zmC6#8rfZAr+t}Bn87@kiY+Wh)PL?Rj*v8TflYJXxA3Jde6Us8KWe~qJe)s%&Ugz~Z z&+Gdvuk(Dq@9*bAPM=>LSi$dy|C$RRC0`s=^rRj8|U9hi8&3H^LlPy5?u8 zCbcLbtV(JQrr5C}9qoWd{1Vsvp=x2*1M?VP+j0Gv($v_9q%wr}ef3o_z4bfNkd{n>oT9oZfWxl9RF?Z4708&Ai+NnY5N zkfr{13%$A7^rk?0;b%IZTj!9ZLFyc(dk5R>#wrVB14PR}f!)D^ljXGfE!txLw#(62 zF`7xyyII;YNwD21k*%j|e}ohi@HUyMk$uTf#^vX(7uqG3jM8GAt#zBoNpv7hE8K%# z(B(0(+TENA-!#hxZf>5s^!usW&(9mBQ=XzB%Pr}oL%$`}o94QnJW_=&6)_URR~YL{ zW3;#$0(g&Lr+jtbxL%8jYh?Q)oiC-~oQ>^KfL;(ZL zF^AtJ&V3kt{>$1hE7h$3lj?jenIM%b!=%OfWaImI{fCZa?snt4b9z7uJA({rV?pi~ zv?*&yJ&FtqK|7etsJ`;baoMe?cn840JEe&S(mQKTqjN(JZqk?I-_k14nNxvB1(usG z#Sq8|yc`VJqPW%(!qsW}8m^1x6J+V6?%FOOOM*tUGG)mf-c=zsf9HMBS!QE&!eXub zE`hSOf#`M(o!W2UK<(*MrXWq&Zw<7Klo}zmqkY>E>CE#?ivGRQq6z%FktcWjA!f|F z-{Ma}7Q2H2VpA1XA1DOWPh|+M2I1OY^3b{)-o!^1NbBiY{To2MZaJb>g&5H!fmMhU`9Q}I)-4r;F1R7+3#h(>hqS!g#k)Qj6oq0{Ed z$5FE``Z%gR8)>)z=dbE#f5O7po*$zCE7`1E6Ol387FCFSy1hP0NkAzNMXbDIZ@hnj zsXRm)(1!?<-VnH4>P(<6(b@VmpBC@*o9H~^*yBiV^q``pPtJoVU>>RppS0P+oWhMX zwaoKINOp&GaSENP0MaraMffq( zePxEVxN}pu%G1xdZRc-a3NY@cB*fze;&p8KkRgMb^}F@1mMe`? zxb|B-92KgyF1fF4m8SFsOz=m0MwQs0StFP-JbJR0sx@A`<8Ha%_;T>Y!`1Ap7lzT; zfKIKYt@Uf;Kh|#{Y~JDqHF$7MdH&!Jyc+H#k<*d>l?~ik@FiD1(JQ(k{&oWOy0*r2 zs7p07G(m{WPw&XTgew=@X2PC4i#YdwT)hGJj|N;uVz5`E!TP9%kQXiK9PQj5L_yG;;?dXyvmaR+&A+?O zA#`Z_q;d}$s=8Q>m&dE64T*&LxVXrcEFVF{!Y+Yqj!v!0o&GS?`jTF3>#d^}NR0 z?Uq$d?;7+Z$2w3Fd=Wtz2`Xm6+~R5`c9M!8ra#y0JwYeh{cbv~+1_tBtac zU2yy`V9VOrb&JlAGJ!r``s)W+ndWM$C z6BEll$RBb^(ZRhO(+9sx%eB`|G*55<+ay>{=M;fJ%CQKqc4X6WYwTjT-EdVD)P{a9 zs_R3v)f9XDR~F4EWP1I{1kLxTRr(jF$?krAo%AAupijoo9)J!q-9uJKW5!HIZ|$0Mu5t@ij%ucm`4 z`hTB9pkipR8|=B*W>-ZDU!`0G{LVn3(D$&SnwMiWkK5v8-Z1*p=~SX6*ULXs{%Cz4_M6V^oKS~%msxl=a*lpHzgXnNjZMRvwXtv+$&zu|D~=##|k z5&VAj@I{HJMU{Iz)WN+DWe(tOYY%*s7L55Qf4k=!C@c>0qasmyC8C(b%F;a!@b-hu zLV{L9k6^rzA@WBLWpEPV_bAb6bu_(_G=|*}JKaf!189!|Gtq>Hj8&~-Uq26sz$E_g zPJ>&NH_FJR^m|(ToMLF1mIWJsO6}Yi!=UG8dJ{B998NUeYn*Kga~Z)}UUsNpF>e6{ zGjKxuSRw*jsqZ|+FkbZb$7-FDD@gzntG4iNh^S!&5tSuE7jw*y!*Fh$t`j6vr5&=M zqRuDIHJXC!ZAkOC0u%+prOBhC-9717Y(sAaN|6=s;Q5Z@ynYJxxAqtM&ZR}O%O;JV zeC5Th4QL%*(tzjrIM_fWpXAIR@PfZ>kp%s|{Pk%t)Kc==tNp+4XYySWyc}WDeRUpU zWyz|gAAyN_eZk~oXLAJC=CPC24JT;f;R<8;&bOeCcZu)&%NLX-ePyyZ0?ZP2$rr&M zCR{`nkr)#kLkqm(7W2%>R;g9_qN{_&^s%1GQfpP70RgUnPvvsje|BhBk6(ZnNlDVtNsR+LZ5u;7L(sVmK-@97U8;=?{U1Cu BK^y=8 literal 0 HcmV?d00001 diff --git a/en/application-dev/connectivity/bluetooth/figures/pair-request-dialog.png b/en/application-dev/connectivity/bluetooth/figures/pair-request-dialog.png new file mode 100644 index 0000000000000000000000000000000000000000..dfdfb14713d3492f772f9a64b02cc1c2d05a3785 GIT binary patch literal 22673 zcmbT7Wk3{P*!D^3k_DCq5m;1UDd~nqngx{>5a})f>Dr}3kdj=|01RRYY3T-O>6Gqf z-{JqfU!O0}2Uud}%$Yg&Ip@BA*ELZ(S}J7348&MiSY)ctlytGMup@w^(ac=C2+ls5NulG}klvBtGH(A=!z@ktiyBK}es{_}T7XwO|v z@%gh_M;s$}GPic>=4eUp_S8?Sxdz`K<}EmMw0tIzAk0k-7-1nyd)G{r<)pA9<5O~D zWPjV~hqN?F<48?MNK&acd?-eV7d}cv&DHhQ@TUpPDpaG4=gl<#L;GwCFhV=)2J7z{ z5`ALPg;!1aG193W_WE(veP$~?66SxJAaq`iw4Vg068-vMZf;NLLpZ(u3}uc=+Km~f z$y3s{$Oo0&Csh95K1^yjmQ=H$93Ar&vSUJ{v7<#j*80Y*xT1Pu74W5-w9$@W1l-u4 zv0$UFj!i;Hs$OZnZtLU|j0lSr1zW}Aps~w3V&bP& zm6c;tQwnF|V^NUAXPM%bo$;Dx&wSjxm_avt6=AMZP*RSE#*!_8C-lNvj!&wq6I*p$ z;dx&B6J|k0#srJM$CQVB{OzZm|LcI{(o8CXIJoTh8f{PZa~(Jv+!FzvB}Va~*h5j6 z8!vFO7N-@NwPkA$5RpBn#uTQ6hm?}*a&2^$^MxI8++0t^GWRfo;L zCJNs9eQ*6SDLxhceF4YGZ=Or7c%sjTDuIy!MGrNC)Q67EV~(g04a)Mygn=lA2j^~A z7_X^LGrFq3K;M;|A~42|@}nQLW7zrOY`Vq85ZW}j$^NJ{7?BhOk<33;thwm5D7Eu5 zC1~andLu$-(PapVj1`wy8_3?ePxS$PNo;Xlw@uCW*lmlf4XU8PsP`57TmR(7G`W7i zDkw5s^k1>&$F&CuYR>}@XyJ`_ZO~YSsVG z%GS!wAHeN3hF9ZXd;PwTWo*hQs#~TUk}SlJ9Zky!Ap zW{k_-s4O`~mY)SNDt5gU1}>9tU_@lGPn5=f7oV{5QcXA`sEVnkyb<@!j8T^nNQ^#^ zr=tm`Y(y#_Wdy`vsruMJ>CG@@IZ4{qWApl-o5sLFwr^wUg^FAFAbd(iolw$(@~9u8 zjm#rXi*>;0lT~y_q*OtmHlnPVh*CmEiStd})>X%aUYLe5BSPF`t?<-<33UEJ|5Z}` zUZXKf;JHPHu$``bO#XiV6nC!w$m+1rpj5JeYz%gXchKpSO}X_8rkM?i*EYSPJsnc1VqkM)d6BN7r_e)d1*OL#l$)_EM0@SAXy zvc~zZ(e2G%P%o{qBYVKrsixB>dOVBzo$BP(G_zM);;Sj1%00IJZyZ#{*21eh%}#4X zJ;B1ZIxsrjyB=Ad?=LEQxCKfaH!Wc*c*kCO|Mk*0wEFPk&B-7AG#Y&q_)7x|{ImKI zwa48(k1MtVDWs2eM7?W6AxvIl@LhDj==^MeVpXF#to>z~k?K$D{*}`i7wxjLAc!q@ zjt`2-d)Do6NRgswobUBgd(@9!zIwEjf@h2&h!WZ!EEwz-bg`PIXKcULMj`8IWgRCn z?n;9f&^-#_dw0CS-pLx&;OG3xZ>MT(dYi~8-X&%!HHN)8l8QsHF7bymkFB2ABNT#I zrjDtK*O(HYl(xhC*U5NtvbK!jfW+1l@tw+16Ls@!ukoa+aiiWSyeheybRETLoZYyp ziC4y{rf&`PyBMSA1F!mtxHj{YX-3kOLec`9YgcK#E6!$InvDJq!V6%vYHgVg#o~_Ne+Ptp&3oXvZKrhNalZnm_RlPQ55qge%~mHe;yPxAIllYmhAofrTkyd)~~aWKox8A( z_XJpVQ_8r5Ny@v{H8{5nZB2{`%V-hxlpmF+#p z({z2PZtw7e<2X)qF7ax&evk-cH|;$iV46#?OO6*y?#|k{tfq3VOlSHq?bW+aQdiqQ zV@wMuc=HEkF(%H97uI$&)n&7;ZDi%R9~6obwaS;{C3js#97g0d4Mz`l>-XxeEo5mT zfZH=J*2;clTIcCD;k_6^*He%nlUem8!k^9T(~euy=H61vxbXX2iEKZ@E1APC4)=rK zboFw9-}u5kJhvx@R|P`vt%#q6qkXx+DRM0CLC$rXToY%_bv5&WGtBC9cD@hef&Qt! z3cB&)jx10~NF`^MKwEa>#-?a7Qwy3mWBKm45d1wc1t!EHFm~t@)B3j`)^q#@ZmdJE zF$-Z7CUrrVo7^=T7kNx39{nPRH)r!DryAoARGZ9p18*?P|B!m(~70sa^cLQ=Dlg545FEo;yyh8u~4S z5SY}WvSe?LM>mOCI$c@$ny%f~mkJtmGfL>|}28fmt$(b*_Hp;ix=CSDNeJTjllTk2O9z*V)zSbVT7GlDPh1Zsswy$Z2H5 zs+6!9aNV)7>4&nn=LOrq{3xewJHWdhBc!^yH~ZZFI~wh3b+ayual-dBEhdyv2Ci)Fkxmnj#-#6;BYkLS?qAy3EJ z)l{vljVu+ASYU$msVjvjW(sMkIspuOj*JVJYwwd^$0NJ5v2Pv>cB}m2V(}y;xMw8) z5PVZP3}dXlnasV#S^Dd<9GA_0oF5eKzkW%DmG=V1;=TK0>517g!@PH>_%*(RJm5BkuabLb)~Scs;4kj)iCieWdT%W;qsoXd zw4fxoa@8?6f*gJ(#4zvMKRi zoPTr4B$AAmEOwjgqvI0sQwqNIf-sPLTl3QVJ&8cyA@Q650WPpL%e`@`L13}nKE<~` zL9zy-V`7j<^rl`5;m^KWD9dtZf;X$-gI|FXUEHV2Vo@Xog($f!^nw_H9cT7CCW^f& zn_Sc7n}X`T0~7wv2Z+MGU|e!nOfAcRGOzx{@u>DFDx^gMh~mG}9Ip5mfhMQ!G- zmH8ibb8lX?-L@+SZZ?|8+KDZOQwy%qUuc^!Db8N&!l1#G{pdHU7w*@7 zyTXX`wbEf?U{&DCe!iC-$@IRFm5^h-Zu>{Cu1cgN>lTD{F_P~QZ+pwhP&AxUFMjb- zRkG^RGC_L$cU$8uMcFg+V^xZa?h|%}I{tgPv`-$iJ{>4pB_A$o__14ax=**8&0 zu5YaYc~B1-QbAa1DrvumeZ^OshxpD!?ZHlC5>)i0EEG>8Fu=;9&1h$$-QI?)(yN4= zUV6n&#-!+!hKz5J$BLJ^w5@p+$LB_A1LOiGx31Ds*O~F(Ej#P{3Im84SSeT$kz&64 z0uLSAp1C`6QQ|Kxf?3{}@E20l(DGriyd6*uw2MGoDfg!yU!CoCFuHj9cAlJHm?lG9 zNqKpcf_Tmk$~OW_2Sc>C&VcUkhXgwQ8=5eVwXc|%hOX@>O^9q z7fOL}^0s(iUgPlTNSu&HCRQVaI&PWdtLag9W>)dtje4Lt8BsKe!)S znwV>%ErZI-ZfTEzchV+tjlfum)-5EC9KF5p8X;!>lMh*|+9ube3DEdIAa+f#K$y%g~DWJ|g<$4Y_gwG8;P{nn? z6RO`q(^igaio@aiabHj^hZ(j;V@d$U8Ceb0B#imPMUnw zOmS00D;<7j^E7;Gv_zX#{~6D*r>DjCGZjrBm7YLm%C0Y_L*NVSt66ACVe>b~vR9$e zI1!R+AXgGff=xn){@|-{%PAz18NN{0g=+$mID}b9!m@Y3;91thG6*GwFH>Vlb69Wn zbTm$ZvI4Zuk-HQud(ck3x%IHgmL1-%35Z7v08(AE4^^AVPPrmlG5_kqpn@foO)r}*RkQ}S(^z-;HJnYty|D5a zlBsRI4J@ge{Ok#x0?5#CVgE`g;Xetb-(R+fp*WM)IMd{t+VNLMJ0O( z5I<8HDm9?uMx=T!+%K@xepma_{xu;}=j(4(FM_qxt;Ow{ZNBn7P#W>hy?D?jVqr3c z@Ka@#(NxJ-4hc||gvA<(Sb>&HnEO}6VOSPLZSOHA6ldCT_Yw&TGmdD0bza(&Fxh&S zd6#CFUWer%<7dv!MKsO^7Qui@zws~J6j{XA!|@98;bJKrJNCd?iLt&Zip9%+Un)$* zSLR%$8zHVNhrwb4V#}o5Fs3j<*Bf9eeTFQoE!8gG>QrxV=-BeOB^anQy52+*o~3zH z`cwV!U%8&9Q^Ai!i;0HuxR$Uzt@RYP>G2C<#E5LT&$^i2%k%&Jt2q@8D!n-fwzr6l z&f`;fZo-~Xy&4TnsB8r_`NB`?%?9vq5T)xM%uW2}Oem!g92i-wB~*7zmnRr(v$SxX z4_R=ql63n?fX1w(u<8ks}y24Y62iBqJqhp;h?y}sn-2XNbIZ#i>iIZ zDlp|Z6tWa_6i_>xSka|md5a9Re;WnZ7gmz!JR;vIrRi^9D>eJ??b4(|6wX<2<JW03OZ8xa;Bku1Z~PaU1X4JCjfH7PpkxSE8TQC;=?8J7!g47*Dp@g>U3&_V zI34dDfJJ>nXLl@5cNbbs{DJz=;OOH`x8*PHcfd0pYAHL5*~)LwA-~X;p`I*9VI|1k zqNyK`C{5)tx#!vz=@m~QDBW&WvKvWSh2&>f=sJ@Cnic=8VEdoPv+EQ+i7}p^k0NU+ zy;)J?TM~h77%zG(<4zCSKNUcw(NfPN-bEcyoD zfSlvq>V5OUf)2$F=|IUr&aWEtv0j5yyytv7rSY;72r}qwAd$ij0$G^rby>QPIibZO zn+xE8?ntxvPUJuB4ubPP0;k*BLuv0lpW|0?k@9RVNQlveV9rf_ry${(U<#s%ubqh$ zg&|udsZ^ogHmcl7H=EOSlG~vNY{@F{K&MN^Nti!;{S8U#KBd+8{%H?&0NcO!N6Ofet-X%hUsj{f2zIlbMI_3$3D;IPgDwI07G9apc-+Tl zA>_S=Q>`!vW@|?oQ!Ki(=V2`cF60-5>EZ_Z+IzDGYVXI$e}1>U9GWxC!Zb$Hm{D2Ckz^%eS% zNn2&LG;UD^r=)W`yw7Ua{9A6_Hw%spQyzYAAx!0RtvkAGL}^0G;j6^ru%(y3oZtj* zah%gzkna$Cy-h`BLY)aSA+F3*uoWMkdKULyicMyzRb@buu~0rgwS04!eQH*Jmw&5v zzL8PQg0(y&;F^ISk?R%yEf1Mf_3eWGn%o6#A6qg z^V%BD*m+5J9c}TOXHnu&I0U*J(GqU#d=I3MOPDjFGoeftO?gmh z_wYN5NuFD0`}wg@qDo=6mPN!vr9bJ6?~5N0*XEt7I~myaUhlx!KL!wr>>xD$Ul{=@g=8}EDf-WvaLai4@8QkDJkOW)J5^Z!)C?!4L*8%= z3~agwgaajGuE&__Pck>Ut%?Z@km2gLTIH7B#BtJDLy8pN$ICah1*zi7%IGEAazB0` z*KDPv!WSS4Z@fhy$Q?#{rBMl;rOr+EmxC^7AgP8oS5JI|jCr!lEV?t*nN?pgs`I6& zOUM$zU9$P@pl?15I7qlt5#1t3l|a;_Pt1dHvJWgu>fp@tT-KMoo{&h$n`E(~Vz1kG zglUTZG529`eY5%+m=4z{XzPxD)?{Cd3CH6<*oyxrbL#$JkP>y*RlG{23fRVRQ zSm1aW2DM=TqFp6pFaFN};LIIbSx!egIk&(B7rkbsTRP==rY?V=&BS-b&M3H(wj)m3 z24$eG`tH;y{Rd;QUvq&G;-ymp3Eqr@mP+mFEx;Y`mC8@G5@Ignh%>6G4r%ep7?Lm~ z@T>C~p`@Ka0Q#%rz@PH7N|tsWeqlEuSCls*hTGz?*UbUtMw?k1fayj3B|nxqS^2dn zvp+iAZ@Q<9LEh2!*nizlA|lmee-ier3t$)+W6oKkX}Q<*m$ zxCS&j4d^i>kaG9%(4AiTou_>q0OF06dv)WC@1pJ)G(B8;%L3psNDtT@OIT zbBy$)`Z7h-8*eWi{zLkje--@A0PIHG` z#G6K$(tg!nPL>p+Uyqf-4*_WXY;W#Yw!qgYdLe5uQBrf0J0`dZD0h7yMF-1BGN2Zr zGwXl|^}%kmxM-Zq@SAyvB$7ok=++-NA@(Z4;gd=N%bg}zvn}MYrjh0xf3|q7SFEAR z%gN3!&fWRM1U>XyMapDrf3YnaGW2dK=*5c<#@g>FBLLj?Cp+v4W)wM!JUZE$aQQAq z)@Jadw3|!xbE-lX#QdDaX90WaO|s@20MR9SO_=K6=?fPChSK#@I$Db1?}4i@bM7@^ z8n?f-k?$JJ>Zvffg_AOgL96sf7MhMn)PJ0e8}|aw;1Q!UI)A%vtNie<_k7VQWsU4X z(A7?jb8Thi^SAQ>-oAkPVU=e3Hc4c{M33*+v2IO20rs-kth|iVO!Wur{>&HDBukUd z^*e8xgRyt7KRQ)sQ1irItbKIh+xq%5{%g(LJ7?+MEXLD0KbP9`rI^)L5`GOcj){W- z$vyN=v-nFRJI>mh(-}P=U~HqGP@!Ds1J1hbzm#z?OL)2>jsS9%0-(kYdRVLt6M&f; zz5=-a2f&pjLKY@n8ZSEjd_9|X;Li|qL(L>?{hq9Ln9zFk=+SJ|Xj(|fc$G=oG)(Q30eT6aHqhQ&#Ul|*6Sc>A#N#w1bY^Ar}82gk=9Z^<2t;X_hgT03Q zY+w<|x*JYJi9b;B0FTh(<5MSHbyZjPou7j;?p^H2=N_Mi1=(&~nr`0SO>IqP6ZN=P zAVAxYwrLi4&py`Zw%C5cKct(74}IMp33T)y^2}kck}xOm(vI#7816OLk$H;ju<`J-2A<~|7sG=7dQEf#4F55p5L8g(4IsNdq@_h_)5t3;mz_Z#ReR><%{tOumi^7q)bwu`7+YT$-2|yV#0d?Dzqgn&_ zur0jr3$w?X=EqcorDc%tf&@x&r4FSQC}}Q?pV)J#{728DKN0~nb1q`QY@lVFDrnem zB`L=hYoLYQvT=cf7P1LRx5hr{{S}O55+A88t9;AKN$fcI5@dU@AoxJDl6-@k?Qblk zZZ*|-wu+5ZEd?@U7dYp;UX=Pi9Rlc^j10dZ(D3(3a@<+23RSe&d!#zaXJmGfr##R{ zU3BC|tdA=i-0Mb9x;PS2fXE%V(f5HnM$o+Mn$#_ggAC=$kysSOJ^lO?Co*kOj3Rrn z4MC<}7DpQaXkAlPwEp%S#DyX3<$w>slpz~p&JZ3R z%mc+iW{P*DSkhNVr4PB}Daa##misNoiLOjLRCsL~c>Q_t*Y)KPd$vSn%CHL4Q8#xk zdesqq*z?$G$||kwX$ox(xGZB-OOm&WOLe|6z?7srcWD_oDg~%qhc$5(9wW!8ce&aT z!dF8j%|p|`%$()rczrAYZS97}7ONNB$G86lmW=g%mMarrLcnWz=tghBCPah-99_yv zD#qLyiMz{yNF2xz;;z#Fp^`(sd`Ds9R$8*d2U!(+{cz-XbHp>Dg-WcW2;6Em;kmfBK=~4*z(O7pbPA#`Yy(8{TzOV z7_PK?j!GmWRH=4>a}YPEKz$G2)by2d>~zJ29nndmgYE0cf&CGZDh4kldqjL07!2%w zdL^ncIL;3)S&qxz0RJr3N~XoO$t8OSP!=HuL?0bUP5L*^{h6n(6Gua_*m1G@*<){zE=&JXl2g-Nb~G_ZYjYnFpoWs=)cEZTkdidkD?bsNk&3GNuKla z^Lux?YWkBXRPYeb6e+{vuoBeO8xx+%lMw`?sDYWq~} zOMMB59-h=o2TpjbbLG~8(#0M3WI}4M4}0sy{?n^%r+yS=z5DmcxrfYr;NfZS8!Rsc z*)^xuE@<+jkctYo#!?prItHZ}qO0_jM2ClgG7)O8pt2ydcaK5-K_4q-;P*U2{CbaB zXBGRsty4K~G#I+BUwGk<#_Axb@E(b2@F--&JuW~D>j)FW&5QN88c1Xj1<+24`# zxrW$|Fd(q~YM4SH+YLtpNoH1Ughz3f#RDDRE=7W@HLdQ~?fdm;aCNr7lUiYxe5+BW z*@`?>jTw+`2Tc{ekPV|J`1$3v(sgZ|LV9UJ0^aW^s{py#S;pe)mzBzuK-yF1TiRNi zD{Wxt4DsS1GINKZg-hS#BjY7p{*yrr6^@1SOUwh z^jOPL1b zP47EJKVN7e=8%? z1;<1mwmH_P;96&`1`6QvnNJ#5*{?1=(2ivE*2&822Ofwm11sZFeuhbzk_H2)PZF=wAj43^Ie{sBfkT<<(qtiTMB|g`M<%J3)YYaxHk~W z*ZJm=Q%K*mNbNQPR)3xTlI$`F)SKG5?8gs5Q9-0!Q#ixx#xuEh0^bPn*4u&wte$Rl z<1SfA!|EyNSg%G}NjZdP zJb+RxJk(?OJ-vv13N`;y+xmRHw+r_@u*+pUL^6`QjJrHRszA5-!XY%3ffuhlZcpFV zP$2eoKCnW}YcGU71w ${EO>a9}kGD1ve8u-*DkF&Hndq-_rP%Ks9eJJ6NLSvw7bO4W znHhw5mfOtVF77+ic%I?liT%1H;=}d$OOnJKvo=SWFx_WZEim!W~Kg!u*6 z;jB+zuh5s>yRk;J>YsOc%xZ|Zt!H~nv{(imsx|G}fPX6#P~y+3fTiuN!B(<59BVBd zyh|}Su+M;Jz*!uxfGQdX5iQ2zzb`+LAh$ygHD zwwxe4XS#Qn?2-OzqQG2$shl6qN{@YZD@dF`_oHdY;aXkXcsdSkfaJ6kwpi??tj?ii zEIO^r#$Wq%)^e=T;jrIhmm^-Rb(J2Ms8om20O@0&8&VzEy4ab5drG!Amz3+qtH(MU zpQ3$O;(N4KUbL>yKw6M*CybKYi7pNR39sJB;K$O4m~;%P$dje)fW`4;#dCj*F^Ez; zZbBD5PXv(?BJdCLI{Lp8%h-)5lqE5g240)N;m!TYQI5(XmA}23aSy&H%y+8>-J3u_ zbgnv1@!AY4X*?pIOl`Lex@q&VaH=imdDyX5f{<3q_Awcdh^L;&GqY5ynk z;$E!GgFQ$X@kO7FZWPk5!w(Dm7ea~Oo<)m=$T}=^e#)wZ&A}R2MxL~igV33yq_dta zBTKRt&4aQF0_PnT>VLD7JZUgz^`5>gi!7 zkxN2K&2|E`_SiOk?XpKFv$q&~Gx|Qi2nMpO&U)XO$BE~BsOPmLFA?5j;vW0}VnP+J zC8c~|#T+oDiO)gpMf8NpKAAusM&w20B8#k)r*yruEkL;Hg%GUU(;&>%{2vL4kWBVn zmg~O~4e!Zy?HxUfVIfpR0kbx_0o4wMI(~&OcNBT)SVfj7FMq!P*)zx(rlEotl`Fe& zgQS_4!7r6?Hzqr~5P>fC*Y=YyK(F3ya@K6Oi7ZG?&@%G>VDAXT+&cr&G0R_pd_0&q zwwlnLPY*MXzO$UsqKfC!Uv_!SktZl9v)dmhX=ee7!mK{V6m<9=n+SY{zH0s%3clo3 zTPSmRr8CwO1#~=40puwqO5p$k^N?1$D3xZzk2(nt?lasA_oj43n!9?26H|!5aAd3Z zuFmp*dIC1MPu8SRFy^WWvn4^U2-d0v%2Sog-}Jl@1_uWi*LTDtUs~JIZ%>aZc)~Mz zT9Z`Gp@-Yljeq-WIZgP+hTP1|zkyGqf^B<|)1oeF%l5DT5%1#SL|Lp!$j#dpFK5Uw zn20yv|6S(Q zgsYB9wyZ6nM0VeOY<~!z*MR`YPKG52Di1QDJ}|Eguw{p~r~im#jFZ7TL|U0`C`6_W z>!m20*hR9OeY|S@_WY_V8Ln}ch;*@wc$BpupnVjwZU%a7vi)t*?9%~ff3vZdEKdJY zNF{>lV2SN5rA+ZhlH~%Pq>HhF(_{7mIgyHl0pw^Hlw5*0;+_#S)*445hMpq#6HTx| z5@J6>kafwD74w%U;w4T;PQ2ypgKau3^$>M}<<3&(LrU-ais}MA!PqL-l&^k~m&aW{ z(5^bI7!qt|bLSg~8d@@Hp;>2CG4ZTKLzfEo@{ug=t>aw7t;4tAU3DZma~7MM%wfVy zOQuRbppbhfih*;Xx$wB`-%z&7WhmrDQo|$b2HD$hfSsvsz$#wxm=gJo(+*6gSwI<~ z5G*U|c?4GNqO(89XfBPAIq+wb88D4j|6 z{>3EST`yHw7yiuX3ZI0oCo%uU;m(YlOCh*9X48jqm3Iu6ips zNB`d5on+16q;9c|J{Z{W{x_m|NdZxBCAG`)`p?wshoL~9XWDZlBOnUxBY0c&U`}km)TWumd*#AV6A|shHzRvvm{2+<7 zDObw(hZNu;6nwjFP&50>&->!~Xz*`Pn{Djz&W!$D`Cw>3@Zl?fMPL%%yW6+g8G_0= z0jGxaqRv^yC;I?z~hl-q$kE#zbyzjRrO{uJw0lMHrZZ<+PN~$;w#aQ%M*bDSG?*C zC>ls2lex6rc*EfZorU9LN?x^qXFuN)^H1{PW^nG4NW>xlr#`&UH+^xJ;OW;Nd@3zX zV;^4rn_(IG z={-M|Ih!uwROi3%Wja@zfZo(G;V)-?e`fw^5hvK#?iQ~&3 z;ZFgApL>u-%hwl20C@Bf6RQ0^Df7CWFhfk>Hq$LA;^1*Im!^BC3O#o00>A;S#=jbV z5{X$b8S^a2#F)^nugt=)v(bw}HUlZtT4F8q(ZG8G{ImoYinCP$?HT1(9kKMg{_R_e zMq?tSo7QF#UH~Zl?g+S3of+*;9L{Q2WY@RH%RV|*Pg$3fMy#)xxJ^*Cet+@e#h($< zEbU%0->!?+A4NJcc0?_J9WM0)WT=%xwxFlDST?qT5+(OacNgsf4?j!v+bRiLM!)pB zcq+mW2Z?2sm6y4!jM>r{NRxecn#vk@DN>cfy3$rXfKh^YH2~dyNFV=%gpB&U+gL7fnnvHF!eUI=P?ZCM=#*`0)8kxhtEfV4W_Gw zfc1&w_O~#{rkhiD07>fmJ>xmQOL_l_n2*IvpBk(SAwKDq^Z>QbUcBXuJOT5=`5?@% znGVGUC;je9ZfBBzJOap)|Cd3%G#}I>yJ(*488^-fgf=uuJU#d*Mg z{^oZ2F+FYRKc@2*NMgd7RB|6d}Qf)Wd@t1!ojvBxH>dt*@ zw}K8ho$4fFV(XbO@rc_-FURlBvA)~LKLln$y;EWWgv~_CY=y+G=!s>8Kbm!g^DI&D z3JB=hb@h`R`j}K{m3=IbM4gu4w>{n>M#2GweLj5vEiVDZ!m=6 zNm-Jn=wD&eD;5dQQorU&Sv(GnxLqLWeY<|=M40^!$PTEPc(+#9qhJhhuY7S*c%pMY z1=NhB_c|z+<)?kj2POBUydCS`?#zZMtIRL7gsl#%uzt96*9YE+@KgiPqjF1B zQyQVm$c3TO-W>##f*n$R9K03TR%E34q&WY?9S%YtE!Eoukv>9D1<1676Tm!yM@vwNx5p6kT9Bk>8L`4(v7Odn1u#FOaRmWKJY-K6Nk8GZg%=s*n)s%f2B2;2GWZXSn z6&3U}cmXVa`&eGPml3fH$!1511VMlu@at2YrAUr=R}pc}WQdMl5!VKzQuzl0ayP75 zZmH+NiyhE|ywL>gbMF@^3TQ2_!42F#-xK-P$^BrQW-ei$TlNL6eJZN|&xYAJbr=esP;FGIz zP*NtzYppHS#O^mXxxdl^OqUh=$*~cERJpQZz$UO81Ol_z>!6{fUY0t?@=H=#l09sC zSH+xpu-`}|$Pz}z$}ZPVsmNk(#30unLreMqA*N%ERnY0R{E|&`Osa~D4*%YBR(rYU zwlq3hr}@^M5dL|Z{6u7>778Z7-UUu}4JQ#XEKfSOB}$|lE4k3@_^sSFOE#)f$U zME*fGCWS0Dgf@I`20|&&GmtJ2bMNIs4+_!AoDSTCBv7u7Uwu(x&$>ebv!+&=9 ztti^a)}y!uj(3&9T@Fjf7U{Moxj3j+0XIH66RGF!5FxNFj@<*kt{0%)CQP8sP}>iU zFA>u+cdwn4)2y`x%-WS?uiU*`(p#8&rM9(t*vqe7@BZ;VP=Ks)5zljH%W8v5TjRFR zZ;`oH3wg>_(I&RZw$*w^tzFB}Y~RQ&Q8Kq0sQq?oZ86!3y=4OX4zO`v2g2<)`bfuv z#Xc3Zk{fh8Rm-x(B4>g#c3g_DXS_C-4d|1bnU8j9iGx!3bB>qmA_WW42Cj-jUyBhX z*tlDal=j_dh%3kUCI+3n;+XVB#ZJPcM#!_ruS?DI1SG~t10p|)Rd#GDt_K+`zl3zo z@*j2}U(#5g*5=;<0BEH=aG74Rhg{5yT`y8?s0Ix52x?ZqanaC@%e{Q2b zC^!r@80H3XJ^|j?Nu;J2iL`j(eIG>{iPIaXB7KpE3Wh$Y1l!~SYlYxT5Tt}@x#kV% zv_w!5KeT~eGeyXV7~RGO#A&D^evBHDg63&E*2Z2z)k511s;Cr&^|hd=%_G_z{>fGi zC|(xGR<%iHb#H}KYfwGLmq+PQ;L_vsvKuiFcO)2b-M-ER*x68&&GX)SXU}|i2?Y=o-uDoO zrk=zdie#*15t&NZXH?E~W*{&~Zs*VXox+$#ro>#6dfJBN`{h9}RVU;UCFc-v%Z_h} zpo;$tPSg&39AhMGH{O^AxC$?dnREp5DwG$Q3UhzZaS}&j+npvX<|Iv+5ZImIX9qrL zmzqxvOxpfC6H`K!is>F48%3lgUJ`0z+&5y@6wX6A{i6e66kdh>^_#s}s&9M60pn|bXO zu@)1^#Fsb}?1%({sA*^ivnc5~i32%6e;tz}SiRJ9B@nq|FlxU)mm~ ztZWoa#V{T_%01uLykstu@%(H->Faus4^&K3o5S)_Cg<;I>^Z?O7QyR1DfE~|fUUHS z(5d7@o`tV5?t73(@{W5=ynxk^3^5f%AM0_np!c|#R#_c}A4Nch5xBJtkKWpsU|5FA6KPqe-=4W%@~RfItAJGOnGY@AtCbowBb59@9F%3M=91dVKu%O{dl zRJ5<7#ly0UNFRQnxB;?XTm;^92>ska>WZ{@j^=|^W4-=zF*s9~LT~?-*b4tU8%C85 z(eM2$vBZ(XH1b|YZXoBl#n5!6-OqGCm6l142iv{Uc~;0shrnc{N!Yx2{Qh|xl*%Hu zq(f!8o6$(uF-D=68Aqj#{$*KJz=)c9hCeDHLQ0X)Qxa7sgqwH|w*E;j!d3PYC1izc zkk)S15EY>r(}~<_+eqf?VRL@4n^t{(d?}uDD~XjM(` z+f+1;EO##blWVp8^I}o4y_K#>!KZoobkS$tHGD%|4(mhYT&&5?w0hjv)?9y1X*tjNo&;`JO0=tQ68Qe@VG$o&ncLv|RQA8|>LhfA zlldB#OFcX9wF;>4o!8RL&Jte*pl)KO1f4EP&tOOB0|_s=W1VMh(9|cke*}WVUJ~8Q zy=67gsRa4c8R?Y_N8)H?2~YJ0tY{U(>g;lir!8vuzZJ9Pmm4_N_<4W(fbsNXn{{{>j4NnS=okkVN*jL^)9fgxZ z%9l)WpBE9rS!5U>h8*+|eD~=}f4=7{*SOuA|AgcsNb`n(I1w>8G3>Yu5OrMXMitxNMi>yT`qg5sJHDLjORj3B<12T;5 zGrNV8z`6YuPDacsH*m)5Le)qG#g>_xzRaGPuYIEJmE;Yc?UBe*y6+4ObB${|=0Qt! zlpP*I7#Wv;42bV57APGgG=V(1(87^s?YV_oq=pN&C@6N>+CJL#o-XT1zky5kQ76z9 z66y#XxgBw)Jq>O#v+ku;@T(J>j3l_fNUUm4dPhdhqc&RH^@H^qg41ChY%w~7_~)WU zZN_GqMPL8OlHwY%D8=PP6Zq((bGrhX6gxhyV%mKhs;Xgg1l&IzvVwhsuVLPy-;s_= zBl=hQB5%IbYE8rBnFgYx-Mi1Vn>4Er))Q_nK_*D;23KE~!sD9NE6@rQf-{>vUiRT~ zjuAZXJM8w(zE~i%dl1OQcSI&Y{T@DQ6Dp1)6!$sLqB0{`qXgH6R$a!l>uY9T@1Pqv zkn3u6$}r<7H|o?@9J8W-l3y(ukG_~s3M_&34`VCB1bPbt&+*!xIb~0=T}+baiobc~YdyI_<8PgS zR~)@Y;?gJ4?KX>B)^Y{C;?R?-0ZP7r!Qc!A~wUInJ$CjC$bo#y=C8a`fqBVo7Oi_1A z`=SW|wuGg)h<)YM<;hr~Wc(ieUr6u^qIJ&A_XQBQvB`ZCTD;R{o&I}ZA8R)yNV>;d z?tnP4Qi!}h7@qhHSh}IG8%0uJHX?J6jSUu=5!xGbQ&o_$B@enD zH2e{NVf9Rsm%)g@zpNKYOY3Ik?naM*W9|kL)m$QUQH;gM+(;IjKgw@q;i|}?$(uD@ zJ5Lb87(vmj!(kKey>?_n9!M%^R;&OjZBYp@?L}%c|08e*kxH|&z&QqL7+iUhte0A= zB9c1AmSql=LntS6kjd+i}7m5|a zUHPd9%uY}r?sF3RW8q`xvC2o?kNDP6fs*^u4z$cb$3-lzz>1Um^0;X`ycfw3zy)t! z7{T6VR0Iqi+N^sV$X*$YeI41dOls^Qj4k_E zzABp&hsd<4J<}6-_A|TRHv{oMS_~DX4}#xkH%R8FkzL zdam&CE%Am`iReW=q-QG$t|-qpha&uzc{b&CPJ6Vc(NlA-U}{Br4>lu@S|x=NAKFPY zcwWTL(K(xF>Zr+nd(XY+*lH5n-pcKzf>FK{&)X9~e<&1Ev9oMvwoPJXd4nM*B~L5PoBaL%9qdhjqxXPOxMLeuL& z-|W}9_j%T(+{Jy}ID#ruJj|^N0y~d^_XA?YM3*yRtn74)#dIW?r{Z+X@rM7T%(KPz z(+%u&W4Y$m#Pk`%Qwmre-g|o^68@XMl3GAtw#oCK)v7EqAehQJwHSvy86TT*=hmYD z7?S@-2mAlj_#TE3fu@fY^)l>#A6rrj(t`5VnZ>YVKaOID1E;2N5m1m8ZeJQNFaSP{ z-fWqg`Q!-FxZYu&m=p`NyuX$=-hMyKBF$yZp{+m*t2k|g2eC}80oqbcXk+{weFxCB z4+FtV69JYg*~=7Jz71~sY2 zZ#fbKY-yTpav(dMQ=7V&eOlEkd|1mQPsVcuq*D zMjM^x8UjcH#G*%Yg47-Fq{JT)h=58P#sR!~C>{8}U8{N)#mV*|_js^>bX93LhZD!*7@U2t zSvaXHN->y=EG556kpfDo)Ff@n&u=L>7bR9Q9Qm=0AJfQ+X(STJ)QA-AvL_{C$OuE& z+EL3+pKaE1m#topR9!my5;9-VYK7xarrYCVTJGnYH#1IjJSxT%OiehvyO;BK@iY8O zl}lmll}k-oPDfj-y+7N$Lu;8%P&~W%{km>L;zY|!MPre&+7!o?rZ-QD+sqt5M0)iH zqXDicblXsLq3_hAdh%S5Ft+O@9BY(<{YGs^^z3u~L{5BPPSfqF4KOpP2!2kMn}D=K zz>y@|fs9|~;#u$l+dd=FoStM+bPrY+*pb5hk1YD=jSCwOnrnx^9#C!>=f{AQR%WLnj`7hjplf%X??hdboQrzyi-hT7 zRur_1^uA}#>bUoq)}`mb({E-|-biMMze|4C8Q6_uhZEV2@Z*;34D4}#cx0m9)J%FO z@U+Qh%kh%-T%NYPY?j4oXGj zCe`Mo$L@Zqa>ebk#eFbyE|7b;}wlW9`&(SrF?nURfJi^+-PgHi3OJ*!z!k-pE1xm^sg+p9c7>LPU;4Q(SUBb4gkjHSA%_^zr7}=!@^@v|=GY z0Rcf=gH(ppAg|GgAG7BRX0Neeqbe7ZcXFX1-SGx@Ss z1eBblyv%xiB(w&;=23tm-F^c>tbR zNf4mx%_Z(;ofTPMj$>SC37Hi2kCqK||G03z+ySh9*1J|rBlWB3cl6bp+}8-jP>Ec1 zTjBBR7mxH-t@}tGIR{}y}e8XUsPUP=m%A11=J9VyS4RFj)rw=xxt9qttjojV^_v6>O5{z-83H`66 z`r%E+#+BYKJ7p%x9nPoO=(&8S6`^_Uq=8qA1HG!7-d;BVn9}Zt!yHPZxANnyW zahgn$QEt-7CaXfvE3fB(@^h}BhAYP>-1MWJGU~1t@H|=g*y$+&~_Ol{(Gq37FMe9=LyE#uzttKWo&;S|Y z)IF_aGNw{%a`xF!TEo$i=s=$6;b(P|7%Ahi(o!GH zp7>v~LT~NUV@>WGRJAJWspz~Y#&fAJgb0NicA;%922)>tm_sP*xvt9zZB;$bS}wRz zefr_$V|cm1Jwb59Z^C&XYUlc&{!K^pk69YHU@TNw;uIb3_6>*G7*fkdDt-*T+_~E( zjyMn!V#mKWahP@#59T`AIBP#W98_(xcaaoQ_bd}$klk~Ol7&CsoqgvthjT6J`iM_{ z8w_6>(}6cwN#IjjQyhjn&HQ}Rry5Aik4^vLngaYWLx2Z3U-gz(AV#n{y)@{!t&^_v z6Y<_x_P8b|(#4c3X8Mn~%!5l{@9?#MMS30QM6^4$>VCa4anQ_EIAC{|d@eO8kSVjK z zmAT8mp{5MJt+QMaX*3fP)~XK7m$ASgxx+E08eCm7>XKK3_<6@(nKdWiB)0~ENGd#; zx8TtTGV?aius-;bt!0tR{2p(xu?zYoLOrm*}OxlG$!t$jr=) zckt{Sc+yek@ywxrCGQTYH^95+)oN!h#a;NI?s>?ME7FdQ;#pE`uzsaVES?BY+O;*n zb@xrjh=2@%)#)6je#}e9t;FZma_7yi{@tV@S?DnFvrCoaR&jrE_6Yv5&)MErQbumC zA(OauvZej;Gw{w|_8a(L0hv;9{^HOrM-VWa!5&TKHcnS=Ko1Q4^8I&n2|_eVS8@FC zT^|mHj%PfEuB@C|Iw-NlvGH?7CwY?n3OBNCE?wOBR!sRR?@N~CQI-1b@PYbycrYaR z@Z*x(=rZwqhMkyZwrMW4@P1A>&8umR=5&@g_gJxu5DtgykcG(#F|`q4uwGJ5$Ay{h z4|o>-!EAGh40(S3>_iVOL8e|Ajcw#kO`M!xD7J1bG+00xxY&dP@xly=Cg@Pxmura) zW;b#Nk!B(A$SBN3jeR1-US-%aTv!;?o6|Ah2`Sqb>PK4pGqrz@xPU)Wm4N3j^;b~zU1y$_UgXiVJ!o^U z=Zo5)$(QqKE!^K?93NH<|AQIUnqw-IzENx^v8v{z3SCoovsrYiL`)3mz~z=~tfEH3 zGSR6oiV_2g|AdO`!28*@r4W9md9voMf8?PnL$n$5%;T2zY3}TCQ)QT;^)d^N%h}Z7 zk;{EmNjqU*n0n=2Pwx-rLGYfvtZ`zvL8Y4cplM#xo~0)9B*ykat)#y>BuvaYHF z$P``1rDTWrz!or%f_KiJh)!qQV`cIRsD;?TiukpA7aM{@5N%y%OzToP?#qW`M(oBd zZ`aNQ{w5zQL>%m%$ByU}Qen zlDJP!_fJ&BLH8mDjMP+tH{Xx8YujLCU>)>f zm}ptd1dV|d+R#bGDVM9R&(IK?ei*2dv(^()@GCYCx}niuiR#ir}Yn- zrTKk#@~G=E7aMT9Wy44LCKo!i5WOS4v6oo(AvvkV1!7s**g-G!4=wB}{3(9Hj2+&T za@_k-Q$%+GM=S5PJ9cKd5`6<5#vR(`_S}i$ghg2WK{cM&cEl%ChwO9G6coP`BLmhO zId5yknu|64J}YL?1~Zm`BP8f<&$m&1jwBCRB0Xb1h8tj-NBGeO|#p)l3Z7%4NgjO#Ujz|%1Kzp!h(%=PdrNP zdflFWd2n!edgC7YMxqCP7;(IMl{xSgzz3*)tNbeJWV1NNdlo1di1RqE24iSh)xY^( zoGXUT7N$IcvMM~>8mXjmQrlposH7(um%I}eeW7pZ|9yNpD#~+dkoGXD^|M&a0a%6^ zQh@b98g(G@-jL*I0`{Ns1ro*LVu0eY)=0)c9n9@QQGiNyhYYs8NxpSMe2fNQHfGFz zj?|xu)K0~e!lvFYI{}01m&X=hPX^$ELd>%}qfLiQR89q_MyF>nJmMXobG*57VPCXmrY+0&nYrssC=f)=HWQX z%o+LEr06>^7ik@H=J_iE`-4~-?(0Y|KPm+3yA+c~!Raccmw9wI-U*bIwS6Q)_8R&Kce!R#g%S2mO>|aF(Dzi@lQr=VC;>U6V`4ke!_;@4jIR1%% zw=hWTdp)d|M+HC@_RKHUU1;I~xQ>~(kF88->t_@j*ccnw7_{FuTvkB+9)@@R3p5nd zF0k^Y#rg@ecuRrAOyO`u@@h5xXjr0=zLML=5}*#|YaJM-#w0pED50&NoO}=b32;uI z$FoF5+w}QP*@-|D!8i&~{>m-ju2LQV$NB{gRg+%+_Zju(E8=qn&qq<-4uEZxRku;; z2_;#IM(K*fE;On3 zN2%8q60pmHVgr1lR7Zwr>)VNpbY<57WDbm5HMGW<46U0UEemeJd;bl5F!YoXY1`Q>wd;#Rabjflb_nw zHVAYh9%$n%AJEpnoUrlr1vA82cwp|7it9W%$IQ3(=-XYsYwIoqV0uONydMBkN(7*p zQV9}b|H4c;aSn`OQ0{eW4u$Hv*A*4tQcH?7kumFRSrE8(*;9d2TxcsQv~sBZTtU*t zxA<4;sn~`%#(hE1l|2{IK0#C`fjNX-QTCR89<5QHVH^kyB>gGCCAXz#%tc%R@%DE-> zORhLzp2DY_gWf22_Fp-gu(0kxi(7efHnY+L(A9U&?H!o{*yxpC?rtFOgnGjX5nql* zP(j>AM?9>*-fKe1m#>kzfNM%i8$D1%7@Ehha4P7KP5L;5STP#BKWZ|v%aWd4V_`!wkk*ehvgaE|@IzdZ*b`>5xx{1RqsdzB^#V1#K5bA GATT server (referred to as server in this topic) is a device that stores attribute data locally and provides data access to a remote GATT client paired via BLE. A GATT client (referred to as client in this topic) is a device that accesses data on the remote GATT server via read, write, notify, or indicate operations. diff --git a/en/application-dev/connectivity/bluetooth/spp-development-guide.md b/en/application-dev/connectivity/bluetooth/spp-development-guide.md index f351d3105d2..4affc07b238 100644 --- a/en/application-dev/connectivity/bluetooth/spp-development-guide.md +++ b/en/application-dev/connectivity/bluetooth/spp-development-guide.md @@ -1,6 +1,7 @@ -# SPP-based Data Transmission Development +# SPP-based Data Transmission ## Introduction + Serial Port Profile (SPP) is a Bluetooth protocol used to establish serial communication connections between Bluetooth devices. With SPP, Bluetooth devices can transmit data, such as files and text, just like using a serial port. ## When to Use diff --git a/en/application-dev/connectivity/wlan/Readme-EN.md b/en/application-dev/connectivity/wlan/Readme-EN.md index 2055733a92f..0f016668fe7 100644 --- a/en/application-dev/connectivity/wlan/Readme-EN.md +++ b/en/application-dev/connectivity/wlan/Readme-EN.md @@ -1,4 +1,6 @@ # WLAN - - [WLAN Service Development Overview](wlan-overview.md) - - [P2P Mode Development](p2p-development-guide.md) +- [WLAN Service Development Overview](wlan-overview.md) +- [P2P Development Guide](p2p-development-guide.md) +- [STA Development](sta-development-guide.md) +- [Wi-Fi Scanning Development](scan-development-guide.md) diff --git a/en/application-dev/connectivity/wlan/p2p-development-guide.md b/en/application-dev/connectivity/wlan/p2p-development-guide.md index f12cb064a72..1e17723d276 100644 --- a/en/application-dev/connectivity/wlan/p2p-development-guide.md +++ b/en/application-dev/connectivity/wlan/p2p-development-guide.md @@ -11,7 +11,7 @@ You can use the APIs provided by the **wifiManager** module to: ## Available APIs -For details about the JavaScript APIs and sample code, see [WLAN](../../reference/apis-connectivity-kit/js-apis-wifiManager.md). +For details about the JavaScript APIs and sample code, see the [P2P API Reference](../../reference/apis-connectivity-kit/js-apis-wifiManager.md). The following table describes the APIs used in this topic. @@ -37,15 +37,14 @@ The following table describes the APIs used in this topic. 2. Enable Wi-Fi on the device. 3. Check that the device has the SystemCapability.Communication.WiFi.P2P capability. 4. Create or remove a P2P group. - -Example: +5. Example: ```ts import { wifiManager } from '@kit.ConnectivityKit'; // Create a P2P group. To use the current device as the group owner (GO), set: -// netId: The value -1 means to create a temporary P2P group. When a device in the group is to be connected next time, GO negotiation and WPS session negotiation must be performed again. -// The value -2 means to create a persistent group. The device in the group can be reconnected without GO negotiation or WPS session negotiation. +// netId: The value -1 means to create a temporary P2P group. When a device in the group is to be connected next time, GO negotiation and WPS key negotiation must be performed again. +// The value -2 means to create a persistent group. The device in the group can be reconnected without GO negotiation or WPS key negotiation. let recvP2pPersistentGroupChangeFunc = () => { console.info("p2p persistent group change receive event"); @@ -76,7 +75,7 @@ try { } ``` -For details about error codes, see [Wi-Fi Error Codes](../../reference/apis-connectivity-kit/errorcode-wifi.md). +6. For details about error codes, see [Wi-Fi Error Codes](../../reference/apis-connectivity-kit/errorcode-wifi.md). ### Creating a P2P Connection 1. Import the **wifiManager** module. @@ -84,8 +83,7 @@ For details about error codes, see [Wi-Fi Error Codes](../../reference/apis-conn 3. Check that the device has the SystemCapability.Communication.WiFi.P2P capability. 4. Register a callback for **p2pPeerDeviceChange** and set up a P2P connection in the callback implementation. 5. Start P2P device discovery. - -Example: +6. Example: ```ts import { wifiManager } from '@kit.ConnectivityKit'; @@ -94,7 +92,7 @@ let recvP2pConnectionChangeFunc = (result:wifiManager.WifiP2pLinkedInfo) => { console.info("p2p connection change receive event: " + JSON.stringify(result)); wifiManager.getP2pLinkedInfo((err, data) => { if (err) { - console.error('failed to get getP2pLinkedInfo: ' + JSON.stringify(err)); + console.error("failed to get P2pLinkedInfo: " + JSON.stringify(err)); return; } console.info("get getP2pLinkedInfo: " + JSON.stringify(data)); @@ -108,7 +106,7 @@ let recvP2pPeerDeviceChangeFunc = (result:wifiManager.WifiP2pDevice[]) => { console.info("p2p peer device change receive event: " + JSON.stringify(result)); wifiManager.getP2pPeerDevices((err, data) => { if (err) { - console.error('failed to get peer devices: ' + JSON.stringify(err)); + console.error("failed to get peer devices: " + JSON.stringify(err)); return; } console.info("get peer devices: " + JSON.stringify(data)); @@ -140,4 +138,4 @@ setTimeout(() => {wifiManager.off("p2pPeerDeviceChange", recvP2pPeerDeviceChang console.info("start discover devices -> " + wifiManager.startDiscoverDevices()); ``` -For details about error codes, see [Wi-Fi Error Codes](../../reference/apis-connectivity-kit/errorcode-wifi.md). \ No newline at end of file +7. For details about error codes, see [Wi-Fi Error Codes](../../reference/apis-connectivity-kit/errorcode-wifi.md). diff --git a/en/application-dev/connectivity/wlan/scan-development-guide.md b/en/application-dev/connectivity/wlan/scan-development-guide.md new file mode 100644 index 00000000000..cad616cb770 --- /dev/null +++ b/en/application-dev/connectivity/wlan/scan-development-guide.md @@ -0,0 +1,106 @@ +# Wi-Fi Scan Development + +## Introduction +Wi-Fi scan is the process where devices (such as smartphones, PCs, and routers) search for available Wi-Fi networks in their surrounding environment. Through this scan process, devices can gather fundamental information about nearby networks—such as network name, signal strength, and encryption type—thereby enabling connection to, management of, or analysis of these networks. + +## Use Cases + +- [Wi-Fi Scan](#wi-fi-scan) +- [PNO Scan](#pno-scan) +- [Periodic Scan](#periodic-scan) +- [Scan Control](#scan-control) + +## Available APIs + +For details about the JavaScript APIs and sample code, see the [SCAN API Reference](../../reference/apis-connectivity-kit/js-apis-wifiManager.md). + +The following table describes the related APIs. + +| API| Description| +| -------- | -------- | +| getScanInfoList() | Obtains the scan result.| +| on(type: 'wifiScanStateChange') | Subscribes to Wi-Fi scan state changes.| +| off(type: 'wifiScanStateChange') | Unsubscribes from Wi-Fi scan state changes.| + + +## How to Develop + +### Wi-Fi Scan +1. Import the required Wi-Fi module. +2. Check that the **SystemCapability.Communication.WiFi.STA** capability is available. +3. Apply for the **ohos.permission.GET_WIFI_INFO** permission. +4. Enable Wi-Fi on the device. + +Sample code: + +> **NOTE** +> +> The Wi-Fi scan API is deprecated since API version 10. The substitute API is available only for system applications. + +```ts + import { wifiManager } from '@kit.ConnectivityKit'; + + try { + let recvWifiScanStateChangeFunc = (result:number) => { + console.info("Receive Wifi scan state change event: " + result); + } + + // Obtain the scan status. The value 1 indicates that the scan is successful, and the value 0 indicates the opposite. + wifiManager.on("wifiScanStateChange", recvWifiScanStateChangeFunc); + + let isWifiActive = wifiManager.isWifiActive(); + if (!isWifiActive) { + console.error("wifi not enable"); // Enable Wi-Fi manually. + return; + } + + let scanInfoList = wifiManager.getScanInfoList(); + + let len = scanInfoList.length; + console.info("wifi received scan info: " + len); + if(len > 0){ + for (let i = 0; i < len; ++i) { + console.info("ssid: " + scanInfoList[i].ssid); + console.info("bssid: " + scanInfoList[i].bssid); + console.info("capabilities: " + scanInfoList[i].capabilities); + console.info("securityType: " + scanInfoList[i].securityType); + console.info("rssi: " + scanInfoList[i].rssi); + console.info("band: " + scanInfoList[i].band); + console.info("frequency: " + scanInfoList[i].frequency); + console.info("channelWidth: " + scanInfoList[i].channelWidth); + console.info("timestamp: " + scanInfoList[i].timestamp); + console.info("supportedWifiCategory: " + scanInfoList[i].supportedWifiCategory); + console.info("isHiLinkNetwork: " + scanInfoList[i].isHiLinkNetwork); + } + } + + // Unsubscribe from Wi-Fi scan state changes. + wifiManager.off("wifiScanStateChange", recvWifiScanStateChangeFunc); + } +``` + +For details about error codes, see [Wi-Fi Error Codes](../../reference/apis-connectivity-kit/errorcode-wifi.md). + +### PNO Scan + +Preferred Network Offload (PNO) scan is a Wi-Fi scan technology that reduces power consumption of mobile devices.
+PNO scan is triggered when a device is not connected to any Wi-Fi network and the screen is off. The device then searches for and connects to the preferred Wi-Fi network in the background. + +### Periodic Scan + +Periodic scan is the process where a wireless device (such as a smartphone, tablet, or laptop) automatically searches for available Wi-Fi networks at the specified interval.
+This function can be used in the following scenarios:
+1. When the screen is on and the device is connected to Wi-Fi, the device checks whether the current link supports Internet access. If Internet access is supported, perform scan at an interval of 1 hour. If Internet access is not supported, check the device's mobility status:
- Stationary scenario: Scan cycle starts at 20 seconds and doubles exponentially, with a maximum of 300 seconds.
- Non-stationary scenario: Scan cycle starts at 20 seconds and caps at 160 seconds.
+2. When the screen is on and the device is not connected to Wi-Fi:
- Stationary scenario: Scan cycle starts at 20 seconds and doubles exponentially, with a maximum of 300 seconds.
- Non-stationary scenario: Scan cycle starts at 20 seconds and caps at 160 seconds. + +### Scan Control + +Scan control allows management and control of Wi-Fi network scan by wireless devices.
+ +Typical scenarios include:
+1. Prohibiting periodic scan and PNO scan when Wi-Fi is disabled
+2. Prohibiting scan during Wi-Fi connection
+3. Initiating no more than four scans within 2 minutes
+4. Prohibiting scan when the device temperature reaches the specified threshold
+5. Using the substitute of the scan API only for system applications (The scan API is supported since API version 9 and deprecated since API version 10.)
+6. Requesting the **ohos.permission.GET_WIFI_PEERS_MAC** permission to obtain the actual BSSID in the scan result diff --git a/en/application-dev/connectivity/wlan/sta-development-guide.md b/en/application-dev/connectivity/wlan/sta-development-guide.md new file mode 100644 index 00000000000..b37f88242b9 --- /dev/null +++ b/en/application-dev/connectivity/wlan/sta-development-guide.md @@ -0,0 +1,127 @@ +# STA Development + +## Introduction + +The Wi-Fi STA mode (that is, station mode) enables wireless devices to connect to a wireless local area network (WLAN) as clients. In this mode, devices such as mobile phones, computers, and tablets can access the network by connecting to an access point (AP) or wireless router. + + +## Use Cases + +- [Checking the Wi-Fi Status](#checking-the-wi-fi-status) +- [Establishing a Wi-Fi Connection](#establishing-a-wi-fi-connection) + +## Available APIs + +For details about the JavaScript APIs and sample code, see the [STA API Reference](../../reference/apis-connectivity-kit/js-apis-wifiManager.md). + +The following table describes the related APIs. + +| API| Description| +| -------- | -------- | +| isWifiActive() | Checks whether WLAN is enabled.| +| addCandidateConfig() | Adds candidate network configurations. Enable WLAN before using this API.| +| connectToCandidateConfig() | Connects to a candidate network.| +| isConnected() | Checks whether WLAN is connected.| +| removeCandidateConfig() | Removes candidate network configurations.| +| getCandidateConfigs() | Obtains candidate network configurations.| +| on(type: 'wifiStateChange') | Subscribes to WLAN state changes.| +| off(type: 'wifiStateChange') | Unsubscribes from WLAN state changes.| +| on(type: 'wifiConnectionChange') | Subscribes to WLAN connection state changes.| +| off(type: 'wifiConnectionChange') | Unsubscribes from WLAN connection state changes.| + + +## How to Develop + +### Checking the Wi-Fi Status +1. Import the required Wi-Fi module. +2. Check that the **SystemCapability.Communication.WiFi.STA** capability is available. +3. Apply for the **ohos.permission.GET_WIFI_INFO** permission. +4. Enable Wi-Fi on the device. + +Sample code: + +```ts + import { wifiManager } from '@kit.ConnectivityKit'; + try { + let recvPowerNotifyFunc = (result:number) => { + let wifiState = ""; + switch (result) { + case 0: + wifiState += 'DISABLEING'; + break; + case 1: + wifiState += 'DISABLED'; + break; + case 2: + wifiState += 'ENABLING'; + break; + case 3: + wifiState += 'ENABLED'; + break; + default: + wifiState += 'UNKNOWN STATUS'; + break; + } + } + // Subscribe to Wi-Fi state changes. + wifiManager.on("wifiStateChange", recvPowerNotifyFunc); + // Check whether Wi-Fi is enabled. + let isWifiActive = wifiManager.isWifiActive(); + if (!isWifiActive) { + console.info("wifi not enable"); // Enable Wi-Fi manually. + return; + } + + wifiManager.off("wifiStateChange", recvPowerNotifyFunc); +} +``` + +### Establishing a Wi-Fi Connection + +1. Import the required Wi-Fi module. +2. Enable Wi-Fi on the device. +3. Check that the **SystemCapability.Communication.WiFi.STA** capability is available. +4. Apply for the **ohos.permission.GET_WIFI_INFO** and **ohos.permission.SET_WIFI_INFO** permissions. + +Sample code: + +```ts + import { wifiManager } from '@kit.ConnectivityKit'; + + try { + let recvWifiConnectionChangeFunc = (result:number) => { + console.info("Receive wifi connection change event: " + result); + } + + let config:wifiManager.WifiDeviceConfig = { + ssid : "****", + bssid : "****", + preSharedKey : "****", + securityType : 0 + } + + // Update the current Wi-Fi connection status. + wifiManager.on("wifiConnectionChange", recvWifiConnectionChangeFunc); + // Add candidate network configurations. + wifiManager.addCandidateConfig(config).then(result => { + // Connect to the specified network. + wifiManager.connectToCandidateConfig(result); + }); + + if (!wifiManager.isConnected()) { + console.info("wifi not conneted"); + } + // Obtain link information. + wifiManager.getLinkedInfo().then(data => { + console.info("get wifi linked info: " + JSON.stringify(data)); + }) + // Query the signal strength. + let level = wifiManager.getSignalLevel(rssi,band); + console.info("level:" + JSON.stringify(level)); + + // Unsubscribe from Wi-Fi connection state changes. + wifiManager.off("wifiConnectionChange", recvWifiConnectionChangeFunc); + } +``` +6. Check the Wi-Fi connection status. For details, see [ConnState](../../reference/apis-connectivity-kit/js-apis-wifiManager.md#connstate9). + For details about error codes, see [Wi-Fi Error Codes](../../reference/apis-connectivity-kit/errorcode-wifi.md). diff --git a/en/application-dev/reference/apis-arkts/js-apis-hashmap.md b/en/application-dev/reference/apis-arkts/js-apis-hashmap.md index 59735654fc6..c89e81000ee 100644 --- a/en/application-dev/reference/apis-arkts/js-apis-hashmap.md +++ b/en/application-dev/reference/apis-arkts/js-apis-hashmap.md @@ -31,7 +31,7 @@ import { HashMap } from '@kit.ArkTS'; **System capability**: SystemCapability.Utils.Lang -| Name| Type| Readable| Writable| Description| +| Name| Type| Read-Only| Optional| Description| | -------- | -------- | -------- | -------- | -------- | | length | number | Yes| No| Number of elements in a HashMap.| diff --git a/en/application-dev/reference/apis-arkts/js-apis-hashset.md b/en/application-dev/reference/apis-arkts/js-apis-hashset.md index b63bee3f35f..43b9e0cecc1 100644 --- a/en/application-dev/reference/apis-arkts/js-apis-hashset.md +++ b/en/application-dev/reference/apis-arkts/js-apis-hashset.md @@ -28,7 +28,7 @@ import { HashSet } from '@kit.ArkTS'; **System capability**: SystemCapability.Utils.Lang -| Name| Type| Readable| Writable| Description| +| Name| Type| Read-Only| Optional| Description| | -------- | -------- | -------- | -------- | -------- | | length | number | Yes| No| Number of elements in a HashSet.| diff --git a/en/application-dev/reference/apis-arkts/js-apis-lightweightmap.md b/en/application-dev/reference/apis-arkts/js-apis-lightweightmap.md index 9cb76b0082e..845e83b93db 100644 --- a/en/application-dev/reference/apis-arkts/js-apis-lightweightmap.md +++ b/en/application-dev/reference/apis-arkts/js-apis-lightweightmap.md @@ -33,7 +33,7 @@ import { LightWeightMap } from '@kit.ArkTS'; **System capability**: SystemCapability.Utils.Lang -| Name| Type| Readable| Writable| Description| +| Name| Type| Read-Only| Optional| Description| | -------- | -------- | -------- | -------- | -------- | | length | number | Yes| No| Number of elements in a LightWeightMap.| diff --git a/en/application-dev/reference/apis-arkts/js-apis-lightweightset.md b/en/application-dev/reference/apis-arkts/js-apis-lightweightset.md index d5e95c07c88..8fdd9aa77d6 100644 --- a/en/application-dev/reference/apis-arkts/js-apis-lightweightset.md +++ b/en/application-dev/reference/apis-arkts/js-apis-lightweightset.md @@ -32,7 +32,7 @@ import { LightWeightSet } from '@kit.ArkTS'; **System capability**: SystemCapability.Utils.Lang -| Name| Type| Readable| Writable| Description| +| Name| Type| Read-Only| Optional| Description| | -------- | -------- | -------- | -------- | -------- | | length | number | Yes| No| Number of elements in a LightWeightSet.| diff --git a/en/application-dev/reference/apis-arkts/js-apis-linkedlist.md b/en/application-dev/reference/apis-arkts/js-apis-linkedlist.md index 0e01b617bc7..7725d32623f 100644 --- a/en/application-dev/reference/apis-arkts/js-apis-linkedlist.md +++ b/en/application-dev/reference/apis-arkts/js-apis-linkedlist.md @@ -34,7 +34,7 @@ import { LinkedList } from '@kit.ArkTS'; **System capability**: SystemCapability.Utils.Lang -| Name| Type| Readable| Writable| Description| +| Name| Type| Read-Only| Optional| Description| | -------- | -------- | -------- | -------- | -------- | | length | number | Yes| No| Number of elements in a LinkedList.| diff --git a/en/application-dev/reference/apis-arkts/js-apis-list.md b/en/application-dev/reference/apis-arkts/js-apis-list.md index d950dcfceb1..46ab4c9ba27 100644 --- a/en/application-dev/reference/apis-arkts/js-apis-list.md +++ b/en/application-dev/reference/apis-arkts/js-apis-list.md @@ -33,7 +33,7 @@ import { List } from '@kit.ArkTS'; **System capability**: SystemCapability.Utils.Lang -| Name| Type| Readable| Writable| Description| +| Name| Type| Read-Only| Optional| Description| | -------- | -------- | -------- | -------- | -------- | | length | number | Yes| No| Number of elements in a List.| diff --git a/en/application-dev/reference/apis-arkts/js-apis-plainarray.md b/en/application-dev/reference/apis-arkts/js-apis-plainarray.md index 209b9d4acad..ae7e15f4661 100644 --- a/en/application-dev/reference/apis-arkts/js-apis-plainarray.md +++ b/en/application-dev/reference/apis-arkts/js-apis-plainarray.md @@ -31,7 +31,7 @@ import { PlainArray } from '@kit.ArkTS'; **System capability**: SystemCapability.Utils.Lang -| Name| Type| Readable| Writable| Description| +| Name| Type| Read-Only| Optional| Description| | -------- | -------- | -------- | -------- | -------- | | length | number | Yes| No| Number of elements in a PlainArray.| diff --git a/en/application-dev/reference/apis-arkts/js-apis-queue.md b/en/application-dev/reference/apis-arkts/js-apis-queue.md index 8662d66d9d9..63326355e69 100644 --- a/en/application-dev/reference/apis-arkts/js-apis-queue.md +++ b/en/application-dev/reference/apis-arkts/js-apis-queue.md @@ -29,7 +29,7 @@ import { Queue } from '@kit.ArkTS'; **System capability**: SystemCapability.Utils.Lang -| Name| Type| Readable| Writable| Description| +| Name| Type| Read-Only| Optional| Description| | -------- | -------- | -------- | -------- | -------- | | length | number | Yes| No| Number of elements in a Queue.| diff --git a/en/application-dev/reference/apis-arkts/js-apis-stack.md b/en/application-dev/reference/apis-arkts/js-apis-stack.md index 56a7e7f88fb..77018b2e93e 100644 --- a/en/application-dev/reference/apis-arkts/js-apis-stack.md +++ b/en/application-dev/reference/apis-arkts/js-apis-stack.md @@ -28,7 +28,7 @@ import { Stack } from '@kit.ArkTS'; **System capability**: SystemCapability.Utils.Lang -| Name| Type| Readable| Writable| Description| +| Name| Type| Read-Only| Optional| Description| | -------- | -------- | -------- | -------- | -------- | | length | number | Yes| No| Number of elements in a Stack.| diff --git a/en/application-dev/reference/apis-arkts/js-apis-treemap.md b/en/application-dev/reference/apis-arkts/js-apis-treemap.md index 63501f5acf7..9b79b6eec6b 100644 --- a/en/application-dev/reference/apis-arkts/js-apis-treemap.md +++ b/en/application-dev/reference/apis-arkts/js-apis-treemap.md @@ -33,7 +33,7 @@ import { TreeMap } from '@kit.ArkTS'; **System capability**: SystemCapability.Utils.Lang -| Name| Type| Readable| Writable| Description| +| Name| Type| Read-Only| Optional| Description| | -------- | -------- | -------- | -------- | -------- | | length | number | Yes| No| Number of elements in a TreeMap.| @@ -52,7 +52,7 @@ A constructor used to create a **TreeMap** instance. It supports sorting element | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| comparator | function | No| Custom comparator, which can be used to sort elements based on the comparison relationship. The default value is **hole** (a blank placeholder), indicating that no comparator is provided.| +| comparator | function | No| Custom comparator, which can be used to sort elements based on the comparison relationship. The default value is null, indicating that no comparator is provided.| comparator parameters diff --git a/en/application-dev/reference/apis-arkts/js-apis-treeset.md b/en/application-dev/reference/apis-arkts/js-apis-treeset.md index 7f55ffddcfd..ec9c3818458 100644 --- a/en/application-dev/reference/apis-arkts/js-apis-treeset.md +++ b/en/application-dev/reference/apis-arkts/js-apis-treeset.md @@ -29,7 +29,7 @@ import { TreeSet } from '@kit.ArkTS'; **System capability**: SystemCapability.Utils.Lang -| Name| Type| Readable| Writable| Description| +| Name| Type| Read-Only| Optional| Description| | -------- | -------- | -------- | -------- | -------- | | length | number | Yes| No| Number of elements in a TreeSet.| @@ -48,7 +48,7 @@ A constructor used to create a **TreeSet** instance. It supports sorting element | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| comparator | function | No| Custom comparator, which can be used to sort elements based on the comparison relationship. The default value is **hole** (a blank placeholder), indicating that no comparator is provided.| +| comparator | function | No| Custom comparator, which can be used to sort elements based on the comparison relationship. The default value is null, indicating that no comparator is provided.| comparator parameters diff --git a/en/application-dev/reference/apis-arkts/js-apis-url.md b/en/application-dev/reference/apis-arkts/js-apis-url.md index 231d3f8ca6b..7352bfbadfe 100644 --- a/en/application-dev/reference/apis-arkts/js-apis-url.md +++ b/en/application-dev/reference/apis-arkts/js-apis-url.md @@ -13,7 +13,7 @@ import { url } from '@kit.ArkTS'; ``` ## URLParams9+ -Defines APIs for handling URL query strings. +URLParams is a utility class for parsing, constructing, and manipulating URL parameters. This class provides a unified interface for handling parameters across different dimensions, such as query parameters and path parameters. ### constructor9+ @@ -168,7 +168,7 @@ console.log(params.getAll('fod').toString()) // Output ["1","3"]. entries(): IterableIterator<[string, string]> -Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and the first and second fields of each array are the key and value respectively. +Obtains an ES6 iterator. Each item of the iterator is an array, and the first and second fields of each array are the key and value respectively. **Atomic service API**: This API can be used in atomic services since API version 11. @@ -323,7 +323,9 @@ let result = paramsObject.has('bard'); set(name: string, value: string): void -Sets the value for a key. If key-value pairs matching the specified key exist, the value of the first key-value pair will be set to the specified value and other key-value pairs will be deleted. Otherwise, the key-value pair will be appended to the query string. +Sets the value for a key. + +If key-value pairs matching the specified key exist, the value of the first key-value pair will be set to the specified value and other key-value pairs will be deleted. Otherwise, the key-value pair will be appended to the query string. **Atomic service API**: This API can be used in atomic services since API version 11. @@ -430,7 +432,7 @@ for (let value of values) { [Symbol.iterator]\(): IterableIterator<[string, string]> -Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and the first and second fields of each array are the key and value respectively. +Obtains an ES6 iterator. Each item of the iterator is an array, and the first and second fields of each array are the key and value respectively. **Atomic service API**: This API can be used in atomic services since API version 11. @@ -487,21 +489,21 @@ Provides APIs for parsing, constructing, standardizing, and encoding URL strings **System capability**: SystemCapability.Utils.Lang -| Name| Type| Readable| Writable| Description| +| Name| Type| Read-Only| Optional| Description| | -------- | -------- | -------- | -------- | -------- | -| hash | string | Yes| Yes| String that contains a harsh mark (#) followed by the fragment identifier of a URL. **Atomic service API**: This API can be used in atomic services since API version 11.| -| host | string | Yes| Yes| Host information in a URL. **Atomic service API**: This API can be used in atomic services since API version 11.| -| hostname | string | Yes| Yes| Hostname (without the port) in a URL. **Atomic service API**: This API can be used in atomic services since API version 11.| -| href | string | Yes| Yes| String that contains the whole URL. **Atomic service API**: This API can be used in atomic services since API version 11.| +| hash | string | No| No| String that contains a harsh mark (#) followed by the fragment identifier of a URL. **Atomic service API**: This API can be used in atomic services since API version 11.| +| host | string | No| No| Host information in a URL. **Atomic service API**: This API can be used in atomic services since API version 11.| +| hostname | string | No| No| Hostname (without the port) in a URL. **Atomic service API**: This API can be used in atomic services since API version 11.| +| href | string | No| No| String that contains the whole URL. **Atomic service API**: This API can be used in atomic services since API version 11.| | origin | string | Yes| No| Read-only string that contains the Unicode serialization of the origin of the represented URL. **Atomic service API**: This API can be used in atomic services since API version 11.| -| password | string | Yes| Yes| Password in a URL. **Atomic service API**: This API can be used in atomic services since API version 11.| -| pathname | string | Yes| Yes| Path in a URL. **Atomic service API**: This API can be used in atomic services since API version 11.| -| port | string | Yes| Yes| Port in a URL. **Atomic service API**: This API can be used in atomic services since API version 11.| -| protocol | string | Yes| Yes| Protocol in a URL. **Atomic service API**: This API can be used in atomic services since API version 11.| -| search | string | Yes| Yes| Serialized query string in a URL. **Atomic service API**: This API can be used in atomic services since API version 11.| +| password | string | No| No| Password in a URL. **Atomic service API**: This API can be used in atomic services since API version 11.| +| pathname | string | No| No| Path in a URL. **Atomic service API**: This API can be used in atomic services since API version 11.| +| port | string | No| No| Port in a URL. **Atomic service API**: This API can be used in atomic services since API version 11.| +| protocol | string | No| No| Protocol in a URL. **Atomic service API**: This API can be used in atomic services since API version 11.| +| search | string | No| No| Serialized query string in a URL. **Atomic service API**: This API can be used in atomic services since API version 11.| | searchParams(deprecated) | [URLSearchParams](#urlsearchparamsdeprecated) | Yes| No| **URLSearchParams** object allowing access to the query parameters in a URL.
- **NOTE**: This property is supported since API version 7 and is deprecated since API version 9. You are advised to use params9+ instead.| | params9+ | [URLParams](#urlparams9) | Yes| No| **URLParams** object allowing access to the query parameters in a URL. **Atomic service API**: This API can be used in atomic services since API version 11.| -| username | string | Yes| Yes| Username in a URL. **Atomic service API**: This API can be used in atomic services since API version 11.| +| username | string | No| No| Username in a URL. **Atomic service API**: This API can be used in atomic services since API version 11.| **Example** @@ -585,6 +587,12 @@ Parses a URL. | url | string | Yes| A string representing an absolute or a relative URL.
In the case of a relative URL, you must specify **base** to parse the final URL.
In the case of an absolute URL, the passed **base** will be ignored.| | base | string \| URL | No| Either a string or an object. The default value is **undefined**.
- **string**: string. If the first parameter is a relative URL, the parameter must comply with the URL standard.
- **URL**: URL object.
- This parameter is used when **url** is a relative URL.| +**Return value** + +| Type| Description | +| ---- | ------------------------------------------------- | +| [URL](#url) | **URL** object created.| + > **NOTE** > > If **url** is a relative URL, the URL parsed by calling this API is not merely a concatenation of **url** and **base**. When **url** is a relative path, it is parsed relative to the current directory of the passed **base**, taking into account all path segments before the last slash in the path of **base**, but excluding the following part (see example url1). When **url** points to a root directory, it is parsed relative to the origin of **base** (see example url2). @@ -784,7 +792,7 @@ console.log(params.getAll('fod').toString()) // Output ["1","3"]. entries(): IterableIterator<[string, string]> -Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and the first and second fields of each array are the key and value respectively. +Obtains an ES6 iterator. Each item of the iterator is an array, and the first and second fields of each array are the key and value respectively. > **NOTE** > @@ -1028,7 +1036,7 @@ for (let value of values) { [Symbol.iterator]\(): IterableIterator<[string, string]> -Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and the first and second fields of each array are the key and value respectively. +Obtains an ES6 iterator. Each item of the iterator is an array, and the first and second fields of each array are the key and value respectively. > **NOTE** > diff --git a/en/application-dev/reference/apis-arkts/js-apis-util.md b/en/application-dev/reference/apis-arkts/js-apis-util.md index f3ee6432067..56a3bc9727e 100644 --- a/en/application-dev/reference/apis-arkts/js-apis-util.md +++ b/en/application-dev/reference/apis-arkts/js-apis-util.md @@ -314,7 +314,7 @@ console.info("RFC 4122 Version 4 UUID:" + uuid); generateRandomBinaryUUID(entropyCache?: boolean): Uint8Array -Uses a secure random number generator to generate a random UUID of the Uint8Array type in RFC 4122 version 4. +Uses a secure random number generator to generate a random UUID in RFC 4122 version 4. **Atomic service API**: This API can be used in atomic services since API version 12. @@ -352,7 +352,7 @@ console.info(JSON.stringify(uuid)); parseUUID(uuid: string): Uint8Array -Converts a UUID of the string type generated by **generateRandomUUID** to a UUID of the Uint8Array type generated by **generateRandomBinaryUUID**, as described in RFC 4122. +Converts a UUID of the string type generated by **generateRandomUUID** to a UUID generated by **generateRandomBinaryUUID**, as described in RFC 4122. **Atomic service API**: This API can be used in atomic services since API version 12. @@ -483,7 +483,9 @@ Processes an asynchronous function and returns a promise. getHash(object: object): number -Obtains the hash value of an object. If no hash value has been obtained, a random hash value is generated, saved to the **hash** field of the object, and returned. If a hash value has been obtained, the hash value saved in the **hash** field is returned (the same value is returned for the same object). +Obtains the hash value of an object. + +If no hash value has been obtained, a random hash value is generated, saved to the **hash** field of the object, and returned. If a hash value has been obtained, the hash value saved in the **hash** field is returned (the same value is returned for the same object). **Atomic service API**: This API can be used in atomic services since API version 12. @@ -540,7 +542,7 @@ Describes decoding-related options, which include **fatal** and **ignoreBOM**. ## DecodeToStringOptions12+ -Describes the options used during the decoding to a string. +Describes the options used during decoding of a byte stream. **Atomic service API**: This API can be used in atomic services since API version 12. @@ -815,7 +817,7 @@ Provides APIs to decode byte arrays into strings. It supports multiple formats, **System capability**: SystemCapability.Utils.Lang -| Name| Type| Readable| Writable| Description| +| Name| Type| Read-Only| Optional| Description| | -------- | -------- | -------- | -------- | -------- | | encoding | string | Yes| No| Encoding format.
The following formats are supported: utf-8, ibm866, iso-8859-2, iso-8859-3, iso-8859-4, iso-8859-5, iso-8859-6, iso-8859-7, iso-8859-8, iso-8859-8-i, iso-8859-10, iso-8859-13, iso-8859-14, iso-8859-15, koi8-r, koi8-u, macintosh, windows-874, windows-1250, windows-1251, windows-1252, windows-1253, windows-1254, windows-1255, windows-1256, windows-1257, windows-1258, x-mac-cyrillic, gbk, gb18030, big5, euc-jp, iso-2022-jp, shift_jis, euc-kr, utf-16be, utf-16le, gb2312, and iso-8859-1.| | fatal | boolean | Yes| No| Whether to display fatal errors. The value **true** means to display fatal errors, and **false** means the opposite.| @@ -1095,7 +1097,7 @@ When **TextEncoder** is used for encoding, the number of bytes occupied by a cha **System capability**: SystemCapability.Utils.Lang -| Name| Type| Readable| Writable| Description| +| Name| Type| Read-Only| Optional| Description| | -------- | -------- | -------- | -------- | -------- | | encoding | string | Yes| No| Encoding format.
The following formats are supported: utf-8, gb2312, gb18030, ibm866, iso-8859-1, iso-8859-2, iso-8859-3, iso-8859-4, iso-8859-5, iso-8859-6, iso-8859-7, iso-8859-8, iso-8859-8-i, iso-8859-10, iso-8859-13, iso-8859-14, iso-8859-15, koi8-r, koi8-u, macintosh, windows-874, windows-1250, windows-1251, windows-1252, windows-1253, windows-1254, windows-1255, windows-1256, windows-1257, windows-1258, gbk, big5, euc-jp, iso-2022-jp, shift_jis, euc-kr, x-mac-cyrillic, utf-16be, and utf-16le.
The default value is **'utf-8'**.| @@ -1880,7 +1882,7 @@ Provides APIs to discard the least recently used data to make rooms for new elem **System capability**: SystemCapability.Utils.Lang -| Name | Type | Readable| Writable| Description | +| Name | Type | Read-Only| Optional| Description | | ------ | ------ | ---- | ---- | ---------------------- | | length | number | Yes | No | Total number of values in this cache.| @@ -2516,7 +2518,7 @@ console.info('result = ' + result); entries(): IterableIterator<[K, V]> -Obtains all key-value pairs in this object. +Returns an iterator object that iterates over all key-value pairs ([key, value]) in the current object in the order they were inserted. **Atomic service API**: This API can be used in atomic services since API version 12. @@ -5157,7 +5159,7 @@ Checks whether the value is of the SharedArrayBuffer type. **System capability**: SystemCapability.Utils.Lang -| Name| Type| Readable| Writable| Description| +| Name| Type| Read-Only| Optional| Description| | -------- | -------- | -------- | -------- | -------- | | length | number | Yes| No| Total number of values in this cache.| diff --git a/en/application-dev/reference/apis-arkts/js-apis-vector.md b/en/application-dev/reference/apis-arkts/js-apis-vector.md index ee69f521d98..7e72a86820e 100644 --- a/en/application-dev/reference/apis-arkts/js-apis-vector.md +++ b/en/application-dev/reference/apis-arkts/js-apis-vector.md @@ -28,7 +28,7 @@ import { Vector } from '@kit.ArkTS'; **System capability**: SystemCapability.Utils.Lang -| Name| Type| Readable| Writable| Description| +| Name| Type| Read-Only| Optional| Description| | -------- | -------- | -------- | -------- | -------- | | length | number | Yes| No| Number of elements in a Vector.| diff --git a/en/application-dev/reference/apis-arkui/errorcode-image-analyzer.md b/en/application-dev/reference/apis-arkui/arkui-ts/errorcode-image-analyzer.md similarity index 96% rename from en/application-dev/reference/apis-arkui/errorcode-image-analyzer.md rename to en/application-dev/reference/apis-arkui/arkui-ts/errorcode-image-analyzer.md index 55e52894a9a..951029db792 100644 --- a/en/application-dev/reference/apis-arkui/errorcode-image-analyzer.md +++ b/en/application-dev/reference/apis-arkui/arkui-ts/errorcode-image-analyzer.md @@ -2,7 +2,7 @@ > **NOTE** > -> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](../errorcode-universal.md). +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](../../errorcode-universal.md). ## 110001 AI Image Analysis Not Supported diff --git a/en/application-dev/reference/apis-arkui/js-apis-StateManagement.md b/en/application-dev/reference/apis-arkui/js-apis-StateManagement.md index 387c49b4e2f..28a90c72da7 100644 --- a/en/application-dev/reference/apis-arkui/js-apis-StateManagement.md +++ b/en/application-dev/reference/apis-arkui/js-apis-StateManagement.md @@ -307,7 +307,7 @@ PersistenceV2.notifyOnError((key: string, reason: string, msg: string) => { |type | TypeConstructorWithArgs\ |No |No |Specified type. | |key | string |No |Yes |key used for connection. If it is not provided, the name of the type is used as the key. | |defaultCreator | StorageDefaultCreator\ |No |Yes |Default constructor. It is recommended that this parameter be passed in. If **globalConnect** is called for the first time with a key and this parameter is not provided, an error will occur.| -|areaMode | contextConstant.AreaMode |No |Yes |Encryption level, ranging from EL1 to EL5 (corresponding to the value from 0 to 4). For details, see [Obtaining and Modifying Encryption Levels](../../application-models/application-context-stage.md). If no value is passed in, the default EL2 level is used. Different encryption levels correspond to different storage paths. Values outside the valid range of 0-4 will cause the application to crash.| +|areaMode | contextConstant.AreaMode |No |Yes |Encryption level, ranging from EL1 to EL5 (corresponding to the value from 0 to 4). For details, see [Encryption Levels](../../application-models/application-context-stage.md#obtaining-and-modifying-encryption-levels). If no value is passed in, EL2 is used by default. Storage paths vary based on the encryption levels. If the input value of encryption level is not in the range of **0** to **4**, a crash occurs.| ## UIUtils @@ -410,9 +410,142 @@ struct Index { } ``` +### enableV2Compatibility19+ + +static enableV2Compatibility\(source: T): T + +Enables V1 state variables to be observable in @ComponentV2. This API is primarily used in scenarios where V1 and V2 state management are mixed. For details, see [Mixing Use of State Management V1 and V2](../../ui/state-management/arkts-v1-v2-mixusage.md). + +**Atomic service API**: This API can be used in atomic services since API version 19. + +**System capability**: SystemCapability.ArkUI.ArkUI.Full + +**Parameters** + +| Name| Type| Mandatory| Description | +| ------ | ---- | ---- | ------------ | +| source | T | Yes | Data source, which must be V1 state data.| + +**Return value** + +| Type| Description | +| ---- | ------------------------------------------------ | +| T | If the data source is V1 state data, returns data that can be observed in @ComponentV2; otherwise, returns the data source itself.| + + +**Example** + +```ts +import { UIUtils } from '@kit.ArkUI'; + +@Observed +class ObservedClass { + name: string = 'Tom'; +} + +@Entry +@Component +struct CompV1 { + @State observedClass: ObservedClass = new ObservedClass(); + + build() { + Column() { + Text(`@State observedClass: ${this.observedClass.name}`) + .onClick(() => { + this.observedClass.name = 'State'; // Refresh + }) + // Enable V2 observability for the V1 state variable. + CompV2({ observedClass: UIUtils.enableV2Compatibility(this.observedClass) }) + } + } +} + +@ComponentV2 +struct CompV2 { + @Param observedClass: ObservedClass = new ObservedClass(); + + build() { + // After V2 observability is enabled for the V1 state variable, the first-layer changes can be observed in V2. + Text(`@Param observedClass: ${this.observedClass.name}`) + .onClick(() => { + this.observedClass.name = 'Param'; // Refresh + }) + } +} +``` + +### makeV1Observed19+ +static makeV1Observed\(source: T): T + +Wraps an unobservable object into an object that is observable by V1 state management. This API is equivalent to @Observed and can be used to initialize @ObjectLink. + +This API can be used in conjunction with [enableV2Compatibility](#enablev2compatibility19) for scenarios where V1 and V2 state management are mixed. For details, see [Mixing Use of State Management V1 and V2](../../ui/state-management/arkts-v1-v2-mixusage.md). + +**Atomic service API**: This API can be used in atomic services since API version 19. + +**System capability**: SystemCapability.ArkUI.ArkUI.Full + +**Parameters** + +| Name| Type| Mandatory| Description | +| ------ | ---- | ---- | ------------ | +| source | T | Yes | Data source. Common class, Array, Map, Set, and Date types are supported.
The [collections](../apis-arkts/js-apis-arkts-collections.md) type and [\@Sendable](../../arkts-utils/arkts-sendable.md) decorated classes are not supported.
**undefined** and **null** are not supported. V2 state management data and the return value of [makeObserved](#makeobserved) are not supported.| + +**Return value** + +| Type| Description | +| ---- | ------------------------------------------------ | +| T | For supported input parameter types, returns data observable by V1 state management. For unsupported input parameter types, returns the data source object itself.| + +**Example** + +```ts +import { UIUtils } from '@kit.ArkUI'; + +class Outer { + outerValue: string = 'outer'; + inner: Inner; + + constructor(inner: Inner) { + this.inner = inner; + } +} + +class Inner { + interValue: string = 'inner'; +} + +@Entry +@Component +struct Index { + @State outer: Outer = new Outer(UIUtils.makeV1Observed(new Inner())); + + build() { + Column() { + // The return value of makeV1Observed can be used to initialize @ObjectLink. + Child({ inner: this.outer.inner }) + } + .height('100%') + .width('100%') + } +} + +@Component +struct Child { + @ObjectLink inner: Inner; + + build() { + Text(`${this.inner.interValue}`) + .onClick(() => { + this.inner.interValue += '!'; + }) + } +} +``` + ## StorageDefaultCreator\ -type StorageDefaultCreator\ = () => T; +type StorageDefaultCreator\ = () => T Obtains the default constructor. @@ -469,7 +602,7 @@ Represents a class constructor that accepts arbitrary arguments. ### new -new(...args: any): T; +new(...args: any): T **Atomic service API**: This API can be used in atomic services since API version 12. @@ -522,7 +655,7 @@ struct SampleComp { ## PersistenceErrorCallback -type PersistenceErrorCallback = (key: string, reason: 'quota' | 'serialization' | 'unknown', message: string) => void; +type PersistenceErrorCallback = (key: string, reason: 'quota' | 'serialization' | 'unknown', message: string) => void Represents the callback invoked when persistence fails. @@ -590,7 +723,7 @@ Class constructor. ### new -new(): T; +new(): T **Return value** @@ -640,7 +773,7 @@ struct Index { ## TypeDecorator -type TypeDecorator = \(type: TypeConstructor\) => PropertyDecorator; +type TypeDecorator = \(type: TypeConstructor\) => PropertyDecorator Property decorator. diff --git a/en/application-dev/reference/apis-basic-services-kit/js-apis-serialManager-sys.md b/en/application-dev/reference/apis-basic-services-kit/js-apis-serialManager-sys.md new file mode 100644 index 00000000000..59d2bacc656 --- /dev/null +++ b/en/application-dev/reference/apis-basic-services-kit/js-apis-serialManager-sys.md @@ -0,0 +1,81 @@ +# @ohos.usbManager.serial (Serial Port Management) (system API) + +This module provides the serial port management functions, including enabling and disabling the serial port of the device, writing and reading data, setting and obtaining the configuration parameters of the serial port, and managing permissions. + +> **NOTE** +> +> The initial APIs of this module are supported since API version 18. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> +> This topic describes only the system APIs provided by the module. For details about its public APIs, see [@ohos.usbManager.serial (USB Manager)](js-apis-serialManager.md). + +## Modules to Import + +```ts +import { serialManager } from '@kit.BasicServicesKit'; +``` + +## serialManager.addSerialRight + +addSerialRight(tokenId: number, portId: number): void; + +Adds the permission to an application for accessing the serial port device. + +**serialManager.requestSerialRight** triggers a dialog box to request user authorization. **addSerialRight** does not trigger a dialog box but directly adds the device access permission for the application. After the application exits, the access permission on the serial port device is automatically removed. After the application is restarted, you need to request the permission again. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.MANAGE_USB_CONFIG + +**System capability**: SystemCapability.USB.USBManager.Serial + +**Parameters** + +| Name | Type | Mandatory| Description | +|---------|--------|----|-------------------------------------| +| tokenId | number | Yes | ID of the token that requires the access permission. | +| portId | number | Yes | Port number.| + +**Error codes** + +For details about the error codes, see [USB Service Error Codes](errorcode-usb.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| 201 | Permission verification failed. The application does not have the permission required to call the API. | +| 202 | Permission verification failed. A non-system application calls a system API. | +| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | +| 14400005 | Database operation exception. | +| 31400001 | Serial port management exception. | +| 31400003 | Device does not exist. | + +**Example** +```ts +import { bundleManager } from '@kit.AbilityKit'; +import { BusinessError } from '@kit.BasicServicesKit'; +import { JSON } from '@kit.ArkTS'; +import { serialManager } from '@kit.BasicServicesKit'; + +// Obtain the serial port list. +let portList: serialManager.SerialPort[] = serialManager.getPortList(); +console.info('portList: ', JSON.stringify(portList)); +if (portList === undefined || portList.length === 0) { + console.info('portList is empty'); + return; +} + +let portId: number = portList[0].portId; +// Add permissions to the serial port. +let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT; +bundleManager.getBundleInfoForSelf(bundleFlags).then((bundleInfo) => { + console.info('getBundleInfoForSelf successfully. Data: %{public}s', JSONstringify(bundleInfo)); + let tokenId = bundleInfo.appInfo.accessTokenId; + try { + serialManager.addSerialRight(tokenId, portId); + console.info('addSerialRight success, portId: ' + portId); + } catch (error) { + console.error('addSerialRight error, ' + JSON.stringify(error)); + } +}).catch((err : BusinessError) => { + console.error('getBundleInfoForSelf failed'); +}); +``` diff --git a/en/application-dev/reference/apis-basic-services-kit/js-apis-serialManager.md b/en/application-dev/reference/apis-basic-services-kit/js-apis-serialManager.md new file mode 100644 index 00000000000..7264c72c245 --- /dev/null +++ b/en/application-dev/reference/apis-basic-services-kit/js-apis-serialManager.md @@ -0,0 +1,934 @@ +# @ohos.usbManager.serial (Serial Port Management) + +This module provides the serial port management functions, including enabling and disabling the serial port of the device, writing and reading data, setting and obtaining the configuration parameters of the serial port, and managing permissions. + +> **NOTE** +> +> The initial APIs of this module are supported since API version 18. Newly added APIs will be marked with a superscript to indicate their earliest API version. + +## Modules to Import + +```ts +import { serialManager } from '@kit.BasicServicesKit'; +``` + +## serialManager.getPortList + +getPortList(): Readonly<serialport>[]; + +Obtains the serial port device list, including the device name and port number. + +**System capability**: SystemCapability.USB.USBManager.Serial + +**Returns** + +| Type | Description | +|-------------------------------------------|-------------| +| Readonly<[SerialPort](#serialport)>[] | Serial port information list.| + +**Example** + +```ts +import { JSON } from '@kit.ArkTS'; +import { serialManager } from '@kit.BasicServicesKit'; + +// Obtain the serial port device list. +let portList: serialManager.SerialPort[] = serialManager.getPortList(); +console.info('usbSerial portList: ' + JSON.stringify(portList)); +if (portList === undefined || portList.length === 0) { + console.info('usbSerial portList is empty'); + return; +} +let portId: number = portList[0].portId; +``` + +## serialManager.hasSerialRight + +hasSerialRight(portId: number): boolean; + +Checks whether the application has the permission to access the serial port device. When an application is restarted after exiting, you need to request the permission from the user again. + +**System capability**: SystemCapability.USB.USBManager.Serial + +**Parameters** + +| Name | Type | Mandatory| Description | +|--------|--------|----|-------------------------------------| +| portId | number | Yes | Port number.| + +**Returns** + +| Type | Description | +|---------|------------------| +| boolean | The value **true** indicates that the permission is authorized, and **false** indicates the opposite.| + +**Error codes** + +For details about the error codes, see [USB Service Error Codes](errorcode-usb.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | +| 14400005 | Database operation exception. | +| 31400001 | Serial port management exception. | +| 31400003 | Device does not exist. | + +**Example** + +```ts +import { JSON } from '@kit.ArkTS'; +import { serialManager } from '@kit.BasicServicesKit'; + +// Obtain the serial port list. +let portList: serialManager.SerialPort[] = serialManager.getPortList(); +console.info('portList: ', JSON.stringify(portList)); +if (portList === undefined || portList.length === 0) { + console.info('portList is empty'); + return; +} +let portId: number = portList[0].portId; + +// Check whether the device can be accessed by the application. +if (serialManager.hasSerialRight(portId)) { + console.info('The serial port is accessible'); +} else { + console.info('No permission to access the serial port'); +} +``` + +## serialManager.requestSerialRight + +requestSerialRight(portId: number): Promise<boolean> + +Requests the permission for the application to access the serial port device. After the application exits, the access permission on the serial port device is automatically removed. After the application is restarted, you need to request the permission again. + +**System capability**: SystemCapability.USB.USBManager.Serial + +**Parameters** + +| Name | Type | Mandatory| Description | +|--------|--------|----|-------------------------------------| +| portId | number | Yes | Port number.| + +**Returns** + +| Type | Description | +|------------------------|---------------| +| Promise<boolean> | Promise used to return the result. The value **true** indicates that the permission is successfully requested, and **false** indicates the opposite.| + +**Error codes** + +For details about the error codes, see [USB Service Error Codes](errorcode-usb.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | +| 14400005 | Database operation exception. | +| 31400001 | Serial port management exception. | +| 31400003 | Device does not exist. | + +**Example** + +```ts +import { JSON } from '@kit.ArkTS'; +import { serialManager } from '@kit.BasicServicesKit'; + +// Obtain the serial port list. +let portList: serialManager.SerialPort[] = serialManager.getPortList(); +console.info('usbSerial portList: ' + JSON.stringify(portList)); +if (portList === undefined || portList.length === 0) { + console.info('usbSerial portList is empty'); + return; +} +let portId: number = portList[0].portId; + +// Check whether the device can be accessed by the application. +if (!serialManager.hasSerialRight(portId)) { + await serialManager.requestSerialRight(portId).then(result => { + if (!result) { + // If the application does not have the access permission and is not granted by the user, the application exits. + console.info('user is not granted the operation permission'); + return; + } else { + console.info('grant permission successfully'); + } + }); +} +``` + +## serialManager.open + +open(portId: number): void; + +Opens a serial port device. + +**System capability**: SystemCapability.USB.USBManager.Serial + +**Parameters** + +| Name | Type | Mandatory| Description | +|--------|--------|----|-------------| +| portId | number | Yes | Port number.| + +**Error codes** + +For details about the error codes, see [USB Service Error Codes](errorcode-usb.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | +| 31400001 | Serial port management exception. | +| 31400002 | Access denied. Call requestSerialRight to request user authorization first. | +| 31400003 | Device does not exist. | +| 31400004 | The serial port device is occupied. | + +**Example** + +```ts +import { JSON } from '@kit.ArkTS'; +import { serialManager } from '@kit.BasicServicesKit'; + +// Obtain the serial port list. +let portList: serialManager.SerialPort[] = serialManager.getPortList(); +console.info('usbSerial portList: ' + JSON.stringify(portList)); +if (portList === undefined || portList.length === 0) { + console.info('usbSerial portList is empty'); + return; +} +let portId: number = portList[0].portId; + +// Check whether the device can be accessed by the application. +if (!serialManager.hasSerialRight(portId)) { + await serialManager.requestSerialRight(portId).then(result => { + if (!result) { + // If the application does not have the access permission and is not granted by the user, the application exits. + console.info('user is not granted the operation permission'); + return; + } else { + console.info('grant permission successfully'); + } + }); +} + +// Open a serial port device. +try { + serialManager.open(portId) + console.info('open usbSerial success, portId: ' + portId); +} catch (error) { + console.error('open usbSerial error, ' + JSON.stringify(error)); +} +``` + +## serialManager.getAttribute + +getAttribute(portId: number): Readonly<[SerialAttribute](#serialattribute)>; + +Obtains the configuration parameters of a specified serial port. + +**System capability**: SystemCapability.USB.USBManager.Serial + +**Parameters** + +| Name | Type | Mandatory| Description | +|--------|--------|----|-------------| +| portId | number | Yes | Port number.| + +**Returns** + +| Type | Description | +|--------|-------------| +| Readonly<[SerialAttribute](#serialattribute)> | Configuration parameters of the serial port.| + +**Error codes** + +For details about the error codes, see [USB Service Error Codes](errorcode-usb.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | +| 31400001 | Serial port management exception. | +| 31400003 | Device does not exist. | +| 31400005 | The serial port device is not opened. Call the open API first. | + +**Example** + +```ts +import { JSON } from '@kit.ArkTS'; +import { serialManager } from '@kit.BasicServicesKit'; + +// Obtain the serial port list. +let portList: serialManager.SerialPort[] = serialManager.getPortList(); +console.info('usbSerial portList: ' + JSON.stringify(portList)); +if (portList === undefined || portList.length === 0) { + console.info('usbSerial portList is empty'); + return; +} +let portId: number = portList[0].portId; + +// Check whether the device can be accessed by the application. +if (!serialManager.hasSerialRight(portId)) { + await serialManager.requestSerialRight(portId).then(result => { + if (!result) { + // If the application does not have the access permission and is not granted by the user, the application exits. + console.info('user is not granted the operation permission'); + return; + } else { + console.info('grant permission successfully'); + } + }); +} + +// Open a serial port device. +try { + serialManager.open(portId) + console.info('open usbSerial success, portId: ' + portId); +} catch (error) { + console.error('open usbSerial error, ' + JSON.stringify(error)); +} + +// Obtain the serial port configuration. +try { + let attribute: serialManager.SerialAttribute = serialManager.getAttribute(portId); + if (attribute === undefined) { + console.error('getAttribute usbSerial error, attribute is undefined'); + } else { + console.info('getAttribute usbSerial success, attribute: ' + JSON.stringify(attribute)); + } +} catch (error) { + console.error('getAttribute usbSerial error, ' + JSON.stringify(error)); +} +``` + +## serialManager.setAttribute + +setAttribute(portId: number, attribute: [SerialAttribute](#serialattribute)): void; + +Sets the parameters of the serial port. If this method is not called, the default configuration parameters are used (baud rate: 9600 bit/s; data bit: 8; parity bit: 0; stop bit: 1). + +**System capability**: SystemCapability.USB.USBManager.Serial + +**Parameters** + +| Name | Type | Mandatory| Description | +|-----------|-------------------------------------|----|-------------| +| portId | number | Yes | Port number.| +| attribute | [SerialAttribute](#serialattribute) | Yes | Configuration parameters of the serial port. | + +**Error codes** + +For details about the error codes, see [USB Service Error Codes](errorcode-usb.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | +| 31400001 | Serial port management exception. | +| 31400003 | Device does not exist. | +| 31400005 | The serial port device is not opened. Call the open API first. | + +**Example** + +```ts +import { JSON } from '@kit.ArkTS'; +import { serialManager } from '@kit.BasicServicesKit'; + +// Obtain the serial port list. +let portList: serialManager.SerialPort[] = serialManager.getPortList(); +console.info('usbSerial portList: ' + JSON.stringify(portList)); +if (portList === undefined || portList.length === 0) { + console.info('usbSerial portList is empty'); + return; +} +let portId: number = portList[0].portId; + +// Check whether the device can be accessed by the application. +if (!serialManager.hasSerialRight(portId)) { + await serialManager.requestSerialRight(portId).then(result => { + if (!result) { + // If the application does not have the access permission and is not granted by the user, the application exits. + console.info('user is not granted the operation permission'); + return; + } else { + console.info('grant permission successfully'); + } + }); +} + +// Open a serial port device. +try { + serialManager.open(portId) + console.info('open usbSerial success, portId: ' + portId); +} catch (error) { + console.error('open usbSerial error, ' + JSON.stringify(error)); +} + +// Set the serial port configuration. +try { + let attribute: serialManager.SerialAttribute = { + baudRate: serialManager.BaudRates.BAUDRATE_9600, + dataBits: serialManager.DataBits.DATABIT_8, + parity: serialManager.Parity.PARITY_NONE, + stopBits: serialManager.StopBits.STOPBIT_1 + } + serialManager.setAttribute(portId, attribute); + console.info('setAttribute usbSerial success, attribute: ' + JSON.stringify(attribute)); +} catch (error) { + console.error('setAttribute usbSerial error, ' + JSON.stringify(error)); +} +``` + +## serialManager.read + +read(portId: number, buffer: Uint8Array, timeout?: number): Promise<number>; + +Reads data from the serial port device asynchronously. + +**System capability**: SystemCapability.USB.USBManager.Serial + +**Parameters** + +| Name | Type | Mandatory| Description | +|---------|------------|----|------------------| +| portId | number | Yes | Port number. | +| buffer | Uint8Array | Yes | Buffer for reading data.| +| timeout | number | No | Timeout duration for reading data, in milliseconds.| + +**Returns** + +| Type | Description | +|-----------------------|----------------| +| Promise<number> | Promise used to return the length of the data read.| + +**Error codes** + +For details about the error codes, see [USB Service Error Codes](errorcode-usb.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | +| 31400001 | Serial port management exception. | +| 31400003 | Device does not exist. | +| 31400005 | The serial port device is not opened. Call the open API first. | +| 31400006 | Data transfer timed out. | +| 31400007 | I/O exception. | + +**Example** + +```ts +import { JSON } from '@kit.ArkTS'; +import { serialManager } from '@kit.BasicServicesKit'; + +// Obtain the serial port list. +let portList: serialManager.SerialPort[] = serialManager.getPortList(); +console.info('usbSerial portList: ' + JSON.stringify(portList)); +if (portList === undefined || portList.length === 0) { + console.info('usbSerial portList is empty'); + return; +} +let portId: number = portList[0].portId; + +// Check whether the device can be accessed by the application. +if (!serialManager.hasSerialRight(portId)) { + await serialManager.requestSerialRight(portId).then(result => { + if (!result) { + // If the application does not have the access permission and is not granted by the user, the application exits. + console.info('user is not granted the operation permission'); + return; + } else { + console.info('grant permission successfully'); + } + }); +} + +// Open a serial port device. +try { + serialManager.open(portId) + console.info('open usbSerial success, portId: ' + portId); +} catch (error) { + console.error('open usbSerial error, ' + JSON.stringify(error)); +} + +// Read data asynchronously. +let readBuffer: Uint8Array = new Uint8Array(64); +serialManager.read(portId, readBuffer, 2000).then((size: number) => { + console.info('read usbSerial success, readBuffer: ' + readBuffer.toString()); +}).catch((error: Error) => { + console.error('read usbSerial error, ' + JSON.stringify(error)); +}) +``` + +## serialManager.readSync + +readSync(portId: number, buffer: Uint8Array, timeout?: number): number; + +Reads data from the serial port device synchronously. + +**System capability**: SystemCapability.USB.USBManager.Serial + +**Parameters** + +| Name | Type | Mandatory| Description | +|---------|------------|----|------------------| +| portId | number | Yes | Port number.| +| buffer | Uint8Array | Yes | Buffer for reading data.| +| timeout | number | No | Timeout duration for reading data, in milliseconds.| + +**Returns** + +| Type | Description | +|--------|-------------| +| number | Length of the data read.| + +**Error codes** + +For details about the error codes, see [USB Service Error Codes](errorcode-usb.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | +| 31400001 | Serial port management exception. | +| 31400003 | Device does not exist. | +| 31400005 | The serial port device is not opened. Call the open API first. | +| 31400006 | Data transfer timed out. | +| 31400007 | I/O exception. | + +**Example** + +```ts +import { JSON } from '@kit.ArkTS'; +import { serialManager } from '@kit.BasicServicesKit'; + +// Obtain the serial port list. +let portList: serialManager.SerialPort[] = serialManager.getPortList(); +console.info('usbSerial portList: ' + JSON.stringify(portList)); +if (portList === undefined || portList.length === 0) { + console.info('usbSerial portList is empty'); + return; +} +let portId: number = portList[0].portId; + +// Check whether the device can be accessed by the application. +if (!serialManager.hasSerialRight(portId)) { + await serialManager.requestSerialRight(portId).then(result => { + if (!result) { + // If the application does not have the access permission and is not granted by the user, the application exits. + console.info('user is not granted the operation permission'); + return; + } else { + console.info('grant permission successfully'); + } + }); +} + +// Open a serial port device. +try { + serialManager.open(portId) + console.info('open usbSerial success, portId: ' + portId); +} catch (error) { + console.error('open usbSerial error, ' + JSON.stringify(error)); +} + +// Read data synchronously. +let readSyncBuffer: Uint8Array = new Uint8Array(64); +try { + serialManager.readSync(portId, readSyncBuffer, 2000); + console.info('readSync usbSerial success, readSyncBuffer: ' + readSyncBuffer.toString()); +} catch (error) { + console.error('readSync usbSerial error, ' + JSON.stringify(error)); +} +``` + +## serialManager.write + +write(portId: number, buffer: Uint8Array, timeout?: number): Promise<number>; + +Writes data to the serial port device asynchronously. + +**System capability**: SystemCapability.USB.USBManager.Serial + +**Parameters** + +| Name | Type | Mandatory| Description | +|---------|------------|----|------------------| +| portId | number | Yes | Port number. | +| buffer | Uint8Array | Yes | Buffer for writing data.| +| timeout | number | No | Timeout duration for writing data, in milliseconds.| + +**Returns** + +| Type | Description | +|-----------------------|-------------| +| Promise<number> | Promise used to return the length of the data written.| + +**Error codes** + +For details about the error codes, see [USB Service Error Codes](errorcode-usb.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | +| 31400001 | Serial port management exception. | +| 31400003 | Device does not exist. | +| 31400005 | The serial port device is not opened. Call the open API first. | +| 31400006 | Data transfer timed out. | +| 31400007 | I/O exception. | + +**Example** + +```ts +import { JSON } from '@kit.ArkTS'; +import { serialManager } from '@kit.BasicServicesKit'; + +// Obtain the serial port list. +let portList: serialManager.SerialPort[] = serialManager.getPortList(); +console.info('usbSerial portList: ' + JSON.stringify(portList)); +if (portList === undefined || portList.length === 0) { + console.info('usbSerial portList is empty'); + return; +} +let portId: number = portList[0].portId; + +// Check whether the device can be accessed by the application. +if (!serialManager.hasSerialRight(portId)) { + await serialManager.requestSerialRight(portId).then(result => { + if (!result) { + // If the application does not have the access permission and is not granted by the user, the application exits. + console.info('user is not granted the operation permission'); + return; + } else { + console.info('grant permission successfully'); + } + }); +} + +// Open a serial port device. +try { + serialManager.open(portId) + console.info('open usbSerial success, portId: ' + portId); +} catch (error) { + console.error('open usbSerial error, ' + JSON.stringify(error)); +} + +// Write data asynchronously. +let writeBuffer: Uint8Array = new Uint8Array(buffer.from('Hello World', 'utf-8').buffer) +serialManager.write(portId, writeBuffer, 2000).then((size: number) => { + console.info('write usbSerial success, writeBuffer: ' + writeBuffer.toString()); +}).catch((error: Error) => { + console.error('write usbSerial error, ' + JSON.stringify(error)); +}) +``` + +## serialManager.writeSync + +writeSync(portId: number, buffer: Uint8Array, timeout?: number): number; + +Writes data to the serial port device synchronously. + +**System capability**: SystemCapability.USB.USBManager.Serial + +**Parameters** + +| Name | Type | Mandatory| Description | +|---------|------------|----|------------------| +| portId | number | Yes | Port number. | +| buffer | Uint8Array | Yes | Destination buffer for writing data.| +| timeout | number | No | Timeout duration for writing data, in milliseconds.| + +**Returns** + +| Type | Description | +|--------|-------------| +| number | Length of the data written.| + +**Error codes** + +For details about the error codes, see [USB Service Error Codes](errorcode-usb.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | +| 31400001 | Serial port management exception. | +| 31400003 | Device does not exist. | +| 31400005 | The serial port device is not opened. Call the open API first. | +| 31400006 | Data transfer timed out. | +| 31400007 | I/O exception. | + +**Example** + +```ts +import { JSON } from '@kit.ArkTS'; +import { serialManager } from '@kit.BasicServicesKit'; + +// Obtain the serial port list. +let portList: serialManager.SerialPort[] = serialManager.getPortList(); +console.info('usbSerial portList: ' + JSON.stringify(portList)); +if (portList === undefined || portList.length === 0) { + console.info('usbSerial portList is empty'); + return; +} +let portId: number = portList[0].portId; + +// Check whether the device can be accessed by the application. +if (!serialManager.hasSerialRight(portId)) { + await serialManager.requestSerialRight(portId).then(result => { + if (!result) { + // If the application does not have the access permission and is not granted by the user, the application exits. + console.info('user is not granted the operation permission'); + return; + } else { + console.info('grant permission successfully'); + } + }); +} + +// Open a serial port device. +try { + serialManager.open(portId) + console.info('open usbSerial success, portId: ' + portId); +} catch (error) { + console.error('open usbSerial error, ' + JSON.stringify(error)); +} + +// Write data synchronously. +let writeSyncBuffer: Uint8Array = new Uint8Array(buffer.from('Hello World', 'utf-8').buffer) +try { + serialManager.writeSync(portId, writeSyncBuffer, 2000); + console.info('writeSync usbSerial success, writeSyncBuffer: ' + writeSyncBuffer.toString()); +} catch (error) { + console.error('writeSync usbSerial error, ' + JSON.stringify(error)); +} +``` + +## serialManager.close + +close(portId: number): void; + +Closes the serial port device. + +**System capability**: SystemCapability.USB.USBManager.Serial + +**Parameters** + +| Name | Type | Mandatory| Description | +|--------|--------|----|-------------| +| portId | number | Yes | Port number.| + +**Error codes** + +For details about the error codes, see [USB Service Error Codes](errorcode-usb.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | +| 31400001 | Serial port management exception. | +| 31400003 | Device does not exist. | +| 31400005 | The serial port device is not opened. Call the open API first. | + +**Example** + +```ts +import { JSON } from '@kit.ArkTS'; +import { serialManager } from '@kit.BasicServicesKit'; + +// Obtain the serial port list. +let portList: serialManager.SerialPort[] = serialManager.getPortList(); +console.info('usbSerial portList: ' + JSON.stringify(portList)); +if (portList === undefined || portList.length === 0) { + console.info('usbSerial portList is empty'); + return; +} +let portId: number = portList[0].portId; + +// Check whether the device can be accessed by the application. +if (!serialManager.hasSerialRight(portId)) { + await serialManager.requestSerialRight(portId).then(result => { + if (!result) { + // If the application does not have the access permission and is not granted by the user, the application exits. + console.info('user is not granted the operation permission'); + return; + } else { + console.info('grant permission successfully'); + } + }); +} + +// Open a serial port device. +try { + serialManager.open(portId) + console.info('open usbSerial success, portId: ' + portId); +} catch (error) { + console.error('open usbSerial error, ' + JSON.stringify(error)); +} + +// Close the serial port device. +try { + serialManager.close(portId); + console.info('close usbSerial success, portId: ' + portId); +} catch (error) { + console.error('close usbSerial error, ' + JSON.stringify(error)); +} +``` + +## serialManager.cancelSerialRight + +cancelSerialRight(portId: number): void; + +Cancels the permission to access the serial port device when the application is running. This API is used to close the enabled serial port device. + +**System capability**: SystemCapability.USB.USBManager.Serial + +**Parameters** + +| Name | Type | Mandatory| Description | +|--------|--------|----|-------------------------------------| +| portId | number | Yes | Port number.| + +**Error codes** + +For details about the error codes, see [USB Service Error Codes](errorcode-usb.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | +| 14400005 | Database operation exception. | +| 31400001 | Serial port management exception. | +| 31400002 | Access denied. Call requestSerialRight to request user authorization first. | +| 31400003 | Device does not exist. | + +**Example** + +```ts +import { JSON } from '@kit.ArkTS'; +import { serialManager } from '@kit.BasicServicesKit'; + +// Obtain the serial port list. +let portList: serialManager.SerialPort[] = serialManager.getPortList(); +console.info('usbSerial portList: ' + JSON.stringify(portList)); +if (portList === undefined || portList.length === 0) { + console.info('usbSerial portList is empty'); + return; +} +let portId: number = portList[0].portId; + +// Check whether the device can be accessed by the application. +if (!serialManager.hasSerialRight(portId)) { + await serialManager.requestSerialRight(portId).then(result => { + if (!result) { + // If the application does not have the access permission and is not granted by the user, the application exits. + console.info('user is not granted the operation permission'); + return; + } else { + console.info('grant permission successfully'); + } + }); +} + +// Cancel the granted permission. +try { + serialManager.cancelSerialRight(portId); + console.info('cancelSerialRight success, portId: ', portId); +} catch (error) { + console.error('cancelSerialRight error, ', JSON.stringify(error)); +} +``` + +## SerialAttribute + +Represents the configuration parameters of a serial port. + +**System capability**: SystemCapability.USB.USBManager.Serial + +| Name | Type | Mandatory| Description | +|----------|--------|----|-----------| +| baudrate | number | Yes | Baud rate. | +| dataBits | number | No | Data bit. | +| parity | number | No | Parity check.| +| stopBits | number | No | Stop bit. | + +## SerialPort + +Represents the parameters of a serial port. + +**System capability**: SystemCapability.USB.USBManager.Serial + +| Name | Type | Mandatory| Description | +|--------|--------|----|-------| +| portId | number | Yes | Port number.| +| deviceName | string | Yes | Serial port device name.| + +## BaudRates + +Enumerates the baud rates. + +**System capability**: SystemCapability.USB.USBManager.Serial + +| Name | Value | Description | +|-----------|-----------|-----------| +| BAUDRATE_50 | 50 | The baud rate is 50 bit/s. | +| BAUDRATE_75 | 75 | The baud rate is 75 bit/s. | +| BAUDRATE_110 | 110 | The baud rate is 110 bit/s. | +| BAUDRATE_134 | 134 | The baud rate is 134 bit/s. | +| BAUDRATE_150 | 150 | The baud rate is 150 bit/s. | +| BAUDRATE_200 | 200 | The baud rate is 200 bit/s. | +| BAUDRATE_300 | 300 | The baud rate is 300 bit/s. | +| BAUDRATE_600 | 600 | The baud rate is 600 bit/s. | +| BAUDRATE_1200 | 1200 | The baud rate is 1200 bit/s. | +| BAUDRATE_1800 | 1800 | The baud rate is 1800 bit/s. | +| BAUDRATE_2400 | 2400 | The baud rate is 2400 bit/s. | +| BAUDRATE_4800 | 4800 | The baud rate is 4800 bit/s. | +| BAUDRATE_9600 | 9600 | The baud rate is 9600 bit/s. | +| BAUDRATE_19200 | 19200 | The baud rate is 19200 bit/s. | +| BAUDRATE_38400 | 38400 | The baud rate is 38400 bit/s. | +| BAUDRATE_57600 | 57600 | The baud rate is 57600 bit/s. | +| BAUDRATE_115200 | 115200 | The baud rate is 115200 bit/s. | +| BAUDRATE_230400 | 230400 | The baud rate is 230400 bit/s. | +| BAUDRATE_460800 | 460800 | The baud rate is 460800 bit/s. | +| BAUDRATE_500000 | 500000 | The baud rate is 500000 bit/s. | +| BAUDRATE_576000 | 576000 | The baud rate is 576000 bit/s. | +| BAUDRATE_921600 | 921600 | The baud rate is 921600 bit/s. | +| BAUDRATE_1000000 | 1000000 | The baud rate is 1000000 bit/s. | +| BAUDRATE_1152000 | 1152000 | The baud rate is 1152000 bit/s. | +| BAUDRATE_1500000 | 1500000 | The baud rate is 1500000 bit/s. | +| BAUDRATE_2000000 | 2000000 | The baud rate is 2000000 bit/s. | +| BAUDRATE_2500000 | 2500000 | The baud rate is 2500000 bit/s. | +| BAUDRATE_3000000 | 3000000 | The baud rate is 3000000 bit/s. | +| BAUDRATE_3500000 | 3500000 | The baud rate is 3500000 bit/s. | +| BAUDRATE_4000000 | 4000000 | The baud rate is 4000000 bit/s. | + +## DataBits + +Enumerates the number of data bits. + +**System capability**: SystemCapability.USB.USBManager.Serial + +| Name | Value | Description | +|-----------|-----------|-----------| +| DATABIT_8 | 8 | The number of data bits is 8.| +| DATABIT_7 | 7 | The number of data bits is 7.| +| DATABIT_6 | 6 | The number of data bits is 6.| +| DATABIT_5 | 5 | The number of data bits is 5.| + +## Parity + +Enumerates the parity check modes. + +**System capability**: SystemCapability.USB.USBManager.Serial + +| Name | Value | Description | +|-----------|-----------|-----------| +| PARITY_NONE | 0 | No parity.| +| PARITY_ODD | 1 | Odd parity.| +| PARITY_EVEN | 2 | Even parity.| +| PARITY_MARK | 3 | Mark parity, whose parity bit is fixed at **1**.| +| PARITY_SPACE | 4 | Space parity, whose parity bit is fixed at **0**.| + +## StopBits + +Enumerates of the number of stop bits. + +**System capability**: SystemCapability.USB.USBManager.Serial + +| Name | Value | Description | +|-----------|-----------|-----------| +| STOPBIT_1 | 0 | The number of stop bits is 1.| +| STOPBIT_1P5 | 1 | The number of stop bits is 1.5.| +| STOPBIT_2 | 2 | The number of stop bits is 2.| diff --git a/en/application-dev/reference/apis-connectivity-kit/js-apis-bluetooth-opp-sys.md b/en/application-dev/reference/apis-connectivity-kit/js-apis-bluetooth-opp-sys.md new file mode 100644 index 00000000000..c1cbd4f9ea1 --- /dev/null +++ b/en/application-dev/reference/apis-connectivity-kit/js-apis-bluetooth-opp-sys.md @@ -0,0 +1,617 @@ +# @ohos.bluetooth.opp (Bluetooth OPP Module) (System API) + +The OPP module provides the Bluetooth-based file transfer functions, including sending files, receiving files, and obtaining the file transfer progress. + +> **NOTE** +> +> The initial APIs of this module are supported since API version 16. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> +> This topic describes only the system APIs provided by the module. + +## Modules to Import + +```js +import { opp } from '@kit.ConnectivityKit'; +``` + +## createOppServerProfile + +createOppServerProfile(): OppServerProfile + +Creates an **OppServerProfile** instance. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Return value** + +| Type | Description | +| ----------------------------- | ---------- | +| OppServerProfile | **OppServerProfile** instance.| + +**Error codes** + +For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|202 | Non-system applications are not allowed to use system APIs. | +|801 | Capability not supported. | + +**Example** + +```js +import { AsyncCallback, BusinessError } from '@kit.BasicServicesKit'; +try { + let oppProfile = opp.createOppServerProfile(); + console.info('oppServer success'); +} catch (err) { + console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); +} +``` + +## OppServerProfile + +Represents the **OppServerProfile** class. Before using APIs of this class, you need to create an **OppServerProfile** instance by using the [createOppServerProfile ()](#createoppserverprofile). + +### sendFile + +sendFile(deviceId: string, fileHolds: Array<FileHolder<): Promise<void> + +Send files over Bluetooth. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------- | --------------------------- | ---- | ------------------------ | +| deviceId | string | Yes | Bluetooth MAC address of the receiver.| +| fileHolds | Array<[FileHolder](#fileholder)>| Yes | File data to transfer. Data is sent according to the sequence it is inserted into the array.| + +**Error codes** + +For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bluetooth Error Codes](errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|201 | Permission denied. | +|202 | Permission denied. Non-system applications are not allowed to use system APIs. | +|203 | This function is prohibited by enterprise management policies. | +|401 | Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3. Parameter verification failed. | +|801 | Capability not supported. | +|2900001 | Service stopped. | +|2900003 | Bluetooth disabled. | +|2900004 | Profile is not supported. | +|2900099 | Failed to send file. | +|2903001 | The file type is not supported. | +|2903002 | Current Transfer Information is busy. | +|2903003 | The file is not accessible. | + +**Example** + +```js +import { BusinessError } from '@kit.BasicServicesKit'; +import { fileIo } from '@kit.CoreFileKit'; +import { opp } from '@kit.ConnectivityKit'; +// Create fileHolders. +try { + let oppProfile = opp.createOppServerProfile(); + let fileHolders : Array = []; + // Valid URIs + let uris: Array = ['test1.jpg', 'test2.jpg']; + for (let i = 0; i < uris.length; i++) { + let filePath = uris[i]; + console.info('opp deal filePath is :' + filePath); + let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); + let stat: fs.Stat = fs.statSync(file.fd); + let fileHolder: opp.FileHolder = { + filePath:filePath, + fileSize:stat.size, + fileFd:file.fd + }; + fileHolders.push(fileHolder); + } + oppProfile.sendFile("11:22:33:44:55:66", fileHolders); + // After the file transfer is complete, call fs.close(file.fd) to close the file descriptor. +} catch (err) { + console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); +} +``` + +### setIncomingFileConfirmation + +setIncomingFileConfirmation(accept: boolean, fileFd: number): Promise<void> + +Receives files over Bluetooth. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------- | --------------------------- | ---- | ------------------------ | +| accept | boolean | Yes | Whether to accept the file transfer request. The value **true** means to accept the file transfer request, and the value **false** means the opposite.| +| fileFd | number| Yes | File descriptor, which must be enabled during file receiving.| + +**Error codes** + +For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bluetooth Error Codes](errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|201 | Permission denied. | +|202 | Permission denied. Non-system applications are not allowed to use system APIs. | +|203 | This function is prohibited by enterprise management policies. | +|401 | Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3. Parameter verification failed. | +|801 | Capability not supported. | +|2900001 | Service stopped. | +|2900003 | Bluetooth disabled. | +|2900004 | Profile is not supported. | +|2900099 | Failed to confirm the received file information. | +|2903002 | Current Transfer Information is busy. | +|2903003 | The file is not accessible. | + +**Example** + +```js +import { BusinessError } from '@kit.BasicServicesKit'; +import { fileIo } from '@kit.CoreFileKit'; +import { opp } from '@kit.ConnectivityKit'; +// Create fileHolders. +try { + let oppProfile = opp.createOppServerProfile(); + let pathDir = this.context.filesDir + "/test.jpg"; + let file = fs.openSync(pathDir, fs.OpenMode.CREATE | fs.OpenMode.READ_WRITE); + oppProfile.setIncomingFileConfirmation(true, file.fd); + // Close the file descriptor after file receiving is complete. + fs.close(file.fd); +} catch (err) { + console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); +} +``` + +### on('transferStateChange') + +on(type: 'transferStateChange', callback: Callback<OppTransferInformation>): void + +Subscribes to the progress and status changes of Bluetooth file transfer. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The field has a fixed value of **transferStateChange**. After **on('transferStateChange')** is called, the file transfer progress and status change events will be returned.| +| callback | Callback<[OppTransferInformation](#opptransferinformation)> | Yes | Callback used to return the file transfer progress and status change events. | + +**Error codes** + +For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bluetooth Error Codes](errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|201 | Permission denied. | +|202 | Permission denied. Non-system applications are not allowed to use system APIs. | +|203 | This function is prohibited by enterprise management policies. | +|401 | Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3. Parameter verification failed. | +|801 | Capability not supported. | +|2900001 | Service stopped. | +|2900003 | Bluetooth disabled. | +|2900004 | Profile is not supported. | +|2903001 | The file type is not supported. | +|2903002 | Current Transfer Information is busy. | +|2903003 | The file is not accessible. | + +**Example** + +```js +import { BusinessError } from '@kit.BasicServicesKit'; +import { fileIo } from '@kit.CoreFileKit'; +import { opp } from '@kit.ConnectivityKit'; +// Create fileHolders. +try { + let oppProfile = opp.createOppServerProfile(); + oppProfile.on("transferStateChange", (data: opp.OppTransferInformation) => { + if (data.status == opp.TransferStatus.PENDING) { + console.info("[opp_js] waiting to transfer : " + data.remoteDeviceName); + } else if (data.status == opp.TransferStatus.RUNNING){ + console.info("[opp_js] running data.currentBytes " + data.currentBytes + " data.totalBytes" + data.totalBytes); + } else if (data.status == opp.TransferStatus.FINISH){ + console.info("[opp_js] transfer finished, result is " + data.result); + } + }); +} catch (err) { + console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); +} +``` + +### off('transferStateChange') + +off(type: 'transferStateChange', callback?: Callback<OppTransferInformation>): void + +Unsubscribes from the progress and status changes of Bluetooth file transfer. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The field has a fixed value of **transferStateChange**. After **off('transferStateChange')** is called, the file transfer progress and status change events will not be returned.| + +**Error codes** + +For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bluetooth Error Codes](errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|201 | Permission denied. | +|202 | Permission denied. Non-system applications are not allowed to use system APIs. | +|203 | This function is prohibited by enterprise management policies. | +|801 | Capability not supported. | +|2900001 | Service stopped. | +|2900003 | Bluetooth disabled. | +|2900004 | Profile is not supported. | +|2903001 | The file type is not supported. | +|2903002 | Current Transfer Information is busy. | +|2903003 | The file is not accessible. | + +**Example** + +```js +import { BusinessError } from '@kit.BasicServicesKit'; +import { fileIo } from '@kit.CoreFileKit'; +import { opp } from '@kit.ConnectivityKit'; +// Create fileHolders. +try { + let oppProfile = opp.createOppServerProfile(); + oppProfile.off("transferStateChange"); +} catch (err) { + console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); +} +``` + +### on('receiveIncomingFile') + +on(type: 'receiveIncomingFile', callback: Callback<OppTransferInformation>): void + +Subscribes to Bluetooth file transfer start events. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The field has a fixed value of **receiveIncomingFile**. After **on('receiveIncomingFile')** is called, an event will be returned when file transfer begins.| +| callback | Callback<[OppTransferInformation](#opptransferinformation)> | Yes | Callback used to return the file transfer progress and status change events. | + +**Error codes** + +For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bluetooth Error Codes](errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|201 | Permission denied. | +|202 | Permission denied. Non-system applications are not allowed to use system APIs. | +|203 | This function is prohibited by enterprise management policies. | +|801 | Capability not supported. | +|2900001 | Service stopped. | +|2900003 | Bluetooth disabled. | +|2900004 | Profile is not supported. | +|2903001 | The file type is not supported. | +|2903002 | Current Transfer Information is busy. | +|2903003 | The file is not accessible. | + +**Example** + +```js +import { BusinessError } from '@kit.BasicServicesKit'; +import { fileIo } from '@kit.CoreFileKit'; +import { opp } from '@kit.ConnectivityKit'; +// Create fileHolders. +try { + let oppProfile = opp.createOppServerProfile(); + oppProfile.on("receiveIncomingFile", (data: opp.OppTransferInformation) => { + if (data.status == opp.TransferStatus.PENDING) { + console.info("[opp_js] received file waiting to confirm : " + data.remoteDeviceName); + } else if (data.status == opp.TransferStatus.RUNNING){ + console.info("[opp_js] running data.currentBytes " + data.currentBytes + " data.totalBytes" + data.totalBytes); + } else if (data.status == opp.TransferStatus.FINISH){ + console.info("[opp_js] transfer finished, result is " + data.result); + } + }); +} catch (err) { + console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); +} +``` + +### off('receiveIncomingFile') + +off(type: 'receiveIncomingFile', callback?: Callback<OppTransferInformation>): void + +Unsubscribes from Bluetooth file transfer completion events. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The field has a fixed value of **receiveIncomingFile**. After **off('receiveIncomingFile')** is called, an event will be returned when file transfer is complete.| + +**Error codes** + +For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bluetooth Error Codes](errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|201 | Permission denied. | +|202 | Permission denied. Non-system applications are not allowed to use system APIs. | +|203 | This function is prohibited by enterprise management policies. | +|801 | Capability not supported. | +|2900001 | Service stopped. | +|2900003 | Bluetooth disabled. | +|2900004 | Profile is not supported. | +|2903001 | The file type is not supported. | +|2903002 | Current Transfer Information is busy. | +|2903003 | The file is not accessible. | + +**Example** + +```js +import { BusinessError } from '@kit.BasicServicesKit'; +import { fileIo } from '@kit.CoreFileKit'; +import { opp } from '@kit.ConnectivityKit'; +// Create fileHolders. +try { + let oppProfile = opp.createOppServerProfile(); + oppProfile.off("receiveIncomingFile"); +} catch (err) { + console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); +} +``` + +### cancelTransfer + +cancelTransfer(): Promise<void> + +Cancels Bluetooth file transfer. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Error codes** + +For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bluetooth Error Codes](errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|201 | Permission denied. | +|202 | Permission denied. Non-system applications are not allowed to use system APIs. | +|203 | This function is prohibited by enterprise management policies. | +|801 | Capability not supported. | +|2900001 | Service stopped. | +|2900003 | Bluetooth disabled. | +|2900004 | Profile is not supported. | +|2900099 | Failed to cancel the current transfer. | +|2903002 | Current Transfer Information is busy. | + +**Example** + +```js +import { BusinessError } from '@kit.BasicServicesKit'; +import { fileIo } from '@kit.CoreFileKit'; +import { opp } from '@kit.ConnectivityKit'; +// Create fileHolders. +try { + let oppProfile = opp.createOppServerProfile(); + oppProfile.cancelTransfer(); +} catch (err) { + console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); +} +``` + +### getCurrentTransferInformation + +getCurrentTransferInformation(): Promise<[OppTransferInformation](#opptransferinformation)> + +Obtains the information about the file that is being transferred. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Error codes** + +For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bluetooth Error Codes](errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|201 | Permission denied. | +|202 | Permission denied. Non-system applications are not allowed to use system APIs. | +|203 | This function is prohibited by enterprise management policies. | +|801 | Capability not supported. | +|2900001 | Service stopped. | +|2900003 | Bluetooth disabled. | +|2900004 | Profile is not supported. | +|2900099 | Failed to obtain the current transmission information. | +|2903004 | Current Transfer Information is empty. | + +**Example** + +```js +import { BusinessError } from '@kit.BasicServicesKit'; +import { fileIo } from '@kit.CoreFileKit'; +import { opp } from '@kit.ConnectivityKit'; +// Create fileHolders. +try { + let oppProfile = opp.createOppServerProfile(); + let data = oppProfile.getCurrentTransferInformation(); + console.info('[opp_js] data ', data.status); +} catch (err) { + console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); +} +``` + +### setLastReceivedFileUri + +setLastReceivedFileUri(uri: string): Promise<void> + +Sets the URI of the last received file. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------- | --------------------------- | ---- | ------------------------ | +| uri | string | Yes | URI of the last received file.| + +**Error codes** + +For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bluetooth Error Codes](errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|201 | Permission denied. | +|202 | Permission denied. Non-system applications are not allowed to use system APIs. | +|203 | This function is prohibited by enterprise management policies. | +|401 | Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3. Parameter verification failed. | +|801 | Capability not supported. | +|2900001 | Service stopped. | +|2900003 | Bluetooth disabled. | +|2900004 | Profile is not supported. | +|2900099 | Failed to set the URI of the last file. | + +**Example** + +```js +import { BusinessError } from '@kit.BasicServicesKit'; +import { fileIo } from '@kit.CoreFileKit'; +import { opp } from '@kit.ConnectivityKit'; +// Create fileHolders. +try { + let oppProfile = opp.createOppServerProfile(); + oppProfile.setLastReceivedFileUri("file://media/Photo/1/IMG_1739266559_000/screenshot_20250211_173419.jpg "); +} catch (err) { + console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); +} +``` + +## FileHolder + +Describes the information about the file to be sent. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Type | Readable | Writable | Description | +| --------------- | ---------------------------------------- | ---- | ---- | ---------------------------------------- | +| filePath | string | Yes | Yes | URI of the file to be sent, for example, **file://media/Photo/1/IMG_1739266559_000/test.jpg**.| +| fileSize | number | Yes | Yes | Size of the file to be sent, in bytes. | +| fileFd | number | Yes | Yes | Opened file descriptor of the file to be sent. The file descriptor must be kept open until the file transfer is complete. | + +## OppTransferInformation + +Describes the file transfer information. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Type | Readable | Writable | Description | +| --------------- | ---------------------------------------- | ---- | ---- | ---------------------------------------- | +| filePath | string | Yes | Yes | URI of the file to be sent, for example, **file://media/Photo/1/IMG_1739266559_000/test.jpg**.| +| remoteDeviceName | string | Yes | Yes | Name of the peer device. | +| remoteDeviceId | number | Yes | Yes | MAC address of the peer device. | +| direction | [DirectionType](#directiontype) | Yes | Yes | Transfer direction. | +| status | [TransferStatus](#transferstatus) | Yes | Yes | Transfer status. | +| result | [TransferResult](#transferresult) | Yes | Yes | Transfer result. | +| currentBytes | number | Yes | Yes | Number of transferred bytes. | +| totalBytes | number | Yes | Yes | Total number of bytes to be transferred. | +| currentCount | number | Yes | Yes | Sequence number of the file to be transferred. | +| totalCount | number | Yes | Yes | Total number of transferred files. | + +## DirectionType + +Enumerates file transfer directions. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Value | Description | +| --------------------- | ---- | ------------ | +| OUTBOUND | 0 | File sending.| +| INBOUND | 1 | File receiving. | + +## TransferStatus + +Enumerates the file transfer states. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Value | Description | +| --------------------- | ---- | ------------ | +| PENDING | 0 | Waiting for transfer.| +| RUNNING | 1 | File transfer in progress. | +| FINISH | 2 | File transfer completed. | + +## TransferResult + +Enumerates file transfer results. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Value | Description | +| --------------------- | ---- | ------------ | +| SUCCESS | 0 | File transfer is successful.| +| ERROR_UNSUPPORTED_TYPE | 1 | The type of files to be transferred is not supported. | +| ERROR_BAD_REQUEST | 2 | The peer device cannot process the file transfer request. | +| ERROR_NOT_ACCEPTABLE | 3 | The peer device rejects the file transfer request.| +| ERROR_CANCELED | 4 | The peer device cancels the file transfer. | +| ERROR_CONNECTION_FAILED | 5 | The peer device is disconnected. | +| ERROR_TRANSFER | 6 | An error occurs during file transfer.| +| ERROR_UNKNOWN | 7 | An unknown error occurs. | diff --git a/en/application-dev/reference/apis-core-file-kit/Readme-EN.md b/en/application-dev/reference/apis-core-file-kit/Readme-EN.md index 181a4b05697..5d8db2bbbe2 100644 --- a/en/application-dev/reference/apis-core-file-kit/Readme-EN.md +++ b/en/application-dev/reference/apis-core-file-kit/Readme-EN.md @@ -22,10 +22,11 @@ - [@ohos.file.fileAccess (User File Access and Management) (System API)](js-apis-fileAccess-sys.md) - [@ohos.file.fileExtensionInfo (User File Access and Management Attribute Information) (System API)](js-apis-fileExtensionInfo-sys.md) - [@ohos.file.keyManager (User Key Management) (System API)](js-apis-file-keymanager-sys.md) + - [@ohos.file.picker (Picker) (System API)](js-apis-file-picker-sys.md) - [@ohos.file.recent (Latest Access List) (System API)](js-apis-file-recent-sys.md) - [@ohos.file.storageStatistics (Application Space Statistics) (System API)](js-apis-file-storage-statistics-sys.md) - [@ohos.file.trash (Trash) (System API)](js-apis-file-trash-sys.md) - - [@ohos.file.volumeManager (volume Management) (System API)](js-apis-file-volumemanager-sys.md) + - [@ohos.file.volumeManager (Volume Management) (System API)](js-apis-file-volumemanager-sys.md) - [@ohos.filemanagement.userFileManager (User Data Management) (System API)](js-apis-userFileManager-sys.md) - [@ohos.fileshare (File Sharing) (System API)](js-apis-fileShare-sys.md) diff --git a/en/application-dev/reference/apis-core-file-kit/js-apis-file-picker-sys.md b/en/application-dev/reference/apis-core-file-kit/js-apis-file-picker-sys.md new file mode 100644 index 00000000000..59e3837efd2 --- /dev/null +++ b/en/application-dev/reference/apis-core-file-kit/js-apis-file-picker-sys.md @@ -0,0 +1,41 @@ +# @ohos.file.picker (Picker) (System API) + +The **Picker** module encapsulates APIs such as **PhotoViewPicker**, **DocumentViewPicker**, and **AudioViewPicker** to provide capabilities of selecting and saving files of different types. An application can select the API as required. The APIs of this module must be called in UIAbility. Otherwise, the **photoPicker** or **FilePicker** cannot be started. +> **NOTE** +> +> - The initial APIs of this module are supported since API version 9. Updates will be marked with a superscript to indicate their earliest API version. +> - This topic describes only the system APIs provided by the module. For details about its public APIs, see [@ohos.file.picker (Picker)](js-apis-file-picker.md). + +## Modules to Import + +```ts +import { picker } from '@kit.CoreFileKit'; +``` + +## DocumentSelectOptions + +Defines the options for selecting documents. + +**Atomic service API**: This API can be used in atomic services since API version 12.
+ +**System capability**: SystemCapability.FileManagement.UserFileService
+ +### Properties + +| Name | Type | Read-Only | Optional | Description | +| :---------------------- |---------------------------------------------| ---- | ---- |------------------------------------------| +| themeColor18+ | [CustomColors](../apis-arkui/js-apis-arkui-theme.md#customcolors) | No | Yes|Theme color parameter. By default, it is left empty and follows the color settings of the **FilePicker**. When it is set to specific theme color properties, such as [brand, fontPrimary, compBackgroundEmphasize, and iconFourth](../apis-arkui/js-apis-arkui-theme.md#colors), the launched **FilePicker** will adapt to the theme color accordingly.
**System capability**: SystemCapability.FileManagement.UserFileService. Only mobile phones are supported.| + +## DocumentSaveOptions + +Defines the options for saving documents. + +**Atomic service API**: This API can be used in atomic services since API version 12. + +**System capability**: SystemCapability.FileManagement.UserFileService + +### Properties + +| Name | Type | Read-Only | Optional |Description | +| :---------------------- |---------------------------------------------| ----- |--------| ------------------------------------------| +| themeColor18+ | [CustomColors](../apis-arkui/js-apis-arkui-theme.md#customcolors) | No | Yes| Theme color parameter. By default, it is left empty and follows the color settings of the **FilePicker**. When it is set to specific theme color properties, such as [fontEmphasize and compBackgroundEmphasize](../apis-arkui/js-apis-arkui-theme.md#colors), the launched **FilePicker** will adapt to the theme color accordingly.
**System capability**: SystemCapability.FileManagement.UserFileService. Only mobile phones are supported.| diff --git a/en/application-dev/reference/apis-ffrt-kit/Readme-EN.md b/en/application-dev/reference/apis-ffrt-kit/Readme-EN.md index 5b822074f9b..2dd764fffbf 100644 --- a/en/application-dev/reference/apis-ffrt-kit/Readme-EN.md +++ b/en/application-dev/reference/apis-ffrt-kit/Readme-EN.md @@ -8,6 +8,7 @@ - [loop.h](loop_8h.md) - [mutex.h](mutex_8h.md) - [queue.h](queue_8h.md) + - [shared_mutex.h](shared__mutex_8h.md) - [sleep.h](sleep_8h.md) - [task.h](task_8h.md) - [timer.h](timer_8h.md) @@ -21,4 +22,6 @@ - [ffrt_mutex_t](ffrt__mutex__t.md) - [ffrt_mutexattr_t](ffrt__mutexattr__t.md) - [ffrt_queue_attr_t](ffrt__queue__attr__t.md) + - [ffrt_rwlock_t](ffrt__rwlock__t.md) + - [ffrt_rwlockattr_t](ffrt__rwlockattr__t.md) - [ffrt_task_attr_t](ffrt__task__attr__t.md) diff --git a/en/application-dev/reference/apis-ffrt-kit/_f_f_r_t.md b/en/application-dev/reference/apis-ffrt-kit/_f_f_r_t.md index 3942ace932e..d0f8f1007dd 100644 --- a/en/application-dev/reference/apis-ffrt-kit/_f_f_r_t.md +++ b/en/application-dev/reference/apis-ffrt-kit/_f_f_r_t.md @@ -21,6 +21,7 @@ Function Flow Runtime (FFRT) is a software runtime library that works with the F | [loop.h](loop_8h.md) | Declares the loop interfaces in C. | | [mutex.h](mutex_8h.md) | Declares the mutex interfaces in C. | | [queue.h](queue_8h.md) | Declares the queue interfaces in C. | +| [shared_mutex.h](shared__mutex_8h.md) | Declares read-write lock interfaces in C. | | [sleep.h](sleep_8h.md) | Declares the sleep and yield interfaces in C. | | [task.h](task_8h.md) | Declares the task interfaces in C. | | [timer.h](timer_8h.md) | Declares the timer interfaces in C. | @@ -38,7 +39,9 @@ Function Flow Runtime (FFRT) is a software runtime library that works with the F | struct  [ffrt_queue_attr_t](ffrt__queue__attr__t.md) | Describes a queue attribute. | | struct  [ffrt_condattr_t](ffrt__condattr__t.md) | Describes a condition variable attribute. | | struct  [ffrt_mutexattr_t](ffrt__mutexattr__t.md) | Describes a mutex attribute. | +| struct  [ffrt_rwlockattr_t](ffrt__rwlockattr__t.md) | Describes a read-write lock attribute. | | struct  [ffrt_mutex_t](ffrt__mutex__t.md) | Describes a mutex. | +| struct  [ffrt_rwlock_t](ffrt__rwlock__t.md) | Describes a read-write lock. | | struct  [ffrt_cond_t](ffrt__cond__t.md) | Describes a condition variable. | @@ -60,14 +63,14 @@ Function Flow Runtime (FFRT) is a software runtime library that works with the F | Name| Description| | -------- | -------- | -| [ffrt_queue_type_t](#ffrt_queue_type_t) {
ffrt_queue_serial,
ffrt_queue_concurrent,
ffrt_queue_max
} | Enumerates the queue types. | -| [ffrt_queue_priority_t](#ffrt_queue_priority_t) {
ffrt_queue_priority_immediate = 0,
ffrt_queue_priority_high,
ffrt_queue_priority_low,
ffrt_queue_priority_idle
} | Enumerates the task priority types. | -| [ffrt_qos_default_t](#ffrt_qos_default_t) {
ffrt_qos_inherit = -1,
ffrt_qos_background,
ffrt_qos_utility,
ffrt_qos_default,
ffrt_qos_user_initiated
} | Enumerates the task QoS types. | -| [ffrt_storage_size_t](#ffrt_storage_size_t) {
ffrt_task_attr_storage_size = 128,
ffrt_auto_managed_function_storage_size = 64 + sizeof(ffrt_function_header_t),
ffrt_mutex_storage_size = 64,
ffrt_cond_storage_size = 64,
ffrt_queue_attr_storage_size = 128
} | Enumerates the storage sizes available for different types of structs. | -| [ffrt_function_kind_t](#ffrt_function_kind_t) {
ffrt_function_kind_general,
ffrt_function_kind_queue
} | Enumerates the task types. | -| [ffrt_dependence_type_t](#ffrt_dependence_type_t) {
ffrt_dependence_data,
ffrt_dependence_task
} | Enumerates the dependency types. | -| [ffrt_error_t](#ffrt_error_t) {
ffrt_error = -1,
ffrt_success = 0,
ffrt_error_nomem = ENOMEM,
ffrt_error_timedout = ETIMEDOUT,
ffrt_error_busy = EBUSY,
ffrt_error_inval = EINVAL
} | Enumerates the FFRT error codes. | -| [ffrt_mutex_type](#ffrt_mutex_type) {
ffrt_mutex_normal = 0,
ffrt_mutex_recursive = 2,
ffrt_mutex_default = ffrt_mutex_normal
} | Enumerates the mutex types. | +| [ffrt_queue_type_t](#ffrt_queue_type_t) { ffrt_queue_serial, ffrt_queue_concurrent, ffrt_queue_max } | Enumerates the queue types. | +| [ffrt_queue_priority_t](#ffrt_queue_priority_t) { ffrt_queue_priority_immediate = 0, ffrt_queue_priority_high, ffrt_queue_priority_low, ffrt_queue_priority_idle } | Enumerates the task priority types. | +| [ffrt_qos_default_t](#ffrt_qos_default_t) {
ffrt_qos_inherit = -1, ffrt_qos_background, ffrt_qos_utility, ffrt_qos_default,
ffrt_qos_user_initiated
} | Enumerates the task QoS types. | +| [ffrt_storage_size_t](#ffrt_storage_size_t) {
ffrt_task_attr_storage_size = 128, ffrt_auto_managed_function_storage_size = 64 + sizeof(ffrt_function_header_t), ffrt_mutex_storage_size = 64, ffrt_cond_storage_size = 64,
ffrt_queue_attr_storage_size = 128, ffrt_rwlock_storage_size = 64
} | Enumerates the storage sizes available for different types of structs. | +| [ffrt_function_kind_t](#ffrt_function_kind_t) { ffrt_function_kind_general, ffrt_function_kind_queue } | Enumerates the task types. | +| [ffrt_dependence_type_t](#ffrt_dependence_type_t) { ffrt_dependence_data, ffrt_dependence_task } | Enumerates the dependency types. | +| [ffrt_error_t](#ffrt_error_t) {
ffrt_error = -1, ffrt_success = 0, ffrt_error_nomem = ENOMEM, ffrt_error_timedout = ETIMEDOUT,
ffrt_error_busy = EBUSY, ffrt_error_inval = EINVAL
} | Enumerates the FFRT error codes. | +| [ffrt_mutex_type](#ffrt_mutex_type) { ffrt_mutex_normal = 0, ffrt_mutex_recursive = 2, ffrt_mutex_default = ffrt_mutex_normal } | Enumerates the mutex types. | ### Functions @@ -114,6 +117,13 @@ Function Flow Runtime (FFRT) is a software runtime library that works with the F | FFRT_C_API int [ffrt_queue_cancel](#ffrt_queue_cancel) ([ffrt_task_handle_t](#ffrt_task_handle_t) handle) | Cancels a task in the queue. | | FFRT_C_API [ffrt_queue_t](#ffrt_queue_t) [ffrt_get_main_queue](#ffrt_get_main_queue) (void) | Obtains the main thread queue. | | FFRT_C_API [ffrt_queue_t](#ffrt_queue_t) [ffrt_get_current_queue](#ffrt_get_current_queue) (void) | Obtains the ArkTS Worker thread queue. | +| FFRT_C_API int [ffrt_rwlock_init](#ffrt_rwlock_init) ([ffrt_rwlock_t](ffrt__rwlock__t.md) \*rwlock, const [ffrt_rwlockattr_t](ffrt__rwlockattr__t.md) \*attr) | Initializes a read-write lock. | +| FFRT_C_API int [ffrt_rwlock_wrlock](#ffrt_rwlock_wrlock) ([ffrt_rwlock_t](ffrt__rwlock__t.md) \*rwlock) | Obtains a write lock. | +| FFRT_C_API int [ffrt_rwlock_trywrlock](#ffrt_rwlock_trywrlock) ([ffrt_rwlock_t](ffrt__rwlock__t.md) \*rwlock) | Attempts to obtain a write lock; if it fails, the function returns immediately. | +| FFRT_C_API int [ffrt_rwlock_rdlock](#ffrt_rwlock_rdlock) ([ffrt_rwlock_t](ffrt__rwlock__t.md) \*rwlock) | Obtains a read lock. | +| FFRT_C_API int [ffrt_rwlock_tryrdlock](#ffrt_rwlock_tryrdlock) ([ffrt_rwlock_t](ffrt__rwlock__t.md) \*rwlock) | Attempts to obtain a read lock; if it fails, the function returns immediately. | +| FFRT_C_API int [ffrt_rwlock_unlock](#ffrt_rwlock_unlock) ([ffrt_rwlock_t](ffrt__rwlock__t.md) \*rwlock) | Releases the read-write lock. | +| FFRT_C_API int [ffrt_rwlock_destroy](#ffrt_rwlock_destroy) ([ffrt_rwlock_t](ffrt__rwlock__t.md) \*rwlock) | Destroys the read-write lock. | | FFRT_C_API int [ffrt_usleep](#ffrt_usleep) (uint64_t usec) | Sets the fixed sleep time. | | FFRT_C_API void [ffrt_yield](#ffrt_yield) (void) | Passes control to other tasks so that they can be executed. | | FFRT_C_API int [ffrt_task_attr_init](#ffrt_task_attr_init) ([ffrt_task_attr_t](ffrt__task__attr__t.md) \*attr) | Initializes a task attribute. | @@ -545,10 +555,10 @@ FFRT_C_API ffrt_queue_t ffrt_get_current_queue (void ) **Description** Obtains the ArkTS Worker thread queue. -**Since**: 12 - **Deprecated version**: 18 +**Since**: 12 + **Returns** Returns the handle to the thread queue. @@ -690,7 +700,7 @@ Starts the timer on a loop. | Name| Description| | -------- | -------- | | loop | Loop object. | -| timeout | Timeout duration of the timer. | +| timeout | Timeout period, in milliseconds. | | data | Pointer to the input parameter in the callback function invoked upon event changes. | | cb | Callback function invoked upon event changes. | | repeat | Whether to repeat the timer. | @@ -846,7 +856,7 @@ Destroys the mutex attribute. This API needs to be called by users. **Returns** -Returns **ffrt_success** if the mutex is destroyed; returns **ffrt_error_inval** otherwise. +Returns **ffrt_success** if the mutex attribute is destroyed; returns **ffrt_error_inval** otherwise. ### ffrt_mutexattr_gettype() @@ -889,7 +899,7 @@ Initializes the mutex attribute. **Returns** -Returns **ffrt_success** if the mutex is initialized; returns **ffrt_error_inval** otherwise. +Returns **ffrt_success** if the mutex attribute is initialized; returns **ffrt_error_inval** otherwise. ### ffrt_mutexattr_settype() @@ -1105,7 +1115,7 @@ Sets the queue timeout. | Name| Description| | -------- | -------- | | attr | Pointer to the queue attribute. | -| timeout_us | Timeout. | +| timeout_us | Queue timeout, in microseconds. | ### ffrt_queue_cancel() @@ -1228,6 +1238,154 @@ Waits until a task in the queue is complete. | handle | Task handle. | +### ffrt_rwlock_destroy() + +``` +FFRT_C_API int ffrt_rwlock_destroy (ffrt_rwlock_t * rwlock) +``` +**Description** +Destroys the read-write lock. + +**Since**: 18 + +**Parameters** + +| Name| Description| +| -------- | -------- | +| rwlock | Pointer to the read-write lock. | + +**Returns** + +Returns **ffrt_success** if the read-write lock is successfully destroyed; returns **ffrt_error_inval** otherwise. For details, see [ffrt_error_t](#ffrt_error_t). + + +### ffrt_rwlock_init() + +``` +FFRT_C_API int ffrt_rwlock_init (ffrt_rwlock_t * rwlock, const ffrt_rwlockattr_t * attr ) +``` +**Description** +Initializes a read-write lock. + +**Since**: 18 + +**Parameters** + +| Name| Description| +| -------- | -------- | +| rwlock | Pointer to the read-write lock. | +| attr | Pointer to the read-write attribute. | + +**Returns** + +Returns **ffrt_success** if the read-write lock is successfully initialized; returns **ffrt_error_inval** otherwise. For details, see [ffrt_error_t](#ffrt_error_t). + + +### ffrt_rwlock_rdlock() + +``` +FFRT_C_API int ffrt_rwlock_rdlock (ffrt_rwlock_t * rwlock) +``` +**Description** +Obtains a read lock. + +**Since**: 18 + +**Parameters** + +| Name| Description| +| -------- | -------- | +| rwlock | Pointer to the read-write lock. | + +**Returns** + +Returns **ffrt_success** if the read lock is successfully obtained; returns **ffrt_error_inval** otherwise or blocks the task. For details, see [ffrt_error_t](#ffrt_error_t). + + +### ffrt_rwlock_tryrdlock() + +``` +FFRT_C_API int ffrt_rwlock_tryrdlock (ffrt_rwlock_t * rwlock) +``` +**Description** +Attempts to obtain a read lock; if it fails, the function returns immediately. + +**Since**: 18 + +**Parameters** + +| Name| Description| +| -------- | -------- | +| rwlock | Pointer to the read-write lock. | + +**Returns** + +Returns **ffrt_success** if the read lock is obtained successfully; returns **ffrt_error_inval** if the lock does not exist; returns **ffrt_error_busy** if the read lock fails to be obtained. For details, see [ffrt_error_t](#ffrt_error_t). + + +### ffrt_rwlock_trywrlock() + +``` +FFRT_C_API int ffrt_rwlock_trywrlock (ffrt_rwlock_t * rwlock) +``` +**Description** +Attempts to obtain a write lock; if it fails, the function returns immediately. + +**Since**: 18 + +**Parameters** + +| Name| Description| +| -------- | -------- | +| rwlock | Pointer to the read-write lock. | + +**Returns** + +Returns **ffrt_success** if the write lock is obtained successfully; returns **ffrt_error_inval** if the lock does not exist; returns **ffrt_error_busy** if the write lock fails to be obtained. For details, see [ffrt_error_t](#ffrt_error_t). + + +### ffrt_rwlock_unlock() + +``` +FFRT_C_API int ffrt_rwlock_unlock (ffrt_rwlock_t * rwlock) +``` +**Description** +Releases the read-write lock. + +**Since**: 18 + +**Parameters** + +| Name| Description| +| -------- | -------- | +| rwlock | Pointer to the read-write lock. | + +**Returns** + +Returns **ffrt_success** if the read-write lock is successfully released; returns **ffrt_error_inval** otherwise. For details, see [ffrt_error_t](#ffrt_error_t). + + +### ffrt_rwlock_wrlock() + +``` +FFRT_C_API int ffrt_rwlock_wrlock (ffrt_rwlock_t * rwlock) +``` +**Description** +Obtains a write lock. + +**Since**: 18 + +**Parameters** + +| Name| Description| +| -------- | -------- | +| rwlock | Pointer to the read-write lock. | + +**Returns** + +Returns **ffrt_success** if the write lock is successfully obtained; returns **ffrt_error_inval** otherwise or blocks the task. For details, see [ffrt_error_t](#ffrt_error_t). + + ### ffrt_submit_base() ``` @@ -1630,7 +1788,7 @@ Starts the timer. | Name| Description| | -------- | -------- | | qos | QoS. | -| timeout | Timeout duration of the timer. | +| timeout | Timeout period, in milliseconds. | | data | Pointer to the input parameter in the callback function invoked upon a timeout. | | cb | Callback function invoked upon a timeout. | | repeat | Whether to repeat the timer (not supported yet). | diff --git a/en/application-dev/reference/apis-ffrt-kit/ffrt__cond__t.md b/en/application-dev/reference/apis-ffrt-kit/ffrt__cond__t.md index 6b57063acf9..271d6e8a9a8 100644 --- a/en/application-dev/reference/apis-ffrt-kit/ffrt__cond__t.md +++ b/en/application-dev/reference/apis-ffrt-kit/ffrt__cond__t.md @@ -9,6 +9,7 @@ The **ffrt_cond_t** struct describes a condition variable. **Related module**: [FFRT](_f_f_r_t.md) +**Header file**: [type_def.h](type__def_8h.md) ## Summary diff --git a/en/application-dev/reference/apis-ffrt-kit/ffrt__condattr__t.md b/en/application-dev/reference/apis-ffrt-kit/ffrt__condattr__t.md index 9887fd112d0..97951cdbf7b 100644 --- a/en/application-dev/reference/apis-ffrt-kit/ffrt__condattr__t.md +++ b/en/application-dev/reference/apis-ffrt-kit/ffrt__condattr__t.md @@ -9,6 +9,7 @@ The **ffrt_condattr_t** struct describes a condition variable attribute. **Related module**: [FFRT](_f_f_r_t.md) +**Header file**: [type_def.h](type__def_8h.md) ## Summary diff --git a/en/application-dev/reference/apis-ffrt-kit/ffrt__dependence__t.md b/en/application-dev/reference/apis-ffrt-kit/ffrt__dependence__t.md index 1e7a339c39e..9ec3074c54e 100644 --- a/en/application-dev/reference/apis-ffrt-kit/ffrt__dependence__t.md +++ b/en/application-dev/reference/apis-ffrt-kit/ffrt__dependence__t.md @@ -9,6 +9,7 @@ The **ffrt_dependence_t** struct describes dependency data. **Related module**: [FFRT](_f_f_r_t.md) +**Header file**: [type_def.h](type__def_8h.md) ## Summary diff --git a/en/application-dev/reference/apis-ffrt-kit/ffrt__deps__t.md b/en/application-dev/reference/apis-ffrt-kit/ffrt__deps__t.md index b207c70a8d4..0e186cc8b90 100644 --- a/en/application-dev/reference/apis-ffrt-kit/ffrt__deps__t.md +++ b/en/application-dev/reference/apis-ffrt-kit/ffrt__deps__t.md @@ -9,6 +9,7 @@ The **ffrt_dependence_t** struct describes dependencies. **Related module**: [FFRT](_f_f_r_t.md) +**Header file**: [type_def.h](type__def_8h.md) ## Summary diff --git a/en/application-dev/reference/apis-ffrt-kit/ffrt__function__header__t.md b/en/application-dev/reference/apis-ffrt-kit/ffrt__function__header__t.md index 383837bef0f..17c3f21d77d 100644 --- a/en/application-dev/reference/apis-ffrt-kit/ffrt__function__header__t.md +++ b/en/application-dev/reference/apis-ffrt-kit/ffrt__function__header__t.md @@ -7,8 +7,9 @@ The **ffrt_function_header_t** struct describes a task execution function. **Since**: 10 -Related module: [FFRT](_f_f_r_t.md) +**Related module**: [FFRT](_f_f_r_t.md) +**Header file**: [type_def.h](type__def_8h.md) ## Summary diff --git a/en/application-dev/reference/apis-ffrt-kit/ffrt__mutex__t.md b/en/application-dev/reference/apis-ffrt-kit/ffrt__mutex__t.md index a0d983ac90a..d3f444bbcae 100644 --- a/en/application-dev/reference/apis-ffrt-kit/ffrt__mutex__t.md +++ b/en/application-dev/reference/apis-ffrt-kit/ffrt__mutex__t.md @@ -9,6 +9,7 @@ The **ffrt_mutex_t** struct describes an FFRT mutex. **Related module**: [FFRT](_f_f_r_t.md) +**Header file**: [type_def.h](type__def_8h.md) ## Summary diff --git a/en/application-dev/reference/apis-ffrt-kit/ffrt__mutexattr__t.md b/en/application-dev/reference/apis-ffrt-kit/ffrt__mutexattr__t.md index 6b94db25507..6a8a7459f6d 100644 --- a/en/application-dev/reference/apis-ffrt-kit/ffrt__mutexattr__t.md +++ b/en/application-dev/reference/apis-ffrt-kit/ffrt__mutexattr__t.md @@ -9,6 +9,7 @@ The **ffrt_mutexattr_t** struct describes an FFRT mutex attribute. **Related module**: [FFRT](_f_f_r_t.md) +**Header file**: [type_def.h](type__def_8h.md) ## Summary diff --git a/en/application-dev/reference/apis-ffrt-kit/ffrt__queue__attr__t.md b/en/application-dev/reference/apis-ffrt-kit/ffrt__queue__attr__t.md index a7a293ad8c5..bbf0a7b917b 100644 --- a/en/application-dev/reference/apis-ffrt-kit/ffrt__queue__attr__t.md +++ b/en/application-dev/reference/apis-ffrt-kit/ffrt__queue__attr__t.md @@ -9,6 +9,7 @@ The **ffrt_queue_attr_t** struct describes a queue attribute. **Related module**: [FFRT](_f_f_r_t.md) +**Header file**: [type_def.h](type__def_8h.md) ## Summary diff --git a/en/application-dev/reference/apis-ffrt-kit/ffrt__rwlock__t.md b/en/application-dev/reference/apis-ffrt-kit/ffrt__rwlock__t.md new file mode 100644 index 00000000000..702408b5a61 --- /dev/null +++ b/en/application-dev/reference/apis-ffrt-kit/ffrt__rwlock__t.md @@ -0,0 +1,34 @@ +# ffrt_rwlock_t + + +## Overview + +The **ffrt_rwlock_t** struct describes an FFRT read-write lock. + +**Since**: 18 + +**Related module**: [FFRT](_f_f_r_t.md) + +**Header file**: [type_def.h](type__def_8h.md) + + +## Summary + + +### Member Variables + +| Name| Description| +| -------- | -------- | +| uint32_t [storage](#storage) ffrt_rwlock_storage_size+sizeof(uint32_t) - 1)/sizeof(uint32_t)] | Storage size of a read-write lock. | + + +## Member Variable Description + + +### storage + +``` +uint32_t ffrt_rwlock_t::storage[(ffrt_rwlock_storage_size+sizeof(uint32_t) - 1)/sizeof(uint32_t)] +``` +**Description** +Storage size of a read-write lock. diff --git a/en/application-dev/reference/apis-ffrt-kit/ffrt__rwlockattr__t.md b/en/application-dev/reference/apis-ffrt-kit/ffrt__rwlockattr__t.md new file mode 100644 index 00000000000..f85284229c2 --- /dev/null +++ b/en/application-dev/reference/apis-ffrt-kit/ffrt__rwlockattr__t.md @@ -0,0 +1,33 @@ +# ffrt_rwlockattr_t + + +## Overview + +The **ffrt_rwlockattr_t** struct describes an FFRT read-write lock attribute. + +**Since**: 18 + +**Related module**: [FFRT](_f_f_r_t.md) + +**Header file**: [type_def.h](type__def_8h.md) + +## Summary + + +### Member Variables + +| Name| Description| +| -------- | -------- | +| long [storage](#storage) | Storage size of a read-write lock. | + + +## Member Variable Description + + +### storage + +``` +long ffrt_rwlockattr_t::storage +``` +**Description** +Storage size of a read-write lock. diff --git a/en/application-dev/reference/apis-ffrt-kit/ffrt__task__attr__t.md b/en/application-dev/reference/apis-ffrt-kit/ffrt__task__attr__t.md index 8ddd5f0b0d0..d45df24a93a 100644 --- a/en/application-dev/reference/apis-ffrt-kit/ffrt__task__attr__t.md +++ b/en/application-dev/reference/apis-ffrt-kit/ffrt__task__attr__t.md @@ -9,6 +9,7 @@ The **ffrt_task_attr_t** struct describes a task attribute. **Related module**: [FFRT](_f_f_r_t.md) +**Header file**: [type_def.h](type__def_8h.md) ## Summary diff --git a/en/application-dev/reference/apis-ffrt-kit/loop_8h.md b/en/application-dev/reference/apis-ffrt-kit/loop_8h.md index c438c7c4761..e7227cbf76b 100644 --- a/en/application-dev/reference/apis-ffrt-kit/loop_8h.md +++ b/en/application-dev/reference/apis-ffrt-kit/loop_8h.md @@ -5,7 +5,7 @@ The **loop.h** file declares the loop interfaces in C. -**File to include**: <ffrt/condition_variable.h> +**File to include**: <ffrt/loop.h> **Library**: libffrt.z.so diff --git a/en/application-dev/reference/apis-ffrt-kit/shared__mutex_8h.md b/en/application-dev/reference/apis-ffrt-kit/shared__mutex_8h.md new file mode 100644 index 00000000000..b3f4b168337 --- /dev/null +++ b/en/application-dev/reference/apis-ffrt-kit/shared__mutex_8h.md @@ -0,0 +1,32 @@ +# shared_mutex.h + + +## Overview + +The **shared_mutex.h** file declares read-write lock interfaces in C. + +**File to include**: <ffrt/shared_mutex.h> + +**Library**: libffrt.z.so + +**System capability**: SystemCapability.Resourceschedule.Ffrt.Core + +**Since**: 18 + +**Related module**: [FFRT](_f_f_r_t.md) + + +## Summary + + +### Functions + +| Name| Description| +| -------- | -------- | +| FFRT_C_API int [ffrt_rwlock_init](_f_f_r_t.md#ffrt_rwlock_init) ([ffrt_rwlock_t](ffrt__rwlock__t.md) \*rwlock, const [ffrt_rwlockattr_t](ffrt__rwlockattr__t.md) \*attr) | Initializes a read-write lock. | +| FFRT_C_API int [ffrt_rwlock_wrlock](_f_f_r_t.md#ffrt_rwlock_wrlock) ([ffrt_rwlock_t](ffrt__rwlock__t.md) \*rwlock) | Obtains a write lock. | +| FFRT_C_API int [ffrt_rwlock_trywrlock](_f_f_r_t.md#ffrt_rwlock_trywrlock) ([ffrt_rwlock_t](ffrt__rwlock__t.md) \*rwlock) | Attempts to obtain a write lock; if it fails, the function returns immediately. | +| FFRT_C_API int [ffrt_rwlock_rdlock](_f_f_r_t.md#ffrt_rwlock_rdlock) ([ffrt_rwlock_t](ffrt__rwlock__t.md) \*rwlock) | Obtains a read lock. | +| FFRT_C_API int [ffrt_rwlock_tryrdlock](_f_f_r_t.md#ffrt_rwlock_tryrdlock) ([ffrt_rwlock_t](ffrt__rwlock__t.md) \*rwlock) | Attempts to obtain a read lock; if it fails, the function returns immediately. | +| FFRT_C_API int [ffrt_rwlock_unlock](_f_f_r_t.md#ffrt_rwlock_unlock) ([ffrt_rwlock_t](ffrt__rwlock__t.md) \*rwlock) | Releases the read-write lock. | +| FFRT_C_API int [ffrt_rwlock_destroy](_f_f_r_t.md#ffrt_rwlock_destroy) ([ffrt_rwlock_t](ffrt__rwlock__t.md) \*rwlock) | Destroys the read-write lock. | diff --git a/en/application-dev/reference/apis-ffrt-kit/type__def_8h.md b/en/application-dev/reference/apis-ffrt-kit/type__def_8h.md index c2f9784c9ed..4390222f12a 100644 --- a/en/application-dev/reference/apis-ffrt-kit/type__def_8h.md +++ b/en/application-dev/reference/apis-ffrt-kit/type__def_8h.md @@ -30,7 +30,9 @@ The **type_def.h** file declares the common types. | struct  [ffrt_queue_attr_t](ffrt__queue__attr__t.md) | Describes a queue attribute. | | struct  [ffrt_condattr_t](ffrt__condattr__t.md) | Describes a condition variable attribute. | | struct  [ffrt_mutexattr_t](ffrt__mutexattr__t.md) | Describes a mutex attribute. | +| struct  [ffrt_rwlockattr_t](ffrt__rwlockattr__t.md) | Describes a read-write lock attribute. | | struct  [ffrt_mutex_t](ffrt__mutex__t.md) | Describes a mutex. | +| struct  [ffrt_rwlock_t](ffrt__rwlock__t.md) | Describes a read-write lock. | | struct  [ffrt_cond_t](ffrt__cond__t.md) | Describes a condition variable. | diff --git a/en/application-dev/reference/apis-input-kit/_input___device_listener.md b/en/application-dev/reference/apis-input-kit/_input___device_listener.md deleted file mode 100644 index 7801b79c591..00000000000 --- a/en/application-dev/reference/apis-input-kit/_input___device_listener.md +++ /dev/null @@ -1,45 +0,0 @@ -# Input_DeviceListener - - -## Overview - -Defines a listener for device hot swap events. - -**Since**: 13 - -**Related module**: [Input](input.md) - -**Header file**: [oh_input_manager.h](oh__input__manager_8h.md) - -## Summary - - -### Member Variables - -| Name| Description| -| -------- | -------- | -| [Input_DeviceAddedCallback](input.md#input_deviceaddedcallback) [deviceAddedCallback](#deviceaddedcallback) | Defines a callback used to receive device insertion events. | -| [Input_DeviceRemovedCallback](input.md#input_deviceremovedcallback) [deviceRemovedCallback](#deviceremovedcallback) | Defines a callback used to receive device removal events. | - - -## Member Variable Description - - -### deviceAddedCallback - -``` -Input_DeviceAddedCallback Input_DeviceListener::deviceAddedCallback -``` -**Description** - -Defines a callback used to receive device insertion events. - - -### deviceRemovedCallback - -``` -Input_DeviceRemovedCallback Input_DeviceListener::deviceRemovedCallback -``` -**Description** - -Defines a callback used to receive device removal events. diff --git a/en/application-dev/reference/apis-input-kit/_input___interceptor_event_callback.md b/en/application-dev/reference/apis-input-kit/_input___interceptor_event_callback.md deleted file mode 100644 index 23ca4a59faa..00000000000 --- a/en/application-dev/reference/apis-input-kit/_input___interceptor_event_callback.md +++ /dev/null @@ -1,62 +0,0 @@ -# Input_InterceptorEventCallback - - -## Overview - -Defines the structure of the interceptor for callback events, including mouse events, touch events, and axis events. - -**Since**: 12 - -**Related module**: [Input](input.md) - -**Header file**: [oh_input_manager.h](oh__input__manager_8h.md) - -## Summary - - -### Member Variables - -| Name| Description| -| -------- | -------- | -| [Input_MouseEventCallback](input.md#input_mouseeventcallback) [mouseCallback](#mousecallback) | Callback for mouse events. | -| [Input_TouchEventCallback](input.md#input_toucheventcallback) [touchCallback](#touchcallback) | Callback for touch events. | -| [Input_AxisEventCallback](input.md#input_axiseventcallback) [axisCallback](#axiscallback) | Callback for axis events. | - - -## Member Variable Description - - -### axisCallback - -``` -Input_AxisEventCallback Input_InterceptorEventCallback::axisCallback -``` -**Description** - -Callback for axis events. - -**Since**: 12 - - -### mouseCallback - -``` -Input_MouseEventCallback Input_InterceptorEventCallback::mouseCallback -``` -**Description** - -Callback for mouse events. - -**Since**: 12 - - -### touchCallback - -``` -Input_TouchEventCallback Input_InterceptorEventCallback::touchCallback -``` -**Description** - -Callback for touch events. - -**Since**: 12 diff --git a/en/application-dev/reference/apis-input-kit/capi-input-axisevent.md b/en/application-dev/reference/apis-input-kit/capi-input-axisevent.md new file mode 100644 index 00000000000..af5e5a738ef --- /dev/null +++ b/en/application-dev/reference/apis-input-kit/capi-input-axisevent.md @@ -0,0 +1,11 @@ +# Input_AxisEvent + +## Overview + +Defines an axis event. + +**Since**: 12 + +**Related module**: [input](capi-input.md) + +**Header file**: [oh_input_manager.h](capi-oh-input-manager-h.md) diff --git a/en/application-dev/reference/apis-input-kit/capi-input-deviceinfo.md b/en/application-dev/reference/apis-input-kit/capi-input-deviceinfo.md new file mode 100644 index 00000000000..0e28f530890 --- /dev/null +++ b/en/application-dev/reference/apis-input-kit/capi-input-deviceinfo.md @@ -0,0 +1,11 @@ +# Input_DeviceInfo + +## Overview + +Defines the input device information. + +**Since**: 13 + +**Related module**: [input](capi-input.md) + +**Header file**: [oh_input_manager.h](capi-oh-input-manager-h.md) diff --git a/en/application-dev/reference/apis-input-kit/capi-input-devicelistener.md b/en/application-dev/reference/apis-input-kit/capi-input-devicelistener.md new file mode 100644 index 00000000000..1dc429b0720 --- /dev/null +++ b/en/application-dev/reference/apis-input-kit/capi-input-devicelistener.md @@ -0,0 +1,20 @@ +# Input_DeviceListener + +## Overview + +Defines a listener for device hot swap events. + +**Since**: 13 + +**Related module**: [input](capi-input.md) + +**Header file**: [oh_input_manager.h](capi-oh-input-manager-h.md) + +## Summary + +### Member Variables + +| Name| Description| +| -- | -- | +| Input_DeviceAddedCallback deviceAddedCallback | Defines a callback used to receive device insertion events.| +| Input_DeviceRemovedCallback deviceRemovedCallback | Defines a callback used to receive device removal events.| diff --git a/en/application-dev/reference/apis-input-kit/capi-input-hotkey.md b/en/application-dev/reference/apis-input-kit/capi-input-hotkey.md new file mode 100644 index 00000000000..fb05ba8b387 --- /dev/null +++ b/en/application-dev/reference/apis-input-kit/capi-input-hotkey.md @@ -0,0 +1,11 @@ +# Input_Hotkey + +## Overview + +Defines the shortcut key structure. + +**Since**: 14 + +**Related module**: [input](capi-input.md) + +**Header file**: [oh_input_manager.h](capi-oh-input-manager-h.md) diff --git a/en/application-dev/reference/apis-input-kit/capi-input-interceptoreventcallback.md b/en/application-dev/reference/apis-input-kit/capi-input-interceptoreventcallback.md new file mode 100644 index 00000000000..f8e47d0d54f --- /dev/null +++ b/en/application-dev/reference/apis-input-kit/capi-input-interceptoreventcallback.md @@ -0,0 +1,143 @@ +# Input_InterceptorEventCallback + +## Overview + +Defines the structure of the interceptor for callback events, including mouse events, touch events, and axis events. + +**Since**: 12 + +**Related module**: [input](capi-input.md) + +**Header file**: [oh_input_manager.h](capi-oh-input-manager-h.md) + +## Summary + +### Member Variables + +| Name| Description| +| -- | -- | +| Input_MouseEventCallback mouseCallback | Callback for mouse events.
**Since**: 12| +| Input_TouchEventCallback touchCallback | Callback for touch events.
**Since**: 12| +| Input_AxisEventCallback axisCallback | Callback for axis events.
**Since**: 12| + + +### Member Functions + +| **Name**| typedef Keyword| Description| +| -- | -- | -- | +| [typedef void (\*Input_KeyEventCallback)(const Input_KeyEvent* keyEvent)](#input_keyeventcallback) | Input_KeyEventCallback() | Defines a lifecycle callback for **keyEvent**. If the callback is triggered, **keyEvent** will be destroyed.
**Since**: 12| +| [typedef void (\*Input_MouseEventCallback)(const Input_MouseEvent* mouseEvent)](#input_mouseeventcallback) | Input_MouseEventCallback() | Defines a lifecycle callback for **mouseEvent**. If the callback is triggered, **mouseEvent** will be destroyed.
**Since**: 12| +| [typedef void (\*Input_TouchEventCallback)(const Input_TouchEvent* touchEvent)](#input_toucheventcallback) | Input_TouchEventCallback() | Defines a lifecycle callback for **touchEvent**. If the callback is triggered, **touchEvent** will be destroyed.
**Since**: 12| +| [typedef void (\*Input_AxisEventCallback)(const Input_AxisEvent* axisEvent)](#input_axiseventcallback) | Input_AxisEventCallback() | Defines a lifecycle callback for **axisEvent**. If the callback is triggered, **axisEvent** will be destroyed.
**Since**: 12| +| [typedef void (\*Input_DeviceAddedCallback)(int32_t deviceId)](#input_deviceaddedcallback) | Input_DeviceAddedCallback() | Defines a callback used to receive device insertion events.
**Since**: 13| +| [typedef void (\*Input_DeviceRemovedCallback)(int32_t deviceId)](#input_deviceremovedcallback) | Input_DeviceRemovedCallback() | Defines a callback used to receive device removal events.
**Since**: 13| + +## Member Function Description + +### Input_KeyEventCallback() + +``` +typedef void (*Input_KeyEventCallback)(const Input_KeyEvent* keyEvent) +``` + +**Description** + +Defines a lifecycle callback for **keyEvent**. If the callback is triggered, **keyEvent** will be destroyed. + +**Since**: 12 + +**Parameters** + +| Parameter| Description| +| -- | -- | +| const [Input_KeyEvent](capi-input-keyevent.md)* keyEvent | Key event object.| + +### Input_MouseEventCallback() + +``` +typedef void (*Input_MouseEventCallback)(const Input_MouseEvent* mouseEvent) +``` + +**Description** + +Defines a lifecycle callback for **mouseEvent**. If the callback is triggered, **mouseEvent** will be destroyed. + +**Since**: 12 + +**Parameters** + +| Parameter| Description| +| -- | -- | +| const [Input_MouseEvent](capi-input-mouseevent.md)* mouseEvent | Mouse event object.| + +### Input_TouchEventCallback() + +``` +typedef void (*Input_TouchEventCallback)(const Input_TouchEvent* touchEvent) +``` + +**Description** + +Defines a lifecycle callback for **touchEvent**. If the callback is triggered, **touchEvent** will be destroyed. + +**Since**: 12 + +**Parameters** + +| Parameter| Description| +| -- | -- | +| const [Input_TouchEvent](capi-input-touchevent.md)* touchEvent | Touch event object.| + +### Input_AxisEventCallback() + +``` +typedef void (*Input_AxisEventCallback)(const Input_AxisEvent* axisEvent) +``` + +**Description** + +Defines a lifecycle callback for **axisEvent**. If the callback is triggered, **axisEvent** will be destroyed. + +**Since**: 12 + +**Parameters** + +| Parameter| Description| +| -- | -- | +| const [Input_AxisEvent](capi-input-axisevent.md)* axisEvent | Axis event object.| + +### Input_DeviceAddedCallback() + +``` +typedef void (*Input_DeviceAddedCallback)(int32_t deviceId) +``` + +**Description** + +Defines a callback used to receive device insertion events. + +**Since**: 13 + +**Parameters** + +| Parameter| Description| +| -- | -- | +| int32_t deviceId | Device ID.| + +### Input_DeviceRemovedCallback() + +``` +typedef void (*Input_DeviceRemovedCallback)(int32_t deviceId) +``` + +**Description** + +Defines a callback used to receive device removal events. + +**Since**: 13 + +**Parameters** + +| Parameter| Description| +| -- | -- | +| int32_t deviceId | Device ID.| diff --git a/en/application-dev/reference/apis-input-kit/capi-input-interceptoroptions.md b/en/application-dev/reference/apis-input-kit/capi-input-interceptoroptions.md new file mode 100644 index 00000000000..bee64e21999 --- /dev/null +++ b/en/application-dev/reference/apis-input-kit/capi-input-interceptoroptions.md @@ -0,0 +1,11 @@ +# Input_InterceptorOptions + +## Overview + +Defines event interception options. + +**Since**: 12 + +**Related module**: [input](capi-input.md) + +**Header file**: [oh_input_manager.h](capi-oh-input-manager-h.md) diff --git a/en/application-dev/reference/apis-input-kit/capi-input-keyevent.md b/en/application-dev/reference/apis-input-kit/capi-input-keyevent.md new file mode 100644 index 00000000000..709d15383bf --- /dev/null +++ b/en/application-dev/reference/apis-input-kit/capi-input-keyevent.md @@ -0,0 +1,11 @@ +# Input_KeyEvent + +## Overview + +Defines the key event to be injected. + +**Since**: 12 + +**Related module**: [input](capi-input.md) + +**Header file**: [oh_input_manager.h](capi-oh-input-manager-h.md) diff --git a/en/application-dev/reference/apis-input-kit/capi-input-keystate.md b/en/application-dev/reference/apis-input-kit/capi-input-keystate.md new file mode 100644 index 00000000000..fbea3c08403 --- /dev/null +++ b/en/application-dev/reference/apis-input-kit/capi-input-keystate.md @@ -0,0 +1,11 @@ +# Input_KeyState + +## Overview + +Defines key information, which identifies a key pressing behavior. For example, the Ctrl key information contains the key value and key type. + +**Since**: 12 + +**Related module**: [input](capi-input.md) + +**Header file**: [oh_input_manager.h](capi-oh-input-manager-h.md) diff --git a/en/application-dev/reference/apis-input-kit/capi-input-mouseevent.md b/en/application-dev/reference/apis-input-kit/capi-input-mouseevent.md new file mode 100644 index 00000000000..92cecfb6083 --- /dev/null +++ b/en/application-dev/reference/apis-input-kit/capi-input-mouseevent.md @@ -0,0 +1,11 @@ +# Input_MouseEvent + +## Overview + +Defines the mouse event to be injected. + +**Since**: 12 + +**Related module**: [input](capi-input.md) + +**Header file**: [oh_input_manager.h](capi-oh-input-manager-h.md) diff --git a/en/application-dev/reference/apis-input-kit/capi-input-touchevent.md b/en/application-dev/reference/apis-input-kit/capi-input-touchevent.md new file mode 100644 index 00000000000..f6d87483d68 --- /dev/null +++ b/en/application-dev/reference/apis-input-kit/capi-input-touchevent.md @@ -0,0 +1,11 @@ +# Input_TouchEvent + +## Overview + +Defines the touch event to be injected. + +**Since**: 12 + +**Related module**: [input](capi-input.md) + +**Header file**: [oh_input_manager.h](capi-oh-input-manager-h.md) diff --git a/en/application-dev/reference/apis-input-kit/capi-input.md b/en/application-dev/reference/apis-input-kit/capi-input.md new file mode 100644 index 00000000000..4a0cb4e0014 --- /dev/null +++ b/en/application-dev/reference/apis-input-kit/capi-input.md @@ -0,0 +1,14 @@ +# input + +## Overview + +Provides C APIs for the multimodal input module. + +**Since**: 12 +## File Summary + +| **Name**| Description| +| -- | -- | +| [oh_axis_type.h](capi-oh-axis-type-h.md) | Defines the axis event structures and enumerations.| +| [oh_input_manager.h](capi-oh-input-manager-h.md) | Provides functions such as event injection and status query.| +| [oh_key_code.h](capi-oh-key-code-h.md) | Defines key codes of the key device.| diff --git a/en/application-dev/reference/apis-input-kit/capi-oh-axis-type-h.md b/en/application-dev/reference/apis-input-kit/capi-oh-axis-type-h.md new file mode 100644 index 00000000000..621f5bf611d --- /dev/null +++ b/en/application-dev/reference/apis-input-kit/capi-oh-axis-type-h.md @@ -0,0 +1,81 @@ +# oh_axis_type.h + +## Overview + +Defines the axis event structures and enumerations. + +**Library**: libohinput.so + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + +**Related module**: [input](capi-input.md) + +## Summary + +### Enums + +| **Name**| typedef Keyword| Description| +| -- | -- | -- | +| [InputEvent_AxisType](#inputevent_axistype) | InputEvent_AxisType | Provides axis types of the input device.| +| [InputEvent_AxisEventType](#inputevent_axiseventtype) | InputEvent_AxisEventType | Provides event types of the input device.| +| [InputEvent_AxisAction](#inputevent_axisaction) | InputEvent_AxisAction | Provides actions of the input device.| + +## Enum Description + +### InputEvent_AxisType + +``` +enum InputEvent_AxisType +``` + +**Description** + +Defines the axis type of an input device. + +**Since**: 12 + +| Enum| Description | +| -- |----------------| +| AXIS_TYPE_UNKNOWN | Unknown axis type, which is usually used as the initial value.| +| AXIS_TYPE_SCROLL_VERTICAL | Vertical scroll axis. When you scroll the mouse wheel or slide with one or two fingers on the touchpad, the status of the vertical scroll axis changes. | +| AXIS_TYPE_SCROLL_HORIZONTAL | Horizontal scroll axis. When you scroll the mouse wheel or slide with two fingers on the touchpad, the status of the horizontal scroll axis changes. | +| AXIS_TYPE_PINCH | Pinch axis, which is used to describe a two-finger pinch gesture on the touchpad. | +| AXIS_TYPE_ROTATE | Rotation axis, which is used to describe a two-finger rotation gesture on the touchpad. | + +### InputEvent_AxisEventType + +``` +enum InputEvent_AxisEventType +``` + +**Description** + +Event type of the input device. + +**Since**: 12 + +| Enum | Description| +| -- | -- | +| AXIS_EVENT_TYPE_PINCH = 1 | Two-finger pinch event. The value can be **AXIS_TYPE_PINCH** or **AXIS_TYPE_ROTATE**.
**Since**: 12| +| AXIS_EVENT_TYPE_SCROLL = 2 | Scroll axis event. The value can be **AXIS_TYPE_SCROLL_VERTICAL** and **AXIS_TYPE_SCROLL_HORIZONTAL**. For mouse wheel events, the value can only be **AXIS_TYPE_SCROLL_VERTICAL**.
**Since**: 12| + +### InputEvent_AxisAction + +``` +enum InputEvent_AxisAction +``` + +**Description** + +Action of the input device. + +**Since**: 12 + +| Enum| Description| +| -- | -- | +| AXIS_ACTION_CANCEL = 0 | Cancellation of an axis input event.| +| AXIS_ACTION_BEGIN | Start of an axis input event.| +| AXIS_ACTION_UPDATE | Update of an axis input event.| +| AXIS_ACTION_END | End of an axis input event.| diff --git a/en/application-dev/reference/apis-input-kit/capi-oh-input-manager-h.md b/en/application-dev/reference/apis-input-kit/capi-oh-input-manager-h.md new file mode 100644 index 00000000000..a1897e1c973 --- /dev/null +++ b/en/application-dev/reference/apis-input-kit/capi-oh-input-manager-h.md @@ -0,0 +1,2923 @@ +# oh_input_manager.h + +## Overview + +Provides functions such as event injection and status query. + +**Library**: libohinput.so + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + +**Related module**: [input](capi-input.md) + +## Summary + +### Structs + +| Name| typedef Keyword| Description| +| -- | -- | -- | +| [Input_InterceptorEventCallback](capi-input-interceptoreventcallback.md) | Input_InterceptorEventCallback | Defines the structure of the interceptor for callback events, including mouse events, touch events, and axis events.| +| [Input_DeviceListener](capi-input-devicelistener.md) | Input_DeviceListener | Defines a listener for device hot swap events.| +| [Input_KeyState](capi-input-keystate.md) | Input_KeyState | Defines key information, which identifies a key pressing behavior. For example, the Ctrl key information contains the key value and key type.| +| [Input_KeyEvent](capi-input-keyevent.md) | Input_KeyEvent | Defines the key event to be injected.| +| [Input_MouseEvent](capi-input-mouseevent.md) | Input_MouseEvent | Defines the mouse event to be injected.| +| [Input_TouchEvent](capi-input-touchevent.md) | Input_TouchEvent | Defines the touch event to be injected.| +| [Input_AxisEvent](capi-input-axisevent.md) | Input_AxisEvent | Defines an axis event.| +| [Input_Hotkey](capi-input-hotkey.md) | Input_Hotkey | Defines the shortcut key structure.| +| [Input_DeviceInfo](capi-input-deviceinfo.md) | Input_DeviceInfo | Defines the input device information.| +| [Input_InterceptorOptions](capi-input-interceptoroptions.md) | Input_InterceptorOptions | Defines event interception options.| + +### Enums + +| Name| typedef Keyword| Description| +| -- | -- | -- | +| [Input_KeyStateAction](#input_keystateaction) | Input_KeyStateAction | Provides the enum values of the key status.| +| [Input_KeyEventAction](#input_keyeventaction) | Input_KeyEventAction | Provides the enum values of the key event type.| +| [Input_MouseEventAction](#input_mouseeventaction) | Input_MouseEventAction | Provides the enum values of mouse actions.| +| [InputEvent_MouseAxis](#inputevent_mouseaxis) | InputEvent_MouseAxis | Provides the enum values of mouse axis event types.| +| [Input_MouseEventButton](#input_mouseeventbutton) | Input_MouseEventButton | Provides the enum values of mouse buttons.| +| [Input_TouchEventAction](#input_toucheventaction) | Input_TouchEventAction | Provides the enum values of touch actions.| +| [InputEvent_SourceType](#inputevent_sourcetype) | InputEvent_SourceType | Provides the enum values of event source types.| +| [Input_KeyboardType](#input_keyboardtype) | Input_KeyboardType | Provides the enum values of keyboard types of the input device.| +| [Input_Result](#input_result) | Input_Result | Provides the enum values of error codes.| + +### Functions + +| Name| typedef Keyword| Description| +| -- | -- | -- | +| [typedef void (\*Input_HotkeyCallback)(Input_Hotkey* hotkey)](#input_hotkeycallback) | Input_HotkeyCallback | Defines the callback used to return shortcut key events.| +| [typedef void (\*Input_KeyEventCallback)(const Input_KeyEvent* keyEvent)](#input_keyeventcallback) | Input_KeyEventCallback | Defines a lifecycle callback for **keyEvent**. If the callback is triggered, **keyEvent** will be destroyed.| +| [typedef void (\*Input_MouseEventCallback)(const Input_MouseEvent* mouseEvent)](#input_mouseeventcallback) | Input_MouseEventCallback | Defines a lifecycle callback for **mouseEvent**. If the callback is triggered, **mouseEvent** will be destroyed.| +| [typedef void (\*Input_TouchEventCallback)(const Input_TouchEvent* touchEvent)](#input_toucheventcallback) | Input_TouchEventCallback | Defines a lifecycle callback for **touchEvent**. If the callback is triggered, **touchEvent** will be destroyed.| +| [typedef void (\*Input_AxisEventCallback)(const Input_AxisEvent* axisEvent)](#input_axiseventcallback) | Input_AxisEventCallback | Defines a lifecycle callback for **axisEvent**. If the callback is triggered, **axisEvent** will be destroyed.| +| [typedef void (\*Input_DeviceAddedCallback)(int32_t deviceId)](#input_deviceaddedcallback) | Input_DeviceAddedCallback | Defines a callback used to receive device insertion events.| +| [typedef void (\*Input_DeviceRemovedCallback)(int32_t deviceId)](#input_deviceremovedcallback) | Input_DeviceRemovedCallback | Defines a callback used to receive device removal events.| +| [Input_Result OH_Input_GetKeyState(struct Input_KeyState* keyState)](#oh_input_getkeystate) | - | Queries a key status enum object.| +| [struct Input_KeyState* OH_Input_CreateKeyState()](#oh_input_createkeystate) | - | Creates a key status enum object.| +| [void OH_Input_DestroyKeyState(struct Input_KeyState** keyState)](#oh_input_destroykeystate) | - | Destroys a key status enum object.| +| [void OH_Input_SetKeyCode(struct Input_KeyState* keyState, int32_t keyCode)](#oh_input_setkeycode) | - | Sets the key value of a key status enum object.| +| [void OH_Input_SetKeyPressed(struct Input_KeyState* keyState, int32_t keyAction)](#oh_input_setkeypressed) | - | Sets whether the key specific to a key status enum object is pressed.| +| [void OH_Input_SetKeySwitch(struct Input_KeyState* keyState, int32_t keySwitch)](#oh_input_setkeyswitch) | - | Sets the key switch of the key status enum object.| +| [struct Input_KeyEvent* OH_Input_CreateKeyEvent()](#oh_input_createkeyevent) | - | Creates a key event object.| +| [void OH_Input_DestroyKeyEvent(struct Input_KeyEvent** keyEvent)](#oh_input_destroykeyevent) | - | Destroys a key event object.| +| [void OH_Input_SetKeyEventAction(struct Input_KeyEvent* keyEvent, int32_t action)](#oh_input_setkeyeventaction) | - | Sets the key event type.| +| [void OH_Input_SetKeyEventKeyCode(struct Input_KeyEvent* keyEvent, int32_t keyCode)](#oh_input_setkeyeventkeycode) | - | Sets the key code value for a key event.| +| [void OH_Input_SetKeyEventActionTime(struct Input_KeyEvent* keyEvent, int64_t actionTime)](#oh_input_setkeyeventactiontime) | - | Sets the time when a key event occurs.| +| [void OH_Input_SetKeyEventWindowId(struct Input_KeyEvent* keyEvent, int32_t windowId)](#oh_input_setkeyeventwindowid) | - | Sets the window ID of a key event.| +| [void OH_Input_SetKeyEventDisplayId(struct Input_KeyEvent* keyEvent, int32_t displayId)](#oh_input_setkeyeventdisplayid) | - | Sets the screen ID of a key event.| +| [struct Input_MouseEvent* OH_Input_CreateMouseEvent()](#oh_input_createmouseevent) | - | Creates a mouse event object.| +| [void OH_Input_DestroyMouseEvent(struct Input_MouseEvent** mouseEvent)](#oh_input_destroymouseevent) | - | Destroys a mouse event object.| +| [void OH_Input_SetMouseEventAction(struct Input_MouseEvent* mouseEvent, int32_t action)](#oh_input_setmouseeventaction) | - | Sets the action for a mouse event.| +| [void OH_Input_SetMouseEventDisplayX(struct Input_MouseEvent* mouseEvent, int32_t displayX)](#oh_input_setmouseeventdisplayx) | - | Sets the X coordinate for a mouse event.| +| [void OH_Input_SetMouseEventDisplayY(struct Input_MouseEvent* mouseEvent, int32_t displayY)](#oh_input_setmouseeventdisplayy) | - | Sets the Y coordinate for a mouse event.| +| [void OH_Input_SetMouseEventButton(struct Input_MouseEvent* mouseEvent, int32_t button)](#oh_input_setmouseeventbutton) | - | Sets the button for a mouse event.| +| [void OH_Input_SetMouseEventAxisType(struct Input_MouseEvent* mouseEvent, int32_t axisType)](#oh_input_setmouseeventaxistype) | - | Sets the axis type for a mouse event.| +| [void OH_Input_SetMouseEventAxisValue(struct Input_MouseEvent* mouseEvent, float axisValue)](#oh_input_setmouseeventaxisvalue) | - | Sets the axis value for a mouse axis event.| +| [void OH_Input_SetMouseEventActionTime(struct Input_MouseEvent* mouseEvent, int64_t actionTime)](#oh_input_setmouseeventactiontime) | - | Sets the time when a mouse event occurs.| +| [void OH_Input_SetMouseEventWindowId(struct Input_MouseEvent* mouseEvent, int32_t windowId)](#oh_input_setmouseeventwindowid) | - | Sets the window ID of a mouse event.| +| [void OH_Input_SetMouseEventDisplayId(struct Input_MouseEvent* mouseEvent, int32_t displayId)](#oh_input_setmouseeventdisplayid) | - | Sets the screen ID of a mouse event.| +| [struct Input_TouchEvent* OH_Input_CreateTouchEvent()](#oh_input_createtouchevent) | - | Creates a touch event object.| +| [void OH_Input_DestroyTouchEvent(struct Input_TouchEvent** touchEvent)](#oh_input_destroytouchevent) | - | Destroys a touch event object.| +| [void OH_Input_SetTouchEventAction(struct Input_TouchEvent* touchEvent, int32_t action)](#oh_input_settoucheventaction) | - | Sets the action for a touch event.| +| [void OH_Input_SetTouchEventFingerId(struct Input_TouchEvent* touchEvent, int32_t id)](#oh_input_settoucheventfingerid) | - | Sets the finger ID for a touch event.| +| [void OH_Input_SetTouchEventDisplayX(struct Input_TouchEvent* touchEvent, int32_t displayX)](#oh_input_settoucheventdisplayx) | - | Sets the X coordinate for a touch event.| +| [void OH_Input_SetTouchEventDisplayY(struct Input_TouchEvent* touchEvent, int32_t displayY)](#oh_input_settoucheventdisplayy) | - | Sets the Y coordinate for a touch event.| +| [void OH_Input_SetTouchEventActionTime(struct Input_TouchEvent* touchEvent, int64_t actionTime)](#oh_input_settoucheventactiontime) | - | Sets the time when a touch event occurs.| +| [void OH_Input_SetTouchEventWindowId(struct Input_TouchEvent* touchEvent, int32_t windowId)](#oh_input_settoucheventwindowid) | - | Sets the window ID of a touchscreen event.| +| [void OH_Input_SetTouchEventDisplayId(struct Input_TouchEvent* touchEvent, int32_t displayId)](#oh_input_settoucheventdisplayid) | - | Sets the screen ID of a touchscreen event.| +| [void OH_Input_CancelInjection()](#oh_input_cancelinjection) | - | Stops event injection and revokes authorization.| +| [Input_AxisEvent* OH_Input_CreateAxisEvent(void)](#oh_input_createaxisevent) | - | Creates an axis event object.| +| [Input_Result OH_Input_DestroyAxisEvent(Input_AxisEvent** axisEvent)](#oh_input_destroyaxisevent) | - | Destroys an axis event object.| +| [Input_Result OH_Input_SetAxisEventAction(Input_AxisEvent* axisEvent, InputEvent_AxisAction action)](#oh_input_setaxiseventaction) | - | Sets the action for an axis event.| +| [Input_Result OH_Input_GetAxisEventAction(const Input_AxisEvent* axisEvent, InputEvent_AxisAction *action)](#oh_input_getaxiseventaction) | - | Obtains the action of an axis event.| +| [Input_Result OH_Input_SetAxisEventDisplayX(Input_AxisEvent* axisEvent, float displayX)](#oh_input_setaxiseventdisplayx) | - | Sets the X coordinate for an axis event.| +| [Input_Result OH_Input_GetAxisEventDisplayX(const Input_AxisEvent* axisEvent, float* displayX)](#oh_input_getaxiseventdisplayx) | - | Obtains the X coordinate of an axis event.| +| [Input_Result OH_Input_SetAxisEventDisplayY(Input_AxisEvent* axisEvent, float displayY)](#oh_input_setaxiseventdisplayy) | - | Sets the Y coordinate for an axis event.| +| [Input_Result OH_Input_GetAxisEventDisplayY(const Input_AxisEvent* axisEvent, float* displayY)](#oh_input_getaxiseventdisplayy) | - | Obtains the Y coordinate of an axis event.| +| [Input_Result OH_Input_SetAxisEventAxisValue(Input_AxisEvent* axisEvent,InputEvent_AxisType axisType, double axisValue)](#oh_input_setaxiseventaxisvalue) | - | Sets the axis value of the axis type specified by the axis event.| +| [Input_Result OH_Input_GetAxisEventAxisValue(const Input_AxisEvent* axisEvent,InputEvent_AxisType axisType, double* axisValue)](#oh_input_getaxiseventaxisvalue) | - | Obtains the axis value for the specified axis type of the axis event.| +| [Input_Result OH_Input_SetAxisEventActionTime(Input_AxisEvent* axisEvent, int64_t actionTime)](#oh_input_setaxiseventactiontime) | - | Sets the time when an axis event occurs.| +| [Input_Result OH_Input_GetAxisEventActionTime(const Input_AxisEvent* axisEvent, int64_t* actionTime)](#oh_input_getaxiseventactiontime) | - | Obtains the time when an axis event occurs.| +| [Input_Result OH_Input_SetAxisEventType(Input_AxisEvent* axisEvent, InputEvent_AxisEventType axisEventType)](#oh_input_setaxiseventtype) | - | Sets the axis event type.| +| [Input_Result OH_Input_GetAxisEventType(const Input_AxisEvent* axisEvent, InputEvent_AxisEventType* axisEventType)](#oh_input_getaxiseventtype) | - | Obtains the axis event type.| +| [Input_Result OH_Input_SetAxisEventSourceType(Input_AxisEvent* axisEvent, InputEvent_SourceType sourceType)](#oh_input_setaxiseventsourcetype) | - | Sets the axis event source type.| +| [Input_Result OH_Input_GetAxisEventSourceType(const Input_AxisEvent* axisEvent, InputEvent_SourceType* sourceType)](#oh_input_getaxiseventsourcetype) | - | Obtains the axis event source type.| +| [Input_Result OH_Input_SetAxisEventWindowId(Input_AxisEvent* axisEvent, int32_t windowId)](#oh_input_setaxiseventwindowid) | - | Sets the window ID of an axis event.| +| [Input_Result OH_Input_GetAxisEventWindowId(const Input_AxisEvent* axisEvent, int32_t* windowId)](#oh_input_getaxiseventwindowid) | - | Obtains the window ID of an axis event.| +| [Input_Result OH_Input_SetAxisEventDisplayId(Input_AxisEvent* axisEvent, int32_t displayId)](#oh_input_setaxiseventdisplayid) | - | Sets the screen ID of an axis event.| +| [Input_Result OH_Input_GetAxisEventDisplayId(const Input_AxisEvent* axisEvent, int32_t* displayId)](#oh_input_getaxiseventdisplayid) | - | Obtains the screen ID of an axis event.| +| [Input_Result OH_Input_AddKeyEventMonitor(Input_KeyEventCallback callback)](#oh_input_addkeyeventmonitor) | - | Adds a listener for key events.| +| [Input_Result OH_Input_AddMouseEventMonitor(Input_MouseEventCallback callback)](#oh_input_addmouseeventmonitor) | - | Adds a listener for mouse events, including mouse click and movement events, but not scroll wheel events. Scroll wheel events are axis events.| +| [Input_Result OH_Input_AddTouchEventMonitor(Input_TouchEventCallback callback)](#oh_input_addtoucheventmonitor) | - | Adds a listener for touch events.| +| [Input_Result OH_Input_AddAxisEventMonitorForAll(Input_AxisEventCallback callback)](#oh_input_addaxiseventmonitorforall) | - | Adds a listener for all types of axis events, which are defined in [InputEvent_AxisEventType](capi-oh-axis-type-h.md#inputevent_axiseventtype).| +| [Input_Result OH_Input_AddAxisEventMonitor(InputEvent_AxisEventType axisEventType, Input_AxisEventCallback callback)](#oh_input_addaxiseventmonitor) | - | Adds a listener for the specified type of axis events, which are defined in [InputEvent_AxisEventType](capi-oh-axis-type-h.md#inputevent_axiseventtype).| +| [Input_Result OH_Input_RemoveKeyEventMonitor(Input_KeyEventCallback callback)](#oh_input_removekeyeventmonitor) | - | Removes the listener for key events.| +| [Input_Result OH_Input_RemoveMouseEventMonitor(Input_MouseEventCallback callback)](#oh_input_removemouseeventmonitor) | - | Removes the listener for mouse events.| +| [Input_Result OH_Input_RemoveTouchEventMonitor(Input_TouchEventCallback callback)](#oh_input_removetoucheventmonitor) | - | Removes the listener for touch events.| +| [Input_Result OH_Input_RemoveAxisEventMonitorForAll(Input_AxisEventCallback callback)](#oh_input_removeaxiseventmonitorforall) | - | Removes the listener for all types of axis events.| +| [Input_Result OH_Input_RemoveAxisEventMonitor(InputEvent_AxisEventType axisEventType, Input_AxisEventCallback callback)](#oh_input_removeaxiseventmonitor) | - | Removes the listener for the specified type of axis events, which are defined in [InputEvent_AxisEventType](capi-oh-axis-type-h.md#inputevent_axiseventtype).| +| [Input_Result OH_Input_AddKeyEventInterceptor(Input_KeyEventCallback callback, Input_InterceptorOptions *option)](#oh_input_addkeyeventinterceptor) | - | Adds an interceptor for key events. If multiple interceptors are added, only the first one takes effect. Key events are intercepted only when the application gains focus.| +| [Input_Result OH_Input_AddInputEventInterceptor(Input_InterceptorEventCallback *callback,Input_InterceptorOptions *option)](#oh_input_addinputeventinterceptor) | - | Adds an interceptor for input events, including mouse, touch, and axis events. If multiple interceptors are added, only the first one takes effect. Key events are intercepted only when the application window is hit.| +| [Input_Result OH_Input_RemoveKeyEventInterceptor(void)](#oh_input_removekeyeventinterceptor) | - | Removes the interceptor for key events.| +| [Input_Result OH_Input_RemoveInputEventInterceptor(void)](#oh_input_removeinputeventinterceptor) | - | Removes the interceptor for input events, including mouse, touch, and axis events.| +| [Input_Result OH_Input_GetIntervalSinceLastInput(int64_t *timeInterval)](#oh_input_getintervalsincelastinput) | - | Obtains the interval since the last system input event.| +| [Input_Hotkey *OH_Input_CreateHotkey(void)](#oh_input_createhotkey) | - | Creates a shortcut key object.| +| [void OH_Input_DestroyHotkey(Input_Hotkey **hotkey)](#oh_input_destroyhotkey) | - | Destroys a shortcut key object.| +| [void OH_Input_SetPreKeys(Input_Hotkey *hotkey, int32_t *preKeys, int32_t size)](#oh_input_setprekeys) | - | Sets the modifier key.| +| [Input_Result OH_Input_GetPreKeys(const Input_Hotkey *hotkey, int32_t **preKeys, int32_t *preKeyCount)](#oh_input_getprekeys) | - | Obtains the modifier key.| +| [void OH_Input_SetFinalKey(Input_Hotkey* hotkey, int32_t finalKey)](#oh_input_setfinalkey) | - | Sets the modified key.| +| [Input_Result OH_Input_GetFinalKey(const Input_Hotkey* hotkey, int32_t *finalKeyCode)](#oh_input_getfinalkey) | - | Obtains the modified key.| +| [Input_Hotkey **OH_Input_CreateAllSystemHotkeys(int32_t count)](#oh_input_createallsystemhotkeys) | - | Creates an array of [Input_Hotkey](capi-input-hotkey.md) instances.| +| [void OH_Input_DestroyAllSystemHotkeys(Input_Hotkey **hotkeys, int32_t count)](#oh_input_destroyallsystemhotkeys) | - | Destroys the array of [Input_Hotkey](capi-input-hotkey.md) instances and reclaims the memory.| +| [Input_Result OH_Input_GetAllSystemHotkeys(Input_Hotkey **hotkey, int32_t *count)](#oh_input_getallsystemhotkeys) | - | Obtains all configured shortcut keys.| +| [void OH_Input_SetRepeat(Input_Hotkey* hotkey, bool isRepeat)](#oh_input_setrepeat) | - | Specifies whether to report repeated key events.| +| [Input_Result OH_Input_GetRepeat(const Input_Hotkey* hotkey, bool *isRepeat)](#oh_input_getrepeat) | - | Checks whether to report repeated key events.| +| [Input_Result OH_Input_AddHotkeyMonitor(const Input_Hotkey* hotkey, Input_HotkeyCallback callback)](#oh_input_addhotkeymonitor) | - | Subscribes to shortcut key events. This API is not applicable to wearables and lite wearables.| +| [Input_Result OH_Input_RemoveHotkeyMonitor(const Input_Hotkey* hotkey, Input_HotkeyCallback callback)](#oh_input_removehotkeymonitor) | - | Unsubscribes from shortcut key events.| +| [Input_Result OH_Input_RegisterDeviceListener(Input_DeviceListener* listener)](#oh_input_registerdevicelistener) | - | Registers a listener for device hot swap events.| +| [Input_Result OH_Input_UnregisterDeviceListener(Input_DeviceListener* listener)](#oh_input_unregisterdevicelistener) | - | Unregisters the listener for device hot swap events.| +| [Input_Result OH_Input_UnregisterDeviceListeners()](#oh_input_unregisterdevicelisteners) | - | Unregisters the listener for all device hot swap events.| +| [Input_Result OH_Input_GetDeviceIds(int32_t *deviceIds, int32_t inSize, int32_t *outSize)](#oh_input_getdeviceids) | - | Obtains the IDs of all input devices.| +| [Input_Result OH_Input_GetDevice(int32_t deviceId, Input_DeviceInfo **deviceInfo)](#oh_input_getdevice) | - | Obtains information about the input device.| +| [Input_DeviceInfo* OH_Input_CreateDeviceInfo(void)](#oh_input_createdeviceinfo) | - | Creates a **deviceInfo** object.| +| [void OH_Input_DestroyDeviceInfo(Input_DeviceInfo **deviceInfo)](#oh_input_destroydeviceinfo) | - | Destroys a **deviceInfo** object.| +| [Input_Result OH_Input_GetKeyboardType(int32_t deviceId, int32_t *keyboardType)](#oh_input_getkeyboardtype) | - | Obtains the keyboard type of the input device.| +| [Input_Result OH_Input_GetDeviceId(Input_DeviceInfo *deviceInfo, int32_t *id)](#oh_input_getdeviceid) | - | Obtains the ID of an input device.| +| [Input_Result OH_Input_GetDeviceName(Input_DeviceInfo *deviceInfo, char **name)](#oh_input_getdevicename) | - | Obtains the name of an input device.| +| [Input_Result OH_Input_GetCapabilities(Input_DeviceInfo *deviceInfo, int32_t *capabilities)](#oh_input_getcapabilities) | - | Obtains the capabilities of an input device, for example, a touchscreen, touchpad, or keyboard.| +| [Input_Result OH_Input_GetDeviceVersion(Input_DeviceInfo *deviceInfo, int32_t *version)](#oh_input_getdeviceversion) | - | Obtains the version information of an input device.| +| [Input_Result OH_Input_GetDeviceProduct(Input_DeviceInfo *deviceInfo, int32_t *product)](#oh_input_getdeviceproduct) | - | Obtains the product information of an input device.| +| [Input_Result OH_Input_GetDeviceVendor(Input_DeviceInfo *deviceInfo, int32_t *vendor)](#oh_input_getdevicevendor) | - | Obtains the vendor information of an input device.| +| [Input_Result OH_Input_GetDeviceAddress(Input_DeviceInfo *deviceInfo, char **address)](#oh_input_getdeviceaddress) | - | Obtains the physical address of an input device.| +| [Input_Result OH_Input_GetFunctionKeyState(int32_t keyCode, int32_t *state)](#oh_input_getfunctionkeystate) | - | Obtains the function key status.| + +## Enum Description + +### Input_KeyStateAction + +``` +enum Input_KeyStateAction +``` + +**Description** + +Provides the enum values of the key status. + +**Since**: 12 + +| Enum| Description| +| -- | -- | +| KEY_DEFAULT = -1 | Default status.| +| KEY_PRESSED = 0 | Pressing of a key.| +| KEY_RELEASED = 1 | Release of a key.| +| KEY_SWITCH_ON = 2 | Key switch enabled.| +| KEY_SWITCH_OFF = 3 | Key switch disabled.| + +### Input_KeyEventAction + +``` +enum Input_KeyEventAction +``` + +**Description** + +Provides the enum values of the key event type. + +**Since**: 12 + +| Enum| Description| +| -- | -- | +| KEY_ACTION_CANCEL = 0 | Button action canceled.| +| KEY_ACTION_DOWN = 1 | Pressing of a key.| +| KEY_ACTION_UP = 2 | Release of a key.| + +### Input_MouseEventAction + +``` +enum Input_MouseEventAction +``` + +**Description** + +Provides the enum values of mouse actions. + +**Since**: 12 + +| Enum| Description| +| -- | -- | +| MOUSE_ACTION_CANCEL = 0 | Mouse action canceled.| +| MOUSE_ACTION_MOVE = 1 | Moving of the mouse pointer.| +| MOUSE_ACTION_BUTTON_DOWN = 2 | Pressing of the mouse button.| +| MOUSE_ACTION_BUTTON_UP = 3 | Release of the mouse button.| +| MOUSE_ACTION_AXIS_BEGIN = 4 | Beginning of the mouse axis event.| +| MOUSE_ACTION_AXIS_UPDATE = 5 | Updating of the mouse axis event.| +| MOUSE_ACTION_AXIS_END = 6 | End of the mouse axis event.| + +### InputEvent_MouseAxis + +``` +enum InputEvent_MouseAxis +``` + +**Description** + +Provides the enum values of mouse axis event types. + +**Since**: 12 + +| Enum| Description| +| -- | -- | +| MOUSE_AXIS_SCROLL_VERTICAL = 0 | Vertical scroll axis.| +| MOUSE_AXIS_SCROLL_HORIZONTAL = 1 | Horizontal scroll axis.| + +### Input_MouseEventButton + +``` +enum Input_MouseEventButton +``` + +**Description** + +Provides the enum values of mouse buttons. + +**Since**: 12 + +| Enum| Description| +| -- | -- | +| MOUSE_BUTTON_NONE = -1 | Invalid key.| +| MOUSE_BUTTON_LEFT = 0 | Left mouse button.| +| MOUSE_BUTTON_MIDDLE = 1 | Middle mouse button.| +| MOUSE_BUTTON_RIGHT = 2 | Right mouse button.| +| MOUSE_BUTTON_FORWARD = 3 | Mouse forward button.| +| MOUSE_BUTTON_BACK = 4 | Mouse back button.| + +### Input_TouchEventAction + +``` +enum Input_TouchEventAction +``` + +**Description** + +Provides the enum values of touch actions. + +**Since**: 12 + +| Enum| Description| +| -- | -- | +| TOUCH_ACTION_CANCEL = 0 | Cancellation of touch.| +| TOUCH_ACTION_DOWN = 1 | Pressing of touch.| +| TOUCH_ACTION_MOVE = 2 | Moving of touch.| +| TOUCH_ACTION_UP = 3 | Lifting of touch.| + +### InputEvent_SourceType + +``` +enum InputEvent_SourceType +``` + +**Description** + +Enter the event source type. + +**Since**: 12 + +| Enum| Description| +| -- | -- | +| SOURCE_TYPE_MOUSE = 1 | Source that generates events similar to mouse cursor movement, button press and release, and wheel scrolling.| +| SOURCE_TYPE_TOUCHSCREEN = 2 | Source that generates a touchscreen multi-touch event.| +| SOURCE_TYPE_TOUCHPAD = 3 | Source that generates a touchpad multi-touch event.| + +### Input_KeyboardType + +``` +enum Input_KeyboardType +``` + +**Description** + +Provides the enum values of keyboard types of the input device. + +**Since**: 13 + +| Enum| Description| +| -- | -- | +| KEYBOARD_TYPE_NONE = 0 | Keyboard without keys.| +| KEYBOARD_TYPE_UNKNOWN = 1 | Keyboard with unknown keys.| +| KEYBOARD_TYPE_ALPHABETIC = 2 | Full keyboard.| +| KEYBOARD_TYPE_DIGITAL = 3 | Numeric keypad.| +| KEYBOARD_TYPE_STYLUS = 4 | Stylus.| +| KEYBOARD_TYPE_REMOTE_CONTROL = 5 | Remote control.| + +### Input_Result + +``` +enum Input_Result +``` + +**Description** + +Provides the enum values of error codes. + +**Since**: 12 + +| Enum| Description| +| -- | -- | +| INPUT_SUCCESS = 0 | Operation succeeded| +| INPUT_PERMISSION_DENIED = 201 | Permission verification failed.| +| INPUT_NOT_SYSTEM_APPLICATION = 202 | Not a system application.| +| INPUT_PARAMETER_ERROR = 401 | Parameter check failed.| +| INPUT_DEVICE_NOT_SUPPORTED = 801 | Input device not supported.
**Since**: 14| +| INPUT_SERVICE_EXCEPTION = 3800001 | Service Error| +| INPUT_REPEAT_INTERCEPTOR = 4200001 | Interceptor repeatedly created.| +| INPUT_OCCUPIED_BY_SYSTEM = 4200002 | Input device occupied by a system application.
**Since**: 14| +| INPUT_OCCUPIED_BY_OTHER = 4200003 | Input device occupied by another application.
**Since**: 14| +| INPUT_KEYBOARD_DEVICE_NOT_EXIST = 3900002 | No keyboard is connected.
**Since**: 15| + + +## Function Description + +### Input_HotkeyCallback() + +``` +typedef void (*Input_HotkeyCallback)(Input_Hotkey* hotkey) +``` + +**Description** + +Defines the callback used to return shortcut key events. + +**Since**: 14 + +### Input_KeyEventCallback() + +``` +typedef void (*Input_KeyEventCallback)(const Input_KeyEvent* keyEvent) +``` + +**Description** + +Defines a lifecycle callback for **keyEvent**. If the callback is triggered, **keyEvent** will be destroyed. + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| const [Input_KeyEvent](capi-input-keyevent.md)* keyEvent | Key event object.| + +### Input_MouseEventCallback() + +``` +typedef void (*Input_MouseEventCallback)(const Input_MouseEvent* mouseEvent) +``` + +**Description** + +Defines a lifecycle callback for **mouseEvent**. If the callback is triggered, **mouseEvent** will be destroyed. + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| const [Input_MouseEvent](capi-input-mouseevent.md)* mouseEvent | Mouse event object.| + +### Input_TouchEventCallback() + +``` +typedef void (*Input_TouchEventCallback)(const Input_TouchEvent* touchEvent) +``` + +**Description** + +Defines a lifecycle callback for **touchEvent**. If the callback is triggered, **touchEvent** will be destroyed. + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| const [Input_TouchEvent](capi-input-touchevent.md)* touchEvent | Touch event object.| + +### Input_AxisEventCallback() + +``` +typedef void (*Input_AxisEventCallback)(const Input_AxisEvent* axisEvent) +``` + +**Description** + +Defines a lifecycle callback for **axisEvent**. If the callback is triggered, **axisEvent** will be destroyed. + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| const [Input_AxisEvent](capi-input-axisevent.md)* axisEvent | Axis event object.| + +### Input_DeviceAddedCallback() + +``` +typedef void (*Input_DeviceAddedCallback)(int32_t deviceId) +``` + +**Description** + +Defines a callback used to receive device insertion events. + +**Since**: 13 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| int32_t deviceId | Device ID.| + +### Input_DeviceRemovedCallback() + +``` +typedef void (*Input_DeviceRemovedCallback)(int32_t deviceId) +``` + +**Description** + +Defines a callback used to receive device removal events. + +**Since**: 13 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| int32_t deviceId | Device ID.| + +### OH_Input_GetKeyState() + +``` +Input_Result OH_Input_GetKeyState(struct Input_KeyState* keyState) +``` + +**Description** + +Queries a key status enum object. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| struct [Input_KeyState](capi-input-keystate.md)* keyState | Key status enum object. For details, see [Input_KeyStateAction](#input_keystateaction).| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful;
an error code defined in [Input_Result](#input_result) otherwise.| + +### OH_Input_CreateKeyState() + +``` +struct Input_KeyState* OH_Input_CreateKeyState() +``` + +**Description** + +Creates a key status enum object. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + +**Return value** + +| Type| Description| +| -- | -- | +| struct | [Input_KeyState](capi-input-keystate.md) pointer object if the operation is successful; a null pointer otherwise.| + +### OH_Input_DestroyKeyState() + +``` +void OH_Input_DestroyKeyState(struct Input_KeyState** keyState) +``` + +**Description** + +Destroys a key status enum object. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| struct [Input_KeyState](capi-input-keystate.md)** keyState | Key status enum object. For details, see [Input_KeyStateAction](#input_keystateaction).| + +### OH_Input_SetKeyCode() + +``` +void OH_Input_SetKeyCode(struct Input_KeyState* keyState, int32_t keyCode) +``` + +**Description** + +Sets the key value of a key status enum object. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| struct [Input_KeyState](capi-input-keystate.md)* keyState | Key status enum object. For details, see [Input_KeyStateAction](#input_keystateaction).| +| int32_t keyCode | Key code.| + +### OH_Input_SetKeyPressed() + +``` +void OH_Input_SetKeyPressed(struct Input_KeyState* keyState, int32_t keyAction) +``` + +**Description** + +Sets whether the key specific to a key status enum object is pressed. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| struct [Input_KeyState](capi-input-keystate.md)* keyState | Key status enum object. For details, see [Input_KeyStateAction](#input_keystateaction).| +| int32_t keyAction | Whether a key is pressed. For details, see [Input_KeyEventAction](#input_keyeventaction).| + +### OH_Input_SetKeySwitch() + +``` +void OH_Input_SetKeySwitch(struct Input_KeyState* keyState, int32_t keySwitch) +``` + +**Description** + +Sets the key switch of the key status enum object. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| struct [Input_KeyState](capi-input-keystate.md)* keyState | Key status enum object. For details, see [Input_KeyStateAction](#input_keystateaction).| +| int32_t keySwitch | Key switch.| + +### OH_Input_CreateKeyEvent() + +``` +struct Input_KeyEvent* OH_Input_CreateKeyEvent() +``` + +**Description** + +Creates a key event object. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + +**Return value** + +| Type| Description| +| -- | -- | +| struct | [Input_KeyEvent](capi-input-keyevent.md) pointer object if the operation is successful; a null pointer otherwise.| + +### OH_Input_DestroyKeyEvent() + +``` +void OH_Input_DestroyKeyEvent(struct Input_KeyEvent** keyEvent) +``` + +**Description** + +Destroys a key event object. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| struct [Input_KeyEvent](capi-input-keyevent.md)** keyEvent | Key event object.| + +### OH_Input_SetKeyEventAction() + +``` +void OH_Input_SetKeyEventAction(struct Input_KeyEvent* keyEvent, int32_t action) +``` + +**Description** + +Sets the key event type. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| struct [Input_KeyEvent](capi-input-keyevent.md)* keyEvent | Key event object.| +| int32_t action | Key event type.| + +### OH_Input_SetKeyEventKeyCode() + +``` +void OH_Input_SetKeyEventKeyCode(struct Input_KeyEvent* keyEvent, int32_t keyCode) +``` + +**Description** + +Sets the key code value for a key event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| struct [Input_KeyEvent](capi-input-keyevent.md)* keyEvent | Key event object.| +| int32_t keyCode | Key value.| + +### OH_Input_SetKeyEventActionTime() + +``` +void OH_Input_SetKeyEventActionTime(struct Input_KeyEvent* keyEvent, int64_t actionTime) +``` + +**Description** + +Sets the time when a key event occurs. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| struct [Input_KeyEvent](capi-input-keyevent.md)* keyEvent | Key event object.| +| int64_t actionTime | Time when a key event occurs.| + +### OH_Input_SetKeyEventWindowId() + +``` +void OH_Input_SetKeyEventWindowId(struct Input_KeyEvent* keyEvent, int32_t windowId) +``` + +**Description** + +Sets the window ID of a key event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 15 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| struct [Input_KeyEvent](capi-input-keyevent.md)* keyEvent | Key event object.| +| int32_t windowId | Window ID of the key event.| + +### OH_Input_SetKeyEventDisplayId() + +``` +void OH_Input_SetKeyEventDisplayId(struct Input_KeyEvent* keyEvent, int32_t displayId) +``` + +**Description** + +Sets the screen ID of a key event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 15 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| struct [Input_KeyEvent](capi-input-keyevent.md)* keyEvent | Key event object.| +| int32_t displayId | Screen ID of the key event.| + +### OH_Input_CreateMouseEvent() + +``` +struct Input_MouseEvent* OH_Input_CreateMouseEvent() +``` + +**Description** + +Creates a mouse event object. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + +**Return value** + +| Type| Description| +| -- | -- | +| struct | [Input_MouseEvent](capi-input-mouseevent.md) pointer object if the operation is successful; a null pointer otherwise.| + +### OH_Input_DestroyMouseEvent() + +``` +void OH_Input_DestroyMouseEvent(struct Input_MouseEvent** mouseEvent) +``` + +**Description** + +Destroys a mouse event object. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| struct [Input_MouseEvent](capi-input-mouseevent.md)** mouseEvent | Mouse event object.| + +### OH_Input_SetMouseEventAction() + +``` +void OH_Input_SetMouseEventAction(struct Input_MouseEvent* mouseEvent, int32_t action) +``` + +**Description** + +Sets the action for a mouse event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| struct [Input_MouseEvent](capi-input-mouseevent.md)* mouseEvent | Mouse event object.| +| int32_t action | Mouse action.| + +### OH_Input_SetMouseEventDisplayX() + +``` +void OH_Input_SetMouseEventDisplayX(struct Input_MouseEvent* mouseEvent, int32_t displayX) +``` + +**Description** + +Sets the X coordinate for a mouse event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| struct [Input_MouseEvent](capi-input-mouseevent.md)* mouseEvent | Mouse event object.| +| int32_t displayX | X coordinate on the screen.| + +### OH_Input_SetMouseEventDisplayY() + +``` +void OH_Input_SetMouseEventDisplayY(struct Input_MouseEvent* mouseEvent, int32_t displayY) +``` + +**Description** + +Sets the Y coordinate for a mouse event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| struct [Input_MouseEvent](capi-input-mouseevent.md)* mouseEvent | Mouse event object.| +| int32_t displayY | Y coordinate on the screen.| + +### OH_Input_SetMouseEventButton() + +``` +void OH_Input_SetMouseEventButton(struct Input_MouseEvent* mouseEvent, int32_t button) +``` + +**Description** + +Sets the button for a mouse event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| struct [Input_MouseEvent](capi-input-mouseevent.md)* mouseEvent | Mouse event object.| +| int32_t button | Mouse button.| + +### OH_Input_SetMouseEventAxisType() + +``` +void OH_Input_SetMouseEventAxisType(struct Input_MouseEvent* mouseEvent, int32_t axisType) +``` + +**Description** + +Sets the axis type for a mouse event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| struct [Input_MouseEvent](capi-input-mouseevent.md)* mouseEvent | Mouse event object.| +| int32_t axisType | Axis type, for example, X axis or Y axis.| + +### OH_Input_SetMouseEventAxisValue() + +``` +void OH_Input_SetMouseEventAxisValue(struct Input_MouseEvent* mouseEvent, float axisValue) +``` + +**Description** + +Sets the axis value for a mouse axis event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| struct [Input_MouseEvent](capi-input-mouseevent.md)* mouseEvent | Mouse event object.| +| float axisValue | Axis value. A positive value means scrolling forward, and a negative number means scrolling backward.| + +### OH_Input_SetMouseEventActionTime() + +``` +void OH_Input_SetMouseEventActionTime(struct Input_MouseEvent* mouseEvent, int64_t actionTime) +``` + +**Description** + +Sets the time when a mouse event occurs. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| struct [Input_MouseEvent](capi-input-mouseevent.md)* mouseEvent | Mouse event object.| +| int64_t actionTime | Time when a mouse event occurs.| + +### OH_Input_SetMouseEventWindowId() + +``` +void OH_Input_SetMouseEventWindowId(struct Input_MouseEvent* mouseEvent, int32_t windowId) +``` + +**Description** + +Sets the window ID of a mouse event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 15 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| struct [Input_MouseEvent](capi-input-mouseevent.md)* mouseEvent | Mouse event object.| +| int32_t windowId | Window ID of the mouse event.| + +### OH_Input_SetMouseEventDisplayId() + +``` +void OH_Input_SetMouseEventDisplayId(struct Input_MouseEvent* mouseEvent, int32_t displayId) +``` + +**Description** + +Sets the screen ID of a mouse event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 15 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| struct [Input_MouseEvent](capi-input-mouseevent.md)* mouseEvent | Mouse event object.| +| int32_t displayId | Screen ID of the mouse event.| + +### OH_Input_CreateTouchEvent() + +``` +struct Input_TouchEvent* OH_Input_CreateTouchEvent() +``` + +**Description** + +Creates a touch event object. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + +**Return value** + +| Type| Description| +| -- | -- | +| struct | [Input_TouchEvent](capi-input-touchevent.md) pointer object if the operation is successful; a null pointer otherwise.| + +### OH_Input_DestroyTouchEvent() + +``` +void OH_Input_DestroyTouchEvent(struct Input_TouchEvent** touchEvent) +``` + +**Description** + +Destroys a touch event object. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| struct [Input_TouchEvent](capi-input-touchevent.md)** touchEvent | Touch event object.| + +### OH_Input_SetTouchEventAction() + +``` +void OH_Input_SetTouchEventAction(struct Input_TouchEvent* touchEvent, int32_t action) +``` + +**Description** + +Sets the action for a touch event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| struct [Input_TouchEvent](capi-input-touchevent.md)* touchEvent | Touch event object.| +| int32_t action | Action of the touch event.| + +### OH_Input_SetTouchEventFingerId() + +``` +void OH_Input_SetTouchEventFingerId(struct Input_TouchEvent* touchEvent, int32_t id) +``` + +**Description** + +Sets the finger ID for a touch event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| struct [Input_TouchEvent](capi-input-touchevent.md)* touchEvent | Touch event object.| +| int32_t id | Finger ID of a touch event.| + +### OH_Input_SetTouchEventDisplayX() + +``` +void OH_Input_SetTouchEventDisplayX(struct Input_TouchEvent* touchEvent, int32_t displayX) +``` + +**Description** + +Sets the X coordinate for a touch event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| struct [Input_TouchEvent](capi-input-touchevent.md)* touchEvent | Touch event object.| +| int32_t displayX | X coordinate on the touchscreen.| + +### OH_Input_SetTouchEventDisplayY() + +``` +void OH_Input_SetTouchEventDisplayY(struct Input_TouchEvent* touchEvent, int32_t displayY) +``` + +**Description** + +Sets the Y coordinate for a touch event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| struct [Input_TouchEvent](capi-input-touchevent.md)* touchEvent | Touch event object.| +| int32_t displayY | Y coordinate on the touchscreen.| + +### OH_Input_SetTouchEventActionTime() + +``` +void OH_Input_SetTouchEventActionTime(struct Input_TouchEvent* touchEvent, int64_t actionTime) +``` + +**Description** + +Sets the time when a touch event occurs. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| keyEvent | Touch event object.| +| int64_t actionTime | Time when a touch event occurs.| + +### OH_Input_SetTouchEventWindowId() + +``` +void OH_Input_SetTouchEventWindowId(struct Input_TouchEvent* touchEvent, int32_t windowId) +``` + +**Description** + +Sets the window ID of a touchscreen event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 15 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| struct [Input_TouchEvent](capi-input-touchevent.md)* touchEvent | Touch event object.| +| int32_t windowId | Window ID of the touchscreen event.| + +### OH_Input_SetTouchEventDisplayId() + +``` +void OH_Input_SetTouchEventDisplayId(struct Input_TouchEvent* touchEvent, int32_t displayId) +``` + +**Description** + +Sets the screen ID of a touchscreen event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 15 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| struct [Input_TouchEvent](capi-input-touchevent.md)* touchEvent | Touch event object.| +| int32_t displayId | Screen ID of the touchscreen event.| + +### OH_Input_CancelInjection() + +``` +void OH_Input_CancelInjection() +``` + +**Description** + +Stops event injection and revokes authorization. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + +### OH_Input_CreateAxisEvent() + +``` +Input_AxisEvent* OH_Input_CreateAxisEvent(void) +``` + +**Description** + +Creates an axis event object. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + +**Return value** + +| Type| Description| +| -- | -- | +| Input_AxisEvent* | [Input_AxisEvent](capi-input-axisevent.md) object if the operation is successful; **null** otherwise.| + +### OH_Input_DestroyAxisEvent() + +``` +Input_Result OH_Input_DestroyAxisEvent(Input_AxisEvent** axisEvent) +``` + +**Description** + +Destroys an axis event object. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_AxisEvent](capi-input-axisevent.md)** axisEvent | Pointer to the axis event object.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR] (#input_result) if **axisEvent** is null.| + +### OH_Input_SetAxisEventAction() + +``` +Input_Result OH_Input_SetAxisEventAction(Input_AxisEvent* axisEvent, InputEvent_AxisAction action) +``` + +**Description** + +Sets the action for an axis event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_AxisEvent](capi-input-axisevent.md)* axisEvent | Axis event object.| +| [InputEvent_AxisAction](capi-oh-axis-type-h.md#inputevent_axisaction) action | Axis event action. For details, see [InputEvent_AxisAction](capi-oh-axis-type-h.md#inputevent_axis).| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR] (#input_result) if **axisEvent** is null.| + +### OH_Input_GetAxisEventAction() + +``` +Input_Result OH_Input_GetAxisEventAction(const Input_AxisEvent* axisEvent, InputEvent_AxisAction *action) +``` + +**Description** + +Obtains the action of an axis event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| const [Input_AxisEvent](capi-input-axisevent.md)* axisEvent | Axis event object.| +| [InputEvent_AxisAction](capi-oh-axis-type-h.md#inputevent_axisaction) *action | Axis event action. For details, see [InputEvent_AxisAction](capi-oh-axis-type-h.md#inputevent_axisaction).| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR] (#input_result) if **axisEvent** or **action** is null.| + +### OH_Input_SetAxisEventDisplayX() + +``` +Input_Result OH_Input_SetAxisEventDisplayX(Input_AxisEvent* axisEvent, float displayX) +``` + +**Description** + +Sets the X coordinate for an axis event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_AxisEvent](capi-input-axisevent.md)* axisEvent | Axis event object.| +| float displayX | X coordinate of the axis event.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR] (#input_result) if **axisEvent** is null.| + +### OH_Input_GetAxisEventDisplayX() + +``` +Input_Result OH_Input_GetAxisEventDisplayX(const Input_AxisEvent* axisEvent, float* displayX) +``` + +**Description** + +Obtains the X coordinate of an axis event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| const [Input_AxisEvent](capi-input-axisevent.md)* axisEvent | Axis event object.| +| float* displayX | X coordinate of the axis event.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR] (#input_result) if **axisEvent** or **displayX** is null.| + +### OH_Input_SetAxisEventDisplayY() + +``` +Input_Result OH_Input_SetAxisEventDisplayY(Input_AxisEvent* axisEvent, float displayY) +``` + +**Description** + +Sets the Y coordinate for an axis event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_AxisEvent](capi-input-axisevent.md)* axisEvent | Axis event object. For details, see [Input_AxisEvent](capi-input-axisevent.md).| +| float displayY | Y coordinate of the axis event.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR] (#input_result) if **axisEvent** is null.| + +### OH_Input_GetAxisEventDisplayY() + +``` +Input_Result OH_Input_GetAxisEventDisplayY(const Input_AxisEvent* axisEvent, float* displayY) +``` + +**Description** + +Obtains the Y coordinate of an axis event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| const [Input_AxisEvent](capi-input-axisevent.md)* axisEvent | Axis event object. For details, see [Input_AxisEvent](capi-input-axisevent.md).| +| float* displayY | Y coordinate of the axis event.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR] (#input_result) if **axisEvent** or **displayY** is null.| + +### OH_Input_SetAxisEventAxisValue() + +``` +Input_Result OH_Input_SetAxisEventAxisValue(Input_AxisEvent* axisEvent,InputEvent_AxisType axisType, double axisValue) +``` + +**Description** + +Sets the axis value of the axis type specified by the axis event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_AxisEvent](capi-input-axisevent.md)* axisEvent | Axis event object. For details, see [Input_AxisEvent](capi-input-axisevent.md).| +| [InputEvent_AxisType](capi-oh-axis-type-h.md#inputevent_axistype) axisType | Axis type. For details, see [InputEvent_AxisType](capi-oh-axis-type-h.md#inputevent_axistype).| +| double axisValue | Axis event axis value.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR] (#input_result) if **axisEvent** is null.| + +### OH_Input_GetAxisEventAxisValue() + +``` +Input_Result OH_Input_GetAxisEventAxisValue(const Input_AxisEvent* axisEvent,InputEvent_AxisType axisType, double* axisValue) +``` + +**Description** + +Obtains the axis value for the specified axis type of the axis event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| const [Input_AxisEvent](capi-input-axisevent.md)* axisEvent | Axis event object. For details, see [Input_AxisEvent](capi-input-axisevent.md).| +| [InputEvent_AxisType](capi-oh-axis-type-h.md#inputevent_axistype) axisType | Axis type. For details, see [InputEvent_AxisType](capi-oh-axis-type-h.md#inputevent_axistype).| +| double* axisValue | Axis value of the axis event.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR] (#input_result) if **axisEvent** or **axisValue** is null.| + +### OH_Input_SetAxisEventActionTime() + +``` +Input_Result OH_Input_SetAxisEventActionTime(Input_AxisEvent* axisEvent, int64_t actionTime) +``` + +**Description** + +Sets the time when an axis event occurs. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_AxisEvent](capi-input-axisevent.md)* axisEvent | Axis event object. For details, see [Input_AxisEvent](capi-input-axisevent.md).| +| int64_t actionTime | Time when an event occurs.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR] (#input_result) if **axisEvent** is null.| + +### OH_Input_GetAxisEventActionTime() + +``` +Input_Result OH_Input_GetAxisEventActionTime(const Input_AxisEvent* axisEvent, int64_t* actionTime) +``` + +**Description** + +Obtains the time when an axis event occurs. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| const [Input_AxisEvent](capi-input-axisevent.md)* axisEvent | Axis event object. For details, see [Input_AxisEvent](capi-input-axisevent.md).| +| int64_t* actionTime | Time when an axis event occurs.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR] (#input_result) if **axisEvent** or **actionTime** is null.| + +### OH_Input_SetAxisEventType() + +``` +Input_Result OH_Input_SetAxisEventType(Input_AxisEvent* axisEvent, InputEvent_AxisEventType axisEventType) +``` + +**Description** + +Sets the axis event type. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_AxisEvent](capi-input-axisevent.md)* axisEvent | Axis event object. For details, see [Input_AxisEvent](capi-input-axisevent.md).| +| [InputEvent_AxisEventType](capi-oh-axis-type-h.md#inputevent_axiseventtype) axisEventType | Axis event type. For details, see [InputEvent_AxisEventType](capi-oh-axis-type-h.md#inputevent_axiseventtype).| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR] (#input_result) if **axisEvent** is null.| + +### OH_Input_GetAxisEventType() + +``` +Input_Result OH_Input_GetAxisEventType(const Input_AxisEvent* axisEvent, InputEvent_AxisEventType* axisEventType) +``` + +**Description** + +Obtains the axis event type. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| const [Input_AxisEvent](capi-input-axisevent.md)* axisEvent | Axis event object.| +| [InputEvent_AxisEventType](capi-oh-axis-type-h.md#inputevent_axiseventtype)* axisEventType | Axis event type. For details, see [InputEvent_AxisEventType](capi-oh-axis-type-h.md#inputevent_axiseventtype).| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR] (#input_result) if **axisEvent** or **axisEventType** is null.| + +### OH_Input_SetAxisEventSourceType() + +``` +Input_Result OH_Input_SetAxisEventSourceType(Input_AxisEvent* axisEvent, InputEvent_SourceType sourceType) +``` + +**Description** + +Sets the axis event source type. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_AxisEvent](capi-input-axisevent.md)* axisEvent | Axis event object.| +| [InputEvent_SourceType](#inputevent_sourcetype) sourceType | Axis event source type. For details, see [InputEvent_SourceType](#inputevent_sourcetype).| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR] (#input_result) if **axisEvent** is null.| + +### OH_Input_GetAxisEventSourceType() + +``` +Input_Result OH_Input_GetAxisEventSourceType(const Input_AxisEvent* axisEvent, InputEvent_SourceType* sourceType) +``` + +**Description** + +Obtains the axis event source type. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| const [Input_AxisEvent](capi-input-axisevent.md)* axisEvent | Axis event object.| +| [InputEvent_SourceType](#inputevent_sourcetype)* sourceType | Axis event source type. For details, see [InputEvent_SourceType](#inputevent_sourcetype).| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR] (#input_result) if **axisEvent** or **sourceType** is null.| + +### OH_Input_SetAxisEventWindowId() + +``` +Input_Result OH_Input_SetAxisEventWindowId(Input_AxisEvent* axisEvent, int32_t windowId) +``` + +**Description** + +Sets the window ID of an axis event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 15 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_AxisEvent](capi-input-axisevent.md)* axisEvent | Axis event object.| +| int32_t windowId | Window ID of the axis event.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR] (#input_result) if **axisEvent** is null.| + +### OH_Input_GetAxisEventWindowId() + +``` +Input_Result OH_Input_GetAxisEventWindowId(const Input_AxisEvent* axisEvent, int32_t* windowId) +``` + +**Description** + +Obtains the window ID of an axis event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 15 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| const [Input_AxisEvent](capi-input-axisevent.md)* axisEvent | Axis event object.| +| int32_t* windowId | Window ID of the axis event.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR] (#input_result) if **axisEvent** or **windowId** is null.| + +### OH_Input_SetAxisEventDisplayId() + +``` +Input_Result OH_Input_SetAxisEventDisplayId(Input_AxisEvent* axisEvent, int32_t displayId) +``` + +**Description** + +Sets the screen ID of an axis event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 15 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_AxisEvent](capi-input-axisevent.md)* axisEvent | Axis event object.| +| int32_t displayId | Screen ID of the axis event.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR] (#input_result) if **axisEvent** is null.| + +### OH_Input_GetAxisEventDisplayId() + +``` +Input_Result OH_Input_GetAxisEventDisplayId(const Input_AxisEvent* axisEvent, int32_t* displayId) +``` + +**Description** + +Obtains the screen ID of an axis event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 15 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| const [Input_AxisEvent](capi-input-axisevent.md)* axisEvent | Axis event object.| +| int32_t* displayId | Screen ID of the axis event.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR] (#input_result) if **axisEvent** or **displayId** is null.| + +### OH_Input_AddKeyEventMonitor() + +``` +Input_Result OH_Input_AddKeyEventMonitor(Input_KeyEventCallback callback) +``` + +**Description** + +Adds a listener for key events. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Required permissions**: ohos.permission.INPUT_MONITORING + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_KeyEventCallback](#input_keyeventcallback) callback | Callback used to receive key events.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PERMISSION_DENIED](#input_result) if permission verification fails;
[INPUT_PARAMETER_ERROR](#input_result) if the callback is empty; [INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| + +### OH_Input_AddMouseEventMonitor() + +``` +Input_Result OH_Input_AddMouseEventMonitor(Input_MouseEventCallback callback) +``` + +**Description** + +Adds a listener for mouse events, including mouse click and movement events, but not scroll wheel events. Scroll wheel events are axis events. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Required permissions**: ohos.permission.INPUT_MONITORING + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_MouseEventCallback](#input_mouseeventcallback) callback | Callback used to receive mouse events.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PERMISSION_DENIED](#input_result) if permission verification fails;
[INPUT_PARAMETER_ERROR](#input_result) if the callback is empty; [INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| + +### OH_Input_AddTouchEventMonitor() + +``` +Input_Result OH_Input_AddTouchEventMonitor(Input_TouchEventCallback callback) +``` + +**Description** + +Adds a listener for touch events. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Required permissions**: ohos.permission.INPUT_MONITORING + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_TouchEventCallback](#input_toucheventcallback) callback | Callback used to receive touch events.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PERMISSION_DENIED](#input_result) if permission verification fails;
[INPUT_PARAMETER_ERROR](#input_result) if the callback is empty; [INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| + +### OH_Input_AddAxisEventMonitorForAll() + +``` +Input_Result OH_Input_AddAxisEventMonitorForAll(Input_AxisEventCallback callback) +``` + +**Description** + +Adds a listener for all types of axis events, which are defined in [InputEvent_AxisEventType](capi-oh-axis-type-h.md#inputevent_axiseventtype). + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Required permissions**: ohos.permission.INPUT_MONITORING + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_AxisEventCallback](#input_axiseventcallback) callback | Callback used to receive axis events.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PERMISSION_DENIED](#input_result) if permission verification fails;
[INPUT_PARAMETER_ERROR](#input_result) if the callback is empty; [INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| + +### OH_Input_AddAxisEventMonitor() + +``` +Input_Result OH_Input_AddAxisEventMonitor(InputEvent_AxisEventType axisEventType, Input_AxisEventCallback callback) +``` + +**Description** + +Adds a listener for the specified type of axis events, which are defined in [InputEvent_AxisEventType](capi-oh-axis-type-h.md#inputevent_axiseventtype). + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Required permissions**: ohos.permission.INPUT_MONITORING + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [InputEvent_AxisEventType](capi-oh-axis-type-h.md#inputevent_axiseventtype) axisEventType | Axis event type, which is defined in [InputEvent_AxisEventType](capi-oh-axis-type-h.md#inputevent_axiseventtype).| +| [Input_AxisEventCallback](#input_axiseventcallback) callback | Callback used to receive the specified type of axis events.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PERMISSION_DENIED](#input_result) if permission verification fails;
[INPUT_PARAMETER_ERROR](#input_result) if the callback is empty; [INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| + +### OH_Input_RemoveKeyEventMonitor() + +``` +Input_Result OH_Input_RemoveKeyEventMonitor(Input_KeyEventCallback callback) +``` + +**Description** + +Removes the listener for key events. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Required permissions**: ohos.permission.INPUT_MONITORING + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_KeyEventCallback](#input_keyeventcallback) callback | Callback for key events.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PERMISSION_DENIED](#input_result) if permission verification fails;
[INPUT_PARAMETER_ERROR] (#input_result) if the callback is empty or no listener is added; [INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| + +### OH_Input_RemoveMouseEventMonitor() + +``` +Input_Result OH_Input_RemoveMouseEventMonitor(Input_MouseEventCallback callback) +``` + +**Description** + +Removes the listener for mouse events. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Required permissions**: ohos.permission.INPUT_MONITORING + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_MouseEventCallback](#input_mouseeventcallback) callback | Callback for mouse events.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PERMISSION_DENIED](#input_result) if permission verification fails;
[INPUT_PARAMETER_ERROR] (#input_result) if the callback is empty or no listener is added; [INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| + +### OH_Input_RemoveTouchEventMonitor() + +``` +Input_Result OH_Input_RemoveTouchEventMonitor(Input_TouchEventCallback callback) +``` + +**Description** + +Removes the listener for touch events. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Required permissions**: ohos.permission.INPUT_MONITORING + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_TouchEventCallback](#input_toucheventcallback) callback | Callback for touch events.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PERMISSION_DENIED](#input_result) if permission verification fails;
[INPUT_PARAMETER_ERROR] (#input_result) if the callback is empty or no listener is added; [INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| + +### OH_Input_RemoveAxisEventMonitorForAll() + +``` +Input_Result OH_Input_RemoveAxisEventMonitorForAll(Input_AxisEventCallback callback) +``` + +**Description** + +Removes the listener for all types of axis events. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Required permissions**: ohos.permission.INPUT_MONITORING + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_AxisEventCallback](#input_axiseventcallback) callback | Callback for the all types of axis events.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PERMISSION_DENIED](#input_result) if permission verification fails;
[INPUT_PARAMETER_ERROR] (#input_result) if the callback is empty or no listener is added; [INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| + +### OH_Input_RemoveAxisEventMonitor() + +``` +Input_Result OH_Input_RemoveAxisEventMonitor(InputEvent_AxisEventType axisEventType, Input_AxisEventCallback callback) +``` + +**Description** + +Removes the listener for the specified type of axis events, which are defined in [InputEvent_AxisEventType](capi-oh-axis-type-h.md#inputevent_axiseventtype). + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Required permissions**: ohos.permission.INPUT_MONITORING + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [InputEvent_AxisEventType](capi-oh-axis-type-h.md#inputevent_axiseventtype) axisEventType | Axis event type, which is defined in [InputEvent_AxisEventType](capi-oh-axis-type-h.md#inputevent_axiseventtype).| +| [Input_AxisEventCallback](#input_axiseventcallback) callback | Callback for the specified type of axis events.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PERMISSION_DENIED](#input_result) if permission verification fails;
[INPUT_PARAMETER_ERROR] (#input_result) if the callback is empty or no listener is added; [INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| + +### OH_Input_AddKeyEventInterceptor() + +``` +Input_Result OH_Input_AddKeyEventInterceptor(Input_KeyEventCallback callback, Input_InterceptorOptions *option) +``` + +**Description** + +Adds an interceptor for key events. If multiple interceptors are added, only the first one takes effect. Key events are intercepted only when the application gains focus. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Required permission**: ohos.permission.INTERCEPT_INPUT_EVENT + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_KeyEventCallback](#input_keyeventcallback) callback | Callback used to receive key events.| +| [Input_InterceptorOptions](capi-input-interceptoroptions.md) *option | Options for event interception. If **null** is passed, the default value is used.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PERMISSION_DENIED](#input_result) if permission verification fails;
[INPUT_PARAMETER_ERROR] (#input_result) if the callback is empty or no listener is added; [INPUT_REPEAT_INTERCEPTOR](#input_result) if an interceptor is repeatedly added;
[INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| + +### OH_Input_AddInputEventInterceptor() + +``` +Input_Result OH_Input_AddInputEventInterceptor(Input_InterceptorEventCallback *callback,Input_InterceptorOptions *option) +``` + +**Description** + +Adds an interceptor for input events, including mouse, touch, and axis events. If multiple interceptors are added, only the first one takes effect. Key events are intercepted only when the application window is hit. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Required permission**: ohos.permission.INTERCEPT_INPUT_EVENT + +**Since**: 12 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_InterceptorEventCallback](capi-input-interceptoreventcallback.md) *callback | Pointer to the structure of the interceptor event callback. For details, see [Input_InterceptorEventCallback](capi-input-interceptoreventcallback.md).| +| [Input_InterceptorOptions](capi-input-interceptoroptions.md) *option | Options for event interception. If **null** is passed, the default value is used.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PERMISSION_DENIED](#input_result) if permission verification fails;
[INPUT_PARAMETER_ERROR] (#input_result) if the callback is empty or no listener is added; [INPUT_REPEAT_INTERCEPTOR](#input_result) if an interceptor is repeatedly added;
[INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| + +### OH_Input_RemoveKeyEventInterceptor() + +``` +Input_Result OH_Input_RemoveKeyEventInterceptor(void) +``` + +**Description** + +Removes the interceptor for key events. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Required permission**: ohos.permission.INTERCEPT_INPUT_EVENT + +**Since**: 12 + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PERMISSION_DENIED](#input_result) if permission verification fails;
[INPUT_SERVICE_EXCEPTION] (#input_result) if the service is abnormal.| + +### OH_Input_RemoveInputEventInterceptor() + +``` +Input_Result OH_Input_RemoveInputEventInterceptor(void) +``` + +**Description** + +Removes the interceptor for input events, including mouse, touch, and axis events. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Required permission**: ohos.permission.INTERCEPT_INPUT_EVENT + +**Since**: 12 + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PERMISSION_DENIED](#input_result) if permission verification fails;
[INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| + +### OH_Input_GetIntervalSinceLastInput() + +``` +Input_Result OH_Input_GetIntervalSinceLastInput(int64_t *timeInterval) +``` + +**Description** + +Obtains the interval since the last system input event. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 14 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| int64_t *timeInterval | Interval, in microseconds.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | Status code of the **OH_Input_GetIntervalSinceLastInput** function,
[INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_SERVICE_EXCEPTION](#input_result) otherwise.| + +### OH_Input_CreateHotkey() + +``` +Input_Hotkey *OH_Input_CreateHotkey(void) +``` + +**Description** + +Creates a shortcut key object. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 14 + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Hotkey](capi-input-hotkey.md) | [Input_Hotkey](capi-input-hotkey.md) pointer if the operation is successful; a null pointer otherwise (possibly because of a memory allocation failure).| + +### OH_Input_DestroyHotkey() + +``` +void OH_Input_DestroyHotkey(Input_Hotkey **hotkey) +``` + +**Description** + +Destroys a shortcut key object. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 14 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_Hotkey](capi-input-hotkey.md) **hotkey | Shortcut key object.| + +### OH_Input_SetPreKeys() + +``` +void OH_Input_SetPreKeys(Input_Hotkey *hotkey, int32_t *preKeys, int32_t size) +``` + +**Description** + +Sets the modifier keys. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 14 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_Hotkey](capi-input-hotkey.md) *hotkey | Shortcut key object.| +| int32_t *preKeys | List of modifier keys.| +| int32_t size | Number of modifier keys. One or two modifier keys are supported.| + +### OH_Input_GetPreKeys() + +``` +Input_Result OH_Input_GetPreKeys(const Input_Hotkey *hotkey, int32_t **preKeys, int32_t *preKeyCount) +``` + +**Description** + +Obtains the modifier key. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 14 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| const [Input_Hotkey](capi-input-hotkey.md) *hotkey | Shortcut key object.| +| int32_t **preKeys | List of modifier keys.| +| int32_t *preKeyCount | Number of modifier keys.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | Status code of the **OH_Input_GetpressedKeys** function, which is
[INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR](#input_result) otherwise.| + +### OH_Input_SetFinalKey() + +``` +void OH_Input_SetFinalKey(Input_Hotkey* hotkey, int32_t finalKey) +``` + +**Description** + +Sets the modified key. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 14 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_Hotkey](capi-input-hotkey.md)* hotkey | Shortcut key object.| +| int32_t finalKey | Modifier key value. Only one modifier key value is allowed.| + +### OH_Input_GetFinalKey() + +``` +Input_Result OH_Input_GetFinalKey(const Input_Hotkey* hotkey, int32_t *finalKeyCode) +``` + +**Description** + +Obtains the modified key. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 14 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| const [Input_Hotkey](capi-input-hotkey.md)* hotkey | Shortcut key object.| +| int32_t *finalKeyCode | Modified key.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | Status code of the **OH_Input_GetfinalKey** function, which is
[INPUT_SUCCESS](#input_result) if the operation is successful;
[INPUT_PARAMETER_ERROR](#input_result) otherwise.| + +### OH_Input_CreateAllSystemHotkeys() + +``` +Input_Hotkey **OH_Input_CreateAllSystemHotkeys(int32_t count) +``` + +**Description** + +Creates an array of [Input_Hotkey](capi-input-hotkey.md) instances. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 14 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| int32_t count | Number of [Input_Hotkey](capi-input-hotkey.md) instances.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Hotkey](capi-input-hotkey.md) | OH_Input_CreateAllSystemHotkey status code,
which is [INPUT_SUCCESS](#input_result) if the operation is successful.| + +### OH_Input_DestroyAllSystemHotkeys() + +``` +void OH_Input_DestroyAllSystemHotkeys(Input_Hotkey **hotkeys, int32_t count) +``` + +**Description** + +Destroys the array of [Input_Hotkey](capi-input-hotkey.md) instances and reclaims the memory. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 14 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_Hotkey](capi-input-hotkey.md) **hotkeys | Double pointer to the array of [Input_Hotkey](capi-input-hotkey.md) instances.| +| int32_t count | Number of [Input_Hotkey](capi-input-hotkey.md) instances.| + +### OH_Input_GetAllSystemHotkeys() + +``` +Input_Result OH_Input_GetAllSystemHotkeys(Input_Hotkey **hotkey, int32_t *count) +``` + +**Description** + +Obtains all configured shortcut keys. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 14 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_Hotkey](capi-input-hotkey.md) **hotkey | Array of [Input_Hotkey](capi-input-hotkey.md) instances. When calling this API for the first time, you can pass **NULL** to obtain the array length.| +| int32_t *count | Number of supported shortcut keys.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | Status code of the **OH_Input_GetAllSystemHotkeys** function, which is
[INPUT_SUCCESS](#input_result) if the operation is successful;
[INPUT_PARAMETER_ERROR](#input_result) otherwise.| + +### OH_Input_SetRepeat() + +``` +void OH_Input_SetRepeat(Input_Hotkey* hotkey, bool isRepeat) +``` + +**Description** + +Specifies whether to report repeated key events. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 14 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_Hotkey](capi-input-hotkey.md)* hotkey | Shortcut key object.| +| bool isRepeat | Whether to report repeated key events. The value **true** means to report repeated key events, and the value **false** means the opposite.| + +### OH_Input_GetRepeat() + +``` +Input_Result OH_Input_GetRepeat(const Input_Hotkey* hotkey, bool *isRepeat) +``` + +**Description** + +Checks whether to report repeated key events. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 14 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| const [Input_Hotkey](capi-input-hotkey.md)* hotkey | Shortcut key object.| +| bool *isRepeat | Whether the reported key event is repeated.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | OH_Input_GetIsRepeat status code, specifically,
[INPUT_SUCCESS](#input_result) if the operation is successful;
[INPUT_PARAMETER_ERROR](#input_result) otherwise.| + +### OH_Input_AddHotkeyMonitor() + +``` +Input_Result OH_Input_AddHotkeyMonitor(const Input_Hotkey* hotkey, Input_HotkeyCallback callback) +``` + +**Description** + +Subscribes to shortcut key events. This API is not applicable to wearables and lite wearables. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 14 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| const [Input_Hotkey](capi-input-hotkey.md)* hotkey | Shortcut key object.| +| [Input_HotkeyCallback](#input_hotkeycallback) callback | Defines the callback used to return shortcut key events.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | OH_Input_AddHotkeyMonitor status code, specifically,
[INPUT_SUCCESS](#input_result) if the operation is successful;
[INPUT_PARAMETER_ERROR](#input_result) if parameter verification fails;
[INPUT_OCCUPIED_BY_SYSTEM](#input_result) if the shortcut key has been occupied by the system (you can use [OH_Input_GetAllSystemHotkeys](#oh_input_getallsystemhotkeys) to query allsystem shortcut keys);
[INPUT_OCCUPIED_BY_OTHER](#input_result) if the shortcut key has been occupied by another application;
[INPUT_DEVICE_NOT_SUPPORTED](#input_result) if the function is not supported.| + +### OH_Input_RemoveHotkeyMonitor() + +``` +Input_Result OH_Input_RemoveHotkeyMonitor(const Input_Hotkey* hotkey, Input_HotkeyCallback callback) +``` + +**Description** + +Unsubscribes from shortcut key events. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 14 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| const [Input_Hotkey](capi-input-hotkey.md)* hotkey | Shortcut key object.| +| [Input_HotkeyCallback](#input_hotkeycallback) callback | Defines the callback used to return shortcut key events.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | OH_Input_RemoveHotkeyMonitor status code, specifically,
[INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR](#input_result) if parameter verification fails.| + +### OH_Input_RegisterDeviceListener() + +``` +Input_Result OH_Input_RegisterDeviceListener(Input_DeviceListener* listener) +``` + +**Description** + +Registers a listener for device hot swap events. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 13 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_DeviceListener](capi-input-devicelistener.md)* listener | Pointer to the [Input_DeviceListener](capi-input-devicelistener.md) object.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | **OH_Input_RegisterDeviceListener** status code, specifically:
[INPUT_SUCCESS](#input_result) if the operation is successful;
[INPUT_PARAMETER_ERROR](#input_result) if the listener is null.| + +### OH_Input_UnregisterDeviceListener() + +``` +Input_Result OH_Input_UnregisterDeviceListener(Input_DeviceListener* listener) +``` + +**Description** + +Unregisters the listener for device hot swap events. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 13 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_DeviceListener](capi-input-devicelistener.md)* listener | Pointer to the [Input_DeviceListener](capi-input-devicelistener.md) object.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | **OH_Input_UnregisterDeviceListener** status code, specifically:
[INPUT_SUCCESS](#input_result) if the operation is successful;
[INPUT_PARAMETER_ERROR](#input_result) if **listener** is **NULL** or the listener is not registered;
[INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| + +### OH_Input_UnregisterDeviceListeners() + +``` +Input_Result OH_Input_UnregisterDeviceListeners() +``` + +**Description** + +Unregisters the listener for all device hot swap events. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 13 + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | **OH_Input_UnregisterDeviceListener** status code, specifically:
[INPUT_SUCCESS](#input_result) if the operation is successful;
[INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| + +### OH_Input_GetDeviceIds() + +``` +Input_Result OH_Input_GetDeviceIds(int32_t *deviceIds, int32_t inSize, int32_t *outSize) +``` + +**Description** + +Obtains the IDs of all input devices. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 13 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| int32_t *deviceIds | List of input device IDs.| +| int32_t inSize | Size of the input device ID list.| +| int32_t *outSize | Length of the input device ID list. The value must be less than or equal to the value of **inSize**.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful;
[INPUT_PARAMETER_ERROR](#input_result) if **deviceIds** or **outSize** is a null pointer or **inSize** is less than **0**.| + +### OH_Input_GetDevice() + +``` +Input_Result OH_Input_GetDevice(int32_t deviceId, Input_DeviceInfo **deviceInfo) +``` + +**Description** + +Obtains information about the input device. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 13 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| int32_t deviceId | Device ID.| +| [Input_DeviceInfo](capi-input-deviceinfo.md) **deviceInfo | Pointer to the [Input_DeviceInfo](capi-input-deviceinfo.md) object.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful;
[INPUT_PARAMETER_ERROR](#input_result) if **deviceInfo** is a null pointer or **deviceId** is invalid.
You can use [OH_Input_GetDeviceIds](#oh_input_getdeviceids) to query the device IDs supported by the system.| + +### OH_Input_CreateDeviceInfo() + +``` +Input_DeviceInfo* OH_Input_CreateDeviceInfo(void) +``` + +**Description** + +Creates a **deviceInfo** object. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 13 + +**Return value** + +| Type| Description| +| -- | -- | +| Input_DeviceInfo* | Pointer to the [Input_DeviceInfo](capi-input-deviceinfo.md) object if the operation is successful; a null pointer otherwise (possibly because of a memory allocation failure).| + +### OH_Input_DestroyDeviceInfo() + +``` +void OH_Input_DestroyDeviceInfo(Input_DeviceInfo **deviceInfo) +``` + +**Description** + +Destroys a **deviceInfo** object. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 13 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_DeviceInfo](capi-input-deviceinfo.md) **deviceInfo | **deviceInfo** object.| + +### OH_Input_GetKeyboardType() + +``` +Input_Result OH_Input_GetKeyboardType(int32_t deviceId, int32_t *keyboardType) +``` + +**Description** + +Obtains the keyboard type of an input device. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 13 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| int32_t deviceId | Device ID.| +| int32_t *keyboardType | Pointer to the keyboard type of the input device.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful;
[INPUT_PARAMETER_ERROR](#input_result) if the device ID is invalid or **keyboardType** is a null pointer.| + +### OH_Input_GetDeviceId() + +``` +Input_Result OH_Input_GetDeviceId(Input_DeviceInfo *deviceInfo, int32_t *id) +``` + +**Description** + +Obtains the ID of an input device. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 13 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_DeviceInfo](capi-input-deviceinfo.md) *deviceInfo | Input device information. For details, see [Input_DeviceInfo](capi-input-deviceinfo.md).| +| int32_t *id | Pointer to the input device ID.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful;
[INPUT_PARAMETER_ERROR](#input_result) if **deviceInfo** or **id** is a null pointer.| + +### OH_Input_GetDeviceName() + +``` +Input_Result OH_Input_GetDeviceName(Input_DeviceInfo *deviceInfo, char **name) +``` + +**Description** + +Obtains the name of an input device. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 13 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_DeviceInfo](capi-input-deviceinfo.md) *deviceInfo | Input device information. For details, see [Input_DeviceInfo](capi-input-deviceinfo.md).| +| char **name | Pointer to the input device name.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful;
[INPUT_PARAMETER_ERROR](#input_result) if **deviceInfo** or **name** is a null pointer.| + +### OH_Input_GetCapabilities() + +``` +Input_Result OH_Input_GetCapabilities(Input_DeviceInfo *deviceInfo, int32_t *capabilities) +``` + +**Description** + +Obtains the capabilities of an input device, for example, a touchscreen, touchpad, or keyboard. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 13 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_DeviceInfo](capi-input-deviceinfo.md) *deviceInfo | Input device information. For details, see [Input_DeviceInfo](capi-input-deviceinfo.md).| +| int32_t *capabilities | Pointer to the capability information of the input device.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful;
[INPUT_PARAMETER_ERROR](#input_result) if **deviceInfo** or **capabilities** is a null pointer.| + +### OH_Input_GetDeviceVersion() + +``` +Input_Result OH_Input_GetDeviceVersion(Input_DeviceInfo *deviceInfo, int32_t *version) +``` + +**Description** + +Obtains the version information of an input device. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 13 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_DeviceInfo](capi-input-deviceinfo.md) *deviceInfo | Input device information. For details, see [Input_DeviceInfo](capi-input-deviceinfo.md).| +| int32_t *version | Pointer to the version information of the input device.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful;
[INPUT_PARAMETER_ERROR](#input_result) if **deviceInfo** or **version** is a null pointer.| + +### OH_Input_GetDeviceProduct() + +``` +Input_Result OH_Input_GetDeviceProduct(Input_DeviceInfo *deviceInfo, int32_t *product) +``` + +**Description** + +Obtains the product information of an input device. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 13 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_DeviceInfo](capi-input-deviceinfo.md) *deviceInfo | Input device information. For details, see [Input_DeviceInfo](capi-input-deviceinfo.md).| +| int32_t *product | Pointer to the product information of the input device.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful;
[INPUT_PARAMETER_ERROR](#input_result) if **deviceInfo** or **product** is a null pointer.| + +### OH_Input_GetDeviceVendor() + +``` +Input_Result OH_Input_GetDeviceVendor(Input_DeviceInfo *deviceInfo, int32_t *vendor) +``` + +**Description** + +Obtains the vendor information of an input device. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 13 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_DeviceInfo](capi-input-deviceinfo.md) *deviceInfo | Input device information. For details, see [Input_DeviceInfo](capi-input-deviceinfo.md).| +| int32_t *vendor | Pointer to the vendor information of the input device.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful;
[INPUT_PARAMETER_ERROR](#input_result) if **deviceInfo** or **vendor** is a null pointer.| + +### OH_Input_GetDeviceAddress() + +``` +Input_Result OH_Input_GetDeviceAddress(Input_DeviceInfo *deviceInfo, char **address) +``` + +**Description** + +Obtains the physical address of an input device. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 13 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| [Input_DeviceInfo](capi-input-deviceinfo.md) *deviceInfo | Input device information. For details, see [Input_DeviceInfo](capi-input-deviceinfo.md).| +| char **address | Pointer to the physical address of the input device.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful;
[INPUT_PARAMETER_ERROR](#input_result) if **deviceInfo** or **address** is a null pointer.| + +### OH_Input_GetFunctionKeyState() + +``` +Input_Result OH_Input_GetFunctionKeyState(int32_t keyCode, int32_t *state) +``` + +**Description** + +Obtains the function key status. + +**Since**: 15 + + +**Parameters** + +| Parameter| Description| +| -- | -- | +| int32_t keyCode | Function key. Only the **CapsLock** key is supported.| +| int32_t *state | Function key status. The value **0** indicates that the function key is disabled, and the value **1** indicates that the function key is enabled.| + +**Return value** + +| Type| Description| +| -- | -- | +| [Input_Result](#input_result) | **OH_Input_GetFunctionKeyState** status code, specifically:
[INPUT_SUCCESS](#input_result) if the operation is successful;
[INPUT_PARAMETER_ERROR](#input_result) if the parameter is incorrect;
{@link INPUT_DEVICE_NOT_EXIST } if the keyboard does not exist.| diff --git a/en/application-dev/reference/apis-input-kit/capi-oh-key-code-h.md b/en/application-dev/reference/apis-input-kit/capi-oh-key-code-h.md new file mode 100644 index 00000000000..29108041528 --- /dev/null +++ b/en/application-dev/reference/apis-input-kit/capi-oh-key-code-h.md @@ -0,0 +1,174 @@ +# oh_key_code.h + +## Overview + +Defines key codes of the key device. + +**Library**: libohinput.so + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +**Since**: 12 + +**Related module**: [input](capi-input.md) + +## Summary + +### Enums + +| Name| typedef Keyword| Description| +| -- | -- | -- | +| [Input_KeyCode](#input_keycode) | Input_KeyCode | Key code value.| + +## Enum Description + +### Input_KeyCode + +``` +enum Input_KeyCode +``` + +**Description** + +Enumerates keycode values. + +**Since**: 12 + +| Enum| Description| +| -- | -- | +| KEYCODE_UNKNOWN = -1 | Unknown key.| +| KEYCODE_FN = 0 | Function (Fn) key.| +| KEYCODE_VOLUME_UP = 16 | Volume Up key.| +| KEYCODE_VOLUME_DOWN = 17 | Volume Down key.| +| KEYCODE_POWER = 18 | Power key.| +| KEYCODE_CAMERA = 19 | Camera key.| +| KEYCODE_VOLUME_MUTE = 22 | Speaker Mute key.| +| KEYCODE_MUTE = 23 | Mute key.| +| KEYCODE_BRIGHTNESS_UP = 40 | Brightness Up key| +| KEYCODE_BRIGHTNESS_DOWN = 41 | Brightness Down key| +| KEYCODE_0 = 2000 | Key 0.| +| KEYCODE_1 = 2001 | Key 1.| +| KEYCODE_2 = 2002 | Key 2.| +| KEYCODE_3 = 2003 | Key 3.| +| KEYCODE_4 = 2004 | Key 4.| +| KEYCODE_5 = 2005 | Key 5.| +| KEYCODE_6 = 2006 | Key 6.| +| KEYCODE_7 = 2007 | Key 7.| +| KEYCODE_8 = 2008 | Key 8.| +| KEYCODE_9 = 2009 | Key 9.| +| KEYCODE_STAR = 2010 | Key *| +| KEYCODE_POUND = 2011 | Key #| +| KEYCODE_DPAD_UP = 2012 | Up key on D-pad| +| KEYCODE_DPAD_DOWN = 2013 | Down key on D-pad| +| KEYCODE_DPAD_LEFT = 2014 | Left key on D-pad| +| KEYCODE_DPAD_RIGHT = 2015 | Right key on D-pad| +| KEYCODE_DPAD_CENTER = 2016 | Center key on D-pad| +| KEYCODE_A = 2017 | Key A.| +| KEYCODE_B = 2018 | Key B.| +| KEYCODE_C = 2019 | Key C.| +| KEYCODE_D = 2020 | Key D.| +| KEYCODE_E = 2021 | Key E.| +| KEYCODE_F = 2022 | Key F.| +| KEYCODE_G = 2023 | Key G.| +| KEYCODE_H = 2024 | Key H.| +| KEYCODE_I = 2025 | Key I.| +| KEYCODE_J = 2026 | Key J.| +| KEYCODE_K = 2027 | Key K.| +| KEYCODE_L = 2028 | Key L.| +| KEYCODE_M = 2029 | Key M.| +| KEYCODE_N = 2030 | Key N.| +| KEYCODE_O = 2031 | Key O.| +| KEYCODE_P = 2032 | Key P.| +| KEYCODE_Q = 2033 | Key Q| +| KEYCODE_R = 2034 | Key R.| +| KEYCODE_S = 2035 | Key S.| +| KEYCODE_T = 2036 | Key T.| +| KEYCODE_U = 2037 | Key U.| +| KEYCODE_V = 2038 | Key V.| +| KEYCODE_W = 2039 | Key W.| +| KEYCODE_X = 2040 | Key X.| +| KEYCODE_Y = 2041 | Key Y.| +| KEYCODE_Z = 2042 | Key Z.| +| KEYCODE_COMMA = 2043 | Key ,.| +| KEYCODE_PERIOD = 2044 | Key ..| +| KEYCODE_ALT_LEFT = 2045 | Left Alt key.| +| KEYCODE_ALT_RIGHT = 2046 | Right Alt key.| +| KEYCODE_SHIFT_LEFT = 2047 | Left Shift key.| +| KEYCODE_SHIFT_RIGHT = 2048 | Right Shift key.| +| KEYCODE_TAB = 2049 | Tab key.| +| KEYCODE_SPACE = 2050 | Space key.| +| KEYCODE_SYM = 2051 | Symbol key.| +| KEYCODE_EXPLORER = 2052 | Explorer key, used to start the explorer application| +| KEYCODE_ENVELOPE = 2053 | Email key, used to start the email application| +| KEYCODE_ENTER = 2054 | Enter key.| +| KEYCODE_DEL = 2055 | Delete key.| +| KEYCODE_GRAVE = 2056 | Key `| +| KEYCODE_MINUS = 2057 | Key -.| +| KEYCODE_EQUALS = 2058 | Key =.| +| KEYCODE_LEFT_BRACKET = 2059 | Key [.| +| KEYCODE_RIGHT_BRACKET = 2060 | Key ].| +| KEYCODE_BACKSLASH = 2061 | Key \.| +| KEYCODE_SEMICOLON = 2062 | Key ;.| +| KEYCODE_APOSTROPHE = 2063 | Key '.| +| KEYCODE_SLASH = 2064 | Key /.| +| KEYCODE_AT = 2065 | Key @| +| KEYCODE_PLUS = 2066 | Key +.| +| KEYCODE_MENU = 2067 | Menu key.| +| KEYCODE_PAGE_UP = 2068 | Page Up key.| +| KEYCODE_PAGE_DOWN = 2069 | Page Down key.| +| KEYCODE_ESCAPE = 2070 | ESC key.| +| KEYCODE_FORWARD_DEL = 2071 | Forward Delete key.| +| KEYCODE_CTRL_LEFT = 2072 | Left Ctrl key.| +| KEYCODE_CTRL_RIGHT = 2073 | Right Ctrl key.| +| KEYCODE_CAPS_LOCK = 2074 | Caps Lock key.| +| KEYCODE_SCROLL_LOCK = 2075 | Scroll Lock key.| +| KEYCODE_META_LEFT = 2076 | Left Meta key.| +| KEYCODE_META_RIGHT = 2077 | Right Meta key.| +| KEYCODE_FUNCTION = 2078 | Function key.| +| KEYCODE_SYSRQ = 2079 | System Request/Print Screen key.| +| KEYCODE_BREAK = 2080 | Break/Pause key.| +| KEYCODE_MOVE_HOME = 2081 | Move to Home key.| +| KEYCODE_MOVE_END = 2082 | Move to End key.| +| KEYCODE_INSERT = 2083 | Insert key.| +| KEYCODE_FORWARD = 2084 | Forward key.| +| KEYCODE_MEDIA_PLAY = 2085 | Play key.| +| KEYCODE_MEDIA_PAUSE = 2086 | Pause key| +| KEYCODE_MEDIA_CLOSE = 2087 | Close key| +| KEYCODE_MEDIA_EJECT = 2088 | Eject key| +| KEYCODE_MEDIA_RECORD = 2089 | Record key| +| KEYCODE_F1 = 2090 | F1 key.| +| KEYCODE_F2 = 2091 | F2 key.| +| KEYCODE_F3 = 2092 | F3 key.| +| KEYCODE_F4 = 2093 | F4 key.| +| KEYCODE_F5 = 2094 | F5 key.| +| KEYCODE_F6 = 2095 | F6 key.| +| KEYCODE_F7 = 2096 | F7 key.| +| KEYCODE_F8 = 2097 | F8 key.| +| KEYCODE_F9 = 2098 | F9 key.| +| KEYCODE_F10 = 2099 | F10 key.| +| KEYCODE_F11 = 2100 | F11 key.| +| KEYCODE_F12 = 2101 | F12 key.| +| KEYCODE_NUM_LOCK = 2102 | Number Lock key.| +| KEYCODE_NUMPAD_0 = 2103 | Key 0 on numeric keypad.| +| KEYCODE_NUMPAD_1 = 2104 | Key 1 on numeric keypad.| +| KEYCODE_NUMPAD_2 = 2105 | Key 2 on numeric keypad.| +| KEYCODE_NUMPAD_3 = 2106 | Key 3 on numeric keypad.| +| KEYCODE_NUMPAD_4 = 2107 | Key 4 on numeric keypad.| +| KEYCODE_NUMPAD_5 = 2108 | Key 5 on numeric keypad.| +| KEYCODE_NUMPAD_6 = 2109 | Key 6 on numeric keypad.| +| KEYCODE_NUMPAD_7 = 2110 | Key 7 on numeric keypad.| +| KEYCODE_NUMPAD_8 = 2111 | Key 8 on numeric keypad.| +| KEYCODE_NUMPAD_9 = 2112 | Key 9 on numeric keypad.| +| KEYCODE_NUMPAD_DIVIDE = 2113 | Key / on numeric keypad.| +| KEYCODE_NUMPAD_MULTIPLY = 2114 | Key * on numeric keypad| +| KEYCODE_NUMPAD_SUBTRACT = 2115 | Key - on numeric keypad.| +| KEYCODE_NUMPAD_ADD = 2116 | Key + on numeric keypad.| +| KEYCODE_NUMPAD_DOT = 2117 | Key . on numeric keypad.| +| KEYCODE_NUMPAD_COMMA = 2118 | Key , on numeric keypad.| +| KEYCODE_NUMPAD_ENTER = 2119 | Enter key on numeric keypad.| +| KEYCODE_NUMPAD_EQUALS = 2120 | Key = on numeric keypad.| +| KEYCODE_NUMPAD_LEFT_PAREN = 2121 | Key ( on numeric keypad.| +| KEYCODE_NUMPAD_RIGHT_PAREN = 2122 | Key ) on numeric keypad.| +| KEYCODE_DAGGER_CLICK = 3211 | Dagger click key on the smart watch
**Since**: 18| +| KEYCODE_DAGGER_DOUBLE_CLICK = 3212 | Dagger double-click key on the smart watch
**Since**: 18| +| KEYCODE_DAGGER_LONG_PRESS = 3213 | Dagger long-press key on the smart watch
**Since**: 18| diff --git a/en/application-dev/reference/apis-input-kit/errorcode-multimodalinput.md b/en/application-dev/reference/apis-input-kit/errorcode-cooperator.md similarity index 88% rename from en/application-dev/reference/apis-input-kit/errorcode-multimodalinput.md rename to en/application-dev/reference/apis-input-kit/errorcode-cooperator.md index ee423b859c2..31f1646417f 100644 --- a/en/application-dev/reference/apis-input-kit/errorcode-multimodalinput.md +++ b/en/application-dev/reference/apis-input-kit/errorcode-cooperator.md @@ -4,6 +4,7 @@ > > This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](../errorcode-universal.md). + ## 4400001 Incorrect Target Device Descriptor **Error Message** @@ -19,16 +20,17 @@ This error code is reported if an invalid device descriptor is passed to the scr 1. The target device does not exist, or the device is not networked. 2. The target device descriptor is empty. -**Procedure** +**Solution** 1. Check whether the target device for screen hopping is correctly networked with the local device. -2. Set the target device descriptor correctly. +2. Set the target device descriptor correctly. + ## 4400002 Input Device Operation Failed **Error Message** -Failed to operate the input device. +Screen hop failed. **Description** @@ -40,8 +42,8 @@ This error code is reported if the screen hopping status is abnormal when the sc 2. When screen hopping is disabled, the local device is in the free state. 3. When screen hopping is disabled, the local device is in the hopping state. -**Procedure** +**Solution** 1. When initiating screen hopping, make sure that the local device is not in the hopped state. 2. When disabling screen hopping, make sure that the local device is not in the free state. -3. When disabling screen hopping, make sure that the local device is not in the hopping state. +3. When disabling screen hopping, make sure that the local device is not in the hopping state. diff --git a/en/application-dev/reference/apis-input-kit/errorcode-inputconsumer.md b/en/application-dev/reference/apis-input-kit/errorcode-inputconsumer.md index 0becb7f72ce..c0ffeaacd45 100644 --- a/en/application-dev/reference/apis-input-kit/errorcode-inputconsumer.md +++ b/en/application-dev/reference/apis-input-kit/errorcode-inputconsumer.md @@ -1,4 +1,4 @@ -# Input Consumer Error Codes +# Global Shortcut Key Error Codes > **NOTE** > @@ -20,7 +20,7 @@ This error code is reported if the shortcut key has been registered by a system **Solution** -1. Call **inputConsumer.getAllSystemHotkeys** to query all registered shortcut keys and use any available shortcut keys. +1. You can call [getAllSystemHotkeys](js-apis-inputconsumer.md#inputconsumergetallsystemhotkeys) to query all system shortcut keys. ## 4200003 Shortcut Key Already Registered by a Third-party Application diff --git a/en/application-dev/reference/apis-input-kit/errorcode-inputdevice.md b/en/application-dev/reference/apis-input-kit/errorcode-inputdevice.md index c866d9c5c91..e002596ef9b 100644 --- a/en/application-dev/reference/apis-input-kit/errorcode-inputdevice.md +++ b/en/application-dev/reference/apis-input-kit/errorcode-inputdevice.md @@ -4,6 +4,7 @@ > > This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](../errorcode-universal.md). + ## 3900001 Device Not Exist **Error Message** @@ -22,7 +23,7 @@ This error code is reported if the specified device cannot be found in the multi **Procedure** 1. Use [inputDevice.getDeviceList](js-apis-inputdevice.md#inputdevicegetdevicelist9) to query the device ID, and then pass in the correct device ID. -2. Check whether the keyboard cable is disconnected. +2. Check whether the keyboard cable is disconnected. ## 3900002 Keyboard Not Connected @@ -32,7 +33,7 @@ There is currently no keyboard device connected. **Description** -No keyboard is connected. +This error code is reported if no connected keyboard is detected. **Possible Causes** @@ -46,7 +47,7 @@ Check whether the keyboard cable is disconnected. **Error Message** -it is prohibited for non-input applications. +It is prohibited for non-input applications. **Description** @@ -59,21 +60,3 @@ This API is not supported for a third-party application or a non-input system ap **Procedure** Use an input application to call this API. - -## 26500001 Invalid Window ID - -**Error Message** - -windowId is invalid. Possible causes: The window id does not belong to the current process. - -**Description** - -This error code is reported if the window ID is invalid. - -**Possible Causes** - -The window ID does not belong to the current application. - -**Procedure** - -Pass in the window ID of the current application. You can obtain the attributes of the current window by calling [getWindowProperties()](../apis-arkui/js-apis-window.md#getwindowproperties9). The window attributes contain the window ID. diff --git a/en/application-dev/reference/apis-input-kit/errorcode-inputkeymonitor.md b/en/application-dev/reference/apis-input-kit/errorcode-inputmonitor.md similarity index 82% rename from en/application-dev/reference/apis-input-kit/errorcode-inputkeymonitor.md rename to en/application-dev/reference/apis-input-kit/errorcode-inputmonitor.md index ca633b17758..7ffe80f1b5e 100644 --- a/en/application-dev/reference/apis-input-kit/errorcode-inputkeymonitor.md +++ b/en/application-dev/reference/apis-input-kit/errorcode-inputmonitor.md @@ -1,23 +1,24 @@ -# Input Key Monitor Error Codes +# Input Monitor Error Codes > **NOTE** > > This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](../errorcode-universal.md). + ## 4100001 Event Listening Not Supported for the Key **Error Message** Event listening not supported for the key. -**Symptom** +**Description** This error code is reported if event listening is not supported for this key. -**Possible Cause** +**Possible Causes** The current API does not support the key for which event listening is to be enabled. **Solution** -Check whether event listening is supported for the input key. Currently, event listening is supported only for the **META_LEFT**, **META_RIGHT**, power, and volume keys. +Check whether event listening is supported for the input key. Currently, event listening is supported only for the **META_LEFT**, **META_RIGHT**, power, and volume keys. diff --git a/en/application-dev/reference/apis-input-kit/errorcode-pointer.md b/en/application-dev/reference/apis-input-kit/errorcode-pointer.md new file mode 100644 index 00000000000..462ee7f452a --- /dev/null +++ b/en/application-dev/reference/apis-input-kit/errorcode-pointer.md @@ -0,0 +1,23 @@ +# Mouse Pointer Error Codes + +> **NOTE** +> +> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](../errorcode-universal.md). + +## 26500001 Invalid Window ID + +**Error Message** + +Invalid windowId. + +**Description** + +This error code is reported if the window ID is invalid. + +**Possible Causes** + +The window ID does not belong to the current process. + +**Solution** + +Pass in the window ID of the current process. You can obtain the attributes of the current window by calling [getWindowProperties()](../apis-arkui/js-apis-window.md#getwindowproperties9). The window attributes contain the window ID. diff --git a/en/application-dev/reference/apis-input-kit/input.md b/en/application-dev/reference/apis-input-kit/input.md deleted file mode 100644 index 04160375c4c..00000000000 --- a/en/application-dev/reference/apis-input-kit/input.md +++ /dev/null @@ -1,3990 +0,0 @@ -# Input - -## Overview - -Provides C APIs for the multimodal input module. - -**Since**: 12 - - -## Summary - - -### File - -| Name| Description| -| -------- | -------- | -| [oh_axis_type.h](oh__axis__type_8h.md) | Defines the axis event structures and enumerations.| -| [oh_input_manager.h](oh__input__manager_8h.md) | Provides functions such as event injection and status query. | -| [oh_key_code.h](oh__key__code_8h.md) | Defines key codes of the key device. | - -### Structs - -| Name| Description| -| -------- | -------- | -| struct  [Input_InterceptorEventCallback](_input___interceptor_event_callback.md) | Defines the structure of the interceptor for callback events, including mouse events, touch events, and axis events. | -| struct  [Input_DeviceListener](_input___device_listener.md) | Defines a listener for device hot swap events. | - - -### Types - -| Name| Description| -| -------- | -------- | -| typedef enum [InputEvent_AxisType](#inputevent_axistype) [InputEvent_AxisType](#inputevent_axistype) | Provides axis types of the input device. | -| typedef enum [InputEvent_AxisEventType](#inputevent_axiseventtype) [InputEvent_AxisEventType](#inputevent_axiseventtype) | Provides event types of the input device. | -| typedef enum [InputEvent_AxisAction](#inputevent_axisaction) [InputEvent_AxisAction](#inputevent_axisaction) | Provides actions of the input device. | -| typedef enum [Input_KeyStateAction](#input_keystateaction) [Input_KeyStateAction](#input_keystateaction) | Provides the enum values of the key status. | -| typedef enum [Input_KeyEventAction](#input_keyeventaction) [Input_KeyEventAction](#input_keyeventaction) | Provides the enum values of the key event type. | -| typedef enum [Input_MouseEventAction](#input_mouseeventaction) [Input_MouseEventAction](#input_mouseeventaction) | Provides the enum values of mouse actions. | -| typedef enum [InputEvent_MouseAxis](#inputevent_mouseaxis) [InputEvent_MouseAxis](#inputevent_mouseaxis) | Provides the enum values of mouse axis event types. | -| typedef enum [Input_MouseEventButton](#input_mouseeventbutton) [Input_MouseEventButton](#input_mouseeventbutton) | Provides the enum values of mouse buttons. | -| typedef enum [Input_TouchEventAction](#input_toucheventaction) [Input_TouchEventAction](#input_toucheventaction) | Provides the enum values of touch actions. | -| typedef enum [InputEvent_SourceType](#inputevent_sourcetype) [InputEvent_SourceType](#inputevent_sourcetype) | Provides the enum values of event source types. | -| typedef enum [Input_KeyboardType](#input_keyboardtype) [Input_KeyboardType](#input_keyboardtype) | Provides the enum values of keyboard types of the input device. | -| typedef struct [Input_KeyState](#input_keystate) [Input_KeyState](#input_keystate) | Defines key information, which identifies a key pressing behavior. For example, the Ctrl key information contains the key value and key type. | -| typedef struct [Input_KeyEvent](#input_keyevent) [Input_KeyEvent](#input_keyevent) | Defines the key event to be injected. | -| typedef struct [Input_MouseEvent](#input_mouseevent) [Input_MouseEvent](#input_mouseevent) | Defines the mouse event to be injected. | -| typedef struct [Input_TouchEvent](#input_touchevent) [Input_TouchEvent](#input_touchevent) | Defines the touch event to be injected. | -| typedef struct [Input_AxisEvent](#input_axisevent) [Input_AxisEvent](#input_axisevent) | Defines an axis event. | -| typedef enum [Input_Result](#input_result) [Input_Result](#input_result) | Provides the enum values of error codes. | -| typedef void(\* [Input_KeyEventCallback](#input_keyeventcallback)) (const [Input_KeyEvent](#input_keyevent) \*keyEvent) | Defines a lifecycle callback for **keyEvent**. If the callback is triggered, **keyEvent** will be destroyed. | -| typedef void(\* [Input_MouseEventCallback](#input_mouseeventcallback)) (const [Input_MouseEvent](#input_mouseevent) \*mouseEvent) | Defines a lifecycle callback for **mouseEvent**. If the callback is triggered, **mouseEvent** will be destroyed. | -| typedef void(\* [Input_TouchEventCallback](#input_toucheventcallback)) (const [Input_TouchEvent](#input_touchevent) \*touchEvent) | Defines a lifecycle callback for **touchEvent**. If the callback is triggered, **touchEvent** will be destroyed. | -| typedef void(\* [Input_AxisEventCallback](#input_axiseventcallback)) (const [Input_AxisEvent](#input_axisevent) \*axisEvent) | Defines a lifecycle callback for **axisEvent**. If the callback is triggered, **axisEvent** will be destroyed. | -| typedef void(\* [Input_HotkeyCallback](#input_hotkeycallback)) ([Input_Hotkey](#input_hotkey) \*hotkey) | Defines the callback used to return shortcut key events. | -| typedef void(\* [Input_DeviceAddedCallback](#input_deviceaddedcallback)) (int32_t deviceId) | Defines a callback used to receive device insertion events. | -| typedef void(\* [Input_DeviceRemovedCallback](#input_deviceremovedcallback)) (int32_t deviceId) | Defines a callback used to receive device removal events. | -| typedef struct [Input_InterceptorEventCallback](_input___interceptor_event_callback.md) [Input_InterceptorEventCallback](#input_interceptoreventcallback) | Defines the structure of the interceptor for callback events, including mouse events, touch events, and axis events. | -| typedef struct [Input_DeviceListener](_input___device_listener.md) [Input_DeviceListener](#input_devicelistener) |Defines a listener for device hot swap events. | -| typedef struct [Input_InterceptorOptions](#input_interceptoroptions) [Input_InterceptorOptions](#input_interceptoroptions) | Defines event interception options. | -| typedef struct [Input_Hotkey](#input_hotkey) [Input_Hotkey](#input_hotkey) | Defines the shortcut key structure. | -| typedef struct [Input_DeviceInfo](#input_deviceinfo) [Input_DeviceInfo](#input_deviceinfo) | Defines the input device information. | - - -### Enums - -| Name| Description| -| -------- | -------- | -| [InputEvent_AxisType](#inputevent_axistype) {
AXIS_TYPE_UNKNOWN, AXIS_TYPE_SCROLL_VERTICAL, AXIS_TYPE_SCROLL_HORIZONTAL, AXIS_TYPE_PINCH,
AXIS_TYPE_ROTATE
} | Axis type of the input device. | -| [InputEvent_AxisEventType](#inputevent_axiseventtype) { AXIS_EVENT_TYPE_PINCH = 1, AXIS_EVENT_TYPE_SCROLL = 2 } | Event type of the input device. | -| [InputEvent_AxisAction](#inputevent_axisaction) { AXIS_ACTION_CANCEL = 0, AXIS_ACTION_BEGIN, AXIS_ACTION_UPDATE, AXIS_ACTION_END } | Action of the input device. | -| [Input_KeyStateAction](#input_keystateaction) {
KEY_DEFAULT = -1, KEY_PRESSED = 0, KEY_RELEASED = 1, KEY_SWITCH_ON = 2,
KEY_SWITCH_OFF = 3
} | Key status. | -| [Input_KeyEventAction](#input_keyeventaction) { KEY_ACTION_CANCEL = 0, KEY_ACTION_DOWN = 1, KEY_ACTION_UP = 2 } | Key event type. | -| [Input_MouseEventAction](#input_mouseeventaction) {
MOUSE_ACTION_CANCEL = 0, MOUSE_ACTION_MOVE = 1, MOUSE_ACTION_BUTTON_DOWN = 2, MOUSE_ACTION_BUTTON_UP = 3,
MOUSE_ACTION_AXIS_BEGIN = 4, MOUSE_ACTION_AXIS_UPDATE = 5, MOUSE_ACTION_AXIS_END = 6
} | Mouse action. | -| [InputEvent_MouseAxis](#inputevent_mouseaxis) { MOUSE_AXIS_SCROLL_VERTICAL = 0, MOUSE_AXIS_SCROLL_HORIZONTAL = 1 } | Mouse axis event type. | -| [Input_MouseEventButton](#input_mouseeventbutton) {
MOUSE_BUTTON_NONE = -1, MOUSE_BUTTON_LEFT = 0, MOUSE_BUTTON_MIDDLE = 1, MOUSE_BUTTON_RIGHT = 2,
MOUSE_BUTTON_FORWARD = 3, MOUSE_BUTTON_BACK = 4
} | Mouse button. | -| [Input_TouchEventAction](#input_toucheventaction) { TOUCH_ACTION_CANCEL = 0, TOUCH_ACTION_DOWN = 1, TOUCH_ACTION_MOVE = 2, TOUCH_ACTION_UP = 3 } | Touch action. | -| [InputEvent_SourceType](#inputevent_sourcetype) { SOURCE_TYPE_MOUSE = 1, SOURCE_TYPE_TOUCHSCREEN = 2, SOURCE_TYPE_TOUCHPAD = 3 } | Event source type. | -| [Input_KeyboardType](#input_keyboardtype) {
KEYBOARD_TYPE_NONE = 0, KEYBOARD_TYPE_UNKNOWN = 1, KEYBOARD_TYPE_ALPHABETIC = 2, KEYBOARD_TYPE_DIGITAL = 3,
KEYBOARD_TYPE_STYLUS = 4, KEYBOARD_TYPE_REMOTE_CONTROL = 5
} | Keyboard type of the input device. | -| [Input_Result](#input_result) {
INPUT_SUCCESS = 0, INPUT_PERMISSION_DENIED = 201, INPUT_NOT_SYSTEM_APPLICATION = 202, INPUT_PARAMETER_ERROR = 401, INPUT_DEVICE_NOT_SUPPORTED = 801,
INPUT_SERVICE_EXCEPTION = 3800001, INPUT_KEYBOARD_DEVICE_NOT_EXIST = 3900002, INPUT_REPEAT_INTERCEPTOR = 4200001, INPUT_OCCUPIED_BY_SYSTEM = 4200002,
INPUT_OCCUPIED_BY_OTHER = 4200003
} | Error code. | -| [Input_KeyCode](#input_keycode) {
KEYCODE_UNKNOWN = -1, KEYCODE_FN = 0, KEYCODE_VOLUME_UP = 16, KEYCODE_VOLUME_DOWN = 17,
KEYCODE_POWER = 18, KEYCODE_CAMERA = 19, KEYCODE_VOLUME_MUTE = 22, KEYCODE_MUTE = 23,
KEYCODE_BRIGHTNESS_UP = 40, KEYCODE_BRIGHTNESS_DOWN = 41, KEYCODE_0 = 2000, KEYCODE_1 = 2001,
KEYCODE_2 = 2002, KEYCODE_3 = 2003, KEYCODE_4 = 2004, KEYCODE_5 = 2005,
KEYCODE_6 = 2006, KEYCODE_7 = 2007, KEYCODE_8 = 2008, KEYCODE_9 = 2009,
KEYCODE_STAR = 2010, KEYCODE_POUND = 2011, KEYCODE_DPAD_UP = 2012, KEYCODE_DPAD_DOWN = 2013,
KEYCODE_DPAD_LEFT = 2014, KEYCODE_DPAD_RIGHT = 2015, KEYCODE_DPAD_CENTER = 2016, KEYCODE_A = 2017,
KEYCODE_B = 2018, KEYCODE_C = 2019, KEYCODE_D = 2020, KEYCODE_E = 2021,
KEYCODE_F = 2022, KEYCODE_G = 2023, KEYCODE_H = 2024, KEYCODE_I = 2025,
KEYCODE_J = 2026, KEYCODE_K = 2027, KEYCODE_L = 2028, KEYCODE_M = 2029,
KEYCODE_N = 2030, KEYCODE_O = 2031, KEYCODE_P = 2032, KEYCODE_Q = 2033,
KEYCODE_R = 2034, KEYCODE_S = 2035, KEYCODE_T = 2036, KEYCODE_U = 2037,
KEYCODE_V = 2038, KEYCODE_W = 2039, KEYCODE_X = 2040, KEYCODE_Y = 2041,
KEYCODE_Z = 2042, KEYCODE_COMMA = 2043, KEYCODE_PERIOD = 2044, KEYCODE_ALT_LEFT = 2045,
KEYCODE_ALT_RIGHT = 2046, KEYCODE_SHIFT_LEFT = 2047, KEYCODE_SHIFT_RIGHT = 2048, KEYCODE_TAB = 2049,
KEYCODE_SPACE = 2050, KEYCODE_SYM = 2051, KEYCODE_EXPLORER = 2052, KEYCODE_ENVELOPE = 2053,
KEYCODE_ENTER = 2054, KEYCODE_DEL = 2055, KEYCODE_GRAVE = 2056, KEYCODE_MINUS = 2057,
KEYCODE_EQUALS = 2058, KEYCODE_LEFT_BRACKET = 2059, KEYCODE_RIGHT_BRACKET = 2060, KEYCODE_BACKSLASH = 2061,
KEYCODE_SEMICOLON = 2062, KEYCODE_APOSTROPHE = 2063, KEYCODE_SLASH = 2064, KEYCODE_AT = 2065,
KEYCODE_PLUS = 2066, KEYCODE_MENU = 2067, KEYCODE_PAGE_UP = 2068, KEYCODE_PAGE_DOWN = 2069,
KEYCODE_ESCAPE = 2070, KEYCODE_FORWARD_DEL = 2071, KEYCODE_CTRL_LEFT = 2072, KEYCODE_CTRL_RIGHT = 2073,
KEYCODE_CAPS_LOCK = 2074, KEYCODE_SCROLL_LOCK = 2075, KEYCODE_META_LEFT = 2076, KEYCODE_META_RIGHT = 2077,
KEYCODE_FUNCTION = 2078, KEYCODE_SYSRQ = 2079, KEYCODE_BREAK = 2080, KEYCODE_MOVE_HOME = 2081,
KEYCODE_MOVE_END = 2082, KEYCODE_INSERT = 2083, KEYCODE_FORWARD = 2084, KEYCODE_MEDIA_PLAY = 2085,
KEYCODE_MEDIA_PAUSE = 2086, KEYCODE_MEDIA_CLOSE = 2087, KEYCODE_MEDIA_EJECT = 2088, KEYCODE_MEDIA_RECORD = 2089,
KEYCODE_F1 = 2090, KEYCODE_F2 = 2091, KEYCODE_F3 = 2092, KEYCODE_F4 = 2093,
KEYCODE_F5 = 2094, KEYCODE_F6 = 2095, KEYCODE_F7 = 2096, KEYCODE_F8 = 2097,
KEYCODE_F9 = 2098, KEYCODE_F10 = 2099, KEYCODE_F11 = 2100, KEYCODE_F12 = 2101,
KEYCODE_NUM_LOCK = 2102, KEYCODE_NUMPAD_0 = 2103, KEYCODE_NUMPAD_1 = 2104, KEYCODE_NUMPAD_2 = 2105,
KEYCODE_NUMPAD_3 = 2106, KEYCODE_NUMPAD_4 = 2107, KEYCODE_NUMPAD_5 = 2108, KEYCODE_NUMPAD_6 = 2109,
KEYCODE_NUMPAD_7 = 2110, KEYCODE_NUMPAD_8 = 2111, KEYCODE_NUMPAD_9 = 2112, KEYCODE_NUMPAD_DIVIDE = 2113,
KEYCODE_NUMPAD_MULTIPLY = 2114, KEYCODE_NUMPAD_SUBTRACT = 2115, KEYCODE_NUMPAD_ADD = 2116, KEYCODE_NUMPAD_DOT = 2117,
KEYCODE_NUMPAD_COMMA = 2118, KEYCODE_NUMPAD_ENTER = 2119, KEYCODE_NUMPAD_EQUALS = 2120, KEYCODE_NUMPAD_LEFT_PAREN = 2121,
KEYCODE_NUMPAD_RIGHT_PAREN = 2122, KEYCODE_DAGGER_CLICK = 3211, KEYCODE_DAGGER_DOUBLE_CLICK = 3212, KEYCODE_DAGGER_LONG_PRESS = 3213
} | Key code value. | - - -### Functions - -| Name| Description| -| -------- | -------- | -| [Input_Result](#input_result) [OH_Input_GetKeyState](#oh_input_getkeystate) (struct [Input_KeyState](#input_keystate) \*keyState) | Queries a key status enum object. | -| struct [Input_KeyState](#input_keystate) \* [OH_Input_CreateKeyState](#oh_input_createkeystate) () | Creates a key status enum object. | -| void [OH_Input_DestroyKeyState](#oh_input_destroykeystate) (struct [Input_KeyState](#input_keystate) \*\*keyState) | Destroys a key status enum object. | -| void [OH_Input_SetKeyCode](#oh_input_setkeycode) (struct [Input_KeyState](#input_keystate) \*keyState, int32_t keyCode) | Sets the key value of a key status enum object. | -| int32_t [OH_Input_GetKeyCode](#oh_input_getkeycode) (const struct [Input_KeyState](#input_keystate) \*keyState) | Obtains the key value of a key status enum object. | -| void [OH_Input_SetKeyPressed](#oh_input_setkeypressed) (struct [Input_KeyState](#input_keystate) \*keyState, int32_t keyAction) | Sets whether the key specific to a key status enum object is pressed. | -| int32_t [OH_Input_GetKeyPressed](#oh_input_getkeypressed) (const struct [Input_KeyState](#input_keystate) \*keyState) | Checks whether the key specific to a key status enum object is pressed. | -| void [OH_Input_SetKeySwitch](#oh_input_setkeyswitch) (struct [Input_KeyState](#input_keystate) \*keyState, int32_t keySwitch) | Sets the key switch of the key status enum object. | -| int32_t [OH_Input_GetKeySwitch](#oh_input_getkeyswitch) (const struct [Input_KeyState](#input_keystate) \*keyState) | Obtains the key switch of the key status enum object. | -| int32_t [OH_Input_InjectKeyEvent](#oh_input_injectkeyevent) (const struct [Input_KeyEvent](#input_keyevent) \*keyEvent) | Injects a key event. | -| struct [Input_KeyEvent](#input_keyevent) \* [OH_Input_CreateKeyEvent](#oh_input_createkeyevent) () | Creates a key event object. | -| void [OH_Input_DestroyKeyEvent](#oh_input_destroykeyevent) (struct [Input_KeyEvent](#input_keyevent) \*\*keyEvent) | Destroys a key event object.| -| void [OH_Input_SetKeyEventAction](#oh_input_setkeyeventaction) (struct [Input_KeyEvent](#input_keyevent) \*keyEvent, int32_t action) | Sets the key event type. | -| int32_t [OH_Input_GetKeyEventAction](#oh_input_getkeyeventaction) (const struct [Input_KeyEvent](#input_keyevent) \*keyEvent) | Obtains the key event type. | -| void [OH_Input_SetKeyEventKeyCode](#oh_input_setkeyeventkeycode) (struct [Input_KeyEvent](#input_keyevent) \*keyEvent, int32_t keyCode) | Sets the key code value for a key event. | -| int32_t [OH_Input_GetKeyEventKeyCode](#oh_input_getkeyeventkeycode) (const struct [Input_KeyEvent](#input_keyevent) \*keyEvent) | Obtains the key code value of a key event. | -| void [OH_Input_SetKeyEventActionTime](#oh_input_setkeyeventactiontime) (struct [Input_KeyEvent](#input_keyevent) \*keyEvent, int64_t actionTime) | Sets the time when a key event occurs. | -| int64_t [OH_Input_GetKeyEventActionTime](#oh_input_getkeyeventactiontime) (const struct [Input_KeyEvent](#input_keyevent) \*keyEvent) | Obtains the time when a key event occurs. | -| void [OH_Input_SetKeyEventWindowId](#oh_input_setkeyeventwindowid) (struct [Input_KeyEvent](#input_keyevent) \*keyEvent, int32_t windowId) | Sets the window ID of a key event. | -| int32_t [OH_Input_GetKeyEventWindowId](#oh_input_getkeyeventwindowid) (const struct [Input_KeyEvent](#input_keyevent) \*keyEvent) | Obtains the window ID of a key event. | -| void [OH_Input_SetKeyEventDisplayId](#oh_input_setkeyeventdisplayid) (struct [Input_KeyEvent](#input_keyevent) \*keyEvent, int32_t displayId) | Sets the screen ID of a key event. | -| int32_t [OH_Input_GetKeyEventDisplayId](#oh_input_getkeyeventdisplayid) (const struct [Input_KeyEvent](#input_keyevent) \*keyEvent) | Obtains the screen ID of a key event. | -| int32_t [OH_Input_InjectMouseEvent](#oh_input_injectmouseevent) (const struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent) | Injects a mouse event. | -| struct [Input_MouseEvent](#input_mouseevent) \* [OH_Input_CreateMouseEvent](#oh_input_createmouseevent) () | Creates a mouse event object. | -| void [OH_Input_DestroyMouseEvent](#oh_input_destroymouseevent) (struct [Input_MouseEvent](#input_mouseevent) \*\*mouseEvent) | Destroys a mouse event object.| -| void [OH_Input_SetMouseEventAction](#oh_input_setmouseeventaction) (struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent, int32_t action) | Sets the action for a mouse event. | -| int32_t [OH_Input_GetMouseEventAction](#oh_input_getmouseeventaction) (const struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent) | Obtains the action of a mouse event. | -| void [OH_Input_SetMouseEventDisplayX](#oh_input_setmouseeventdisplayx) (struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent, int32_t displayX) | Sets the X coordinate for a mouse event. | -| int32_t [OH_Input_GetMouseEventDisplayX](#oh_input_getmouseeventdisplayx) (const struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent) | Obtains the X coordinate of a mouse event. | -| void [OH_Input_SetMouseEventDisplayY](#oh_input_setmouseeventdisplayy) (struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent, int32_t displayY) | Sets the Y coordinate for a mouse event. | -| int32_t [OH_Input_GetMouseEventDisplayY](#oh_input_getmouseeventdisplayy) (const struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent) | Obtains the Y coordinate of a mouse event. | -| void [OH_Input_SetMouseEventButton](#oh_input_setmouseeventbutton) (struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent, int32_t button) | Sets the button for a mouse event. | -| int32_t [OH_Input_GetMouseEventButton](#oh_input_getmouseeventbutton) (const struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent) | Obtains the button of a mouse event. | -| void [OH_Input_SetMouseEventAxisType](#oh_input_setmouseeventaxistype) (struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent, int32_t axisType) | Sets the axis type for a mouse event. | -| int32_t [OH_Input_GetMouseEventAxisType](#oh_input_getmouseeventaxistype) (const struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent) | Obtains the axis type of a mouse event. | -| void [OH_Input_SetMouseEventAxisValue](#oh_input_setmouseeventaxisvalue) (struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent, float axisValue) | Sets the axis value for a mouse axis event. | -| float [OH_Input_GetMouseEventAxisValue](#oh_input_getmouseeventaxisvalue) (const struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent) | Obtains the axis value of a mouse axis event. | -| void [OH_Input_SetMouseEventActionTime](#oh_input_setmouseeventactiontime) (struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent, int64_t actionTime) | Sets the time when a mouse event occurs. | -| int64_t [OH_Input_GetMouseEventActionTime](#oh_input_getmouseeventactiontime) (const struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent) | Obtains the time when a mouse event occurs. | -| void [OH_Input_SetMouseEventWindowId](#oh_input_setmouseeventwindowid) (struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent, int32_t windowId) | Sets the window ID of a mouse event. | -| int32_t [OH_Input_GetMouseEventWindowId](#oh_input_getmouseeventwindowid) (const struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent) | Obtains the window ID of a mouse event. | -| void [OH_Input_SetMouseEventDisplayId](#oh_input_setmouseeventdisplayid) (struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent, int32_t displayId) | Sets the screen ID of a mouse event. | -| int32_t [OH_Input_GetMouseEventDisplayId](#oh_input_getmouseeventdisplayid) (const struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent) | Obtains the screen ID of a mouse event. | -| int32_t [OH_Input_InjectTouchEvent](#oh_input_injecttouchevent) (const struct [Input_TouchEvent](#input_touchevent) \*touchEvent) | Injects a touch event. | -| struct [Input_TouchEvent](#input_touchevent) \* [OH_Input_CreateTouchEvent](#oh_input_createtouchevent) () | Creates a touch event object. | -| void [OH_Input_DestroyTouchEvent](#oh_input_destroytouchevent) (struct [Input_TouchEvent](#input_touchevent) \*\*touchEvent) | Destroys a touch event object. | -| void [OH_Input_SetTouchEventAction](#oh_input_settoucheventaction) (struct [Input_TouchEvent](#input_touchevent) \*touchEvent, int32_t action) | Sets the action for a touch event. | -| int32_t [OH_Input_GetTouchEventAction](#oh_input_gettoucheventaction) (const struct [Input_TouchEvent](#input_touchevent) \*touchEvent) | Obtains the action of a touch event. | -| void [OH_Input_SetTouchEventFingerId](#oh_input_settoucheventfingerid) (struct [Input_TouchEvent](#input_touchevent) \*touchEvent, int32_t id) | Sets the finger ID for a touch event. | -| int32_t [OH_Input_GetTouchEventFingerId](#oh_input_gettoucheventfingerid) (const struct [Input_TouchEvent](#input_touchevent) \*touchEvent) | Obtains the finger ID of a touch event. | -| void [OH_Input_SetTouchEventDisplayX](#oh_input_settoucheventdisplayx) (struct [Input_TouchEvent](#input_touchevent) \*touchEvent, int32_t displayX) | Sets the X coordinate for a touch event.| -| int32_t [OH_Input_GetTouchEventDisplayX](#oh_input_gettoucheventdisplayx) (const struct [Input_TouchEvent](#input_touchevent) \*touchEvent) | Obtains the X coordinate of a touch event. | -| void [OH_Input_SetTouchEventDisplayY](#oh_input_settoucheventdisplayy) (struct [Input_TouchEvent](#input_touchevent) \*touchEvent, int32_t displayY) | Sets the Y coordinate for a touch event. | -| int32_t [OH_Input_GetTouchEventDisplayY](#oh_input_gettoucheventdisplayy) (const struct [Input_TouchEvent](#input_touchevent) \*touchEvent) | Obtains the Y coordinate of a touch event. | -| void [OH_Input_SetTouchEventActionTime](#oh_input_settoucheventactiontime) (struct [Input_TouchEvent](#input_touchevent) \*touchEvent, int64_t actionTime) | Sets the time when a touch event occurs. | -| int64_t [OH_Input_GetTouchEventActionTime](#oh_input_gettoucheventactiontime) (const struct [Input_TouchEvent](#input_touchevent) \*touchEvent) | Obtains the time when a touch event occurs. | -| void [OH_Input_SetTouchEventWindowId](#oh_input_settoucheventwindowid) (struct [Input_TouchEvent](#input_touchevent) \*touchEvent, int32_t windowId) | Sets the window ID of a touchscreen event. | -| int32_t [OH_Input_GetTouchEventWindowId](#oh_input_gettoucheventwindowid) (const struct [Input_TouchEvent](#input_touchevent) \*touchEvent) | Obtains the window ID of a touchscreen event. | -| void [OH_Input_SetTouchEventDisplayId](#oh_input_settoucheventdisplayid) (struct [Input_TouchEvent](#input_touchevent) \*touchEvent, int32_t displayId) | Sets the screen ID of a touchscreen event. | -| int32_t [OH_Input_GetTouchEventDisplayId](#oh_input_gettoucheventdisplayid) (const struct [Input_TouchEvent](#input_touchevent) \*touchEvent) | Obtains the screen ID of a touchscreen event. | -| void [OH_Input_CancelInjection](#oh_input_cancelinjection) () | Stops event injection and revokes authorization. | -| [Input_AxisEvent](#input_axisevent) \* [OH_Input_CreateAxisEvent](#oh_input_createaxisevent) (void) | Creates an axis event object. | -| [Input_Result](#input_result) [OH_Input_DestroyAxisEvent](#oh_input_destroyaxisevent) ([Input_AxisEvent](#input_axisevent) \*\*axisEvent) | Destroys an axis event object. | -| [Input_Result](#input_result) [OH_Input_SetAxisEventAction](#oh_input_setaxiseventaction) ([Input_AxisEvent](#input_axisevent) \*axisEvent, [InputEvent_AxisAction](#inputevent_axisaction) action) | Sets the action for an axis event. | -| [Input_Result](#input_result) [OH_Input_GetAxisEventAction](#oh_input_getaxiseventaction) (const [Input_AxisEvent](#input_axisevent) \*axisEvent, [InputEvent_AxisAction](#inputevent_axisaction) \*action) | Obtains the action of an axis event. | -| [Input_Result](#input_result) [OH_Input_SetAxisEventDisplayX](#oh_input_setaxiseventdisplayx) ([Input_AxisEvent](#input_axisevent) \*axisEvent, float displayX) | Sets the X coordinate for an axis event. | -| [Input_Result](#input_result) [OH_Input_GetAxisEventDisplayX](#oh_input_getaxiseventdisplayx) (const [Input_AxisEvent](#input_axisevent) \*axisEvent, float \*displayX) | Obtains the X coordinate of an axis event. | -| [Input_Result](#input_result) [OH_Input_SetAxisEventDisplayY](#oh_input_setaxiseventdisplayy) ([Input_AxisEvent](#input_axisevent) \*axisEvent, float displayY) | Sets the Y coordinate for an axis event. | -| [Input_Result](#input_result) [OH_Input_GetAxisEventDisplayY](#oh_input_getaxiseventdisplayy) (const [Input_AxisEvent](#input_axisevent) \*axisEvent, float \*displayY) | Obtains the Y coordinate of an axis event. | -| [Input_Result](#input_result) [OH_Input_SetAxisEventAxisValue](#oh_input_setaxiseventaxisvalue) ([Input_AxisEvent](#input_axisevent) \*axisEvent, [InputEvent_AxisType](#inputevent_axistype) axisType, double axisValue) | Sets the axis value of the axis type specified by the axis event. | -| [Input_Result](#input_result) [OH_Input_GetAxisEventAxisValue](#oh_input_getaxiseventaxisvalue) (const [Input_AxisEvent](#input_axisevent) \*axisEvent, [InputEvent_AxisType](#inputevent_axistype) axisType, double \*axisValue) | Obtains the axis value for the specified axis type of the axis event. | -| [Input_Result](#input_result) [OH_Input_SetAxisEventActionTime](#oh_input_setaxiseventactiontime) ([Input_AxisEvent](#input_axisevent) \*axisEvent, int64_t actionTime) | Sets the time when an axis event occurs. | -| [Input_Result](#input_result) [OH_Input_GetAxisEventActionTime](#oh_input_getaxiseventactiontime) (const [Input_AxisEvent](#input_axisevent) \*axisEvent, int64_t \*actionTime) | Obtains the time when an axis event occurs. | -| [Input_Result](#input_result) [OH_Input_SetAxisEventType](#oh_input_setaxiseventtype) ([Input_AxisEvent](#input_axisevent) \*axisEvent, [InputEvent_AxisEventType](#inputevent_axiseventtype) axisEventType) | Sets the axis event type. | -| [Input_Result](#input_result) [OH_Input_GetAxisEventType](#oh_input_getaxiseventtype) (const [Input_AxisEvent](#input_axisevent) \*axisEvent, [InputEvent_AxisEventType](#inputevent_axiseventtype) \*axisEventType) | Obtains the axis event type. | -| [Input_Result](#input_result) [OH_Input_SetAxisEventSourceType](#oh_input_setaxiseventsourcetype) ([Input_AxisEvent](#input_axisevent) \*axisEvent, [InputEvent_SourceType](#inputevent_sourcetype) sourceType) | Sets the axis event source type. | -| [Input_Result](#input_result) [OH_Input_GetAxisEventSourceType](#oh_input_getaxiseventsourcetype) (const [Input_AxisEvent](#input_axisevent) \*axisEvent, [InputEvent_SourceType](#inputevent_sourcetype) \*sourceType) | Obtains the axis event source type. | -| [Input_Result](#input_result) [OH_Input_SetAxisEventWindowId](#oh_input_setaxiseventwindowid) ([Input_AxisEvent](#input_axisevent) \*axisEvent, int32_t windowId) | Sets the window ID of an axis event. | -| [Input_Result](#input_result) [OH_Input_GetAxisEventWindowId](#oh_input_getaxiseventwindowid) (const [Input_AxisEvent](#input_axisevent) \*axisEvent, int32_t \*windowId) | Obtains the window ID of an axis event. | -| [Input_Result](#input_result) [OH_Input_SetAxisEventDisplayId](#oh_input_setaxiseventdisplayid) ([Input_AxisEvent](#input_axisevent) \*axisEvent, int32_t displayId) | Sets the screen ID of an axis event. | -| [Input_Result](#input_result) [OH_Input_GetAxisEventDisplayId](#oh_input_getaxiseventdisplayid) (const [Input_AxisEvent](#input_axisevent) \*axisEvent, int32_t \*displayId) | Obtains the screen ID of an axis event. | -| [Input_Result](#input_result) [OH_Input_AddKeyEventMonitor](#oh_input_addkeyeventmonitor) ([Input_KeyEventCallback](#input_keyeventcallback) callback) | Adds a listener for key events. | -| [Input_Result](#input_result) [OH_Input_AddMouseEventMonitor](#oh_input_addmouseeventmonitor) ([Input_MouseEventCallback](#input_mouseeventcallback) callback) | Adds a listener for mouse events, including mouse click and movement events, but not scroll wheel events. Scroll wheel events are axis events. | -| [Input_Result](#input_result) [OH_Input_AddTouchEventMonitor](#oh_input_addtoucheventmonitor) ([Input_TouchEventCallback](#input_toucheventcallback) callback) | Adds a listener for touch events. | -| [Input_Result](#input_result) [OH_Input_AddAxisEventMonitorForAll](#oh_input_addaxiseventmonitorforall) ([Input_AxisEventCallback](#input_axiseventcallback) callback) | Adds a listener for all types of axis events, which are defined in [InputEvent_AxisEventType](#inputevent_axiseventtype). | -| [Input_Result](#input_result) [OH_Input_AddAxisEventMonitor](#oh_input_addaxiseventmonitor) ([InputEvent_AxisEventType](#inputevent_axiseventtype) axisEventType, [Input_AxisEventCallback](#input_axiseventcallback) callback) | Adds a listener for the specified type of axis events, which are defined in [InputEvent_AxisEventType](#inputevent_axiseventtype). | -| [Input_Result](#input_result) [OH_Input_RemoveKeyEventMonitor](#oh_input_removekeyeventmonitor) ([Input_KeyEventCallback](#input_keyeventcallback) callback) | Removes the listener for key events. | -| [Input_Result](#input_result) [OH_Input_RemoveMouseEventMonitor](#oh_input_removemouseeventmonitor) ([Input_MouseEventCallback](#input_mouseeventcallback) callback) | Removes the listener for mouse events. | -| [Input_Result](#input_result) [OH_Input_RemoveTouchEventMonitor](#oh_input_removetoucheventmonitor) ([Input_TouchEventCallback](#input_toucheventcallback) callback) | Removes the listener for touch events. | -| [Input_Result](#input_result) [OH_Input_RemoveAxisEventMonitorForAll](#oh_input_removeaxiseventmonitorforall) ([Input_AxisEventCallback](#input_axiseventcallback) callback) | Removes the listener for all types of axis events. | -| [Input_Result](#input_result) [OH_Input_RemoveAxisEventMonitor](#oh_input_removeaxiseventmonitor) ([InputEvent_AxisEventType](#inputevent_axiseventtype) axisEventType, [Input_AxisEventCallback](#input_axiseventcallback) callback) | Removes the listener for the specified type of axis events, which are defined in [InputEvent_AxisEventType](#inputevent_axiseventtype). | -| [Input_Result](#input_result) [OH_Input_AddKeyEventInterceptor](#oh_input_addkeyeventinterceptor) ([Input_KeyEventCallback](#input_keyeventcallback) callback, [Input_InterceptorOptions](#input_interceptoroptions) \*option) | Adds an interceptor for key events. If multiple interceptors are added, only the first one takes effect. | -| [Input_Result](#input_result) [OH_Input_AddInputEventInterceptor](#oh_input_addinputeventinterceptor) ([Input_InterceptorEventCallback](_input___interceptor_event_callback.md) \*callback [Input_InterceptorOptions](#input_interceptoroptions) \*option) | Adds an interceptor for input events, including mouse, touch, and axis events. If multiple interceptors are added, only the first one takes effect. | -| [Input_Result](#input_result) [OH_Input_RemoveKeyEventInterceptor](#oh_input_removekeyeventinterceptor) (void) | Removes the interceptor for key events. | -| [Input_Result](#input_result) [OH_Input_RemoveInputEventInterceptor](#oh_input_removeinputeventinterceptor) (void) | Removes the interceptor for input events, including mouse, touch, and axis events. | -| [Input_Result](#input_result) [OH_Input_GetIntervalSinceLastInput](#oh_input_getintervalsincelastinput) (int64_t \*timeInterval) | Obtains the interval since the last system input event. | -| [Input_Hotkey](#input_hotkey) \* [OH_Input_CreateHotkey](#oh_input_createhotkey) (void) | Creates a shortcut key object. | -| void [OH_Input_DestroyHotkey](#oh_input_destroyhotkey) ([Input_Hotkey](#input_hotkey) \*\*hotkey) | Destroys a shortcut key object. | -| void [OH_Input_SetPreKeys](#oh_input_setprekeys) ([Input_Hotkey](#input_hotkey) \*hotkey, int32_t \*preKeys, int32_t size) | Sets the modifier key. | -| [Input_Result](#input_result) [OH_Input_GetPreKeys](#oh_input_getprekeys) (const [Input_Hotkey](#input_hotkey) \*hotkey, int32_t \*\*preKeys, int32_t \*preKeyCount) | Obtains the modifier key. | -| void [OH_Input_SetFinalKey](#oh_input_setfinalkey) ([Input_Hotkey](#input_hotkey) \*hotkey, int32_t finalKey) | Sets the modified key. | -| [Input_Result](#input_result) [OH_Input_GetFinalKey](#oh_input_getfinalkey) (const [Input_Hotkey](#input_hotkey) \*hotkey, int32_t \*finalKeyCode) | Obtains the modified key. | -| [Input_Hotkey](#input_hotkey) \*\* [OH_Input_CreateAllSystemHotkeys](#oh_input_createallsystemhotkeys) (int32_t count) | Creates an array of [Input_Hotkey](#input_hotkey) instances. | -| void [OH_Input_DestroyAllSystemHotkeys](#oh_input_destroyallsystemhotkeys) ([Input_Hotkey](#input_hotkey) \*\*hotkeys, int32_t count) | Destroys the array of [Input_Hotkey](#input_hotkey) instances and reclaims the memory. | -| [Input_Result](#input_result) [OH_Input_GetAllSystemHotkeys](#oh_input_getallsystemhotkeys) ([Input_Hotkey](#input_hotkey) \*\*hotkey, int32_t \*count) | Obtains all configured shortcut keys. | -| void [OH_Input_SetRepeat](#oh_input_setrepeat) ([Input_Hotkey](#input_hotkey) \*hotkey, bool isRepeat) | Specifies whether to report repeated key events. | -| [Input_Result](#input_result) [OH_Input_GetRepeat](#oh_input_getrepeat) (const [Input_Hotkey](#input_hotkey) \*hotkey, bool \*isRepeat) | Checks whether to report repeated key events. | -| [Input_Result](#input_result) [OH_Input_AddHotkeyMonitor](#oh_input_addhotkeymonitor) (const [Input_Hotkey](#input_hotkey) \*hotkey, [Input_HotkeyCallback](#input_hotkeycallback) callback) | Subscribes to shortcut key events. This API is not applicable to wearables and lite wearables. | -| [Input_Result](#input_result) [OH_Input_RemoveHotkeyMonitor](#oh_input_removehotkeymonitor) (const [Input_Hotkey](#input_hotkey) \*hotkey, [Input_HotkeyCallback](#input_hotkeycallback) callback) | Unsubscribes from shortcut key events. | -| [Input_Result](#input_result) [OH_Input_GetDeviceIds](#oh_input_getdeviceids) (int32_t \*deviceIds, int32_t inSize, int32_t \*outSize) | Obtains the IDs of all input devices. | -| [Input_Result](#input_result) [OH_Input_GetDevice](#oh_input_getdevice) (int32_t deviceId, [Input_DeviceInfo](#input_deviceinfo) \*\*deviceInfo) | Obtains information about the input device. | -| [Input_DeviceInfo](#input_deviceinfo) \* [OH_Input_CreateDeviceInfo](#oh_input_createdeviceinfo) (void) | Creates a **deviceInfo** object. | -| void [OH_Input_DestroyDeviceInfo](#oh_input_destroydeviceinfo) ([Input_DeviceInfo](#input_deviceinfo) \*\*deviceInfo) | Destroys a **deviceInfo** object. | -| [Input_Result](#input_result) [OH_Input_GetKeyboardType](#oh_input_getkeyboardtype) (int32_t deviceId, int32_t \*keyboardType) | Obtains the keyboard type of the input device. | -| [Input_Result](#input_result) [OH_Input_GetDeviceId](#oh_input_getdeviceid) ([Input_DeviceInfo](#input_deviceinfo) \*deviceInfo, int32_t \*id) | Obtains the ID of an input device. | -| [Input_Result](#input_result) [OH_Input_GetDeviceName](#oh_input_getdevicename) ([Input_DeviceInfo](#input_deviceinfo) \*deviceInfo, char \*\*name) | Obtains the name of an input device. | -| [Input_Result](#input_result) [OH_Input_GetCapabilities](#oh_input_getcapabilities) ([Input_DeviceInfo](#input_deviceinfo) \*deviceInfo, int32_t \*capabilities) | Obtains the capabilities of an input device, for example, a touchscreen, touchpad, or keyboard. | -| [Input_Result](#input_result) [OH_Input_GetDeviceVersion](#oh_input_getdeviceversion) ([Input_DeviceInfo](#input_deviceinfo) \*deviceInfo, int32_t \*version) | Obtains the version information of an input device. | -| [Input_Result](#input_result) [OH_Input_GetDeviceProduct](#oh_input_getdeviceproduct) ([Input_DeviceInfo](#input_deviceinfo) \*deviceInfo, int32_t \*product) | Obtains the product information of an input device. | -| [Input_Result](#input_result) [OH_Input_GetDeviceVendor](#oh_input_getdevicevendor) ([Input_DeviceInfo](#input_deviceinfo) \*deviceInfo, int32_t \*vendor) | Obtains the vendor information of an input device. | -| [Input_Result](#input_result) [OH_Input_GetDeviceAddress](#oh_input_getdeviceaddress) ([Input_DeviceInfo](#input_deviceinfo) \*deviceInfo, char \*\*address) | Obtains the physical address of an input device. | -| [Input_Result](#input_result) [OH_Input_RegisterDeviceListener](#oh_input_registerdevicelistener) ([Input_DeviceListener](_input___device_listener.md) \*listener) | Registers a listener for device hot swap events. | -| [Input_Result](#input_result) [OH_Input_UnregisterDeviceListener](#oh_input_unregisterdevicelistener) ([Input_DeviceListener](_input___device_listener.md) \*listener) | Unregisters the listener for device hot swap events. | -| [Input_Result](#input_result) [OH_Input_UnregisterDeviceListeners](#oh_input_unregisterdevicelisteners) () | Unregisters the listener for all device hot swap events. | -| [Input_Result](#input_result) [OH_Input_GetFunctionKeyState](#oh_input_getfunctionkeystate) (int32_t keyCode, int32_t \*state) | Obtains the function key status. | - - -## Type Description - - -### Input_AxisEvent - -``` -typedef struct Input_AxisEventInput_AxisEvent -``` -**Description** - -Defines an axis event. - -**Since**: 12 - - -### Input_AxisEventCallback - -``` -typedef void(* Input_AxisEventCallback) (const Input_AxisEvent *axisEvent) -``` -**Description** - -Defines a lifecycle callback for **axisEvent**. If the callback is triggered, **axisEvent** will be destroyed. - -**Since**: 12 - -**Parameters** - -| Name| Description | -| ------ | ------ | -| axisEvent | Axis event object.| - -### Input_DeviceAddedCallback - -``` -typedef void(* Input_DeviceAddedCallback) (int32_t deviceId) -``` -**Description** - -Defines a callback used to receive device insertion events. - -**Since**: 13 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| deviceId | Device ID. | - -### Input_DeviceInfo - -``` -typedef struct Input_DeviceInfoInput_DeviceInfo -``` -**Description** - -Defines the input device information. - -**Since**: 13 - -### Input_DeviceListener - -``` -typedef struct Input_DeviceListenerInput_DeviceListener -``` -**Description** - -Defines a listener for device hot swap events. - -**Since**: 13 - -### Input_DeviceRemovedCallback - -``` -typedef void(* Input_DeviceRemovedCallback) (int32_t deviceId) -``` -**Description** - -Defines a callback used to receive device removal events. - -**Since**: 13 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| deviceId | Device ID. | - - -### Input_Hotkey - -``` -typedef struct Input_Hotkey Input_Hotkey -``` -**Description** - -Defines the shortcut key structure. - -**Since**: 14 - - -### Input_HotkeyCallback - -``` -typedef void(* Input_HotkeyCallback) (Input_Hotkey *hotkey) -``` -**Description** - -Defines the callback used to return shortcut key events. - -**Since**: 14 - - -### Input_InterceptorEventCallback - -``` -typedef struct Input_InterceptorEventCallbackInput_InterceptorEventCallback -``` -**Description** - -Defines the structure of the interceptor for callback events, including mouse events, touch events, and axis events. - -**Since**: 12 - - -### Input_InterceptorOptions - -``` -typedef struct Input_InterceptorOptionsInput_InterceptorOptions -``` -**Description** - -Defines event interception options. - -**Since**: 12 - - -### Input_KeyboardType - -``` -typedef enum Input_KeyboardTypeInput_KeyboardType -``` -**Description** - -Enumerates keyboard types of the input device. - -**Since**: 13 - - -### Input_KeyEvent - -``` -typedef struct Input_KeyEventInput_KeyEvent -``` -**Description** - -Defines the key event to be injected. - -**Since**: 12 - - -### Input_KeyEventAction - -``` -typedef enum Input_KeyEventActionInput_KeyEventAction -``` -**Description** - -Provides the enum values of the key event type. - -**Since**: 12 - - -### Input_KeyEventCallback - -``` -typedef void(* Input_KeyEventCallback) (const Input_KeyEvent *keyEvent) -``` -**Description** - -Defines a lifecycle callback for **keyEvent**. If the callback is triggered, **keyEvent** will be destroyed. - -**Since**: 12 - -**Parameters** - -| Name|Description | -| ------ | ------ | -| keyEvent | Key event object.| - -### Input_KeyState - -``` -typedef struct Input_KeyStateInput_KeyState -``` -**Description** - -Defines key information, which identifies a key pressing behavior. For example, the Ctrl key information contains the key value and key type. - -**Since**: 12 - - -### Input_KeyStateAction - -``` -typedef enum Input_KeyStateActionInput_KeyStateAction -``` -**Description** - -Provides the enum values of the key status. - -**Since**: 12 - - -### Input_MouseEvent - -``` -typedef struct Input_MouseEventInput_MouseEvent -``` -**Description** - -Defines the mouse event to be injected. - -**Since**: 12 - -### Input_MouseEventAction - -``` -typedef enum Input_MouseEventActionInput_MouseEventAction -``` -**Description** - -Provides the enum values of mouse actions. - -**Since**: 12 - - -### Input_MouseEventButton - -``` -typedef enum Input_MouseEventButtonInput_MouseEventButton -``` -**Description** - -Provides the enum values of mouse buttons. - -**Since**: 12 - - -### Input_MouseEventCallback - -``` -typedef void(* Input_MouseEventCallback) (const Input_MouseEvent *mouseEvent) -``` -**Description** - -Defines a lifecycle callback for **mouseEvent**. If the callback is triggered, **mouseEvent** will be destroyed. - -**Since**: 12 - -**Parameters** - -| Name| Description | -| ------ | ------ | -| mouseEvent | Mouse event object.| - -### Input_Result - -``` -typedef enum Input_ResultInput_Result -``` -**Description** - -Provides the enum values of error codes. - -**Since**: 12 - - -### Input_TouchEvent - -``` -typedef struct Input_TouchEventInput_TouchEvent -``` -**Description** - -Defines the touch event to be injected. - -**Since**: 12 - - -### Input_TouchEventAction - -``` -typedef enum Input_TouchEventActionInput_TouchEventAction -``` -**Description** - -Provides the enum values of touch actions. - -**Since**: 12 - - -### Input_TouchEventCallback - -``` -typedef void(* Input_TouchEventCallback) (const Input_TouchEvent *touchEvent) -``` -**Description** - -Defines a lifecycle callback for **touchEvent**. If the callback is triggered, **touchEvent** will be destroyed. - -**Since**: 12 - -**Parameters** - -| Name| Description | -| ------ | ------ | -| touchEvent | Touch event object.| - -### InputEvent_AxisAction - -``` -typedef enum InputEvent_AxisActionInputEvent_AxisAction -``` -**Description** - -Action of the input device. - -**Since**: 12 - - -### InputEvent_AxisEventType - -``` -typedef enum InputEvent_AxisEventTypeInputEvent_AxisEventType -``` -**Description** - -Event type of the input device. - -**Since**: 12 - - -### InputEvent_AxisType - -``` -typedef enum InputEvent_AxisTypeInputEvent_AxisType -``` -**Description** - -Defines the axis type of an input device. - -**Since**: 12 - - -### InputEvent_MouseAxis - -``` -typedef enum InputEvent_MouseAxisInputEvent_MouseAxis -``` -**Description** - -Provides the enum values of mouse axis event types. - -**Since**: 12 - - -### InputEvent_SourceType - -``` -typedef enum InputEvent_SourceTypeInputEvent_SourceType -``` -**Description** - -Enter the event source type. - -**Since**: 12 - - -## Enum Description - - -### Input_KeyboardType - -``` -enum Input_KeyboardType -``` -**Description** - -Enumerates keyboard types of the input device. - -**Since**: 13 - -| Value| Description| -| -------- | -------- | -| KEYBOARD_TYPE_NONE | Keyboard without keys.| -| KEYBOARD_TYPE_UNKNOWN | Keyboard with unknown keys.| -| KEYBOARD_TYPE_ALPHABETIC | Full keyboard.| -| KEYBOARD_TYPE_DIGITAL | Numeric keypad.| -| KEYBOARD_TYPE_STYLUS | Stylus.| -| KEYBOARD_TYPE_REMOTE_CONTROL | Remote control.| - - -### Input_KeyCode - -``` -enum Input_KeyCode -``` -**Description** - -Enumerates key code values. - -**Since**: 12 - -| Value| Description| -| -------- | -------- | -| KEYCODE_UNKNOWN | Unknown key| -| KEYCODE_FN | Function (Fn) key| -| KEYCODE_VOLUME_UP | Volume Up key| -| KEYCODE_VOLUME_DOWN | Volume Down key| -| KEYCODE_POWER | Power key| -| KEYCODE_CAMERA | Camera key| -| KEYCODE_VOLUME_MUTE | Speaker Mute key| -| KEYCODE_MUTE | Mute key| -| KEYCODE_BRIGHTNESS_UP | Brightness Up key| -| KEYCODE_BRIGHTNESS_DOWN | Brightness Down key| -| KEYCODE_0 | Key 0| -| KEYCODE_1 | Key 1| -| KEYCODE_2 | Key 2| -| KEYCODE_3 | Key 3| -| KEYCODE_4 | Key 4| -| KEYCODE_5 | Key 5| -| KEYCODE_6 | Key 6| -| KEYCODE_7 | Key 7| -| KEYCODE_8 | Key 8| -| KEYCODE_9 | Key 9| -| KEYCODE_STAR | Key \*| -| KEYCODE_POUND | Key \#| -| KEYCODE_DPAD_UP | Up key on D-pad| -| KEYCODE_DPAD_DOWN | Down key on D-pad| -| KEYCODE_DPAD_LEFT | Left key on D-pad| -| KEYCODE_DPAD_RIGHT | Right key on D-pad| -| KEYCODE_DPAD_CENTER | Center key on D-pad| -| KEYCODE_A | Key A| -| KEYCODE_B | Key B| -| KEYCODE_C | Key C| -| KEYCODE_D | Key D| -| KEYCODE_E | Key E| -| KEYCODE_F | Key F| -| KEYCODE_G | Key G| -| KEYCODE_H | Key H| -| KEYCODE_I | Key I| -| KEYCODE_J | Key J| -| KEYCODE_K | Key K| -| KEYCODE_L | Key L| -| KEYCODE_M | Key M| -| KEYCODE_N | Key N| -| KEYCODE_O | Key O| -| KEYCODE_P | Key P| -| KEYCODE_Q | Key Q| -| KEYCODE_R | Key R| -| KEYCODE_S | Key S| -| KEYCODE_T | Key T| -| KEYCODE_U | Key U| -| KEYCODE_V | Key V| -| KEYCODE_W | Key W| -| KEYCODE_X | Key X| -| KEYCODE_Y | Key Y| -| KEYCODE_Z | Key Z| -| KEYCODE_COMMA | Key ,| -| KEYCODE_PERIOD | Key .| -| KEYCODE_ALT_LEFT | Left Alt key| -| KEYCODE_ALT_RIGHT | Right Alt key| -| KEYCODE_SHIFT_LEFT | Left Shift key| -| KEYCODE_SHIFT_RIGHT | Right Shift key| -| KEYCODE_TAB | Tab key| -| KEYCODE_SPACE | Space key| -| KEYCODE_SYM | Symbol key| -| KEYCODE_EXPLORER | Explorer key, which is used to start the explorer application| -| KEYCODE_ENVELOPE | Email key, which is used to start the email application| -| KEYCODE_ENTER | Enter key| -| KEYCODE_DEL | Delete key| -| KEYCODE_GRAVE | Key `| -| KEYCODE_MINUS | Key -| -| KEYCODE_EQUALS | Key =| -| KEYCODE_LEFT_BRACKET | Key [| -| KEYCODE_RIGHT_BRACKET | Key ]| -| KEYCODE_BACKSLASH | Key \| -| KEYCODE_SEMICOLON | Key ;| -| KEYCODE_APOSTROPHE | Key '| -| KEYCODE_SLASH | Key /| -| KEYCODE_AT | Key \@| -| KEYCODE_PLUS | Key +| -| KEYCODE_MENU | Menu key| -| KEYCODE_PAGE_UP | Page Up key| -| KEYCODE_PAGE_DOWN | Page Down key| -| KEYCODE_ESCAPE | ESC key| -| KEYCODE_FORWARD_DEL | Forward Delete key| -| KEYCODE_CTRL_LEFT | Left Ctrl key| -| KEYCODE_CTRL_RIGHT | Right Ctrl key.| -| KEYCODE_CAPS_LOCK | Caps Lock key| -| KEYCODE_SCROLL_LOCK | Scroll Lock key| -| KEYCODE_META_LEFT | Left Meta key| -| KEYCODE_META_RIGHT | Right Meta key| -| KEYCODE_FUNCTION | Function key| -| KEYCODE_SYSRQ | System Request/Print Screen key| -| KEYCODE_BREAK | Break/Pause key| -| KEYCODE_MOVE_HOME | Move to Home key| -| KEYCODE_MOVE_END | Move to End key| -| KEYCODE_INSERT | Insert key| -| KEYCODE_FORWARD | Forward key| -| KEYCODE_MEDIA_PLAY | Play key| -| KEYCODE_MEDIA_PAUSE | Pause key| -| KEYCODE_MEDIA_CLOSE | Close key| -| KEYCODE_MEDIA_EJECT | Eject key| -| KEYCODE_MEDIA_RECORD | Record key| -| KEYCODE_F1 | F1 key| -| KEYCODE_F2 | F2 key| -| KEYCODE_F3 | F3 key| -| KEYCODE_F4 | F4 key| -| KEYCODE_F5 | F5 key| -| KEYCODE_F6 | F6 key| -| KEYCODE_F7 | F7 key| -| KEYCODE_F8 | F8 key| -| KEYCODE_F9 | F9 key| -| KEYCODE_F10 | F10 key| -| KEYCODE_F11 | F11 key| -| KEYCODE_F12 | F12 key| -| KEYCODE_NUM_LOCK | Number Lock key on numeric keypad| -| KEYCODE_NUMPAD_0 | Key 0 on numeric keypad| -| KEYCODE_NUMPAD_1 | Key 1 on numeric keypad| -| KEYCODE_NUMPAD_2 | Key 2 on numeric keypad| -| KEYCODE_NUMPAD_3 | Key 3 on numeric keypad| -| KEYCODE_NUMPAD_4 | Key 4 on numeric keypad| -| KEYCODE_NUMPAD_5 | Key 5 on numeric keypad| -| KEYCODE_NUMPAD_6 | Key 6 on numeric keypad| -| KEYCODE_NUMPAD_7 | Key 7 on numeric keypad| -| KEYCODE_NUMPAD_8 | Key 8 on numeric keypad| -| KEYCODE_NUMPAD_9 | Key 9 on numeric keypad| -| KEYCODE_NUMPAD_DIVIDE | Key / on numeric keypad| -| KEYCODE_NUMPAD_MULTIPLY | Key \* on numeric keypad| -| KEYCODE_NUMPAD_SUBTRACT | Key - on numeric keypad| -| KEYCODE_NUMPAD_ADD | Key + on numeric keypad| -| KEYCODE_NUMPAD_DOT | Key . on numeric keypad| -| KEYCODE_NUMPAD_COMMA | Key , on numeric keypad| -| KEYCODE_NUMPAD_ENTER | Enter key on numeric keypad| -| KEYCODE_NUMPAD_EQUALS | Key = on numeric keypad| -| KEYCODE_NUMPAD_LEFT_PAREN | Key ( on numeric keypad| -| KEYCODE_NUMPAD_RIGHT_PAREN | Key ) on numeric keypad| -| KEYCODE_DAGGER_CLICK | Dagger click key on the smart watch
**Since**: 18| -| KEYCODE_DAGGER_DOUBLE_CLICK | Dagger double-click key on the smart watch
**Since**: 18| -| KEYCODE_DAGGER_LONG_PRESS | Dagger long-press key on the smart watch
**Since**: 18| - - -### Input_KeyEventAction - -``` -enum Input_KeyEventAction -``` -**Description** - -Provides the enum values of the key event type. - -**Since**: 12 - -| Value| Description| -| -------- | -------- | -| KEY_ACTION_CANCEL | Button action canceled.| -| KEY_ACTION_DOWN | Key pressed.| -| KEY_ACTION_UP | Key released.| - - -### Input_KeyStateAction - -``` -enum Input_KeyStateAction -``` -**Description** - -Provides the enum values of the key status. - -**Since**: 12 - -| Value| Description| -| -------- | -------- | -| KEY_DEFAULT | Default state.| -| KEY_PRESSED | Key pressed.| -| KEY_RELEASED | Key released.| -| KEY_SWITCH_ON | Key switch enabled.| -| KEY_SWITCH_OFF | Key switch disabled.| - - -### Input_MouseEventAction - -``` -enum Input_MouseEventAction -``` -**Description** - -Provides the enum values of mouse actions. - -**Since**: 12 - -| Value| Description| -| -------- | -------- | -| MOUSE_ACTION_CANCEL | Mouse action canceled.| -| MOUSE_ACTION_MOVE | Mouse pointer moved.| -| MOUSE_ACTION_BUTTON_DOWN | Mouse button pressed.| -| MOUSE_ACTION_BUTTON_UP | Mouse button released.| -| MOUSE_ACTION_AXIS_BEGIN | Mouse axis begun.| -| MOUSE_ACTION_AXIS_UPDATE | Mouse axis updated.| -| MOUSE_ACTION_AXIS_END | Mouse axis ended.| - - -### Input_MouseEventButton - -``` -enum Input_MouseEventButton -``` -**Description** - -Provides the enum values of mouse buttons. - -**Since**: 12 - -| Value| Description| -| -------- | -------- | -| MOUSE_BUTTON_NONE | Invalid key| -| MOUSE_BUTTON_LEFT | Left mouse button| -| MOUSE_BUTTON_MIDDLE | Middle mouse button| -| MOUSE_BUTTON_RIGHT | Right mouse button| -| MOUSE_BUTTON_FORWARD | Mouse forward button| -| MOUSE_BUTTON_BACK | Mouse back button| - - -### Input_Result - -``` -enum Input_Result -``` -**Description** - -Provides the enum values of error codes. - -**Since**: 12 - -| Value| Description| -| -------- | -------- | -| INPUT_SUCCESS | Operation succeeded.| -| INPUT_PERMISSION_DENIED | Permission verification failed.| -| INPUT_NOT_SYSTEM_APPLICATION | Not a system application.| -| INPUT_PARAMETER_ERROR | Parameter check failed.| -| INPUT_DEVICE_NOT_SUPPORTED | Input device not supported.
**Since**: API version 14| -| INPUT_SERVICE_EXCEPTION | Service error.| -| INPUT_REPEAT_INTERCEPTOR | Interceptor repeatedly created.| -| INPUT_OCCUPIED_BY_SYSTEM | Occupied by a system application.
**Since**: API version 14| -| INPUT_OCCUPIED_BY_OTHER | Occupied by other applications.
**Since**: API version 14| -| INPUT_KEYBOARD_DEVICE_NOT_EXIST | No keyboard connected.
**Since**: API version 15| - - -### Input_TouchEventAction - -``` -enum Input_TouchEventAction -``` -**Description** - -Provides the enum values of touch actions. - -**Since**: 12 - -| Value| Description| -| -------- | -------- | -| TOUCH_ACTION_CANCEL | Cancellation of touch.| -| TOUCH_ACTION_DOWN | Pressing of touch.| -| TOUCH_ACTION_MOVE | Moving of touch.| -| TOUCH_ACTION_UP | Lifting of touch.| - - -### InputEvent_AxisAction - -``` -enum InputEvent_AxisAction -``` -**Description** - -Action of the input device. - -**Since**: 12 - -| Value| Description| -| -------- | -------- | -| AXIS_ACTION_CANCEL | Cancellation of an axis input event.| -| AXIS_ACTION_BEGIN | Start of an axis input event.| -| AXIS_ACTION_UPDATE | Update of an axis input event.| -| AXIS_ACTION_END | End of an axis input event.| - - -### InputEvent_AxisEventType - -``` -enum InputEvent_AxisEventType -``` -**Description** - -Event type of the input device. - -**Since**: 12 - -| Value| Description| -| -------- | -------- | -| AXIS_EVENT_TYPE_PINCH | Two-finger pinch event. The value can be **AXIS_TYPE_PINCH** or **AXIS_TYPE_ROTATE**.| -| AXIS_EVENT_TYPE_SCROLL | Scroll axis event. The value can be **AXIS_TYPE_SCROLL_VERTICAL** and **AXIS_TYPE_SCROLL_HORIZONTAL**. For mouse wheel events, the value can only be **AXIS_TYPE_SCROLL_VERTICAL**.| - - -### InputEvent_AxisType - -``` -enum InputEvent_AxisType -``` -**Description** - -Defines the axis type of an input device. - -**Since**: 12 - -| Value| Description| -| -------- | -------- | -| AXIS_TYPE_UNKNOWN | Unknown axis type, which is usually used as the initial value.| -| AXIS_TYPE_SCROLL_VERTICAL | Vertical scroll axis. When you scroll the mouse wheel or slide with one or two fingers on the touchpad, the status of the vertical scroll axis changes.| -| AXIS_TYPE_SCROLL_HORIZONTAL | Horizontal scroll axis. When you scroll the mouse wheel or slide with two fingers on the touchpad, the status of the horizontal scroll axis changes.| -| AXIS_TYPE_PINCH | Pinch axis, which is used to describe a two-finger pinch gesture on the touchpad.| -| AXIS_TYPE_ROTATE | Rotation axis, which is used to describe a two-finger rotation gesture on the touchpad.| - - -### InputEvent_MouseAxis - -``` -enum InputEvent_MouseAxis -``` -**Description** - -Provides the enum values of mouse axis event types. - -**Since**: 12 - -| Value| Description| -| -------- | -------- | -| MOUSE_AXIS_SCROLL_VERTICAL | Vertical scroll axis.| -| MOUSE_AXIS_SCROLL_HORIZONTAL | Horizontal scroll axis.| - - -### InputEvent_SourceType - -``` -enum InputEvent_SourceType -``` -**Description** - -Enter the event source type. - -**Since**: 12 - -| Value| Description| -| -------- | -------- | -| SOURCE_TYPE_MOUSE | Source that generates events similar to mouse cursor movement, button press and release, and wheel scrolling.| -| SOURCE_TYPE_TOUCHSCREEN | Source that generates a touchscreen multi-touch event.| -| SOURCE_TYPE_TOUCHPAD | Source that generates a touchpad multi-touch event.| - - -## Function Description - - -### OH_Input_AddAxisEventMonitor() - -``` -Input_Result OH_Input_AddAxisEventMonitor (InputEvent_AxisEventType axisEventType, Input_AxisEventCallback callback ) -``` -**Description** - -Adds a listener for the specified type of axis events, which are defined in [InputEvent_AxisEventType](#inputevent_axiseventtype). - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| axisEventType | Type of the axis event. The event type is defined in [InputEvent_AxisEventType](#inputevent_axiseventtype). | -| callback | Callback used to receive the specified type of axis events. | - -**Required Permissions** - -ohos.permission.INPUT_MONITORING - -**Returns** - -**INTO_SUCCESS** if the operation is successful; **INPUT_PERMISSION_DENIED** if the permission verification fails; **INPUT_PARAMETER_ERROR** if the callback is empty; **INPUT_SERVICE_EXCEPTION** if the service is abnormal. - - -### OH_Input_AddAxisEventMonitorForAll() - -``` -Input_Result OH_Input_AddAxisEventMonitorForAll (Input_AxisEventCallback callback) -``` -**Description** - -Adds a listener for all types of axis events, which are defined in [InputEvent_AxisEventType](#inputevent_axiseventtype). - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| callback | Callback used to receive axis events. | - -**Required Permissions** - -ohos.permission.INPUT_MONITORING - -**Returns** - -**INTO_SUCCESS** if the operation is successful; **INPUT_PERMISSION_DENIED** if the permission verification fails; **INPUT_PARAMETER_ERROR** if the callback is empty; **INPUT_SERVICE_EXCEPTION** if the service is abnormal. - - -### OH_Input_AddHotkeyMonitor() - -``` -Input_Result OH_Input_AddHotkeyMonitor (const Input_Hotkey * hotkey, Input_HotkeyCallback callback ) -``` -**Description** - -Subscribes to shortcut key events. This API is not applicable to wearables and lite wearables. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 14 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| hotkey | Shortcut key object. | -| callback | Defines the callback used to return shortcut key events. | - -**Returns** - -OH_Input_AddHotkeyMonitor status code, specifically, - -**INPUT_SUCCESS** if the operation is successful; - -INPUT_PARAMETER_ERROR if parameter check fails; - -INPUT_OCCUPIED_BY_SYSTEM if the shortcut key has been occupied by the system (you can use [OH_Input_GetAllSystemHotkeys](#oh_input_getallsystemhotkeys) to query allsystem shortcut keys); - -INPUT_OCCUPIED_BY_OTHER if the shortcut key has been occupied by another application. - -**INPUT_DEVICE_NOT_SUPPORTED** if the input device is not supported. - -### OH_Input_AddInputEventInterceptor() - -``` -Input_Result OH_Input_AddInputEventInterceptor (Input_InterceptorEventCallback *callback Input_InterceptorOptions * option) -``` -**Description** - -Adds an interceptor for input events, including mouse, touch, and axis events. If multiple interceptors are added, only the first one takes effect. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| callback | Pointer to the input event callback. For details, see [Input_InterceptorEventCallback](_input___interceptor_event_callback.md). | -| option | Options for event interception. If **null** is passed, the default value is used. | - -**Required Permissions** - -ohos.permission.INTERCEPT_INPUT_EVENT - -**Returns** - -**INTO_SUCCESS** if the operation is successful; - -**INPUT_PERMISSION_DENIED** if the permission verification fails; - -**INPUT_PARAMETER_ERROR** if the callback is empty; - -**INPUT_REPEAT_INTERCEPTOR** if an interceptor is repeatedly added; - -or **INPUT_SERVICE_EXCEPTION** if the service is abnormal. - - -### OH_Input_AddKeyEventInterceptor() - -``` -Input_Result OH_Input_AddKeyEventInterceptor (Input_KeyEventCallback callback, Input_InterceptorOptions * option ) -``` -**Description** - -Adds an interceptor for key events. If multiple interceptors are added, only the first one takes effect. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| callback | Callback used to receive key events. | -| option | Options for event interception. If **null** is passed, the default value is used. | - -**Required Permissions** - -ohos.permission.INTERCEPT_INPUT_EVENT - -**Returns** - -**INTO_SUCCESS** if the operation is successful; - -**INPUT_PERMISSION_DENIED** if the permission verification fails; - -**INPUT_PARAMETER_ERROR** if the callback is empty; - -**INPUT_REPEAT_INTERCEPTOR** if an interceptor is repeatedly added; - -or **INPUT_SERVICE_EXCEPTION** if the service is abnormal. - - -### OH_Input_AddKeyEventMonitor() - -``` -Input_Result OH_Input_AddKeyEventMonitor (Input_KeyEventCallback callback) -``` -**Description** - -Adds a listener for key events. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| callback | Callback used to receive key events. | - -**Required Permissions** - -ohos.permission.INPUT_MONITORING - -**Returns** - -**INTO_SUCCESS** if the operation is successful; - -**INPUT_PERMISSION_DENIED** if the permission verification fails; - -**INPUT_PARAMETER_ERROR** if the callback is empty; - -or **INPUT_SERVICE_EXCEPTION** if the service is abnormal. - - -### OH_Input_AddMouseEventMonitor() - -``` -Input_Result OH_Input_AddMouseEventMonitor (Input_MouseEventCallback callback) -``` -**Description** - -Adds a listener for mouse events, including mouse click and movement events, but not scroll wheel events. Scroll wheel events are axis events. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| callback | Callback used to receive mouse events. | - -**Required Permissions** - -ohos.permission.INPUT_MONITORING - -**Returns** - -**INTO_SUCCESS** if the operation is successful; - -**INPUT_PERMISSION_DENIED** if the permission verification fails; - -**INPUT_PARAMETER_ERROR** if the callback is empty; - -or **INPUT_SERVICE_EXCEPTION** if the service is abnormal. - - -### OH_Input_AddTouchEventMonitor() - -``` -Input_Result OH_Input_AddTouchEventMonitor (Input_TouchEventCallback callback) -``` -**Description** - -Adds a listener for touch events. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| callback | Callback used to receive touch events. | - -**Required Permissions** - -ohos.permission.INPUT_MONITORING - -**Returns** - -**INTO_SUCCESS** if the operation is successful; **INPUT_PERMISSION_DENIED** if the permission verification fails; **INPUT_PARAMETER_ERROR** if the callback is empty; **INPUT_SERVICE_EXCEPTION** if the service is abnormal. - - -### OH_Input_CancelInjection() - -``` -void OH_Input_CancelInjection () -``` -**Description** - -Stops event injection and revokes authorization. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - - -### OH_Input_CreateAllSystemHotkeys() - -``` -Input_Hotkey** OH_Input_CreateAllSystemHotkeys (int32_t count) -``` -**Description** - -Creates an array of [Input_Hotkey](#input_hotkey) instances. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 14 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| count | Number of [Input_Hotkey](#input_hotkey) instances to be created. | - -**Returns** - -OH_Input_CreateAllSystemHotkey status code, which is **INPUT_SUCCESS** if a double pointer to the instance array is successfully created or an error code otherwise. - - -### OH_Input_CreateAxisEvent() - -``` -Input_AxisEvent* OH_Input_CreateAxisEvent ( void ) -``` -**Description** - -Creates an axis event object. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Returns** - -An [Input_AxisEvent](#input_axisevent) object if the operation is successful; **null** otherwise. - - -### OH_Input_CreateDeviceInfo() - -``` -Input_DeviceInfo* OH_Input_CreateDeviceInfo (void ) -``` -**Description** - -Creates a **deviceInfo** object. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 13 - -**Returns** - -Pointer to an [Input_DeviceInfo](#input_deviceinfo) object if the operation is successful; a null pointer otherwise (possibly because of a memory allocation failure). - - -### OH_Input_CreateHotkey() - -``` -Input_Hotkey* OH_Input_CreateHotkey (void) -``` -**Description** - -Creates a shortcut key object. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 14 - -**Returns** - -An [Input_Hotkey](#input_hotkey) pointer object if the operation is successful; a null pointer otherwise (possibly because of a memory allocation failure). - - -### OH_Input_CreateKeyEvent() - -``` -struct Input_KeyEvent* OH_Input_CreateKeyEvent () -``` -**Description** - -Creates a key event object. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Returns** - -An [Input_KeyEvent](#input_keyevent) pointer object if the operation is successful; a null pointer otherwise. - - -### OH_Input_CreateKeyState() - -``` -struct Input_KeyState* OH_Input_CreateKeyState () -``` -**Description** - -Creates a key status enum object. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Returns** - -An [Input_KeyState](#input_keystate) pointer object if the operation is successful; a null pointer otherwise. - - -### OH_Input_CreateMouseEvent() - -``` -struct Input_MouseEvent* OH_Input_CreateMouseEvent () -``` -**Description** - -Creates a mouse event object. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Returns** - -An [Input_MouseEvent](#input_mouseevent) pointer object if the operation is successful; a null pointer otherwise. - - -### OH_Input_CreateTouchEvent() - -``` -struct Input_TouchEvent* OH_Input_CreateTouchEvent () -``` -**Description** - -Creates a touch event object. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Returns** - -An [Input_TouchEvent](#input_touchevent) pointer object if the operation is successful; a null pointer otherwise. - - -### OH_Input_DestroyAllSystemHotkeys() - -``` -void OH_Input_DestroyAllSystemHotkeys (Input_Hotkey ** hotkeys, int32_t count ) -``` -**Description** - -Destroys the array of [Input_Hotkey](#input_hotkey) instances and reclaims the memory. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 14 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| hotkeys | Double pointer to the array of [Input_Hotkey](#input_hotkey) instances. | -| count | Number of [Input_Hotkey](#input_hotkey) instances to be destroyed. | - - -### OH_Input_DestroyAxisEvent() - -``` -Input_Result OH_Input_DestroyAxisEvent (Input_AxisEvent ** axisEvent) -``` -**Description** - -Destroys an axis event object. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| axisEvent | Pointer to the axis event object. | - -**Returns** - -**INTO_SUCCESS** if operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** or **\*axisEvent** is **NULL**. - - -### OH_Input_DestroyDeviceInfo() - -``` -void OH_Input_DestroyDeviceInfo (Input_DeviceInfo ** deviceInfo) -``` -**Description** - -Destroys a **deviceInfo** object. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 13 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| deviceInfo | **deviceInfo** object. | - - -### OH_Input_DestroyHotkey() - -``` -void OH_Input_DestroyHotkey (Input_Hotkey ** hotkey) -``` -**Description** - -Destroys a shortcut key object. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 14 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| hotkey | Shortcut key object. | - - -### OH_Input_DestroyKeyEvent() - -``` -void OH_Input_DestroyKeyEvent (struct Input_KeyEvent ** keyEvent) -``` -**Description** - -Destroys a key event object. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| keyEvent | Key event object. | - - -### OH_Input_DestroyKeyState() - -``` -void OH_Input_DestroyKeyState (struct Input_KeyState ** keyState) -``` -**Description** - -Destroys a key status enum object. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| keyState | Key status enum object. For details, see [Input_KeyStateAction](#input_keystateaction).| - - -### OH_Input_DestroyMouseEvent() - -``` -void OH_Input_DestroyMouseEvent (struct Input_MouseEvent ** mouseEvent) -``` -**Description** - -Destroys a mouse event object. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| mouseEvent | Mouse event object. | - - -### OH_Input_DestroyTouchEvent() - -``` -void OH_Input_DestroyTouchEvent (struct Input_TouchEvent ** touchEvent) -``` -**Description** - -Destroys a touch event object. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| touchEvent | Touch event object. | - - -### OH_Input_GetAllSystemHotkeys() - -``` -Input_Result OH_Input_GetAllSystemHotkeys (Input_Hotkey ** hotkey, int32_t * count ) -``` -**Description** - -Obtains all configured shortcut keys. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 14 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| hotkey | An array of [Input_Hotkey](#input_hotkey) instances. When calling this API for the first time, you can pass **NULL** to obtain the array length. | -| count | Number of supported shortcut keys. | - -**Returns** - -Status code of the **OH_Input_GetAllSystemHotkeys** function, which is - -**INTO_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** otherwise. - - -### OH_Input_GetAxisEventAction() - -``` -Input_Result OH_Input_GetAxisEventAction (const Input_AxisEvent * axisEvent, InputEvent_AxisAction * action ) -``` -**Description** - -Obtains the action of an axis event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| axisEvent | Axis event object. | -| action | Action of the axis event. For details, see [InputEvent_AxisAction](#inputevent_axisaction). | - -**Returns** - -**INTO_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** or **action** is **NULL**. - -### OH_Input_GetAxisEventActionTime() - -``` -Input_Result OH_Input_GetAxisEventActionTime (const Input_AxisEvent * axisEvent, int64_t * actionTime ) -``` -**Description** - -Obtains the time when an axis event occurs. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| axisEvent | Axis event object. For details, see [Input_AxisEvent](#input_axisevent). | -| actionTime | Time when an axis event occurs. | - -**Returns** - -**INTO_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** or **actionTime** is **NULL**. - - -### OH_Input_GetAxisEventAxisValue() - -``` -Input_Result OH_Input_GetAxisEventAxisValue (const Input_AxisEvent * axisEvent, InputEvent_AxisType axisType, double * axisValue ) -``` -**Description** - -Obtains the axis value for the specified axis type of the axis event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| axisEvent | Axis event object. For details, see [Input_AxisEvent](#input_axisevent). | -| axisType | Axis type. For details, see [InputEvent_AxisType](#inputevent_axistype). | -| axisValue | Axis value of the axis event. | - -**Returns** - -**INTO_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** or **axisValue** is **NULL**. - - -### OH_Input_GetAxisEventDisplayId() - -``` -Input_Result OH_Input_GetAxisEventDisplayId (const Input_AxisEvent * axisEvent, int32_t * displayId ) -``` -**Description** - -Obtains the screen ID of an axis event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 15 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| axisEvent | Axis event object. | -| displayId | Screen ID of the axis event. | - -**Returns** - -**INTO_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** or **displayId** is **NULL**. - - -### OH_Input_GetAxisEventDisplayX() - -``` -Input_Result OH_Input_GetAxisEventDisplayX (const Input_AxisEvent * axisEvent, float * displayX ) -``` -**Description** - -Obtains the X coordinate of an axis event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| axisEvent | Axis event object. | -| displayX | X coordinate of the axis event. | - -**Returns** - -**INTO_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** or **displayX** is **NULL**. - - -### OH_Input_GetAxisEventDisplayY() - -``` -Input_Result OH_Input_GetAxisEventDisplayY (const Input_AxisEvent * axisEvent, float * displayY ) -``` -**Description** - -Obtains the Y coordinate of an axis event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| axisEvent | Axis event object. For details, see [Input_AxisEvent](#input_axisevent). | -| displayY | Y coordinate of the axis event. | - -**Returns** - -**INTO_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** or **displayY** is **NULL**. - - -### OH_Input_GetAxisEventSourceType() - -``` -Input_Result OH_Input_GetAxisEventSourceType (const Input_AxisEvent * axisEvent, InputEvent_SourceType * sourceType ) -``` -**Description** - -Obtains the axis event source type. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| axisEvent | Axis event object. | -| sourceType | Axis event source type. For details, see [InputEvent_SourceType](#inputevent_sourcetype). | - -**Returns** - -**INTO_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** or **sourceType** is **NULL**. - - -### OH_Input_GetAxisEventType() - -``` -Input_Result OH_Input_GetAxisEventType (const Input_AxisEvent * axisEvent, InputEvent_AxisEventType * axisEventType ) -``` -**Description** - -Obtains the axis event type. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| axisEvent | Axis event object. | -| axisEventType | Axis event type. For details, see [InputEvent_AxisEventType](#inputevent_axiseventtype). | - -**Returns** - -**INTO_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** or **axisEventType** is **NULL**. - - -### OH_Input_GetAxisEventWindowId() - -``` -Input_Result OH_Input_GetAxisEventWindowId (const Input_AxisEvent * axisEvent, int32_t * windowId ) -``` -**Description** - -Obtains the window ID of an axis event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 15 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| axisEvent | Axis event object. | -| windowId | Window ID of the axis event. | - -**Returns** - -**INTO_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** or **windowId** is **NULL**. - - -### OH_Input_GetCapabilities() - -``` -Input_Result OH_Input_GetCapabilities (Input_DeviceInfo * deviceInfo, int32_t * capabilities ) -``` -**Description** - -Obtains the capabilities of an input device, for example, a touchscreen, touchpad, or keyboard. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 13 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| deviceInfo | [Input_DeviceInfo](#input_deviceinfo) object. | -| capabilities | Pointer to the capability information of the input device. | - -**Returns** - -**INPUT_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **deviceInfo** or **capabilities** is a null pointer. - - -### OH_Input_GetDevice() - -``` -Input_Result OH_Input_GetDevice (int32_t deviceId, Input_DeviceInfo ** deviceInfo ) -``` -**Description** - -Obtains information about the input device. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 13 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| deviceId | Device ID. | -| deviceInfo | Pointer to the [Input_DeviceInfo](#input_deviceinfo) object. | - -**Returns** - -**INPUT_SUCCESS** if the operation is successful; - -**INPUT_PARAMETER_ERROR** if **deviceInfo** is a null pointer or **deviceId** is invalid. You can use [OH_Input_GetDeviceIds](#oh_input_getdeviceids) to query the device IDs supported by the system. - - -### OH_Input_GetDeviceAddress() - -``` -Input_Result OH_Input_GetDeviceAddress (Input_DeviceInfo * deviceInfo, char ** address ) -``` -**Description** - -Obtains the physical address of an input device. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 13 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| deviceInfo | [Input_DeviceInfo](#input_deviceinfo) object. | -| address | Pointer to the physical address of the input device. | - -**Returns** - -**INPUT_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **deviceInfo** or **address** is a null pointer. - - -### OH_Input_GetDeviceId() - -``` -Input_Result OH_Input_GetDeviceId (Input_DeviceInfo * deviceInfo, int32_t * id ) -``` -**Description** - -Obtains the ID of an input device. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 13 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| deviceInfo | Input device information. For details, see [Input_DeviceInfo](#input_deviceinfo). | -| id | Pointer to the input device ID. | - -**Returns** - -**INPUT_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **deviceInfo** or **id** is a null pointer. - - -### OH_Input_GetDeviceIds() - -``` -Input_Result OH_Input_GetDeviceIds (int32_t * deviceIds, int32_t inSize, int32_t * outSize ) -``` -**Description** - -Obtains the IDs of all input devices. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 13 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| deviceIds | List of input device IDs. | -| inSize | Size of the input device ID list. | -| outSize | Length of the input device ID list. The value must be less than or equal to the value of **inSize**. | - -**Returns** - -**INPUT_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **deviceIds** or **outSize** is a null pointer or **inSize** is less than **0**. - - -### OH_Input_GetDeviceName() - -``` -Input_Result OH_Input_GetDeviceName (Input_DeviceInfo * deviceInfo, char ** name ) -``` -**Description** - -Obtains the name of an input device. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 13 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| deviceInfo | Input device information. For details, see [Input_DeviceInfo](#input_deviceinfo). | -| name | Pointer to the input device name. | - -**Returns** - -**INPUT_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **deviceInfo** or **name** is a null pointer. - - -### OH_Input_GetDeviceProduct() - -``` -Input_Result OH_Input_GetDeviceProduct (Input_DeviceInfo * deviceInfo, int32_t * product ) -``` -**Description** - -Obtains the product information of an input device. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 13 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| deviceInfo | Input device information. For details, see [Input_DeviceInfo](#input_deviceinfo). | -| product | Pointer to the product information of the input device. | - -**Returns** - -**INPUT_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **deviceInfo** or **product** is a null pointer. - - -### OH_Input_GetDeviceVendor() - -``` -Input_Result OH_Input_GetDeviceVendor (Input_DeviceInfo * deviceInfo, int32_t * vendor ) -``` -**Description** - -Obtains the vendor information of an input device. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 13 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| deviceInfo | Input device information. For details, see [Input_DeviceInfo](#input_deviceinfo). | -| vendor | Pointer to the vendor information of the input device. | - -**Returns** - -**INPUT_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **deviceInfo** or **vendor** is a null pointer. - - -### OH_Input_GetDeviceVersion() - -``` -Input_Result OH_Input_GetDeviceVersion (Input_DeviceInfo * deviceInfo, int32_t * version ) -``` -**Description** - -Obtains the version information of an input device. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 13 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| deviceInfo | Input device information. For details, see [Input_DeviceInfo](#input_deviceinfo). | -| version | Pointer to the version information of the input device. | - -**Returns** - -**INPUT_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **deviceInfo** or **version** is a null pointer. - - -### OH_Input_GetFinalKey() - -``` -Input_Result OH_Input_GetFinalKey (const Input_Hotkey * hotkey, int32_t * finalKeyCode ) -``` -**Description** - -Obtains the modified key. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 14 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| hotkey | Shortcut key object. | -| finalKeyCode | Modified key. | - -**Returns** - -Status code of the **OH_Input_GetfinalKey** function, which is **INPUT_SUCCESS** if the operation is successful or - -**INPUT_PARAMETER_ERROR** otherwise. - - -### OH_Input_GetFunctionKeyState() - -``` -Input_Result OH_Input_GetFunctionKeyState (int32_t keyCode, int32_t * state ) -``` -**Description** - -Obtains the function key status. - -**Since**: 15 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| keyCode | Function key. Only the **CapsLock** key is supported. | -| state | Function key status. The value **0** indicates that the function key is disabled, and the value **1** indicates that the function key is enabled. | - -**Returns** - -**OH_Input_GetFunctionKeyState** status code, specifically: -**INPUT_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if the parameter is incorrect; **INPUT_DEVICE_NOT_EXIST** if the keyboard does not exist. - - -### OH_Input_GetIntervalSinceLastInput() - -``` -Input_Result OH_Input_GetIntervalSinceLastInput (int64_t * timeInterval) -``` -**Description** - -Obtains the interval since the last system input event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 14 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| timeInterval | Interval, in microseconds. | - -**Returns** - -Status code of the **OH_Input_GetIntervalSinceLastInput** function, - -which is **INPUT_SUCCESS** if the operation is successful; **INPUT_SERVICE_EXCEPTION** otherwise. - - -### OH_Input_GetKeyboardType() - -``` -Input_Result OH_Input_GetKeyboardType (int32_t deviceId, int32_t * keyboardType ) -``` -**Description** - -Obtains the keyboard type of an input device. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 13 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| deviceId | Device ID. | -| keyboardType | Pointer to the keyboard type of the input device. | - -**Returns** - -**INPUT_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if the device ID is invalid or **keyboardType** is a null pointer. - - -### OH_Input_GetKeyCode() - -``` -int32_t OH_Input_GetKeyCode (const struct Input_KeyState * keyState) -``` -**Description** - -Obtains the key value of a key status enum object. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| keyState | Key status enum object. For details, see [Input_KeyStateAction](#input_keystateaction).| - -**Returns** - -Key value of the key status enum object. - - -### OH_Input_GetKeyEventAction() - -``` -int32_t OH_Input_GetKeyEventAction (const struct Input_KeyEvent * keyEvent) -``` -**Description** - -Obtains the key event type. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| keyEvent | Key event object.| - -**Returns** - -Key event type. - - -### OH_Input_GetKeyEventActionTime() - -``` -int64_t OH_Input_GetKeyEventActionTime (const struct Input_KeyEvent * keyEvent) -``` -**Description** - -Obtains the time when a key event occurs. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| keyEvent | Key event object. | - -**Returns** - -Time when a key event occurs. - - -### OH_Input_GetKeyEventDisplayId() - -``` -int32_t OH_Input_GetKeyEventDisplayId (const struct Input_KeyEvent * keyEvent) -``` -**Description** - -Obtains the screen ID of a key event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 15 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| keyEvent | Key event object. | - -**Returns** - -Screen ID of the key event. - - -### OH_Input_GetKeyEventKeyCode() - -``` -int32_t OH_Input_GetKeyEventKeyCode (const struct Input_KeyEvent * keyEvent) -``` -**Description** - -Obtains the key code value of a key event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| keyEvent | Key event object. | - -**Returns** - -Key code. - - -### OH_Input_GetKeyEventWindowId() - -``` -int32_t OH_Input_GetKeyEventWindowId (const struct Input_KeyEvent * keyEvent) -``` -**Description** - -Obtains the window ID of a key event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 15 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| keyEvent | Key event object. | - -**Returns** - -Window ID of the key event. - - -### OH_Input_GetKeyPressed() - -``` -int32_t OH_Input_GetKeyPressed (const struct Input_KeyState * keyState) -``` -**Description** - -Checks whether the key specific to a key status enum object is pressed. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| keyState | Key status enum object. For details, see [Input_KeyStateAction](#input_keystateaction).| - -**Returns** - -Key pressing status of the key status enum object. - - -### OH_Input_GetKeyState() - -``` -Input_Result OH_Input_GetKeyState (struct Input_KeyState * keyState) -``` -**Description** - -Queries a key status enum object. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| keyState | Key status enum object. For details, see [Input_KeyStateAction](#input_keystateaction).| - -**Returns** - -**Input_Result#INPUT_SUCCESS** if the operation is successful; an error code defined in [Input_Result](#input_result) otherwise. - - -### OH_Input_GetKeySwitch() - -``` -int32_t OH_Input_GetKeySwitch (const struct Input_KeyState * keyState) -``` -**Description** - -Obtains the key switch of the key status enum object. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| keyState | Key status enum object. For details, see [Input_KeyStateAction](#input_keystateaction).| - -**Returns** - -Key switch of the key status enum object. - - -### OH_Input_GetMouseEventAction() - -``` -int32_t OH_Input_GetMouseEventAction (const struct Input_MouseEvent * mouseEvent) -``` -**Description** - -Obtains the action of a mouse event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| mouseEvent | Mouse event object. | - -**Returns** - -Mouse action. - - -### OH_Input_GetMouseEventActionTime() - -``` -int64_t OH_Input_GetMouseEventActionTime (const struct Input_MouseEvent * mouseEvent) -``` -**Description** - -Obtains the time when a mouse event occurs. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| keyEvent | Mouse event object. | - -**Returns** - -Time when the mouse event occurs. - - -### OH_Input_GetMouseEventAxisType() - -``` -int32_t OH_Input_GetMouseEventAxisType (const struct Input_MouseEvent * mouseEvent) -``` -**Description** - -Obtains the axis type of a mouse event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| mouseEvent | Mouse event object. | - -**Returns** - -Axis type. - - -### OH_Input_GetMouseEventAxisValue() - -``` -float OH_Input_GetMouseEventAxisValue (const struct Input_MouseEvent * mouseEvent) -``` -**Description** - -Obtains the axis value of a mouse axis event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| mouseEvent | Mouse event object. | - -**Returns** - -Axis value of the mouse axis event. - - -### OH_Input_GetMouseEventButton() - -``` -int32_t OH_Input_GetMouseEventButton (const struct Input_MouseEvent * mouseEvent) -``` -**Description** - -Obtains the button of a mouse event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| mouseEvent | Mouse event object. | - -**Returns** - -Enumerates mouse buttons. - - -### OH_Input_GetMouseEventDisplayId() - -``` -int32_t OH_Input_GetMouseEventDisplayId (const struct Input_MouseEvent * mouseEvent) -``` -**Description** - -Obtains the screen ID of a mouse event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 15 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| mouseEvent | Mouse event object. | - -**Returns** - -Screen ID of the mouse event. - - -### OH_Input_GetMouseEventDisplayX() - -``` -int32_t OH_Input_GetMouseEventDisplayX (const struct Input_MouseEvent * mouseEvent) -``` -**Description** - -Obtains the X coordinate of a mouse event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| mouseEvent | Mouse event object. | - -**Returns** - -X coordinate on the screen. - - -### OH_Input_GetMouseEventDisplayY() - -``` -int32_t OH_Input_GetMouseEventDisplayY (const struct Input_MouseEvent * mouseEvent) -``` -**Description** - -Obtains the Y coordinate of a mouse event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| mouseEvent | Mouse event object. | - -**Returns** - -Y coordinate on the screen. - - -### OH_Input_GetMouseEventWindowId() - -``` -int32_t OH_Input_GetMouseEventWindowId (const struct Input_MouseEvent * mouseEvent) -``` -**Description** - -Obtains the window ID of a mouse event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 15 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| mouseEvent | Mouse event object. | - -**Returns** - -Window ID of the mouse event. - - -### OH_Input_GetPreKeys() - -``` -Input_Result OH_Input_GetPreKeys (const Input_Hotkey * hotkey, int32_t ** preKeys, int32_t * preKeyCount ) -``` -**Description** - -Obtains the modifier key. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 14 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| hotkey | Shortcut key object. | -| preKeys | List of modifier keys. | -| preKeyCount | Number of modifier keys. | - -**Returns** - -Status code of the **OH_Input_GetpressedKeys** function, which is **INPUT_SUCCESS** if the operation is successful or - -**INPUT_PARAMETER_ERROR** otherwise. - -### OH_Input_GetRepeat() - -``` -Input_Result OH_Input_GetRepeat (const Input_Hotkey * hotkey, bool * isRepeat ) -``` -**Description** - -Checks whether to report repeated key events. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 14 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| hotkey | Shortcut key object. | -| isRepeat | Whether the reported key events is repeated. | - -**Returns** - -OH_Input_GetIsRepeat status code, specifically, **INPUT_SUCCESS** if the operation is successful or - -**INPUT_PARAMETER_ERROR** otherwise. - -### OH_Input_GetTouchEventAction() - -``` -int32_t OH_Input_GetTouchEventAction (const struct Input_TouchEvent * touchEvent) -``` -**Description** - -Obtains the action of a touch event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| touchEvent | Touch event object. | - -**Returns** - -Action of the touch event. - - -### OH_Input_GetTouchEventActionTime() - -``` -int64_t OH_Input_GetTouchEventActionTime (const struct Input_TouchEvent * touchEvent) -``` -**Description** - -Obtains the time when a touch event occurs. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| keyEvent | Touch event object. | - -**Returns** - -Time when the touch event occurs. - - -### OH_Input_GetTouchEventDisplayId() - -``` -int32_t OH_Input_GetTouchEventDisplayId (const struct Input_TouchEvent * touchEvent) -``` -**Description** - -Obtains the screen ID of a touchscreen event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 15 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| touchEvent | Touch event object. | - -**Returns** - -Screen ID of the touchscreen event. - - -### OH_Input_GetTouchEventDisplayX() - -``` -int32_t OH_Input_GetTouchEventDisplayX (const struct Input_TouchEvent * touchEvent) -``` -**Description** - -Obtains the X coordinate of a touch event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| touchEvent | Touch event object. | - -**Returns** - -X coordinate on the touchscreen. - - -### OH_Input_GetTouchEventDisplayY() - -``` -int32_t OH_Input_GetTouchEventDisplayY (const struct Input_TouchEvent * touchEvent) -``` -**Description** - -Obtains the Y coordinate of a touch event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| touchEvent | Touch event object. | - -**Returns** - -Y coordinate on the touchscreen. - - -### OH_Input_GetTouchEventFingerId() - -``` -int32_t OH_Input_GetTouchEventFingerId (const struct Input_TouchEvent * touchEvent) -``` -**Description** - -Obtains the finger ID of a touch event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| touchEvent | Touch event object. | - -**Returns** - -Finger ID of a touch event. - - -### OH_Input_GetTouchEventWindowId() - -``` -int32_t OH_Input_GetTouchEventWindowId (const struct Input_TouchEvent * touchEvent) -``` -**Description** - -Obtains the window ID of a touchscreen event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 15 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| touchEvent | Touch event object. | - -**Returns** - -Window ID of the touchscreen event. - - -### OH_Input_InjectKeyEvent() - -``` -int32_t OH_Input_InjectKeyEvent (const struct Input_KeyEvent * keyEvent) -``` -**Description** - -Injects a key event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| keyEvent | Defines the key event to be injected. | - -**Returns** - -**0** if the operation is successful; **201** if the required permission is missing; **401** if the parameter is invalid. - - -### OH_Input_InjectMouseEvent() - -``` -int32_t OH_Input_InjectMouseEvent (const struct Input_MouseEvent * mouseEvent) -``` -**Description** - -Injects a mouse event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| mouseEvent | Defines the mouse event to be injected. | - -**Returns** - -**0** if the operation is successful; **201** if the required permission is missing; **401** if the parameter is invalid. - - -### OH_Input_InjectTouchEvent() - -``` -int32_t OH_Input_InjectTouchEvent (const struct Input_TouchEvent * touchEvent) -``` -**Description** - -Injects a touch event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| touchEvent | Defines the touch event to be injected. | - -**Returns** - -**0** if the operation is successful; **201** if the required permission is missing; **401** if the parameter is invalid. - -### OH_Input_RegisterDeviceListener() - -``` -Input_Result OH_Input_RegisterDeviceListener (Input_DeviceListener * listener) -``` -**Description** - -Registers a listener for device hot swap events. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 13 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| listener | Pointer to the [Input_DeviceListener](_input___device_listener.md) object. | - -**Returns** - -**OH_Input_RegisterDeviceListener** status code, specifically: - -**INPUT_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **listener** is **NULL**. - -### OH_Input_RemoveAxisEventMonitor() - -``` -Input_Result OH_Input_RemoveAxisEventMonitor (InputEvent_AxisEventType axisEventType, Input_AxisEventCallback callback ) -``` -**Description** - -Removes the listener for the specified type of axis events, which are defined in [InputEvent_AxisEventType](#inputevent_axiseventtype). - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| axisEventType | Axis event type, which is defined in [InputEvent_AxisEventType](#inputevent_axiseventtype). | -| callback | Callback for the specified type of axis events. | - -**Required Permissions** - -ohos.permission.INPUT_MONITORING - -**Returns** - -**INTO_SUCCESS** if the operation is successful; **INPUT_PERMISSION_DENIED** if the permission verification fails; **INPUT_PARAMETER_ERROR** if the callback is empty or no listener is added; **INPUT_SERVICE_EXCEPTION** if the service is abnormal. - - -### OH_Input_RemoveAxisEventMonitorForAll() - -``` -Input_Result OH_Input_RemoveAxisEventMonitorForAll (Input_AxisEventCallback callback) -``` -**Description** - -Removes the listener for all types of axis events. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| callback | Callback for the all types of axis events. | - -**Required Permissions** - -ohos.permission.INPUT_MONITORING - -**Returns** - -**INTO_SUCCESS** if the operation is successful; **INPUT_PERMISSION_DENIED** if the permission verification fails; **INPUT_PARAMETER_ERROR** if the callback is empty or no listener is added; **INPUT_SERVICE_EXCEPTION** if the service is abnormal. - - -### OH_Input_RemoveHotkeyMonitor() - -``` -Input_Result OH_Input_RemoveHotkeyMonitor (const Input_Hotkey * hotkey, Input_HotkeyCallback callback ) -``` -**Description** - -Unsubscribes from shortcut key events. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 14 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| hotkey | Shortcut key object. | -| callback | Defines the callback used to return shortcut key events. | - -**Returns** - -OH_Input_RemoveHotkeyMonitor status code, specifically, **INPUT_SUCCESS** if the operation is successful or - -**INPUT_PARAMETER_ERROR** if parameter check fails. - - -### OH_Input_RemoveInputEventInterceptor() - -``` -Input_Result OH_Input_RemoveInputEventInterceptor (void) -``` -**Description** - -Removes the interceptor for input events, including mouse, touch, and axis events. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Required Permissions** - -ohos.permission.INTERCEPT_INPUT_EVENT - -**Returns** - -**INTO_SUCCESS** if operation is successful; **INPUT_PERMISSION_DENIED** if permission verification fails; **INPUT_SERVICE_EXCEPTION** if the service is abnormal. - - -### OH_Input_RemoveKeyEventInterceptor() - -``` -Input_Result OH_Input_RemoveKeyEventInterceptor (void) -``` -**Description** - -Removes the interceptor for key events. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Required Permissions** - -ohos.permission.INTERCEPT_INPUT_EVENT - -**Returns** - -**INTO_SUCCESS** if operation is successful; **INPUT_PERMISSION_DENIED** if permission verification fails; **INPUT_SERVICE_EXCEPTION** if the service is abnormal. - - -### OH_Input_RemoveKeyEventMonitor() - -``` -Input_Result OH_Input_RemoveKeyEventMonitor (Input_KeyEventCallback callback) -``` -**Description** - -Removes the listener for key events. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| callback | Callback for key events. | - -**Required Permissions** - -ohos.permission.INPUT_MONITORING - -**Returns** - -**INTO_SUCCESS** if the operation is successful; **INPUT_PERMISSION_DENIED** if the permission verification fails; **INPUT_PARAMETER_ERROR** if the callback is empty or no listener is added; **INPUT_SERVICE_EXCEPTION** if the service is abnormal. - - -### OH_Input_RemoveMouseEventMonitor() - -``` -Input_Result OH_Input_RemoveMouseEventMonitor (Input_MouseEventCallback callback) -``` -**Description** - -Removes the listener for mouse events. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| callback | Callback for mouse events. | - -**Required Permissions** - -ohos.permission.INPUT_MONITORING - -**Returns** - -**INTO_SUCCESS** if the operation is successful; **INPUT_PERMISSION_DENIED** if the permission verification fails; **INPUT_PARAMETER_ERROR** if the callback is empty or no listener is added; **INPUT_SERVICE_EXCEPTION** if the service is abnormal. - - -### OH_Input_RemoveTouchEventMonitor() - -``` -Input_Result OH_Input_RemoveTouchEventMonitor (Input_TouchEventCallback callback) -``` -**Description** - -Removes the listener for touch events. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| callback | Callback for touch events. | - -**Required Permissions** - -ohos.permission.INPUT_MONITORING - -**Returns** - -**INTO_SUCCESS** if the operation is successful; **INPUT_PERMISSION_DENIED** if the permission verification fails; **INPUT_PARAMETER_ERROR** if the callback is empty or no listener is added; **INPUT_SERVICE_EXCEPTION** if the service is abnormal. - - -### OH_Input_SetAxisEventAction() - -``` -Input_Result OH_Input_SetAxisEventAction (Input_AxisEvent * axisEvent, InputEvent_AxisAction action ) -``` -**Description** - -Sets the action for an axis event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| axisEvent | Axis event object. | -| action | Action of the axis event. For details, see [InputEvent_AxisAction](#inputevent_axisaction). | - -**Returns** - -**INTO_SUCCESS** if operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** is NULL. - -### OH_Input_SetAxisEventActionTime() - -``` -Input_Result OH_Input_SetAxisEventActionTime (Input_AxisEvent * axisEvent, int64_t actionTime ) -``` -**Description** - -Sets the time when an axis event occurs. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| axisEvent | Axis event object. For details, see [Input_AxisEvent](#input_axisevent). | -| actionTime | Time when an event occurs. | - -**Returns** - -**INTO_SUCCESS** if operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** is NULL. - - -### OH_Input_SetAxisEventAxisValue() - -``` -Input_Result OH_Input_SetAxisEventAxisValue (Input_AxisEvent * axisEvent, InputEvent_AxisType axisType, double axisValue ) -``` -**Description** - -Sets the axis value of the axis type specified by the axis event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| axisEvent | Axis event object. For details, see [Input_AxisEvent](#input_axisevent). | -| axisType | Axis type. For details, see [InputEvent_AxisType](#inputevent_axistype). | -| axisValue | Axis event axis value. | - -**Returns** - -**INTO_SUCCESS** if operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** is NULL. - - -### OH_Input_SetAxisEventDisplayId() - -``` -Input_Result OH_Input_SetAxisEventDisplayId (Input_AxisEvent * axisEvent, int32_t displayId ) -``` -**Description** - -Sets the screen ID of an axis event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 15 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| axisEvent | Axis event object. | -| displayId | Screen ID of the axis event. | - -**Returns** - -**INTO_SUCCESS** if operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** is NULL. - - -### OH_Input_SetAxisEventDisplayX() - -``` -Input_Result OH_Input_SetAxisEventDisplayX (Input_AxisEvent * axisEvent, float displayX ) -``` -**Description** - -Sets the X coordinate for an axis event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| axisEvent | Axis event object. | -| displayX | X coordinate of the axis event. | - -**Returns** - -**INTO_SUCCESS** if operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** is NULL. - - -### OH_Input_SetAxisEventDisplayY() - -``` -Input_Result OH_Input_SetAxisEventDisplayY (Input_AxisEvent * axisEvent, float displayY ) -``` -**Description** - -Sets the Y coordinate for an axis event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| axisEvent | Axis event object. For details, see [Input_AxisEvent](#input_axisevent). | -| displayY | Y coordinate of the axis event. | - -**Returns** - -**INTO_SUCCESS** if operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** is NULL. - - -### OH_Input_SetAxisEventSourceType() - -``` -Input_Result OH_Input_SetAxisEventSourceType (Input_AxisEvent * axisEvent, InputEvent_SourceType sourceType ) -``` -**Description** - -Sets the axis event source type. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| axisEvent | Axis event object. | -| sourceType | Axis event source type. For details, see [InputEvent_SourceType](#inputevent_sourcetype). | - -**Returns** - -**INTO_SUCCESS** if operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** is NULL. - - -### OH_Input_SetAxisEventType() - -``` -Input_Result OH_Input_SetAxisEventType (Input_AxisEvent * axisEvent, InputEvent_AxisEventType axisEventType ) -``` -**Description** - -Sets the axis event type. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| axisEvent | Axis event object. For details, see [Input_AxisEvent](#input_axisevent). | -| axisEventType | Axis event type. For details, see [InputEvent_AxisEventType](#inputevent_axiseventtype). | - -**Returns** - -**INTO_SUCCESS** if operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** is NULL. - - -### OH_Input_SetAxisEventWindowId() - -``` -Input_Result OH_Input_SetAxisEventWindowId (Input_AxisEvent * axisEvent, int32_t windowId ) -``` -**Description** - -Sets the window ID of an axis event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 15 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| axisEvent | Axis event object. | -| windowId | Window ID of the axis event. | - -**Returns** - -**INTO_SUCCESS** if operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** is NULL. - - -### OH_Input_SetFinalKey() - -``` -void OH_Input_SetFinalKey (Input_Hotkey * hotkey, int32_t finalKey ) -``` -**Description** - -Sets the modified key. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 14 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| hotkey | Shortcut key object. | -| finalKey | Modifier key value. Only one modifier key value is allowed. | - - -### OH_Input_SetKeyCode() - -``` -void OH_Input_SetKeyCode (struct Input_KeyState * keyState, int32_t keyCode ) -``` -**Description** - -Sets the key value of a key status enum object. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| keyState | Key status enum object. For details, see [Input_KeyStateAction](#input_keystateaction).| -| keyCode | Key code. | - - -### OH_Input_SetKeyEventAction() - -``` -void OH_Input_SetKeyEventAction (struct Input_KeyEvent * keyEvent, int32_t action ) -``` -**Description** - -Sets the key event type. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| keyEvent | Key event object. | -| action | Key event type.| - - -### OH_Input_SetKeyEventActionTime() - -``` -void OH_Input_SetKeyEventActionTime (struct Input_KeyEvent * keyEvent, int64_t actionTime ) -``` -**Description** - -Sets the time when a key event occurs. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| keyEvent | Key event object.| -| actionTime | Time when a key event occurs. | - - -### OH_Input_SetKeyEventDisplayId() - -``` -void OH_Input_SetKeyEventDisplayId (struct Input_KeyEvent * keyEvent, int32_t displayId ) -``` -**Description** - -Sets the screen ID of a key event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 15 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| keyEvent | Key event object. | -| displayId | Screen ID of the key event. | - - -### OH_Input_SetKeyEventKeyCode() - -``` -void OH_Input_SetKeyEventKeyCode (struct Input_KeyEvent * keyEvent, int32_t keyCode ) -``` -**Description** - -Sets the key code value for a key event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| keyEvent | Key event object. | -| keyCode | Key value. | - - -### OH_Input_SetKeyEventWindowId() - -``` -void OH_Input_SetKeyEventWindowId (struct Input_KeyEvent * keyEvent, int32_t windowId ) -``` -**Description** - -Sets the window ID of a key event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 15 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| keyEvent | Key event object. | -| windowId | Window ID of the key event. | - - -### OH_Input_SetKeyPressed() - -``` -void OH_Input_SetKeyPressed (struct Input_KeyState * keyState, int32_t keyAction ) -``` -**Description** - -Sets whether the key specific to a key status enum object is pressed. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| keyState | Key status enum object. For details, see [Input_KeyStateAction](#input_keystateaction).| -| keyAction | Whether a key is pressed. For details, see [Input_KeyEventAction](#input_keyeventaction).| - - -### OH_Input_SetKeySwitch() - -``` -void OH_Input_SetKeySwitch (struct Input_KeyState * keyState, int32_t keySwitch ) -``` -**Description** - -Sets the key switch of the key status enum object. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| keyState | Key status enum object. For details, see [Input_KeyStateAction](#input_keystateaction).| -| keySwitch | Key switch. | - - -### OH_Input_SetMouseEventAction() - -``` -void OH_Input_SetMouseEventAction (struct Input_MouseEvent * mouseEvent, int32_t action ) -``` -**Description** - -Sets the action for a mouse event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| mouseEvent | Mouse event object. | -| action | Mouse action. | - - -### OH_Input_SetMouseEventActionTime() - -``` -void OH_Input_SetMouseEventActionTime (struct Input_MouseEvent * mouseEvent, int64_t actionTime ) -``` -**Description** - -Sets the time when a mouse event occurs. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| mouseEvent | Mouse event object. | -| actionTime | Time when a mouse event occurs. | - - -### OH_Input_SetMouseEventAxisType() - -``` -void OH_Input_SetMouseEventAxisType (struct Input_MouseEvent * mouseEvent, int32_t axisType ) -``` -**Description** - -Sets the axis type for a mouse event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| mouseEvent | Mouse event object.| -| axisType | Axis type, for example, X axis or Y axis. | - - -### OH_Input_SetMouseEventAxisValue() - -``` -void OH_Input_SetMouseEventAxisValue (struct Input_MouseEvent * mouseEvent, float axisValue ) -``` -**Description** - -Sets the axis value for a mouse axis event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| mouseEvent | Mouse event object. | -| axisValue | Axis value. A positive value means scrolling forward, and a negative number means scrolling backward. | - - -### OH_Input_SetMouseEventButton() - -``` -void OH_Input_SetMouseEventButton (struct Input_MouseEvent * mouseEvent, int32_t button ) -``` -**Description** - -Sets the button for a mouse event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| mouseEvent | Mouse event object. | -| button | Enumerates mouse buttons. | - - -### OH_Input_SetMouseEventDisplayId() - -``` -void OH_Input_SetMouseEventDisplayId (struct Input_MouseEvent * mouseEvent, int32_t displayId ) -``` -**Description** - -Sets the screen ID of a mouse event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 15 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| mouseEvent | Mouse event object. | -| displayId | Screen ID of the mouse event. | - - -### OH_Input_SetMouseEventDisplayX() - -``` -void OH_Input_SetMouseEventDisplayX (struct Input_MouseEvent * mouseEvent, int32_t displayX ) -``` -**Description** - -Sets the X coordinate for a mouse event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| mouseEvent | Mouse event object. | -| displayX | X coordinate on the screen. | - - -### OH_Input_SetMouseEventDisplayY() - -``` -void OH_Input_SetMouseEventDisplayY (struct Input_MouseEvent * mouseEvent, int32_t displayY ) -``` -**Description** - -Sets the Y coordinate for a mouse event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| mouseEvent | Mouse event object. | -| displayY | Y coordinate on the screen. | - - -### OH_Input_SetMouseEventWindowId() - -``` -void OH_Input_SetMouseEventWindowId (struct Input_MouseEvent * mouseEvent, int32_t windowId ) -``` -**Description** - -Sets the window ID of a mouse event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 15 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| mouseEvent | Mouse event object. | -| windowId | Window ID of the mouse event. | - - -### OH_Input_SetPreKeys() - -``` -void OH_Input_SetPreKeys (Input_Hotkey * hotkey, int32_t * preKeys, int32_t size ) -``` -**Description** - -Sets the modifier keys. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 14 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| hotkey | Shortcut key object. | -| preKeys | List of modifier keys. | -| size | Number of modifier keys. One or two modifier keys are supported. | - - -### OH_Input_SetRepeat() - -``` -void OH_Input_SetRepeat (Input_Hotkey * hotkey, bool isRepeat ) -``` -**Description** - -Specifies whether to report repeated key events. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 14 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| hotkey | Shortcut key object. | -| isRepeat | Whether to report repeated key events. The value **true** means to report repeated key events, and the value **false** means the opposite. | - - -### OH_Input_SetTouchEventAction() - -``` -void OH_Input_SetTouchEventAction (struct Input_TouchEvent * touchEvent, int32_t action ) -``` -**Description** - -Sets the action for a touch event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| touchEvent | Touch event object. | -| action| Action of the touch event.| - - -### OH_Input_SetTouchEventActionTime() - -``` -void OH_Input_SetTouchEventActionTime (struct Input_TouchEvent * touchEvent, int64_t actionTime ) -``` -**Description** - -Sets the time when a touch event occurs. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| keyEvent | Touch event object.| -| actionTime | Time when a touch event occurs. | - - -### OH_Input_SetTouchEventDisplayId() - -``` -void OH_Input_SetTouchEventDisplayId (struct Input_TouchEvent * touchEvent, int32_t displayId ) -``` -**Description** - -Sets the screen ID of a touchscreen event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 15 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| touchEvent | Touch event object. | -| displayId | Screen ID of the touchscreen event. | - - -### OH_Input_SetTouchEventDisplayX() - -``` -void OH_Input_SetTouchEventDisplayX (struct Input_TouchEvent * touchEvent, int32_t displayX ) -``` -**Description** - -Sets the X coordinate for a touch event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| touchEvent | Touch event object. | -| displayX| X coordinate on the touchscreen.| - - -### OH_Input_SetTouchEventDisplayY() - -``` -void OH_Input_SetTouchEventDisplayY (struct Input_TouchEvent * touchEvent, int32_t displayY ) -``` -**Description** - -Sets the Y coordinate for a touch event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| touchEvent | Touch event object. | -| displayY | Y coordinate on the touchscreen.| - - -### OH_Input_SetTouchEventFingerId() - -``` -void OH_Input_SetTouchEventFingerId (struct Input_TouchEvent * touchEvent, int32_t id ) -``` -**Description** - -Sets the finger ID for a touch event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| touchEvent | Touch event object.| -| id | Finger ID of a touch event.| - - -### OH_Input_SetTouchEventWindowId() - -``` -void OH_Input_SetTouchEventWindowId (struct Input_TouchEvent * touchEvent, int32_t windowId ) -``` -**Description** - -Sets the window ID of a touchscreen event. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 15 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| touchEvent | Touch event object. | -| windowId | Window ID of the touchscreen event. | - - -### OH_Input_UnregisterDeviceListener() - -``` -Input_Result OH_Input_UnregisterDeviceListener (Input_DeviceListener * listener) -``` -**Description** - -Unregisters the listener for device hot swap events. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 13 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| listener | Pointer to the [Input_DeviceListener](_input___device_listener.md) object. | - -**Returns** - -**OH_Input_UnregisterDeviceListener** status code, specifically: - -**INPUT_SUCCESS** if the operation is successful; - -**INPUT_PARAMETER_ERROR** if **listener** is **NULL** or the listener is not registered; - -**INPUT_SERVICE_EXCEPTION** if the service is abnormal. - - -### OH_Input_UnregisterDeviceListeners() - -``` -Input_Result OH_Input_UnregisterDeviceListeners () -``` -**Description** - -Unregisters the listener for all device hot swap events. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 13 - -**Returns** - -**OH_Input_UnregisterDeviceListener** status code, specifically: - -**INPUT_SUCCESS** if the operation is successful; **INPUT_SERVICE_EXCEPTION** if the service is abnormal. - -### OH_Input_GetFunctionKeyState() - -``` -Input_Result OH_Input_GetFunctionKeyState(int32_t keyCode, int32_t *state) -``` -**Description** - -Obtains the function key status. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Since**: 15 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| keyCode | Function key. Only the **CapsLock** key is supported. | -| state | Function key status. The value **0** indicates that the function key is disabled, and the value **1** indicates that the function key is enabled. | - -**Returns** - -**OH_Input_GetFunctionKeyState** status code, specifically: - - **INPUT_SUCCESS** if the operation is successful; - - **INPUT_PARAMETER_ERROR** if the parameter is incorrect; - - **INPUT_DEVICE_NOT_EXIST** if the keyboard does not exist. diff --git a/en/application-dev/reference/apis-input-kit/js-apis-cooperate-sys.md b/en/application-dev/reference/apis-input-kit/js-apis-cooperate-sys.md index 2c7bed7b43d..be3eddc501b 100644 --- a/en/application-dev/reference/apis-input-kit/js-apis-cooperate-sys.md +++ b/en/application-dev/reference/apis-input-kit/js-apis-cooperate-sys.md @@ -49,13 +49,13 @@ import { BusinessError } from '@kit.BasicServicesKit'; try { inputDeviceCooperate.enable(true, (error: BusinessError) => { if (error) { - console.log(`Keyboard mouse crossing enable failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Keyboard mouse crossing enable failed, error: ${JSON.stringify(error, [`code`, `message`])}`); return; } console.log(`Keyboard mouse crossing enable success.`); }); } catch (error) { - console.log(`Keyboard mouse crossing enable failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Keyboard mouse crossing enable failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -65,7 +65,6 @@ enable(enable: boolean): Promise<void> Specifies whether to enable screen hopping. This API uses a promise to return the result. - **System capability**: SystemCapability.MultimodalInput.Input.Cooperator **Parameters** @@ -98,10 +97,10 @@ try { inputDeviceCooperate.enable(true).then(() => { console.log(`Keyboard mouse crossing enable success.`); }, (error: BusinessError) => { - console.log(`Keyboard mouse crossing enable failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Keyboard mouse crossing enable failed, error: ${JSON.stringify(error, [`code`, `message`])}`); }); } catch (error) { - console.log(`Keyboard mouse crossing enable failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Keyboard mouse crossing enable failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -123,7 +122,7 @@ Starts screen hopping. This API uses an asynchronous callback to return the resu **Error codes** -For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Screen Hopping Error Codes](errorcode-multimodalinput.md). +For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Screen Hopping Error Codes](errorcode-cooperator.md). | ID| Error Message| | -------- | ---------------------------------------- | @@ -142,13 +141,13 @@ let srcInputDeviceId = 0; try { inputDeviceCooperate.start(sinkDeviceDescriptor, srcInputDeviceId, (error: BusinessError) => { if (error) { - console.log(`Start Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Start Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`); return; } console.log(`Start Keyboard mouse crossing success.`); }); } catch (error) { - console.log(`Start Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Start Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -177,7 +176,7 @@ Starts screen hopping. This API uses a promise to return the result. **Error codes** -For details about the error codes, see [Screen Hopping Error Codes](errorcode-multimodalinput.md). +For details about the error codes, see [Screen Hopping Error Codes](errorcode-cooperator.md). | ID| Error Message| | -------- | ---------------------------------------- | @@ -197,10 +196,10 @@ try { inputDeviceCooperate.start(sinkDeviceDescriptor, srcInputDeviceId).then(() => { console.log(`Start Keyboard mouse crossing success.`); }, (error: BusinessError) => { - console.log(`Start Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Start Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`); }); } catch (error) { - console.log(`Start Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Start Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -235,13 +234,13 @@ import { BusinessError } from '@kit.BasicServicesKit'; try { inputDeviceCooperate.stop((error: BusinessError) => { if (error) { - console.log(`Stop Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Stop Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`); return; } console.log(`Stop Keyboard mouse crossing success.`); }); } catch (error) { - console.log(`Stop Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Stop Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -269,10 +268,10 @@ try { inputDeviceCooperate.stop().then(() => { console.log(`Stop Keyboard mouse crossing success.`); }, (error: BusinessError) => { - console.log(`Stop Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Stop Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`); }); } catch (error) { - console.log(`Stop Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Stop Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -310,13 +309,13 @@ let deviceDescriptor = "descriptor"; try { inputDeviceCooperate.getState(deviceDescriptor, (error: BusinessError, data: object) => { if (error) { - console.log(`Get the status failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Get the status failed, error: ${JSON.stringify(error, [`code`, `message`])}`); return; } console.log(`Get the status success, data: ${JSON.stringify(data)}`); }); } catch (error) { - console.log(`Get the status failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Get the status failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -338,7 +337,7 @@ Checks whether screen hopping is enabled. This API uses a promise to return the | Parameters | Description | | ------------------- | ------------------------------- | -| Promise<{ state: boolean }>| Promise used to return the result. | +| Promise<{ state: boolean }>| Promise used to return the result. The value **true** indicates that screen hopping is enabled, and the **false** indicates the opposite. | **Error codes** @@ -360,10 +359,10 @@ try { inputDeviceCooperate.getState(deviceDescriptor).then((data: object) => { console.log(`Get the status success, data: ${JSON.stringify(data)}`); }, (error: BusinessError) => { - console.log(`Get the status failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Get the status failed, error: ${JSON.stringify(error, [`code`, `message`])}`); }); } catch (error) { - console.log(`Get the status failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Get the status failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -396,14 +395,14 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ ```ts import { inputDeviceCooperate } from '@kit.InputKit'; -function callback(msg: object) { +let callback = (msg: object) => { console.log(`Keyboard mouse crossing event: ${JSON.stringify(msg)}`); return false; } try { inputDeviceCooperate.on('cooperation', callback); } catch (error) { - console.log(`Register failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Register failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -437,11 +436,11 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ import { inputDeviceCooperate } from '@kit.InputKit'; // Unregister a single callback. -function callbackOn(msg: object) { +let callbackOn = (msg: object) => { console.log(`Keyboard mouse crossing event: ${JSON.stringify(msg)}`); return false; } -function callbackOff() { +let callbackOff = () => { console.log(`Keyboard mouse crossing event`); return false; } @@ -449,14 +448,14 @@ try { inputDeviceCooperate.on('cooperation', callbackOn); inputDeviceCooperate.off("cooperation", callbackOff); } catch (error) { - console.log(`Execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` ```ts import { inputDeviceCooperate } from '@kit.InputKit'; // Unregister all callbacks. -function callback(msg: object) { +let callback = (msg: object) => { console.log(`Keyboard mouse crossing event: ${JSON.stringify(msg)}`); return false; } @@ -464,7 +463,7 @@ try { inputDeviceCooperate.on('cooperation', callback); inputDeviceCooperate.off("cooperation"); } catch (error) { - console.log(`Execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` diff --git a/en/application-dev/reference/apis-input-kit/js-apis-infraredemitter.md b/en/application-dev/reference/apis-input-kit/js-apis-infraredemitter.md index 3bc2ec15bc5..3072cad4fef 100644 --- a/en/application-dev/reference/apis-input-kit/js-apis-infraredemitter.md +++ b/en/application-dev/reference/apis-input-kit/js-apis-infraredemitter.md @@ -45,7 +45,7 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ try { infraredEmitter.transmitInfrared(38000, [100, 200, 300, 400]); } catch (error) { - console.log(`transmitInfrared failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`transmitInfrared failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -80,7 +80,7 @@ try { let frequencies = infraredEmitter.getInfraredFrequencies(); console.log(`frequencies: ${JSON.stringify(frequencies)}`); } catch (error) { - console.log(`Get infrared frequencies failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Get infrared frequencies failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` diff --git a/en/application-dev/reference/apis-input-kit/js-apis-inputconsumer.md b/en/application-dev/reference/apis-input-kit/js-apis-inputconsumer.md index e6857b101b3..9db800ef736 100644 --- a/en/application-dev/reference/apis-input-kit/js-apis-inputconsumer.md +++ b/en/application-dev/reference/apis-input-kit/js-apis-inputconsumer.md @@ -1,20 +1,22 @@ -# @ohos.multimodalInput.inputConsumer (Input Consumer) +# @ohos.multimodalInput.inputConsumer (Global Shortcut Keys) -The **inputConsumer** module implements listening for combination key events. +The **inputConsumer** module provides APIs for subscribing to and unsubscribing from global shortcut keys. > **NOTE** > > - The initial APIs of this module are supported since API version 14. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> +> - Global shortcut keys are combination keys defined by the system or application. System shortcut keys are defined by the system, and application shortcut keys are defined by applications. ## Modules to Import ```js -import { inputConsumer } from '@kit.InputKit'; +import { inputConsumer, KeyEvent } from '@kit.InputKit'; ``` -## HotkeyOptions14+ +## HotkeyOptions Defines shortcut key options. @@ -23,7 +25,7 @@ Defines shortcut key options. | Name | Type | Readable | Writable | Description | | --------- | ------ | ------- | ------- | ------- | | preKeys | Array<number> | Yes | No | Modifier key set (including Ctrl, Shift, and Alt). A maximum of two modifier keys are supported. There is no requirement on the sequence of modifier keys.
For example, in **Ctrl+Shift+Esc**, **Ctrl** and **Shift** are modifier keys.| -| finalKey | number | Yes | No | Modified key, which is the key other than the modifier key and meta key.
For example, in **Ctrl+Shift+Esc**, **Esc** is the modified key.| +| finalKey | number | Yes | No | Modified key, which can be any key except the modifier keys and Meta key. For details about the keys, see [Keycode](js-apis-keycode.md).
For example, in **Ctrl+Shift+Esc**, **Esc** is the modified key.| | isRepeat | boolean | Yes | No | Whether to report repeated key events. The value **true** means to report repeated key events, and the value **false** means the opposite. The default value is **true**.| ## KeyPressedConfig16+ @@ -34,11 +36,11 @@ Sets the key event consumption configuration. | Name | Type | Readable | Writable | Description | | --------- | ------ | ------- | ------- | ------- | -| key | number | Yes | No | Key value.
Currently, only the [KEYCODE_VOLUME_UP](js-apis-keycode.md#keycode) and [KEYCODE_VOLUME_DOWN](js-apis-keycode.md#keycode) keys are supported.| -| action | number | Yes | No | Key event type. Currently, the value can only be **1**.
- **1**: Key press.
- **2**: Key release.| -| isRepeat | boolean | Yes | No | Whether to report repeated key events.| +| key | number | Yes | No | Key value.
Currently, only the [KEYCODE_VOLUME_UP](js-apis-keycode.md#keycode) and [KEYCODE_VOLUME_DOWN](js-apis-keycode.md#keycode) keys are supported.| +| action | number | Yes | No | Key event type. Currently, this parameter can only be set to **1**, indicating key press.| +| isRepeat | boolean | Yes | No | Whether to report repeated key events. The value **true** means to report repeated key events, and the value **false** means the opposite. The default value is **true**.| -## inputConsumer.getAllSystemHotkeys14+ +## inputConsumer.getAllSystemHotkeys getAllSystemHotkeys(): Promise<Array<HotkeyOptions>> @@ -48,7 +50,7 @@ Obtains all system shortcut keys. This API uses a promise to return the result. **Return value** -| Parameter | Description | +| Type | Description | | ---------- | ---------------------------------------- | | Promise<Array<HotkeyOptions>> | Promise used to return the list of all system shortcut keys.| @@ -68,11 +70,11 @@ inputConsumer.getAllSystemHotkeys().then((data: Array14+ +## inputConsumer.on('hotkeyChange') on(type: 'hotkeyChange', hotkeyOptions: HotkeyOptions, callback: Callback<HotkeyOptions>): void -Enables listening for global combination key events. This API uses an asynchronous callback to return the combination key data when a combination key event that meets the specified condition occurs. +Subscribes to application shortcut key change events based on the specified options. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.MultimodalInput.Input.InputConsumer @@ -81,12 +83,12 @@ Enables listening for global combination key events. This API uses an asynchrono | Name | Type | Mandatory | Description | | ---------- | -------------------------- | ---- | ---------- | | type | string | Yes | Event type. This parameter has a fixed value of **hotkeyChange**. | -| hotkeyOptions | [HotkeyOptions](#hotkeyoptions14) | Yes | Shortcut key options. | -| callback | Callback<HotkeyOptions> | Yes | Callback used to return the combination key data when a global combination key event that meets the specified condition occurs.| +| hotkeyOptions | [HotkeyOptions](#hotkeyoptions) | Yes | Shortcut key options. | +| callback | Callback<HotkeyOptions> | Yes | Callback used to return the application shortcut key change event.| **Error codes**: -For details about the error codes, see [Input Consumer Error Codes](errorcode-inputconsumer.md) and [Universal Error Codes](../errorcode-universal.md). +For details about the error codes, see [Global Shortcut Key Error Codes](errorcode-inputconsumer.md) and [Universal Error Codes](../errorcode-universal.md). | Error Code | Error Message | | ---- | --------------------- | @@ -111,15 +113,15 @@ let hotkeyCallback = (hotkeyOptions: inputConsumer.HotkeyOptions) => { try { inputConsumer.on("hotkeyChange", hotkeyOptions, hotkeyCallback); } catch (error) { - console.log(`Subscribe failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Subscribe failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` -## inputConsumer.off('hotkeyOptions')14+ +## inputConsumer.off('hotkeyChange') off(type: 'hotkeyChange', hotkeyOptions: HotkeyOptions, callback?: Callback<HotkeyOptions>): void -Disables listening for global combination key events. +Unsubscribes from application shortcut key change events. **System capability**: SystemCapability.MultimodalInput.Input.InputConsumer @@ -128,8 +130,8 @@ Disables listening for global combination key events. | Name | Type | Mandatory | Description | | ---------- | -------------------------- | ---- | ---------- | | type | string | Yes | Event type. This parameter has a fixed value of **hotkeyChange**. | -| hotkeyOptions | [HotkeyOptions](#hotkeyoptions14) | Yes | Shortcut key options. | -| callback | Callback<HotkeyOptions> | No | Callback to unregister. If this parameter is not specified, listening will be disabled for all callbacks registered by the current application.| +| hotkeyOptions | [HotkeyOptions](#hotkeyoptions) | Yes | Shortcut key options. | +| callback | Callback<HotkeyOptions> | No | Callback to unregister. If this parameter is left unspecified, listening will be disabled for all callbacks registered for the specified shortcut key options.| **Error codes**: @@ -155,7 +157,7 @@ try { inputConsumer.off("hotkeyChange", hotkeyOption, hotkeyCallback); console.log(`Unsubscribe success`); } catch (error) { - console.log(`Execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -172,7 +174,7 @@ try { inputConsumer.off("hotkeyChange", hotkeyOption); console.log(`Unsubscribe success`); } catch (error) { - console.log(`Execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -180,7 +182,7 @@ try { on(type: 'keyPressed', options: KeyPressedConfig, callback: Callback<KeyEvent>): void -Subscribes to key press events. If the current application is in the foreground focus window, a callback is triggered when the specified key is pressed. +Subscribes to key press events. This API uses an asynchronous callback to return the result. If the current application is in the foreground focus window, a callback is triggered when the specified key is pressed. **System capability**: SystemCapability.MultimodalInput.Input.InputConsumer @@ -190,7 +192,7 @@ Subscribes to key press events. If the current application is in the foreground | ---------- | -------------------------- | ---- | ---------- | | type | string | Yes | Event type. This parameter has a fixed value of **keyPressed**. | | options | [KeyPressedConfig](#keypressedconfig16)| Yes | Sets the key event consumption configuration. | -| callback | Callback<[KeyEvent](./js-apis-keyevent.md#keyevent)> | Yes | Callback used to return the key event.| +| callback | Callback<[KeyEvent](./js-apis-keyevent.md#keyevent)> | Yes | Callback used to return key press events.| **Error codes**: @@ -214,7 +216,7 @@ try { console.log(`Subscribe success ${JSON.stringify(event)}`); }); } catch (error) { - console.log(`Subscribe execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Subscribe execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -222,7 +224,7 @@ try { off(type: 'keyPressed', callback?: Callback<KeyEvent>): void -Unsubscribes from key press events. +Unsubscribes from key press events. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.MultimodalInput.Input.InputConsumer @@ -231,7 +233,7 @@ Unsubscribes from key press events. | Name | Type | Mandatory | Description | | ---------- | -------------------------- | ---- | ---------- | | type | string | Yes | Event type. This parameter has a fixed value of **keyPressed**. | -| callback | Callback<[KeyEvent](./js-apis-keyevent.md#keyevent)> | No | Callback to unregister. If this parameter is not specified, listening will be disabled for all callbacks registered by the current application.| +| callback | Callback<[KeyEvent](./js-apis-keyevent.md#keyevent)> | No | Callback to unregister. If this parameter is not specified, listening will be disabled for all registered callbacks.| **Error codes**: @@ -253,6 +255,6 @@ try { // Disable listening for all callbacks. inputConsumer.off("keyPressed"); } catch (error) { - console.log(`Unsubscribe execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Unsubscribe execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` diff --git a/en/application-dev/reference/apis-input-kit/js-apis-inputdevice-sys.md b/en/application-dev/reference/apis-input-kit/js-apis-inputdevice-sys.md index 74bf00a056a..fe09f6db5f3 100644 --- a/en/application-dev/reference/apis-input-kit/js-apis-inputdevice-sys.md +++ b/en/application-dev/reference/apis-input-kit/js-apis-inputdevice-sys.md @@ -1,7 +1,7 @@ # @ohos.multimodalInput.inputDevice (Input Device) (System API) -The **inputDevice** module allows you to listen for hot swap events of input devices and query information about input devices. +The **inputDevice** module implements input device management functions such as querying input device information. > **NOTE** @@ -40,6 +40,7 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ | ID | Error Message | | ---- | --------------------- | +| 202 | SystemAPI permission error. | | 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | **Example** @@ -48,13 +49,13 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ try { inputDevice.setKeyboardRepeatDelay(350, (error: Error) => { if (error) { - console.log(`Set keyboard repeat delay failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Set keyboard repeat delay failed, error: ${JSON.stringify(error, [`code`, `message`])}`); return; } console.log(`Set keyboard repeat delay success`); }); } catch (error) { - console.log(`Set keyboard repeat delay failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Set keyboard repeat delay failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -76,9 +77,9 @@ Sets the keyboard repeat delay. This API uses a promise to return the result. **Return value** -| Parameters | Description | +| Type | Description | | ------------------- | ---------------- | -| Promise<void> | Promise used to return the result.| +| Promise<void> | A promise that returns no value.| **Error codes** @@ -86,6 +87,7 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ | ID | Error Message | | ---- | --------------------- | +| 202 | SystemAPI permission error. | | 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | **Example** @@ -96,7 +98,7 @@ try { console.log(`Set keyboard repeat delay success`); }); } catch (error) { - console.log(`Set keyboard repeat delay failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Set keyboard repeat delay failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -114,7 +116,7 @@ Obtains the keyboard repeat delay. This API uses an asynchronous callback to ret | Name | Type | Mandatory| Description | | -------- | ------ | ---- | ------------------------------------------------------------ | -| callback | AsyncCallback<number> | Yes | Callback used to return the result.| +| callback | AsyncCallback<number> | Yes | Callback used to return the keyboard repeat delay.| **Error codes** @@ -122,7 +124,7 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ | ID | Error Message | | ---- | --------------------- | -| 202 | SystemAPI permission error | +| 202 | SystemAPI permission error. | | 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | **Example** @@ -131,13 +133,13 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ try { inputDevice.getKeyboardRepeatDelay((error: Error, delay: Number) => { if (error) { - console.log(`Get keyboard repeat delay failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Get keyboard repeat delay failed, error: ${JSON.stringify(error, [`code`, `message`])}`); return; } console.log(`Get keyboard repeat delay success`); }); } catch (error) { - console.log(`Get keyboard repeat delay failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Get keyboard repeat delay failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -153,9 +155,9 @@ Obtains the keyboard repeat delay. This API uses a promise to return the result. **Return value** -| Parameters | Description | +| Type | Description | | --------------------- | ------------------- | -| Promise<number> | Promise used to return the result.| +| Promise<number> | Promise used to return the keyboard repeat delay.| **Error codes** @@ -163,7 +165,7 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ | ID | Error Message | | ---- | --------------------- | -| 202 | SystemAPI permission error | +| 202 | SystemAPI permission error. | | 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | **Example** @@ -174,7 +176,7 @@ try { console.log(`Get keyboard repeat delay success`); }); } catch (error) { - console.log(`Get keyboard repeat delay failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Get keyboard repeat delay failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -201,7 +203,7 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ | ID | Error Message | | ---- | --------------------- | -| 202 | SystemAPI permission error | +| 202 | SystemAPI permission error. | | 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | **Example** @@ -210,13 +212,13 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ try { inputDevice.setKeyboardRepeatRate(60, (error: Error) => { if (error) { - console.log(`Set keyboard repeat rate failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Set keyboard repeat rate failed, error: ${JSON.stringify(error, [`code`, `message`])}`); return; } console.log(`Set keyboard repeat rate success`); }); } catch (error) { - console.log(`Set keyboard repeat rate failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Set keyboard repeat rate failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -238,9 +240,9 @@ Sets the keyboard repeat rate. This API uses a promise to return the result. **Return value** -| Parameters | Description | +| Type | Description | | ------------------- | ---------------- | -| Promise<void> | Promise used to return the result.| +| Promise<void> | A promise that returns no value.| **Error codes** @@ -248,7 +250,7 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ | ID | Error Message | | ---- | --------------------- | -| 202 | SystemAPI permission error | +| 202 | SystemAPI permission error. | | 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | **Example** @@ -259,7 +261,7 @@ try { console.log(`Set keyboard repeat rate success`); }); } catch (error) { - console.log(`Set keyboard repeat rate failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Set keyboard repeat rate failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -277,7 +279,7 @@ Obtains the keyboard repeat rate. This API uses an asynchronous callback to retu | Name | Type | Mandatory | Description | | -------- | --------------------------- | ---- | -------------- | -| callback | AsyncCallback<number> | Yes | Callback used to return the result.| +| callback | AsyncCallback<number> | Yes | Callback used to return the keyboard repeat rate.| **Error codes** @@ -285,7 +287,7 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ | ID | Error Message | | ---- | --------------------- | -| 202 | SystemAPI permission error | +| 202 | SystemAPI permission error. | | 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | **Example** @@ -294,13 +296,13 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ try { inputDevice.getKeyboardRepeatRate((error: Error, rate: Number) => { if (error) { - console.log(`Get keyboard repeat rate failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Get keyboard repeat rate failed, error: ${JSON.stringify(error, [`code`, `message`])}`); return; } console.log(`Get keyboard repeat rate success`); }); } catch (error) { - console.log(`Get keyboard repeat rate failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Get keyboard repeat rate failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -316,9 +318,9 @@ Obtains the keyboard repeat rate. This API uses a promise to return the result. **Return value** -| Parameters | Description | +| Type | Description | | --------------------- | ------------------- | -| Promise<number> | Promise used to return the result.| +| Promise<number> | Promise used to return the keyboard repeat rate.| **Error codes** @@ -326,7 +328,7 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ | ID | Error Message | | ---- | --------------------- | -| 202 | SystemAPI permission error | +| 202 | SystemAPI permission error. | | 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | **Example** @@ -337,7 +339,7 @@ try { console.log(`Get keyboard repeat rate success`); }); } catch (error) { - console.log(`Get keyboard repeat rate failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Get keyboard repeat rate failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -358,7 +360,7 @@ Sets the input switch status of an input device. Take the touchscreen as an exam | Name | Type | Mandatory| Description | | -------- | ------- | ---- | ------------------------- | | deviceId | number | Yes | Device ID. | -| enabled | boolean | Yes | Whether to enable input switch of the input device. The value true indicates that the input switch is enabled, and the value **false** indicates the opposite.| +| enabled | boolean | Yes | Switch status of the input device. The value **true** indicates that the input device is enabled, and the value **false** indicates the opposite.| **Error codes** @@ -380,6 +382,6 @@ try { console.info(`Set input device enable success`); }); } catch (error) { - console.info(`Set input device enable error`); + console.error(`Set input device enable error`); } ``` diff --git a/en/application-dev/reference/apis-input-kit/js-apis-inputdevice.md b/en/application-dev/reference/apis-input-kit/js-apis-inputdevice.md index 55f756d5253..b20aa820016 100644 --- a/en/application-dev/reference/apis-input-kit/js-apis-inputdevice.md +++ b/en/application-dev/reference/apis-input-kit/js-apis-inputdevice.md @@ -1,7 +1,7 @@ # @ohos.multimodalInput.inputDevice (Input Device) -The **inputDevice** module allows you to listen for hot swap events of input devices and query information about input devices. +The inputDevice module implements input device management functions such as listening for the connection and disconnection of input devices and querying input device information such as the device name. > **NOTE** @@ -28,7 +28,7 @@ Obtains the IDs of all input devices. This API uses an asynchronous callback to | Name | Type | Mandatory| Description | | -------- | ---------------------------------------- | ---- | ---------------------------------------- | -| callback | AsyncCallback<Array<number>> | Yes | Callback used to return the result.| +| callback | AsyncCallback<Array<number>> | Yes | Callback used to return the IDs of all input devices. **id** is the unique ID of an input device.| **Error codes** @@ -44,13 +44,13 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ try { inputDevice.getDeviceList((error: Error, ids: Array) => { if (error) { - console.log(`Failed to get device id list, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Failed to get device id list, error: ${JSON.stringify(error, [`code`, `message`])}`); return; } console.log(`Device id list: ${JSON.stringify(ids)}`); }); } catch (error) { - console.log(`Failed to get device id list, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Failed to get device id list, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -64,9 +64,9 @@ Obtains the IDs of all input devices. This API uses a promise to return the resu **Return value** -| Parameters | Description | +| Type | Description | | ---------------------------------- | ------------------------------------------- | -| Promise<Array<number>> | Promise used to return the result.| +| Promise<Array<number>> | Promise used to return the IDs of all input devices.| **Example** @@ -76,7 +76,7 @@ try { console.log(`Device id list: ${JSON.stringify(ids)}`); }); } catch (error) { - console.log(`Failed to get device id list, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Failed to get device id list, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -84,7 +84,7 @@ try { getDeviceInfo(deviceId: number, callback: AsyncCallback<InputDeviceData>): void -Obtains information about an input device. This API uses an asynchronous callback to return the result. +Obtains information about the specified input device. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.MultimodalInput.Input.InputDevice @@ -93,7 +93,7 @@ Obtains information about an input device. This API uses an asynchronous callbac | Name | Type | Mandatory| Description | | -------- | -------------------------------------------------------- | ---- | --------------------------------------- | | deviceId | number | Yes | ID of the input device. | -| callback | AsyncCallback<[InputDeviceData](#inputdevicedata)> | Yes | Callback used to return the result, which is an **InputDeviceData** object.| +| callback | AsyncCallback<[InputDeviceData](#inputdevicedata)> | Yes | Callback used to return information about the input device, including device ID, name, supported source, physical address, version information, and product information.| **Error codes** @@ -110,13 +110,13 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ try { inputDevice.getDeviceInfo(1, (error: Error, deviceData: inputDevice.InputDeviceData) => { if (error) { - console.log(`Failed to get device info, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Failed to get device info, error: ${JSON.stringify(error, [`code`, `message`])}`); return; } console.log(`Device info: ${JSON.stringify(deviceData)}`); }); } catch (error) { - console.log(`Failed to get device info, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Failed to get device info, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -124,7 +124,7 @@ try { getDeviceInfo(deviceId: number): Promise<InputDeviceData> -Obtains information about an input device. This API uses a promise to return the result. +Obtains the information about the input device with the specified ID. This API uses a promise to return the result. **System capability**: SystemCapability.MultimodalInput.Input.InputDevice @@ -136,9 +136,9 @@ Obtains information about an input device. This API uses a promise to return the **Return value** -| Parameters | Description | +| Type | Description | | -------------------------------------------------- | ------------------------------- | -| Promise<[InputDeviceData](#inputdevicedata)> | Promise used to return the result.| +| Promise<[InputDeviceData](#inputdevicedata)> | Promise used to return the information about the input device.| **Error codes** @@ -157,7 +157,7 @@ try { console.log(`Device info: ${JSON.stringify(deviceData)}`); }); } catch (error) { - console.log(`Failed to get device info, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Failed to get device info, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -177,9 +177,9 @@ Obtains information about the specified input device. **Return value** -| Parameters | Description | +| Type | Description | | -------------------------------------------------- | ------------------------------- | -| [InputDeviceData](#inputdevicedata) | Information about the input device.| +| [InputDeviceData](#inputdevicedata) | Information about the input device, including device ID, name, supported source, physical address, version information, and product information.| **Error codes** @@ -194,10 +194,10 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ ```js // Obtain the name of the device whose ID is 1. try { - let deviceData: inputDevice.InputDeviceData = inputDevice.getDeviceInfoSync(1) - console.log(`Device info: ${JSON.stringify(deviceData)}`) + let deviceData: inputDevice.InputDeviceData = inputDevice.getDeviceInfoSync(1); + console.log(`Device info: ${JSON.stringify(deviceData)}`); } catch (error) { - console.log(`Failed to get device info, error: ${JSON.stringify(error, [`code`, `message`])}`) + console.error(`Failed to get device info, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -205,7 +205,7 @@ try { on(type: "change", listener: Callback<DeviceListener>): void -Enables listening for device hot swap events. When performing this operation, you need to connect your device to an external device, for example, mouse or keyboard. +Enables listening for device hot swap events. When performing this operation, you need to connect to external devices such as a mouse, keyboard, and touchscreen. **System capability**: SystemCapability.MultimodalInput.Input.InputDevice @@ -213,7 +213,7 @@ Enables listening for device hot swap events. When performing this operation, yo | Name | Type | Mandatory | Description | | -------- | ---------------------------------------- | ---- | ----------- | -| type | string | Yes | Event type of the input device, such as the mouse, keyboard, or touchscreen. | +| type | string | Yes | Event type. This field has a fixed value of **change**. | | listener | Callback<[DeviceListener](#devicelistener9)> | Yes | Listener for events of the input device.| **Error codes** @@ -244,7 +244,7 @@ try { }); // Check whether the soft keyboard is open based on the value of isPhysicalKeyboardExist. } catch (error) { - console.log(`Get device info failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Get device info failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -260,8 +260,8 @@ Disables listening for device hot swap events. This API is called before the app | Name | Type | Mandatory | Description | | -------- | ---------------------------------------- | ---- | ----------- | -| type | string | Yes | Event type of the input device, such as the mouse, keyboard, or touchscreen. | -| listener | Callback<[DeviceListener](#devicelistener9)> | No | Listener for events of the input device.| +| type | string | Yes | Event type. This field has a fixed value of **change**. | +| listener | Callback<[DeviceListener](#devicelistener9)> | No | Callback to unregister. If this parameter is left unspecified, listening for hot swap events of all input devices will be canceled.| **Error codes** @@ -274,28 +274,28 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -function callback(data: inputDevice.DeviceListener) { +let callback = (data: inputDevice.DeviceListener) => { console.log(`Report device event info: ${JSON.stringify(data, [`type`, `deviceId`])}`); }; try { inputDevice.on("change", callback); } catch (error) { - console.log(`Listen device event failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Listen device event failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } // Disable this listener. try { inputDevice.off("change", callback); } catch (error) { - console.log(`Cancel listening device event failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Cancel listening device event failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } // Disable all listeners. try { inputDevice.off("change"); } catch (error) { - console.log(`Cancel all listening device event failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Cancel all listening device event failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -313,14 +313,14 @@ Obtains the IDs of all input devices. This API uses an asynchronous callback to | Name | Type | Mandatory| Description | | -------- | ---------------------------------------- | ---- | ---------------------------------------- | -| callback | AsyncCallback<Array<number>> | Yes | Callback used to return the result.| +| callback | AsyncCallback<Array<number>> | Yes | Callback used to return the IDs of all input devices.| **Example** ```js inputDevice.getDeviceIds((error: Error, ids: Array) => { if (error) { - console.log(`Failed to get device id list, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Failed to get device id list, error: ${JSON.stringify(error, [`code`, `message`])}`); return; } console.log(`Device id list: ${JSON.stringify(ids)}`); @@ -339,9 +339,9 @@ Obtains the IDs of all input devices. This API uses a promise to return the resu **Return value** -| Parameters | Description | +| Type | Description | | ---------------------------------- | ------------------------------------------- | -| Promise<Array<number>> | Promise used to return the result.| +| Promise<Array<number>> | Promise used to return the IDs of all input devices.| **Example** @@ -355,7 +355,7 @@ inputDevice.getDeviceIds().then((ids: Array) => { getDevice(deviceId: number, callback: AsyncCallback<InputDeviceData>): void -Obtains information about an input device. This API uses an asynchronous callback to return the result. +Obtains the information about the input device with the specified ID. This API uses an asynchronous callback to return the result. > This API is deprecated since API version 9. You are advised to use [inputDevice.getDeviceInfo](#inputdevicegetdeviceinfo9) instead. @@ -366,7 +366,7 @@ Obtains information about an input device. This API uses an asynchronous callbac | Name | Type | Mandatory| Description | | -------- | -------------------------------------------------------- | ---- | -------------------------------- | | deviceId | number | Yes | ID of the input device. | -| callback | AsyncCallback<[InputDeviceData](#inputdevicedata)> | Yes | Callback used to return the result, which is an **InputDeviceData** object.| +| callback | AsyncCallback<[InputDeviceData](#inputdevicedata)> | Yes | Callback used to return the information about the input device.| **Example** @@ -374,7 +374,7 @@ Obtains information about an input device. This API uses an asynchronous callbac // Obtain the name of the device whose ID is 1. inputDevice.getDevice(1, (error: Error, deviceData: inputDevice.InputDeviceData) => { if (error) { - console.log(`Failed to get device info, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Failed to get device info, error: ${JSON.stringify(error, [`code`, `message`])}`); return; } console.log(`Device info: ${JSON.stringify(deviceData)}`); @@ -385,7 +385,7 @@ inputDevice.getDevice(1, (error: Error, deviceData: inputDevice.InputDeviceData) getDevice(deviceId: number): Promise<InputDeviceData> -Obtains information about an input device. This API uses a promise to return the result. +Obtains the information about the input device with the specified ID. This API uses a promise to return the result. > This API is deprecated since API version 9. You are advised to use [inputDevice.getDeviceInfo](#inputdevicegetdeviceinfo9) instead. @@ -399,9 +399,9 @@ Obtains information about an input device. This API uses a promise to return the **Return value** -| Parameters | Description | +| Type | Description | | -------------------------------------------------- | ----------------------------------- | -| Promise<[InputDeviceData](#inputdevicedata)> | Promise used to return the result.| +| Promise<[InputDeviceData](#inputdevicedata)> | Promise used to return the information about the input device.| **Example** @@ -416,7 +416,7 @@ inputDevice.getDevice(1).then((deviceData: inputDevice.InputDeviceData) => { supportKeys(deviceId: number, keys: Array<KeyCode>, callback: AsyncCallback <Array<boolean>>): void -Obtains the keycodes supported by the input device. This API uses an asynchronous callback to return the result. +Checks whether the input device supports the specified keys. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.MultimodalInput.Input.InputDevice @@ -424,7 +424,7 @@ Obtains the keycodes supported by the input device. This API uses an asynchronou | Name | Type | Mandatory| Description | | -------- | ----------------------------------------- | ---- | ------------------------------------------------------ | -| deviceId | number | Yes | Unique ID of the input device. If the same physical device is repeatedly inserted and removed, its ID changes.| +| deviceId | number | Yes | ID of the input device. The device ID changes if the same physical device is repeatedly removed and inserted.| | keys | Array[<KeyCode>](js-apis-keycode.md#keycode) | Yes | Keycodes to be queried. A maximum of five keycodes can be specified. | | callback | AsyncCallback<Array<boolean>> | Yes | Callback used to return the result. | @@ -445,7 +445,7 @@ try { console.log(`Query result: ${JSON.stringify(supportResult)}`); }); } catch (error) { - console.log(`Query failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Query failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -453,7 +453,7 @@ try { supportKeys(deviceId: number, keys: Array<KeyCode>): Promise<Array<boolean>> -Obtains the keycodes supported by the input device. This API uses a promise to return the result. +Checks whether the input device supports the specified keys. This API uses a promise to return the result. **System capability**: SystemCapability.MultimodalInput.Input.InputDevice @@ -461,14 +461,14 @@ Obtains the keycodes supported by the input device. This API uses a promise to r | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | ------------------------------------------------------ | -| deviceId | number | Yes | Unique ID of the input device. If the same physical device is repeatedly inserted and removed, its ID changes.| +| deviceId | number | Yes | ID of the input device. The device ID changes if the same physical device is repeatedly removed and inserted.| | keys | Array[<KeyCode>](js-apis-keycode.md#keycode) | Yes | Keycodes to be queried. A maximum of five keycodes can be specified. | **Return value** -| Parameters | Description | +| Type | Description | | ----------------------------------- | ------------------------------- | -| Promise<Array<boolean>> | Promise used to return the result.| +| Promise<Array<boolean>> | Promise used to return the result. The value **true** indicates that the keycodes are supported, and the value **false** indicates the opposite.| **Error codes** @@ -487,7 +487,7 @@ try { console.log(`Query result: ${JSON.stringify(supportResult)}`); }); } catch (error) { - console.log(`Query failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Query failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -495,7 +495,7 @@ try { supportKeysSync(deviceId: number, keys: Array<KeyCode>): Array<boolean> -Checks whether the input device supports the specified keycode value. +Checks whether the input device supports the specified keys. **System capability**: SystemCapability.MultimodalInput.Input.InputDevice @@ -503,12 +503,12 @@ Checks whether the input device supports the specified keycode value. | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | ------------------------------------------------------ | -| deviceId | number | Yes | Unique ID of the input device. If the same physical device is repeatedly inserted and removed, its ID changes.| +| deviceId | number | Yes | ID of the input device. The device ID changes if the same physical device is repeatedly removed and inserted.| | keys | Array[<KeyCode>](js-apis-keycode.md#keycode) | Yes | Keycodes to be queried. A maximum of five keycodes can be specified. | **Return value** -| Parameters | Description | +| Type | Description | | ----------------------------------- | ------------------------------- | | Array<boolean> | Result indicating whether the input device supports the keycode value. The value **true** indicates yes, and the value **false** indicates no.| @@ -528,7 +528,7 @@ try { let supportResult: Array = inputDevice.supportKeysSync(1, [17, 22, 2055]) console.log(`Query result: ${JSON.stringify(supportResult)}`) } catch (error) { - console.log(`Query failed, error: ${JSON.stringify(error, [`code`, `message`])}`) + console.error(`Query failed, error: ${JSON.stringify(error, [`code`, `message`])}`) } ``` @@ -536,7 +536,7 @@ try { getKeyboardType(deviceId: number, callback: AsyncCallback<KeyboardType>): void -Obtains the keyboard type of an input device. This API uses an asynchronous callback to return the result. +Obtains the keyboard type of the input device, such as full keyboard and numeric keypad. This API uses an asynchronous callback to return the result. The keyboard type of the input device is subject to the result returned by the API. **System capability**: SystemCapability.MultimodalInput.Input.InputDevice @@ -544,7 +544,7 @@ Obtains the keyboard type of an input device. This API uses an asynchronous call | Name | Type | Mandatory| Description | | -------- | --------------------------------------------------- | ---- | ------------------------------------------------------------ | -| deviceId | number | Yes | Unique ID of the input device. If the same physical device is repeatedly inserted and removed, its ID changes.| +| deviceId | number | Yes | Unique ID of the input device. If the same physical device is repeatedly reinstalled or restarted, its ID may change.| | callback | AsyncCallback<[KeyboardType](#keyboardtype9)> | Yes | Callback used to return the result. | **Error codes** @@ -562,13 +562,13 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ try { inputDevice.getKeyboardType(1, (error: Error, type: Number) => { if (error) { - console.log(`Failed to get keyboard type, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Failed to get keyboard type, error: ${JSON.stringify(error, [`code`, `message`])}`); return; } console.log(`Keyboard type: ${JSON.stringify(type)}`); }); } catch (error) { - console.log(`Failed to get keyboard type, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Failed to get keyboard type, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -582,13 +582,13 @@ Obtains the keyboard type of an input device. This API uses a promise to return **Parameters** -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | -------- | ------ | ---- | ------------------------------------------------------------ | -| deviceId | number | Yes | Unique ID of the input device. If the same physical device is repeatedly inserted and removed, its ID changes.| +| deviceId | number | Yes | Unique ID of the input device. If the same physical device is repeatedly reinstalled or restarted, its ID may change.| **Return value** -| Parameters | Description | +| Type | Description | | --------------------------------------------- | ------------------------------- | | Promise<[KeyboardType](#keyboardtype9)> | Promise used to return the result.| @@ -609,7 +609,7 @@ try { console.log(`Keyboard type: ${JSON.stringify(type)}`); }); } catch (error) { - console.log(`Failed to get keyboard type, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Failed to get keyboard type, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -625,11 +625,11 @@ Obtains the keyboard type of the input device. | Name | Type | Mandatory| Description | | -------- | ------ | ---- | ------------------------------------------------------------ | -| deviceId | number | Yes | Unique ID of the input device. If the same physical device is repeatedly inserted and removed, its ID changes.| +| deviceId | number | Yes | Unique ID of the input device. If the same physical device is repeatedly reinstalled or restarted, its ID may change.| **Return value** -| Parameters | Description | +| Type | Description | | --------------------------------------------- | ------------------------------- | | [KeyboardType](#keyboardtype9) | Keyboard type.| @@ -649,7 +649,7 @@ try { let type: number = inputDevice.getKeyboardTypeSync(1) console.log(`Keyboard type: ${JSON.stringify(type)}`) } catch (error) { - console.log(`Failed to get keyboard type, error: ${JSON.stringify(error, [`code`, `message`])}`) + console.error(`Failed to get keyboard type, error: ${JSON.stringify(error, [`code`, `message`])}`) } ``` @@ -657,7 +657,7 @@ try { isFunctionKeyEnabled(functionKey: FunctionKey): Promise<boolean> -Checks whether the function key is enabled. This API uses a promise to return the result. +Checks whether the specified function key (for example, **CapsLock**) is enabled. This API uses a promise to return the result. **System capability**: SystemCapability.MultimodalInput.Input.InputDevice @@ -669,7 +669,7 @@ Checks whether the function key is enabled. This API uses a promise to return th **Return value** -| Parameters | Description | +| Type | Description | | ---------------------- | ------------------------------------------------------------ | | Promise<boolean> | Promise used to return the result. The value **true** indicates that the function key is enabled, and the value **false** indicates the opposite.| @@ -692,7 +692,7 @@ try { console.log(`capslock state: ${JSON.stringify(state)}`); }); } catch (error) { - console.log(`Failed to get capslock state, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Failed to get capslock state, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -700,7 +700,7 @@ try { setFunctionKeyEnabled(functionKey: FunctionKey, enabled: boolean): Promise<void> -Sets the status of the function key . This API uses a promise to return the result. +Specifies whether to enable a function key (for example, **CapsLock**). This API uses a promise to return the result. **Required permissions**: ohos.permission.INPUT_KEYBOARD_CONTROLLER @@ -735,10 +735,10 @@ try { inputDevice.setFunctionKeyEnabled(inputDevice.FunctionKey.CAPS_LOCK, true).then(() => { console.info(`Set capslock state success`); }).catch((error: BusinessError) => { - console.info(`Set capslock state failed, error=${JSON.stringify(error)}`); + console.error(`Set capslock state failed, error=${JSON.stringify(error)}`); }); } catch (error) { - console.info(`Set capslock enable error`); + console.error(`Set capslock enable error`); } ``` @@ -746,7 +746,7 @@ try { getIntervalSinceLastInput(): Promise<number> -Obtains the interval since the last system input event. This API uses a promise to return the result. +Obtains the interval (including the device sleep time) elapsed since the last system input event. This API uses a promise to return the result. **System capability**: SystemCapability.MultimodalInput.Input.InputDevice @@ -766,28 +766,28 @@ Obtains the interval since the last system input event. This API uses a promise ## DeviceListener9+ -Defines the listener for hot swap events of an input device. +Provides hot swap information about an input device. **System capability**: SystemCapability.MultimodalInput.Input.InputDevice | Name | Type | Readable | Writable | Description | | --------- | ------ | ---- | ---- | ------- | | type | [ChangedType](#changedtype9)| Yes| No| Device change type, which indicates whether an input device is inserted or removed.| -| deviceId | number | Yes| No| Unique ID of the input device. If the same physical device is repeatedly inserted and removed, its ID changes.| +| deviceId | number | Yes| No| Unique ID of the input device. If a physical device is repeatedly reinstalled or restarted, its ID may change.| ## InputDeviceData -Defines the information about an input device. +Provides information about an input device. **System capability**: SystemCapability.MultimodalInput.Input.InputDevice | Name | Type | Readable | Writable | Description | | --------- | ------ | ---- | ---- | ------- | -| id | number | Yes| No| Unique ID of the input device. If the same physical device is repeatedly inserted and removed, its ID changes.| +| id | number | Yes| No| Unique ID of the input device. If the same physical device is repeatedly reinstalled or restarted, its ID may change.| | name | string | Yes| No| Name of the input device. | -| sources | Array<[SourceType](#sourcetype9)> | Yes| No| Source type of the input device. For example, if a keyboard is attached with a touchpad, the device has two input sources: keyboard and touchpad.| +| sources | Array<[SourceType](#sourcetype9)> | Yes| No| Input sources supported by the input device. An input device can have multiple input sources. For example, if a keyboard is equipped with a touchpad, the input device supports both keyboard and touchpad input capabilities.| | axisRanges | Array<[AxisRange](#axisrange)> | Yes| No| Axis information of the input device. | -| bus9+ | number | Yes| No| Bus type of the input device. | +| bus9+ | number | Yes| No| Bus type of the input device. By default, the bus type reported by the input device prevails. | | product9+ | number | Yes| No| Product information of the input device. | | vendor9+ | number | Yes| No| Vendor information of the input device. | | version9+ | number | Yes| No| Version information of the input device. | @@ -822,7 +822,7 @@ Defines the axis range of an input device. | Name | Type | Readable | Writable | Description | | --------- | ------ | ---- | ---- | ------- | -| source | [SourceType](#sourcetype9) | Yes| No| Input source type of the axis.| +| source | [SourceType](#sourcetype9) | Yes| No| Input source of the axis.| | axis | [AxisType](#axistype9) | Yes| No| Axis type. | | max | number | Yes| No| Maximum value of the axis. | | min | number | Yes| No| Minimum value of the axis. | @@ -834,7 +834,7 @@ Defines the axis range of an input device. type SourceType = 'keyboard' | 'mouse' | 'touchpad' | 'touchscreen' | 'joystick' | 'trackball' -Enumerates input source types of the axis. For example, if a mouse reports an x-axis event, the input source of the x-axis is the mouse. +Enumerates input sources of the axis. For example, if a mouse reports an x-axis event, the input source of the x-axis is the mouse. **System capability**: SystemCapability.MultimodalInput.Input.InputDevice @@ -851,18 +851,18 @@ Enumerates input source types of the axis. For example, if a mouse reports an x- type ChangedType = 'add' | 'remove' -Defines the change type for the hot swap event of an input device. +Enumerates hot swap events. **System capability**: SystemCapability.MultimodalInput.Input.InputDevice | Type | Description | | --------- | ------- | -| 'add' | An input device is inserted.| -| 'remove' | An input device is removed.| +| 'add' | Device insertion.| +| 'remove' | Device removal.| ## KeyboardType9+ -Enumerates the keyboard types. +Enumerates keyboard types. **System capability**: SystemCapability.MultimodalInput.Input.InputDevice @@ -877,7 +877,7 @@ Enumerates the keyboard types. ## FunctionKey15+ -Defines the type of a function key. +Enumerates function key types. **System capability**: SystemCapability.MultimodalInput.Input.InputDevice diff --git a/en/application-dev/reference/apis-input-kit/js-apis-inputeventclient-sys.md b/en/application-dev/reference/apis-input-kit/js-apis-inputeventclient-sys.md index 5352883f2f9..a1482888149 100644 --- a/en/application-dev/reference/apis-input-kit/js-apis-inputeventclient-sys.md +++ b/en/application-dev/reference/apis-input-kit/js-apis-inputeventclient-sys.md @@ -70,7 +70,7 @@ try { let eventUp: EventUp = { KeyEvent: backKeyUp } inputEventClient.injectEvent(eventUp); } catch (error) { - console.log(`Failed to inject KeyEvent, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Failed to inject KeyEvent, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -131,12 +131,12 @@ try { let eventUp: EventUp = { keyEvent: backKeyUp } inputEventClient.injectKeyEvent(eventUp); } catch (error) { - console.log(`Failed to inject KeyEvent, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Failed to inject KeyEvent, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` ## inputEventClient.injectMouseEvent11+ -injectMouseEvent(mouseEvent: MouseEventData): void; +injectMouseEvent(mouseEvent: MouseEventData): void Injects a mouse/touchpad event. @@ -231,9 +231,8 @@ try { } catch (error) { - console.log(`Failed to inject MouseEvent, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Failed to inject MouseEvent, error: ${JSON.stringify(error, [`code`, `message`])}`); } - ``` ## inputEventClient.injectTouchEvent11+ @@ -322,7 +321,7 @@ try { } inputEventClient.injectTouchEvent(touchEventDown); } catch (error) { - console.log(`Failed to inject touchEvent, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Failed to inject touchEvent, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` diff --git a/en/application-dev/reference/apis-input-kit/js-apis-inputmonitor-sys.md b/en/application-dev/reference/apis-input-kit/js-apis-inputmonitor-sys.md index 3ca2069191d..3cc3e8c5c2f 100644 --- a/en/application-dev/reference/apis-input-kit/js-apis-inputmonitor-sys.md +++ b/en/application-dev/reference/apis-input-kit/js-apis-inputmonitor-sys.md @@ -45,14 +45,27 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js +import { inputMonitor } from '@kit.InputKit'; import { TouchEvent } from '@kit.InputKit'; -try { - inputMonitor.on('touch', (touchEvent: TouchEvent) => { - console.log(`Monitor on success ${JSON.stringify(touchEvent)}`); - return false; - }); -} catch (error) { - console.log(`Monitor on failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + inputMonitor.on('touch', (touchEvent: TouchEvent) => { + console.log(`Monitor on success ${JSON.stringify(touchEvent)}`); + return false; + }); + } catch (error) { + console.error(`Monitor on failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -85,15 +98,27 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js +import { inputMonitor } from '@kit.InputKit'; import { MouseEvent } from '@kit.InputKit'; -try { - inputMonitor.on('mouse', (mouseEvent: MouseEvent) => { - console.log(`Monitor on success ${JSON.stringify(mouseEvent)}`); - return false; - }); -} catch (error) { - console.log(`Monitor on failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + inputMonitor.on('mouse', (mouseEvent: MouseEvent) => { + console.log(`Monitor on success ${JSON.stringify(mouseEvent)}`); + return false; + }); + } catch (error) { + console.error(`Monitor on failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -128,40 +153,51 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js +import { inputMonitor } from '@kit.InputKit'; import { MouseEvent } from '@kit.InputKit'; -import { promptAction } from '@kit.ArkUI'; import { display } from '@kit.ArkUI'; -/** - * Callback triggered when the mouse pointer moves to the specified rectangular area. - */ -function callback(mouseEvent : MouseEvent) { - promptAction.showToast({ - message: `Monitor on success: ${JSON.stringify(mouseEvent)}` - }) - console.log(`Monitor on success ${JSON.stringify(mouseEvent)}`); - return false; -}; - -/** - * Rectangular area where a callback is triggered. - */ -let rect: display.Rect[] = [{ - left: 100, - top: 100, - width: 100, - height: 100 -}, { - left: 600, - top: 100, - width: 100, - height: 100 -}]; - -try { - inputMonitor.on('mouse', rect, callback); -} catch (error) { - console.log(`Monitor on failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + /** + * Callback triggered when the mouse pointer moves to the specified rectangular area. + */ + let callback = (mouseEvent : MouseEvent) => { + this.getUIContext().getPromptAction().showToast({ + message: `Monitor on success: ${JSON.stringify(mouseEvent)}` + }) + console.log(`Monitor on success ${JSON.stringify(mouseEvent)}`); + return false; + }; + + /** + * Rectangular area where a callback is triggered. + */ + let rect: display.Rect[] = [{ + left: 100, + top: 100, + width: 100, + height: 100 + }, { + left: 600, + top: 100, + width: 100, + height: 100 + }]; + + try { + inputMonitor.on('mouse', rect, callback); + } catch (error) { + console.error(`Monitor on failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -195,33 +231,58 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ ```js import { TouchEvent } from '@kit.InputKit'; -// Disable listening for a single callback. -let callback = (touchEvent: TouchEvent) => { - console.log(`Monitor on success ${JSON.stringify(touchEvent)}`); - return false; -}; -try { - inputMonitor.on('touch', callback); - inputMonitor.off('touch', callback); - console.log(`Monitor off success`); -} catch (error) { - console.log(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + // Disable listening for a single callback. + let callback = (touchEvent: TouchEvent) => { + console.log(`Monitor on success ${JSON.stringify(touchEvent)}`); + return false; + }; + try { + inputMonitor.on('touch', callback); + inputMonitor.off('touch', callback); + console.log(`Monitor off success`); + } catch (error) { + console.error(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` ```js +import { inputMonitor } from '@kit.InputKit'; import { TouchEvent } from '@kit.InputKit'; -// Cancel listening for all callbacks. -let callback = (touchEvent: TouchEvent) => { - console.log(`Monitor on success ${JSON.stringify(touchEvent)}`); - return false; -}; -try { - inputMonitor.on('touch', callback); - inputMonitor.off('touch'); - console.log(`Monitor off success`); -} catch (error) { - console.log(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + // Cancel listening for all callbacks. + let callback = (touchEvent: TouchEvent) => { + console.log(`Monitor on success ${JSON.stringify(touchEvent)}`); + return false; + }; + try { + inputMonitor.on('touch', callback); + inputMonitor.off('touch'); + console.log(`Monitor off success`); + } catch (error) { + console.error(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -254,34 +315,60 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js +import { inputMonitor } from '@kit.InputKit'; import { MouseEvent } from '@kit.InputKit'; -// Disable listening for a single callback. -let callback = (mouseEvent: MouseEvent) => { - console.log(`Monitor on success ${JSON.stringify(mouseEvent)}`); - return false; -}; -try { - inputMonitor.on('mouse', callback); - inputMonitor.off('mouse', callback); - console.log(`Monitor off success`); -} catch (error) { - console.log(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + // Disable listening for a single callback. + let callback = (mouseEvent: MouseEvent) => { + console.log(`Monitor on success ${JSON.stringify(mouseEvent)}`); + return false; + }; + try { + inputMonitor.on('mouse', callback); + inputMonitor.off('mouse', callback); + console.log(`Monitor off success`); + } catch (error) { + console.error(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` ```js +import { inputMonitor } from '@kit.InputKit'; import { MouseEvent } from '@kit.InputKit'; -// Cancel listening for all callbacks. -let callback = (mouseEvent: MouseEvent) => { - console.log(`Monitor on success ${JSON.stringify(mouseEvent)}`); - return false; -}; -try { - inputMonitor.on('mouse', callback); - inputMonitor.off('mouse'); - console.log(`Monitor off success`); -} catch (error) { - console.log(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + // Cancel listening for all callbacks. + let callback = (mouseEvent: MouseEvent) => { + console.log(`Monitor on success ${JSON.stringify(mouseEvent)}`); + return false; + }; + try { + inputMonitor.on('mouse', callback); + inputMonitor.off('mouse'); + console.log(`Monitor off success`); + } catch (error) { + console.error(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -310,16 +397,29 @@ Defines the callback for touch (touchscreen) events. **Example** ```js +import { inputMonitor } from '@kit.InputKit'; import { TouchEvent } from '@kit.InputKit'; -try { - inputMonitor.on('touch', touchEvent => { - if (touchEvent.touches.length == 3) {// Three fingers are pressed. - return true; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + inputMonitor.on('touch', touchEvent => { + if (touchEvent.touches.length == 3) { // Three fingers are pressed. + return true; + } + return false; + }); + } catch (error) { + console.error(`Monitor on failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) } - return false; - }); -} catch (error) { - console.log(`Monitor on failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } } ``` @@ -353,14 +453,27 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -import type { Pinch } from '@kit.InputKit'; -try { - inputMonitor.on('pinch', (pinchEvent) => { - console.log(`Monitor on success ${JSON.stringify(pinchEvent)}`); - return false; - }); -} catch (error) { - console.log(`Monitor on failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { inputMonitor } from '@kit.InputKit'; +import { Pinch } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + inputMonitor.on('pinch', (pinchEvent) => { + console.log(`Monitor on success ${JSON.stringify(pinchEvent)}`); + return false; + }); + } catch (error) { + console.error(`Monitor on failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -394,36 +507,60 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -// Disable listening for a single callback. +import { inputMonitor } from '@kit.InputKit'; import { Pinch } from '@kit.InputKit'; -let callback = (pinchEvent: Pinch) => { - console.log(`Monitor on success ${JSON.stringify(pinchEvent)}`); - return false; -}; -try { - inputMonitor.on('pinch', callback); - inputMonitor.off('pinch', callback); - console.log(`Monitor off success`); -} catch (error) { - console.log(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + // Disable listening for a single callback. + let callback = (pinchEvent: Pinch) => { + console.log(`Monitor on success ${JSON.stringify(pinchEvent)}`); + return false; + }; + try { + inputMonitor.on('pinch', callback); + inputMonitor.off('pinch', callback); + console.log(`Monitor off success`); + } catch (error) { + console.error(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` ```js -// Cancel listening for all callbacks. +import { inputMonitor } from '@kit.InputKit'; import { Pinch } from '@kit.InputKit'; -let callback = (pinchEvent: Pinch) => { - console.log(`Monitor on success ${JSON.stringify(pinchEvent)}`); - return false; -}; -try { - inputMonitor.on('pinch', callback); - inputMonitor.off('pinch'); - console.log(`Monitor off success`); -} catch (error) { - console.log(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + // Cancel listening for all callbacks. + let callback = (pinchEvent: Pinch) => { + console.log(`Monitor on success ${JSON.stringify(pinchEvent)}`); + return false; + }; + try { + inputMonitor.on('pinch', callback); + inputMonitor.off('pinch'); + console.log(`Monitor off success`); + } catch (error) { + console.error(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -457,13 +594,26 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - inputMonitor.on('threeFingersSwipe', (threeFingersSwipe) => { - console.log(`Monitor on success ${JSON.stringify(threeFingersSwipe)}`); - return false; - }); -} catch (error) { - console.log(`Monitor on failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { inputMonitor } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + inputMonitor.on('threeFingersSwipe', (threeFingersSwipe) => { + console.log(`Monitor on success ${JSON.stringify(threeFingersSwipe)}`); + return false; + }); + } catch (error) { + console.error(`Monitor on failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -497,36 +647,60 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -// Disable listening for a single callback. +import { inputMonitor } from '@kit.InputKit'; import { ThreeFingersSwipe } from '@kit.InputKit'; -let callback = (threeFingersSwipe: ThreeFingersSwipe) => { - console.log(`Monitor on success ${JSON.stringify(threeFingersSwipe)}`); - return false; -}; -try { - inputMonitor.on('threeFingersSwipe', callback); - inputMonitor.off("threeFingersSwipe", callback); - console.log(`Monitor off success`); -} catch (error) { - console.log(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + // Disable listening for a single callback. + let callback = (threeFingersSwipe: ThreeFingersSwipe) => { + console.log(`Monitor on success ${JSON.stringify(threeFingersSwipe)}`); + return false; + }; + try { + inputMonitor.on('threeFingersSwipe', callback); + inputMonitor.off("threeFingersSwipe", callback); + console.log(`Monitor off success`); + } catch (error) { + console.error(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` ```js -// Cancel listening for all callbacks. +import { inputMonitor } from '@kit.InputKit'; import { ThreeFingersSwipe } from '@kit.InputKit'; -let callback = (threeFingersSwipe: ThreeFingersSwipe) => { - console.log(`Monitor on success ${JSON.stringify(threeFingersSwipe)}`); - return false; -}; -try { - inputMonitor.on("threeFingersSwipe", callback); - inputMonitor.off("threeFingersSwipe"); - console.log(`Monitor off success`); -} catch (error) { - console.log(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + // Cancel listening for all callbacks. + let callback = (threeFingersSwipe: ThreeFingersSwipe) => { + console.log(`Monitor on success ${JSON.stringify(threeFingersSwipe)}`); + return false; + }; + try { + inputMonitor.on("threeFingersSwipe", callback); + inputMonitor.off("threeFingersSwipe"); + console.log(`Monitor off success`); + } catch (error) { + console.error(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -560,13 +734,26 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - inputMonitor.on('fourFingersSwipe', (fourFingersSwipe) => { - console.log(`Monitor on success ${JSON.stringify(fourFingersSwipe)}`); - return false; - }); -} catch (error) { - console.log(`Monitor on failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { inputMonitor } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + inputMonitor.on('fourFingersSwipe', (fourFingersSwipe) => { + console.log(`Monitor on success ${JSON.stringify(fourFingersSwipe)}`); + return false; + }); + } catch (error) { + console.error(`Monitor on failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -600,36 +787,60 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -// Disable listening for a single callback. +import { inputMonitor } from '@kit.InputKit'; import { FourFingersSwipe } from '@kit.InputKit'; -let callback = (fourFingersSwipe: FourFingersSwipe) => { - console.log(`Monitor on success ${JSON.stringify(fourFingersSwipe)}`); - return false; -}; -try { - inputMonitor.on('fourFingersSwipe', callback); - inputMonitor.off('fourFingersSwipe', callback); - console.log(`Monitor off success`); -} catch (error) { - console.log(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + // Disable listening for a single callback. + let callback = (fourFingersSwipe: FourFingersSwipe) => { + console.log(`Monitor on success ${JSON.stringify(fourFingersSwipe)}`); + return false; + }; + try { + inputMonitor.on('fourFingersSwipe', callback); + inputMonitor.off('fourFingersSwipe', callback); + console.log(`Monitor off success`); + } catch (error) { + console.error(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` ```js -// Cancel listening for all callbacks. +import { inputMonitor } from '@kit.InputKit'; import { FourFingersSwipe } from '@kit.InputKit'; -let callback = (fourFingersSwipe: FourFingersSwipe) => { - console.log(`Monitor on success ${JSON.stringify(fourFingersSwipe)}`); - return false; -}; -try { - inputMonitor.on('fourFingersSwipe', callback); - inputMonitor.off('fourFingersSwipe'); - console.log(`Monitor off success`); -} catch (error) { - console.log(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + // Cancel listening for all callbacks. + let callback = (fourFingersSwipe: FourFingersSwipe) => { + console.log(`Monitor on success ${JSON.stringify(fourFingersSwipe)}`); + return false; + }; + try { + inputMonitor.on('fourFingersSwipe', callback); + inputMonitor.off('fourFingersSwipe'); + console.log(`Monitor off success`); + } catch (error) { + console.error(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -664,14 +875,27 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -import type { Rotate } from '@kit.InputKit'; -try { - inputMonitor.on('rotate', 2, (rotateEvent: Rotate) => { - console.log(`Monitor on success ${JSON.stringify(rotateEvent)}`); - return false; - }); -} catch (error) { - console.log(`Monitor on failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { inputMonitor } from '@kit.InputKit'; +import { Rotate } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + inputMonitor.on('rotate', 2, (rotateEvent: Rotate) => { + console.log(`Monitor on success ${JSON.stringify(rotateEvent)}`); + return false; + }); + } catch (error) { + console.error(`Monitor on failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -706,36 +930,60 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -// Disable listening for a single callback. +import { inputMonitor } from '@kit.InputKit'; import { Rotate } from '@kit.InputKit'; -let callback = (rotateEvent: Rotate) => { - console.log(`Monitor on success ${JSON.stringify(rotateEvent)}`); - return false; -}; -try { - inputMonitor.on('rotate', 2, callback); - inputMonitor.off('rotate', 2, callback); - console.log(`Monitor off success`); -} catch (error) { - console.log(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + // Disable listening for a single callback. + let callback = (rotateEvent: Rotate) => { + console.log(`Monitor on success ${JSON.stringify(rotateEvent)}`); + return false; + }; + try { + inputMonitor.on('rotate', 2, callback); + inputMonitor.off('rotate', 2, callback); + console.log(`Monitor off success`); + } catch (error) { + console.error(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` ```js -// Cancel listening for all callbacks. +import { inputMonitor } from '@kit.InputKit'; import { Rotate } from '@kit.InputKit'; -let callback = (rotateEvent: Rotate) => { - console.log(`Monitor on success ${JSON.stringify(rotateEvent)}`); - return false; -}; -try { - inputMonitor.on('rotate', 2, callback); - inputMonitor.off('rotate', 2); - console.log(`Monitor off success`); -} catch (error) { - console.log(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + // Cancel listening for all callbacks. + let callback = (rotateEvent: Rotate) => { + console.log(`Monitor on success ${JSON.stringify(rotateEvent)}`); + return false; + }; + try { + inputMonitor.on('rotate', 2, callback); + inputMonitor.off('rotate', 2); + console.log(`Monitor off success`); + } catch (error) { + console.error(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -770,14 +1018,27 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -import type { Pinch } from '@kit.InputKit'; -try { - inputMonitor.on('pinch', 2, (pinchEvent: Pinch) => { - console.log(`Monitor on success ${JSON.stringify(pinchEvent)}`); - return false; - }); -} catch (error) { - console.log(`Monitor on failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { inputMonitor } from '@kit.InputKit'; +import { Pinch } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + inputMonitor.on('pinch', 2, (pinchEvent: Pinch) => { + console.log(`Monitor on success ${JSON.stringify(pinchEvent)}`); + return false; + }); + } catch (error) { + console.error(`Monitor on failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -812,36 +1073,60 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -// Disable listening for a single callback. +import { inputMonitor } from '@kit.InputKit'; import { Pinch } from '@kit.InputKit'; -let callback = (pinchEvent: Pinch) => { - console.log(`Monitor on success ${JSON.stringify(pinchEvent)}`); - return false; -}; -try { - inputMonitor.on('pinch', 2, callback); - inputMonitor.off('pinch', 2, callback); - console.log(`Monitor off success`); -} catch (error) { - console.log(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + // Disable listening for a single callback. + let callback = (pinchEvent: Pinch) => { + console.log(`Monitor on success ${JSON.stringify(pinchEvent)}`); + return false; + }; + try { + inputMonitor.on('pinch', 2, callback); + inputMonitor.off('pinch', 2, callback); + console.log(`Monitor off success`); + } catch (error) { + console.error(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` ```js -// Cancel listening for all callbacks. +import { inputMonitor } from '@kit.InputKit'; import { Pinch } from '@kit.InputKit'; -let callback = (pinchEvent: Pinch) => { - console.log(`Monitor on success ${JSON.stringify(pinchEvent)}`); - return false; -}; -try { - inputMonitor.on('pinch', 2, callback); - inputMonitor.off('pinch', 2); - console.log(`Monitor off success`); -} catch (error) { - console.log(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + // Cancel listening for all callbacks. + let callback = (pinchEvent: Pinch) => { + console.log(`Monitor on success ${JSON.stringify(pinchEvent)}`); + return false; + }; + try { + inputMonitor.on('pinch', 2, callback); + inputMonitor.off('pinch', 2); + console.log(`Monitor off success`); + } catch (error) { + console.error(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -875,13 +1160,26 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - inputMonitor.on('threeFingersTap', (threeFingersTap) => { - console.log(`Monitor on success ${JSON.stringify(threeFingersTap)}`); - return false; - }); -} catch (error) { - console.log(`Monitor on failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { inputMonitor } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + inputMonitor.on('threeFingersTap', (threeFingersTap) => { + console.log(`Monitor on success ${JSON.stringify(threeFingersTap)}`); + return false; + }); + } catch (error) { + console.error(`Monitor on failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -915,36 +1213,60 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -// Disable listening for a single callback. +import { inputMonitor } from '@kit.InputKit'; import { ThreeFingersTap } from '@kit.InputKit'; -let callback = (threeFingersTap: ThreeFingersTap) => { - console.log(`Monitor on success ${JSON.stringify(threeFingersTap)}`); - return false; -}; -try { - inputMonitor.on('threeFingersTap', callback); - inputMonitor.off("threeFingersTap", callback); - console.log(`Monitor off success`); -} catch (error) { - console.log(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + // Disable listening for a single callback. + let callback = (threeFingersTap: ThreeFingersTap) => { + console.log(`Monitor on success ${JSON.stringify(threeFingersTap)}`); + return false; + }; + try { + inputMonitor.on('threeFingersTap', callback); + inputMonitor.off("threeFingersTap", callback); + console.log(`Monitor off success`); + } catch (error) { + console.error(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` ```js -// Cancel listening for all callbacks. +import { inputMonitor } from '@kit.InputKit'; import { ThreeFingersTap } from '@kit.InputKit'; -let callback = (threeFingersTap: ThreeFingersTap) => { - console.log(`Monitor on success ${JSON.stringify(threeFingersTap)}`); - return false; -}; -try { - inputMonitor.on('threeFingersTap', callback); - inputMonitor.off("threeFingersTap"); - console.log(`Monitor off success`); -} catch (error) { - console.log(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + // Cancel listening for all callbacks. + let callback = (threeFingersTap: ThreeFingersTap) => { + console.log(`Monitor on success ${JSON.stringify(threeFingersTap)}`); + return false; + }; + try { + inputMonitor.on('threeFingersTap', callback); + inputMonitor.off("threeFingersTap"); + console.log(`Monitor off success`); + } catch (error) { + console.error(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -979,16 +1301,27 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -import inputMonitor from '@ohos.multimodalInput.inputMonitor'; +import { inputMonitor } from '@kit.InputKit'; import { TouchGestureEvent } from '@ohos.multimodalInput.gestureEvent'; -let fingers: number = 4; -try { - inputMonitor.on('touchscreenSwipe', fingers, (event: TouchGestureEvent) => { - console.log(`Monitor on success ${JSON.stringify(event)}`); - }); -} catch (error) { - console.log(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + let fingers: number = 4; + try { + inputMonitor.on('touchscreenSwipe', fingers, (event: TouchGestureEvent) => { + console.log(`Monitor on success ${JSON.stringify(event)}`); + }); + } catch (error) { + console.error(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -1023,35 +1356,57 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -// Disable listening for a single callback. -import inputMonitor from '@ohos.multimodalInput.inputMonitor'; +import { inputMonitor } from '@kit.InputKit'; import { TouchGestureEvent } from '@ohos.multimodalInput.gestureEvent'; -let callback = (event: TouchGestureEvent) => { - console.log(`Monitor on success ${JSON.stringify(event)}`); -}; -let fingers: number = 4; -try { - inputMonitor.on('touchscreenSwipe', fingers, callback); - inputMonitor.off('touchscreenSwipe', fingers, callback); -} catch (error) { - console.log(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + // Disable listening for a single callback. + let callback = (event: TouchGestureEvent) => { + console.log(`Monitor on success ${JSON.stringify(event)}`); + }; + let fingers: number = 4; + try { + inputMonitor.on('touchscreenSwipe', fingers, callback); + inputMonitor.off('touchscreenSwipe', fingers, callback); + } catch (error) { + console.error(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` ```js -// Cancel listening for all callbacks. -import inputMonitor from '@ohos.multimodalInput.inputMonitor'; +import { inputMonitor } from '@kit.InputKit'; import { TouchGestureEvent } from '@ohos.multimodalInput.gestureEvent'; -let fingers: number = 4; -try { - inputMonitor.on('touchscreenSwipe', fingers, (event: TouchGestureEvent) => { - console.log(`Monitor on success ${JSON.stringify(event)}`); - }); - inputMonitor.off('touchscreenSwipe', fingers); -} catch (error) { - console.log(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + // Cancel listening for all callbacks. + let fingers: number = 4; + try { + inputMonitor.on('touchscreenSwipe', fingers, (event: TouchGestureEvent) => { + console.log(`Monitor on success ${JSON.stringify(event)}`); + }); + inputMonitor.off('touchscreenSwipe', fingers); + } catch (error) { + console.error(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -1086,16 +1441,27 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -import inputMonitor from '@ohos.multimodalInput.inputMonitor'; +import { inputMonitor } from '@kit.InputKit'; import { TouchGestureEvent } from '@ohos.multimodalInput.gestureEvent'; -let fingers: number = 4; -try { - inputMonitor.on('touchscreenPinch', fingers, (event: TouchGestureEvent) => { - console.log(`Monitor on success ${JSON.stringify(event)}`); - }); -} catch (error) { - console.log(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + let fingers: number = 4; + try { + inputMonitor.on('touchscreenPinch', fingers, (event: TouchGestureEvent) => { + console.log(`Monitor on success ${JSON.stringify(event)}`); + }); + } catch (error) { + console.error(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -1130,35 +1496,57 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -// Disable listening for a single callback. -import inputMonitor from '@ohos.multimodalInput.inputMonitor'; +import { inputMonitor } from '@kit.InputKit'; import { TouchGestureEvent } from '@ohos.multimodalInput.gestureEvent'; -let callback = (event: TouchGestureEvent) => { - console.log(`Monitor on success ${JSON.stringify(event)}`); -}; -let fingers: number = 4; -try { - inputMonitor.on('touchscreenPinch', fingers, callback); - inputMonitor.off("touchscreenPinch", fingers, callback); -} catch (error) { - console.log(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + // Disable listening for a single callback. + let callback = (event: TouchGestureEvent) => { + console.log(`Monitor on success ${JSON.stringify(event)}`); + }; + let fingers: number = 4; + try { + inputMonitor.on('touchscreenPinch', fingers, callback); + inputMonitor.off("touchscreenPinch", fingers, callback); + } catch (error) { + console.error(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` ```js -// Cancel listening for all callbacks. -import inputMonitor from '@ohos.multimodalInput.inputMonitor'; +import { inputMonitor } from '@kit.InputKit'; import { TouchGestureEvent } from '@ohos.multimodalInput.gestureEvent'; -let fingers: number = 4; -try { - inputMonitor.on('touchscreenPinch', fingers, (event: TouchGestureEvent) => { - console.log(`Monitor on success ${JSON.stringify(event)}`); - }); - inputMonitor.off("touchscreenPinch", fingers); -} catch (error) { - console.log(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + // Cancel listening for all callbacks. + let fingers: number = 4; + try { + inputMonitor.on('touchscreenPinch', fingers, (event: TouchGestureEvent) => { + console.log(`Monitor on success ${JSON.stringify(event)}`); + }); + inputMonitor.off("touchscreenPinch", fingers); + } catch (error) { + console.error(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -1182,7 +1570,7 @@ Listens for the press and release events of the specified key, which can be the **Error codes** -For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Input Key Monitor Error Codes](errorcode-inputkeymonitor.md). +For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Input Monitor Error Codes](errorcode-inputmonitor.md). | ID| Error Message | | -------- | ------------------------------------------------------------ | @@ -1196,13 +1584,24 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ ```js import { inputMonitor, KeyEvent, KeyCode } from '@kit.InputKit'; -let keys: Array = [KeyCode.KEYCODE_VOLUME_UP]; -try { - inputMonitor.on('keyPressed', keys, (event: KeyEvent ) => { - console.log(`Monitor on success ${JSON.stringify(event)}`); - }); -} catch (error) { - console.log(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + let keys: Array = [KeyCode.KEYCODE_VOLUME_UP]; + try { + inputMonitor.on('keyPressed', keys, (event: KeyEvent ) => { + console.log(`Monitor on success ${JSON.stringify(event)}`); + }); + } catch (error) { + console.error(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -1236,32 +1635,54 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -// Disable listening for a single callback. import { inputMonitor, KeyEvent, KeyCode } from '@kit.InputKit'; -try { - let callback = (event: KeyEvent) => { - console.log(`Monitor on success ${JSON.stringify(event)}`); - }; - let keys: Array = [KeyCode.KEYCODE_VOLUME_UP]; - inputMonitor.on('keyPressed', keys, callback); - inputMonitor.off("keyPressed", callback); -} catch (error) { - console.log(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + // Disable listening for a single callback. + try { + let callback = (event: KeyEvent) => { + console.log(`Monitor on success ${JSON.stringify(event)}`); + }; + let keys: Array = [KeyCode.KEYCODE_VOLUME_UP]; + inputMonitor.on('keyPressed', keys, callback); + inputMonitor.off("keyPressed", callback); + } catch (error) { + console.error(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` ```js -// Cancel listening for all callbacks. import { inputMonitor, KeyEvent, KeyCode } from '@kit.InputKit'; -try { - let keys: Array = [KeyCode.KEYCODE_VOLUME_UP]; - inputMonitor.on('keyPressed', keys, (event: KeyEvent) => { - console.log(`Monitor on success ${JSON.stringify(event)}`); - }); - inputMonitor.off("keyPressed"); -} catch (error) { - console.log(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + // Cancel listening for all callbacks. + try { + let keys: Array = [KeyCode.KEYCODE_VOLUME_UP]; + inputMonitor.on('keyPressed', keys, (event: KeyEvent) => { + console.log(`Monitor on success ${JSON.stringify(event)}`); + }); + inputMonitor.off("keyPressed"); + } catch (error) { + console.error(`Monitor execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` diff --git a/en/application-dev/reference/apis-input-kit/js-apis-keycode.md b/en/application-dev/reference/apis-input-kit/js-apis-keycode.md index 547720bef6b..b635d564ec2 100644 --- a/en/application-dev/reference/apis-input-kit/js-apis-keycode.md +++ b/en/application-dev/reference/apis-input-kit/js-apis-keycode.md @@ -109,7 +109,7 @@ Keycode value. | KEYCODE_MENU | 2067 | Menu key | | KEYCODE_PAGE_UP | 2068 | Page Up key | | KEYCODE_PAGE_DOWN | 2069 | Page Down key | -| KEYCODE_ESCAPE | 2070 | ESC key | +| KEYCODE_ESCAPE | 2070 | Esc key | | KEYCODE_FORWARD_DEL | 2071 | Forward Delete key | | KEYCODE_CTRL_LEFT | 2072 | Left Ctrl key | | KEYCODE_CTRL_RIGHT | 2073 | Right Ctrl key | @@ -364,6 +364,6 @@ Keycode value. | KEYCODE_BTN_7 | 3107 | Button 7 | | KEYCODE_BTN_8 | 3108 | Button 8 | | KEYCODE_BTN_9 | 3109 | Button 9 | -| KEYCODE_DAGGER_CLICK18+ | 3211 | Single-click action on the smart watch's dagger button | -| KEYCODE_DAGGER_DOUBLE_CLICK18+ | 3212 | Double-click action on the smart watch's dagger button | -| KEYCODE_DAGGER_LONG_PRESS18+ | 3213 | Long-press action on the smart watch's dagger button | +| KEYCODE_DAGGER_CLICK18+ | 3211 | Single tapping the smart watch's X-TAP sensor | +| KEYCODE_DAGGER_DOUBLE_CLICK18+ | 3212 | Double tapping the smart watch's X-TAP sensor | +| KEYCODE_DAGGER_LONG_PRESS18+ | 3213 | Long-pressing the smart watch's X-TAP sensor | diff --git a/en/application-dev/reference/apis-input-kit/js-apis-keyevent.md b/en/application-dev/reference/apis-input-kit/js-apis-keyevent.md index 5f790e57e37..36714708f62 100644 --- a/en/application-dev/reference/apis-input-kit/js-apis-keyevent.md +++ b/en/application-dev/reference/apis-input-kit/js-apis-keyevent.md @@ -60,5 +60,5 @@ Key event. | logoKey | boolean | Yes | No | Whether logoKey is being pressed.
The value **true** indicates that the key is pressed, and the value **false** indicates the opposite. | | fnKey | boolean | Yes | No | Whether fnKey is being pressed.
The value **true** indicates that the key is pressed, and the value **false** indicates the opposite. | | capsLock | boolean | Yes | No | Whether capsLock is active.
The value **true** indicates that capsLock is active, and the value **false** indicates the opposite. | -| numLock | boolean | Yes | No | Whether numLock is active.
The value **true** indicates that capsLock is active, and the value **false** indicates the opposite. | -| scrollLock | boolean | Yes | No | Whether scrollLock is active.
The value **true** indicates that capsLock is active, and the value **false** indicates the opposite.| +| numLock | boolean | Yes | No | Whether numLock is active.
The value **true** indicates that numLock is active, and the value **false** indicates the opposite. | +| scrollLock | boolean | Yes | No | Whether scrollLock is active.
The value **true** indicates that scrollLock is active, and the value **false** indicates the opposite.| diff --git a/en/application-dev/reference/apis-input-kit/js-apis-mouseevent.md b/en/application-dev/reference/apis-input-kit/js-apis-mouseevent.md index c761b3d93f9..d5fb784fffc 100644 --- a/en/application-dev/reference/apis-input-kit/js-apis-mouseevent.md +++ b/en/application-dev/reference/apis-input-kit/js-apis-mouseevent.md @@ -99,7 +99,7 @@ Defines the mouse event. | windowY | number | Yes | No | Vertical coordinate of the mouse pointer in the window. | | rawDeltaX | number | Yes | No | Horizontal coordinate offset relative to the previous reported mouse pointer position.| | rawDeltaY | number | Yes | No | Vertical coordinate offset relative to the previous reported mouse pointer position. | -| button | [Button](#button) | Yes | No | Mouse button. +| button | [Button](#button) | Yes | No | Mouse button. | | pressedButtons | [Button](#button)[] | Yes | No | Button being pressed. | | axes | [AxisValue](#axisvalue)[] | Yes | No | All axis data contained in the event. | | pressedKeys | [KeyCode](js-apis-keycode.md#keycode)[] | Yes | No | List of pressed keys. | diff --git a/en/application-dev/reference/apis-input-kit/js-apis-pointer-sys.md b/en/application-dev/reference/apis-input-kit/js-apis-pointer-sys.md index a5eed0aee60..be114420d4b 100644 --- a/en/application-dev/reference/apis-input-kit/js-apis-pointer-sys.md +++ b/en/application-dev/reference/apis-input-kit/js-apis-pointer-sys.md @@ -43,16 +43,29 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setPointerSpeed(5, (error: Error) => { - if (error) { - console.log(`Set pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); - return; +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setPointerSpeed(5, (error: Error) => { + if (error) { + console.error(`Set pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } + console.log(`Set pointer speed success`); + }); + } catch (error) { + console.error(`Set pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) } - console.log(`Set pointer speed success`); - }); -} catch (error) { - console.log(`Set pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } } ``` @@ -90,12 +103,25 @@ For details about the following error codes, see [Screen Hopping Error Codes](.. **Example** ```js -try { - pointer.setPointerSpeed(5).then(() => { - console.log(`Set pointer speed success`); - }); -} catch (error) { - console.log(`Set pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setPointerSpeed(5).then(() => { + console.log(`Set pointer speed success`); + }); + } catch (error) { + console.error(`Set pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -127,11 +153,24 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - let speed = pointer.setPointerSpeedSync(5); - console.log(`Set pointer speed success`); -} catch (error) { - console.log(`Set pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + let speed = pointer.setPointerSpeedSync(5); + console.log(`Set pointer speed success`); + } catch (error) { + console.error(`Set pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -163,16 +202,29 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.getPointerSpeed((error: Error, speed: number) => { - if (error) { - console.log(`Get pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); - return; +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.getPointerSpeed((error: Error, speed: number) => { + if (error) { + console.error(`Get pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } + console.log(`Get pointer speed success, speed: ${JSON.stringify(speed)}`); + }); + } catch (error) { + console.error(`Get pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) } - console.log(`Get pointer speed success, speed: ${JSON.stringify(speed)}`); - }); -} catch (error) { - console.log(`Get pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } } ``` @@ -195,12 +247,25 @@ Obtains the moving speed of the mouse pointer. This API uses a promise to return **Example** ```js -try { - pointer.getPointerSpeed().then(speed => { - console.log(`Get pointer speed success, speed: ${JSON.stringify(speed)}`); - }); -} catch (error) { - console.log(`Get pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.getPointerSpeed().then(speed => { + console.log(`Get pointer speed success, speed: ${JSON.stringify(speed)}`); + }); + } catch (error) { + console.error(`Get pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -232,11 +297,24 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - let speed = pointer.getPointerSpeedSync(); - console.log(`Get pointer speed success, speed: ${JSON.stringify(speed)}`); -} catch (error) { - console.log(`Get pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + let speed = pointer.getPointerSpeedSync(); + console.log(`Get pointer speed success, speed: ${JSON.stringify(speed)}`); + } catch (error) { + console.error(`Get pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -269,16 +347,29 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setHoverScrollState(true, (error: Error) => { - if (error) { - console.log(`Set the mouse hover scroll failed, error: ${JSON.stringify(error, [`code`, `message`])}`); - return; +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setHoverScrollState(true, (error: Error) => { + if (error) { + console.error(`Set the mouse hover scroll failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } + console.log(`Set the mouse hover scroll success`); + }); + } catch (error) { + console.error(`Set the mouse hover scroll failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) } - console.log(`Set the mouse hover scroll success`); - }); -} catch (error) { - console.log(`Set the mouse hover scroll failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } } ``` @@ -316,12 +407,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setHoverScrollState(true).then(() => { - console.log(`Set the mouse hover scroll success`); - }); -} catch (error) { - console.log(`Set the mouse hover scroll failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setHoverScrollState(true).then(() => { + console.log(`Set the mouse hover scroll success`); + }); + } catch (error) { + console.error(`Set the mouse hover scroll failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -353,12 +457,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.getHoverScrollState((error: Error, state: boolean) => { - console.log(`Get the mouse hover scroll success, state: ${JSON.stringify(state)}`); - }); -} catch (error) { - console.log(`Get the mouse hover scroll failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.getHoverScrollState((error: Error, state: boolean) => { + console.log(`Get the mouse hover scroll success, state: ${JSON.stringify(state)}`); + }); + } catch (error) { + console.error(`Get the mouse hover scroll failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -390,12 +507,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.getHoverScrollState().then((state: boolean) => { - console.log(`Get the mouse hover scroll success, state: ${JSON.stringify(state)}`); - }); -} catch (error) { - console.log(`Get the mouse hover scroll failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.getHoverScrollState().then((state: boolean) => { + console.log(`Get the mouse hover scroll success, state: ${JSON.stringify(state)}`); + }); + } catch (error) { + console.error(`Get the mouse hover scroll failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -428,16 +558,29 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setMousePrimaryButton(pointer.PrimaryButton.RIGHT, (error: Error) => { - if (error) { - console.log(`Set mouse primary button failed, error: ${JSON.stringify(error, [`code`, `message`])}`); - return; +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setMousePrimaryButton(pointer.PrimaryButton.RIGHT, (error: Error) => { + if (error) { + console.error(`Set mouse primary button failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } + console.log(`Set mouse primary button success`); + }); + } catch (error) { + console.error(`Set mouse primary button failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) } - console.log(`Set mouse primary button success`); - }); -} catch (error) { - console.log(`Set mouse primary button failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } } ``` @@ -475,12 +618,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setMousePrimaryButton(pointer.PrimaryButton.RIGHT).then(() => { - console.log(`Set mouse primary button success`); - }); -} catch (error) { - console.log(`Set mouse primary button failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setMousePrimaryButton(pointer.PrimaryButton.RIGHT).then(() => { + console.log(`Set mouse primary button success`); + }); + } catch (error) { + console.error(`Set mouse primary button failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -512,12 +668,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.getMousePrimaryButton((error: Error, primary: pointer.PrimaryButton) => { - console.log(`Get mouse primary button success, primary: ${JSON.stringify(primary)}`); - }); -} catch (error) { - console.log(`Get mouse primary button failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.getMousePrimaryButton((error: Error, primary: pointer.PrimaryButton) => { + console.log(`Get mouse primary button success, primary: ${JSON.stringify(primary)}`); + }); + } catch (error) { + console.error(`Get mouse primary button failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -549,12 +718,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.getMousePrimaryButton().then((primary: pointer.PrimaryButton) => { - console.log(`Get mouse primary button success, primary: ${JSON.stringify(primary)}`); - }); -} catch (error) { - console.log(`Get mouse primary button failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.getMousePrimaryButton().then((primary: pointer.PrimaryButton) => { + console.log(`Get mouse primary button success, primary: ${JSON.stringify(primary)}`); + }); + } catch (error) { + console.error(`Get mouse primary button failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -587,16 +769,29 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setMouseScrollRows(1, (error: Error) => { - if (error) { - console.log(`setMouseScrollRows failed, error: ${JSON.stringify(error, [`code`, `message`])}`); - return; +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setMouseScrollRows(1, (error: Error) => { + if (error) { + console.error(`setMouseScrollRows failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } + console.log(`setMouseScrollRows success`); + }); + } catch (error) { + console.error(`setMouseScrollRows failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) } - console.log(`setMouseScrollRows success`); - }); -} catch (error) { - console.log(`setMouseScrollRows failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } } ``` @@ -634,12 +829,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setMouseScrollRows(20).then(() => { - console.log(`setMouseScrollRows success`); - }); -} catch (error) { - console.log(`setMouseScrollRows failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setMouseScrollRows(20).then(() => { + console.log(`setMouseScrollRows success`); + }); + } catch (error) { + console.error(`setMouseScrollRows failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -671,12 +879,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.getMouseScrollRows((error: Error, rows: number) => { - console.log(`getMouseScrollRows success, rows: ${JSON.stringify(rows)}`); - }); -} catch (error) { - console.log(`getMouseScrollRows failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.getMouseScrollRows((error: Error, rows: number) => { + console.log(`getMouseScrollRows success, rows: ${JSON.stringify(rows)}`); + }); + } catch (error) { + console.error(`getMouseScrollRows failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -708,12 +929,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.getMouseScrollRows().then((rows: number) => { - console.log(`getMouseScrollRows success, rows: ${JSON.stringify(rows)}`); - }); -} catch (error) { - console.log(`getMouseScrollRows failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.getMouseScrollRows().then((rows: number) => { + console.log(`getMouseScrollRows success, rows: ${JSON.stringify(rows)}`); + }); + } catch (error) { + console.error(`getMouseScrollRows failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -746,16 +980,29 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setTouchpadScrollSwitch(true, (error: Error) => { - if (error) { - console.log(`setTouchpadScrollSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); - return; +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setTouchpadScrollSwitch(true, (error: Error) => { + if (error) { + console.error(`setTouchpadScrollSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } + console.log(`setTouchpadScrollSwitch success`); + }); + } catch (error) { + console.error(`setTouchpadScrollSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) } - console.log(`setTouchpadScrollSwitch success`); - }); -} catch (error) { - console.log(`setTouchpadScrollSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } } ``` @@ -793,12 +1040,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setTouchpadScrollSwitch(false).then(() => { - console.log(`setTouchpadScrollSwitch success`); - }); -} catch (error) { - console.log(`setTouchpadScrollSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setTouchpadScrollSwitch(false).then(() => { + console.log(`setTouchpadScrollSwitch success`); + }); + } catch (error) { + console.error(`setTouchpadScrollSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -830,12 +1090,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.getTouchpadScrollSwitch((error: Error, state: boolean) => { - console.log(`getTouchpadScrollSwitch success, state: ${JSON.stringify(state)}`); - }); -} catch (error) { - console.log(`getTouchpadScrollSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.getTouchpadScrollSwitch((error: Error, state: boolean) => { + console.log(`getTouchpadScrollSwitch success, state: ${JSON.stringify(state)}`); + }); + } catch (error) { + console.error(`getTouchpadScrollSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -867,12 +1140,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.getTouchpadScrollSwitch().then((state) => { - console.log(`getTouchpadScrollSwitch success, state: ${JSON.stringify(state)}`); - }); -} catch (error) { - console.log(`getTouchpadScrollSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.getTouchpadScrollSwitch().then((state) => { + console.log(`getTouchpadScrollSwitch success, state: ${JSON.stringify(state)}`); + }); + } catch (error) { + console.error(`getTouchpadScrollSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -905,16 +1191,29 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setTouchpadScrollDirection(true, (error: Error) => { - if (error) { - console.log(`setTouchpadScrollDirection failed, error: ${JSON.stringify(error, [`code`, `message`])}`); - return; +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setTouchpadScrollDirection(true, (error: Error) => { + if (error) { + console.error(`setTouchpadScrollDirection failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } + console.log(`setTouchpadScrollDirection success`); + }); + } catch (error) { + console.error(`setTouchpadScrollDirection failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) } - console.log(`setTouchpadScrollDirection success`); - }); -} catch (error) { - console.log(`setTouchpadScrollDirection failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } } ``` @@ -952,12 +1251,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setTouchpadScrollDirection (false).then(() => { - console.log(`setTouchpadScrollDirection success`); - }); -} catch (error) { - console.log(`setTouchpadScrollDirection failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setTouchpadScrollDirection (false).then(() => { + console.log(`setTouchpadScrollDirection success`); + }); + } catch (error) { + console.error(`setTouchpadScrollDirection failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -989,12 +1301,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.getTouchpadScrollDirection ((error: Error, state: boolean) => { - console.log(`getTouchpadScrollDirection success, state: ${JSON.stringify(state)}`); - }); -} catch (error) { - console.log(`getTouchpadScrollDirection failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.getTouchpadScrollDirection ((error: Error, state: boolean) => { + console.log(`getTouchpadScrollDirection success, state: ${JSON.stringify(state)}`); + }); + } catch (error) { + console.error(`getTouchpadScrollDirection failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -1026,12 +1351,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.getTouchpadScrollDirection().then((state: boolean) => { - console.log(`getTouchpadScrollDirection success, state: ${JSON.stringify(state)}`); - }); -} catch (error) { - console.log(`getTouchpadScrollDirection failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.getTouchpadScrollDirection().then((state: boolean) => { + console.log(`getTouchpadScrollDirection success, state: ${JSON.stringify(state)}`); + }); + } catch (error) { + console.error(`getTouchpadScrollDirection failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -1064,16 +1402,29 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setTouchpadTapSwitch(true, (error: Error) => { - if (error) { - console.log(`setTouchpadTapSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); - return; +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setTouchpadTapSwitch(true, (error: Error) => { + if (error) { + console.error(`setTouchpadTapSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } + console.log(`setTouchpadTapSwitch success`); + }); + } catch (error) { + console.error(`setTouchpadTapSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) } - console.log(`setTouchpadTapSwitch success`); - }); -} catch (error) { - console.log(`setTouchpadTapSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } } ``` @@ -1111,12 +1462,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setTouchpadTapSwitch(false).then(() => { - console.log(`setTouchpadTapSwitch success`); - }); -} catch (error) { - console.log(`setTouchpadTapSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setTouchpadTapSwitch(false).then(() => { + console.log(`setTouchpadTapSwitch success`); + }); + } catch (error) { + console.error(`setTouchpadTapSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -1148,12 +1512,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.getTouchpadTapSwitch((error: Error, state: boolean) => { - console.log(`getTouchpadTapSwitch success, state: ${JSON.stringify(state)}`); - }); -} catch (error) { - console.log(`getTouchpadTapSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.getTouchpadTapSwitch((error: Error, state: boolean) => { + console.log(`getTouchpadTapSwitch success, state: ${JSON.stringify(state)}`); + }); + } catch (error) { + console.error(`getTouchpadTapSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -1185,12 +1562,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.getTouchpadTapSwitch().then((state: boolean) => { - console.log(`getTouchpadTapSwitch success, state: ${JSON.stringify(state)}`); - }); -} catch (error) { - console.log(`getTouchpadTapSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.getTouchpadTapSwitch().then((state: boolean) => { + console.log(`getTouchpadTapSwitch success, state: ${JSON.stringify(state)}`); + }); + } catch (error) { + console.error(`getTouchpadTapSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -1223,16 +1613,29 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setTouchpadPointerSpeed(1, (error: Error) => { - if (error) { - console.log(`setTouchpadPointerSpeedfailed, error: ${JSON.stringify(error, [`code`, `message`])}`); - return; +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setTouchpadPointerSpeed(1, (error: Error) => { + if (error) { + console.error(`setTouchpadPointerSpeedfailed, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } + console.log(`setTouchpadPointerSpeed success`); + }); + } catch (error) { + console.error(`setTouchpadPointerSpeed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) } - console.log(`setTouchpadPointerSpeed success`); - }); -} catch (error) { - console.log(`setTouchpadPointerSpeed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } } ``` @@ -1270,12 +1673,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setTouchpadPointerSpeed(10).then(() => { - console.log(`setTouchpadPointerSpeed success`); - }); -} catch (error) { - console.log(`setTouchpadPointerSpeed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setTouchpadPointerSpeed(10).then(() => { + console.log(`setTouchpadPointerSpeed success`); + }); + } catch (error) { + console.error(`setTouchpadPointerSpeed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -1307,12 +1723,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.getTouchpadPointerSpeed((error: Error, speed: number) => { - console.log(`getTouchpadPointerSpeed success, speed: ${JSON.stringify(speed)}`); - }); -} catch (error) { - console.log(`getTouchpadPointerSpeed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.getTouchpadPointerSpeed((error: Error, speed: number) => { + console.log(`getTouchpadPointerSpeed success, speed: ${JSON.stringify(speed)}`); + }); + } catch (error) { + console.error(`getTouchpadPointerSpeed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -1344,12 +1773,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.getTouchpadPointerSpeed().then((speed: number) => { - console.log(`getTouchpadPointerSpeed success, speed: ${JSON.stringify(speed)}`); - }); -} catch (error) { - console.log(`getTouchpadPointerSpeed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.getTouchpadPointerSpeed().then((speed: number) => { + console.log(`getTouchpadPointerSpeed success, speed: ${JSON.stringify(speed)}`); + }); + } catch (error) { + console.error(`getTouchpadPointerSpeed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -1382,16 +1824,29 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setTouchpadTapSwitch(true, (error: Error) => { - if (error) { - console.log(`setTouchpadPinchSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); - return; +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setTouchpadTapSwitch(true, (error: Error) => { + if (error) { + console.error(`setTouchpadPinchSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } + console.log(`setTouchpadPinchSwitch success`); + }); + } catch (error) { + console.error(`setTouchpadPinchSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) } - console.log(`setTouchpadPinchSwitch success`); - }); -} catch (error) { - console.log(`setTouchpadPinchSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } } ``` @@ -1429,12 +1884,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setTouchpadPinchSwitch(false).then(() => { - console.log(`setTouchpadPinchSwitch success`); - }); -} catch (error) { - console.log(`setTouchpadPinchSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setTouchpadPinchSwitch(false).then(() => { + console.log(`setTouchpadPinchSwitch success`); + }); + } catch (error) { + console.error(`setTouchpadPinchSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -1466,12 +1934,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.getTouchpadPinchSwitch((error: Error, state: boolean) => { - console.log(`getTouchpadPinchSwitch success, state: ${JSON.stringify(state)}`); - }); -} catch (error) { - console.log(`getTouchpadPinchSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.getTouchpadPinchSwitch((error: Error, state: boolean) => { + console.log(`getTouchpadPinchSwitch success, state: ${JSON.stringify(state)}`); + }); + } catch (error) { + console.error(`getTouchpadPinchSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -1503,12 +1984,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.getTouchpadPinchSwitch().then((state: boolean) => { - console.log(`getTouchpadPinchSwitch success, state: ${JSON.stringify(state)}`); - }); -} catch (error) { - console.log(`getTouchpadPinchSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.getTouchpadPinchSwitch().then((state: boolean) => { + console.log(`getTouchpadPinchSwitch success, state: ${JSON.stringify(state)}`); + }); + } catch (error) { + console.error(`getTouchpadPinchSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -1541,16 +2035,29 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setTouchpadSwipeSwitch(true, (error: Error) => { - if (error) { - console.log(`setTouchpadSwipeSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); - return; +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setTouchpadSwipeSwitch(true, (error: Error) => { + if (error) { + console.error(`setTouchpadSwipeSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } + console.log(`setTouchpadSwipeSwitch success`); + }); + } catch (error) { + console.error(`setTouchpadSwipeSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) } - console.log(`setTouchpadSwipeSwitch success`); - }); -} catch (error) { - console.log(`setTouchpadSwipeSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } } ``` @@ -1588,12 +2095,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setTouchpadSwipeSwitch(false).then(() => { - console.log(`setTouchpadSwipeSwitch success`); - }); -} catch (error) { - console.log(`setTouchpadSwipeSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setTouchpadSwipeSwitch(false).then(() => { + console.log(`setTouchpadSwipeSwitch success`); + }); + } catch (error) { + console.error(`setTouchpadSwipeSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -1625,12 +2145,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.getTouchpadSwipeSwitch((error: Error, state: boolean) => { - console.log(`getTouchpadSwipeSwitch success, state: ${JSON.stringify(state)}`); - }); -} catch (error) { - console.log(`getTouchpadSwipeSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.getTouchpadSwipeSwitch((error: Error, state: boolean) => { + console.log(`getTouchpadSwipeSwitch success, state: ${JSON.stringify(state)}`); + }); + } catch (error) { + console.error(`getTouchpadSwipeSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -1662,12 +2195,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.getTouchpadSwipeSwitch().then((state: boolean) => { - console.log(`getTouchpadSwipeSwitch success, state: ${JSON.stringify(state)}`); - }); -} catch (error) { - console.log(`getTouchpadSwipeSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.getTouchpadSwipeSwitch().then((state: boolean) => { + console.log(`getTouchpadSwipeSwitch success, state: ${JSON.stringify(state)}`); + }); + } catch (error) { + console.error(`getTouchpadSwipeSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -1685,7 +2231,7 @@ Sets the shortcut menu type of the touchpad. This API uses an asynchronous callb | Name | Type | Mandatory | Description | | -------- | ------------------------- | ---- | ------------------------------------- | -| type| [RightClickType](js-apis-pointer.md#rightclicktype10)| Yes |Shortcut menu type of the touchpad.
- TOUCHPAD_RIGHT_BUTTON: tapping the right-button area of the touchpad.
- TOUCHPAD_LEFT_BUTTON: tapping the left-button area of the touchpad.
- TOUCHPAD_TWO_FINGER_TAP: tapping or pressing the touchpad with two fingers.
The default value is **TOUCHPAD_RIGHT_BUTTON**. | +| type| [RightClickType](js-apis-pointer.md#rightclicktype10)| Yes |Shortcut menu type of the touchpad.
- TOUCHPAD_RIGHT_BUTTON: Tapping the right-button area of the touchpad.
- TOUCHPAD_LEFT_BUTTON: Tapping the left-button area of the touchpad.
- TOUCHPAD_TWO_FINGER_TAP: Tapping or pressing the touchpad with two fingers.
- TOUCHPAD_TWO_FINGER_TAP_OR_LEFT_BUTTON20+: Tapping or pressing the touchpad with two fingers, or tapping the left-button area of the touchpad.
The default value is **TOUCHPAD_TWO_FINGER_TAP_OR_RIGHT_BUTTON**.| | callback | AsyncCallback\ | Yes | Callback used to return the result.| **Error codes** @@ -1700,16 +2246,29 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setTouchpadRightClickType(pointer.RightClickType.TOUCHPAD_RIGHT_BUTTON , (error: Error) => { - if (error) { - console.log(`setTouchpadRightClickType, error: ${JSON.stringify(error, [`code`, `message`])}`); - return; +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setTouchpadRightClickType(pointer.RightClickType.TOUCHPAD_RIGHT_BUTTON , (error: Error) => { + if (error) { + console.error(`setTouchpadRightClickType, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } + console.log(`setTouchpadRightClickType success`); + }); + } catch (error) { + console.error(`setTouchpadRightClickType failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) } - console.log(`setTouchpadRightClickType success`); - }); -} catch (error) { - console.log(`setTouchpadRightClickType failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } } ``` @@ -1725,9 +2284,9 @@ Sets the shortcut menu type of the touchpad. This API uses a promise to return t **Parameters** -| Name | Type | Mandatory | Description | -| ----- | ------ | ---- | ----------------------------------- | -| type| [RightClickType](js-apis-pointer.md#rightclicktype10)| Yes | Shortcut menu type of the touchpad.
- TOUCHPAD_RIGHT_BUTTON: tapping the right-button area of the touchpad.
- TOUCHPAD_LEFT_BUTTON: tapping the left-button area of the touchpad.
- TOUCHPAD_TWO_FINGER_TAP: tapping or pressing the touchpad with two fingers.
The default value is **TOUCHPAD_RIGHT_BUTTON**.| +| Name | Type | Mandatory | Description | +| -------- | ------------------------- | ---- | ------------------------------------- | +| type| [RightClickType](js-apis-pointer.md#rightclicktype10)| Yes |Shortcut menu type of the touchpad.
- TOUCHPAD_RIGHT_BUTTON: Tapping the right-button area of the touchpad.
- TOUCHPAD_LEFT_BUTTON: Tapping the left-button area of the touchpad.
- TOUCHPAD_TWO_FINGER_TAP: Tapping or pressing the touchpad with two fingers.
- TOUCHPAD_TWO_FINGER_TAP_OR_LEFT_BUTTON20+: Tapping or pressing the touchpad with two fingers, or tapping the left-button area of the touchpad.
The default value is **TOUCHPAD_TWO_FINGER_TAP_OR_RIGHT_BUTTON**.| **Return value** @@ -1747,12 +2306,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setTouchpadRightClickType(pointer.RightClickType.TOUCHPAD_RIGHT_BUTTON).then(() => { - console.log(`setTouchpadRightClickType success`); - }); -} catch (error) { - console.log(`setTouchpadRightClickType failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setTouchpadRightClickType(pointer.RightClickType.TOUCHPAD_RIGHT_BUTTON).then(() => { + console.log(`setTouchpadRightClickType success`); + }); + } catch (error) { + console.error(`setTouchpadRightClickType failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -1784,12 +2356,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.getTouchpadRightClickType((error: Error, type: pointer.RightClickType) => { - console.log(`getTouchpadRightClickType success, type: ${JSON.stringify(type)}`); - }); -} catch (error) { - console.log(`getTouchpadRightClickType failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.getTouchpadRightClickType((error: Error, type: pointer.RightClickType) => { + console.log(`getTouchpadRightClickType success, type: ${JSON.stringify(type)}`); + }); + } catch (error) { + console.error(`getTouchpadRightClickType failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -1821,12 +2406,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.getTouchpadRightClickType().then((type: pointer.RightClickType) => { - console.log(`getTouchpadRightClickType success, typeed: ${JSON.stringify(type)}`); - }); -} catch (error) { - console.log(`getTouchpadRightClickType failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.getTouchpadRightClickType().then((type: pointer.RightClickType) => { + console.log(`getTouchpadRightClickType success, typeed: ${JSON.stringify(type)}`); + }); + } catch (error) { + console.error(`getTouchpadRightClickType failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -1859,16 +2457,29 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setPointerSize(1, (error: Error) => { - if (error) { - console.log(`setPointerSize failed, error: ${JSON.stringify(error, [`code`, `message`])}`); - return; +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setPointerSize(1, (error: Error) => { + if (error) { + console.error(`setPointerSize failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } + console.log(`setPointerSize success`); + }); + } catch (error) { + console.error(`setPointerSize failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) } - console.log(`setPointerSize success`); - }); -} catch (error) { - console.log(`setPointerSize failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } } ``` @@ -1906,12 +2517,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setPointerSize(3).then(() => { - console.log(`setPointerSize success`); - }); -} catch (error) { - console.log(`setPointerSize failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setPointerSize(3).then(() => { + console.log(`setPointerSize success`); + }); + } catch (error) { + console.error(`setPointerSize failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -1943,11 +2567,24 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setPointerSizeSync(5); - console.log(`setPointerSizeSync success`); -} catch (error) { - console.log(`setPointerSizeSync failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setPointerSizeSync(5); + console.log(`setPointerSizeSync success`); + } catch (error) { + console.error(`setPointerSizeSync failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -1979,12 +2616,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.getPointerSize((error: Error, size: number) => { - console.log(`getPointerSize success, size: ${JSON.stringify(size)}`); - }); -} catch (error) { - console.log(`getPointerSize failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.getPointerSize((error: Error, size: number) => { + console.log(`getPointerSize success, size: ${JSON.stringify(size)}`); + }); + } catch (error) { + console.error(`getPointerSize failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -2016,12 +2666,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.getPointerSize().then((size: number) => { - console.log(`getPointerSize success, size: ${JSON.stringify(size)}`); - }); -} catch (error) { - console.log(`getPointerSize failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.getPointerSize().then((size: number) => { + console.log(`getPointerSize success, size: ${JSON.stringify(size)}`); + }); + } catch (error) { + console.error(`getPointerSize failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -2053,11 +2716,24 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - let pointerSize = pointer.getPointerSizeSync(); - console.log(`getPointerSizeSync success, pointerSize: ${JSON.stringify(pointerSize)}`); -} catch (error) { - console.log(`getPointerSizeSync failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + let pointerSize = pointer.getPointerSizeSync(); + console.log(`getPointerSizeSync success, pointerSize: ${JSON.stringify(pointerSize)}`); + } catch (error) { + console.error(`getPointerSizeSync failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -2094,16 +2770,29 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setPointerColor(0xF6C800, (error: Error) => { - if (error) { - console.log(`setPointerColor failed, error: ${JSON.stringify(error, [`code`, `message`])}`); - return; +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setPointerColor(0xF6C800, (error: Error) => { + if (error) { + console.error(`setPointerColor failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } + console.log(`setPointerColor success`); + }); + } catch (error) { + console.error(`setPointerColor failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) } - console.log(`setPointerColor success`); - }); -} catch (error) { - console.log(`setPointerColor failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } } ``` @@ -2145,12 +2834,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setPointerColor(0xF6C800).then(() => { - console.log(`setPointerColor success`); - }); -} catch (error) { - console.log(`setPointerColor failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setPointerColor(0xF6C800).then(() => { + console.log(`setPointerColor success`); + }); + } catch (error) { + console.error(`setPointerColor failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -2186,11 +2888,24 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setPointerColorSync(0xF6C800); - console.log(`setPointerColorSync success`); -} catch (error) { - console.log(`setPointerColorSync failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setPointerColorSync(0xF6C800); + console.log(`setPointerColorSync success`); + } catch (error) { + console.error(`setPointerColorSync failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -2222,12 +2937,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.getPointerColor((error: Error, color: number) => { - console.log(`getPointerColor success, color: ${JSON.stringify(color)}`); - }); -} catch (error) { - console.log(`getPointerColor failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.getPointerColor((error: Error, color: number) => { + console.log(`getPointerColor success, color: ${JSON.stringify(color)}`); + }); + } catch (error) { + console.error(`getPointerColor failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -2259,12 +2987,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.getPointerColor().then((color: number) => { - console.log(`getPointerColor success, color: ${JSON.stringify(color)}`); - }); -} catch (error) { - console.log(`getPointerColor failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.getPointerColor().then((color: number) => { + console.log(`getPointerColor success, color: ${JSON.stringify(color)}`); + }); + } catch (error) { + console.error(`getPointerColor failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -2296,11 +3037,24 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - let pointerColor = pointer.getPointerColorSync(); - console.log(`getPointerColorSync success, pointerColor: ${JSON.stringify(pointerColor)}`); -} catch (error) { - console.log(`getPointerColorSync failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + let pointerColor = pointer.getPointerColorSync(); + console.log(`getPointerColorSync success, pointerColor: ${JSON.stringify(pointerColor)}`); + } catch (error) { + console.error(`getPointerColorSync failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -2333,16 +3087,29 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setTouchpadDoubleTapAndDragState(true, (error: Error) => { - if (error) { - console.log(`setTouchpadDoubleTapAndDragState failed, error: ${JSON.stringify(error, [`code`, `message`])}`); - return; +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setTouchpadDoubleTapAndDragState(true, (error: Error) => { + if (error) { + console.error(`setTouchpadDoubleTapAndDragState failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } + console.log(`setTouchpadDoubleTapAndDragState success`); + }); + } catch (error) { + console.error(`setTouchpadDoubleTapAndDragState failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) } - console.log(`setTouchpadDoubleTapAndDragState success`); - }); -} catch (error) { - console.log(`setTouchpadDoubleTapAndDragState failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } } ``` @@ -2380,12 +3147,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setTouchpadDoubleTapAndDragState(false).then(() => { - console.log(`setTouchpadDoubleTapAndDragState success`); - }); -} catch (error) { - console.log(`setTouchpadDoubleTapAndDragState failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setTouchpadDoubleTapAndDragState(false).then(() => { + console.log(`setTouchpadDoubleTapAndDragState success`); + }); + } catch (error) { + console.error(`setTouchpadDoubleTapAndDragState failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -2417,12 +3197,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.getTouchpadDoubleTapAndDragState((error: Error, state: boolean) => { - console.log(`getTouchpadDoubleTapAndDragState success, state: ${JSON.stringify(state)}`); - }); -} catch (error) { - console.log(`getTouchpadDoubleTapAndDragState failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.getTouchpadDoubleTapAndDragState((error: Error, state: boolean) => { + console.log(`getTouchpadDoubleTapAndDragState success, state: ${JSON.stringify(state)}`); + }); + } catch (error) { + console.error(`getTouchpadDoubleTapAndDragState failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -2453,11 +3246,24 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.getTouchpadDoubleTapAndDragState().then((state) => { - console.log(`getTouchpadDoubleTapAndDragState success, state: ${JSON.stringify(state)}`); - }); -} catch (error) { - console.log(`getTouchpadDoubleTapAndDragState failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.getTouchpadDoubleTapAndDragState().then((state) => { + console.log(`getTouchpadDoubleTapAndDragState success, state: ${JSON.stringify(state)}`); + }); + } catch (error) { + console.error(`getTouchpadDoubleTapAndDragState failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` diff --git a/en/application-dev/reference/apis-input-kit/js-apis-pointer.md b/en/application-dev/reference/apis-input-kit/js-apis-pointer.md index 3984c542fbc..ca6790d9e45 100644 --- a/en/application-dev/reference/apis-input-kit/js-apis-pointer.md +++ b/en/application-dev/reference/apis-input-kit/js-apis-pointer.md @@ -1,6 +1,6 @@ # @ohos.multimodalInput.pointer (Mouse Pointer) -The **pointer** module provides APIs related to pointer attribute management. +The **pointer** module provides APIs related to pointer attribute management, such as querying and setting pointer attributes. > **NOTE** > @@ -39,16 +39,29 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setPointerVisible(true, (error: Error) => { - if (error) { - console.log(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); - return; +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setPointerVisible(true, (error: Error) => { + if (error) { + console.error(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } + console.log(`Set pointer visible success`); + }); + } catch (error) { + console.error(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) } - console.log(`Set pointer visible success`); - }); -} catch (error) { - console.log(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } } ``` @@ -68,9 +81,9 @@ Sets the visible status of the mouse pointer. This API uses a promise to return **Return value** -| Name | Description | +| Type | Description | | ------------------- | ------------------- | -| Promise<void> | Promise used to return the result.| +| Promise<void> | Promise that returns no value.| **Error codes** @@ -84,12 +97,25 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setPointerVisible(false).then(() => { - console.log(`Set pointer visible success`); - }); -} catch (error) { - console.log(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setPointerVisible(false).then(() => { + console.log(`Set pointer visible success`); + }); + } catch (error) { + console.error(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -118,11 +144,24 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.setPointerVisibleSync(false); - console.log(`Set pointer visible success`); -} catch (error) { - console.log(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.setPointerVisibleSync(false); + console.log(`Set pointer visible success`); + } catch (error) { + console.error(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -130,7 +169,7 @@ try { isPointerVisible(callback: AsyncCallback<boolean>): void -Checks the visible status of the mouse pointer. This API uses an asynchronous callback to return the result. +Obtains the visible status of the mouse pointer. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.MultimodalInput.Input.Pointer @@ -138,7 +177,7 @@ Checks the visible status of the mouse pointer. This API uses an asynchronous ca | Name | Type | Mandatory | Description | | -------- | ---------------------------- | ---- | -------------- | -| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. The value **true** indicates that the mouse pointer is displayed, and the value **false** indicates the opposite.| +| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. The value **true** indicates that the mouse pointer is visible, and the value **false** indicates the opposite.| **Error codes** @@ -151,16 +190,29 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -try { - pointer.isPointerVisible((error: Error, visible: boolean) => { - if (error) { - console.log(`Get pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); - return; +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.isPointerVisible((error: Error, visible: boolean) => { + if (error) { + console.error(`Get pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + return; + } + console.log(`Get pointer visible success, visible: ${JSON.stringify(visible)}`); + }); + } catch (error) { + console.error(`Get pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) } - console.log(`Get pointer visible success, visible: ${JSON.stringify(visible)}`); - }); -} catch (error) { - console.log(`Get pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } } ``` @@ -168,25 +220,38 @@ try { isPointerVisible(): Promise<boolean> -Checks the visible status of the mouse pointer. This API uses a promise to return the result. +Obtains the visible status of the mouse pointer. This API uses a promise to return the result. **System capability**: SystemCapability.MultimodalInput.Input.Pointer **Return value** -| Name | Description | +| Type | Description | | ---------------------- | ------------------- | -| Promise<boolean> | Promise used to return the result.| +| Promise<boolean> | Promise used to return the visible status of the mouse pointer. The value **true** indicates that the mouse pointer is visible, and the value **false** indicates the opposite.| **Example** ```js -try { - pointer.isPointerVisible().then((visible: boolean) => { - console.log(`Get pointer visible success, visible: ${JSON.stringify(visible)}`); - }); -} catch (error) { - console.log(`Get pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + pointer.isPointerVisible().then((visible: boolean) => { + console.log(`Get pointer visible success, visible: ${JSON.stringify(visible)}`); + }); + } catch (error) { + console.error(`Get pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -200,18 +265,31 @@ Obtains the visible status of the mouse pointer. This API returns the result syn **Return value** -| Name | Description | +| Type | Description | | ---------------------- | ------------------- | | boolean | Visible status of the mouse pointer. The value **true** indicates that the mouse pointer is visible, and the value **false** indicates the opposite.| **Example** ```js -try { - let visible: boolean = pointer.isPointerVisibleSync(); - console.log(`Get pointer visible success, visible: ${JSON.stringify(visible)}`); -} catch (error) { - console.log(`Get pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +import { pointer } from '@kit.InputKit'; + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + try { + let visible: boolean = pointer.isPointerVisibleSync(); + console.log(`Get pointer visible success, visible: ${JSON.stringify(visible)}`); + } catch (error) { + console.error(`Get pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -227,8 +305,8 @@ Obtains the mouse pointer style. This API uses an asynchronous callback to retur | Name | Type | Mandatory | Description | | -------- | ---------------------------------------- | ---- | -------------- | -| windowId | number | Yes | Window ID. | -| callback | AsyncCallback<[PointerStyle](#pointerstyle)> | Yes | Callback used to return the result.| +| windowId | number | Yes | Window ID. The value is an integer greater than or equal to **-1**. The value **-1** indicates the global window. | +| callback | AsyncCallback<[PointerStyle](#pointerstyle)> | Yes | Callback used to return the mouse pointer style.| **Error codes** @@ -241,28 +319,39 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js +import { pointer } from '@kit.InputKit'; import { BusinessError } from '@kit.BasicServicesKit'; import { window } from '@kit.ArkUI'; -let context = getContext(this); -window.getLastWindow(context, (error: BusinessError, win: window.Window) => { - if (error.code) { - console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error)); - return; - } - let windowId = win.getWindowProperties().id; - if (windowId < 0) { - console.log(`Invalid windowId`); - return; - } - try { - pointer.getPointerStyle(windowId, (error: Error, style: pointer.PointerStyle) => { - console.log(`Get pointer style success, style: ${JSON.stringify(style)}`); - }); - } catch (error) { - console.log(`Get pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + window.getLastWindow(this.getUIContext().getHostContext(), (error: BusinessError, win: window.Window) => { + if (error.code) { + console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error)); + return; + } + let windowId = win.getWindowProperties().id; + if (windowId < 0) { + console.log(`Invalid windowId`); + return; + } + try { + pointer.getPointerStyle(windowId, (error: Error, style: pointer.PointerStyle) => { + console.log(`Get pointer style success, style: ${JSON.stringify(style)}`); + }); + } catch (error) { + console.error(`Get pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }); + }) + } } -}); +} ``` ## pointer.getPointerStyle @@ -281,9 +370,9 @@ Obtains the mouse pointer style. This API uses a promise to return the result. **Return value** -| Name | Description | +| Type | Description | | ---------------------------------------- | ------------------- | -| Promise<[PointerStyle](#pointerstyle)> | Promise used to return the result.| +| Promise<[PointerStyle](#pointerstyle)> | Promise used to return the mouse pointer style.| **Error codes** @@ -296,35 +385,46 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js +import { pointer } from '@kit.InputKit'; import { BusinessError } from '@kit.BasicServicesKit'; import { window } from '@kit.ArkUI'; -let context = getContext(this); -window.getLastWindow(context, (error: BusinessError, win: window.Window) => { - if (error.code) { - console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error)); - return; - } - let windowId = win.getWindowProperties().id; - if (windowId < 0) { - console.log(`Invalid windowId`); - return; - } - try { - pointer.getPointerStyle(windowId).then((style: pointer.PointerStyle) => { - console.log(`Get pointer style success, style: ${JSON.stringify(style)}`); - }); - } catch (error) { - console.log(`Get pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + window.getLastWindow(this.getUIContext().getHostContext(), (error: BusinessError, win: window.Window) => { + if (error.code) { + console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error)); + return; + } + let windowId = win.getWindowProperties().id; + if (windowId < 0) { + console.log(`Invalid windowId`); + return; + } + try { + pointer.getPointerStyle(windowId).then((style: pointer.PointerStyle) => { + console.log(`Get pointer style success, style: ${JSON.stringify(style)}`); + }); + } catch (error) { + console.error(`Get pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }); + }) + } } -}); +} ``` ## pointer.getPointerStyleSync10+ getPointerStyleSync(windowId: number): PointerStyle -Obtains the mouse pointer style. This API returns the result synchronously. +Obtains the mouse pointer style, such as the east arrow, west arrow, south arrow, and north arrow. This API returns the result synchronously. **System capability**: SystemCapability.MultimodalInput.Input.Pointer @@ -336,7 +436,7 @@ Obtains the mouse pointer style. This API returns the result synchronously. **Return value** -| Name | Description | +| Type | Description | | ---------------------------------------- | ------------------- | | [PointerStyle](#pointerstyle) | Mouse pointer style.| @@ -353,12 +453,23 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ ```js import { pointer } from '@kit.InputKit'; -let windowId = -1; -try { - let style: pointer.PointerStyle = pointer.getPointerStyleSync(windowId); - console.log(`Get pointer style success, style: ${JSON.stringify(style)}`); -} catch (error) { - console.log(`Get pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + let windowId = -1; + try { + let style: pointer.PointerStyle = pointer.getPointerStyleSync(windowId); + console.log(`Get pointer style success, style: ${JSON.stringify(style)}`); + } catch (error) { + console.error(`Get pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }) + } + } } ``` @@ -389,27 +500,39 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js +import { pointer } from '@kit.InputKit'; import { BusinessError } from '@kit.BasicServicesKit'; import { window } from '@kit.ArkUI'; -window.getLastWindow(getContext(), (error: BusinessError, win: window.Window) => { - if (error.code) { - console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error)); - return; - } - let windowId = win.getWindowProperties().id; - if (windowId < 0) { - console.log(`Invalid windowId`); - return; - } - try { - pointer.setPointerStyle(windowId, pointer.PointerStyle.CROSS, error => { - console.log(`Set pointer style success`); - }); - } catch (error) { - console.log(`Set pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + window.getLastWindow(this.getUIContext().getHostContext(), (error: BusinessError, win: window.Window) => { + if (error.code) { + console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error)); + return; + } + let windowId = win.getWindowProperties().id; + if (windowId < 0) { + console.log(`Invalid windowId`); + return; + } + try { + pointer.setPointerStyle(windowId, pointer.PointerStyle.CROSS, error => { + console.log(`Set pointer style success`); + }); + } catch (error) { + console.error(`Set pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }); + }) + } } -}); +} ``` ## pointer.setPointerStyle @@ -428,9 +551,9 @@ Sets the mouse pointer style. This API uses a promise to return the result. **Return value** -| Name | Description | +| Type | Description | | ------------------- | ------------------- | -| Promise<void> | Promise used to return the result.| +| Promise<void> | Promise that returns no value.| **Error codes** @@ -443,27 +566,39 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js +import { pointer } from '@kit.InputKit'; import { BusinessError } from '@kit.BasicServicesKit'; import { window } from '@kit.ArkUI'; -window.getLastWindow(getContext(), (error: BusinessError, win: window.Window) => { - if (error.code) { - console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error)); - return; - } - let windowId = win.getWindowProperties().id; - if (windowId < 0) { - console.log(`Invalid windowId`); - return; - } - try { - pointer.setPointerStyle(windowId, pointer.PointerStyle.CROSS).then(() => { - console.log(`Set pointer style success`); - }); - } catch (error) { - console.log(`Set pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + window.getLastWindow(this.getUIContext().getHostContext(), (error: BusinessError, win: window.Window) => { + if (error.code) { + console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error)); + return; + } + let windowId = win.getWindowProperties().id; + if (windowId < 0) { + console.log(`Invalid windowId`); + return; + } + try { + pointer.setPointerStyle(windowId, pointer.PointerStyle.CROSS).then(() => { + console.log(`Set pointer style success`); + }); + } catch (error) { + console.error(`Set pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }); + }) + } } -}); +} ``` ## pointer.setPointerStyleSync10+ @@ -491,26 +626,38 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js +import { pointer } from '@kit.InputKit'; import { BusinessError } from '@kit.BasicServicesKit'; import { window } from '@kit.ArkUI'; -window.getLastWindow(getContext(), (error: BusinessError, win: window.Window) => { - if (error.code) { - console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error)); - return; - } - let windowId = win.getWindowProperties().id; - if (windowId < 0) { - console.log(`Invalid windowId`); - return; - } - try { - pointer.setPointerStyleSync(windowId, pointer.PointerStyle.CROSS); - console.log(`Set pointer style success`); - } catch (error) { - console.log(`getPointerSize failed, error: ${JSON.stringify(error, [`code`, `message`])}`); +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + window.getLastWindow(this.getUIContext().getHostContext(), (error: BusinessError, win: window.Window) => { + if (error.code) { + console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error)); + return; + } + let windowId = win.getWindowProperties().id; + if (windowId < 0) { + console.log(`Invalid windowId`); + return; + } + try { + pointer.setPointerStyleSync(windowId, pointer.PointerStyle.CROSS); + console.log(`Set pointer style success`); + } catch (error) { + console.error(`getPointerSize failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }); + }) + } } -}); +} ``` ## PrimaryButton10+ @@ -521,8 +668,8 @@ Type of the primary mouse button. | Name | Value | Description | | -------------------------------- | ---- | ------ | -| LEFT | 0 | Left mouse button. | -| RIGHT | 1 | Right mouse button. | +| LEFT | 0 | Left button. | +| RIGHT | 1 | Right button. | ## RightClickType10+ @@ -594,7 +741,7 @@ Enumerates mouse pointer styles. setCustomCursor(windowId: number, pixelMap: image.PixelMap, focusX?: number, focusY?: number): Promise<void> -Sets a custom cursor. This API uses a promise to return the result. +Sets the custom cursor style. This API uses a promise to return the result. **System capability**: SystemCapability.MultimodalInput.Input.Pointer @@ -609,7 +756,7 @@ Sets a custom cursor. This API uses a promise to return the result. **Return value** -| Name | Description | +| Type | Description | | ------------------- | ---------------- | | Promise<void> | Promise that returns no value.| @@ -624,26 +771,40 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js +import { pointer } from '@kit.InputKit'; import { image } from '@kit.ImageKit'; import { BusinessError } from '@kit.BasicServicesKit'; import { window } from '@kit.ArkUI'; -getContext().resourceManager.getMediaContent($r("app.media.app_icon")).then((svgFileData) => { - const svgBuffer: ArrayBuffer = svgFileData.buffer.slice(0); - let svgImagesource: image.ImageSource = image.createImageSource(svgBuffer); - let svgDecodingOptions: image.DecodingOptions = {desiredSize: { width: 50, height:50 }}; - svgImagesource.createPixelMap(svgDecodingOptions).then((pixelMap) => { - window.getLastWindow(getContext(), (error: BusinessError, win: window.Window) => { - let windowId = win.getWindowProperties().id; - try { - pointer.setCustomCursor(windowId, pixelMap).then(() => { - console.log(`setCustomCursor success`); + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + // app_iconΪʾÀý×ÊÔ´£¬Ç뿪·¢Õ߸ù¾Ýʵ¼ÊÐèÇóÅäÖÃ×ÊÔ´Îļþ¡£ + this.getUIContext()?.getHostContext()?.resourceManager.getMediaContent($r("app.media.app_icon")).then((svgFileData) => { + const svgBuffer: ArrayBuffer = svgFileData.buffer.slice(0); + let svgImagesource: image.ImageSource = image.createImageSource(svgBuffer); + let svgDecodingOptions: image.DecodingOptions = {desiredSize: { width: 50, height:50 }}; + svgImagesource.createPixelMap(svgDecodingOptions).then((pixelMap) => { + window.getLastWindow(this.getUIContext().getHostContext(), (error: BusinessError, win: window.Window) => { + let windowId = win.getWindowProperties().id; + try { + pointer.setCustomCursor(windowId, pixelMap).then(() => { + console.log(`setCustomCursor success`); + }); + } catch (error) { + console.error(`setCustomCursor failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }); + }); }); - } catch (error) { - console.log(`setCustomCursor failed, error: ${JSON.stringify(error, [`code`, `message`])}`); - } - }); - }); -}); + }) + } + } +} ``` ## CustomCursor15+ @@ -685,7 +846,7 @@ The cursor may be switched back to the system style in the following cases: appl **Return value** -| Name | Description | +| Type | Description | | ------------------- | ---------------- | | Promise<void> | Promise that returns no value.| @@ -696,31 +857,45 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ | ID | Error Message | | ---- | --------------------- | | 401 | Parameter error. Possible causes: 1. Abnormal windowId parameter passed in. 2. Abnormal pixelMap parameter passed in; 3. Abnormal focusX parameter passed in.4. Abnormal focusY parameter passed in. | -| 26500001 | Invalid windowId. Possible causes: The window id does not belong to the current process. | +| 26500001 | Invalid windowId. | **Example** ```js +import { pointer } from '@kit.InputKit'; import { image } from '@kit.ImageKit'; import { BusinessError } from '@kit.BasicServicesKit'; import { window } from '@kit.ArkUI'; -getContext().resourceManager.getMediaContent($r("app.media.app_icon")).then((svgFileData) => { - const svgBuffer: ArrayBuffer = svgFileData.buffer.slice(0); - let svgImagesource: image.ImageSource = image.createImageSource(svgBuffer); - let svgDecodingOptions: image.DecodingOptions = {desiredSize: { width: 50, height:50 }}; - svgImagesource.createPixelMap(svgDecodingOptions).then((pixelMap) => { - window.getLastWindow(getContext(), (error: BusinessError, win: window.Window) => { - let windowId = win.getWindowProperties().id; - try { - pointer.setCustomCursor(windowId, {pixelMap: pixelMap, focusX: 25, focusY: 25}, {followSystem: false}).then(() => { - console.log(`setCustomCursor success`); + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + // app_icon is an example resource. Configure the resource file based on the actual requirements. + this.getUIContext()?.getHostContext()?.resourceManager.getMediaContent($r("app.media.app_icon")).then((svgFileData) => { + const svgBuffer: ArrayBuffer = svgFileData.buffer.slice(0); + let svgImagesource: image.ImageSource = image.createImageSource(svgBuffer); + let svgDecodingOptions: image.DecodingOptions = {desiredSize: { width: 50, height:50 }}; + svgImagesource.createPixelMap(svgDecodingOptions).then((pixelMap) => { + window.getLastWindow(this.getUIContext().getHostContext(), (error: BusinessError, win: window.Window) => { + let windowId = win.getWindowProperties().id; + try { + pointer.setCustomCursor(windowId, {pixelMap: pixelMap, focusX: 25, focusY: 25}, {followSystem: false}).then(() => { + console.log(`setCustomCursor success`); + }); + } catch (error) { + console.error(`setCustomCursor failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }); + }); }); - } catch (error) { - console.log(`setCustomCursor failed, error: ${JSON.stringify(error, [`code`, `message`])}`); - } - }); - }); -}); + }) + } + } +} ``` ## pointer.setCustomCursorSync11+ @@ -735,7 +910,7 @@ Sets a custom cursor. This API returns the result synchronously. | Name | Type | Mandatory | Description | | ----- | ------ | ---- | ----------------------------------- | -| windowId | number | Yes | Window ID. | +| windowId | number | Yes | Window ID. The value must be an integer greater than 0. | | pixelMap | [image.PixelMap](../apis-image-kit/js-apis-image.md#pixelmap7) | Yes | Pixel map resource.| | focusX | number | No | Focus x of the custom cursor. The value is greater than or equal to **0**. The default value is **0**.| | focusY | number | No | Focus y of the custom cursor. The value is greater than or equal to **0**. The default value is **0**.| @@ -751,23 +926,37 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js +import { pointer } from '@kit.InputKit'; import { image } from '@kit.ImageKit'; import { BusinessError } from '@kit.BasicServicesKit'; import { window } from '@kit.ArkUI'; -const svgFileData = getContext().resourceManager.getMediaContent($r("app.media.app_icon")).then((svgFileData) => { - const svgBuffer: ArrayBuffer = svgFileData.buffer.slice(0); - let svgImagesource: image.ImageSource = image.createImageSource(svgBuffer); - let svgDecodingOptions: image.DecodingOptions = {desiredSize: { width: 50, height:50 }}; - svgImagesource.createPixelMap(svgDecodingOptions).then((pixelMap) => { - window.getLastWindow(getContext(), (error: BusinessError, win: window.Window) => { - let windowId = win.getWindowProperties().id; - try { - pointer.setCustomCursorSync(windowId, pixelMap, 25, 25); - console.log(`setCustomCursorSync success`); - } catch (error) { - console.log(`setCustomCursorSync failed, error: ${JSON.stringify(error, [`code`, `message`])}`); - } - }); - }); -}); + +@Entry +@Component +struct Index { + build() { + RelativeContainer() { + Text() + .onClick(() => { + // app_icon is an example resource. Configure the resource file based on the actual requirements. + const svgFileData = this.getUIContext()?.getHostContext()?.resourceManager.getMediaContent($r("app.media.app_icon")).then((svgFileData) => { + const svgBuffer: ArrayBuffer = svgFileData.buffer.slice(0); + let svgImagesource: image.ImageSource = image.createImageSource(svgBuffer); + let svgDecodingOptions: image.DecodingOptions = {desiredSize: { width: 50, height:50 }}; + svgImagesource.createPixelMap(svgDecodingOptions).then((pixelMap) => { + window.getLastWindow(this.getUIContext().getHostContext(), (error: BusinessError, win: window.Window) => { + let windowId = win.getWindowProperties().id; + try { + pointer.setCustomCursorSync(windowId, pixelMap, 25, 25); + console.log(`setCustomCursorSync success`); + } catch (error) { + console.error(`setCustomCursorSync failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } + }); + }); + }); + }) + } + } +} ``` diff --git a/en/application-dev/reference/apis-input-kit/js-apis-shortKey-sys.md b/en/application-dev/reference/apis-input-kit/js-apis-shortKey-sys.md index 235b52fe656..8719a3931df 100644 --- a/en/application-dev/reference/apis-input-kit/js-apis-shortKey-sys.md +++ b/en/application-dev/reference/apis-input-kit/js-apis-shortKey-sys.md @@ -1,4 +1,4 @@ -# @ohos.multimodalInput.shortKey (Shortcut Key) (System API) +# @ohos.multimodalInput.shortKey (Preset Global Shortcut Keys) (System API) The **shortKey** module provides APIs to set the delay for starting an ability using a shortcut key. For example, you can set the delay to 3 seconds so that a screenshot is taken when you press and hold the shortcut key for 3 seconds. @@ -8,6 +8,7 @@ The **shortKey** module provides APIs to set the delay for starting an ability u > > - The APIs provided by this module are system APIs. + ## Modules to Import ```js @@ -28,7 +29,7 @@ Sets the delay for starting an ability using shortcut keys. This API uses an asy | ---------- | ------------------- | ---- | ------------------------------------------------------------ | | businessKey| string | Yes | Unique service ID registered on the multimodal side. It corresponds to **businessId** in the **ability_launch_config.json** file. You need to query this parameter on your own before calling the API.| | delay | number | Yes | Delay for starting an ability using shortcut keys, in milliseconds. This field is invalid only when shortcut keys are used.| -| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object. | +| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.| **Error codes** @@ -42,17 +43,16 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -import { shortKey } from '@kit.InputKit'; try { shortKey.setKeyDownDuration("businessId", 500, (error) => { if (error) { - console.log(`Set key down duration failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Set key down duration failed, error: ${JSON.stringify(error, [`code`, `message`])}`); return; } console.log(`Set key down duration success`); }); } catch (error) { - console.log(`Set key down duration failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Set key down duration failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` @@ -89,13 +89,12 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ **Example** ```js -import { shortKey } from '@kit.InputKit'; try { shortKey.setKeyDownDuration("businessId", 500).then(() => { console.log(`Set key down duration success`); }); } catch (error) { - console.log(`Set key down duration failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + console.error(`Set key down duration failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` diff --git a/en/application-dev/reference/apis-input-kit/js-apis-touchevent.md b/en/application-dev/reference/apis-input-kit/js-apis-touchevent.md index 68e0bd08869..8f9c49a5437 100644 --- a/en/application-dev/reference/apis-input-kit/js-apis-touchevent.md +++ b/en/application-dev/reference/apis-input-kit/js-apis-touchevent.md @@ -54,6 +54,19 @@ Enumerates touch source types. | PEN | 1 | Stylus. | | TOUCH_PAD | 2 | Touchpad. | + +## FixedMode19+ + +Enumerates coordinate correction modes. This API takes effect only for mobile phones. + +**System capability**: SystemCapability.MultimodalInput.Input.Core + +| Name | Value | Description | +| ------------ | ------ | ---- | +| NONE | 0 | Normal mode.| +| AUTO | 1 | One-handed mode.| + + ## Touch Defines the touch point information. @@ -80,6 +93,8 @@ Defines the touch point information. | rawX | number | Yes | No | X coordinate of the input device. | | rawY | number | Yes | No | Y coordinate of the input device. | | toolType | [ToolType](#tooltype) | Yes | No | Tool type. | +| fixedDisplayX19+| number| Yes | No | **screenX** correction value in one-hand mode.
**NOTE**: This API takes effect only for mobile phones.| +| fixedDisplayY19+| number| Yes | No | **screenY** correction value in one-hand mode.
This API takes effect only for mobile phones. | ## TouchEvent @@ -93,3 +108,4 @@ Defines a touch event. | touch | [Touch](#touch) | Yes | No | Current touch point. | | touches | [Touch](#touch)[] | Yes | No | All touch points. | | sourceType | [SourceType](#sourcetype) | Yes | No | Enumerates touch source types.| +| fixedMode19+ | [FixedMode](#fixedmode19) | Yes | Yes | Coordinate correction mode.
This API takes effect only for mobile phones.| diff --git a/en/application-dev/reference/apis-input-kit/oh__axis__type_8h.md b/en/application-dev/reference/apis-input-kit/oh__axis__type_8h.md deleted file mode 100644 index 4c9cfae54d4..00000000000 --- a/en/application-dev/reference/apis-input-kit/oh__axis__type_8h.md +++ /dev/null @@ -1,35 +0,0 @@ -# oh_axis_type.h - - -## Overview - -Defines the axis event structures and enumerations. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Library**: libohinput.so - -**Since**: 12 - -**Related module**: [Input](input.md) - - -## Summary - - -### Types - -| Name| Description| -| -------- | -------- | -| typedef enum [InputEvent_AxisType](input.md#inputevent_axistype) [InputEvent_AxisType](input.md#inputevent_axistype) | Axis type of the input device. | -| typedef enum [InputEvent_AxisEventType](input.md#inputevent_axiseventtype) [InputEvent_AxisEventType](input.md#inputevent_axiseventtype) | Event type of the input device. | -| typedef enum [InputEvent_AxisAction](input.md#inputevent_axisaction) [InputEvent_AxisAction](input.md#inputevent_axisaction) | Action of the input device. | - - -### Enum - -| Name| Description| -| -------- | -------- | -| [InputEvent_AxisType](input.md#inputevent_axistype) {
[AXIS_TYPE_UNKNOWN](input.md), [AXIS_TYPE_SCROLL_VERTICAL](input.md), [AXIS_TYPE_SCROLL_HORIZONTAL](input.md), [AXIS_TYPE_PINCH](input.md),
[AXIS_TYPE_ROTATE](input.md)
} | Axis type of the input device. | -| [InputEvent_AxisEventType](input.md#inputevent_axiseventtype) { [AXIS_EVENT_TYPE_PINCH](input.md) = 1, [AXIS_EVENT_TYPE_SCROLL](input.md) = 2 } | Event type of the input device. | -| [InputEvent_AxisAction](input.md#inputevent_axisaction) { [AXIS_ACTION_CANCEL](input.md) = 0, [AXIS_ACTION_BEGIN](input.md), [AXIS_ACTION_UPDATE](input.md), [AXIS_ACTION_END](input.md) } | Action of the input device. | diff --git a/en/application-dev/reference/apis-input-kit/oh__input__manager_8h.md b/en/application-dev/reference/apis-input-kit/oh__input__manager_8h.md deleted file mode 100644 index a8ef960ec52..00000000000 --- a/en/application-dev/reference/apis-input-kit/oh__input__manager_8h.md +++ /dev/null @@ -1,203 +0,0 @@ -# oh_input_manager.h - - -## Overview - -Provides functions such as event injection and status query. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Library**: libohinput.so - -**Since**: 12 - -**Related module**: [Input](input.md) - - -## Summary - - -### Structs - -| Name| Description| -| -------- | -------- | -| struct  [Input_InterceptorEventCallback](_input___interceptor_event_callback.md) | Defines the structure of the interceptor for callback events, including mouse events, touch events, and axis events. | -| struct  [Input_DeviceListener](_input___device_listener.md) | Defines a listener for device hot swap events. | - - -### Types - -| Name| Description| -| -------- | -------- | -| typedef enum [Input_KeyStateAction](input.md#input_keystateaction) [Input_KeyStateAction](input.md#input_keystateaction) | Provides the enum values of the key status. | -| typedef enum [Input_KeyEventAction](input.md#input_keyeventaction) [Input_KeyEventAction](input.md#input_keyeventaction) | Provides the enum values of the key event type. | -| typedef enum [Input_MouseEventAction](input.md#input_mouseeventaction) [Input_MouseEventAction](input.md#input_mouseeventaction) | Provides the enum values of mouse actions. | -| typedef enum [InputEvent_MouseAxis](input.md#inputevent_mouseaxis) [InputEvent_MouseAxis](input.md#inputevent_mouseaxis) | Provides the enum values of mouse axis event types. | -| typedef enum [Input_MouseEventButton](input.md#input_mouseeventbutton) [Input_MouseEventButton](input.md#input_mouseeventbutton) | Provides the enum values of mouse buttons. | -| typedef enum [Input_TouchEventAction](input.md#input_toucheventaction) [Input_TouchEventAction](input.md#input_toucheventaction) | Provides the enum values of touch actions. | -| typedef enum [InputEvent_SourceType](input.md#inputevent_sourcetype) [InputEvent_SourceType](input.md#inputevent_sourcetype) | Provides the enum values of event source types. | -| typedef enum [Input_KeyboardType](input.md#input_keyboardtype) [Input_KeyboardType](input.md#input_keyboardtype) | Provides the enum values of keyboard types of the input device. | -| typedef struct [Input_KeyState](input.md#input_keystate) [Input_KeyState](input.md#input_keystate) | Defines key information, which identifies a key pressing behavior. For example, the Ctrl key information contains the key value and key type. | -| typedef struct [Input_KeyEvent](input.md#input_keyevent) [Input_KeyEvent](input.md#input_keyevent) | Defines the key event to be injected. | -| typedef struct [Input_MouseEvent](input.md#input_mouseevent) [Input_MouseEvent](input.md#input_mouseevent) | Defines the mouse event to be injected. | -| typedef struct [Input_TouchEvent](input.md#input_touchevent) [Input_TouchEvent](input.md#input_touchevent) | Defines the touch event to be injected. | -| typedef struct [Input_AxisEvent](input.md#input_axisevent) [Input_AxisEvent](input.md#input_axisevent) | Defines an axis event. | -| typedef enum [Input_Result](input.md#input_result) [Input_Result](input.md#input_result) | Provides the enum values of error codes. | -| typedef void(\* [Input_KeyEventCallback](input.md#input_keyeventcallback)) (const [Input_KeyEvent](input.md#input_keyevent) \*keyEvent) | Defines a lifecycle callback for **keyEvent**. If the callback is triggered, **keyEvent** will be destroyed. | -| typedef void(\* [Input_MouseEventCallback](input.md#input_mouseeventcallback)) (const [Input_MouseEvent](input.md#input_mouseevent) \*mouseEvent) | Defines a lifecycle callback for **mouseEvent**. If the callback is triggered, **mouseEvent** will be destroyed. | -| typedef void(\* [Input_TouchEventCallback](input.md#input_toucheventcallback)) (const [Input_TouchEvent](input.md#input_touchevent) \*touchEvent) | Defines a lifecycle callback for **touchEvent**. If the callback is triggered, **touchEvent** will be destroyed. | -| typedef void(\* [Input_AxisEventCallback](input.md#input_axiseventcallback)) (const [Input_AxisEvent](input.md#input_axisevent) \*axisEvent) | Defines a lifecycle callback for **axisEvent**. If the callback is triggered, **axisEvent** will be destroyed. | -| typedef void(\* [Input_HotkeyCallback](input.md#input_hotkeycallback)) ([Input_Hotkey](input.md#input_hotkey) \*hotkey) | Defines the callback used to return shortcut key events. | -| typedef void(\* [Input_DeviceAddedCallback](input.md#input_deviceaddedcallback)) (int32_t deviceId) | Defines a callback used to receive device insertion events. | -| typedef void(\* [Input_DeviceRemovedCallback](input.md#input_deviceremovedcallback)) (int32_t deviceId) | Defines a callback used to receive device removal events. | -| typedef struct [Input_InterceptorEventCallback](_input___interceptor_event_callback.md) [Input_InterceptorEventCallback](input.md#input_interceptoreventcallback) | Defines the structure of the interceptor for callback events, including mouse events, touch events, and axis events. | -| typedef struct [Input_DeviceListener](_input___device_listener.md) [Input_DeviceListener](input.md#input_devicelistener) | Defines a listener for device hot swap events. | -| typedef struct [Input_InterceptorOptions](input.md#input_interceptoroptions) [Input_InterceptorOptions](input.md#input_interceptoroptions) | Defines event interception options. | -| typedef struct [Input_Hotkey](input.md#input_hotkey) [Input_Hotkey](input.md#input_hotkey) | Defines the shortcut key structure. | -| typedef struct [Input_DeviceInfo](input.md#input_deviceinfo) [Input_DeviceInfo](input.md#input_deviceinfo) | Defines the input device information. | - - -### Enums - -| Name| Description| -| -------- | -------- | -| [Input_KeyStateAction](input.md#input_keystateaction) {
[KEY_DEFAULT](input.md) = -1, [KEY_PRESSED](input.md) = 0, [KEY_RELEASED](input.md) = 1, [KEY_SWITCH_ON](input.md) = 2,
[KEY_SWITCH_OFF](input.md) = 3
} | Provides the enum values of the key status. | -| [Input_KeyEventAction](input.md#input_keyeventaction) { [KEY_ACTION_CANCEL](input.md) = 0, [KEY_ACTION_DOWN](input.md) = 1, [KEY_ACTION_UP](input.md) = 2 } | Provides the enum values of the key event type. | -| [Input_MouseEventAction](input.md#input_mouseeventaction) {
[MOUSE_ACTION_CANCEL](input.md) = 0, [MOUSE_ACTION_MOVE](input.md) = 1, [MOUSE_ACTION_BUTTON_DOWN](input.md) = 2, [MOUSE_ACTION_BUTTON_UP](input.md) = 3,
[MOUSE_ACTION_AXIS_BEGIN](input.md) = 4, [MOUSE_ACTION_AXIS_UPDATE](input.md) = 5, [MOUSE_ACTION_AXIS_END](input.md) = 6
} | Provides the enum values of mouse actions. | -| [InputEvent_MouseAxis](input.md#inputevent_mouseaxis) { [MOUSE_AXIS_SCROLL_VERTICAL](input.md) = 0, [MOUSE_AXIS_SCROLL_HORIZONTAL](input.md) = 1 } | Provides the enum values of mouse axis event types. | -| [Input_MouseEventButton](input.md#input_mouseeventbutton) {
[MOUSE_BUTTON_NONE](input.md) = -1, [MOUSE_BUTTON_LEFT](input.md) = 0, [MOUSE_BUTTON_MIDDLE](input.md) = 1, [MOUSE_BUTTON_RIGHT](input.md) = 2,
[MOUSE_BUTTON_FORWARD](input.md) = 3, [MOUSE_BUTTON_BACK](input.md) = 4
} | Provides the enum values of mouse buttons. | -| [Input_TouchEventAction](input.md#input_toucheventaction) { [TOUCH_ACTION_CANCEL](input.md) = 0, [TOUCH_ACTION_DOWN](input.md) = 1, [TOUCH_ACTION_MOVE](input.md) = 2, [TOUCH_ACTION_UP](input.md) = 3 } | Provides the enum values of touch actions. | -| [InputEvent_SourceType](input.md#inputevent_sourcetype) { [SOURCE_TYPE_MOUSE](input.md) = 1, [SOURCE_TYPE_TOUCHSCREEN](input.md) = 2, [SOURCE_TYPE_TOUCHPAD](input.md) = 3 } | Provides the enum values of event source types. | -| [Input_KeyboardType](input.md#input_keyboardtype) {
[KEYBOARD_TYPE_NONE](input.md) = 0, [KEYBOARD_TYPE_UNKNOWN](input.md) = 1, [KEYBOARD_TYPE_ALPHABETIC](input.md) = 2, [KEYBOARD_TYPE_DIGITAL](input.md) = 3,
[KEYBOARD_TYPE_STYLUS](input.md) = 4, [KEYBOARD_TYPE_REMOTE_CONTROL](input.md) = 5
} | Provides the enum values of keyboard types of the input device. | -| [Input_Result](input.md#input_result) {
[INPUT_SUCCESS](input.md) = 0, [INPUT_PERMISSION_DENIED](input.md) = 201, [INPUT_NOT_SYSTEM_APPLICATION](input.md) = 202, [INPUT_PARAMETER_ERROR](input.md) = 401, [INPUT_DEVICE_NOT_SUPPORTED](input.md) = 801, [INPUT_SERVICE_EXCEPTION](input.md) = 3800001, [INPUT_KEYBOARD_DEVICE_NOT_EXIST](input.md) = 3900002, [INPUT_REPEAT_INTERCEPTOR](input.md) = 4200001, [INPUT_OCCUPIED_BY_SYSTEM](input.md) = 4200002, [INPUT_OCCUPIED_BY_OTHER](input.md) = 4200003
} | Provides the enum values of error codes. | - - -### Functions - -| Name| Description| -| -------- | -------- | -| [Input_Result](input.md#input_result) [OH_Input_GetKeyState](input.md#oh_input_getkeystate) (struct [Input_KeyState](input.md#input_keystate) \*keyState) | Queries an enum object of the key status. | -| struct [Input_KeyState](input.md#input_keystate) \* [OH_Input_CreateKeyState](input.md#oh_input_createkeystate) () | Creates an enum object of the key status. | -| void [OH_Input_DestroyKeyState](input.md#oh_input_destroykeystate) (struct [Input_KeyState](input.md#input_keystate) \*\*keyState) | Destroys an enum object of the key status. | -| void [OH_Input_SetKeyCode](input.md#oh_input_setkeycode) (struct [Input_KeyState](input.md#input_keystate) \*keyState, int32_t keyCode) | Sets the key value of a key status enum object. | -| int32_t [OH_Input_GetKeyCode](input.md#oh_input_getkeycode) (const struct [Input_KeyState](input.md#input_keystate) \*keyState) | Obtains the key value of a key status enum object. | -| void [OH_Input_SetKeyPressed](input.md#oh_input_setkeypressed) (struct [Input_KeyState](input.md#input_keystate) \*keyState, int32_t keyAction) | Sets whether the key specific to a key status enum object is pressed. | -| int32_t [OH_Input_GetKeyPressed](input.md#oh_input_getkeypressed) (const struct [Input_KeyState](input.md#input_keystate) \*keyState) | Checks whether the key specific to a key status enum object is pressed. | -| void [OH_Input_SetKeySwitch](input.md#oh_input_setkeyswitch) (struct [Input_KeyState](input.md#input_keystate) \*keyState, int32_t keySwitch) | Sets the key switch of the key status enum object. | -| int32_t [OH_Input_GetKeySwitch](input.md#oh_input_getkeyswitch) (const struct [Input_KeyState](input.md#input_keystate) \*keyState) | Obtains the key switch of the key status enum object. | -| int32_t [OH_Input_InjectKeyEvent](input.md#oh_input_injectkeyevent) (const struct [Input_KeyEvent](input.md#input_keyevent) \*keyEvent) | Injects a key event. | -| struct [Input_KeyEvent](input.md#input_keyevent) \* [OH_Input_CreateKeyEvent](input.md#oh_input_createkeyevent) () | Creates a key event object. | -| void [OH_Input_DestroyKeyEvent](input.md#oh_input_destroykeyevent) (struct [Input_KeyEvent](input.md#input_keyevent) \*\*keyEvent) | Destroys a key event object. | -| void [OH_Input_SetKeyEventAction](input.md#oh_input_setkeyeventaction) (struct [Input_KeyEvent](input.md#input_keyevent) \*keyEvent, int32_t action) | Sets the key event type. | -| int32_t [OH_Input_GetKeyEventAction](input.md#oh_input_getkeyeventaction) (const struct [Input_KeyEvent](input.md#input_keyevent) \*keyEvent) | Obtains the key event type. | -| void [OH_Input_SetKeyEventKeyCode](input.md#oh_input_setkeyeventkeycode) (struct [Input_KeyEvent](input.md#input_keyevent) \*keyEvent, int32_t keyCode) | Sets the key code value for a key event. | -| int32_t [OH_Input_GetKeyEventKeyCode](input.md#oh_input_getkeyeventkeycode) (const struct [Input_KeyEvent](input.md#input_keyevent) \*keyEvent) | Obtains the key code value of a key event. | -| void [OH_Input_SetKeyEventActionTime](input.md#oh_input_setkeyeventactiontime) (struct [Input_KeyEvent](input.md#input_keyevent) \*keyEvent, int64_t actionTime) | Sets the time when a key event occurs. | -| int64_t [OH_Input_GetKeyEventActionTime](input.md#oh_input_getkeyeventactiontime) (const struct [Input_KeyEvent](input.md#input_keyevent) \*keyEvent) | Obtains the time when a key event occurs. | -| void [OH_Input_SetKeyEventWindowId](input.md#oh_input_setkeyeventwindowid) (struct [Input_KeyEvent](input.md#input_keyevent) \*keyEvent, int32_t windowId) | Sets the window ID of a key event. | -| int32_t [OH_Input_GetKeyEventWindowId](input.md#oh_input_getkeyeventwindowid) (const struct [Input_KeyEvent](input.md#input_keyevent) \*keyEvent) | Obtains the window ID of a key event. | -| void [OH_Input_SetKeyEventDisplayId](input.md#oh_input_setkeyeventdisplayid) (struct [Input_KeyEvent](input.md#input_keyevent) \*keyEvent, int32_t displayId) | Sets the screen ID of a key event. | -| int32_t [OH_Input_GetKeyEventDisplayId](input.md#oh_input_getkeyeventdisplayid) (const struct [Input_KeyEvent](input.md#input_keyevent) \*keyEvent) | Obtains the screen ID of a key event. | -| int32_t [OH_Input_InjectMouseEvent](input.md#oh_input_injectmouseevent) (const struct [Input_MouseEvent](input.md#input_mouseevent) \*mouseEvent) | Injects a mouse event. | -| struct [Input_MouseEvent](input.md#input_mouseevent) \* [OH_Input_CreateMouseEvent](input.md#oh_input_createmouseevent) () | Creates a mouse event object. | -| void [OH_Input_DestroyMouseEvent](input.md#oh_input_destroymouseevent) (struct [Input_MouseEvent](input.md#input_mouseevent) \*\*mouseEvent) | Destroys a mouse event object. | -| void [OH_Input_SetMouseEventAction](input.md#oh_input_setmouseeventaction) (struct [Input_MouseEvent](input.md#input_mouseevent) \*mouseEvent, int32_t action) | Sets the action for a mouse event. | -| int32_t [OH_Input_GetMouseEventAction](input.md#oh_input_getmouseeventaction) (const struct [Input_MouseEvent](input.md#input_mouseevent) \*mouseEvent) | Obtains the action of a mouse event. | -| void [OH_Input_SetMouseEventDisplayX](input.md#oh_input_setmouseeventdisplayx) (struct [Input_MouseEvent](input.md#input_mouseevent) \*mouseEvent, int32_t displayX) | Sets the X coordinate for a mouse event. | -| int32_t [OH_Input_GetMouseEventDisplayX](input.md#oh_input_getmouseeventdisplayx) (const struct [Input_MouseEvent](input.md#input_mouseevent) \*mouseEvent) | Obtains the X coordinate of a mouse event.| -| void [OH_Input_SetMouseEventDisplayY](input.md#oh_input_setmouseeventdisplayy) (struct [Input_MouseEvent](input.md#input_mouseevent) \*mouseEvent, int32_t displayY) | Sets the Y coordinate for a mouse event. | -| int32_t [OH_Input_GetMouseEventDisplayY](input.md#oh_input_getmouseeventdisplayy) (const struct [Input_MouseEvent](input.md#input_mouseevent) \*mouseEvent) | Obtains the Y coordinate of a mouse event. | -| void [OH_Input_SetMouseEventButton](input.md#oh_input_setmouseeventbutton) (struct [Input_MouseEvent](input.md#input_mouseevent) \*mouseEvent, int32_t button) | Sets the button for a mouse event. | -| int32_t [OH_Input_GetMouseEventButton](input.md#oh_input_getmouseeventbutton) (const struct [Input_MouseEvent](input.md#input_mouseevent) \*mouseEvent) | Obtains the button of a mouse event. | -| void [OH_Input_SetMouseEventAxisType](input.md#oh_input_setmouseeventaxistype) (struct [Input_MouseEvent](input.md#input_mouseevent) \*mouseEvent, int32_t axisType) | Sets the axis type for a mouse event. | -| int32_t [OH_Input_GetMouseEventAxisType](input.md#oh_input_getmouseeventaxistype) (const struct [Input_MouseEvent](input.md#input_mouseevent) \*mouseEvent) | Obtains the axis type of a mouse event. | -| void [OH_Input_SetMouseEventAxisValue](input.md#oh_input_setmouseeventaxisvalue) (struct [Input_MouseEvent](input.md#input_mouseevent) \*mouseEvent, float axisValue) | Sets the axis value for a mouse axis event. | -| float [OH_Input_GetMouseEventAxisValue](input.md#oh_input_getmouseeventaxisvalue) (const struct [Input_MouseEvent](input.md#input_mouseevent) \*mouseEvent) | Obtains the axis value of a mouse axis event. | -| void [OH_Input_SetMouseEventActionTime](input.md#oh_input_setmouseeventactiontime) (struct [Input_MouseEvent](input.md#input_mouseevent) \*mouseEvent, int64_t actionTime) | Sets the time when a mouse event occurs.| -| int64_t [OH_Input_GetMouseEventActionTime](input.md#oh_input_getmouseeventactiontime) (const struct [Input_MouseEvent](input.md#input_mouseevent) \*mouseEvent) | Obtains the time when a mouse event occurs. | -| void [OH_Input_SetMouseEventWindowId](input.md#oh_input_setmouseeventwindowid) (struct [Input_MouseEvent](input.md#input_mouseevent) \*mouseEvent, int32_t windowId) | Sets the window ID of a mouse event. | -| int32_t [OH_Input_GetMouseEventWindowId](input.md#oh_input_getmouseeventwindowid) (const struct [Input_MouseEvent](input.md#input_mouseevent) \*mouseEvent) | Obtains the window ID of a mouse event. | -| void [OH_Input_SetMouseEventDisplayId](input.md#oh_input_setmouseeventdisplayid) (struct [Input_MouseEvent](input.md#input_mouseevent) \*mouseEvent, int32_t displayId) | Sets the screen ID of a mouse event. | -| int32_t [OH_Input_GetMouseEventDisplayId](input.md#oh_input_getmouseeventdisplayid) (const struct [Input_MouseEvent](input.md#input_mouseevent) \*mouseEvent) | Obtains the screen ID of a mouse event. | -| int32_t [OH_Input_InjectTouchEvent](input.md#oh_input_injecttouchevent) (const struct [Input_TouchEvent](input.md#input_touchevent) \*touchEvent) | Injects a touch event. | -| struct [Input_TouchEvent](input.md#input_touchevent) \* [OH_Input_CreateTouchEvent](input.md#oh_input_createtouchevent) () | Creates a touch event object. | -| void [OH_Input_DestroyTouchEvent](input.md#oh_input_destroytouchevent) (struct [Input_TouchEvent](input.md#input_touchevent) \*\*touchEvent) | Destroys a touch event object. | -| void [OH_Input_SetTouchEventAction](input.md#oh_input_settoucheventaction) (struct [Input_TouchEvent](input.md#input_touchevent) \*touchEvent, int32_t action) | Sets the action for a touch event. | -| int32_t [OH_Input_GetTouchEventAction](input.md#oh_input_gettoucheventaction) (const struct [Input_TouchEvent](input.md#input_touchevent) \*touchEvent) | Obtains the action of a touch event. | -| void [OH_Input_SetTouchEventFingerId](input.md#oh_input_settoucheventfingerid) (struct [Input_TouchEvent](input.md#input_touchevent) \*touchEvent, int32_t id) | Sets the finger ID for a touch event. | -| int32_t [OH_Input_GetTouchEventFingerId](input.md#oh_input_gettoucheventfingerid) (const struct [Input_TouchEvent](input.md#input_touchevent) \*touchEvent) | Obtains the finger ID of a touch event. | -| void [OH_Input_SetTouchEventDisplayX](input.md#oh_input_settoucheventdisplayx) (struct [Input_TouchEvent](input.md#input_touchevent) \*touchEvent, int32_t displayX) | Sets the X coordinate for a touch event. | -| int32_t [OH_Input_GetTouchEventDisplayX](input.md#oh_input_gettoucheventdisplayx) (const struct [Input_TouchEvent](input.md#input_touchevent) \*touchEvent) | Obtains the X coordinate of a touch event. | -| void [OH_Input_SetTouchEventDisplayY](input.md#oh_input_settoucheventdisplayy) (struct [Input_TouchEvent](input.md#input_touchevent) \*touchEvent, int32_t displayY) | Sets the Y coordinate for a touch event. | -| int32_t [OH_Input_GetTouchEventDisplayY](input.md#oh_input_gettoucheventdisplayy) (const struct [Input_TouchEvent](input.md#input_touchevent) \*touchEvent) | Obtains the Y coordinate of a touch event. | -| void [OH_Input_SetTouchEventActionTime](input.md#oh_input_settoucheventactiontime) (struct [Input_TouchEvent](input.md#input_touchevent) \*touchEvent, int64_t actionTime) | Sets the time when a touch event occurs. | -| int64_t [OH_Input_GetTouchEventActionTime](input.md#oh_input_gettoucheventactiontime) (const struct [Input_TouchEvent](input.md#input_touchevent) \*touchEvent) | Obtains the time when a touch event occurs. | -| void [OH_Input_SetTouchEventWindowId](input.md#oh_input_settoucheventwindowid) (struct [Input_TouchEvent](input.md#input_touchevent) \*touchEvent, int32_t windowId) | Sets the window ID of a touchscreen event. | -| int32_t [OH_Input_GetTouchEventWindowId](input.md#oh_input_gettoucheventwindowid) (const struct [Input_TouchEvent](input.md#input_touchevent) \*touchEvent) | Obtains the window ID of a touchscreen event. | -| void [OH_Input_SetTouchEventDisplayId](input.md#oh_input_settoucheventdisplayid) (struct [Input_TouchEvent](input.md#input_touchevent) \*touchEvent, int32_t displayId) | Sets the screen ID of a touchscreen event. | -| int32_t [OH_Input_GetTouchEventDisplayId](input.md#oh_input_gettoucheventdisplayid) (const struct [Input_TouchEvent](input.md#input_touchevent) \*touchEvent) | Obtains the screen ID of a touchscreen event. | -| void [OH_Input_CancelInjection](input.md#oh_input_cancelinjection) () | Stops event injection and revokes authorization. | -| [Input_AxisEvent](input.md#input_axisevent) \* [OH_Input_CreateAxisEvent](input.md#oh_input_createaxisevent) (void) | Creates an axis event object. | -| [Input_Result](input.md#input_result) [OH_Input_DestroyAxisEvent](input.md#oh_input_destroyaxisevent) ([Input_AxisEvent](input.md#input_axisevent) \*\*axisEvent) | Destroys an axis event object. | -| [Input_Result](input.md#input_result) [OH_Input_SetAxisEventAction](input.md#oh_input_setaxiseventaction) ([Input_AxisEvent](input.md#input_axisevent) \*axisEvent, [InputEvent_AxisAction](input.md#inputevent_axisaction) action) | Sets the action for an axis event. | -| [Input_Result](input.md#input_result) [OH_Input_GetAxisEventAction](input.md#oh_input_getaxiseventaction) (const [Input_AxisEvent](input.md#input_axisevent) \*axisEvent, [InputEvent_AxisAction](input.md#inputevent_axisaction) \*action) | Obtains the action of an axis event. | -| [Input_Result](input.md#input_result) [OH_Input_SetAxisEventDisplayX](input.md#oh_input_setaxiseventdisplayx) ([Input_AxisEvent](input.md#input_axisevent) \*axisEvent, float displayX) | Sets the X coordinate for an axis event. | -| [Input_Result](input.md#input_result) [OH_Input_GetAxisEventDisplayX](input.md#oh_input_getaxiseventdisplayx) (const [Input_AxisEvent](input.md#input_axisevent) \*axisEvent, float \*displayX) | Obtains the X coordinate of an axis event. | -| [Input_Result](input.md#input_result) [OH_Input_SetAxisEventDisplayY](input.md#oh_input_setaxiseventdisplayy) ([Input_AxisEvent](input.md#input_axisevent) \*axisEvent, float displayY) | Sets the Y coordinate for an axis event. | -| [Input_Result](input.md#input_result) [OH_Input_GetAxisEventDisplayY](input.md#oh_input_getaxiseventdisplayy) (const [Input_AxisEvent](input.md#input_axisevent) \*axisEvent, float \*displayY) | Obtains the Y coordinate of an axis event. | -| [Input_Result](input.md#input_result) [OH_Input_SetAxisEventAxisValue](input.md#oh_input_setaxiseventaxisvalue) ([Input_AxisEvent](input.md#input_axisevent) \*axisEvent, [InputEvent_AxisType](input.md#inputevent_axistype) axisType, double axisValue) | Sets the axis value of the axis type specified by the axis event. | -| [Input_Result](input.md#input_result) [OH_Input_GetAxisEventAxisValue](input.md#oh_input_getaxiseventaxisvalue) (const [Input_AxisEvent](input.md#input_axisevent) \*axisEvent, [InputEvent_AxisType](input.md#inputevent_axistype) axisType, double \*axisValue) | Obtains the axis value for the specified axis type of the axis event. | -| [Input_Result](input.md#input_result) [OH_Input_SetAxisEventActionTime](input.md#oh_input_setaxiseventactiontime) ([Input_AxisEvent](input.md#input_axisevent) \*axisEvent, int64_t actionTime) | Sets the time when an axis event occurs. | -| [Input_Result](input.md#input_result) [OH_Input_GetAxisEventActionTime](input.md#oh_input_getaxiseventactiontime) (const [Input_AxisEvent](input.md#input_axisevent) \*axisEvent, int64_t \*actionTime) | Obtains the time when an axis event occurs. | -| [Input_Result](input.md#input_result) [OH_Input_SetAxisEventType](input.md#oh_input_setaxiseventtype) ([Input_AxisEvent](input.md#input_axisevent) \*axisEvent, [InputEvent_AxisEventType](input.md#inputevent_axiseventtype) axisEventType) | Sets the axis event type. | -| [Input_Result](input.md#input_result) [OH_Input_GetAxisEventType](input.md#oh_input_getaxiseventtype) (const [Input_AxisEvent](input.md#input_axisevent) \*axisEvent, [InputEvent_AxisEventType](input.md#inputevent_axiseventtype) \*axisEventType) | Obtains the axis event type. | -| [Input_Result](input.md#input_result) [OH_Input_SetAxisEventSourceType](input.md#oh_input_setaxiseventsourcetype) ([Input_AxisEvent](input.md#input_axisevent) \*axisEvent, [InputEvent_SourceType](input.md#inputevent_sourcetype) sourceType) | Sets the axis event source type. | -| [Input_Result](input.md#input_result) [OH_Input_GetAxisEventSourceType](input.md#oh_input_getaxiseventsourcetype) (const [Input_AxisEvent](input.md#input_axisevent) \*axisEvent, [InputEvent_SourceType](input.md#inputevent_sourcetype) \*sourceType) | Obtains the axis event source type. | -| [Input_Result](input.md#input_result) [OH_Input_SetAxisEventWindowId](input.md#oh_input_setaxiseventwindowid) ([Input_AxisEvent](input.md#input_axisevent) \*axisEvent, int32_t windowId) | Sets the window ID of an axis event. | -| [Input_Result](input.md#input_result) [OH_Input_GetAxisEventWindowId](input.md#oh_input_getaxiseventwindowid) (const [Input_AxisEvent](input.md#input_axisevent) \*axisEvent, int32_t \*windowId) | Obtains the window ID of an axis event. | -| [Input_Result](input.md#input_result) [OH_Input_SetAxisEventDisplayId](input.md#oh_input_setaxiseventdisplayid) ([Input_AxisEvent](input.md#input_axisevent) \*axisEvent, int32_t displayId) | Sets the screen ID of an axis event. | -| [Input_Result](input.md#input_result) [OH_Input_GetAxisEventDisplayId](input.md#oh_input_getaxiseventdisplayid) (const [Input_AxisEvent](input.md#input_axisevent) \*axisEvent, int32_t \*displayId) | Obtains the screen ID of an axis event. | -| [Input_Result](input.md#input_result) [OH_Input_AddKeyEventMonitor](input.md#oh_input_addkeyeventmonitor) ([Input_KeyEventCallback](input.md#input_keyeventcallback) callback) | Adds a listener for key events. | -| [Input_Result](input.md#input_result) [OH_Input_AddMouseEventMonitor](input.md#oh_input_addmouseeventmonitor) ([Input_MouseEventCallback](input.md#input_mouseeventcallback) callback) | Adds a listener for mouse events, including mouse click and movement events, but not scroll wheel events. Scroll wheel events are axis events. | -| [Input_Result](input.md#input_result) [OH_Input_AddTouchEventMonitor](input.md#oh_input_addtoucheventmonitor) ([Input_TouchEventCallback](input.md#input_toucheventcallback) callback) | Adds a listener for touch events. | -| [Input_Result](input.md#input_result) [OH_Input_AddAxisEventMonitorForAll](input.md#oh_input_addaxiseventmonitorforall) ([Input_AxisEventCallback](input.md#input_axiseventcallback) callback) | Adds a listener for all types of axis events, which are defined in [InputEvent_AxisEventType](input.md#inputevent_axiseventtype). | -| [Input_Result](input.md#input_result) [OH_Input_AddAxisEventMonitor](input.md#oh_input_addaxiseventmonitor) ([InputEvent_AxisEventType](input.md#inputevent_axiseventtype) axisEventType, [Input_AxisEventCallback](input.md#input_axiseventcallback) callback) | Adds a listener for the specified type of axis events, which are defined in [InputEvent_AxisEventType](input.md#inputevent_axiseventtype). | -| [Input_Result](input.md#input_result) [OH_Input_RemoveKeyEventMonitor](input.md#oh_input_removekeyeventmonitor) ([Input_KeyEventCallback](input.md#input_keyeventcallback) callback) | Removes the listener for key events. | -| [Input_Result](input.md#input_result) [OH_Input_RemoveMouseEventMonitor](input.md#oh_input_removemouseeventmonitor) ([Input_MouseEventCallback](input.md#input_mouseeventcallback) callback) | Removes the listener for mouse events. | -| [Input_Result](input.md#input_result) [OH_Input_RemoveTouchEventMonitor](input.md#oh_input_removetoucheventmonitor) ([Input_TouchEventCallback](input.md#input_toucheventcallback) callback) | Removes the listener for touch events. | -| [Input_Result](input.md#input_result) [OH_Input_RemoveAxisEventMonitorForAll](input.md#oh_input_removeaxiseventmonitorforall) ([Input_AxisEventCallback](input.md#input_axiseventcallback) callback) | Removes the listener for all types of axis events. | -| [Input_Result](input.md#input_result) [OH_Input_RemoveAxisEventMonitor](input.md#oh_input_removeaxiseventmonitor) ([InputEvent_AxisEventType](input.md#inputevent_axiseventtype) axisEventType, [Input_AxisEventCallback](input.md#input_axiseventcallback) callback) | Removes the listener for the specified type of axis events, which are defined in [InputEvent_AxisEventType](input.md#inputevent_axiseventtype). | -| [Input_Result](input.md#input_result) [OH_Input_AddKeyEventInterceptor](input.md#oh_input_addkeyeventinterceptor) ([Input_KeyEventCallback](input.md#input_keyeventcallback) callback, [Input_InterceptorOptions](input.md#input_interceptoroptions) \*option) | Adds an interceptor for key events. If multiple interceptors are added, only the first one takes effect. | -| [Input_Result](input.md#input_result) [OH_Input_AddInputEventInterceptor](input.md#oh_input_addinputeventinterceptor) ([Input_InterceptorEventCallback](_input___interceptor_event_callback.md) \*callback [Input_InterceptorOptions](input.md#input_interceptoroptions) \*option) | Adds an interceptor for input events, including mouse, touch, and axis events. If multiple interceptors are added, only the first one takes effect. | -| [Input_Result](input.md#input_result) [OH_Input_RemoveKeyEventInterceptor](input.md#oh_input_removekeyeventinterceptor) (void) | Removes the interceptor for key events. | -| [Input_Result](input.md#input_result) [OH_Input_RemoveInputEventInterceptor](input.md#oh_input_removeinputeventinterceptor) (void) | Removes the interceptor for input events, including mouse, touch, and axis events. | -| [Input_Result](input.md#input_result) [OH_Input_GetIntervalSinceLastInput](input.md#oh_input_getintervalsincelastinput) (int64_t \*timeInterval) | Obtains the interval since the last system input event. | -| [Input_Hotkey](input.md#input_hotkey) \* [OH_Input_CreateHotkey](input.md#oh_input_createhotkey) (void) | Creates a shortcut key object. | -| void [OH_Input_DestroyHotkey](input.md#oh_input_destroyhotkey) ([Input_Hotkey](input.md#input_hotkey) \*\*hotkey) | Destroys a shortcut key object. | -| void [OH_Input_SetPreKeys](input.md#oh_input_setprekeys) ([Input_Hotkey](input.md#input_hotkey) \*hotkey, int32_t \*preKeys, int32_t size) | Sets the modifier key. | -| [Input_Result](input.md#input_result) [OH_Input_GetPreKeys](input.md#oh_input_getprekeys) (const [Input_Hotkey](input.md#input_hotkey) \*hotkey, int32_t \*\*preKeys, int32_t \*preKeyCount) | Obtains the modifier key. | -| void [OH_Input_SetFinalKey](input.md#oh_input_setfinalkey) ([Input_Hotkey](input.md#input_hotkey) \*hotkey, int32_t finalKey) | Sets the modified key. | -| [Input_Result](input.md#input_result) [OH_Input_GetFinalKey](input.md#oh_input_getfinalkey) (const [Input_Hotkey](input.md#input_hotkey) \*hotkey, int32_t \*finalKeyCode) | Obtains the modified key. | -| [Input_Hotkey](input.md#input_hotkey) \*\* [OH_Input_CreateAllSystemHotkeys](input.md#oh_input_createallsystemhotkeys) (int32_t count) | Creates an array of [Input_Hotkey](input.md#input_hotkey) instances. | -| void [OH_Input_DestroyAllSystemHotkeys](input.md#oh_input_destroyallsystemhotkeys) ([Input_Hotkey](input.md#input_hotkey) \*\*hotkeys, int32_t count) | Destroys the array of [Input_Hotkey](input.md#input_hotkey) instances and reclaims the memory. | -| [Input_Result](input.md#input_result) [OH_Input_GetAllSystemHotkeys](input.md#oh_input_getallsystemhotkeys) ([Input_Hotkey](input.md#input_hotkey) \*\*hotkey, int32_t \*count) | Obtains all configured shortcut keys. | -| void [OH_Input_SetRepeat](input.md#oh_input_setrepeat) ([Input_Hotkey](input.md#input_hotkey) \*hotkey, bool isRepeat) | Specifies whether to report repeated key events. | -| [Input_Result](input.md#input_result) [OH_Input_GetRepeat](input.md#oh_input_getrepeat) (const [Input_Hotkey](input.md#input_hotkey) \*hotkey, bool \*isRepeat) | Checks whether to report repeated key events. | -| [Input_Result](input.md#input_result) [OH_Input_AddHotkeyMonitor](input.md#oh_input_addhotkeymonitor) (const [Input_Hotkey](input.md#input_hotkey) \*hotkey, [Input_HotkeyCallback](input.md#input_hotkeycallback) callback) | Subscribes to shortcut key events. This API is not applicable to wearables and lite wearables. | -| [Input_Result](input.md#input_result) [OH_Input_RemoveHotkeyMonitor](input.md#oh_input_removehotkeymonitor) (const [Input_Hotkey](input.md#input_hotkey) \*hotkey, [Input_HotkeyCallback](input.md#input_hotkeycallback) callback) | Unsubscribes from shortcut key events. | -| [Input_Result](input.md#input_result) [OH_Input_GetDeviceIds](input.md#oh_input_getdeviceids) (int32_t \*deviceIds, int32_t inSize, int32_t \*outSize) | Obtains the IDs of all input devices. | -| [Input_Result](input.md#input_result) [OH_Input_GetDevice](input.md#oh_input_getdevice) (int32_t deviceId, [Input_DeviceInfo](input.md#input_deviceinfo) \*\*deviceInfo) | Obtains information about the input device. | -| [Input_DeviceInfo](input.md#input_deviceinfo) \* [OH_Input_CreateDeviceInfo](input.md#oh_input_createdeviceinfo) (void) | Creates a **deviceInfo** object. | -| void [OH_Input_DestroyDeviceInfo](input.md#oh_input_destroydeviceinfo) ([Input_DeviceInfo](input.md#input_deviceinfo) \*\*deviceInfo) | Destroys a **deviceInfo** object. | -| [Input_Result](input.md#input_result) [OH_Input_GetKeyboardType](input.md#oh_input_getkeyboardtype) (int32_t deviceId, int32_t \*keyboardType) | Obtains the keyboard type of the input device. | -| [Input_Result](input.md#input_result) [OH_Input_GetDeviceId](input.md#oh_input_getdeviceid) ([Input_DeviceInfo](input.md#input_deviceinfo) \*deviceInfo, int32_t \*id) | Obtains the ID of an input device. | -| [Input_Result](input.md#input_result) [OH_Input_GetDeviceName](input.md#oh_input_getdevicename) ([Input_DeviceInfo](input.md#input_deviceinfo) \*deviceInfo, char \*\*name) | Obtains the name of an input device. | -| [Input_Result](input.md#input_result) [OH_Input_GetCapabilities](input.md#oh_input_getcapabilities) ([Input_DeviceInfo](input.md#input_deviceinfo) \*deviceInfo, int32_t \*capabilities) | Obtains the capabilities of an input device, for example, a touchscreen, touchpad, or keyboard. | -| [Input_Result](input.md#input_result) [OH_Input_GetDeviceVersion](input.md#oh_input_getdeviceversion) ([Input_DeviceInfo](input.md#input_deviceinfo) \*deviceInfo, int32_t \*version) | Obtains the version information of an input device. | -| [Input_Result](input.md#input_result) [OH_Input_GetDeviceProduct](input.md#oh_input_getdeviceproduct) ([Input_DeviceInfo](input.md#input_deviceinfo) \*deviceInfo, int32_t \*product) | Obtains the product information of an input device. | -| [Input_Result](input.md#input_result) [OH_Input_GetDeviceVendor](input.md#oh_input_getdevicevendor) ([Input_DeviceInfo](input.md#input_deviceinfo) \*deviceInfo, int32_t \*vendor) | Obtains the vendor information of an input device. | -| [Input_Result](input.md#input_result) [OH_Input_GetDeviceAddress](input.md#oh_input_getdeviceaddress) ([Input_DeviceInfo](input.md#input_deviceinfo) \*deviceInfo, char \*\*address) | Obtains the physical address of an input device. | -| [Input_Result](input.md#input_result) [OH_Input_RegisterDeviceListener](input.md#oh_input_registerdevicelistener) ([Input_DeviceListener](_input___device_listener.md) \*listener) | Registers a listener for device hot swap events. | -| [Input_Result](input.md#input_result) [OH_Input_UnregisterDeviceListener](input.md#oh_input_unregisterdevicelistener) ([Input_DeviceListener](_input___device_listener.md) \*listener) | Unregisters the listener for device hot swap events. | -| [Input_Result](input.md#input_result) [OH_Input_UnregisterDeviceListeners](input.md#oh_input_unregisterdevicelisteners) () | Unregisters the listener for all device hot swap events. | -| [Input_Result](input.md#input_result) [OH_Input_GetFunctionKeyState](input.md#oh_input_getfunctionkeystate) (int32_t keyCode, int32_t \*state) | Obtains the function key status. | diff --git a/en/application-dev/reference/apis-input-kit/oh__key__code_8h.md b/en/application-dev/reference/apis-input-kit/oh__key__code_8h.md deleted file mode 100644 index ed2a9334a5a..00000000000 --- a/en/application-dev/reference/apis-input-kit/oh__key__code_8h.md +++ /dev/null @@ -1,24 +0,0 @@ -# oh_key_code.h - - -## Overview - -Defines key codes of the key device. - -**System capability**: SystemCapability.MultimodalInput.Input.Core - -**Library**: libohinput.so - -**Since**: 12 - -**Related module**: [Input](input.md) - - -## Summary - - -### Enums - -| Name| Description| -| -------- | -------- | -| [Input_KeyCode](input.md#input_keycode) {
[KEYCODE_UNKNOWN](input.md) = -1, [KEYCODE_FN](input.md) = 0, [KEYCODE_VOLUME_UP](input.md) = 16, [KEYCODE_VOLUME_DOWN](input.md) = 17,
[KEYCODE_POWER](input.md) = 18, [KEYCODE_CAMERA](input.md) = 19, [KEYCODE_VOLUME_MUTE](input.md) = 22, [KEYCODE_MUTE](input.md) = 23,
[KEYCODE_BRIGHTNESS_UP](input.md) = 40, [KEYCODE_BRIGHTNESS_DOWN](input.md) = 41, [KEYCODE_0](input.md) = 2000, [KEYCODE_1](input.md) = 2001,
[KEYCODE_2](input.md) = 2002, [KEYCODE_3](input.md) = 2003, [KEYCODE_4](input.md) = 2004, [KEYCODE_5](input.md) = 2005,
[KEYCODE_6](input.md) = 2006, [KEYCODE_7](input.md) = 2007, [KEYCODE_8](input.md) = 2008, [KEYCODE_9](input.md) = 2009,
[KEYCODE_STAR](input.md) = 2010, [KEYCODE_POUND](input.md) = 2011, [KEYCODE_DPAD_UP](input.md) = 2012, [KEYCODE_DPAD_DOWN](input.md) = 2013,
[KEYCODE_DPAD_LEFT](input.md) = 2014, [KEYCODE_DPAD_RIGHT](input.md) = 2015, [KEYCODE_DPAD_CENTER](input.md) = 2016, [KEYCODE_A](input.md) = 2017,
[KEYCODE_B](input.md) = 2018, [KEYCODE_C](input.md) = 2019, [KEYCODE_D](input.md) = 2020, [KEYCODE_E](input.md) = 2021,
[KEYCODE_F](input.md) = 2022, [KEYCODE_G](input.md) = 2023, [KEYCODE_H](input.md) = 2024, [KEYCODE_I](input.md) = 2025,
[KEYCODE_J](input.md) = 2026, [KEYCODE_K](input.md) = 2027, [KEYCODE_L](input.md) = 2028, [KEYCODE_M](input.md) = 2029,
[KEYCODE_N](input.md) = 2030, [KEYCODE_O](input.md) = 2031, [KEYCODE_P](input.md) = 2032, [KEYCODE_Q](input.md) = 2033,
[KEYCODE_R](input.md) = 2034, [KEYCODE_S](input.md) = 2035, [KEYCODE_T](input.md) = 2036, [KEYCODE_U](input.md) = 2037,
[KEYCODE_V](input.md) = 2038, [KEYCODE_W](input.md) = 2039, [KEYCODE_X](input.md) = 2040, [KEYCODE_Y](input.md) = 2041,
[KEYCODE_Z](input.md) = 2042, [KEYCODE_COMMA](input.md) = 2043, [KEYCODE_PERIOD](input.md) = 2044, [KEYCODE_ALT_LEFT](input.md) = 2045,
[KEYCODE_ALT_RIGHT](input.md) = 2046, [KEYCODE_SHIFT_LEFT](input.md) = 2047, [KEYCODE_SHIFT_RIGHT](input.md) = 2048, [KEYCODE_TAB](input.md) = 2049,
[KEYCODE_SPACE](input.md) = 2050, [KEYCODE_SYM](input.md) = 2051, [KEYCODE_EXPLORER](input.md) = 2052, [KEYCODE_ENVELOPE](input.md) = 2053,
[KEYCODE_ENTER](input.md) = 2054, [KEYCODE_DEL](input.md) = 2055, [KEYCODE_GRAVE](input.md) = 2056, [KEYCODE_MINUS](input.md) = 2057,
[KEYCODE_EQUALS](input.md) = 2058, [KEYCODE_LEFT_BRACKET](input.md) = 2059, [KEYCODE_RIGHT_BRACKET](input.md) = 2060, [KEYCODE_BACKSLASH](input.md) = 2061,
[KEYCODE_SEMICOLON](input.md) = 2062, [KEYCODE_APOSTROPHE](input.md) = 2063, [KEYCODE_SLASH](input.md) = 2064, [KEYCODE_AT](input.md) = 2065,
[KEYCODE_PLUS](input.md) = 2066, [KEYCODE_MENU](input.md) = 2067, [KEYCODE_PAGE_UP](input.md) = 2068, [KEYCODE_PAGE_DOWN](input.md) = 2069,
[KEYCODE_ESCAPE](input.md) = 2070, [KEYCODE_FORWARD_DEL](input.md) = 2071, [KEYCODE_CTRL_LEFT](input.md) = 2072, [KEYCODE_CTRL_RIGHT](input.md) = 2073,
[KEYCODE_CAPS_LOCK](input.md) = 2074, [KEYCODE_SCROLL_LOCK](input.md) = 2075, [KEYCODE_META_LEFT](input.md) = 2076, [KEYCODE_META_RIGHT](input.md) = 2077,
[KEYCODE_FUNCTION](input.md) = 2078, [KEYCODE_SYSRQ](input.md) = 2079, [KEYCODE_BREAK](input.md) = 2080, [KEYCODE_MOVE_HOME](input.md) = 2081,
[KEYCODE_MOVE_END](input.md) = 2082, [KEYCODE_INSERT](input.md) = 2083, [KEYCODE_FORWARD](input.md) = 2084, [KEYCODE_MEDIA_PLAY](input.md) = 2085,
[KEYCODE_MEDIA_PAUSE](input.md) = 2086, [KEYCODE_MEDIA_CLOSE](input.md) = 2087, [KEYCODE_MEDIA_EJECT](input.md) = 2088, [KEYCODE_MEDIA_RECORD](input.md) = 2089,
[KEYCODE_F1](input.md) = 2090, [KEYCODE_F2](input.md) = 2091, [KEYCODE_F3](input.md) = 2092, [KEYCODE_F4](input.md) = 2093,
[KEYCODE_F5](input.md) = 2094, [KEYCODE_F6](input.md) = 2095, [KEYCODE_F7](input.md) = 2096, [KEYCODE_F8](input.md) = 2097,
[KEYCODE_F9](input.md) = 2098, [KEYCODE_F10](input.md) = 2099, [KEYCODE_F11](input.md) = 2100, [KEYCODE_F12](input.md) = 2101,
[KEYCODE_NUM_LOCK](input.md) = 2102, [KEYCODE_NUMPAD_0](input.md) = 2103, [KEYCODE_NUMPAD_1](input.md) = 2104, [KEYCODE_NUMPAD_2](input.md) = 2105,
[KEYCODE_NUMPAD_3](input.md) = 2106, [KEYCODE_NUMPAD_4](input.md) = 2107, [KEYCODE_NUMPAD_5](input.md) = 2108, [KEYCODE_NUMPAD_6](input.md) = 2109,
[KEYCODE_NUMPAD_7](input.md) = 2110, [KEYCODE_NUMPAD_8](input.md) = 2111, [KEYCODE_NUMPAD_9](input.md) = 2112, [KEYCODE_NUMPAD_DIVIDE](input.md) = 2113,
[KEYCODE_NUMPAD_MULTIPLY](input.md) = 2114, [KEYCODE_NUMPAD_SUBTRACT](input.md) = 2115, [KEYCODE_NUMPAD_ADD](input.md) = 2116, [KEYCODE_NUMPAD_DOT](input.md) = 2117,
[KEYCODE_NUMPAD_COMMA](input.md) = 2118, [KEYCODE_NUMPAD_ENTER](input.md) = 2119, [KEYCODE_NUMPAD_EQUALS](input.md) = 2120, [KEYCODE_NUMPAD_LEFT_PAREN](input.md) = 2121,
[KEYCODE_NUMPAD_RIGHT_PAREN](input.md) = 2122, [KEYCODE_DAGGER_CLICK](input.md) = 3211, [KEYCODE_DAGGER_DOUBLE_CLICK](input.md) = 3212, [KEYCODE_DAGGER_LONG_PRESS](input.md) = 3213
} | Key code values. | diff --git a/en/application-dev/reference/apis-media-kit/_a_v_image_generator.md b/en/application-dev/reference/apis-media-kit/_a_v_image_generator.md deleted file mode 100644 index bb21517469a..00000000000 --- a/en/application-dev/reference/apis-media-kit/_a_v_image_generator.md +++ /dev/null @@ -1,223 +0,0 @@ -# AVImageGenerator - - -## Overview - -The AVImageGenerator module provides the APIs for extracting video frames at given time points from videos. - -**System capability**: SystemCapability.Multimedia.Media.AVImageGenerator - -**Since**: 18 - - -## Summary - - -### Files - -| Name| Description| -| -------- | -------- | -| [avimage_generator.h](avimage__generator_8h.md) | Declares the AVImageGenerator APIs. With these native APIs, you can extract video frames at given time points from videos. | -| [avimage_generator_base.h](avimage__generator__base_8h.md) | Declares the enums used by the AVImageGenerator. | - - -### Types - -| Name| Description| -| -------- | -------- | -| typedef struct [OH_AVImageGenerator](#oh_avimagegenerator) [OH_AVImageGenerator](#oh_avimagegenerator) | Defines a struct for the OH_AVImageGenerator. | -| typedef enum [OH_AVImageGenerator_QueryOptions](#oh_avimagegenerator_queryoptions-1) [OH_AVImageGenerator_QueryOptions](#oh_avimagegenerator_queryoptions) | Defines an enum for the mappings between time points and video frames. | - - -### Enums - -| Name| Description| -| -------- | -------- | -| [OH_AVImageGenerator_QueryOptions](#oh_avimagegenerator_queryoptions-1) {
OH_AVIMAGE_GENERATOR_QUERY_NEXT_SYNC = 0,
OH_AVIMAGE_GENERATOR_QUERY_PREVIOUS_SYNC = 1,
OH_AVIMAGE_GENERATOR_QUERY_CLOSEST_SYNC = 2,
OH_AVIMAGE_GENERATOR_QUERY_CLOSEST = 3 } | Enumerates the mappings between time points and video frames. | - - -### Functions - -| Name| Description| -| -------- | -------- | -| [OH_AVImageGenerator](#oh_avimagegenerator) \* [OH_AVImageGenerator_Create](#oh_avimagegenerator_create) (void) | Creates an **OH_AVImageGenerator** instance. | -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVImageGenerator_SetFDSource](#oh_avimagegenerator_setfdsource) ([OH_AVImageGenerator](#oh_avimagegenerator) \*generator, int32_t fd, int64_t offset, int64_t size) | Sets a data source based on the media file descriptor. | -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVImageGenerator_FetchFrameByTime](#oh_avimagegenerator_fetchframebytime) ([OH_AVImageGenerator](#oh_avimagegenerator) \*generator, int64_t timeUs, [OH_AVImageGenerator_QueryOptions](#oh_avimagegenerator_queryoptions) options, OH_PixelmapNative \*\*pixelMap) | Extracts a video frame at a given time from a video. | -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVImageGenerator_Release](#oh_avimagegenerator_release) ([OH_AVImageGenerator](#oh_avimagegenerator) \*generator) | Releases the resources used by the **OH_AVImageGenerator** instance and destroys the instance. | - - -## Type Description - - -### OH_AVImageGenerator - -``` -typedef struct OH_AVImageGenerator OH_AVImageGenerator -``` -**Description** - -Defines a struct for the OH_AVImageGenerator. - -**System capability**: SystemCapability.Multimedia.Media.AVImageGenerator - -**Since**: 18 - - -### OH_AVImageGenerator_QueryOptions - -``` -typedef enum OH_AVImageGenerator_QueryOptions OH_AVImageGenerator_QueryOptions -``` -**Description** - -Defines an enum for the mappings between time points and video frames. - -**System capability**: SystemCapability.Multimedia.Media.AVImageGenerator - -**Since**: 18 - - -## Enum Description - - -### OH_AVImageGenerator_QueryOptions - -``` -enum OH_AVImageGenerator_QueryOptions -``` -**Description** - -Enumerates the mappings between time points and video frames. - -**System capability**: SystemCapability.Multimedia.Media.AVImageGenerator - -**Since**: 18 - -| Value| Description| -| -------- | -------- | -| OH_AVIMAGE_GENERATOR_QUERY_NEXT_SYNC | Extracts the key frame at or next to the specified time. | -| OH_AVIMAGE_GENERATOR_QUERY_PREVIOUS_SYNC | Extracts the key frame at or prior to the specified time. | -| OH_AVIMAGE_GENERATOR_QUERY_CLOSEST_SYNC | Extracts the key frame closest to the specified time. | -| OH_AVIMAGE_GENERATOR_QUERY_CLOSEST | Extracts the frame (not necessarily a key frame) closest to the specified time. | - - -## Function Description - - -### OH_AVImageGenerator_Create() - -``` -OH_AVImageGenerator* OH_AVImageGenerator_Create(void) -``` -**Description** - -Creates an **OH_AVImageGenerator** instance. - -**System capability**: SystemCapability.Multimedia.Media.AVImageGenerator - -**Since**: 18 - -**Returns** - -Returns the pointer to the **OH_AVImageGenerator** instance created if the operation is successful; returns a null pointer otherwise. - -Possible cause of failures: HstEngineFactory fails to create an AVMetadataHelperEngine. - - -### OH_AVImageGenerator_FetchFrameByTime() - -``` -OH_AVErrCode OH_AVImageGenerator_FetchFrameByTime(OH_AVImageGenerator* generator, int64_t timeUs, OH_AVImageGenerator_QueryOptions options, OH_PixelmapNative** pixelMap) -``` -**Description** - -Extracts a video frame at a given time from a video. - -This function must be called after [SetFDSource](#oh_avimagegenerator_setfdsource). - -**System capability**: SystemCapability.Multimedia.Media.AVImageGenerator - -**Parameters** - -| Name| Description| -| -------- | -------- | -| generator | Pointer to an **OH_AVImageGenerator** instance. | -| timeUs | Time point of the video frame to be extracted in the video, in μs. | -| options | Mappings between the given time points and video frames. For details, see [OH_AVImageGenerator_QueryOptions](#oh_avimagegenerator_queryoptions-1). | -| pixelMap | Double pointer to the video frame object obtained. For details, see {@link OH_PixelmapNative}. | - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The operation is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **generator** is a null pointer or an input parameter is invalid. - -**AV_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. - -**AV_ERR_UNSUPPORTED_FORMAT**: The format is not supported. - -**AV_ERR_NO_MEMORY**: Internal memory allocation failed. - -### OH_AVImageGenerator_Release() - -``` -OH_AVErrCode OH_AVImageGenerator_Release(OH_AVImageGenerator* generator) -``` -**Description** - -Releases the resources used by the **OH_AVImageGenerator** instance and destroys the instance. - -**System capability**: SystemCapability.Multimedia.Media.AVImageGenerator - -**Since**: 18 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| generator | Pointer to an **OH_AVImageGenerator** instance. | - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The operation is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **generator** is a null pointer or an input parameter is invalid. - - -### OH_AVImageGenerator_SetFDSource() - -``` -OH_AVErrCode OH_AVImageGenerator_SetFDSource(OH_AVImageGenerator* generator, int32_t fd, int64_t offset, int64_t size) -``` -**Description** - -Sets a data source based on the media file descriptor. - -**System capability**: SystemCapability.Multimedia.Media.AVImageGenerator - -**Since**: 18 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| generator | Pointer to an **OH_AVImageGenerator** instance. | -| fd | File descriptor of the media source. | -| offset | Offset of the media source in the file descriptor. | -| size | Size of the media source. | - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The operation is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **generator** is a null pointer or an input parameter is invalid. - -**AV_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. - -**AV_ERR_NO_MEMORY**: Internal memory allocation failed. diff --git a/en/application-dev/reference/apis-media-kit/_a_v_metadata_extractor.md b/en/application-dev/reference/apis-media-kit/_a_v_metadata_extractor.md deleted file mode 100644 index 0590cec712d..00000000000 --- a/en/application-dev/reference/apis-media-kit/_a_v_metadata_extractor.md +++ /dev/null @@ -1,536 +0,0 @@ -# AVMetadataExtractor - - -## Overview - -The AVMetadataExtractor module provides the APIs for extracting metadata from media assets. - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Since**: 18 - - -## Summary - - -### Files - -| Name| Description| -| -------- | -------- | -| [avmetadata_extractor.h](avmetadata__extractor_8h.md) | Declares the AVMetadataExtractor APIs. With these native APIs, you can obtain metadata from media assets. | -| [avmetadata_extractor_base.h](avmetadata__extractor__base_8h.md) | Declares the constants used by the AVMetadataExtractor. | - - -### Types - -| Name| Description| -| -------- | -------- | -| typedef struct [OH_AVMetadataExtractor](#oh_avmetadataextractor) [OH_AVMetadataExtractor](#oh_avmetadataextractor) | Defines a struct for the OH_AVMetadataExtractor. | - - -### Functions - -| Name| Description| -| -------- | -------- | -| [OH_AVMetadataExtractor](#oh_avmetadataextractor) \* [OH_AVMetadataExtractor_Create](#oh_avmetadataextractor_create) (void) | Creates an **OH_AVMetadataExtractor** instance. | -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVMetadataExtractor_SetFDSource](#oh_avmetadataextractor_setfdsource) ([OH_AVMetadataExtractor](#oh_avmetadataextractor) \*extractor, int32_t fd, int64_t offset, int64_t size) | Sets a data source based on the media file descriptor. | -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVMetadataExtractor_FetchMetadata](#oh_avmetadataextractor_fetchmetadata) ([OH_AVMetadataExtractor](#oh_avmetadataextractor) \*extractor, OH_AVFormat \*avMetadata) | Obtains metadata from a media asset. This function must be called after [SetFDSource](#oh_avmetadataextractor_setfdsource).| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVMetadataExtractor_FetchAlbumCover](#oh_avmetadataextractor_fetchalbumcover) ([OH_AVMetadataExtractor](#oh_avmetadataextractor) \*extractor, OH_PixelmapNative \*\*pixelMap) | Obtains the cover of an audio album. This function must be called after [SetFDSource](#oh_avmetadataextractor_setfdsource).| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVMetadataExtractor_Release](#oh_avmetadataextractor_release) ([OH_AVMetadataExtractor](#oh_avmetadataextractor) \*extractor) | Releases the resources used by the **OH_AVMetadataExtractor** instance and destroys the instance. | - - -### Variables - -| Name| Description| -| -------- | -------- | -| static const char\* [OH_AVMETADATA_EXTRACTOR_ALBUM](#oh_avmetadata_extractor_album) = "album" | Pointer to the key for obtaining the title of the album. The value type is const char\*. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_ALBUM_ARTIST](#oh_avmetadata_extractor_album_artist) = "albumArtist" | Pointer to the key for obtaining the artist of the album. The value type is const char\*. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_ARTIST](#oh_avmetadata_extractor_artist) = "artist" | Pointer to the key for obtaining the artist of the media asset. The value type is const char\*. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_AUTHOR](#oh_avmetadata_extractor_author) = "author" | Pointer to the key for obtaining the author of the media asset. The value type is const char\*. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_DATE_TIME](#oh_avmetadata_extractor_date_time) = "dateTime" | Pointer to the key for obtaining the creation time of the media asset. The value type is const char\*. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_DATE_TIME_FORMAT](#oh_avmetadata_extractor_date_time_format) = "dateTimeFormat" | Pointer to the key for obtaining the creation time of the media asset. The value type is const char\* and the output format is YYYY-MM-DD HH:mm:ss. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_COMPOSER](#oh_avmetadata_extractor_composer) = "composer" | Pointer to the key for obtaining the composer of the media asset. The value type is const char\*. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_DURATION](#oh_avmetadata_extractor_duration) = "duration" | Pointer to the key for obtaining the duration of the media asset, in ms. The value type is int64_t. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_GENRE](#oh_avmetadata_extractor_genre) = "genre" | Pointer to the key for obtaining the type or genre of the media asset. The value type is const char\*. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_HAS_AUDIO](#oh_avmetadata_extractor_has_audio) = "hasAudio" | Pointer to the key for obtaining the flag indicating whether the media asset contains audio. The value type is int32_t. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_HAS_VIDEO](#oh_avmetadata_extractor_has_video) = "hasVideo" | Pointer to the key for obtaining the flag indicating whether the media asset contains video. The value type is int32_t. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_MIME_TYPE](#oh_avmetadata_extractor_mime_type) = "mimeType" | Pointer to the key for obtaining the MIME type of the media asset. The value type is const char\*, for example, video/mp4, audio/mp4, and audio/amr wb. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_TRACK_COUNT](#oh_avmetadata_extractor_track_count) = "trackCount" | Pointer to the key for obtaining the number of tracks of the media asset. The value type is int32_t. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_SAMPLE_RATE](#oh_avmetadata_extractor_sample_rate) = "sampleRate" | Pointer to the key for obtaining the audio sampling rate, in Hz. The value type is int32_t. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_TITLE](#oh_avmetadata_extractor_title) = "title" | Pointer to the key for obtaining the title of the media asset. The value type is const char\*. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_VIDEO_HEIGHT](#oh_avmetadata_extractor_video_height) = "videoHeight" | Pointer to the key for obtaining the video height, in px. The value type is int32_t. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_VIDEO_WIDTH](#oh_avmetadata_extractor_video_width) = "videoWidth" | Pointer to the key for obtaining the video weight, in px. The value type is int32_t. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_VIDEO_ORIENTATION](#oh_avmetadata_extractor_video_orientation) = "videoOrientation" | Pointer to the key for obtaining the video rotation direction, in degrees (°). The value type is int32_t. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_VIDEO_IS_HDR_VIVID](#oh_avmetadata_extractor_video_is_hdr_vivid) = "hdrType" | Pointer to the key for obtaining the flag indicating whether the video is an HDR Vivid video. The value type is int32_t. For details, see the definition of [OH_Core_HdrType](../apis-avcodec-kit/_core.md#oh_core_hdrtype) in [media_types.h](../apis-avcodec-kit/media__types_8h.md). | -| static const char\* [OH_AVMETADATA_EXTRACTOR_LOCATION_LATITUDE](#oh_avmetadata_extractor_location_latitude) = "latitude" | Pointer to the key for obtaining the latitude in the geographical location. The value type is float. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_LOCATION_LONGITUDE](#oh_avmetadata_extractor_location_longitude) = "longitude" | Pointer to the key for obtaining the longitude in the geographical location. The value type is float. | - - -## Type Description - - -### OH_AVMetadataExtractor - -``` -typedef struct OH_AVMetadataExtractor OH_AVMetadataExtractor -``` -**Description** - -Defines a struct for the OH_AVMetadataExtractor. - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Since**: 18 - - -## Function Description - - -### OH_AVMetadataExtractor_Create() - -``` -OH_AVMetadataExtractor* OH_AVMetadataExtractor_Create(void) -``` -**Description** - -Creates an **OH_AVMetadataExtractor** instance. - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Since**: 18 - -**Returns** - -Returns the pointer to the **OH_AVMetadataExtractor** instance created if the operation is successful; returns a null pointer otherwise. - -Possible cause of failures: **HstEngineFactory::CreateAVMetadataHelperEngine** fails to run. - - -### OH_AVMetadataExtractor_FetchAlbumCover() - -``` -OH_AVErrCode OH_AVMetadataExtractor_FetchAlbumCover(OH_AVMetadataExtractor* extractor, OH_PixelmapNative** pixelMap) -``` -**Description** - -Obtains the cover of an audio album. This function must be called after [SetFDSource](#oh_avmetadataextractor_setfdsource). - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Since**: 18 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| extractor | Pointer to an **OH_AVMetadataExtractor** instance. | -| pixelMap | Double pointer to the album cover obtained. For details, see **OH_PixelmapNative**. | - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The operation is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **extractor** is a null pointer or an input parameter is invalid. - -**AV_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. - -**AV_ERR_UNSUPPORTED_FORMAT**: The format is not supported. - -**AV_ERR_NO_MEMORY**: Internal memory allocation failed. - - -### OH_AVMetadataExtractor_FetchMetadata() - -``` -OH_AVErrCode OH_AVMetadataExtractor_FetchMetadata(OH_AVMetadataExtractor* extractor, OH_AVFormat* avMetadata) -``` -**Description** - -Obtains metadata from a media asset. This function must be called after [SetFDSource](#oh_avmetadataextractor_setfdsource). - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Since**: 18 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| extractor | Pointer to an **OH_AVMetadataExtractor** instance. | -| avMetadata | Pointer to an **OH_AVFormat** instance, which contains the obtained metadata. | - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The operation is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **extractor** is a null pointer or an input parameter is invalid. - -**AV_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. - -**AV_ERR_UNSUPPORTED_FORMAT**: The format is not supported. - -**AV_ERR_NO_MEMORY**: Internal memory allocation failed. - - -### OH_AVMetadataExtractor_Release() - -``` -OH_AVErrCode OH_AVMetadataExtractor_Release(OH_AVMetadataExtractor* extractor) -``` -**Description** - -Releases the resources used by the **OH_AVMetadataExtractor** instance and destroys the instance. - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Since**: 18 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| extractor | Pointer to an **OH_AVMetadataExtractor** instance. | - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The operation is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **extractor** is a null pointer or an input parameter is invalid. - - -### OH_AVMetadataExtractor_SetFDSource() - -``` -OH_AVErrCode OH_AVMetadataExtractor_SetFDSource(OH_AVMetadataExtractor* extractor, int32_t fd, int64_t offset, int64_t size) -``` -**Description** - -Sets a data source based on the media file descriptor. - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Since**: 18 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| extractor | Pointer to an **OH_AVMetadataExtractor** instance. | -| fd | File descriptor of the media source. | -| offset | Offset of the media source in the file descriptor. | -| size | Size of the media source. | - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The operation is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **extractor** is a null pointer or an input parameter is invalid. - -**AV_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. - -**AV_ERR_NO_MEMORY**: Internal memory allocation failed. - - -## Variable Description - - -### OH_AVMETADATA_EXTRACTOR_ALBUM - -``` -static const char* OH_AVMETADATA_EXTRACTOR_ALBUM = "album" -``` -**Description** - -Pointer to the key for obtaining the title of the album. The value type is const char\*. - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Since**: 18 - - -### OH_AVMETADATA_EXTRACTOR_ALBUM_ARTIST - -``` -static const char* OH_AVMETADATA_EXTRACTOR_ALBUM_ARTIST = "albumArtist" -``` -**Description** - -Pointer to the key for obtaining the artist of the album. The value type is const char\*. - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Since**: 18 - - -### OH_AVMETADATA_EXTRACTOR_ARTIST - -``` -static const char* OH_AVMETADATA_EXTRACTOR_ARTIST = "artist" -``` -**Description** - -Pointer to the key for obtaining the artist of the media asset. The value type is const char\*. - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Since**: 18 - - -### OH_AVMETADATA_EXTRACTOR_AUTHOR - -``` -static const char* OH_AVMETADATA_EXTRACTOR_AUTHOR = "author" -``` -**Description** - -Pointer to the key for obtaining the author of the media asset. The value type is const char\*. - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Since**: 18 - - -### OH_AVMETADATA_EXTRACTOR_COMPOSER - -``` -static const char* OH_AVMETADATA_EXTRACTOR_COMPOSER = "composer" -``` -**Description** - -Pointer to the key for obtaining the composer of the media asset. The value type is const char\*. - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Since**: 18 - - -### OH_AVMETADATA_EXTRACTOR_DATE_TIME - -``` -static const char* OH_AVMETADATA_EXTRACTOR_DATE_TIME = "dateTime" -``` -**Description** - -Pointer to the key for obtaining the creation time of the media asset. The value type is const char\*. - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Since**: 18 - - -### OH_AVMETADATA_EXTRACTOR_DATE_TIME_FORMAT - -``` -static const char* OH_AVMETADATA_EXTRACTOR_DATE_TIME_FORMAT = "dateTimeFormat" -``` -**Description** - -Pointer to the key for obtaining the creation time of the media asset. The value type is const char\* and the output format is YYYY-MM-DD HH:mm:ss. - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Since**: 18 - - -### OH_AVMETADATA_EXTRACTOR_DURATION - -``` -static const char* OH_AVMETADATA_EXTRACTOR_DURATION = "duration" -``` -**Description** - -Pointer to the key for obtaining the duration of the media asset, in ms. The value type is int64_t. - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Since**: 18 - - -### OH_AVMETADATA_EXTRACTOR_GENRE - -``` -static const char* OH_AVMETADATA_EXTRACTOR_GENRE = "genre" -``` -**Description** - -Pointer to the key for obtaining the type or genre of the media asset. The value type is const char\*. - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Since**: 18 - - -### OH_AVMETADATA_EXTRACTOR_HAS_AUDIO - -``` -static const char* OH_AVMETADATA_EXTRACTOR_HAS_AUDIO = "hasAudio" -``` -**Description** - -Pointer to the key for obtaining the flag indicating whether the media asset contains audio. The value type is int32_t. - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Since**: 18 - - -### OH_AVMETADATA_EXTRACTOR_HAS_VIDEO - -``` -static const char* OH_AVMETADATA_EXTRACTOR_HAS_VIDEO = "hasVideo" -``` -**Description** - -Pointer to the key for obtaining the flag indicating whether the media asset contains video. The value type is int32_t. - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Since**: 18 - - -### OH_AVMETADATA_EXTRACTOR_LOCATION_LATITUDE - -``` -static const char* OH_AVMETADATA_EXTRACTOR_LOCATION_LATITUDE = "latitude" -``` -**Description** - -Pointer to the key for obtaining the latitude in the geographical location. The value type is float. - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Since**: 18 - - -### OH_AVMETADATA_EXTRACTOR_LOCATION_LONGITUDE - -``` -static const char* OH_AVMETADATA_EXTRACTOR_LOCATION_LONGITUDE = "longitude" -``` -**Description** - -Pointer to the key for obtaining the longitude in the geographical location. The value type is float. - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Since**: 18 - - -### OH_AVMETADATA_EXTRACTOR_MIME_TYPE - -``` -static const char* OH_AVMETADATA_EXTRACTOR_MIME_TYPE = "mimeType" -``` -**Description** - -Pointer to the key for obtaining the MIME type of the media asset. The value type is const char\*, for example, video/mp4, audio/mp4, and audio/amr wb. - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Since**: 18 - - -### OH_AVMETADATA_EXTRACTOR_SAMPLE_RATE - -``` -static const char* OH_AVMETADATA_EXTRACTOR_SAMPLE_RATE = "sampleRate" -``` -**Description** - -Pointer to the key for obtaining the audio sampling rate, in Hz. The value type is int32_t. - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Since**: 18 - - -### OH_AVMETADATA_EXTRACTOR_TITLE - -``` -static const char* OH_AVMETADATA_EXTRACTOR_TITLE = "title" -``` -**Description** - -Pointer to the key for obtaining the title of the media asset. The value type is const char\*. - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Since**: 18 - - -### OH_AVMETADATA_EXTRACTOR_TRACK_COUNT - -``` -static const char* OH_AVMETADATA_EXTRACTOR_TRACK_COUNT = "trackCount" -``` -**Description** - -Pointer to the key for obtaining the number of tracks of the media asset. The value type is int32_t. - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Since**: 18 - - -### OH_AVMETADATA_EXTRACTOR_VIDEO_HEIGHT - -``` -static const char* OH_AVMETADATA_EXTRACTOR_VIDEO_HEIGHT = "videoHeight" -``` -**Description** - -Pointer to the key for obtaining the video height, in px. The value type is int32_t. - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Since**: 18 - - -### OH_AVMETADATA_EXTRACTOR_VIDEO_IS_HDR_VIVID - -``` -static const char* OH_AVMETADATA_EXTRACTOR_VIDEO_IS_HDR_VIVID = "hdrType" -``` -**Description** - -Pointer to the key for obtaining the flag indicating whether the video is an HDR Vivid video. The value type is int32_t. For details, see the definition of [OH_Core_HdrType](../apis-avcodec-kit/_core.md#oh_core_hdrtype) in [media_types.h](../apis-avcodec-kit/media__types_8h.md). - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Since**: 18 - - -### OH_AVMETADATA_EXTRACTOR_VIDEO_ORIENTATION - -``` -static const char* OH_AVMETADATA_EXTRACTOR_VIDEO_ORIENTATION = "videoOrientation" -``` -**Description** - -Pointer to the key for obtaining the video rotation direction, in degrees (°). The value type is int32_t. - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Since**: 18 - - -### OH_AVMETADATA_EXTRACTOR_VIDEO_WIDTH - -``` -static const char* OH_AVMETADATA_EXTRACTOR_VIDEO_WIDTH = "videoWidth" -``` -**Description** - -Pointer to the key for obtaining the video weight, in px. The value type is int32_t. - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Since**: 18 diff --git a/en/application-dev/reference/apis-media-kit/_a_v_player.md b/en/application-dev/reference/apis-media-kit/_a_v_player.md deleted file mode 100644 index 83058744f1e..00000000000 --- a/en/application-dev/reference/apis-media-kit/_a_v_player.md +++ /dev/null @@ -1,1975 +0,0 @@ -# AVPlayer - - -## Overview - -The AVPlayer module provides APIs related to media playback. - -You can refer to the corresponding development guide and samples based on your development requirements. - -- [Using AVPlayer to Play Audio](../../media/media/using-ndk-avplayer-for-playback.md) -- [Using AVPlayer to Play Videos](../../media/media/using-ndk-avplayer-for-video-playback.md) - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - - -## Summary - - -### Files - -| Name| Description| -| -------- | -------- | -| [avplayer.h](avplayer_8h.md) | Declares the AVPlayer APIs. You can use the native AVPlayer APIs to play a media asset. | -| [avplayer_base.h](avplayer__base_8h.md) | Declares the structs and enums of the AVPlayer. | - - -### Structs - -| Name| Description| -| -------- | -------- | -| struct [AVPlayerCallback](_a_v_player_callback.md) | (Deprecated) Contains the set of the **OH_AVPlayerOnInfo** and **OH_AVPlayerOnInfo** callback function pointers. | - - -### Types - -| Name| Description| -| -------- | -------- | -| typedef struct [MediaKeySession](#mediakeysession) [MediaKeySession](#mediakeysession) | Defines a struct for the media key session. | -| typedef struct [DRM_MediaKeySystemInfo](#drm_mediakeysysteminfo) [DRM_MediaKeySystemInfo](#drm_mediakeysysteminfo) | Defines a struct for the media key system information. | -| typedef void(\* [Player_MediaKeySystemInfoCallback](#player_mediakeysysteminfocallback)) (OH_AVPlayer \*player, [DRM_MediaKeySystemInfo](#drm_mediakeysysteminfo) \*mediaKeySystemInfo) | Defines the callback invoked when media key system information of the AVPlayer is updated. | -| typedef enum [AVPlayerState](#avplayerstate-1) [AVPlayerState](#avplayerstate) | Defines an enum for the AVPlayer states. | -| typedef enum [AVPlayerSeekMode](#avplayerseekmode-1) [AVPlayerSeekMode](#avplayerseekmode) | Defines an enum for the seek modes of the AVPlayer. | -| typedef enum [AVPlaybackSpeed](#avplaybackspeed-1) [AVPlaybackSpeed](#avplaybackspeed) | Defines an enum for the playback speeds of the AVPlayer. | -| typedef enum [AVPlayerOnInfoType](#avplayeroninfotype-1) [AVPlayerOnInfoType](#avplayeroninfotype) | Defines an enum for the types of messages received by the AVPlayer. | -| typedef enum [AVPlayerBufferingType](#avplayerbufferingtype-1) [AVPlayerBufferingType](#avplayerbufferingtype) | Defines an enum for the types of buffer messages of the AVPlayer. | -| typedef void(\*[OH_AVPlayerOnInfo](#oh_avplayeroninfo)) (OH_AVPlayer \*player, [AVPlayerOnInfoType](#avplayeroninfotype) type, int32_t extra) | (Deprecated) Defines the callback invoked when the AVPlayer receives a message. | -| typedef void(\*[OH_AVPlayerOnInfoCallback](#oh_avplayeroninfocallback)) (OH_AVPlayer \*player, [AVPlayerOnInfoType](#avplayeroninfotype) type, OH_AVFormat \*infoBody, void \*userData) | Defines the callback invoked when the AVPlayer receives a message. If this callback is successfully set, the **OH_AVPlayerOnInfo** function will not be invoked. | -| typedef void(\* [OH_AVPlayerOnError](#oh_avplayeronerror)) (OH_AVPlayer \*player, int32_t errorCode, const char \*errorMsg) | (Deprecated) Defines the callback invoked when an error occurs in the AVPlayer. This type is available in API version 9 or later. | -| typedef void(\* [OH_AVPlayerOnErrorCallback](#oh_avplayeronerrorcallback)) (OH_AVPlayer \*player, int32_t errorCode, const char \*errorMsg, void \*userData) | Defines the callback invoked when an error occurs in the AVPlayer. If this callback is successfully set, the **OH_AVPlayerOnError** function will not be invoked. | -| typedef struct [AVPlayerCallback](_a_v_player_callback.md) [AVPlayerCallback](#avplayercallback) | (Deprecated) Contains the set of the **OH_AVPlayerOnInfo** and **OH_AVPlayerOnInfo** callback function pointers. | - - -### Enums - -| Name| Description| -| -------- | -------- | -| [AVPlayerState](#avplayerstate-1) {
AV_IDLE = 0,
AV_INITIALIZED = 1,
AV_PREPARED = 2,
AV_PLAYING = 3,
AV_PAUSED = 4,
AV_STOPPED = 5,
AV_COMPLETED = 6,
AV_RELEASED = 7,
AV_ERROR = 8
} | Enumerates the AVPlayer states.| -| [AVPlayerSeekMode](#avplayerseekmode) {
AV_SEEK_NEXT_SYNC = 0,
AV_SEEK_PREVIOUS_SYNC,
AV_SEEK_CLOSEST = 2
} | Enumerates the seek modes of the AVPlayer.| -| [AVPlaybackSpeed](#avplaybackspeed-1) {
AV_SPEED_FORWARD_0_75_X,
AV_SPEED_FORWARD_1_00_X,
AV_SPEED_FORWARD_1_25_X,
AV_SPEED_FORWARD_1_75_X,
AV_SPEED_FORWARD_2_00_X,
AV_SPEED_FORWARD_0_50_X,
AV_SPEED_FORWARD_1_50_X
,
AV_SPEED_FORWARD_3_00_X,
AV_SPEED_FORWARD_0_25_X,
AV_SPEED_FORWARD_0_125_X} | Enumerates the playback speeds of the AVPlayer. | -| [AVPlayerOnInfoType](#avplayeroninfotype-1) {
AV_INFO_TYPE_SEEKDONE = 0,
AV_INFO_TYPE_SPEEDDONE = 1,
AV_INFO_TYPE_BITRATEDONE = 2,
AV_INFO_TYPE_EOS = 3,
AV_INFO_TYPE_STATE_CHANGE = 4,
AV_INFO_TYPE_POSITION_UPDATE = 5,
AV_INFO_TYPE_MESSAGE = 6,
AV_INFO_TYPE_VOLUME_CHANGE = 7,
AV_INFO_TYPE_RESOLUTION_CHANGE = 8,
AV_INFO_TYPE_BUFFERING_UPDATE = 9,
AV_INFO_TYPE_BITRATE_COLLECT = 10,
AV_INFO_TYPE_INTERRUPT_EVENT = 11,
AV_INFO_TYPE_DURATION_UPDATE = 12,
AV_INFO_TYPE_IS_LIVE_STREAM = 13,
AV_INFO_TYPE_TRACKCHANGE = 14,
AV_INFO_TYPE_TRACK_INFO_UPDATE = 15,
AV_INFO_TYPE_SUBTITLE_UPDATE = 16, AV_INFO_TYPE_AUDIO_OUTPUT_DEVICE_CHANGE = 17
} | Enumerates the types of messages received by the AVPlayer.| -| [AVPlayerBufferingType](#avplayerbufferingtype-1) {
AVPLAYER_BUFFERING_START = 1,
AVPLAYER_BUFFERING_END,
AVPLAYER_BUFFERING_PERCENT,
AVPLAYER_BUFFERING_CACHED_DURATION
} | Enumerates the types of buffer messages of the AVPlayer. | - - -### Functions - -| Name| Description| -| -------- | -------- | -| OH_AVPlayer \*[OH_AVPlayer_Create](#oh_avplayer_create) (void) | Creates an **OH_AVPlayer** instance.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetURLSource](#oh_avplayer_seturlsource) (OH_AVPlayer \*player, const char \*url) | Sets the HTTP URL of a media source to be played by an AVPlayer. | -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetFDSource](#oh_avplayer_setfdsource) (OH_AVPlayer \*player, int32_t fd, int64_t offset, int64_t size) | Sets the file descriptor of a media source to be played by an AVPlayer.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_Prepare](#oh_avplayer_prepare) (OH_AVPlayer \*player) | Prepares the playback environment and buffers media data.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_Play](#oh_avplayer_play) (OH_AVPlayer \*player) | Starts playback.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_Pause](#oh_avplayer_pause) (OH_AVPlayer \*player) | Pauses playback.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_Stop](#oh_avplayer_stop) (OH_AVPlayer \*player) | Stops playback.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_Reset](#oh_avplayer_reset) (OH_AVPlayer \*player) | Restores the AVPlayer to the initial state.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_Release](#oh_avplayer_release) (OH_AVPlayer \*player) | Asynchronously releases an **OH_AVPlayer** instance.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_ReleaseSync](#oh_avplayer_releasesync) (OH_AVPlayer \*player) | Synchronously releases an **OH_AVPlayer** instance.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetVolume](#oh_avplayer_setvolume) (OH_AVPlayer \*player, float leftVolume, float rightVolume) | Sets the volume for an AVPlayer.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_Seek](#oh_avplayer_seek) (OH_AVPlayer \*player, int32_t mSeconds, [AVPlayerSeekMode](#avplayerseekmode) mode) | Seeks to a playback position.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_GetCurrentTime](#oh_avplayer_getcurrenttime) (OH_AVPlayer \*player, int32_t \*currentTime) | Obtains the playback position, in milliseconds.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_GetVideoWidth](#oh_avplayer_getvideowidth) (OH_AVPlayer \*player, int32_t \*videoWidth) | Obtains the video width.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_GetVideoHeight](#oh_avplayer_getvideoheight) (OH_AVPlayer \*player, int32_t \*videoHeight) | Obtains the video height.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetPlaybackSpeed](#oh_avplayer_setplaybackspeed) (OH_AVPlayer \*player, [AVPlaybackSpeed](#avplaybackspeed) speed) | Sets the playback speed for an AVPlayer.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_GetPlaybackSpeed](#oh_avplayer_getplaybackspeed) (OH_AVPlayer \*player, [AVPlaybackSpeed](#avplaybackspeed) \*speed) | Obtains the playback speed of an AVPlayer.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetAudioRendererInfo](#oh_avplayer_setaudiorendererinfo) (OH_AVPlayer \*player, OH_AudioStream_Usage streamUsage) | Sets the audio stream type for an AVPlayer. | -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetVolumeMode](#oh_avplayer_setvolumemode) (OH_AVPlayer \*player, [OH_AudioStream_VolumeMode](../apis-audio-kit/_o_h_audio.md#oh_audiostream_volumemode) volumeMode) | Sets the audio volume mode for an AVPlayer.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetAudioInterruptMode](#oh_avplayer_setaudiointerruptmode) (OH_AVPlayer \*player, OH_AudioInterrupt_Mode interruptMode) | Sets the audio interruption mode for an AVPlayer. | -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetAudioEffectMode](#oh_avplayer_setaudioeffectmode) (OH_AVPlayer \*player, OH_AudioStream_AudioEffectMode effectMode) | Sets the audio effect mode for an AVPlayer. | -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SelectBitRate](#oh_avplayer_selectbitrate) (OH_AVPlayer \*player, uint32_t bitRate) | Sets the bit rate used by an HLS player.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetVideoSurface](#oh_avplayer_setvideosurface) (OH_AVPlayer \*player, OHNativeWindow \*window) | Sets a playback window.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_GetDuration](#oh_avplayer_getduration) (OH_AVPlayer \*player, int32_t \*duration) | Obtains the total duration of a media file, in milliseconds.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_GetState](#oh_avplayer_getstate) (OH_AVPlayer \*player, [AVPlayerState](#avplayerstate) \*state) | Obtains the AVPlayer state.| -| bool [OH_AVPlayer_IsPlaying](#oh_avplayer_isplaying) (OH_AVPlayer \*player) | Checks whether an AVPlayer is playing.| -| bool [OH_AVPlayer_IsLooping](#oh_avplayer_islooping) (OH_AVPlayer \*player) | Checks whether an AVPlayer is looping.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetLooping](#oh_avplayer_setlooping) (OH_AVPlayer \*player, bool loop) | Enables loop playback.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetPlayerCallback](#oh_avplayer_setplayercallback) (OH_AVPlayer \*player, [AVPlayerCallback](_a_v_player_callback.md) callback) | Sets a callback for an AVPlayer.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SelectTrack](#oh_avplayer_selecttrack) (OH_AVPlayer \*player, int32_t index) | Selects an audio track. This function is not supported yet.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_DeselectTrack](#oh_avplayer_deselecttrack) (OH_AVPlayer \*player, int32_t index) | Deselects an audio track. This function is not supported yet.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_GetCurrentTrack](#oh_avplayer_getcurrenttrack) (OH_AVPlayer \*player, int32_t trackType, int32_t \*index) | Obtains the currently valid track. This function is not supported yet.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetMediaKeySystemInfoCallback](#oh_avplayer_setmediakeysysteminfocallback) (OH_AVPlayer \*player, Player_MediaKeySystemInfoCallback callback) | Sets a callback to return the media key system information for an AVPlayer.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_GetMediaKeySystemInfo](#oh_avplayer_getmediakeysysteminfo) (OH_AVPlayer \*player, [DRM_MediaKeySystemInfo](../apis-drm-kit/_d_r_m___media_key_system_info.md) \*mediaKeySystemInfo) | Obtains the media key system information to create a media key session.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetDecryptionConfig](#oh_avplayer_setdecryptionconfig) (OH_AVPlayer \*player, [MediaKeySession](../apis-drm-kit/_drm.md#mediakeysession) \*mediaKeySession, bool secureVideoPath) | Sets the decryption information.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetOnInfoCallback](#oh_avplayer_setoninfocallback) (OH_AVPlayer \*player, [OH_AVPlayerOnInfoCallback](#oh_avplayeroninfocallback) callback, void \*userData) | Sets a callback for the event indicating that the AVPlayer receives a message. | -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetOnErrorCallback](#oh_avplayer_setonerrorcallback) (OH_AVPlayer \*player, [OH_AVPlayerOnErrorCallback](#oh_avplayeronerrorcallback) callback, void \*userData) | Sets a callback for the event indicating that an error occurs in the AVPlayer. | - - -### Variables - -| Name| Description| -| -------- | -------- | -| const char \* [OH_PLAYER_STATE](#oh_player_state) | Pointer to the key for obtaining the AVPlayer state. The value is of the int32_t type. | -| const char \* [OH_PLAYER_STATE_CHANGE_REASON](#oh_player_state_change_reason) | Pointer to the key for obtaining the AVPlayer state change reason. The value is of the int32_t type. | -| const char \* [OH_PLAYER_VOLUME](#oh_player_volume) | Pointer to the key for obtaining the volume. The value type is float. | -| const char \* [OH_PLAYER_BITRATE_ARRAY](#oh_player_bitrate_array) | Pointer to the key for obtaining the bit rate array. The value is of the uint8_t byte array type, which is expressed by [AV_INFO_TYPE_BITRATE_COLLECT](#avplayeroninfotype-1). | -| const char \* [OH_PLAYER_AUDIO_INTERRUPT_TYPE](#oh_player_audio_interrupt_type) | Pointer to the key for obtaining the audio interruption type. The value is of the int32_t type. | -| const char \* [OH_PLAYER_AUDIO_INTERRUPT_FORCE](#oh_player_audio_interrupt_force) | Pointer to the key for obtaining the FORCE type of audio interruption. The value is of the int32_t type. | -| const char \* [OH_PLAYER_AUDIO_INTERRUPT_HINT](#oh_player_audio_interrupt_hint) | Pointer to the key for obtaining the HINT type of audio interruption. The value is of the int32_t type. | -| const char \* [OH_PLAYER_AUDIO_DEVICE_CHANGE_REASON](#oh_player_audio_device_change_reason) | Pointer to the key for obtaining the audio device change reason. The value is of the int32_t type. | -| const char \* [OH_PLAYER_BUFFERING_TYPE](#oh_player_buffering_type) | Pointer to the key for obtaining the type of the buffer update message. The value type is [AVPlayerBufferingType](#avplayerbufferingtype-1). | -| const char \* [OH_PLAYER_BUFFERING_VALUE](#oh_player_buffering_value) | Pointer to the key for obtaining the value of the buffer update message. The value is of the int32_t type. | -| const char \* [OH_PLAYER_SEEK_POSITION](#oh_player_seek_position) | Pointer to the key for obtaining the playback progress after the seek operation. The value is of the int32_t type. | -| const char \* [OH_PLAYER_PLAYBACK_SPEED](#oh_player_playback_speed) | Pointer to the key for obtaining the playback speed. The value type is [AVPlaybackSpeed](#avplaybackspeed-1). | -| const char \* [OH_PLAYER_BITRATE](#oh_player_bitrate) | Pointer to the key for obtaining the bit rate. The value is of the int32_t type. | -| const char \* [OH_PLAYER_CURRENT_POSITION](#oh_player_current_position) | Pointer to the key for obtaining the playback progress information. The value is of the int32_t type. | -| const char \* [OH_PLAYER_DURATION](#oh_player_duration) | Pointer to the key for obtaining the media asset duration. The value type is int64_t. | -| const char \* [OH_PLAYER_VIDEO_WIDTH](#oh_player_video_width) | Pointer to the key for obtaining the video width. The value is of the int32_t type. | -| const char \* [OH_PLAYER_VIDEO_HEIGHT](#oh_player_video_height) | Pointer to the key for obtaining the video height. The value is of the int32_t type. | -| const char \* [OH_PLAYER_MESSAGE_TYPE](#oh_player_message_type) | Pointer to the key for obtaining the type of message received by the AVPlayer. The value is of the int32_t type. | -| const char \* [OH_PLAYER_IS_LIVE_STREAM](#oh_player_is_live_stream) | Pointer to the key for checking whether a media asset is live streaming. The value is of the int32_t type. | - - -## Type Description - - -### AVPlaybackSpeed - -``` -typedef enum AVPlaybackSpeed AVPlaybackSpeed -``` - -**Description** - -Defines an enum for the playback speeds of the AVPlayer. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - - -### AVPlayerBufferingType - -``` -typedef enum AVPlayerBufferingType AVPlayerBufferingType -``` - -**Description** - -Defines an enum for the types of buffer messages of the AVPlayer. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - - -### AVPlayerCallback - -``` -typedef struct AVPlayerCallback AVPlayerCallback -``` - -**Description** - -Contains the set of the **OH_AVPlayerOnInfo** and **OH_AVPlayerOnInfo** callback function pointers. To ensure the normal running of **OH_AVPlayer**, you must register the instance of this struct with the **OH_AVPlayer** instance and process the information reported by the callback functions. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Deprecated from**: 12 - -**Substitute**: [OH_AVPlayerOnInfoCallback](#oh_avplayeroninfocallback) and [OH_AVPlayerOnErrorCallback](#oh_avplayeronerrorcallback) - -**Parameters** - -| Name| Description| -| -------- | -------- | -| onInfo | Callback for AVPlayer message information. For details about the available options, see [OH_AVPlayerOnInfo](#oh_avplayeroninfo).| -| onError | Callback for AVPlayer error information. For details about the available options, see [OH_AVPlayerOnError](#oh_avplayeronerror).| - - -### AVPlayerOnInfoType - -``` -typedef enum AVPlayerOnInfoType AVPlayerOnInfoType -``` - -**Description** - -Defines an enum for the types of messages received by the AVPlayer. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - - -### AVPlayerSeekMode - -``` -typedef enum AVPlayerSeekMode AVPlayerSeekMode -``` - -**Description** - -Defines an enum for the seek modes of the AVPlayer. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - - -### AVPlayerState - -``` -typedef enum AVPlayerState AVPlayerState -``` - -**Description** - -Defines an enum for the AVPlayer states. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - - -### DRM_MediaKeySystemInfo - -``` -typedef struct DRM_MediaKeySystemInfo DRM_MediaKeySystemInfo -``` - -**Description** - -Defines a struct for the media key system information. - -**Since**: 12 - - -### MediaKeySession - -``` -typedef struct MediaKeySession MediaKeySession -``` - -**Description** - -Defines a struct for the media key session. - -**Since**: 12 - - -### OH_AVPlayerOnError - -``` -typedef void(* OH_AVPlayerOnError) (OH_AVPlayer *player, int32_t errorCode, const char *errorMsg) -``` - -**Description** - -Defines the callback when an error occurs in the AVPlayer. This type is available in API version 9 or later. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Deprecated from**: 12 - -**Substitute**: [OH_AVPlayerOnErrorCallback](#oh_avplayeronerrorcallback) - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance. | -| errorCode | Error code.
**AV_ERR_NO_MEMORY**: No memory. The value is **1**.
**AV_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The value is **2**.
**AV_ERR_INVALID_VAL**: Invalid value. The value is **3**.
**AV_ERR_IO**: I/O error. The value is **4**.
**AV_ERR_TIMEOUT**: Timeout. The value is **5**.
**AV_ERR_UNKNOWN**: Unknown error. The value is **6**.
**AV_ERR_SERVICE_DIED**: The service is dead. The value is **7**.
**AV_ERR_INVALID_STATE**: The operation is not supported in the current state. The value is **8**.
**AV_ERR_UNSUPPORT**: The function is not supported. The value is **9**.
**AV_ERR_EXTEND_START**: Initial value for extended error codes. The value is **100**.| -| errorMsg | Pointer to an error message. | - - -### OH_AVPlayerOnErrorCallback - -``` -typedef void(* OH_AVPlayerOnErrorCallback) (OH_AVPlayer *player, int32_t errorCode, const char *errorMsg, void *userData) -``` - -**Description** - -Defines the callback invoked when an error occurs in the AVPlayer. If this callback is successfully set, the **OH_AVPlayerOnError** function will not be invoked. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance. | -| errorCode | Error code.
**AV_ERR_NO_MEMORY**: No memory. The value is **1**.
**AV_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The value is **2**.
**AV_ERR_INVALID_VAL**: Invalid value. The value is **3**.
**AV_ERR_IO**: I/O error. The value is **4**.
**AV_ERR_TIMEOUT**: Timeout. The value is **5**.
**AV_ERR_UNKNOWN**: Unknown error. The value is **6**.
**AV_ERR_SERVICE_DIED**: The service is dead. The value is **7**.
**AV_ERR_INVALID_STATE**: The operation is not supported in the current state. The value is **8**.
**AV_ERR_UNSUPPORT**: The function is not supported. The value is **9**.
**AV_ERR_EXTEND_START**: Initial value for extended error codes. The value is **100**.| -| errorMsg | Pointer to the error message. | -| userData | Pointer to the user data passed in. The same data is returned. | - - -### OH_AVPlayerOnInfo - -``` -typedef void(* OH_AVPlayerOnInfo) (OH_AVPlayer *player, AVPlayerOnInfoType type, int32_t extra) -``` - -**Description** - -Defines the callback invoked when the AVPlayer receives a message. - -The following table lists the mappings between **type** and **extra** values. - -| Value of type| Value of extra| -| -------- | -------- | -| AV_INFO_TYPE_SEEKDONE | Message returned when seeking to a playback position is complete. **extra** indicates the position after the seek operation.| -| AV_INFO_TYPE_SPEEDDONE | Message returned when the playback speed setting is complete. **extra** indicates the playback speed. For details about the available options, see [AVPlaybackSpeed](#avplaybackspeed-1).| -| AV_INFO_TYPE_BITRATEDONE | Message returned when the bit rate setting is complete. **extra** indicates the bit rate.| -| AV_INFO_TYPE_EOS | Message returned when the playback is complete.| -| AV_INFO_TYPE_STATE_CHANGE | Message returned when the AVPlayer state changes. **extra** indicates the new state. For details about the available options, see [AVPlayerState](#avplayerstate-1).| -| AV_INFO_TYPE_POSITION_UPDATE | Message returned when the playback position changes. **extra** indicates the current position.| -| AV_INFO_TYPE_MESSAGE | Message returned when video rendering starts. **extra** indicates the first video frame rendered.| -| AV_INFO_TYPE_VOLUME_CHANGE | Message returned when the playback volume changes. **extra** is not defined in this scenario.| -| AV_INFO_TYPE_RESOLUTION_CHANGE | Message returned when the video size is obtained for the first time or the video size is updated. **extra** is not defined in this scenario.| -| AV_INFO_TYPE_BUFFERING_UPDATE | Message returned when multi-queue buffering changes. **extra** indicates the video duration.| -| AV_INFO_TYPE_BITRATE_COLLECT | Message returned to report the HLS video bit rates. Each bit rate has been converted into a uint8_t byte array during the reporting. You need to forcibly convert the uint8_t byte array into a uint32_t integer array. | -| AV_INFO_TYPE_INTERRUPT_EVENT | Message returned when the audio focus changes. **extra** indicates the hints provided along with audio interruption. For details about the available options, see [OH_AudioInterrupt_Hint](../apis-audio-kit/_o_h_audio.md#oh_audiointerrupt_hint). The application can determine whether to perform further processing based on the hint.| -| AV_INFO_TYPE_DURATION_UPDATE | Message returned when the playback duration changes. **extra** indicates the video duration.| -| AV_INFO_TYPE_IS_LIVE_STREAM | Message returned when live streams are played. **extra** indicates whether the stream is a live stream. The value **0** means a non-live stream, and **1** means a live stream.| -| AV_INFO_TYPE_TRACKCHANGE | Message returned when the track changes. **extra** is not defined in this scenario.| -| AV_INFO_TYPE_TRACK_INFO_UPDATE |Message returned when the track information updates. **extra** is not defined in this scenario.| -| AV_INFO_TYPE_SUBTITLE_UPDATE | Message returned when the subtitle information changes. **extra** is not defined in this scenario.| -| AV_INFO_TYPE_AUDIO_OUTPUT_DEVICE_CHANGE | Message returned when the audio output device changes. **extra** indicates the device change reason. For details about the available options, see [OH_AudioStream_DeviceChangeReason](../apis-audio-kit/_o_h_audio.md#oh_audiostream_devicechangereason).| - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Deprecated from**: 12 - -**Substitute**: [OH_AVPlayerOnInfoCallback](#oh_avplayeroninfocallback) - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance. | -| type | Message type. For details about the available options, see [AVPlayerOnInfoType](#avplayeroninfotype-1). For details about the mappings between **type** and **extra** values, see the function description.| -| extra | Other information, such as the start time and position of the media file to play. | - - -### OH_AVPlayerOnInfoCallback - -``` -typedef void(* OH_AVPlayerOnInfoCallback) (OH_AVPlayer *player, AVPlayerOnInfoType type, OH_AVFormat *infoBody, void *userData) -``` - -**Description** - -Defines the callback invoked when the AVPlayer receives a message. If this callback is successfully set, the **OH_AVPlayerOnInfo** function will not be invoked. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance. | -| type | Message type. For details about the available options, see [AVPlayerOnInfoType](#avplayeroninfotype-1). | -| infoBody | Pointer to the message. The pointer is valid only in this callback. | -| userData | Pointer to the user data passed in. The same data is returned. | - - -### Player_MediaKeySystemInfoCallback - -``` -typedef void(* Player_MediaKeySystemInfoCallback) (OH_AVPlayer *player, DRM_MediaKeySystemInfo *mediaKeySystemInfo) -``` - -**Description** - -Defines the callback invoked when media key system information of the AVPlayer is updated. - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance. | -| mediaKeySystemInfo | Pointer to the media key system information. | - -**Returns** - -void - - -## Enum Description - - -### AVPlaybackSpeed - -``` -enum AVPlaybackSpeed -``` - -**Description** - -Enumerates the playback speeds of the AVPlayer. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -| Value| Description| -| -------- | -------- | -| AV_SPEED_FORWARD_0_75_X | Plays the video at 0.75 times the normal speed.| -| AV_SPEED_FORWARD_1_00_X | Plays the video at the normal speed.| -| AV_SPEED_FORWARD_1_25_X | Plays the video at 1.25 times the normal speed.| -| AV_SPEED_FORWARD_1_75_X | Plays the video at 1.75 times the normal speed.| -| AV_SPEED_FORWARD_2_00_X | Plays the video at 2.0 times the normal speed.| -| AV_SPEED_FORWARD_0_50_X | Plays the video at 0.5 times the normal speed.
**Since**: 12| -| AV_SPEED_FORWARD_1_50_X | Plays the video at 1.5 times the normal speed.
**Since**: 12| -| AV_SPEED_FORWARD_3_00_X | Plays the video at 3.0 times the normal speed.
**Since**: 13| -| AV_SPEED_FORWARD_0_25_X | Plays the video at 0.25 times the normal speed.
**Since**: 13| -| AV_SPEED_FORWARD_0_125_X | Plays the video at 0.125 times the normal speed.
**Since**: 13| - - -### AVPlayerBufferingType - -``` -enum AVPlayerBufferingType -``` - -**Description** - -Enumerates the types of buffer messages of the AVPlayer. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - -| Value| Description| -| -------- | -------- | -| AVPLAYER_BUFFERING_START | Buffering start message. | -| AVPLAYER_BUFFERING_END | Buffering end message. | -| AVPLAYER_BUFFERING_PERCENT | Buffer execution progress, in percentage. The value is an integer in the range [0, 100]. | -| AVPLAYER_BUFFERING_CACHED_DURATION | Duration that cached data can be played, in milliseconds. | - - -### AVPlayerOnInfoType - -``` -enum AVPlayerOnInfoType -``` - -**Description** - -Enumerates the types of messages received by the AVPlayer. - -The enum can be used in [OH_AVPlayerOnInfoCallback](#oh_avplayeroninfocallback) and [OH_AVPlayerOnInfo (deprecated)](#oh_avplayeroninfo) to indicate the type of information received by the AVPlayer. - -- Since API version 12, you are advised to use [OH_AVPlayerOnInfoCallback](#oh_avplayeroninfocallback) instead. Different information (**infoBody**) can be obtained for different **OnInfo** types. **infoBody** contains the key-value pairs. For details, see the following enumerated value table. - -- If you are using API version 11 for development, use **OH_AVPlayerOnInfo (deprecated)**. For details about the mappings used in this deprecated API, see [OH_AVPlayerOnInfo API Description](#oh_avplayeroninfo). - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -| Value| Description| -| -------- | -------- | -| AV_INFO_TYPE_SEEKDONE | Message returned when seeking to a playback position is complete.
If **key** is set to **OH_PLAYER_SEEK_POSITION**, the value type is int32_t. The system uses int32_t to transfer the value, and the application uses int32_t to obtain the value.| -| AV_INFO_TYPE_SPEEDDONE | Message returned when the playback speed setting is complete.
If **key** is set to **OH_PLAYER_PLAYBACK_SPEED**, the value is an enumerated value of [AVPlaybackSpeed](#avplaybackspeed-1). The system uses int32_t to transfer the value, and the application uses int32_t to obtain the value and forcibly converts the value to an enumerated value of [AVPlaybackSpeed](#avplaybackspeed-1).| -| AV_INFO_TYPE_BITRATEDONE | Message returned when the bit rate setting is complete.
If **key** is set to **OH_PLAYER_BITRATE**, the value type is uint32_t. The system uses int32_t to transfer the value, and the application uses int32_t to obtain the value and forcibly converts the value to the uint32_t type.| -| AV_INFO_TYPE_EOS | Message returned when the playback is complete.| -| AV_INFO_TYPE_STATE_CHANGE | Message returned when the AVPlayer state changes.
- If **key** is set to **OH_PLAYER_STATE**, the value type is int32_t. The system uses int32_t to transfer the value, and the application uses int32_t to obtain the value and forcibly converts the value to an enumerated value of [AVPlayerState](#avplayerstate-1).
- If **key** is set to **OH_PLAYER_STATE_CHANGE_REASON**, the value type is int32_t. The system uses int32_t to transfer the value, and the application uses int32_t to obtain the value. The value **1** means that the change is triggered by user operations, and **2** means that the change is triggered by the system.| -| AV_INFO_TYPE_POSITION_UPDATE | Message returned when the playback position changes.
If **key** is set to **OH_PLAYER_CURRENT_POSITION**, the value type is int32_t. The system uses int32_t to transfer the value, and the application uses int32_t to obtain the value.| -| AV_INFO_TYPE_MESSAGE | Message returned when video rendering starts.
If **key** is set to **OH_PLAYER_MESSAGE_TYPE**, the value type is int32_t. The system uses int32_t to transfer the value, and the application uses int32_t to obtain the value. The value **1** means that video rendering starts.| -| AV_INFO_TYPE_VOLUME_CHANGE | Message returned when the playback volume changes.
If **key** is set to **OH_PLAYER_VOLUME**, the value type is float. The system uses float to transfer the value, and the application uses float to obtain the value. The value range is [0.0, 1.0].| -| AV_INFO_TYPE_RESOLUTION_CHANGE | Message returned when the video size is obtained for the first time or the video size is updated.
If **key** is set to **OH_PLAYER_VIDEO_WIDTH** or **OH_PLAYER_VIDEO_HEIGHT**, the value type is int32_t. The system uses int32_t to transfer the value, and the application uses int32_t to obtain the value.| -| AV_INFO_TYPE_BUFFERING_UPDATE | Message returned when multi-queue buffering changes.
- If **key** is set to **OH_PLAYER_BUFFERING_TYPE**, the value type is [AVPlayerBufferingType](#avplayerbufferingtype-1). The system uses int32_t to transfer the value, and the application uses int32_t to obtain the value and forcibly converts the value to an enumerated value of [AVPlayerBufferingType](#avplayerbufferingtype-1).
- If **key** is set to **OH_PLAYER_BUFFERING_VALUE**, the value type is int32_t. The system uses int32_t to transfer the value, and the application uses int32_t to obtain the value. This value is valid when the buffer update message type is **AVPLAYER_BUFFERING_PERCENT** or **AVPLAYER_BUFFERING_CACHED_DURATION**, which indicate the percentage of the buffer progress and the duration that the cached data can play, respectively.| -| AV_INFO_TYPE_BITRATE_COLLECT | Message returned to report the HLS video bit rates.
If **key** is set to **OH_PLAYER_BITRATE_ARRAY**, the value type is uint8_t. The application uses a pointer variable of the uint8_t type to store the bit rate list and uses a variable of the size_t type to store the byte array length. Then it allocates several storage spaces of the uint32_t type to receive the bit rate integer of the uint32_t type, which is converted from the uint8_t byte array. | -| AV_INFO_TYPE_INTERRUPT_EVENT | Message returned when the audio focus changes.
The value type is int32_t. The system uses int32_t to transfer the value, and the application uses int32_t to obtain the value.
**key** can be set to any of the following values:
- **OH_PLAYER_AUDIO_INTERRUPT_TYPE**: The value **1** means that the audio interruption event starts, and **2** means that the event ends.
- **OH_PLAYER_AUDIO_INTERRUPT_FORCE**: The value **0** means forcible interruption (the system changes the audio playback status), and **1** means sharing interruption (the application changes the audio playback status).
- **OH_PLAYER_AUDIO_INTERRUPT_HINT**: The value **0** (NONE) means no hint; **1** (RESUME) means that the audio playback is resumed; **2** (PAUSE) means that the audio playback is paused and loses focus; **3** (STOP) means that the audio playback is stopped; **4** (DUCK) means that the audio volume is reduced; **5** (UNDUCK) means that the audio volume is restored.| -| AV_INFO_TYPE_DURATION_UPDATE | Message returned when the playback duration changes.
If **key** is set to **OH_PLAYER_DURATION**, the value type is int64_t. The system uses int64_t to transfer the value, and the application uses int64_t to obtain the value.| -| AV_INFO_TYPE_IS_LIVE_STREAM | Message returned when live streams are played.
If **key** is set to **OH_PLAYER_IS_LIVE_STREAM**, the value type is int32_t. The system uses int32_t to transfer the value, and the application uses int32_t to obtain the value. The value **0** means a non-live stream, and **1** means a live stream.| -| AV_INFO_TYPE_TRACKCHANGE | Message returned when the track changes. **extra** is not defined in this scenario.| -| AV_INFO_TYPE_TRACK_INFO_UPDATE |Message returned when the track information updates. **extra** is not defined in this scenario.| -| AV_INFO_TYPE_SUBTITLE_UPDATE | Message returned when the subtitle information changes. **extra** is not defined in this scenario.| -| AV_INFO_TYPE_AUDIO_OUTPUT_DEVICE_CHANGE | Message returned when the audio output device changes.
If **key** is set to **OH_PLAYER_AUDIO_DEVICE_CHANGE_REASON**, the value type is int32_t. The system uses int32_t to transfer the value, and the application uses int32_t to obtain the value.| - - -### AVPlayerSeekMode - -``` -enum AVPlayerSeekMode -``` - -**Description** - -Enumerates the seek modes of the AVPlayer. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -| Value| Description| -| -------- | -------- | -| AV_SEEK_NEXT_SYNC | Seeks to the next key frame at the specified position.| -| AV_SEEK_PREVIOUS_SYNC | Seeks to the previous key frame at the specified position.| -| AV_SEEK_CLOSEST | Seeks to the frame closest to the specified position.
**Since**: 12| - - -### AVPlayerState - -``` -enum AVPlayerState -``` - -**Description** - -Enumerates the AVPlayer states. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -| Value| Description| -| -------- | -------- | -| AV_IDLE | Idle.| -| AV_INITIALIZED | Initialized.| -| AV_PREPARED | Ready.| -| AV_PLAYING | Playing.| -| AV_PAUSED | Paused.| -| AV_STOPPED | Stopped.| -| AV_COMPLETED | Completed.| -| AV_RELEASED | Released.| -| AV_ERROR | Error.| - - -## Function Description - - -### OH_AVPlayer_Create() - -``` -OH_AVPlayer* OH_AVPlayer_Create (void) -``` - -**Description** - -Creates an **OH_AVPlayer** instance. - -> **NOTE** -> -> - You are advised to create a maximum of 16 **AVPlayer** instances for an application in both audio and video playback scenarios. -> - The actual number of instances that can be created may be different. It depends on the specifications of the device chip in use. For example, in the case of RK3568, you are advised to create a maximum of 6 **AVPlayer** instances for an application in audio and video playback scenarios. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Returns** - -Returns the pointer to the **OH_AVPlayer** instance created if the operation is successful; returns a null pointer otherwise. - -The possible causes of an operation failure are as follows: - -1. The execution of **PlayerFactory::CreatePlayer** fails. -2. The execution of **new PlayerObject** fails. - - -### OH_AVPlayer_DeselectTrack() - -``` -OH_AVErrCode OH_AVPlayer_DeselectTrack (OH_AVPlayer *player, int32_t index) -``` - -**Description** - -Deselects an audio track. This function is not supported yet. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| -| index | Index of the track. | - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The deselection is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player DeselectTrack** fails. - - -### OH_AVPlayer_GetCurrentTime() - -``` -OH_AVErrCode OH_AVPlayer_GetCurrentTime (OH_AVPlayer *player, int32_t *currentTime) -``` - -**Description** - -Obtains the playback position, in milliseconds. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| -| currentTime | Pointer to the playback position.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The playback position is obtained. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player GetCurrentTime** fails. - - -### OH_AVPlayer_GetCurrentTrack() - -``` -OH_AVErrCode OH_AVPlayer_GetCurrentTrack (OH_AVPlayer *player, int32_t trackType, int32_t *index) -``` - -**Description** - -Obtains the currently valid track. This function is not supported yet. - -You can set the track to the prepared, playing, paused, or completed state. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| -| trackType | Media type. The value **0** means audio and **1** means video.| -| index | Pointer to the index of the track.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The track is obtained. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player GetCurrentTrack** fails. - - -### OH_AVPlayer_GetDuration() - -``` -OH_AVErrCode OH_AVPlayer_GetDuration (OH_AVPlayer *player, int32_t *duration) -``` - -**Description** - -Obtains the total duration of a media file, in milliseconds. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| -| duration | Pointer to the total duration.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The total duration is obtained. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player GetDuration** fails. - - -### OH_AVPlayer_GetMediaKeySystemInfo() - -``` -OH_AVErrCode OH_AVPlayer_GetMediaKeySystemInfo (OH_AVPlayer *player, DRM_MediaKeySystemInfo *mediaKeySystemInfo) -``` - -**Description** - -Obtains the media key system information to create a media key session. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| -| mediaKeySystemInfo | Pointer to the media key system information.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The setting is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the memory is insufficient. - -### OH_AVPlayer_GetPlaybackSpeed() - -``` -OH_AVErrCode OH_AVPlayer_GetPlaybackSpeed (OH_AVPlayer *player, AVPlaybackSpeed *speed) -``` - -**Description** - -Obtains the playback speed of an AVPlayer. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| -| speed | Pointer to the playback speed. For details about the available options, see [AVPlaybackSpeed](#avplaybackspeed).| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The playback rate is obtained. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player GetPlaybackSpeed** fails. - - -### OH_AVPlayer_GetState() - -``` -OH_AVErrCode OH_AVPlayer_GetState (OH_AVPlayer *player, AVPlayerState *state) -``` - -**Description** - -Obtains the AVPlayer state. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| -| state | Pointer to the state.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The AVPlayer state is obtained. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player GetState** fails. - - -### OH_AVPlayer_GetVideoHeight() - -``` -OH_AVErrCode OH_AVPlayer_GetVideoHeight (OH_AVPlayer *player, int32_t *videoHeight) -``` - -**Description** - -Obtains the video height. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| -| videoHeights | Pointer to the video height.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The video height is obtained. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer. - - -### OH_AVPlayer_GetVideoWidth() - -``` -OH_AVErrCode OH_AVPlayer_GetVideoWidth (OH_AVPlayer *player, int32_t *videoWidth) -``` - -**Description** - -Obtains the video width. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| -| videoWidth | Pointer to the video width.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The video width is obtained. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer. - - -### OH_AVPlayer_IsLooping() - -``` -bool OH_AVPlayer_IsLooping (OH_AVPlayer *player) -``` - -**Description** - -Checks whether an AVPlayer is looping. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| - -**Returns** - -Returns **true** if the AVPlayer is looping; returns **false** if the AVPlayer is not looping or the input parameter **player** is a null pointer. - - -### OH_AVPlayer_IsPlaying() - -``` -bool OH_AVPlayer_IsPlaying (OH_AVPlayer *player) -``` - -**Description** - -Checks whether an AVPlayer is playing. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| - -**Returns** - -Returns **true** if the AVPlayer is playing; returns **false** if the AVPlayer is not playing or the input parameter **player** is a null pointer. - - -### OH_AVPlayer_Pause() - -``` -OH_AVErrCode OH_AVPlayer_Pause (OH_AVPlayer *player) -``` - -**Description** - -Pauses playback. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The **Pause** operation is added to the task queue. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player Pause** fails. - - -### OH_AVPlayer_Play() - -``` -OH_AVErrCode OH_AVPlayer_Play (OH_AVPlayer *player) -``` - -**Description** - -Starts playback. - -This function must be called after **Prepare**. In other words, you can call this function when the AVPlayer is in the prepared state. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The playback starts. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player Play** fails. - - -### OH_AVPlayer_Prepare() - -``` -OH_AVErrCode OH_AVPlayer_Prepare (OH_AVPlayer *player) -``` - -**Description** - -Prepares the playback environment and buffers media data. - -This function must be called after **SetSource**. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The **Prepare** operation is added to the task queue. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player Prepare** fails. - - -### OH_AVPlayer_Release() - -``` -OH_AVErrCode OH_AVPlayer_Release (OH_AVPlayer *player) -``` - -**Description** - -Asynchronously releases an **OH_AVPlayer** instance. - -The asynchronous function ensures the performance, but cannot ensure that the surface buffer of the playback window is released. You must ensure the lifecycle of the playback window. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The **Release** operation is added to the task queue. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player Release** fails. - - -### OH_AVPlayer_ReleaseSync() - -``` -OH_AVErrCode OH_AVPlayer_ReleaseSync (OH_AVPlayer *player) -``` - -**Description** - -Synchronously releases an **OH_AVPlayer** instance. - -The synchronous function ensures that the display buffer of the playback window is released, with a long time. Therefore, you need to design an asynchronous mechanism. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The AVPlayer is released. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player ReleaseSync** fails. - -### OH_AVPlayer_Reset() - -``` -OH_AVErrCode OH_AVPlayer_Reset (OH_AVPlayer *player) -``` - -**Description** - -Restores the AVPlayer to the initial state. - -After the function is called, you can call **SetSource** to set the media source to play, and then call **Prepare** and **Play** in sequence. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The **reset** operation is added to the task queue. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player Reset** fails. - - -### OH_AVPlayer_Seek() - -``` -OH_AVErrCode OH_AVPlayer_Seek (OH_AVPlayer *player, int32_t mSeconds, AVPlayerSeekMode mode) -``` - -**Description** - -Seeks to a playback position. - -This function can be used when the AVPlayer is in the playing or paused state. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| -| mSeconds | Position to seek to, in ms.| -| mode | Seek mode. For details about the available options, see [AVPlayerSeekMode](#avplayerseekmode).| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -AV_ERR_OK: The seek operation is complete. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player Seek** fails. - - -### OH_AVPlayer_SelectBitRate() - -``` -OH_AVErrCode OH_AVPlayer_SelectBitRate (OH_AVPlayer *player, uint32_t bitRate) -``` - -**Description** - -Sets the bit rate used by an HLS player, - -in bit/s. This function is valid only for HLS network streams. By default, the player selects a proper bit rate and speed based on the network connection. You can set a bit rate available in the valid bit rates reported in **INFO_TYPE_BITRATE_COLLECT**. The player selects a bit rate that is lower than or closest to the specified bit rate for playback. When ready, you can query the selected bit rate. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| -| bitRate | Bit rate, in kbit/s.| - -**Returns** - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The bit rate is set. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player SelectBitRate** fails. - - -### OH_AVPlayer_SelectTrack() - -``` -OH_AVErrCode OH_AVPlayer_SelectTrack (OH_AVPlayer *player, int32_t index) -``` - -**Description** - -Selects an audio track. This function is not supported yet. - -By default, the first audio stream with data is played. After the setting takes effect, the original track becomes invalid. This API sets the audio track to the ready state. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| -| index | Index of the track.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: A track is selected. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player SelectTrack** fails. - - -### OH_AVPlayer_SetAudioEffectMode() - -``` -OH_AVErrCode OH_AVPlayer_SetAudioEffectMode (OH_AVPlayer *player, OH_AudioStream_AudioEffectMode effectMode) -``` - -**Description** - -Sets the audio effect mode for an AVPlayer. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance. | -| interruptMode | Audio effect mode. For details about the available options, see [OH_AudioStream_AudioEffectMode](../apis-audio-kit/_o_h_audio.md#oh_audiostream_audioeffectmode). | - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The setting is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer or **effectMode** is invalid. - - -### OH_AVPlayer_SetAudioInterruptMode() - -``` -OH_AVErrCode OH_AVPlayer_SetAudioInterruptMode (OH_AVPlayer *player, OH_AudioInterrupt_Mode interruptMode) -``` - -**Description** - -Sets the audio interruption mode for an AVPlayer. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance. | -| interruptMode | Audio interruption mode. For details about the available options, see [OH_AudioInterrupt_Mode](../apis-audio-kit/_o_h_audio.md#oh_audiointerrupt_mode). | - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The setting is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer or **interruptMode** is invalid. - - -### OH_AVPlayer_SetAudioRendererInfo() - -``` -OH_AVErrCode OH_AVPlayer_SetAudioRendererInfo (OH_AVPlayer *player, OH_AudioStream_Usage streamUsage) -``` - -**Description** - -Sets the audio stream type for an AVPlayer. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance. | -| streamUsage | Audio stream type. For details about the available options, see [OH_AudioStream_Usage](../apis-audio-kit/_o_h_audio.md#oh_audiostream_usage). | - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The setting is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer or **streamUsage** is invalid. - - -### OH_AVPlayer_SetDecryptionConfig() - -``` -OH_AVErrCode OH_AVPlayer_SetDecryptionConfig (OH_AVPlayer *player, MediaKeySession *mediaKeySession, bool secureVideoPath) -``` - -**Description** - -Sets the decryption information. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| -| mediaKeySession | Pointer to the media key session with the decryption feature.| -| secureVideoPath | Whether a secure decoder is required.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The setting is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player SetDecryptionConfig** fails. - - -### OH_AVPlayer_SetFDSource() - -``` -OH_AVErrCode OH_AVPlayer_SetFDSource (OH_AVPlayer *player, int32_t fd, int64_t offset, int64_t size) -``` - -**Description** - -Sets the file descriptor of a media source to be played by an AVPlayer. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| -| fd | File descriptor of the media source.| -| offset | Offset of the media source in the file descriptor.| -| size | Size of the media source.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The file descriptor is set. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player SetFdSource** fails. - - -### OH_AVPlayer_SetLooping() - -``` -OH_AVErrCode OH_AVPlayer_SetLooping (OH_AVPlayer *player, bool loop) -``` - -**Description** - -Enables loop playback. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| -| loop | Whether to enable loop playback.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: Loop playback is enabled. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player SetLooping** fails. - - -### OH_AVPlayer_SetMediaKeySystemInfoCallback() - -``` -OH_AVErrCode OH_AVPlayer_SetMediaKeySystemInfoCallback (OH_AVPlayer *player, Player_MediaKeySystemInfoCallback callback) -``` - -**Description** - -Sets a callback to return the media key system information for an AVPlayer. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| -| callback | Callback.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The setting is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, the input parameter **callback** is null, or the execution of **player SetDrmSystemInfoCallback** fails. - - -### OH_AVPlayer_SetOnErrorCallback() - -``` -OH_AVErrCode OH_AVPlayer_SetOnErrorCallback (OH_AVPlayer * player, OH_AVPlayerOnErrorCallback callback, void * userData ) -``` - -**Description** - -Sets a callback for the event indicating that an error occurs in the AVPlayer. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance. | -| callback | Pointer to the callback. If a null pointer is passed in, the listening for AVPlayer errors is canceled. | -| userData | Pointer to the instance set by the caller. | - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The operation is successful. - -**AV_ERR_NO_MEMORY**: An error occurs during memory allocation. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer or the function fails to be executed. - - -### OH_AVPlayer_SetOnInfoCallback() - -``` -OH_AVErrCode OH_AVPlayer_SetOnInfoCallback (OH_AVPlayer * player, OH_AVPlayerOnInfoCallback callback, void * userData ) -``` - -**Description** - -Sets a callback for the event indicating that the AVPlayer receives a message. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance. | -| callback | Pointer to the callback. If a null pointer is passed in, the listening for AVPlayer messages is canceled. | -| userData | Pointer to the instance set by the caller. | - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The operation is successful. - -**AV_ERR_NO_MEMORY**: An error occurs during memory allocation. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer or the function fails to be executed. - - -### OH_AVPlayer_SetPlaybackSpeed() - -``` -OH_AVErrCode OH_AVPlayer_SetPlaybackSpeed (OH_AVPlayer *player, AVPlaybackSpeed speed) -``` - -**Description** - -Sets the playback speed for an AVPlayer. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| -| speed | Playback speed. For details about the available options, see [AVPlaybackSpeed](#avplaybackspeed).| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The playback speed is set. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer. - - -### OH_AVPlayer_SetPlayerCallback() - -``` -OH_AVErrCode OH_AVPlayer_SetPlayerCallback (OH_AVPlayer *player, AVPlayerCallback callback) -``` - -**Description** -Sets an AVPlayer callback. - -The callbacks [OH_AVPlayerOnInfo](#oh_avplayeroninfo) and [OH_AVPlayerOnError](#oh_avplayeronerror) set by using this function can transfer limited information. In addition, it is inconvenient for the application to distinguish between multiple **AVPlayer** instances. Therefore, since API version 12, [OH_AVPlayer_SetOnInfoCallback()](#oh_avplayer_setoninfocallback) and [OH_AVPlayer_SetOnErrorCallback()](#oh_avplayer_setonerrorcallback) are provided to set the callbacks [OH_AVPlayerOnInfoCallback](../../reference/apis-media-kit/_a_v_player.md#oh_avplayeroninfocallback) and [OH_AVPlayerOnErrorCallback](../../reference/apis-media-kit/_a_v_player.md#oh_avplayeronerrorcallback), respectively. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| -| callback | Callback used to return the result.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The callback is set. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, the input parameter **callback.onInfo** or **onError** is null, or the execution of **player SetPlayerCallback** fails. - - -### OH_AVPlayer_SetURLSource() - -``` -OH_AVErrCode OH_AVPlayer_SetURLSource (OH_AVPlayer *player, const char *url) -``` - -**Description** - -Sets the HTTP URL of a media source to be played by an AVPlayer. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| -| url | URL of the media source.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The setting is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, the input parameter **url** is null, or the execution of **player SetUrlSource** fails. - - -### OH_AVPlayer_SetVideoSurface() - -``` -OH_AVErrCode OH_AVPlayer_SetVideoSurface (OH_AVPlayer *player, OHNativeWindow *window) -``` - -**Description** - -Sets a playback window. -This function must be called after **SetSource** and before **Prepare**. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| -| window | Pointer to an **OHNativeWindow** instance.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -AV_ERR_OK: The playback window is set. - -**AV_ERR_INVALID_VAL**: The input parameter **player** or **window** is a null pointer, or the execution of **player SetVideoSurface** fails. - - -### OH_AVPlayer_SetVolume() - -``` -OH_AVErrCode OH_AVPlayer_SetVolume (OH_AVPlayer *player, float leftVolume, float rightVolume) -``` - -**Description** - -Sets the volume for an AVPlayer. - -This function can be used when the AVPlayer is in the playing or paused state. The value **0** means that the AVPlayer is muted, and **1** means that the original volume is used. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| -| leftVolume | Target volume of the left channel.| -| rightVolume | Target volume of the right channel.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -AV_ERR_OK: The volume is set. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player SetVolume** fails. - - -### OH_AVPlayer_SetVolumeMode() - -``` -OH_AVErrCode OH_AVPlayer_SetVolumeMode(OH_AVPlayer *player, OH_AudioStream_VolumeMode volumeMode) -``` - -**Description** - -Sets the audio volume mode for an AVPlayer. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 18 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| -| volumeMode | Audio volume mode. For details about the available options, see [OH_AudioStream_VolumeMode](../apis-audio-kit/_o_h_audio.md#oh_audiostream_volumemode).| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The operation is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer or **volumeMode** is invalid. - -**AV_ERR_INVALID_STATE**: The function is called in an invalid state. It must be in the prepared state. - -**AV_ERR_SERVICE_DIED**: A system error occurs. - - -### OH_AVPlayer_Stop() - -``` -OH_AVErrCode OH_AVPlayer_Stop (OH_AVPlayer *player) -``` - -**Description** - -Stops playback. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| player | Pointer to an **OH_AVPlayer** instance.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The **stop** operation is added to the task queue. - -**AV_ERR_INVALID_VAL**: The input parameter **player** is a null pointer, or the execution of **player Stop** fails. - - -## Variable Description - - -### OH_PLAYER_AUDIO_DEVICE_CHANGE_REASON - -``` -const char* OH_PLAYER_AUDIO_DEVICE_CHANGE_REASON -``` -**Description** - -Pointer to the key for obtaining the audio device change reason. The value is of the int32_t type. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - - -### OH_PLAYER_AUDIO_INTERRUPT_FORCE - -``` -const char* OH_PLAYER_AUDIO_INTERRUPT_FORCE -``` - -**Description** - -Pointer to the key for obtaining the FORCE type of audio interruption. The value is of the int32_t type. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - - -### OH_PLAYER_AUDIO_INTERRUPT_HINT - -``` -const char* OH_PLAYER_AUDIO_INTERRUPT_HINT -``` - -**Description** - -Pointer to the key for obtaining the HINT type of audio interruption. The value is of the int32_t type. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - - -### OH_PLAYER_AUDIO_INTERRUPT_TYPE - -``` -const char* OH_PLAYER_AUDIO_INTERRUPT_TYPE -``` - -**Description** - -Pointer to the key for obtaining the audio interruption type. The value is of the int32_t type. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - - -### OH_PLAYER_BITRATE - -``` -const char* OH_PLAYER_BITRATE -``` - -**Description** - -Pointer to the key for obtaining the bit rate. The value is of the int32_t type. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - - -### OH_PLAYER_BITRATE_ARRAY - -``` -const char* OH_PLAYER_BITRATE_ARRAY -``` - -**Description** - -Pointer to the key for obtaining the bit rate array. The value is of the uint8_t byte array type. When this key is used to obtain information, you need to: -- Use a pointer variable of the uint8_t type to store the bit rate list and use a variable of the size_t type to store the byte array length. -- Allocate several storage spaces of the uint32_t type to receive the bit rate integer of the uint32_t type, which is converted from the uint8_t byte array. For details, see the **OHAVPlayerOnInfoCallback** function in [Sample Code](../../media/media/using-ndk-avplayer-for-playback.md#sample-code). - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - - -### OH_PLAYER_BUFFERING_TYPE - -``` -const char* OH_PLAYER_BUFFERING_TYPE -``` - -**Description** - -Pointer to the key for obtaining the type of the buffer update message. The value type is [AVPlayerBufferingType](#avplayerbufferingtype-1). When this key is used to obtain information, you must use a variable of the int32_t type to save the result and then convert the result to a value of [AVPlayerBufferingType](#avplayerbufferingtype-1). - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - - -### OH_PLAYER_BUFFERING_VALUE - -``` -const char* OH_PLAYER_BUFFERING_VALUE -``` - -**Description** - -Pointer to the key for obtaining the value of the buffer update message. The value is of the int32_t type. For details about the available options, see [AVPlayerBufferingType](#avplayerbufferingtype-1). This key is valid when the buffer update message type is **AVPLAYER_BUFFERING_PERCENT** or **AVPLAYER_BUFFERING_CACHED_DURATION**. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - - -### OH_PLAYER_CURRENT_POSITION - -``` -const char* OH_PLAYER_CURRENT_POSITION -``` - -**Description** - -Pointer to the key for obtaining the playback progress information. The value is of the int32_t type. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - - -### OH_PLAYER_DURATION - -``` -const char* OH_PLAYER_DURATION -``` - -**Description** - -Pointer to the key for obtaining the media asset duration. The value type is int64_t. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - - -### OH_PLAYER_IS_LIVE_STREAM - -``` -const char* OH_PLAYER_IS_LIVE_STREAM -``` - -**Description** - -Pointer to the key for checking whether a media asset is live streaming. The value is of the int32_t type. - -The value **1** means live streaming. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - - -### OH_PLAYER_MESSAGE_TYPE - -``` -const char* OH_PLAYER_MESSAGE_TYPE -``` - -**Description** - -Pointer to the key for obtaining the type of message received by the AVPlayer. The value is of the int32_t type. - -The value **1** means that the video frame starts to be rendered. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - - -### OH_PLAYER_PLAYBACK_SPEED - -``` -const char* OH_PLAYER_PLAYBACK_SPEED -``` - -**Description** - -Pointer to the key for obtaining the playback speed. The value type is [AVPlaybackSpeed](#avplaybackspeed-1). When this key is used to obtain information, you must use a variable of the int32_t type to save the result and then convert the result to a value of [AVPlaybackSpeed](#avplaybackspeed-1). - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - - -### OH_PLAYER_SEEK_POSITION - -``` -const char* OH_PLAYER_SEEK_POSITION -``` - -**Description** - -Pointer to the key for obtaining the playback progress after the seek operation. The value is of the int32_t type. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - - -### OH_PLAYER_STATE - -``` -const char* OH_PLAYER_STATE -``` - -**Description** - -Pointer to the key for obtaining the AVPlayer state. The value is of the int32_t type. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - - -### OH_PLAYER_STATE_CHANGE_REASON - -``` -const char* OH_PLAYER_STATE_CHANGE_REASON -``` - -**Description** - -Pointer to the key for obtaining the AVPlayer state change reason. The value is of the int32_t type. - -The value **1** means that the change is triggered by user operations, and **2** means that the change is triggered by the system. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - - -### OH_PLAYER_VIDEO_HEIGHT - -``` -const char* OH_PLAYER_VIDEO_HEIGHT -``` - -**Description** - -Pointer to the key for obtaining the video height. The value is of the int32_t type. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - - -### OH_PLAYER_VIDEO_WIDTH - -``` -const char* OH_PLAYER_VIDEO_WIDTH -``` - -**Description** - -Pointer to the key for obtaining the video width. The value is of the int32_t type. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 - - -### OH_PLAYER_VOLUME - -``` -const char* OH_PLAYER_VOLUME -``` - -**Description** - -Pointer to the key for obtaining the volume. The value type is float. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 12 diff --git a/en/application-dev/reference/apis-media-kit/_a_v_player_callback.md b/en/application-dev/reference/apis-media-kit/_a_v_player_callback.md deleted file mode 100644 index b0e61add57b..00000000000 --- a/en/application-dev/reference/apis-media-kit/_a_v_player_callback.md +++ /dev/null @@ -1,28 +0,0 @@ -# AVPlayerCallback - - -## Overview - -The AVPlayerCallback struct contains the set of the **OH_AVPlayerOnInfo** and **OH_AVPlayerOnInfo** callback function pointers. To ensure the normal running of **OH_AVPlayer**, you must register the instance of this struct with the **OH_AVPlayer** instance and process the information reported by the callback functions. - -**System capability**: SystemCapability.Multimedia.Media.AVPlayer - -**Since**: 11 - -**Deprecated from**: 12 - -**Substitute**: [OH_AVPlayerOnInfoCallback](_a_v_player.md#oh_avplayeroninfocallback) and [OH_AVPlayerOnErrorCallback](_a_v_player.md#oh_avplayeronerrorcallback) - -**Related module**: [AVPlayer](_a_v_player.md) - -**Header file**: [avplayer_base.h](avplayer__base_8h.md) - -## Summary - - -### Member Variables - -| Name| Description| -| -------- | -------- | -| onInfo | AVPlayer process information. For details, see [OH_AVPlayerOnInfo](_a_v_player.md#oh_avplayeroninfo).| -| onError | AVPlayer error information. For details, see [OH_AVPlayerOnError](_a_v_player.md#oh_avplayeronerror).| diff --git a/en/application-dev/reference/apis-media-kit/_a_v_recorder.md b/en/application-dev/reference/apis-media-kit/_a_v_recorder.md deleted file mode 100644 index eaff1f3309a..00000000000 --- a/en/application-dev/reference/apis-media-kit/_a_v_recorder.md +++ /dev/null @@ -1,1018 +0,0 @@ -# AVRecorder - - -## Overview - -The AVRecorder module provides the APIs for requesting the recording capability. - -You can refer to the corresponding development guide and samples based on your development requirements. - -- [Using AVRecorder to Record Audio (C/C++)](../../media/media/using-ndk-avrecorder-for-audio-recording.md) -- [Using AVRecorder to Record Videos (C/C++)](../../media/media/using-ndk-avrecorder-for-video-recording.md) - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - - -## Summary - - -### Files - -| Name| Description| -| -------- | -------- | -| [avrecorder.h](avrecorder_8h.md) | Declares the AVRecorder APIs. Applications can use the APIs to record media data.| -| [avrecorder_base.h](avrecorder__base_8h.md) | Declares the struct and enums used by the AVRecorder.| - - -### Structs - -| Name| Description| -| -------- | -------- | -| struct [OH_AVRecorder_Profile](_o_h___a_v_recorder___profile.md) | Describes the parameters used for audio and video recording.
You can choose to record only audio or only video by setting the parameters. When **audioBitrate** or **audioChannels** is set to **0**, audio recording is disabled. When **videoFrameWidth** or **videoFrameHeight** is set to **0**, video recording is disabled.| -| struct [OH_AVRecorder_Location](_o_h___a_v_recorder___location.md) | Describes the geographical location information about a media asset.| -| struct [OH_AVRecorder_MetadataTemplate](_o_h___a_v_recorder___metadata_template.md) | Describes the basic template of metadata.| -| struct [OH_AVRecorder_Metadata](_o_h___a_v_recorder___metadata.md) | Describes the metadata.| -| struct [OH_AVRecorder_Config](_o_h___a_v_recorder___config.md) | Describes the AVRecorder configuration.| -| struct [OH_AVRecorder_Range](_o_h___a_v_recorder___range.md) | Describes the range.| -| struct [OH_AVRecorder_EncoderInfo](_o_h___a_v_recorder___encoder_info.md) | Describes the encoder information.| - - -### Types - -| Name| Description| -| -------- | -------- | -| typedef struct [OH_AVRecorder](#oh_avrecorder) [OH_AVRecorder](#oh_avrecorder) | Defines a struct for the AVRecorder.| -| typedef enum [OH_AVRecorder_AudioSourceType](#oh_avrecorder_audiosourcetype-1) [OH_AVRecorder_AudioSourceType](#oh_avrecorder_audiosourcetype) | Defines an enum for the audio source types of the AVRecorder.| -| typedef enum [OH_AVRecorder_VideoSourceType](#oh_avrecorder_videosourcetype-1) [OH_AVRecorder_VideoSourceType](#oh_avrecorder_videosourcetype) | Defines an enum for the video source types of the AVRecorder.| -| typedef enum [OH_AVRecorder_CodecMimeType](#oh_avrecorder_codecmimetype-1) [OH_AVRecorder_CodecMimeType](#oh_avrecorder_codecmimetype) | Defines an enum for the MIME types of the encoder.| -| typedef enum [OH_AVRecorder_ContainerFormatType](#oh_avrecorder_containerformattype-1) [OH_AVRecorder_ContainerFormatType](#oh_avrecorder_containerformattype) | Defines an enum for the Container Format Types (CFTs).| -| typedef enum [OH_AVRecorder_State](#oh_avrecorder_state-1) [OH_AVRecorder_State](#oh_avrecorder_state) | Defines an enum for the AVRecorder states.| -| typedef enum [OH_AVRecorder_StateChangeReason](#oh_avrecorder_statechangereason-1) [OH_AVRecorder_StateChangeReason](#oh_avrecorder_statechangereason) | Defines an enum for the reasons for AVRecorder state changes.| -| typedef enum [OH_AVRecorder_FileGenerationMode](#oh_avrecorder_filegenerationmode-1) [OH_AVRecorder_FileGenerationMode](#oh_avrecorder_filegenerationmode) | Defines an enum for the modes available for creating a recording file.| -| typedef struct [OH_AVRecorder_Profile](_o_h___a_v_recorder___profile.md) [OH_AVRecorder_Profile](#oh_avrecorder_profile) | Defines a struct for the parameters used for audio and video recording.
You can choose to record only audio or only video by setting the parameters. When **audioBitrate** or **audioChannels** is set to **0**, audio recording is disabled. When **videoFrameWidth** or **videoFrameHeight** is set to **0**, video recording is disabled.| -| typedef struct [OH_AVRecorder_Location](_o_h___a_v_recorder___location.md) [OH_AVRecorder_Location](#oh_avrecorder_location) | Defines a struct for the geographical location information about a media asset.| -| typedef struct [OH_AVRecorder_MetadataTemplate](_o_h___a_v_recorder___metadata_template.md) [OH_AVRecorder_MetadataTemplate](#oh_avrecorder_metadatatemplate) | Defines a struct for the basic template of metadata.| -| typedef struct [OH_AVRecorder_Metadata](_o_h___a_v_recorder___metadata.md) [OH_AVRecorder_Metadata](#oh_avrecorder_metadata) | Defines a struct for the metadata.| -| typedef struct [OH_AVRecorder_Config](_o_h___a_v_recorder___config.md) [OH_AVRecorder_Config](#oh_avrecorder_config) | Defines a struct for the AVRecorder configuration.| -| typedef struct [OH_AVRecorder_Range](_o_h___a_v_recorder___range.md) [OH_AVRecorder_Range](#oh_avrecorder_range) | Defines a struct for the range.| -| typedef struct [OH_AVRecorder_EncoderInfo](_o_h___a_v_recorder___encoder_info.md) [OH_AVRecorder_EncoderInfo](#oh_avrecorder_encoderinfo) | Defines a struct for the encoder information.| -| typedef void(\* [OH_AVRecorder_OnStateChange](#oh_avrecorder_onstatechange)) ([OH_AVRecorder](#oh_avrecorder) \*recorder, [OH_AVRecorder_State](#oh_avrecorder_state) state, [OH_AVRecorder_StateChangeReason](#oh_avrecorder_statechangereason) reason, void \*userData) | Defines a callback invoked when the AVRecorder state changes.| -| typedef void(\* [OH_AVRecorder_OnError](#oh_avrecorder_onerror)) ([OH_AVRecorder](#oh_avrecorder) \*recorder, int32_t errorCode, const char \*errorMsg, void \*userData) | Defines a callback invoked when an error occurs during recording.| -| typedef void(\* [OH_AVRecorder_OnUri](#oh_avrecorder_onuri)) ([OH_AVRecorder](#oh_avrecorder) \*recorder, OH_MediaAsset \*asset, void \*userData) | Defines a callback invoked when the recording is in OH_AVRecorder_FileGenerationMode.AVRECORDER_AUTO_CREATE_CAMERA_SCENE mode.| - - -### Enums - -| Name| Description| -| -------- | -------- | -| [OH_AVRecorder_AudioSourceType](#oh_avrecorder_audiosourcetype-1) {
AVRECORDER_DEFAULT = 0,
AVRECORDER_MIC = 1,
AVRECORDER_VOICE_RECOGNITION = 2,
AVRECORDER_VOICE_COMMUNICATION = 7,
AVRECORDER_VOICE_MESSAGE = 10,
AVRECORDER_CAMCORDER = 13
} | Enumerates the audio source types of the AVRecorder.| -| [OH_AVRecorder_VideoSourceType](#oh_avrecorder_videosourcetype-1) {
AVRECORDER_SURFACE_YUV = 0,
AVRECORDER_SURFACE_ES = 1 } | Enumerates the video source types of the AVRecorder.| -| [OH_AVRecorder_CodecMimeType](#oh_avrecorder_codecmimetype-1) {
AVRECORDER_VIDEO_AVC = 2,
AVRECORDER_AUDIO_AAC = 3,
AVRECORDER_AUDIO_MP3 = 4,
AVRECORDER_AUDIO_G711MU = 5,
AVRECORDER_VIDEO_MPEG4 = 6,
AVRECORDER_VIDEO_HEVC = 8,
AVRECORDER_AUDIO_AMR_NB = 9,
AVRECORDER_AUDIO_AMR_WB = 10
} | Enumerates the MIME types of the encoder.| -| [OH_AVRecorder_ContainerFormatType](#oh_avrecorder_containerformattype-1) {
AVRECORDER_CFT_MPEG_4 = 2,
AVRECORDER_CFT_MPEG_4A = 6,
AVRECORDER_CFT_AMR = 8,
AVRECORDER_CFT_MP3 = 9,
AVRECORDER_CFT_WAV = 10
} | Enumerates the CFTs.| -| [OH_AVRecorder_State](#oh_avrecorder_state-1) {
AVRECORDER_IDLE = 0,
AVRECORDER_PREPARED = 1,
AVRECORDER_STARTED = 2,
AVRECORDER_PAUSED = 3,
AVRECORDER_STOPPED = 4,
AVRECORDER_RELEASED = 5, AVRECORDER_ERROR = 6
} | Enumerates the AVRecorder states.| -| [OH_AVRecorder_StateChangeReason](#oh_avrecorder_statechangereason-1) {
AVRECORDER_USER = 0,
AVRECORDER_BACKGROUND = 1
} | Enumerates the reasons for AVRecorder state changes.| -| [OH_AVRecorder_FileGenerationMode](#oh_avrecorder_filegenerationmode-1) {
AVRECORDER_APP_CREATE = 0, AVRECORDER_AUTO_CREATE_CAMERA_SCENE = 1
} | Enumerates the modes available for creating a recording file.| - - -### Functions - -| Name| Description| -| -------- | -------- | -| [OH_AVRecorder](#oh_avrecorder) \* [OH_AVRecorder_Create](#oh_avrecorder_create) (void) | Creates an AVRecorder instance. After this function is successfully called, the AVRecorder transitions to the AVRECORDER_IDLE state.| -| OH_AVErrCode [OH_AVRecorder_Prepare](#oh_avrecorder_prepare) ([OH_AVRecorder](#oh_avrecorder) \*recorder, [OH_AVRecorder_Config](_o_h___a_v_recorder___config.md) \*config) | Sets AVRecorder parameters to prepare for recording. This function must be called after [OH_AVRecorder_Start](#oh_avrecorder_start) is successfully triggered. After this function is successfully called, the AVRecorder transitions to the AVRECORDER_PREPARED state.| -| OH_AVErrCode [OH_AVRecorder_GetAVRecorderConfig](#oh_avrecorder_getavrecorderconfig) ([OH_AVRecorder](#oh_avrecorder) \*recorder, [OH_AVRecorder_Config](_o_h___a_v_recorder___config.md) \*\*config) | Obtains the AVRecorder configuration. This function must be called after the recording preparation is complete. **config** must be set to a null pointer. The framework layer allocates and releases the memory in a unified manner to avoid issues with memory management, such as leaks or double freeing.| -| OH_AVErrCode [OH_AVRecorder_GetInputSurface](#oh_avrecorder_getinputsurface) ([OH_AVRecorder](#oh_avrecorder) \*recorder, OHNativeWindow \*\*window) | Obtains an input surface. This function must be called after [OH_AVRecorder_Prepare](#oh_avrecorder_prepare) is successfully triggered and before [OH_AVRecorder_Start](#oh_avrecorder_start) is called.| -| OH_AVErrCode [OH_AVRecorder_UpdateRotation](#oh_avrecorder_updaterotation) ([OH_AVRecorder](#oh_avrecorder) \*recorder, int32_t rotation) | Updates the video rotation angle. This function must be called after [OH_AVRecorder_Prepare](#oh_avrecorder_prepare) is successfully triggered and before [OH_AVRecorder_Start](#oh_avrecorder_start) is called.| -| OH_AVErrCode [OH_AVRecorder_Start](#oh_avrecorder_start) ([OH_AVRecorder](#oh_avrecorder) \*recorder) | Starts recording. This function must be called after [OH_AVRecorder_Prepare](#oh_avrecorder_prepare) is successfully triggered. After this function is successfully called, the AVRecorder transitions to the AVRECORDER_STARTED state.| -| OH_AVErrCode [OH_AVRecorder_Pause](#oh_avrecorder_pause) ([OH_AVRecorder](#oh_avrecorder) \*recorder) | Pauses recording. This function must be called after [OH_AVRecorder_Start](#oh_avrecorder_start) is successfully triggered and the AVRecorder is in the AVRECORDER_STARTED state. After this function is successfully called, the AVRecorder transitions to the AVRECORDER_PAUSED state.| -| OH_AVErrCode [OH_AVRecorder_Resume](#oh_avrecorder_resume) ([OH_AVRecorder](#oh_avrecorder) \*recorder) | Resumes recording. This function must be called after [OH_AVRecorder_Pause](#oh_avrecorder_pause) is successfully triggered and the AVRecorder is in the AVRECORDER_PAUSED state. After this function is successfully called, the AVRecorder transitions to the AVRECORDER_STARTED state.| -| OH_AVErrCode [OH_AVRecorder_Stop](#oh_avrecorder_stop) ([OH_AVRecorder](#oh_avrecorder) \*recorder) | Stops recording. This function must be called after [OH_AVRecorder_Start](#oh_avrecorder_start) is successfully triggered. After this function is successfully called, the AVRecorder transitions to the AVRECORDER_STOPPED state.| -| OH_AVErrCode [OH_AVRecorder_Reset](#oh_avrecorder_reset) ([OH_AVRecorder](#oh_avrecorder) \*recorder) | Resets the recording state. This function must be called when the AVRecorder is not in the AVRECORDER_RELEASED state. After this function is successfully called, the AVRecorder transitions to the AVRECORDER_IDLE state.| -| OH_AVErrCode [OH_AVRecorder_Release](#oh_avrecorder_release) ([OH_AVRecorder](#oh_avrecorder) \*recorder) | Releases recording resources. After this API is successfully called, the AVRecorder transitions to the AVRECORDER_RELEASED state. The recorder memory will be released. The application layer must explicitly set the recorder to a null pointer to avoid access to wild pointers.| -| OH_AVErrCode [OH_AVRecorder_GetAvailableEncoder](#oh_avrecorder_getavailableencoder) ([OH_AVRecorder](#oh_avrecorder) \*recorder, [OH_AVRecorder_EncoderInfo](_o_h___a_v_recorder___encoder_info.md) \*\*info, int32_t \*length) | Obtains the available encoders and encoder information of the AVRecorder. **info** must be set to a null pointer. The framework layer allocates and releases the memory in a unified manner to avoid issues with memory management, such as leaks or double freeing.| -| OH_AVErrCode [OH_AVRecorder_SetStateCallback](#oh_avrecorder_setstatecallback) ([OH_AVRecorder](#oh_avrecorder) \*recorder, [OH_AVRecorder_OnStateChange](#oh_avrecorder_onstatechange) callback, void \*userData) | Sets a state callback so that the application can respond to state change events generated by the AVRecorder. This function must be called before [OH_AVRecorder_Start](#oh_avrecorder_start) is called.| -| OH_AVErrCode [OH_AVRecorder_SetErrorCallback](#oh_avrecorder_seterrorcallback) ([OH_AVRecorder](#oh_avrecorder) \*recorder, [OH_AVRecorder_OnError](#oh_avrecorder_onerror) callback, void \*userData) | Sets an error callback so that the application can respond to error events generated by the AVRecorder. This function must be called before [OH_AVRecorder_Start](#oh_avrecorder_start) is called.| -| OH_AVErrCode [OH_AVRecorder_SetUriCallback](#oh_avrecorder_seturicallback) ([OH_AVRecorder](#oh_avrecorder) \*recorder, [OH_AVRecorder_OnUri](#oh_avrecorder_onuri) callback, void \*userData) | Sets a URI callback so that the application can respond to URI events generated by the AVRecorder. This function must be called before [OH_AVRecorder_Start](#oh_avrecorder_start) is called.| - - -## Type Description - - -### OH_AVRecorder - -``` -typedef struct OH_AVRecorder OH_AVRecorder -``` - -**Description** - -Defines a struct for the AVRecorder. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - - -### OH_AVRecorder_AudioSourceType - -``` -typedef enum OH_AVRecorder_AudioSourceType OH_AVRecorder_AudioSourceType -``` - -**Description** - -Defines an enum for the audio source types of the AVRecorder. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - - -### OH_AVRecorder_CodecMimeType - -``` -typedef enum OH_AVRecorder_CodecMimeType OH_AVRecorder_CodecMimeType -``` - -**Description** - -Defines an enum for the MIME types of the encoder. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - - -### OH_AVRecorder_Config - -``` -typedef struct OH_AVRecorder_Config OH_AVRecorder_Config -``` - -**Description** - -Defines a struct for the AVRecorder configuration. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - - -### OH_AVRecorder_ContainerFormatType - -``` -typedef enum OH_AVRecorder_ContainerFormatType OH_AVRecorder_ContainerFormatType -``` - -**Description** - -Defines an enum for the CFTs. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - - -### OH_AVRecorder_EncoderInfo - -``` -typedef struct OH_AVRecorder_EncoderInfo OH_AVRecorder_EncoderInfo -``` - -**Description** - -Defines a struct for the encoder information. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - - -### OH_AVRecorder_FileGenerationMode - -``` -typedef enum OH_AVRecorder_FileGenerationMode OH_AVRecorder_FileGenerationMode -``` - -**Description** - -Defines an enum for the modes available for creating a recording file. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - - -### OH_AVRecorder_Location - -``` -typedef struct OH_AVRecorder_Location OH_AVRecorder_Location -``` - -**Description** - -Defines a struct for the geographical location information about a media asset. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - - -### OH_AVRecorder_Metadata - -``` -typedef struct OH_AVRecorder_Metadata OH_AVRecorder_Metadata -``` - -**Description** - -Defines a struct for the metadata. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - - -### OH_AVRecorder_MetadataTemplate - -``` -typedef struct OH_AVRecorder_MetadataTemplate OH_AVRecorder_MetadataTemplate -``` - -**Description** - -Defines a struct for the basic template of metadata. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - - -### OH_AVRecorder_OnError - -``` -typedef void (*OH_AVRecorder_OnError)(OH_AVRecorder *recorder, int32_t errorCode, const char *errorMsg, void *userData) -``` - -**Description** - -Defines a callback invoked when an error occurs during recording. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| recorder | Pointer to an **OH_AVRecorder** instance.| -| errorCode | Error code.| -| errorMsg | Pointer to the error message.| -| userData | Pointer to user-defined data.| - - -### OH_AVRecorder_OnStateChange - -``` -typedef void (*OH_AVRecorder_OnStateChange)(OH_AVRecorder *recorder, OH_AVRecorder_State state, OH_AVRecorder_StateChangeReason reason, void *userData) -``` - -**Description** - -Defines a callback invoked when the AVRecorder state changes. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| recorder | Pointer to an **OH_AVRecorder** instance.| -| state | AVRecorder state. For details, see [OH_AVRecorder_State](#oh_avrecorder_state).| -| reason | Reason for the AVRecorder state change. For details, see [OH_AVRecorder_StateChangeReason](#oh_avrecorder_statechangereason).| -| userData | Pointer to user-defined data.| - - -### OH_AVRecorder_OnUri - -``` -typedef void (*OH_AVRecorder_OnUri)(OH_AVRecorder *recorder, OH_MediaAsset *asset, void *userData) -``` - -**Description** - -Defines a callback invoked when the recording is in OH_AVRecorder_FileGenerationMode.AVRECORDER_AUTO_CREATE_CAMERA_SCENE mode. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| recorder | Pointer to an **OH_AVRecorder** instance.| -| asset | Pointer to an **OH_MediaAsset** instance.| -| userData | Pointer to user-defined data.| - - -### OH_AVRecorder_Profile - -``` -typedef struct OH_AVRecorder_Profile OH_AVRecorder_Profile -``` - -**Description** - -Defines a struct for the parameters used for audio and video recording. - -You can choose to record only audio or only video by setting the parameters. When **audioBitrate** or **audioChannels** is set to **0**, audio recording is disabled. When **videoFrameWidth** or **videoFrameHeight** is set to **0**, video recording is disabled. - -For details about the value range of each parameter, see [AVRecorderProfile](js-apis-media.md#avrecorderprofile9). - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - - -### OH_AVRecorder_Range - -``` -typedef struct OH_AVRecorder_Range OH_AVRecorder_Range -``` - -**Description** - -Defines a struct for the range. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - - -### OH_AVRecorder_State - -``` -typedef enum OH_AVRecorder_State OH_AVRecorder_State -``` - -**Description** - -Defines an enum for the AVRecorder states. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - - -### OH_AVRecorder_StateChangeReason - -``` -typedef enum OH_AVRecorder_StateChangeReason OH_AVRecorder_StateChangeReason -``` - -**Description** - -Defines an enum for the reasons for AVRecorder state changes. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - - -### OH_AVRecorder_VideoSourceType - -``` -typedef enum OH_AVRecorder_VideoSourceType OH_AVRecorder_VideoSourceType -``` - -**Description** - -Defines an enum for the video source types of the AVRecorder. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - - -## Enum Description - - -### OH_AVRecorder_AudioSourceType - -``` -enum OH_AVRecorder_AudioSourceType -``` - -**Description** - -Enumerates the audio source types of the AVRecorder. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -| Value| Description| -| -------- | -------- | -| AVRECORDER_DEFAULT | Default audio source.| -| AVRECORDER_MIC | Microphone audio source.| -| AVRECORDER_VOICE_RECOGNITION | Audio source in speech recognition scenarios.| -| AVRECORDER_VOICE_COMMUNICATION | Voice communication source.| -| AVRECORDER_VOICE_MESSAGE | Voice message source.| -| AVRECORDER_CAMCORDER | Audio source in camera recording scenarios.| - - -### OH_AVRecorder_CodecMimeType - -``` -enum OH_AVRecorder_CodecMimeType -``` - -**Description** - -Enumerates the MIME types of the encoder. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -| Value| Description| -| -------- | -------- | -| AVRECORDER_VIDEO_AVC | MIME type of the H.264 encoder.| -| AVRECORDER_AUDIO_AAC | MIME type of the AAC encoder.| -| AVRECORDER_AUDIO_MP3 | MIME type of the MP3 encoder.| -| AVRECORDER_AUDIO_G711MU | MIME type of the G711-mulaw encoder.| -| AVRECORDER_VIDEO_MPEG4 | MIME type of the MPEG4 encoder.| -| AVRECORDER_VIDEO_HEVC | MIME type of the H.265 encoder.| -| AVRECORDER_AUDIO_AMR_NB | MIME type of the AMR-NB codec.| -| AVRECORDER_AUDIO_AMR_WB | MIME type of the AMR-WB codec.| - - -### OH_AVRecorder_ContainerFormatType - -``` -enum OH_AVRecorder_ContainerFormatType -``` - -**Description** - -Enumerates the CFTs. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -| Value| Description| -| -------- | -------- | -| AVRECORDER_CFT_MPEG_4 | Video container format mp4.| -| AVRECORDER_CFT_MPEG_4A | Audio container format m4a.| -| AVRECORDER_CFT_AMR | Audio container format amr.| -| AVRECORDER_CFT_MP3 | Audio container format mp3.| -| AVRECORDER_CFT_WAV | Audio container format wav.| - - -### OH_AVRecorder_FileGenerationMode - -``` -enum OH_AVRecorder_FileGenerationMode -``` - -**Description** - -Enumerates the modes available for creating a recording file. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -| Value| Description| -| -------- | -------- | -| AVRECORDER_APP_CREATE | The application creates a media file in the sandbox.| -| AVRECORDER_AUTO_CREATE_CAMERA_SCENE | The system creates a media file. This value is valid only in camera recording scenarios.| - - -### OH_AVRecorder_State - -``` -enum OH_AVRecorder_State -``` - -**Description** - -Enumerates the AVRecorder states. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -| Value| Description| -| -------- | -------- | -| AVRECORDER_IDLE | Idle. In this state, you can call **OH_AVRecorder_Prepare()** to set recording parameters, and the AVRecorder transitions to the AVRECORDER_PREPARED state.| -| AVRECORDER_PREPARED | Prepared. After the parameters are set, you can call **OH_AVRecorder_Start()** to start recording, and the AVRecorder transitions to the AVRECORDER_STARTED state.| -| AVRECORDER_STARTED | Started. Recording is in progress. In this case, you can call **OH_AVRecorder_Pause()** to pause recording, and the AVRecorder transitions to the AVRECORDER_PAUSED state. You can also call **OH_AVRecorder_Stop()** to stop recording, and the AVRecorder transitions to the AVRECORDER_STOPPED state.| -| AVRECORDER_PAUSED | Paused. In this state, you can call **OH_AVRecorder_Resume()** to resume recording, and the AVRecorder transitions to the AVRECORDER_STARTED state. You can also call **OH_AVRecorder_Stop()** to stop recording, and the AVRecorder transitions to the AVRECORDER_STOPPED state.| -| AVRECORDER_STOPPED | Stopped. In this state, you can call **OH_AVRecorder_Prepare()** to set recording parameters, and the AVRecorder transitions to the AVRECORDER_PREPARED state again.| -| AVRECORDER_RELEASED | Released. The recording resources are released. No operation can be performed at this time. In any other state, you can call **OH_AVRecorder_Release()** to transition to the AVRECORDER_RELEASED state.| -| AVRECORDER_ERROR | Error state. The AVRecorder transitions to this state when an irreversible error occurs in the instance. In this state, the OH_AVRecorder_OnError event is reported, with the detailed error cause. You should call **OH_AVRecorder_Reset()** to reset the AVRecorder instance or call **OH_AVRecorder_Release()** to release resources.| - - -### OH_AVRecorder_StateChangeReason - -``` -enum OH_AVRecorder_StateChangeReason -``` - -**Description** - -Enumerates the reasons for AVRecorder state changes. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -| Value| Description| -| -------- | -------- | -| AVRECORDER_USER | The state change is caused by user operations.| -| AVRECORDER_BACKGROUND | The state change is caused by background operations.| - - -### OH_AVRecorder_VideoSourceType - -``` -enum OH_AVRecorder_VideoSourceType -``` - -**Description** - -Enumerates the video source types of the AVRecorder. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -| Value| Description| -| -------- | -------- | -| AVRECORDER_SURFACE_YUV | Raw data surface.| -| AVRECORDER_SURFACE_ES | ES data surface.| - - -## Function Description - - -### OH_AVRecorder_Create() - -``` -OH_AVRecorder *OH_AVRecorder_Create(void) -``` - -**Description** - -Creates an AVRecorder instance. After this function is successfully called, the AVRecorder transitions to the AVRECORDER_IDLE state. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -**Returns** - -Returns the pointer to the **OH_AVRecorder** instance created if the operation is successful; returns a null pointer otherwise. - - -### OH_AVRecorder_Prepare() - -``` -OH_AVErrCode OH_AVRecorder_Prepare(OH_AVRecorder *recorder, OH_AVRecorder_Config *config) -``` - -**Description** - -Sets AVRecorder parameters to prepare for recording. This function must be called after [OH_AVRecorder_Start](#oh_avrecorder_start) is successfully triggered. After this function is successfully called, the AVRecorder transitions to the AVRECORDER_PREPARED state. - -To record only audio, you do not need to set video parameters. Similarly, to record only video, you do not need to set audio parameters. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| recorder | Pointer to an **OH_AVRecorder** instance.| -| config | Pointer to an [OH_AVRecorder_Config](_o_h___a_v_recorder___config.md) instance. For details, see [OH_AVRecorder_Config](_o_h___a_v_recorder___config.md).| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The operation is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **recorder** is a null pointer or the preparation fails. - - -### OH_AVRecorder_GetAVRecorderConfig() - -``` -OH_AVErrCode OH_AVRecorder_GetAVRecorderConfig(OH_AVRecorder *recorder, OH_AVRecorder_Config **config) -``` - -**Description** - -Obtains the AVRecorder configuration. This function must be called after the recording preparation is complete. **config** must be set to a null pointer. The framework layer allocates and releases the memory in a unified manner to avoid issues with memory management, such as leaks or double freeing. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| recorder | Pointer to an **OH_AVRecorder** instance.| -| config | Double pointer to the [OH_AVRecorder_Config](_o_h___a_v_recorder___config.md) instance. For details, see [OH_AVRecorder_Config](_o_h___a_v_recorder___config.md).| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The operation is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **recorder** is a null pointer or **config** is not a null pointer. - -**AV_ERR_NO_MEMORY**: The memory fails to be allocated due to insufficient memory. - - -### OH_AVRecorder_GetInputSurface() - -``` -OH_AVErrCode OH_AVRecorder_GetInputSurface(OH_AVRecorder *recorder, OHNativeWindow **window) -``` - -**Description** - -Obtains an input surface. This function must be called after [OH_AVRecorder_Prepare](#oh_avrecorder_prepare) is successfully triggered and before [OH_AVRecorder_Start](#oh_avrecorder_start) is called. - -The caller obtains the **surfaceBuffer** from this surface and fills in the corresponding video data. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| recorder | Pointer to an **OH_AVRecorder** instance.| -| window | Double pointer to an **OHNativeWindow** instance. For details, see **OHNativeWindow**.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The operation is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **recorder** is a null pointer. - - -### OH_AVRecorder_UpdateRotation() - -``` -OH_AVErrCode OH_AVRecorder_UpdateRotation(OH_AVRecorder *recorder, int32_t rotation) -``` - -**Description** - -Updates the video rotation angle. This function must be called after [OH_AVRecorder_Prepare](#oh_avrecorder_prepare) is successfully triggered and before [OH_AVRecorder_Start](#oh_avrecorder_start) is called. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| recorder | Pointer to an **OH_AVRecorder** instance.| -| rotation | Video rotation angle. The value must be an integer in the range [0, 90, 180, 270].| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The operation is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **recorder** is a null pointer, **rotation** is invalid, or the update operation fails. - - -### OH_AVRecorder_Start() - -``` -OH_AVErrCode OH_AVRecorder_Start(OH_AVRecorder *recorder) -``` - -**Description** - -Starts recording. This function must be called after [OH_AVRecorder_Prepare](#oh_avrecorder_prepare) is successfully triggered. After this function is successfully called, the AVRecorder transitions to the AVRECORDER_STARTED state. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| recorder | Pointer to an **OH_AVRecorder** instance.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The operation is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **recorder** is a null pointer or recording fails to start. - -(Note: Do not use error codes that are not declared in this document.) - -### OH_AVRecorder_Pause() - -``` -OH_AVErrCode OH_AVRecorder_Pause(OH_AVRecorder *recorder) -``` - -**Description** - -Pauses recording. This function must be called after [OH_AVRecorder_Start](#oh_avrecorder_start) is successfully triggered and the AVRecorder is in the AVRECORDER_STARTED state. After this function is successfully called, the AVRecorder transitions to the AVRECORDER_PAUSED state. - -Then, you can call [OH_AVRecorder_Resume](#oh_avrecorder_resume) to resume recording, and the AVRecorder transitions the AVRECORDER_STARTED state again. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| recorder | Pointer to an **OH_AVRecorder** instance.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The operation is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **recorder** is a null pointer or the pause operation fails. - - -### OH_AVRecorder_Resume() - -``` -OH_AVErrCode OH_AVRecorder_Resume(OH_AVRecorder *recorder) -``` - -**Description** - -Resumes recording. This function must be called after [OH_AVRecorder_Pause](#oh_avrecorder_pause) is successfully triggered and the AVRecorder is in the AVRECORDER_PAUSED state. After this function is successfully called, the AVRecorder transitions to the AVRECORDER_STARTED state. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| recorder | Pointer to an **OH_AVRecorder** instance.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The operation is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **recorder** is a null pointer or the resumption operation fails. - - -### OH_AVRecorder_Stop() - -``` -OH_AVErrCode OH_AVRecorder_Stop(OH_AVRecorder *recorder) -``` - -**Description** - -Stops recording. This function must be called after [OH_AVRecorder_Start](#oh_avrecorder_start) is successfully triggered. After this function is successfully called, the AVRecorder transitions to the AVRECORDER_STOPPED state. - -For audio-only recording, you can call [OH_AVRecorder_Prepare](#oh_avrecorder_prepare) again for re-recording. For video-only recording or audio and video recording, you can call [OH_AVRecorder_Prepare](#oh_avrecorder_prepare) and [OH_AVRecorder_GetInputSurface](#oh_avrecorder_getinputsurface) again for re-recording. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| recorder | Pointer to an **OH_AVRecorder** instance.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The operation is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **recorder** is a null pointer or recording fails to stop. - - -### OH_AVRecorder_Reset() - -``` -OH_AVErrCode OH_AVRecorder_Reset(OH_AVRecorder *recorder) -``` - -**Description** - -Resets the recording state. This function must be called when the AVRecorder is not in the AVRECORDER_RELEASED state. After this function is successfully called, the AVRecorder transitions to the AVRECORDER_IDLE state. - -For audio-only recording, you can call [OH_AVRecorder_Prepare](#oh_avrecorder_prepare) again for re-recording. For video-only recording or audio and video recording, you can call [OH_AVRecorder_Prepare](#oh_avrecorder_prepare) and [OH_AVRecorder_GetInputSurface](#oh_avrecorder_getinputsurface) again for re-recording. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| recorder | Pointer to an **OH_AVRecorder** instance.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The operation is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **recorder** is a null pointer or the resetting operation fails. - - -### OH_AVRecorder_Release() - -``` -OH_AVErrCode OH_AVRecorder_Release(OH_AVRecorder *recorder) -``` - -**Description** - -Releases recording resources. After this API is successfully called, the AVRecorder transitions to the AVRECORDER_RELEASED state. The recorder memory will be released. The application layer must explicitly set the recorder to a null pointer to avoid access to wild pointers. - - After the resources are released, you can no longer perform any operation on the **OH_AVRecorder** instance. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| recorder | Pointer to an **OH_AVRecorder** instance.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The operation is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **recorder** is a null pointer or the release operation fails. - - -### OH_AVRecorder_GetAvailableEncoder() - -``` -OH_AVErrCode OH_AVRecorder_GetAvailableEncoder(OH_AVRecorder *recorder, OH_AVRecorder_EncoderInfo **info, int32_t *length) -``` - -**Description** - -Obtains the available encoders and encoder information of the AVRecorder. **info** must be set to a null pointer. The framework layer allocates and releases the memory in a unified manner to avoid issues with memory management, such as leaks or double freeing. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| recorder | Pointer to an **OH_AVRecorder** instance.| -| info | Double pointer to an [OH_AVRecorder_EncoderInfo](_o_h___a_v_recorder___encoder_info.md) instance. For details, see [OH_AVRecorder_EncoderInfo](_o_h___a_v_recorder___encoder_info.md).| -| length | Pointer to the number of available encoders.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The operation is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **recorder** is a null pointer. - -**AV_ERR_NO_MEMORY**: The memory fails to be allocated due to insufficient memory. - - -### OH_AVRecorder_SetStateCallback() - -``` -OH_AVErrCode OH_AVRecorder_SetStateCallback( OH_AVRecorder *recorder, OH_AVRecorder_OnStateChange callback, void *userData) -``` - -**Description** - -Sets a state callback so that the application can respond to state change events generated by the AVRecorder. This function must be called before [OH_AVRecorder_Start](#oh_avrecorder_start) is called. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| recorder | Pointer to an **OH_AVRecorder** instance.| -| callback | State callback. For details, see [OH_AVRecorder_OnStateChange](#oh_avrecorder_onstatechange).| -| userData | Pointer to user-defined data.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The operation is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **recorder** or **callback** is a null pointer. - - -### OH_AVRecorder_SetErrorCallback() - -``` -OH_AVErrCode OH_AVRecorder_SetErrorCallback(OH_AVRecorder *recorder, OH_AVRecorder_OnError callback, void *userData) -``` - -**Description** - -Sets an error callback so that the application can respond to error events generated by the AVRecorder. This function must be called before [OH_AVRecorder_Start](#oh_avrecorder_start) is called. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| recorder | Pointer to an **OH_AVRecorder** instance.| -| callback | Error callback. For details, see [OH_AVRecorder_OnError](#oh_avrecorder_onerror).| -| userData | Pointer to user-defined data.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The operation is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **recorder** or **callback** is a null pointer. - - -### OH_AVRecorder_SetUriCallback() - -``` -OH_AVErrCode OH_AVRecorder_SetUriCallback(OH_AVRecorder *recorder, OH_AVRecorder_OnUri callback, void *userData) -``` - -**Description** - -Sets a URI callback so that the application can respond to URI events generated by the AVRecorder. This function must be called before [OH_AVRecorder_Start](#oh_avrecorder_start) is called. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| recorder | Pointer to an **OH_AVRecorder** instance.| -| callback | URI callback. For details, see [OH_AVRecorder_OnUri](#oh_avrecorder_onuri).| -| userData | Pointer to user-defined data.| - -**Returns** - -Returns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: - -**AV_ERR_OK**: The operation is successful. - -**AV_ERR_INVALID_VAL**: The input parameter **recorder** or **callback** is a null pointer. diff --git a/en/application-dev/reference/apis-media-kit/_a_v_screen_capture.md b/en/application-dev/reference/apis-media-kit/_a_v_screen_capture.md deleted file mode 100644 index 961539044a5..00000000000 --- a/en/application-dev/reference/apis-media-kit/_a_v_screen_capture.md +++ /dev/null @@ -1,1890 +0,0 @@ -# AVScreenCapture - - -## Overview - -The AVScreenCapture module provides APIs for screen capture. - -You can refer to the corresponding development guide and samples based on your development requirements. - -- [Using AVScreenCapture to Capture Screens and Obtain Streams](../../media/media/using-avscreencapture-for-buffer.md) -- [Using AVScreenCapture to Capture Screens and Write Them to Files](../../media/media/using-avscreencapture-for-file.md) - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - - -## Summary - - -### Files - -| Name| Description| -| -------- | -------- | -| [native_avscreen_capture.h](native__avscreen__capture_8h.md) | Declares the APIs used to create an **OH_AVScreenCapture** instance.| -| [native_avscreen_capture_base.h](native__avscreen__capture__base_8h.md) | Declares the common structs, character constants, and enums used for running screen capture.| -| [native_avscreen_capture_errors.h](native__avscreen__capture__errors_8h.md) | Declares the error codes generated during screen capture.| - - -### Structs - -| Name| Description| -| -------- | -------- | -| struct [OH_AudioCaptureInfo](_o_h___audio_capture_info.md) | Describes the audio capture information.| -| struct [OH_AudioEncInfo](_o_h___audio_enc_info.md) | Describes the audio encoding information.| -| struct [OH_AudioInfo](_o_h___audio_info.md) | Describes the audio information.| -| struct [OH_VideoCaptureInfo](_o_h___video_capture_info.md) | Describes the video capture information.| -| struct [OH_VideoEncInfo](_o_h___video_enc_info.md) | Describes the video encoding information.| -| struct [OH_VideoInfo](_o_h___video_info.md) |Describes the video information.| -| struct [OH_RecorderInfo](_o_h___recorder_info.md) | Describes the recording file information.| -| struct [OH_AVScreenCaptureConfig](_o_h___a_v_screen_capture_config.md) | Describes the screen capture configuration.| -| struct [OH_AVScreenCaptureCallback](_o_h___a_v_screen_capture_callback.md) | Describes all the asynchronous callback function pointers of an **OH_AVScreenCapture** instance.| -| struct [OH_Rect](_o_h___rect.md) | Describes the width, height, and image information of the rectangle used for screen capture.| -| struct [OH_AudioBuffer](_o_h___audio_buffer.md) | Describes the configuration such as the size, type, and timestamp of audio data.| - - -### Types - -| Name| Description| -| -------- | -------- | -| typedef struct [OH_NativeBuffer](#oh_nativebuffer) [OH_NativeBuffer](#oh_nativebuffer) | Defines the native video stream class for screen capture.| -| typedef struct [OH_AVScreenCapture](#oh_avscreencapture) [OH_AVScreenCapture](#oh_avscreencapture) | Defines a screen capture instance used to obtain original video and audio streams.| -| typedef struct [OH_AVScreenCapture_ContentFilter](#oh_avscreencapture_contentfilter) [OH_AVScreenCapture_ContentFilter](#oh_avscreencapture_contentfilter) | Defines a struct for the filter used to filter audio and video content.| -| typedef enum [OH_CaptureMode](#oh_capturemode-1) [OH_CaptureMode](#oh_capturemode) | Defines an enum for the screen capture modes.| -| typedef enum [OH_AudioCaptureSourceType](#oh_audiocapturesourcetype-1) [OH_AudioCaptureSourceType](#oh_audiocapturesourcetype) | Defines an enum for the audio source types during screen capture.| -| typedef enum [OH_AudioCodecFormat](#oh_audiocodecformat-1) [OH_AudioCodecFormat](#oh_audiocodecformat) | Defines an enum for the audio encoding formats.| -| typedef enum [OH_VideoCodecFormat](#oh_videocodecformat-1) [OH_VideoCodecFormat](#oh_videocodecformat) | Defines an enum for the video encoding formats.| -| typedef enum [OH_DataType](#oh_datatype-1) [OH_DataType](#oh_datatype) | Defines an enum for the data types of screen capture streams.| -| typedef enum [OH_VideoSourceType](#oh_videosourcetype-1) [OH_VideoSourceType](#oh_videosourcetype) | Defines an enum for the video source formats. Currently, only the RGBA format is supported.| -| typedef enum [OH_ContainerFormatType](#oh_containerformattype-1) [OH_ContainerFormatType](#oh_containerformattype) | Defines an enum for the types of files generated during screen capture.| -| typedef struct [OH_AudioCaptureInfo](_o_h___audio_capture_info.md) [OH_AudioCaptureInfo](#oh_audiocaptureinfo) | Defines a struct for the audio capture information.| -| typedef struct [OH_AudioEncInfo](_o_h___audio_enc_info.md) [OH_AudioEncInfo](#oh_audioencinfo) | Defines a struct for the audio encoding information.| -| typedef struct [OH_AudioInfo](_o_h___audio_info.md) [OH_AudioInfo](#oh_audioinfo) | Defines a struct for the audio information.| -| typedef struct [OH_VideoCaptureInfo](_o_h___video_capture_info.md) [OH_VideoCaptureInfo](#oh_videocaptureinfo) | Defines a struct for the video capture information.| -| typedef struct [OH_VideoEncInfo](_o_h___video_enc_info.md) [OH_VideoEncInfo](#oh_videoencinfo) | Defines a struct for the video encoding information.| -| typedef struct [OH_VideoInfo](_o_h___video_info.md) [OH_VideoInfo](#oh_videoinfo) | Defines a struct for the video information.| -| typedef struct [OH_RecorderInfo](_o_h___recorder_info.md) [OH_RecorderInfo](#oh_recorderinfo) | Defines a struct for the recording file information.| -| typedef struct [OH_AVScreenCaptureConfig](_o_h___a_v_screen_capture_config.md) [OH_AVScreenCaptureConfig](#oh_avscreencaptureconfig) | Defines a struct for the screen capture configuration.| -| typedef void(\* [OH_AVScreenCaptureOnError](#oh_avscreencaptureonerror)) ([OH_AVScreenCapture](#oh_avscreencapture) \*capture, int32_t errorCode) | Defines a pointer to a callback function that is called when an error occurs during the running of an **OH_AVScreenCapture** instance.| -| typedef void(\* [OH_AVScreenCaptureOnAudioBufferAvailable](#oh_avscreencaptureonaudiobufferavailable)) ([OH_AVScreenCapture](#oh_avscreencapture) \*capture, bool isReady, [OH_AudioCaptureSourceType](#oh_audiocapturesourcetype) type) | Defines a pointer to a callback function that is called when an audio buffer is available during the running of an **OH_AVScreenCapture** instance.| -| typedef void(\* [OH_AVScreenCaptureOnVideoBufferAvailable](#oh_avscreencaptureonvideobufferavailable)) ([OH_AVScreenCapture](#oh_avscreencapture) \*capture, bool isReady) | Defines a pointer to a callback function that is called when a video buffer is available during the running of an **OH_AVScreenCapture** instance.| -| typedef struct [OH_AVScreenCaptureCallback](_o_h___a_v_screen_capture_callback.md) [OH_AVScreenCaptureCallback](#oh_avscreencapturecallback) | Defines a struct for all the asynchronous callback function pointers of an **OH_AVScreenCapture** instance.| -| typedef struct [OH_Rect](_o_h___rect.md) [OH_Rect](#oh_rect) | Defines a struct for the width, height, and image information of the rectangle used for screen capture.| -| typedef struct [OH_AudioBuffer](_o_h___audio_buffer.md) [OH_AudioBuffer](#oh_audiobuffer) | Defines a struct for the configuration such as the size, type, and timestamp of audio data.| -| typedef enum [OH_AVScreenCaptureStateCode](#oh_avscreencapturestatecode-1) [OH_AVScreenCaptureStateCode](#oh_avscreencapturestatecode) | Defines an enum for the screen capture states.| -| typedef enum [OH_AVScreenCaptureBufferType](#oh_avscreencapturebuffertype-1) [OH_AVScreenCaptureBufferType](#oh_avscreencapturebuffertype) | Defines an enum for the buffer types.| -| typedef enum [OH_AVScreenCaptureFilterableAudioContent](#oh_avscreencapturefilterableaudiocontent-1) [OH_AVScreenCaptureFilterableAudioContent](#oh_avscreencapturefilterableaudiocontent) | Defines an enum for the types of audio that can be added to a content filter.| -| typedef void(\* [OH_AVScreenCapture_OnStateChange](#oh_avscreencapture_onstatechange)) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, [OH_AVScreenCaptureStateCode](#oh_avscreencapturestatecode) stateCode, void \*userData) | Defines a pointer to a callback function that is called when the state changes during the running of an **OH_AVScreenCapture** instance.| -| typedef void(\* [OH_AVScreenCapture_OnError](#oh_avscreencapture_onerror)) ([OH_AVScreenCapture](#oh_avscreencapture) \*capture, int32_t errorCode, void \*userData) | Defines a pointer to a callback function that is called when an error occurs during the running of an **OH_AVScreenCapture** instance.| -| typedef void(\* [OH_AVScreenCapture_OnBufferAvailable](#oh_avscreencapture_onbufferavailable)) ([OH_AVScreenCapture](#oh_avscreencapture) \*capture, [OH_AVBuffer](../apis-avcodec-kit/_core.md#oh_avbuffer) \*buffer, [OH_AVScreenCaptureBufferType](#oh_avscreencapturebuffertype) bufferType, int64_t timestamp, void \*userData) | Defines a pointer to a callback function that is called when an audio or a video buffer is available during the running of an **OH_AVScreenCapture** instance.| -| typedef enum [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1) [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) | Defines an enum for the error codes generated during screen recording.| -| typedef void(\* [OH_AVScreenCapture_OnDisplaySelected](#oh_avscreencapture_ondisplayselected)) ([OH_AVScreenCapture](#oh_avscreencapture) \*capture, uint64_t displayId, void \*userData) | Defines a pointer to a callback function that is called when screen capture starts.| - - -### Enums - -| Name| Description| -| -------- | -------- | -| [OH_CaptureMode](#oh_capturemode-1) {
OH_CAPTURE_HOME_SCREEN = 0,
OH_CAPTURE_SPECIFIED_SCREEN = 1,
OH_CAPTURE_SPECIFIED_WINDOW = 2,
OH_CAPTURE_INVAILD = -1
} | Enumerates the screen capture modes.| -| [OH_AudioCaptureSourceType](#oh_audiocapturesourcetype-1) {
OH_SOURCE_INVALID = -1,
OH_SOURCE_DEFAULT = 0,
OH_MIC = 1,
OH_ALL_PLAYBACK = 2,
OH_APP_PLAYBACK = 3
} | Enumerates the audio source types during screen capture.| -| [OH_AudioCodecFormat](#oh_audiocodecformat-1) {
OH_AUDIO_DEFAULT = 0,
OH_AAC_LC = 3,
OH_AUDIO_CODEC_FORMAT_BUTT
} | Enumerates the audio encoding formats.| -| [OH_VideoCodecFormat](#oh_videocodecformat-1) {
OH_VIDEO_DEFAULT = 0,
OH_H264 = 2,
OH_H265 = 4,
OH_MPEG4 = 6,
OH_VP8 = 8,
OH_VP9 = 10,
OH_VIDEO_CODEC_FORMAT_BUTT
} | Enumerates the video encoding formats.| -| [OH_DataType](#oh_datatype-1) {
OH_ORIGINAL_STREAM = 0,
OH_ENCODED_STREAM = 1,
OH_CAPTURE_FILE = 2,
OH_INVAILD = -1
} | Enumerates the data types of screen capture streams.| -| [OH_VideoSourceType](#oh_videosourcetype-1) {
OH_VIDEO_SOURCE_SURFACE_YUV = 0,
OH_VIDEO_SOURCE_SURFACE_ES,
OH_VIDEO_SOURCE_SURFACE_RGBA,
OH_VIDEO_SOURCE_BUTT
} | Enumerates the video source formats. Currently, only the RGBA format is supported.| -| [OH_ContainerFormatType](#oh_containerformattype) {
CFT_MPEG_4A = 0,
CFT_MPEG_4 = 1
} | Enumerates the types of files generated during screen capture.| -| [OH_AVScreenCaptureStateCode](#oh_avscreencapturestatecode-1) {
OH_SCREEN_CAPTURE_STATE_STARTED = 0,
OH_SCREEN_CAPTURE_STATE_CANCELED = 1,
OH_SCREEN_CAPTURE_STATE_STOPPED_BY_USER = 2,
OH_SCREEN_CAPTURE_STATE_INTERRUPTED_BY_OTHER = 3,
OH_SCREEN_CAPTURE_STATE_STOPPED_BY_CALL = 4,
OH_SCREEN_CAPTURE_STATE_MIC_UNAVAILABLE = 5,
OH_SCREEN_CAPTURE_STATE_MIC_MUTED_BY_USER = 6,
OH_SCREEN_CAPTURE_STATE_MIC_UNMUTED_BY_USER = 7,
OH_SCREEN_CAPTURE_STATE_ENTER_PRIVATE_SCENE = 8,
OH_SCREEN_CAPTURE_STATE_EXIT_PRIVATE_SCENE = 9,
OH_SCREEN_CAPTURE_STATE_STOPPED_BY_USER_SWITCHES = 10
} | Enumerates the screen capture states.| -| [OH_AVScreenCaptureBufferType](#oh_avscreencapturebuffertype-1) {
OH_SCREEN_CAPTURE_BUFFERTYPE_VIDEO = 0,
OH_SCREEN_CAPTURE_BUFFERTYPE_AUDIO_INNER = 1,
OH_SCREEN_CAPTURE_BUFFERTYPE_AUDIO_MIC = 2
} | Enumerates the buffer types.| -| [OH_AVScreenCaptureFilterableAudioContent](#oh_avscreencapturefilterableaudiocontent-1) {
OH_SCREEN_CAPTURE_NOTIFICATION_AUDIO = 0,
OH_SCREEN_CAPTURE_CURRENT_APP_AUDIO = 1
} | Enumerates the types of audio that can be added to a content filter. | -| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1) {
AV_SCREEN_CAPTURE_ERR_BASE = 0,
AV_SCREEN_CAPTURE_ERR_OK = AV_SCREEN_CAPTURE_ERR_BASE,
AV_SCREEN_CAPTURE_ERR_NO_MEMORY = AV_SCREEN_CAPTURE_ERR_BASE + 1,
AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT = AV_SCREEN_CAPTURE_ERR_BASE + 2,
AV_SCREEN_CAPTURE_ERR_INVALID_VAL = AV_SCREEN_CAPTURE_ERR_BASE + 3,
AV_SCREEN_CAPTURE_ERR_IO = AV_SCREEN_CAPTURE_ERR_BASE + 4,
AV_SCREEN_CAPTURE_ERR_TIMEOUT = AV_SCREEN_CAPTURE_ERR_BASE + 5,
AV_SCREEN_CAPTURE_ERR_UNKNOWN = AV_SCREEN_CAPTURE_ERR_BASE + 6,
AV_SCREEN_CAPTURE_ERR_SERVICE_DIED = AV_SCREEN_CAPTURE_ERR_BASE + 7,
AV_SCREEN_CAPTURE_ERR_INVALID_STATE = AV_SCREEN_CAPTURE_ERR_BASE + 8,
AV_SCREEN_CAPTURE_ERR_UNSUPPORT = AV_SCREEN_CAPTURE_ERR_BASE + 9,
AV_SCREEN_CAPTURE_ERR_EXTEND_START = AV_SCREEN_CAPTURE_ERR_BASE + 100
} | Enumerates the error codes generated during screen recording.| - - -### Functions - -| Name| Description| -| -------- | -------- | -| struct [OH_AVScreenCapture](#oh_avscreencapture) \* [OH_AVScreenCapture_Create](#oh_avscreencapture_create) (void) | Creates an **OH_AVScreenCapture** instance. | -| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_Init](#oh_avscreencapture_init) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, [OH_AVScreenCaptureConfig](_o_h___a_v_screen_capture_config.md) config) | Initializes parameters related to an **OH_AVScreenCapture** instance, including audio sampling parameters for external capture using microphones (optional), audio sampling parameters for internal capture, and video resolution parameters. | -| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_StartScreenCapture](#oh_avscreencapture_startscreencapture) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture) | Starts screen capture and collects original streams. | -| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_StartScreenCaptureWithSurface](#oh_avscreencapture_startscreencapturewithsurface) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, [OHNativeWindow](../apis-arkgraphics2d/_native_window.md#ohnativewindow) \*window) | Starts screen capture in surface mode. | -| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_StopScreenCapture](#oh_avscreencapture_stopscreencapture) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture) | Stops screen capture. This function is used in pair with **OH_AVScreenCapture_StartScreenCapture**. | -| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_StartScreenRecording](#oh_avscreencapture_startscreenrecording) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture) | Starts screen recording, with recordings saved in files. | -| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_StopScreenRecording](#oh_avscreencapture_stopscreenrecording) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture) | Stops screen recording. This function is used in pair with **OH_AVScreenCapture_StartScreenRecording**.| -| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_AcquireAudioBuffer](#oh_avscreencapture_acquireaudiobuffer) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, [OH_AudioBuffer](_o_h___audio_buffer.md) \*\*audiobuffer, [OH_AudioCaptureSourceType](#oh_audiocapturesourcetype) type) | Obtains an audio buffer. When calling this function, the application must allocate the memory of the corresponding struct size to the audio buffer. | -| [OH_NativeBuffer](#oh_nativebuffer) \* [OH_AVScreenCapture_AcquireVideoBuffer](#oh_avscreencapture_acquirevideobuffer) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, int32_t \*fence, int64_t \*timestamp, struct [OH_Rect](_o_h___rect.md) \*region) | Obtains a video buffer. An application can call this function to obtain information such as the video buffer and timestamp. | -| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_ReleaseAudioBuffer](#oh_avscreencapture_releaseaudiobuffer) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, [OH_AudioCaptureSourceType](#oh_audiocapturesourcetype) type) | Releases an audio buffer. | -| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_ReleaseVideoBuffer](#oh_avscreencapture_releasevideobuffer) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture) | Releases a video buffer. After the video buffer is no longer needed, call this function to release it. | -| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_SetCallback](#oh_avscreencapture_setcallback) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, struct [OH_AVScreenCaptureCallback](_o_h___a_v_screen_capture_callback.md) callback) | Sets a callback to listen for available video buffers and audio buffers and errors that occur during the function calling. | -| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_Release](#oh_avscreencapture_release) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture) | Releases an **OH_AVScreenCapture** instance. This function is used in pair with **OH_AVScreenCapture_Create**. | -| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_SetMicrophoneEnabled](#oh_avscreencapture_setmicrophoneenabled) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, bool isMicrophone) | Enables or disables the microphone. | -| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_SetStateCallback](#oh_avscreencapture_setstatecallback) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, [OH_AVScreenCapture_OnStateChange](#oh_avscreencapture_onstatechange) callback, void \*userData) | Sets a state change callback. This function must be called before screen capture starts. | -| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_SetDataCallback](#oh_avscreencapture_setdatacallback) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, [OH_AVScreenCapture_OnBufferAvailable](#oh_avscreencapture_onbufferavailable) callback, void \*userData) | Sets a data processing callback. This function must be called before screen capture starts. | -| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_SetErrorCallback](#oh_avscreencapture_seterrorcallback) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, [OH_AVScreenCapture_OnError](#oh_avscreencapture_onerror) callback, void \*userData) | Sets an error processing callback. This function must be called before screen capture starts. | -| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_SetCanvasRotation](#oh_avscreencapture_setcanvasrotation) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, bool canvasRotation) | Sets canvas rotation for screen capture. | -| struct [OH_AVScreenCapture_ContentFilter](#oh_avscreencapture_contentfilter) \* [OH_AVScreenCapture_CreateContentFilter](#oh_avscreencapture_createcontentfilter) (void) | Creates a content filter. | -| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_ReleaseContentFilter](#oh_avscreencapture_releasecontentfilter) (struct [OH_AVScreenCapture_ContentFilter](#oh_avscreencapture_contentfilter) \*filter) | Releases a content filter. | -| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_ContentFilter_AddAudioContent](#oh_avscreencapture_contentfilter_addaudiocontent) (struct [OH_AVScreenCapture_ContentFilter](#oh_avscreencapture_contentfilter) \*filter, [OH_AVScreenCaptureFilterableAudioContent](#oh_avscreencapturefilterableaudiocontent) content) | Adds audio content to a content filter. | -| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_ExcludeContent](#oh_avscreencapture_excludecontent) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, struct [OH_AVScreenCapture_ContentFilter](#oh_avscreencapture_contentfilter) \*filter) | Sets a content filter for an **OH_AVScreenCapture** instance. | -| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_ContentFilter_AddWindowContent](#oh_avscreencapture_contentfilter_addwindowcontent) (struct [OH_AVScreenCapture_ContentFilter](#oh_avscreencapture_contentfilter) \*filter, int32_t \*windowIDs, int32_t windowCount) | Adds a list of window IDs to a **ContentFilter** instance. | -| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_ResizeCanvas](#oh_avscreencapture_resizecanvas) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, int32_t width, int32_t height) | Adjusts the screen resolution. | -| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_SkipPrivacyMode](#oh_avscreencapture_skipprivacymode) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, int32_t \*windowIDs, int32_t windowCount) | Exempts privacy windows during screen capture. | -| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_SetMaxVideoFrameRate](#oh_avscreencapture_setmaxvideoframerate) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, int32_t frameRate) | Sets the maximum frame rate for screen capture. | -| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_ShowCursor](#oh_avscreencapture_showcursor) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, bool showCursor) | Sets whether to show the cursor.| -| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_SetDisplayCallback](#oh_avscreencapture_setdisplaycallback) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, [OH_AVScreenCapture_OnDisplaySelected](#oh_avscreencapture_ondisplayselected) callback, void \*userData) | Sets a callback function for obtaining the display ID.| - - -## Type Description - - -### OH_AudioBuffer - -``` -typedef struct OH_AudioBuffer OH_AudioBuffer -``` - -**Description** - -Defines a struct for the configuration such as the size, type, and timestamp of audio data. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - - -### OH_AudioCaptureInfo - -``` -typedef struct OH_AudioCaptureInfo OH_AudioCaptureInfo -``` - -**Description** - -Defines a struct for the audio capture information. - -When both **audioSampleRate** and **audioChannels** are **0**, the audio-related parameters are ignored and the audio data is not recorded. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - - -### OH_AudioCaptureSourceType - -``` -typedef enum OH_AudioCaptureSourceType OH_AudioCaptureSourceType -``` - -**Description** - -Defines an enum for the audio source types during screen capture. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - - -### OH_AudioCodecFormat - -``` -typedef enum OH_AudioCodecFormat OH_AudioCodecFormat -``` - -**Description** - -Defines an enum for the audio encoding formats. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - - -### OH_AudioEncInfo - -``` -typedef struct OH_AudioEncInfo OH_AudioEncInfo -``` - -**Description** - -Defines a struct for the audio encoding information. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - - -### OH_AudioInfo - -``` -typedef struct OH_AudioInfo OH_AudioInfo -``` - -**Description** - -Defines a struct for the audio information. - -To perform both external capture (using microphones) and internal capture, **audioSampleRate** and **audioChannels** must be the same for both audio channels. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - - -### OH_AVSCREEN_CAPTURE_ErrCode - -``` -typedef enum OH_AVSCREEN_CAPTURE_ErrCode OH_AVSCREEN_CAPTURE_ErrCode -``` - -**Description** - -Defines an enum for the error codes generated during screen recording. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - - -### OH_AVScreenCapture - -``` -typedef struct OH_AVScreenCaptureOH_AVScreenCapture -``` - -**Description** - -Defines a screen capture instance used to obtain original video and audio streams. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - - -### OH_AVScreenCapture_ContentFilter - -``` -typedef struct OH_AVScreenCapture_ContentFilterOH_AVScreenCapture_ContentFilter -``` - -**Description** - -Defines a struct for the filter used to filter audio and video content. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 12 - - -### OH_AVScreenCapture_OnBufferAvailable - -``` -typedef void(* OH_AVScreenCapture_OnBufferAvailable) (OH_AVScreenCapture *capture, OH_AVBuffer *buffer, OH_AVScreenCaptureBufferType bufferType, int64_t timestamp, void *userData) -``` - -**Description** - -Defines a pointer to a callback function that is called when an audio or a video buffer is available during the running of an **OH_AVScreenCapture** instance. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an **OH_AVScreenCapture** instance. | -| buffer | Pointer to the **OH_AVBuffer** instance. After the callback is triggered, the buffer is no longer valid. | -| bufferType | Type of the buffer. | -| timestamp | Timestamp, in nanoseconds. | -| userData | Pointer to the user-defined data carried in the function.| - - -### OH_AVScreenCapture_OnDisplaySelected - -``` -typedef void (*OH_AVScreenCapture_OnDisplaySelected)(OH_AVScreenCapture *capture, uint64_t displayId, void *userData) -``` - -**Description** - -Defines a pointer to a callback function that is called when screen capture starts. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 15 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an **OH_AVScreenCapture** instance.| -| displayId | ID of the screen to capture.| -| userData | Pointer to the user-defined data carried in the function.| - - -### OH_AVScreenCapture_OnError - -``` -typedef void(* OH_AVScreenCapture_OnError) (OH_AVScreenCapture *capture, int32_t errorCode, void *userData) -``` - -**Description** - -Defines a pointer to a callback function that is called when an error occurs during the running of an **OH_AVScreenCapture** instance. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an **OH_AVScreenCapture** instance. | -| errorCode | Error code. | -| userData | Pointer to the user-defined data carried in the function.| - - -### OH_AVScreenCapture_OnStateChange - -``` -typedef void(* OH_AVScreenCapture_OnStateChange) (struct OH_AVScreenCapture *capture, OH_AVScreenCaptureStateCode stateCode, void *userData) -``` - -**Description** - -Defines a pointer to a callback function that is called when the state changes during the running of an **OH_AVScreenCapture** instance. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an **OH_AVScreenCapture** instance. | -| stateCode | Status code. | -| userData | Pointer to the user-defined data carried in the function.| - - -### OH_AVScreenCaptureBufferType - -``` -typedef enum OH_AVScreenCaptureBufferTypeOH_AVScreenCaptureBufferType -``` - -**Description** - -Defines an enum for the buffer types. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 12 - - -### OH_AVScreenCaptureCallback - -``` -typedef struct OH_AVScreenCaptureCallback OH_AVScreenCaptureCallback -``` - -**Description** - -Defines a struct for all the asynchronous callback function pointers of an **OH_AVScreenCapture** instance. To ensure the normal running of **OH_AVScreenCapture**, you must register the instance of this struct with the **OH_AVScreenCapture** instance and process the information reported by the callback functions. - -From API version 12, you are advised to use [OH_AVScreenCapture_OnError](#oh_avscreencapture_onerror) and [OH_AVScreenCapture_OnBufferAvailable](#oh_avscreencapture_onbufferavailable) instead. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| onError | Pointer to a callback function that is called when an error occurs during the running of an **OH_AVScreenCapture** instance. For details, see [OH_AVScreenCaptureOnError](#oh_avscreencaptureonerror).| -| onAudioBufferAvailable | Pointer to a callback function that is called when an audio buffer is available during the running of an **OH_AVScreenCapture** instance. For details, see [OH_AVScreenCaptureOnAudioBufferAvailable](#oh_avscreencaptureonaudiobufferavailable).| -| onVideoBufferAvailable | Pointer to a callback function that is called when a video buffer is available during the running of an **OH_AVScreenCapture** instance. For details, see [OH_AVScreenCaptureOnVideoBufferAvailable](#oh_avscreencaptureonvideobufferavailable).| - - -### OH_AVScreenCaptureConfig - -``` -typedef struct OH_AVScreenCaptureConfig OH_AVScreenCaptureConfig -``` - -**Description** - -Defines a struct for the screen capture configuration. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - - -### OH_AVScreenCaptureFilterableAudioContent - -``` -typedef enum OH_AVScreenCaptureFilterableAudioContent OH_AVScreenCaptureFilterableAudioContent -``` - -**Description** - -Defines an enum for the types of audio that can be added to a content filter. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 12 - - -### OH_AVScreenCaptureOnAudioBufferAvailable - -``` -typedef void(* OH_AVScreenCaptureOnAudioBufferAvailable) (OH_AVScreenCapture *capture, bool isReady, OH_AudioCaptureSourceType type) -``` - -**Description** - -Defines a pointer to a callback function that is called when an audio buffer is available during the running of an **OH_AVScreenCapture** instance. - -From API version 12, you are advised to use [OH_AVScreenCapture_OnBufferAvailable](#oh_avscreencapture_onbufferavailable) instead. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an **OH_AVScreenCapture** instance. | -| isReady | Whether the audio buffer is available. | -| type | Audio source type.| - - -### OH_AVScreenCaptureOnError - -``` -typedef void(* OH_AVScreenCaptureOnError) (OH_AVScreenCapture *capture, int32_t errorCode) -``` - -**Description** - -Defines a pointer to a callback function that is called when an error occurs during the running of an **OH_AVScreenCapture** instance. - -From API version 12, you are advised to use [OH_AVScreenCapture_OnError](#oh_avscreencapture_onerror) instead. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an **OH_AVScreenCapture** instance. | -| errorCode | Error code.| - - -### OH_AVScreenCaptureOnVideoBufferAvailable - -``` -typedef void(* OH_AVScreenCaptureOnVideoBufferAvailable) (OH_AVScreenCapture *capture, bool isReady) -``` - -**Description** - -Defines a pointer to a callback function that is called when a video buffer is available during the running of an **OH_AVScreenCapture** instance. - -From API version 12, you are advised to use [OH_AVScreenCapture_OnBufferAvailable](#oh_avscreencapture_onbufferavailable) instead. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an **OH_AVScreenCapture** instance. | -| isReady | Whether the video buffer is available.| - - -### OH_AVScreenCaptureStateCode - -``` -typedef enum OH_AVScreenCaptureStateCode OH_AVScreenCaptureStateCode -``` - -**Description** - -Defines an enum for the screen capture states. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 12 - - -### OH_CaptureMode - -``` -typedef enum OH_CaptureMode OH_CaptureMode -``` - -**Description** - -Defines an enum for the screen capture modes. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - - -### OH_ContainerFormatType - -``` -typedef enum OH_ContainerFormatType OH_ContainerFormatType -``` - -**Description** - -Defines an enum for the types of files generated during screen capture. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - - -### OH_DataType - -``` -typedef enum OH_DataType OH_DataType -``` - -**Description** - -Defines an enum for the data types of screen capture streams. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - - -### OH_NativeBuffer - -``` -typedef struct OH_NativeBuffer OH_NativeBuffer -``` - -**Description** - -Defines the native video stream class for screen capture. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - - -### OH_RecorderInfo - -``` -typedef struct OH_RecorderInfo OH_RecorderInfo -``` - -**Description** - -Defines a struct for the recording file information. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - - -### OH_Rect - -``` -typedef struct OH_Rect OH_Rect -``` - -**Description** - -Defines a struct for the width, height, and image information of the rectangle used for screen capture. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - - -### OH_VideoCaptureInfo - -``` -typedef struct OH_VideoCaptureInfo OH_VideoCaptureInfo -``` - -**Description** - -Defines a struct for the video capture information. - -When **videoFrameWidth** and **videoFrameHeight** are both **0**, video-related parameters are ignored and screen data is not recorded. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - - -### OH_VideoCodecFormat - -``` -typedef enum OH_VideoCodecFormat OH_VideoCodecFormat -``` - -**Description** - -Defines an enum for the video encoding formats. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - - -### OH_VideoEncInfo - -``` -typedef struct OH_VideoEncInfo OH_VideoEncInfo -``` - -**Description** - -Defines a struct for the video encoding information. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - - -### OH_VideoInfo - -``` -typedef struct OH_VideoInfo OH_VideoInfo -``` - -**Description** - -Defines a struct for the video information. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - - -### OH_VideoSourceType - -``` -typedef enum OH_VideoSourceType OH_VideoSourceType -``` - -**Description** - -Defines an enum for the video source formats. Currently, only the RGBA format is supported. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - - -## Enum Description - - -### OH_AudioCaptureSourceType - -``` -enum OH_AudioCaptureSourceType -``` - -**Description** - -Enumerates the audio source types during screen capture. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -| Value| Description| -| -------- | -------- | -| OH_SOURCE_INVALID | Invalid audio source. | -| OH_SOURCE_DEFAULT | Default audio source. The default value is **MIC**. | -| OH_MIC | External audio streams recorded by the microphone. | -| OH_ALL_PLAYBACK | All internal audio streams played by the system. | -| OH_APP_PLAYBACK | Internal audio streams played by a specified application. | - - -### OH_AudioCodecFormat - -``` -enum OH_AudioCodecFormat -``` - -**Description** - -Enumerates the audio encoding formats. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -| Value| Description| -| -------- | -------- | -| OH_AUDIO_DEFAULT | Default audio encoding format. The default value is **AAC_LC**. | -| OH_AAC_LC | AAC_LC audio encoding. | -| OH_AUDIO_CODEC_FORMAT_BUTT | Invalid format. | - - -### OH_AVSCREEN_CAPTURE_ErrCode - -``` -enum OH_AVSCREEN_CAPTURE_ErrCode -``` - -**Description** - -Enumerates the error codes generated during screen recording. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -| Value| Description| -| -------- | -------- | -| AV_SCREEN_CAPTURE_ERR_BASE | Basic value returned when an API call error occurs.| -| AV_SCREEN_CAPTURE_ERR_OK | Operation successful.| -| AV_SCREEN_CAPTURE_ERR_NO_MEMORY | Memory insufficient.| -| AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT | Operation not allowed.| -| AV_SCREEN_CAPTURE_ERR_INVALID_VAL | Invalid parameter.| -| AV_SCREEN_CAPTURE_ERR_IO | Abnormal input and output streams.| -| AV_SCREEN_CAPTURE_ERR_TIMEOUT | Network timeout.| -| AV_SCREEN_CAPTURE_ERR_UNKNOWN | Unknown error.| -| AV_SCREEN_CAPTURE_ERR_SERVICE_DIED | Media service terminated.| -| AV_SCREEN_CAPTURE_ERR_INVALID_STATE | Unsupported operation in this state.| -| AV_SCREEN_CAPTURE_ERR_UNSUPPORT | Unsupported interface.| -| AV_SCREEN_CAPTURE_ERR_EXTEND_START | Unexpected error.| - - -### OH_AVScreenCaptureBufferType - -``` -enum OH_AVScreenCaptureBufferType -``` - -**Description** - -Enumerates the buffer types. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 12 - -| Value| Description| -| -------- | -------- | -| OH_SCREEN_CAPTURE_BUFFERTYPE_VIDEO | Video data. | -| OH_SCREEN_CAPTURE_BUFFERTYPE_AUDIO_INNER | Internal audio capture data. | -| OH_SCREEN_CAPTURE_BUFFERTYPE_AUDIO_MIC | Microphone audio data. | - - -### OH_AVScreenCaptureFilterableAudioContent - -``` -enum OH_AVScreenCaptureFilterableAudioContent -``` - -**Description** - -Enumerates the types of audio that can be added to a content filter. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 12 - -| Value| Description| -| -------- | -------- | -| OH_SCREEN_CAPTURE_NOTIFICATION_AUDIO | Notification tone. | -| OH_SCREEN_CAPTURE_CURRENT_APP_AUDIO | Sound of the application itself. | - - -### OH_AVScreenCaptureStateCode - -``` -enum OH_AVScreenCaptureStateCode -``` - -**Description** - -Enumerates the screen capture states. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 12 - -| Value| Description| -| -------- | -------- | -| OH_SCREEN_CAPTURE_STATE_STARTED | Screen capture is started. | -| OH_SCREEN_CAPTURE_STATE_CANCELED | Screen capture is canceled. | -| OH_SCREEN_CAPTURE_STATE_STOPPED_BY_USER | Screen capture is stopped. | -| OH_SCREEN_CAPTURE_STATE_INTERRUPTED_BY_OTHER | Screen capture is interrupted by another screen capture. | -| OH_SCREEN_CAPTURE_STATE_STOPPED_BY_CALL | Screen capture is interrupted by a call. | -| OH_SCREEN_CAPTURE_STATE_MIC_UNAVAILABLE | The microphone is unavailable. | -| OH_SCREEN_CAPTURE_STATE_MIC_MUTED_BY_USER | The microphone is muted. | -| OH_SCREEN_CAPTURE_STATE_MIC_UNMUTED_BY_USER | The microphone is unmuted. | -| OH_SCREEN_CAPTURE_STATE_ENTER_PRIVATE_SCENE | The system enters a privacy dialog box. | -| OH_SCREEN_CAPTURE_STATE_EXIT_PRIVATE_SCENE | The system exits a privacy dialog box. | -| OH_SCREEN_CAPTURE_STATE_STOPPED_BY_USER_SWITCHES | Screen capture is interrupted by system user switching.| - - -### OH_CaptureMode - -``` -enum OH_CaptureMode -``` - -**Description** - -Enumerates the screen capture modes. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -| Value| Description| -| -------- | -------- | -| OH_CAPTURE_HOME_SCREEN | Captures the home screen. | -| OH_CAPTURE_SPECIFIED_SCREEN | Captures a specified screen. | -| OH_CAPTURE_SPECIFIED_WINDOW | Captures a specified window. | -| OH_CAPTURE_INVAILD | Invalid mode. | - - -### OH_ContainerFormatType - -``` -enum OH_ContainerFormatType -``` - -**Description** - -Enumerates the types of files generated during screen capture. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -| Value| Description| -| -------- | -------- | -| CFT_MPEG_4A | Audio format M4A. | -| CFT_MPEG_4 | Video format MP4. | - - -### OH_DataType - -``` -enum OH_DataType -``` - -**Description** - -Enumerates the data types of screen capture streams. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -| Value| Description| -| -------- | -------- | -| OH_ORIGINAL_STREAM | Original stream format, such as YUV, RGBA, and PCM. | -| OH_ENCODED_STREAM | Encoded stream format, such as H.264 and AAC. This value is not supported yet. | -| OH_CAPTURE_FILE | Format of the recording file. The value can be **mp4**. | -| OH_INVAILD | Invalid format. | - - -### OH_VideoCodecFormat - -``` -enum OH_VideoCodecFormat -``` - -**Description** - -Enumerates the video encoding formats. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -| Value| Description| -| -------- | -------- | -| OH_VIDEO_DEFAULT | Default video encoding format. The default value is **H.264**.| -| OH_H264 | H.264.| -| OH_H265 | H.265/HEVC.| -| OH_MPEG4 | MPEG4.| -| OH_VP8 | VP8.| -| OH_VP9 | VP9.| -| OH_VIDEO_CODEC_FORMAT_BUTT | Invalid format.| - - -### OH_VideoSourceType - -``` -enum OH_VideoSourceType -``` - -**Description** - -Enumerates the video source formats. Currently, only the RGBA format is supported. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -| Value| Description| -| -------- | -------- | -| OH_VIDEO_SOURCE_SURFACE_YUV | YUV format. This value is not supported yet. | -| OH_VIDEO_SOURCE_SURFACE_ES | Raw format. This value is not supported yet. | -| OH_VIDEO_SOURCE_SURFACE_RGBA | RGBA format. | -| OH_VIDEO_SOURCE_BUTT | Invalid format. | - - -## Function Description - - -### OH_AVScreenCapture_AcquireAudioBuffer() - -``` -OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_AcquireAudioBuffer (struct OH_AVScreenCapture * capture, OH_AudioBuffer ** audiobuffer, OH_AudioCaptureSourceType type ) -``` - -**Description** - -Obtains an audio buffer. When calling this function, the application must allocate the memory of the corresponding struct size to the audio buffer. - -From API version 12, you are advised to use [OH_AVScreenCapture_OnBufferAvailable](#oh_avscreencapture_onbufferavailable) instead. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| -| audiobuffer | Pointer to the struct for storing the audio buffer. This struct is used to obtain the information about the audio buffer and the timestamp of the buffer.| -| type | Type of the audio buffer, which is used to distinguish external streams recorded by the microphone from internal streams played by the system. For details, see [OH_AudioCaptureSourceType](#oh_audiocapturesourcetype).| - -**Returns** - -Returns a result code defined in [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1). - -**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. - -**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** or **audiobuffer** is a null pointer. - -**AV_SCREEN_CAPTURE_ERR_NO_MEMORY**: The audio buffer fails to be allocated due to insufficient memory. - -**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The privacy permission fails to be enabled or the audio buffer fails to be obtained. - - - -### OH_AVScreenCapture_AcquireVideoBuffer() - -``` -OH_NativeBuffer* OH_AVScreenCapture_AcquireVideoBuffer (struct OH_AVScreenCapture * capture, int32_t * fence, int64_t * timestamp, struct OH_Rect * region ) -``` - -**Description** - -Obtains a video buffer. An application can call this function to obtain information such as the video buffer and timestamp. After the buffer is no longer needed, call [OH_AVScreenCapture_ReleaseVideoBuffer](#oh_avscreencapture_releasevideobuffer) to release it. - -From API version 12, you are advised to use [OH_AVScreenCapture_OnBufferAvailable](#oh_avscreencapture_onbufferavailable) instead. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance. | -| fence | Pointer to parameters for synchronization display. | -| timestamp | Pointer to the timestamp of the video frame. | -| region | Pointer to the coordinates related to video display. | - -**Returns** - -Returns an **OH_NativeBuffer** object if the operation is successful. The application can call the APIs provided by the **OH_NativeBuffer** object to obtain information such as the video buffer and resolution. - - -### OH_AVScreenCapture_ContentFilter_AddAudioContent() - -``` -OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ContentFilter_AddAudioContent (struct OH_AVScreenCapture_ContentFilter * filter, OH_AVScreenCaptureFilterableAudioContent content ) -``` - -**Description** - -Adds audio content to a content filter. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| filter | Pointer to an [OH_AVScreenCapture_ContentFilter](#oh_avscreencapture_contentfilter) instance.| -| content | [OH_AVScreenCaptureFilterableAudioContent](#oh_avscreencapturefilterableaudiocontent) instance.| - -**Returns** - -Returns a result code defined in [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1). - -**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. - -**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **filter** is a null pointer or the input parameter **content** is invalid. - - -### OH_AVScreenCapture_ContentFilter_AddWindowContent() - -``` -OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ContentFilter_AddWindowContent (struct OH_AVScreenCapture_ContentFilter *filter, int32_t *windowIDs, int32_t windowCount) -``` - -**Description** - -Adds a list of window IDs to a **ContentFilter** instance. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| filter | Pointer to an **OH_AVScreenCapture_ContentFilter** instance. | -| windowIDs | Pointer to the window IDs. | -| windowCount | Length of the window ID list. | - -**Returns** - -Returns **AV_SCREEN_CAPTURE_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1) otherwise. - - -### OH_AVScreenCapture_Create() - -``` -struct OH_AVScreenCapture* OH_AVScreenCapture_Create (void ) -``` - -**Description** - -Creates an **OH_AVScreenCapture** instance. You can release the instance by calling [OH_AVScreenCapture_Release](#oh_avscreencapture_release). - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Returns** - -Returns the pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance. - - -### OH_AVScreenCapture_CreateContentFilter() - -``` -struct OH_AVScreenCapture_ContentFilter* OH_AVScreenCapture_CreateContentFilter (void ) -``` - -**Description** - -Creates a content filter. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 12 - -**Returns** - -Returns [OH_AVScreenCapture_ContentFilter](#oh_avscreencapture_contentfilter) if the operation is successful; returns a null pointer otherwise. - - -### OH_AVScreenCapture_ExcludeContent() - -``` -OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ExcludeContent (struct OH_AVScreenCapture * capture, struct OH_AVScreenCapture_ContentFilter * filter ) -``` - -**Description** - -Sets a content filter for an **OH_AVScreenCapture** instance. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| -| filter | Pointer to an [OH_AVScreenCapture_ContentFilter](#oh_avscreencapture_contentfilter) instance.| - -**Returns** - -Returns a result code defined in [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1). - -**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. - -**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** or **filter** is a null pointer. - -**AV_SCREEN_CAPTURE_ERR_UNSUPPORT**: The operation is not supported. For streams, the **AudioCapturer** API must be called for the operation to take effect during the start. For captured files, the **AudioRecorder** API must be called for the operation to take effect during the start. - - -### OH_AVScreenCapture_Init() - -``` -OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_Init (struct OH_AVScreenCapture * capture, OH_AVScreenCaptureConfig config ) -``` - -**Description** - -Initializes parameters related to an [OH_AVScreenCapture](#oh_avscreencapture) instance, including audio sampling parameters for external capture using microphones (optional), audio sampling parameters for internal capture, and video resolution parameters. - -In the scenario where screen recording files are stored, the application must ensure that the video encoding parameters, video sampling parameters, audio encoding parameters, audio sampling parameters for internal capture, and audio sampling parameters for external capture using microphones (optional) are valid. - -In the scenario where screen capture streams are generated, the application must ensure that either audio sampling parameters for internal capture or video sampling parameters are valid, or both are valid, and audio sampling parameters for external capture using microphones are valid (optional). - -The members of the struct variables are not initialized during initialization. Therefore, the application must correctly set the parameters based on the use scenario. You are advised to -set all memory bytes of the OH_AVScreenCaptureConfig struct variables to **0**, and then set valid parameters based on the screen capture scenario. - -If both **audioSampleRate** and **audioChannels** in the [OH_AudioCaptureInfo](#oh_audiocaptureinfo) struct are **0**, -the **OH_AVScreenCapture** instance ignores the audio parameters of this type and does not collect the audio data of this type. - -If both **videoFrameWidth** and **videoFrameHeight** in the [OH_VideoCaptureInfo](#oh_videocaptureinfo) struct are **0**, -the **OH_AVScreenCapture** instance ignores the corresponding video parameters and does not collect screen data. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| -| config | Parameters related to screen capture initialization.| - -**Returns** - -Returns a result code defined in [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1). - -**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. - -**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** is a null pointer. - -**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The configuration fails to be initialized. - - -### OH_AVScreenCapture_Release() - -``` -OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_Release (struct OH_AVScreenCapture * capture) -``` - -**Description** - -Releases an **OH_AVScreenCapture** instance. This function is used in pair with [OH_AVScreenCapture_Create](#oh_avscreencapture_create). - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| - -**Returns** - -Returns a result code defined in [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1). - -**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. - -**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** is a null pointer. - -**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The **OH_AVScreenCapture** instance fails to be released. - -### OH_AVScreenCapture_ReleaseAudioBuffer() - -``` -OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ReleaseAudioBuffer (struct OH_AVScreenCapture * capture, OH_AudioCaptureSourceType type ) -``` - -**Description** - -Releases an audio buffer. After the audio buffer is no longer needed, call this function to release it. - -From API version 12, you are advised to use [OH_AVScreenCapture_OnBufferAvailable](#oh_avscreencapture_onbufferavailable) instead. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| -| type | Type of the audio buffer, which is used to distinguish external streams recorded by the microphone from internal streams played by the system.| - -**Returns** - -Returns a result code defined in [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1). - -**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. - -**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** is a null pointer. - -**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The data callback has been set or the audio buffer fails to be released. - - -### OH_AVScreenCapture_ReleaseContentFilter() - -``` -OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ReleaseContentFilter (struct OH_AVScreenCapture_ContentFilter * filter) -``` - -**Description** - -Releases a content filter. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| filter | Pointer to an [OH_AVScreenCapture_ContentFilter](#oh_avscreencapture_contentfilter) instance.| - -**Returns** - -Returns a result code defined in [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1). - -**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. - -**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **filter** is a null pointer. - - -### OH_AVScreenCapture_ReleaseVideoBuffer() - -``` -OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ReleaseVideoBuffer (struct OH_AVScreenCapture * capture) -``` - -**Description** - -Releases a video buffer. After the video buffer is no longer needed, call this function to release it. - -From API version 12, you are advised to use [OH_AVScreenCapture_OnBufferAvailable](#oh_avscreencapture_onbufferavailable) instead. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| - -**Returns** - -Returns a result code defined in [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1). - -**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. - -**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** is a null pointer. - -**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The data callback has been set or the video buffer fails to be released. - - -### OH_AVScreenCapture_SetCallback() - -``` -OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetCallback (struct OH_AVScreenCapture * capture, struct OH_AVScreenCaptureCallback callback ) -``` - -**Description** - -Sets a callback to listen for available video buffers and audio buffers and errors that occur during the function calling. - -From API version 12, you are advised to use [OH_AVScreenCapture_SetErrorCallback](#oh_avscreencapture_seterrorcallback) and [OH_AVScreenCapture_SetDataCallback](#oh_avscreencapture_setdatacallback) instead. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| -| callback | [OH_AVScreenCaptureCallback](_o_h___a_v_screen_capture_callback.md) struct, which stores related callback function pointers.| - -**Returns** - -Returns a result code defined in [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1). - -**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. - -**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** or **callback** is a null pointer. - -**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The callback fails to be set. - - -### OH_AVScreenCapture_SetCanvasRotation() - -``` -OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetCanvasRotation (struct OH_AVScreenCapture * capture, bool canvasRotation ) -``` - -**Description** - -Sets canvas rotation for screen capture. - -You can call this function to set whether to rotate the recorded screen data. When **canvasRotation** is set to **true**, screen capture rotation is enabled and the recorded screen data remains positive. - -The default value is **false**. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| -| canvasRotation | Whether to enable screen data rotation.| - -**Returns** - -Returns a result code defined in [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1). - -**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. - -**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** is a null pointer. - -**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. Canvas rotation fails to be set for screen capture. - - -### OH_AVScreenCapture_SetDataCallback() - -``` -OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetDataCallback (struct OH_AVScreenCapture * capture, OH_AVScreenCapture_OnBufferAvailable callback, void * userData ) -``` - -**Description** - -Sets a data processing callback. This function must be called before screen capture starts. - -The callback is triggered when an audio buffer or a video buffer becomes available during the running of an **OH_AVScreenCapture** instance. - -The application needs to process microphone audio, internal audio, and video data based on the data type in the callback. After the callback is triggered, the buffer is no longer valid. - -A successful call to this function leads to the following scenarios: - -- The callbacks [OH_AVScreenCaptureOnAudioBufferAvailable](#oh_avscreencaptureonaudiobufferavailable) and [OH_AVScreenCaptureOnVideoBufferAvailable](#oh_avscreencaptureonvideobufferavailable) set by calling [OH_AVScreenCapture_SetCallback](#oh_avscreencapture_setcallback) will no longer be triggered, even when an audio buffer or a video buffer becomes available. -- A failure message is returned for a call to any of the following functions: [OH_AVScreenCapture_AcquireAudioBuffer](#oh_avscreencapture_acquireaudiobuffer), [OH_AVScreenCapture_ReleaseAudioBuffer](#oh_avscreencapture_releaseaudiobuffer), [OH_AVScreenCapture_AcquireVideoBuffer](#oh_avscreencapture_acquirevideobuffer), and [OH_AVScreenCapture_ReleaseVideoBuffer](#oh_avscreencapture_releasevideobuffer). - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| -| callback | Data processing callback, which is [OH_AVScreenCapture_OnBufferAvailable](#oh_avscreencapture_onbufferavailable).| -| userData | Pointer to the user-defined data. The data is returned as an input parameter when the data processing callback is triggered.| - -**Returns** - -Returns a result code defined in [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1). - -**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. - -**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** or **callback** is a null pointer. - -**AV_SCREEN_CAPTURE_ERR_NO_MEMORY**: The memory fails to be allocated due to insufficient memory. - -**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The data callback fails to be set. - - -### OH_AVScreenCapture_SetDisplayCallback() - -``` -OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetDisplayCallback(struct OH_AVScreenCapture *capture, OH_AVScreenCapture_OnDisplaySelected callback, void *userData) -``` - -**Description** - -Sets a callback function for obtaining the display ID. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 15 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an **OH_AVScreenCapture** instance.| -| callback | Callback function for returning the display ID. The callback function is an [OH_AVScreenCapture_OnDisplaySelected](#oh_avscreencapture_ondisplayselected) object.| -| userData | Pointer to the user-defined data. The data is returned as an input parameter when the state change callback is triggered.| - -**Returns** - -Returns a result code defined in [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1). - -**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. - -**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** or **callback** is a null pointer. - -**AV_SCREEN_CAPTURE_ERR_NO_MEMORY**: The memory fails to be allocated due to insufficient memory. - -**AV_SCREEN_CAPTURE_ERR_INVALID_STATE**: This operation is not supported in the current state. The callback function must be called before **start** is called. - - -### OH_AVScreenCapture_SetErrorCallback() - -``` -OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetErrorCallback (struct OH_AVScreenCapture * capture, OH_AVScreenCapture_OnError callback, void * userData ) -``` - -**Description** - -Sets an error processing callback. This function must be called before screen capture starts. - -The callback is triggered when an error occurs during the running of an **OH_AVScreenCapture** instance. - -After a successful call to this function, the callback [OH_AVScreenCaptureOnError](#oh_avscreencaptureonerror) set by calling [OH_AVScreenCapture_SetCallback](#oh_avscreencapture_setcallback) will no longer be triggered, even when an error occurs in the **OH_AVScreenCapture** instance. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| -| callback | Error processing callback, which is [OH_AVScreenCapture_OnError](#oh_avscreencapture_onerror).| -| userData | Pointer to the user-defined data. The data is returned as an input parameter when the error processing callback is triggered.| - -**Returns** - -Returns a result code defined in [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1). - -**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. - -**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** or **callback** is a null pointer. - -**AV_SCREEN_CAPTURE_ERR_NO_MEMORY**: The memory fails to be allocated due to insufficient memory. - -**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The error callback fails to be set. - - -### OH_AVScreenCapture_SetMicrophoneEnabled() - -``` -OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetMicrophoneEnabled (struct OH_AVScreenCapture * capture, bool isMicrophone ) -``` - -**Description** - -Enables or disables the microphone. When **isMicrophone** is set to **true**, the microphone is enabled, and the original PCM data of the microphone can be obtained by calling [OH_AVScreenCapture_StartScreenCapture](#oh_avscreencapture_startscreencapture) and [OH_AVScreenCapture_AcquireAudioBuffer](#oh_avscreencapture_acquireaudiobuffer). When **isMicrophone** is set to **false**, the obtained audio data is silent data. - -By default, the microphone is enabled. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| -| isMicrophone | Whether to enable the microphone.| - -**Returns** - -Returns a result code defined in [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1). - -**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. - -**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** is a null pointer. - -**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The microphone fails to be enabled or disabled. - - -### OH_AVScreenCapture_SetStateCallback() - -``` -OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetStateCallback (struct OH_AVScreenCapture * capture, OH_AVScreenCapture_OnStateChange callback, void * userData ) -``` - -**Description** - -Sets a state change callback. This function must be called before screen capture starts. - -The callback is triggered when the state changes during the running of an **OH_AVScreenCapture** instance. - -A privacy dialog box is displayed to ask for user consent before screen capture starts. After a successful call to this function, the following scenarios are possible: - -- If the user agrees, the screen capture startup process starts. - - - If screen capture starts successfully, the state change callback is triggered to report the [OH_SCREEN_CAPTURE_STATE_STARTED](#oh_avscreencapturestatecode-1) status to notify the application of the startup success, with a screen capture notification displayed. - - - If screen capture fails to start, the state change callback is triggered to report the failure information (for example, [OH_SCREEN_CAPTURE_STATE_MIC_UNAVAILABLE](#oh_avscreencapturestatecode-1) if the microphone is unavailable), or the error processing callback [OH_AVScreenCapture_OnError](#oh_avscreencapture_onerror) is triggered to report the error information. - -- If the user disagrees, the screen capture startup process stops. The state change callback is triggered to report the [OH_SCREEN_CAPTURE_STATE_CANCELED](#oh_avscreencapturestatecode-1) status to notify the application of the startup failure due to user rejection. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| -| callback | State change callback, which is [OH_AVScreenCapture_OnStateChange](#oh_avscreencapture_onstatechange).| -| userData | Pointer to the user-defined data. The data is returned as an input parameter when the state change callback is triggered.| - -**Returns** - -Returns a result code defined in [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1). - -**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. - -**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** or **callback** is a null pointer. - -**AV_SCREEN_CAPTURE_ERR_NO_MEMORY**: The memory fails to be allocated due to insufficient memory. - -**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The state callback fails to be set. - - -### OH_AVScreenCapture_StartScreenCapture() - -``` -OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StartScreenCapture (struct OH_AVScreenCapture * capture) -``` - -**Description** - -Starts screen capture and collects original streams. After this function is called, the callback ([OH_AVScreenCapture_OnBufferAvailable](#oh_avscreencapture_onbufferavailable)) can be used to check whether streams are generated, and the callback ([OH_AVScreenCapture_OnStateChange](#oh_avscreencapture_onstatechange)) can be used to check the startup status. - -The application can obtain the original streams of screen capture by calling [OH_AVScreenCapture_AcquireAudioBuffer](#oh_avscreencapture_acquireaudiobuffer) and [OH_AVScreenCapture_ReleaseVideoBuffer](#oh_avscreencapture_releasevideobuffer). - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| - -**Returns** - -Returns a result code defined in [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1). - -**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. - -**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** is a null pointer. - -**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The privacy permission fails to be enabled or screen capture fails to start. - - -### OH_AVScreenCapture_StartScreenCaptureWithSurface() - -``` -OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StartScreenCaptureWithSurface (struct OH_AVScreenCapture * capture, OHNativeWindow * window ) -``` - -**Description** - -Starts screen capture in surface mode. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| -| window | Pointer to an [OHNativeWindow](../apis-arkgraphics2d/_native_window.md#ohnativewindow) instance.| - -**Returns** - -Returns a result code defined in [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1). - -**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. - -**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture**, input parameter **window**, or **windowSurface** pointed to by **window** is a null pointer. - -**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The privacy permission fails to be enabled or screen capture with a surface fails to start. - - -### OH_AVScreenCapture_StartScreenRecording() - -``` -OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StartScreenRecording (struct OH_AVScreenCapture * capture) -``` - -**Description** - -Starts screen recording, with recordings saved in files. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| - -**Returns** - -Returns a result code defined in [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1). - -**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. - -**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** is a null pointer. - -**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The privacy permission fails to be enabled or screen capture fails to start. - - -### OH_AVScreenCapture_StopScreenCapture() - -``` -OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StopScreenCapture (struct OH_AVScreenCapture * capture) -``` - -**Description** - -Stops screen capture. This function is used in pair with [OH_AVScreenCapture_StartScreenCapture](#oh_avscreencapture_startscreencapture). After calling this function, the application stops screen capture or screen share and releases the microphone. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| - -**Returns** - -Returns a result code defined in [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1). - -**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. - -**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** is a null pointer. - -**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. Screen capture fails to stop. - - -### OH_AVScreenCapture_StopScreenRecording() - -``` -OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StopScreenRecording (struct OH_AVScreenCapture * capture) -``` - -**Description** - -Stops screen recording. This function is used in pair with [OH_AVScreenCapture_StartScreenRecording](#oh_avscreencapture_startscreenrecording). - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| - -**Returns** - -Returns a result code defined in [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1). - -**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. - -**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** is a null pointer. - -**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. Screen capture fails to stop. - -### OH_AVScreenCapture_ResizeCanvas() - -``` -OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ResizeCanvas (struct OH_AVScreenCapture * capture, int32_t width, int32_t height) -``` - -**Description** - -Adjusts the screen resolution. - -This function is used to set the resolution of screen capture data. **width** indicates the screen width and **height** indicates the screen height. - -Currently, this function supports only the scenario of capturing streams, but not the scenario of storing captured files. In addition, the caller of this function and the video data consumer must ensure that they support resolution changes of the received video data. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| -| width | Width of the screen to capture.| -| height | Height of the screen to capture.| - -**Returns** - -Returns a result code defined in [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1). - -**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. - -**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** is a null pointer. - -**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. - - -### OH_AVScreenCapture_ShowCursor() - -``` -OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ShowCursor(struct OH_AVScreenCapture *capture, bool showCursor) -``` - -**Description** - -Sets whether to show the cursor. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 15 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| -| showCursor | Whether to show the cursor.| - -**Returns** - -Returns a result code defined in [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1). - -**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. - -**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** is a null pointer. - -**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The cursor setting fails. - - -### OH_AVScreenCapture_SkipPrivacyMode() - -``` -OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SkipPrivacyMode (struct OH_AVScreenCapture * capture, int32_t *windowIDs, int32_t windowCount) -``` - -**Description** - -Exempts privacy windows during screen capture. - -Currently, all the IDs of the subwindows and main windows to skip must be passed in. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| -| windowIDs | Pointer to the IDs of the privacy windows to skip.| -| windowCount | Length of the privacy window ID list.| - -**Returns** - -Returns a result code defined in [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1). - -**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. - -**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** is a null pointer. - -**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. - - -### OH_AVScreenCapture_SetMaxVideoFrameRate() -``` -OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetMaxVideoFrameRate (struct OH_AVScreenCapture * capture, int32_t frameRate) -``` - -**Description** - -Sets the maximum frame rate for screen capture. - -This function must be called after screen capture starts. - - - -The maximum frame rate that can be configured is subject to the device's limitations and is ultimately governed by the capabilities of the underlying system. - -Although there is no limit on the maximum value of the input parameter, the maximum frame rate supported is 60 FPS. If the input parameter value exceeds 60 FPS, 60 FPS is used. If the value does not exceed the upper limit, the passed value is used. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 14 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| -| frameRate | Maximum frame rate.| - -**Returns** - -Returns a result code defined in [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1). - -**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. - -**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** is a null pointer, or the input parameter **frameRate** is not supported. - -**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is restricted. You are advised to try again. diff --git a/en/application-dev/reference/apis-media-kit/_o_h___a_v_recorder___config.md b/en/application-dev/reference/apis-media-kit/_o_h___a_v_recorder___config.md deleted file mode 100644 index 87822748a3e..00000000000 --- a/en/application-dev/reference/apis-media-kit/_o_h___a_v_recorder___config.md +++ /dev/null @@ -1,98 +0,0 @@ -# OH_AVRecorder_Config - - -## Overview - -The OH_AVRecorder_Config struct describes the AVRecorder configuration. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -**Related module**: [AVRecorder](_a_v_recorder.md) - -**Header file**: [avrecorder_base.h](avrecorder__base_8h.md) - - -## Summary - - -### Member Variables - -| Name| Description| -| -------- | -------- | -| [OH_AVRecorder_AudioSourceType](_a_v_recorder.md#oh_avrecorder_audiosourcetype) [audioSourceType](#audiosourcetype) | Type of the audio source to record.| -| [OH_AVRecorder_VideoSourceType](_a_v_recorder.md#oh_avrecorder_videosourcetype) [videoSourceType](#videosourcetype) | Type of the video source to record.| -| [OH_AVRecorder_Profile](_o_h___a_v_recorder___profile.md) [profile](#profile) | Audio and video encoding configuration.| -| char \*[url](#url) | URL of the recording output file, in the format of fd://xx.| -| [OH_AVRecorder_FileGenerationMode](_a_v_recorder.md#oh_avrecorder_filegenerationmode) [fileGenerationMode](#filegenerationmode) | Mode for generating the recording output file.| -| [OH_AVRecorder_Metadata](_o_h___a_v_recorder___metadata.md) [metadata](#metadata) | Metadata of the recorded media.| - - -## Member Variable Description - - -### audioSourceType - -``` -OH_AVRecorder_AudioSourceType audioSourceType -``` - -**Description** - -Type of the audio source to record. - - -### videoSourceType - -``` -OH_AVRecorder_VideoSourceType videoSourceType -``` - -**Description** - -Type of the video source to record. - - -### profile - -``` -OH_AVRecorder_Profile profile -``` - -**Description** - -Audio and video encoding configuration. - - -### url - -``` -char *url -``` - -**Description** - -URL of the recording output file, in the format of fd://xx. - - -### fileGenerationMode - -``` -OH_AVRecorder_FileGenerationMode fileGenerationMode -``` - -**Description** - -Mode for generating the recording output file. - - -### metadata - -``` -OH_AVRecorder_Metadata metadata -``` - -**Description** - -Metadata of the recorded media. diff --git a/en/application-dev/reference/apis-media-kit/_o_h___a_v_recorder___encoder_info.md b/en/application-dev/reference/apis-media-kit/_o_h___a_v_recorder___encoder_info.md deleted file mode 100644 index 8a392975086..00000000000 --- a/en/application-dev/reference/apis-media-kit/_o_h___a_v_recorder___encoder_info.md +++ /dev/null @@ -1,134 +0,0 @@ -# OH_AVRecorder_EncoderInfo - - -## Overview - -The OH_AVRecorder_EncoderInfo struct describes the encoder information. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -**Related module**: [AVRecorder](_a_v_recorder.md) - -**Header file**: [avrecorder_base.h](avrecorder__base_8h.md) - - -## Summary - - -### Member Variables - -| Name| Description| -| -------- | -------- | -| [OH_AVRecorder_CodecMimeType](_a_v_recorder.md#oh_avrecorder_codecmimetype) [mimeType](#mimetype) | MIME type of the encoder.| -| char \*[type](#type) | Encoder type. The value **audio** means an audio encoder, and **video** means a video encoder.| -| [OH_AVRecorder_Range](_o_h___a_v_recorder___range.md) [bitRate](#bitrate) | Bit rate range of the encoder, with the minimum and maximum bit rates specified.| -| [OH_AVRecorder_Range](_o_h___a_v_recorder___range.md) [frameRate](#framerate) | Video frame rate range, with the minimum and maximum frame rates specified. This parameter is available only for video encoders.| -| [OH_AVRecorder_Range](_o_h___a_v_recorder___range.md) [width](#width) | Video frame width range, with the minimum and maximum widths specified. This parameter is available only for video encoders.| -| [OH_AVRecorder_Range](_o_h___a_v_recorder___range.md) [height](#height) | Video frame height range, with the minimum and maximum heights specified. This parameter is available only for video encoders.| -| [OH_AVRecorder_Range](_o_h___a_v_recorder___range.md) [channels](#channels) | Number of audio channels for the audio capturer, with the minimum and maximum numbers of audio channels specified. This parameter is available only for audio encoders.| -| int32_t \*[sampleRate](#samplerate) | List of audio sampling rates, including all available audio sampling rates. This parameter is available only for audio encoders.| -| int32_t [sampleRateLen](#sampleratelen) | Length of the audio sampling rate list.| - - -## Member Variable Description - - -### mimeType - -``` -OH_AVRecorder_CodecMimeType mimeType -``` - -**Description** - -MIME type of the encoder. - - -### type - -``` -char *type -``` - -**Description** - -Encoder type. The value **audio** means an audio encoder, and **video** means a video encoder. - - -### bitRate - -``` -OH_AVRecorder_Range bitRate -``` - -**Description** - -Bit rate range of the encoder, with the minimum and maximum bit rates specified. - - -### frameRate - -``` -OH_AVRecorder_Range frameRate -``` - -**Description** - -Video frame rate range, with the minimum and maximum frame rates specified. This parameter is available only for video encoders. - - -### width - -``` -OH_AVRecorder_Range width -``` - -**Description** - -Video frame width range, with the minimum and maximum widths specified. This parameter is available only for video encoders. - - -### height - -``` -OH_AVRecorder_Range height -``` - -**Description** - -Video frame height range, with the minimum and maximum heights specified. This parameter is available only for video encoders. - - -### channels - -``` -OH_AVRecorder_Range channels -``` - -**Description** - -Number of audio channels for the audio capturer, with the minimum and maximum numbers of audio channels specified. This parameter is available only for audio encoders. - - -### sampleRate - -``` -int32_t *sampleRate -``` - -**Description** - -List of audio sampling rates, including all available audio sampling rates. This parameter is available only for audio encoders. - - -### sampleRateLen - -``` -int32_t sampleRateLen -``` - -**Description** - -Length of the audio sampling rate list. diff --git a/en/application-dev/reference/apis-media-kit/_o_h___a_v_recorder___location.md b/en/application-dev/reference/apis-media-kit/_o_h___a_v_recorder___location.md deleted file mode 100644 index ab6f0e56f23..00000000000 --- a/en/application-dev/reference/apis-media-kit/_o_h___a_v_recorder___location.md +++ /dev/null @@ -1,50 +0,0 @@ -# OH_AVRecorder_Location - - -## Overview - -The OH_AVRecorder_Location struct describes the geographical location information about a media asset. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -**Related module**: [AVRecorder](_a_v_recorder.md) - -**Header file**: [avrecorder_base.h](avrecorder__base_8h.md) - - -## Summary - - -### Member Variables - -| Name| Description| -| -------- | -------- | -| float [latitude](#latitude) | Latitude of the geographical location.| -| float [longitude](#longitude) | Longitude of the geographical location.| - - -## Member Variable Description - - -### latitude - -``` -float latitude -``` - -**Description** - -Latitude of the geographical location. - - -### longitude - -``` -float longitude -``` - -**Description** - -Longitude of the geographical location. diff --git a/en/application-dev/reference/apis-media-kit/_o_h___a_v_recorder___metadata.md b/en/application-dev/reference/apis-media-kit/_o_h___a_v_recorder___metadata.md deleted file mode 100644 index 936c3703d71..00000000000 --- a/en/application-dev/reference/apis-media-kit/_o_h___a_v_recorder___metadata.md +++ /dev/null @@ -1,74 +0,0 @@ -# OH_AVRecorder_Metadata - - -## Overview - -The OH_AVRecorder_Metadata struct describes the metadata. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -**Related module**: [AVRecorder](_a_v_recorder.md) - -**Header file**: [avrecorder_base.h](avrecorder__base_8h.md) - - -## Summary - - -### Member Variables - -| Name| Description| -| -------- | -------- | -| char \*[genre](#genre) | Type or genre of the media asset.| -| char \*[videoOrientation](#videoorientation) | Video rotation direction, in degrees.| -| [OH_AVRecorder_Location](_o_h___a_v_recorder___location.md) [location](#location) | Geographical location of the media asset.| -| [OH_AVRecorder_MetadataTemplate](_o_h___a_v_recorder___metadata_template.md) [customInfo](#custominfo) | Custom key-value mappings read from **moov.meta.list**.| - - -## Member Variable Description - - -### genre - -``` -char *genre -``` - -**Description** - -Type or genre of the media asset. - - -### videoOrientation - -``` -char *videoOrientation -``` - -**Description** - -Video rotation direction, in degrees. - - -### location - -``` -OH_AVRecorder_Location location -``` - -**Description** - -Geographical location of the media asset. - - -### customInfo - -``` -OH_AVRecorder_MetadataTemplate customInfo -``` - -**Description** - -Custom key-value mappings read from **moov.meta.list**. diff --git a/en/application-dev/reference/apis-media-kit/_o_h___a_v_recorder___metadata_template.md b/en/application-dev/reference/apis-media-kit/_o_h___a_v_recorder___metadata_template.md deleted file mode 100644 index 76ef7e80ce6..00000000000 --- a/en/application-dev/reference/apis-media-kit/_o_h___a_v_recorder___metadata_template.md +++ /dev/null @@ -1,50 +0,0 @@ -# OH_AVRecorder_MetadataTemplate - - -## Overview - -The OH_AVRecorder_MetadataTemplate struct describes the basic template of metadata. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -**Related module**: [AVRecorder](_a_v_recorder.md) - -**Header file**: [avrecorder_base.h](avrecorder__base_8h.md) - - -## Summary - - -### Member Variables - -| Name| Description| -| -------- | -------- | -| char \*[key](#key) | Key of the metadata.| -| char \*[value](#value) | Value of the metadata.| - - -## Member Variable Description - - -### key - -``` -char *key -``` - -**Description** - -Key of the metadata. - - -### value - -``` -char *value -``` - -**Description** - -Value of the metadata. diff --git a/en/application-dev/reference/apis-media-kit/_o_h___a_v_recorder___profile.md b/en/application-dev/reference/apis-media-kit/_o_h___a_v_recorder___profile.md deleted file mode 100644 index 26e7bebca86..00000000000 --- a/en/application-dev/reference/apis-media-kit/_o_h___a_v_recorder___profile.md +++ /dev/null @@ -1,174 +0,0 @@ -# OH_AVRecorder_Profile - - -## Overview - -The OH_AVRecorder_Profile struct describes the parameters used for audio and video recording. - -You can choose to record only audio or only video by setting the parameters. When **audioBitrate** or **audioChannels** is set to **0**, audio recording is disabled. When **videoFrameWidth** or **videoFrameHeight** is set to **0**, video recording is disabled. - -For details about the value range of each parameter, see [AVRecorderProfile](js-apis-media.md#avrecorderprofile9). - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -**Related module**: [AVRecorder](_a_v_recorder.md) - -**Header file**: [avrecorder_base.h](avrecorder__base_8h.md) - - -## Summary - - -### Member Variables - -| Name| Description| -| -------- | -------- | -| int32_t [audioBitrate](#audiobitrate) | Audio bit rate.| -| int32_t [audioChannels](#audiochannels) | Number of channels.| -| [OH_AVRecorder_CodecMimeType](_a_v_recorder.md#oh_avrecorder_codecmimetype) [audioCodec](#audiocodec) | Audio encoding format.| -| int32_t [audioSampleRate](#audiosamplerate) | Audio sampling rate.| -| [OH_AVRecorder_ContainerFormatType](_a_v_recorder.md#oh_avrecorder_containerformattype) [fileFormat](#fileformat) | Output file format.| -| int32_t [videoBitrate](#videobitrate) | Video bit rate.| -| [OH_AVRecorder_CodecMimeType](_a_v_recorder.md#oh_avrecorder_codecmimetype) [videoCodec](#videocodec) | Video encoding format.| -| int32_t [videoFrameWidth](#videoframewidth) | Video width.| -| int32_t [videoFrameHeight](#videoframeheight) | Video height.| -| int32_t [videoFrameRate](#videoframerate) | Video frame rate.| -| bool [isHdr](#ishdr) | Whether to record HDR videos.| -| bool [enableTemporalScale](#enabletemporalscale) | Whether to enable temporal scaling encoding mode.| - - -## Member Variable Description - - -### audioBitrate - -``` -int32_t audioBitrate -``` - -**Description** - -Audio bit rate. - - -### audioChannels - -``` -int32_t audioChannels -``` - -**Description** - -Number of channels. - - -### audioCodec - -``` -OH_AVRecorder_CodecMimeType audioCodec -``` - -**Description** - -Audio encoding format. - - -### audioSampleRate - -``` -int32_t audioSampleRate -``` - -**Description** - -Audio sampling rate. - - -### fileFormat - -``` -OH_AVRecorder_ContainerFormatType fileFormat -``` - -**Description** - -Output file format. - - -### videoBitrate - -``` -int32_t videoBitrate -``` - -**Description** - -Video bit rate. - - -### videoCodec - -``` -OH_AVRecorder_CodecMimeType videoCodec -``` - -**Description** - -Video encoding format. - - -### videoFrameWidth - -``` -int32_t videoFrameWidth -``` - -**Description** - -Video width. - - -### videoFrameHeight - -``` -int32_t videoFrameHeight -``` - -**Description** - -Video height. - - -### videoFrameRate - -``` -int32_t videoFrameRate -``` - -**Description** - -Video frame rate. - - -### isHdr - -``` -bool isHdr -``` - -**Description** - -Whether to record HDR videos. - - -### enableTemporalScale - -``` -bool enableTemporalScale -``` - -**Description** - -Whether to enable temporal scaling encoding mode. diff --git a/en/application-dev/reference/apis-media-kit/_o_h___a_v_recorder___range.md b/en/application-dev/reference/apis-media-kit/_o_h___a_v_recorder___range.md deleted file mode 100644 index 58080343a9e..00000000000 --- a/en/application-dev/reference/apis-media-kit/_o_h___a_v_recorder___range.md +++ /dev/null @@ -1,50 +0,0 @@ -# OH_AVRecorder_Range - - -## Overview - -The OH_AVRecorder_Range struct describes the range. - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -**Related module**: [AVRecorder](_a_v_recorder.md) - -**Header file**: [avrecorder_base.h](avrecorder__base_8h.md) - - -## Summary - - -### Member Variables - -| Name| Description| -| -------- | -------- | -| int32_t [min](#min) | Minimum value.| -| int32_t [max](#max) | Maximum value.| - - -## Member Variable Description - - -### min - -``` -int32_t min -``` - -**Description** - -Minimum value. - - -### max - -``` -int32_t max -``` - -**Description** - -Maximum value. diff --git a/en/application-dev/reference/apis-media-kit/_o_h___a_v_screen_capture_callback.md b/en/application-dev/reference/apis-media-kit/_o_h___a_v_screen_capture_callback.md deleted file mode 100644 index 47bf08e4e03..00000000000 --- a/en/application-dev/reference/apis-media-kit/_o_h___a_v_screen_capture_callback.md +++ /dev/null @@ -1,70 +0,0 @@ -# OH_AVScreenCaptureCallback - - -## Overview - -The OH_AVScreenCaptureCallback struct describes all the asynchronous callback function pointers of an **OH_AVScreenCapture** instance. To ensure the normal running of **OH_AVScreenCapture**, you must register the instance of this struct with the **OH_AVScreenCapture** instance and process the information reported by the callback functions. - -From API version 12, you are advised to use [OH_AVScreenCapture_OnError](_a_v_screen_capture.md#oh_avscreencapture_onerror) and [OH_AVScreenCapture_OnBufferAvailable](_a_v_screen_capture.md#oh_avscreencapture_onbufferavailable) instead. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Related module**: [AVScreenCapture](_a_v_screen_capture.md) - -**Header file**: [native_avscreen_capture_base.h](native__avscreen__capture__base_8h.md) - - -## Summary - - -### Member Variables - -| Name| Description| -| -------- | -------- | -| [OH_AVScreenCaptureOnError](_a_v_screen_capture.md#oh_avscreencaptureonerror) [onError](#onerror) | Pointer to a callback function that is called when an error occurs during the running of an **OH_AVScreenCapture** instance. For details, see [OH_AVScreenCaptureOnError](_a_v_screen_capture.md#oh_avscreencaptureonerror).| -| [OH_AVScreenCaptureOnAudioBufferAvailable](_a_v_screen_capture.md#oh_avscreencaptureonaudiobufferavailable) [onAudioBufferAvailable](#onaudiobufferavailable) | Pointer to a callback function that is called when an audio buffer is available during the running of an **OH_AVScreenCapture** instance. For details, see [OH_AVScreenCaptureOnAudioBufferAvailable](_a_v_screen_capture.md#oh_avscreencaptureonaudiobufferavailable).| -| [OH_AVScreenCaptureOnVideoBufferAvailable](_a_v_screen_capture.md#oh_avscreencaptureonvideobufferavailable) [onVideoBufferAvailable](#onvideobufferavailable) | Pointer to a callback function that is called when a video buffer is available during the running of an **OH_AVScreenCapture** instance. For details, see [OH_AVScreenCaptureOnVideoBufferAvailable](_a_v_screen_capture.md#oh_avscreencaptureonvideobufferavailable).| - - -## Member Variable Description - - -### onAudioBufferAvailable - -``` -OH_AVScreenCaptureOnAudioBufferAvailable OH_AVScreenCaptureCallback::onAudioBufferAvailable -``` - -Pointer to a callback function that is called when an audio buffer is available during the running of an **OH_AVScreenCapture** instance. For details, see [OH_AVScreenCaptureOnAudioBufferAvailable](_a_v_screen_capture.md#oh_avscreencaptureonaudiobufferavailable). - -From API version 12, you are advised to use [OH_AVScreenCapture_OnBufferAvailable](_a_v_screen_capture.md#oh_avscreencapture_onbufferavailable) instead. - -**Since**: 10 - - -### onError - -``` -OH_AVScreenCaptureOnError OH_AVScreenCaptureCallback::onError -``` - -Pointer to a callback function that is called when an error occurs during the running of an **OH_AVScreenCapture** instance. For details, see [OH_AVScreenCaptureOnError](_a_v_screen_capture.md#oh_avscreencaptureonerror). - -From API version 12, you are advised to use [OH_AVScreenCapture_OnError](_a_v_screen_capture.md#oh_avscreencapture_onerror) instead. - -**Since**: 10 - - -### onVideoBufferAvailable - -``` -OH_AVScreenCaptureOnVideoBufferAvailable OH_AVScreenCaptureCallback::onVideoBufferAvailable -``` - -Pointer to a callback function that is called when a video buffer is available during the running of an **OH_AVScreenCapture** instance. For details, see [OH_AVScreenCaptureOnVideoBufferAvailable](_a_v_screen_capture.md#oh_avscreencaptureonvideobufferavailable). - -From API version 12, you are advised to use [OH_AVScreenCapture_OnBufferAvailable](_a_v_screen_capture.md#oh_avscreencapture_onbufferavailable) instead. - -**Since**: 10 diff --git a/en/application-dev/reference/apis-media-kit/_o_h___a_v_screen_capture_config.md b/en/application-dev/reference/apis-media-kit/_o_h___a_v_screen_capture_config.md deleted file mode 100644 index 965952b9bf6..00000000000 --- a/en/application-dev/reference/apis-media-kit/_o_h___a_v_screen_capture_config.md +++ /dev/null @@ -1,86 +0,0 @@ -# OH_AVScreenCaptureConfig - - -## Overview - -The OH_AVScreenCaptureConfig struct describes the screen capture configuration. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Related module**: [AVScreenCapture](_a_v_screen_capture.md) - -**Header file**: [native_avscreen_capture_base.h](native__avscreen__capture__base_8h.md) - - -## Summary - - -### Member Variables - -| Name| Description| -| -------- | -------- | -| [OH_CaptureMode](_a_v_screen_capture.md#oh_capturemode) [captureMode](#capturemode) | Screen capture mode.| -| [OH_DataType](_a_v_screen_capture.md#oh_datatype) [dataType](#datatype) | Data type of the screen capture stream.| -| [OH_AudioInfo](_o_h___audio_info.md) [audioInfo](#audioinfo) | Audio capture information.| -| [OH_VideoInfo](_o_h___video_info.md) [videoInfo](#videoinfo) | Video capture information.| -| [OH_RecorderInfo](_o_h___recorder_info.md) [recorderInfo](#recorderinfo) | Recording file information. This member variable is mandatory when the data type is **OH_CAPTURE_FILE**.| - - -## Member Variable Description - - -### audioInfo - -``` -OH_AudioInfo OH_AVScreenCaptureConfig::audioInfo -``` - -**Description** - -Audio capture information. - - -### captureMode - -``` -OH_CaptureMode OH_AVScreenCaptureConfig::captureMode -``` - -**Description** - -Screen capture mode. - - -### dataType - -``` -OH_DataType OH_AVScreenCaptureConfig::dataType -``` - -**Description** - -Data type of the screen capture stream. - - -### recorderInfo - -``` -OH_RecorderInfo OH_AVScreenCaptureConfig::recorderInfo -``` - -**Description** - -Recording file information. This member variable is mandatory when the data type is **OH_CAPTURE_FILE**. - - -### videoInfo - -``` -OH_VideoInfo OH_AVScreenCaptureConfig::videoInfo -``` - -**Description** - -Video capture information. diff --git a/en/application-dev/reference/apis-media-kit/_o_h___audio_buffer.md b/en/application-dev/reference/apis-media-kit/_o_h___audio_buffer.md deleted file mode 100644 index dc37c6b7f32..00000000000 --- a/en/application-dev/reference/apis-media-kit/_o_h___audio_buffer.md +++ /dev/null @@ -1,66 +0,0 @@ -# OH_AudioBuffer - - -## Overview - -The **OH_AudioBuffer** struct defines the configuration such as the size, type, and timestamp of audio data. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Related module**: [AVScreenCapture](_a_v_screen_capture.md) - -**Header file**: [native_avscreen_capture_base.h](native__avscreen__capture__base_8h.md) - - -## Summary - - -### Member Variables - -| Name| Description| -| -------- | -------- | -| uint8_t \* [buf](#buf) | Defines the pointer to an audio buffer. | -| int32_t [size](#size) | Defines the size of the audio buffer. | -| int64_t [timestamp](#timestamp) | Defines the timestamp of the audio buffer. | -| [OH_AudioCaptureSourceType](_a_v_screen_capture.md#oh_audiocapturesourcetype) [type](#type) | Defines the type of the audio capture source. | - - -## Member Variable Description - - -### buf - -``` -uint8_t* OH_AudioBuffer::buf -``` -**Description** -Defines the pointer to an audio buffer. - - -### size - -``` -int32_t OH_AudioBuffer::size -``` -**Description** -Defines the size of the audio buffer. - - -### timestamp - -``` -int64_t OH_AudioBuffer::timestamp -``` -**Description** -Defines the timestamp of the audio buffer. - - -### type - -``` -OH_AudioCaptureSourceType OH_AudioBuffer::type -``` -**Description** -Defines the type of the audio capture source. diff --git a/en/application-dev/reference/apis-media-kit/_o_h___audio_capture_info.md b/en/application-dev/reference/apis-media-kit/_o_h___audio_capture_info.md deleted file mode 100644 index 82c01b210a8..00000000000 --- a/en/application-dev/reference/apis-media-kit/_o_h___audio_capture_info.md +++ /dev/null @@ -1,58 +0,0 @@ -# OH_AudioCaptureInfo - - -## Overview - -The OH_AudioCaptureInfo struct describes the audio capture information. - -When both **audioSampleRate** and **audioChannels** are **0**, the audio-related parameters are ignored and the audio data is not recorded. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Related module**: [AVScreenCapture](_a_v_screen_capture.md) - -**Header file**: [native_avscreen_capture_base.h](native__avscreen__capture__base_8h.md) - - -## Summary - - -### Member Variables - -| Name| Description| -| -------- | -------- | -| int32_t [audioSampleRate](#audiosamplerate) | Audio sampling rate. | -| int32_t [audioChannels](#audiochannels) | Number of audio channels. | -| [OH_AudioCaptureSourceType](_a_v_screen_capture.md#oh_audiocapturesourcetype) [audioSource](#audiosource) | Audio source. | - - -## Member Variable Description - - -### audioChannels - -``` -int32_t OH_AudioCaptureInfo::audioChannels -``` -**Description** -Number of audio channels. - - -### audioSampleRate - -``` -int32_t OH_AudioCaptureInfo::audioSampleRate -``` -**Description** -Audio sampling rate. For details about the supported rates, see [AudioSamplingRate](../apis-audio-kit/js-apis-audio.md#audiosamplingrate8) of Audio Kit. - - -### audioSource - -``` -OH_AudioCaptureSourceType OH_AudioCaptureInfo::audioSource -``` -**Description** -Audio source. diff --git a/en/application-dev/reference/apis-media-kit/_o_h___audio_enc_info.md b/en/application-dev/reference/apis-media-kit/_o_h___audio_enc_info.md deleted file mode 100644 index 530399b28bb..00000000000 --- a/en/application-dev/reference/apis-media-kit/_o_h___audio_enc_info.md +++ /dev/null @@ -1,50 +0,0 @@ -# OH_AudioEncInfo - - -## Overview - -The **OH_AudioEncInfo** struct describes the audio encoding information. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Related module**: [AVScreenCapture](_a_v_screen_capture.md) - -**Header file**: [native_avscreen_capture_base.h](native__avscreen__capture__base_8h.md) - - -## Summary - - -### Member Variables - -| Name| Description| -| -------- | -------- | -| int32_t [audioBitrate](#audiobitrate) | Audio bit rate.| -| [OH_AudioCodecFormat](_a_v_screen_capture.md#oh_audiocodecformat) [audioCodecformat](#audiocodecformat) | Audio codec format.| - - -## Member Variable Description - - -### audioBitrate - -``` -int32_t OH_AudioEncInfo::audioBitrate -``` - -**Description** - -Audio bit rate. - - -### audioCodecformat - -``` -OH_AudioCodecFormat OH_AudioEncInfo::audioCodecformat -``` - -**Description** - -Audio codec format. diff --git a/en/application-dev/reference/apis-media-kit/_o_h___audio_info.md b/en/application-dev/reference/apis-media-kit/_o_h___audio_info.md deleted file mode 100644 index 9e670570b24..00000000000 --- a/en/application-dev/reference/apis-media-kit/_o_h___audio_info.md +++ /dev/null @@ -1,65 +0,0 @@ -# OH_AudioInfo - - -## Overview - -The OH_AudioInfo struct describes the audio information. - -To perform both external capture (using microphones) and internal capture, **audioSampleRate** and **audioChannels** must be the same for both audio channels. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Related module**: [AVScreenCapture](_a_v_screen_capture.md) - -**Header file**: [native_avscreen_capture_base.h](native__avscreen__capture__base_8h.md) - - -## Summary - - -### Member Variables - -| Name| Description| -| -------- | -------- | -| [OH_AudioCaptureInfo](_o_h___audio_capture_info.md) [micCapInfo](#miccapinfo) | External audio capture information.| -| [OH_AudioCaptureInfo](_o_h___audio_capture_info.md) [innerCapInfo](#innercapinfo) | Internal audio capture information.| -| [OH_AudioEncInfo](_o_h___audio_enc_info.md) [audioEncInfo](#audioencinfo) | Audio encoding information, which is not required for raw streams.| - - -## Member Variable Description - - -### audioEncInfo - -``` -OH_AudioEncInfo OH_AudioInfo::audioEncInfo -``` - -**Description** - -Audio encoding information, which is not required for raw streams. - - - -### innerCapInfo - -``` -OH_AudioCaptureInfo OH_AudioInfo::innerCapInfo -``` - -**Description** - -Internal audio capture information. - - -### micCapInfo - -``` -OH_AudioCaptureInfo OH_AudioInfo::micCapInfo -``` - -**Description** - -External audio capture information. diff --git a/en/application-dev/reference/apis-media-kit/_o_h___recorder_info.md b/en/application-dev/reference/apis-media-kit/_o_h___recorder_info.md deleted file mode 100644 index 62c9fb84ce9..00000000000 --- a/en/application-dev/reference/apis-media-kit/_o_h___recorder_info.md +++ /dev/null @@ -1,61 +0,0 @@ -# OH_RecorderInfo - - -## Overview - -The OH_RecorderInfo struct describes the recording file information. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Related module**: [AVScreenCapture](_a_v_screen_capture.md) - -**Header file**: [native_avscreen_capture_base.h](native__avscreen__capture__base_8h.md) - -## Summary - - -### Member Variables - -| Name| Description| -| -------- | -------- | -| char \* [url](#url) | URL of the recording file.| -| uint32_t [urlLen](#urllen) | URL length.| -| [OH_ContainerFormatType](_a_v_screen_capture.md#oh_containerformattype) [fileFormat](#fileformat) | Format of the recording file.| - - -## Member Variable Description - - -### fileFormat - -``` -OH_ContainerFormatType OH_RecorderInfo::fileFormat -``` - -**Description** - -Format of the recording file. - - -### url - -``` -char* OH_RecorderInfo::url -``` - -**Description** - -URL of the recording file. - - -### urlLen - -``` -uint32_t OH_RecorderInfo::urlLen -``` - -**Description** - -URL length. diff --git a/en/application-dev/reference/apis-media-kit/_o_h___rect.md b/en/application-dev/reference/apis-media-kit/_o_h___rect.md deleted file mode 100644 index 8b3ddcb6a48..00000000000 --- a/en/application-dev/reference/apis-media-kit/_o_h___rect.md +++ /dev/null @@ -1,74 +0,0 @@ -# OH_Rect - - -## Overview - -The OH_Rect struct describes the width, height, and image information of the rectangle used for screen capture. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Related module**: [AVScreenCapture](_a_v_screen_capture.md) - -**Header file**: [native_avscreen_capture_base.h](native__avscreen__capture__base_8h.md) - - -## Summary - - -### Member Variables - -| Name| Description| -| -------- | -------- | -| int32_t [x](#x) | X coordinate of the screen capture rectangle.| -| int32_t [y](#y) | Y coordinate of the screen capture rectangle.| -| int32_t [width](#width) | Width of the screen capture rectangle, in px.| -| int32_t [height](#height) | Height of the screen capture rectangle, in px.| - - -## Member Variable Description - - -### height - -``` -int32_t OH_Rect::height -``` - -**Description** - -Height of the screen capture rectangle, in px. - - -### width - -``` -int32_t OH_Rect::width -``` - -**Description** - -Width of the screen capture rectangle, in px. - - -### x - -``` -int32_t OH_Rect::x -``` - -**Description** - -X coordinate of the screen capture rectangle. - - -### y - -``` -int32_t OH_Rect::y -``` - -**Description** - -Y coordinate of the screen capture rectangle. diff --git a/en/application-dev/reference/apis-media-kit/_o_h___video_capture_info.md b/en/application-dev/reference/apis-media-kit/_o_h___video_capture_info.md deleted file mode 100644 index 97d3b630a2b..00000000000 --- a/en/application-dev/reference/apis-media-kit/_o_h___video_capture_info.md +++ /dev/null @@ -1,100 +0,0 @@ -# OH_VideoCaptureInfo - - -## Overview - -The **OH_VideoCaptureInfo** struct describes the video capture information. - -When **videoFrameWidth** and **videoFrameHeight** are both **0**, video-related parameters are ignored and screen data is not recorded. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Related module**: [AVScreenCapture](_a_v_screen_capture.md) - -**Header file**: [native_avscreen_capture_base.h](native__avscreen__capture__base_8h.md) - - -## Summary - - -### Member Variables - -| Name| Description| -| -------- | -------- | -| uint64_t [displayId](#displayid) | ID of the physical screen to capture. This member variable is valid when **capturemode** is set to **CAPTURE_SPECIFIED_SCREEN**.| -| int32_t \* [missionIDs](#missionids) | Mission ID list. This member variable is valid when **capturemode** is set to **CAPTURE_SPECIFIED_WINDOW**.| -| int32_t [missionIDsLen](#missionidslen) | Length of the mission ID list. This member variable is valid when **capturemode** is set to **CAPTURE_SPECIFIED_WINDOW**.| -| int32_t [videoFrameWidth](#videoframewidth) | Width of the video to capture, in px.| -| int32_t [videoFrameHeight](#videoframeheight) | Height of the video to capture, in px.| -| [OH_VideoSourceType](_a_v_screen_capture.md#oh_videosourcetype) [videoSource](#videosource) | Video source type. Currently, only RGBA is supported.| - - -## Member Variable Description - - -### displayId - -``` -uint64_t OH_VideoCaptureInfo::displayId -``` - -**Description** - -ID of the physical screen to capture. This member variable is valid when **capturemode** is set to **CAPTURE_SPECIFIED_SCREEN**. - - -### missionIDs - -``` -int32_t* OH_VideoCaptureInfo::missionIDs -``` - -**Description** - -Mission ID list. This member variable is valid when **capturemode** is set to **CAPTURE_SPECIFIED_WINDOW**. - - -### missionIDsLen - -``` -int32_t OH_VideoCaptureInfo::missionIDsLen -``` - -**Description** - -Length of the mission ID list. This member variable is valid when **capturemode** is set to **CAPTURE_SPECIFIED_WINDOW**. - - -### videoFrameHeight - -``` -int32_t OH_VideoCaptureInfo::videoFrameHeight -``` - -**Description** - -Height of the video to capture, in px. - - -### videoFrameWidth - -``` -int32_t OH_VideoCaptureInfo::videoFrameWidth -``` - -**Description** - -Width of the video to capture, in px. - - -### videoSource - -``` -OH_VideoSourceType OH_VideoCaptureInfo::videoSource -``` - -**Description** - -Video source type. Currently, only RGBA is supported. diff --git a/en/application-dev/reference/apis-media-kit/_o_h___video_enc_info.md b/en/application-dev/reference/apis-media-kit/_o_h___video_enc_info.md deleted file mode 100644 index 1b4e75b2220..00000000000 --- a/en/application-dev/reference/apis-media-kit/_o_h___video_enc_info.md +++ /dev/null @@ -1,61 +0,0 @@ -# OH_VideoEncInfo - - -## Overview - -The **OH_VideoEncInfo** struct describes the video encoding information. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Related module**: [AVScreenCapture](_a_v_screen_capture.md) - -**Header file**: [native_avscreen_capture_base.h](native__avscreen__capture__base_8h.md) - -## Summary - - -### Member Variables - -| Name| Description| -| -------- | -------- | -| [OH_VideoCodecFormat](_a_v_screen_capture.md#oh_videocodecformat) [videoCodec](#videocodec) | Video encoding format.| -| int32_t [videoBitrate](#videobitrate) | Video bit rate.| -| int32_t [videoFrameRate](#videoframerate) | Video frame rate.| - - -## Member Variable Description - - -### videoBitrate - -``` -int32_t OH_VideoEncInfo::videoBitrate -``` - -**Description** - -Video bit rate. - - -### videoCodec - -``` -OH_VideoCodecFormat OH_VideoEncInfo::videoCodec -``` - -**Description** - -Video encoding format. - - -### videoFrameRate - -``` -int32_t OH_VideoEncInfo::videoFrameRate -``` - -**Description** - -Video frame rate. diff --git a/en/application-dev/reference/apis-media-kit/_o_h___video_info.md b/en/application-dev/reference/apis-media-kit/_o_h___video_info.md deleted file mode 100644 index 4b6ccb29b3a..00000000000 --- a/en/application-dev/reference/apis-media-kit/_o_h___video_info.md +++ /dev/null @@ -1,49 +0,0 @@ -# OH_VideoInfo - - -## Overview - -The **OH_VideoInfo** struct describes the video information. - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Related module**: [AVScreenCapture](_a_v_screen_capture.md) - -**Header file**: [native_avscreen_capture_base.h](native__avscreen__capture__base_8h.md) - -## Summary - - -### Member Variables - -| Name| Description| -| -------- | -------- | -| [OH_VideoCaptureInfo](_o_h___video_capture_info.md) [videoCapInfo](#videocapinfo) | Video capture information.| -| [OH_VideoEncInfo](_o_h___video_enc_info.md) [videoEncInfo](#videoencinfo) | Video encoding information.| - - -## Member Variable Description - - -### videoCapInfo - -``` -OH_VideoCaptureInfo OH_VideoInfo::videoCapInfo -``` - -**Description** - -Video capture information. - - -### videoEncInfo - -``` -OH_VideoEncInfo OH_VideoInfo::videoEncInfo -``` - -**Description** - -Video encoding information. diff --git a/en/application-dev/reference/apis-media-kit/_video_processing.md b/en/application-dev/reference/apis-media-kit/_video_processing.md deleted file mode 100644 index 510d10d18b2..00000000000 --- a/en/application-dev/reference/apis-media-kit/_video_processing.md +++ /dev/null @@ -1,988 +0,0 @@ -# VideoProcessing - - -## Overview - -The VideoProcessing module provides the APIs for video processing. It provides video processing capabilities, including color space conversion, metadata generation, and video scaling. - - - -**Since**: 12 - - -## Summary - - -### Files - -| Name| Description| -| -------- | -------- | -| [video_processing.h](video__processing_8h.md) | Declares the video processing functions.| -| [video_processing_types.h](video__processing__types_8h.md) | Declares the video processing types.| - - -### Structs - -| Name| Description| -| -------- | -------- | -| struct [VideoProcessing_ColorSpaceInfo](_video_processing___color_space_info.md) | Describes the color space information of video processing.| - - -### Types - -| Name| Description| -| -------- | -------- | -| typedef struct [OH_VideoProcessing](#oh_videoprocessing-1) [OH_VideoProcessing](#oh_videoprocessing) | Defines a struct for the video processing object.| -| typedef struct NativeWindow [OHNativeWindow](#ohnativewindow) | Defines a struct for the NativeWindow object.| -| typedef struct [OH_AVFormat](#oh_avformat-1) [OH_AVFormat](#oh_avformat) | Defines a struct for the OH_AVFormat object.| -| typedef struct [VideoProcessing_ColorSpaceInfo](_video_processing___color_space_info.md) [VideoProcessing_ColorSpaceInfo](#videoprocessing_colorspaceinfo) | Defines a struct for the color space information of video processing.| -| typedef enum [VideoDetailEnhancer_QualityLevel](#videodetailenhancer_qualitylevel-1) [VideoDetailEnhancer_QualityLevel](#videodetailenhancer_qualitylevel) | Defines an enum for the quality levels for detail enhancement.| -| typedef enum [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1) [VideoProcessing_ErrorCode](#videoprocessing_errorcode) | Defines an enum for the video processing error codes.| -| typedef enum [VideoProcessing_State](#videoprocessing_state-1) [VideoProcessing_State](#videoprocessing_state) | Defines an enum for the video processing states.| -| typedef struct [VideoProcessing_Callback](#videoprocessing_callback) [VideoProcessing_Callback](#videoprocessing_callback) | Defines a struct for the video processing callback object.| -| typedef void(\* [OH_VideoProcessingCallback_OnError](#oh_videoprocessingcallback_onerror)) ([OH_VideoProcessing](#oh_videoprocessing) \*videoProcessor, [VideoProcessing_ErrorCode](#videoprocessing_errorcode) error, void \*userData) | Defines a pointer to the callback function for reporting an error during video processing.| -| typedef void(\* [OH_VideoProcessingCallback_OnState](#oh_videoprocessingcallback_onstate)) ([OH_VideoProcessing](#oh_videoprocessing) \*videoProcessor, [VideoProcessing_State](#videoprocessing_state) state, void \*userData) | Defines a pointer to the callback function for reporting the video processing state.| -| typedef void(\* [OH_VideoProcessingCallback_OnNewOutputBuffer](#oh_videoprocessingcallback_onnewoutputbuffer)) ([OH_VideoProcessing](#oh_videoprocessing) \*videoProcessor, uint32_t index, void \*userData) | Defines a pointer to the callback function for reporting the data filled in the output buffer.| - - -### Enums - -| Name| Description| -| -------- | -------- | -| [VideoDetailEnhancer_QualityLevel](#videodetailenhancer_qualitylevel-1) {
VIDEO_DETAIL_ENHANCER_QUALITY_LEVEL_NONE,
VIDEO_DETAIL_ENHANCER_QUALITY_LEVEL_LOW,
VIDEO_DETAIL_ENHANCER_QUALITY_LEVEL_MEDIUM,
VIDEO_DETAIL_ENHANCER_QUALITY_LEVEL_HIGH
} | Enumerates the quality levels for detail enhancement.| -| [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1) {
VIDEO_PROCESSING_SUCCESS,
VIDEO_PROCESSING_ERROR_INVALID_PARAMETER = 401,
VIDEO_PROCESSING_ERROR_UNKNOWN = 29210001,
VIDEO_PROCESSING_ERROR_INITIALIZE_FAILED,
VIDEO_PROCESSING_ERROR_CREATE_FAILED,
VIDEO_PROCESSING_ERROR_PROCESS_FAILED,
VIDEO_PROCESSING_ERROR_UNSUPPORTED_PROCESSING,
VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED,
VIDEO_PROCESSING_ERROR_NO_MEMORY,
VIDEO_PROCESSING_ERROR_INVALID_INSTANCE,
VIDEO_PROCESSING_ERROR_INVALID_VALUE
} | Enumerates the video processing error codes.| -| [VideoProcessing_State](#videoprocessing_state-1) {
VIDEO_PROCESSING_STATE_RUNNING,
VIDEO_PROCESSING_STATE_STOPPED
} | Enumerates the video processing states.| - - -### Functions - -| Name| Description| -| -------- | -------- | -| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessing_InitializeEnvironment](#oh_videoprocessing_initializeenvironment) (void) | Initializes the global video processing environment.| -| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessing_DeinitializeEnvironment](#oh_videoprocessing_deinitializeenvironment) (void) | Releases the global video processing environment.| -| bool [OH_VideoProcessing_IsColorSpaceConversionSupported](#oh_videoprocessing_iscolorspaceconversionsupported) (const [VideoProcessing_ColorSpaceInfo](_video_processing___color_space_info.md) \*sourceVideoInfo, const [VideoProcessing_ColorSpaceInfo](_video_processing___color_space_info.md) \*destinationVideoInfo) | Checks whether color space conversion is supported during video processing.| -| bool [OH_VideoProcessing_IsMetadataGenerationSupported](#oh_videoprocessing_ismetadatagenerationsupported) (const [VideoProcessing_ColorSpaceInfo](_video_processing___color_space_info.md) \*sourceVideoInfo) | Checks whether metadata generation is supported during video processing.| -| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessing_Create](#oh_videoprocessing_create) ([OH_VideoProcessing](#oh_videoprocessing) \*\*videoProcessor, int type) | Creates a video processing instance.| -| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessing_Destroy](#oh_videoprocessing_destroy) ([OH_VideoProcessing](#oh_videoprocessing) \*videoProcessor) | Destroys a video processing instance.| -| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessing_RegisterCallback](#oh_videoprocessing_registercallback) ([OH_VideoProcessing](#oh_videoprocessing) \*videoProcessor, const [VideoProcessing_Callback](#videoprocessing_callback) \*callback, void \*userData) | Registers a callback for video processing.| -| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessing_SetSurface](#oh_videoprocessing_setsurface) ([OH_VideoProcessing](#oh_videoprocessing) \*videoProcessor, const [OHNativeWindow](#ohnativewindow) \*window) | Sets an output surface for video processing.| -| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessing_GetSurface](#oh_videoprocessing_getsurface) ([OH_VideoProcessing](#oh_videoprocessing) \*videoProcessor, [OHNativeWindow](#ohnativewindow) \*\*window) | Obtains a surface for video processing.| -| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessing_SetParameter](#oh_videoprocessing_setparameter) ([OH_VideoProcessing](#oh_videoprocessing) \*videoProcessor, const [OH_AVFormat](#oh_avformat) \*parameter) | Sets video processing parameters.| -| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessing_GetParameter](#oh_videoprocessing_getparameter) ([OH_VideoProcessing](#oh_videoprocessing) \*videoProcessor, [OH_AVFormat](#oh_avformat) \*parameter) | Obtains video processing parameters.| -| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessing_Start](#oh_videoprocessing_start) ([OH_VideoProcessing](#oh_videoprocessing) \*videoProcessor) | Starts video processing.| -| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessing_Stop](#oh_videoprocessing_stop) ([OH_VideoProcessing](#oh_videoprocessing) \*videoProcessor) | Stops video processing.| -| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessing_RenderOutputBuffer](#oh_videoprocessing_renderoutputbuffer) ([OH_VideoProcessing](#oh_videoprocessing) \*videoProcessor, uint32_t index) | Renders and processes the buffer, and then outputs it.| -| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessingCallback_Create](#oh_videoprocessingcallback_create) ([VideoProcessing_Callback](#videoprocessing_callback) \*\*callback) | Creates a video processing callback object.| -| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessingCallback_Destroy](#oh_videoprocessingcallback_destroy) ([VideoProcessing_Callback](#videoprocessing_callback) \*callback) | Destroys a video processing callback object.| -| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessingCallback_BindOnError](#oh_videoprocessingcallback_bindonerror) ([VideoProcessing_Callback](#videoprocessing_callback) \*callback, [OH_VideoProcessingCallback_OnError](#oh_videoprocessingcallback_onerror) onError) | Binds the callback function [OH_VideoProcessingCallback_OnError](#oh_videoprocessingcallback_onerror) to a video processing callback object.| -| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessingCallback_BindOnState](#oh_videoprocessingcallback_bindonstate) ([VideoProcessing_Callback](#videoprocessing_callback) \*callback, [OH_VideoProcessingCallback_OnState](#oh_videoprocessingcallback_onstate) onState) | Binds the callback function [OH_VideoProcessingCallback_OnState](#oh_videoprocessingcallback_onstate) to a video processing callback object.| -| [VideoProcessing_ErrorCode](#videoprocessing_errorcode) [OH_VideoProcessingCallback_BindOnNewOutputBuffer](#oh_videoprocessingcallback_bindonnewoutputbuffer) ([VideoProcessing_Callback](#videoprocessing_callback) \*callback, [OH_VideoProcessingCallback_OnNewOutputBuffer](#oh_videoprocessingcallback_onnewoutputbuffer) onNewOutputBuffer) | Binds the callback function [OH_VideoProcessingCallback_OnNewOutputBuffer](#oh_videoprocessingcallback_onnewoutputbuffer) to a video processing callback object.| - - -### Variables - -| Name| Description| -| -------- | -------- | -| const int32_t [VIDEO_PROCESSING_TYPE_COLOR_SPACE_CONVERSION](#video_processing_type_color_space_conversion) | Instance created for color space conversion during video processing.| -| const int32_t [VIDEO_PROCESSING_TYPE_METADATA_GENERATION](#video_processing_type_metadata_generation) | Instance created for metadata generation during video processing.| -| const int32_t [VIDEO_PROCESSING_TYPE_DETAIL_ENHANCER](#video_processing_type_detail_enhancer) | Instance for detail enhancement during video processing.| -| const char \* [VIDEO_DETAIL_ENHANCER_PARAMETER_KEY_QUALITY_LEVEL](#video_detail_enhancer_parameter_key_quality_level) | Pointer to the quality level of video detail enhancement.| - - -## Type Description - - -### OH_AVFormat - -``` -typedef struct OH_AVFormat OH_AVFormat -``` - -**Description** - -Defines a struct for the OH_AVFormat object. - -**Since**: 12 - - -### OH_VideoProcessing - -``` -typedef struct OH_VideoProcessing OH_VideoProcessing -``` - -**Description** - -Defines a struct for the video processing object. - -Define a null pointer to **OH_VideoProcessing**. Before [OH_VideoProcessing_Create](#oh_videoprocessing_create) is called to create a video processing instance, the pointer must be null. You can create different video processing instances with different processing types. - -**Since**: 12 - - -### OH_VideoProcessingCallback_OnError - -``` -typedef void(* OH_VideoProcessingCallback_OnError) (OH_VideoProcessing *videoProcessor, VideoProcessing_ErrorCode error, void *userData) -``` - -**Description** - -Defines a pointer to the callback function for reporting an error during video processing. - -The following error codes are defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): - -- **VIDEO_PROCESSING_ERROR_UNSUPPORTED_PROCESSING**: unsupported processing. For example, conversion between the color space types for input and output is not supported. - -- **VIDEO_PROCESSING_ERROR_INVALID_VALUE**: invalid video attribute. For example, the video color space is invalid. - -- **VIDEO_PROCESSING_ERROR_NO_MEMORY**: out of memory. - -- **VIDEO_PROCESSING_ERROR_PROCESS_FAILED**: An error occurs during the processing. - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| videoProcessor | Pointer to the video processing instance.| -| error | Error code reported.| -| userData | Pointer to user-defined data.| - - -### OH_VideoProcessingCallback_OnNewOutputBuffer - -``` -typedef void(* OH_VideoProcessingCallback_OnNewOutputBuffer) (OH_VideoProcessing *videoProcessor, uint32_t index, void *userData) -``` - -**Description** - -Defines a pointer to the callback function for reporting the data filled in the output buffer. - -After data is filled in each new output buffer, the index of the buffer is reported. Call [OH_VideoProcessing_RenderOutputBuffer](#oh_videoprocessing_renderoutputbuffer) to process rendering based on the index and output the buffer. If this callback function is not registered, the data filled in the output buffer is not reported. Instead, the data is directly processed, rendered, and output. - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| videoProcessor | Pointer to the video processing instance.| -| index | Index of the output buffer.| -| userData | Pointer to user-defined data.| - - -### OH_VideoProcessingCallback_OnState - -``` -typedef void(* OH_VideoProcessingCallback_OnState) (OH_VideoProcessing *videoProcessor, VideoProcessing_State state, void *userData) -``` - -**Description** - -Defines a pointer to the callback function for reporting the video processing state. - -After [OH_VideoProcessing_Start](#oh_videoprocessing_start) is called, the video processing state changes to VIDEO_PROCESSING_STATE_RUNNING. After [OH_VideoProcessing_Stop](#oh_videoprocessing_stop) is called and all buffers finishes processing, the state changes to VIDEO_PROCESSING_STATE_STOPPED. For details, see [VideoProcessing_State](#videoprocessing_state). - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| videoProcessor | Pointer to the video processing instance.| -| state | Video processing state. For details, see [VideoProcessing_State](#videoprocessing_state).| -| userData | Pointer to user-defined data.| - - -### OHNativeWindow - -``` -typedef struct NativeWindow OHNativeWindow -``` - -**Description** - -Defines a struct for the NativeWindow object. - -**Since**: 12 - - -### VideoDetailEnhancer_QualityLevel - -``` -typedef enum VideoDetailEnhancer_QualityLevel VideoDetailEnhancer_QualityLevel -``` - -**Description** - -Defines an enum for the quality levels for detail enhancement. - -For details about the enumerated values, see [VIDEO_DETAIL_ENHANCER_PARAMETER_KEY_QUALITY_LEVEL](#video_detail_enhancer_parameter_key_quality_level). For details about how to set the quality level, see the development guide. - -**See also**: [OH_VideoProcessing_SetParameter](#oh_videoprocessing_setparameter) and [OH_VideoProcessing_GetParameter](#oh_videoprocessing_getparameter) - -**Since**: 12 - - -### VideoProcessing_Callback - -``` -typedef struct VideoProcessing_Callback VideoProcessing_Callback -``` - -**Description** - -Defines a struct for the video processing callback object. - -Define a null pointer to **VideoProcessing_Callback**. Before [OH_VideoProcessingCallback_Create](#oh_videoprocessingcallback_create) is called to create a video processing callback object, the pointer must be null. The callback object is registered by calling [OH_VideoProcessing_RegisterCallback](#oh_videoprocessing_registercallback). - -**Since**: 12 - - -### VideoProcessing_ColorSpaceInfo - -``` -typedef struct VideoProcessing_ColorSpaceInfo VideoProcessing_ColorSpaceInfo -``` - -**Description** - -Defines a struct for the color space information of video processing. - -**See also**: [OH_VideoProcessing_IsColorSpaceConversionSupported](#oh_videoprocessing_iscolorspaceconversionsupported) - -**Since**: 12 - - -### VideoProcessing_ErrorCode - -``` -typedef enum VideoProcessing_ErrorCode VideoProcessing_ErrorCode -``` - -**Description** - -Defines an enum for the video processing error codes. - -**Since**: 12 - - -### VideoProcessing_State - -``` -typedef enum VideoProcessing_State VideoProcessing_State -``` - -**Description** - -Defines an enum for the video processing states. - -The video processing state is reported through the callback function [OH_VideoProcessingCallback_OnState](#oh_videoprocessingcallback_onstate). - -**Since**: 12 - - -## Enum Description - - -### VideoDetailEnhancer_QualityLevel - -``` -enum VideoDetailEnhancer_QualityLevel -``` - -**Description** - -Enumerates the quality levels for detail enhancement. - -For details about the enumerated values, see [VIDEO_DETAIL_ENHANCER_PARAMETER_KEY_QUALITY_LEVEL](#video_detail_enhancer_parameter_key_quality_level). For details about how to set the quality level, see the development guide. - -**See also**: [OH_VideoProcessing_SetParameter](#oh_videoprocessing_setparameter) and [OH_VideoProcessing_GetParameter](#oh_videoprocessing_getparameter) - -**Since**: 12 - -| Value| Description| -| -------- | -------- | -| VIDEO_DETAIL_ENHANCER_QUALITY_LEVEL_NONE | No detail enhancement.| -| VIDEO_DETAIL_ENHANCER_QUALITY_LEVEL_LOW | Low-quality detail enhancement, which features fast speed. This is the default value.| -| VIDEO_DETAIL_ENHANCER_QUALITY_LEVEL_MEDIUM | Medium-quality detail enhancement, which features moderate speed.| -| VIDEO_DETAIL_ENHANCER_QUALITY_LEVEL_HIGH | High-quality detail enhancement, which features slow speed.| - - -### VideoProcessing_ErrorCode - -``` -enum VideoProcessing_ErrorCode -``` - -**Description** - -Enumerates the video processing error codes. - -**Since**: 12 - -| Value| Description| -| -------- | -------- | -| VIDEO_PROCESSING_SUCCESS | The processing is successful.| -| VIDEO_PROCESSING_ERROR_INVALID_PARAMETER | An input parameter is invalid. This error code is returned in the following cases:
1 - The input or output video buffer is either invalid or empty.
2 - The provided parameter is invalid or missing.
3 - The requested processing type is invalid.| -| VIDEO_PROCESSING_ERROR_UNKNOWN | An unknown error occurs. For example, the GPU computing or memcpy fails.| -| VIDEO_PROCESSING_ERROR_INITIALIZE_FAILED | The global video processing environment, for example, the GPU environment, fails to be initialized.| -| VIDEO_PROCESSING_ERROR_CREATE_FAILED | Creating the video processing instance fails. For example, the total number of instances exceeds the upper limit.| -| VIDEO_PROCESSING_ERROR_PROCESS_FAILED | The processing fails. For example, the processing times out.| -| VIDEO_PROCESSING_ERROR_UNSUPPORTED_PROCESSING | The processing type is not supported. You can call OH_VideoProcessing_Is*XXX*Supported to check whether a specific processing type is supported.| -| VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED | The operation is not allowed. For example, the function is called in an incorrect running state.| -| VIDEO_PROCESSING_ERROR_NO_MEMORY | Insufficient memory.| -| VIDEO_PROCESSING_ERROR_INVALID_INSTANCE | The video processing instance is invalid, for example, a null instance.| -| VIDEO_PROCESSING_ERROR_INVALID_VALUE | The input value is invalid. This error code is returned in the following cases:
1 - The width and height of the video buffer are inappropriate or the color space is incorrect.
2 - The parameter contains an invalid value. For example, the quality level of detail enhancement is incorrect.| - - -### VideoProcessing_State - -``` -enum VideoProcessing_State -``` - -**Description** - -Enumerates the video processing states. - -The video processing state is reported through the callback function [OH_VideoProcessingCallback_OnState](#oh_videoprocessingcallback_onstate). - -**Since**: 12 - -| Value| Description| -| -------- | -------- | -| VIDEO_PROCESSING_STATE_RUNNING | Video processing is in progress.| -| VIDEO_PROCESSING_STATE_STOPPED | Video processing stopped.| - - -## Function Description - - -### OH_VideoProcessing_Create() - -``` -VideoProcessing_ErrorCode OH_VideoProcessing_Create (OH_VideoProcessing ** videoProcessor, int type ) -``` - -**Description** - -Creates a video processing instance. - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| videoProcessor | Double pointer to the video processing instance created. Before any input, **\*videoProcessor** must be a null pointer.| -| type | Video processing type. The processing type of an instance cannot be changed.| - -**Returns** - -Returns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): - -- **VIDEO_PROCESSING_SUCCESS** if the video processing instance is created successfully. - -- **VIDEO_PROCESSING_ERROR_UNSUPPORTED_PROCESSING** if the video processing type is not supported. - For example, if metadata generation is not supported, **VIDEO_PROCESSING_ERROR_UNSUPPORTED_PROCESSING** is returned. - -- **VIDEO_PROCESSING_ERROR_CREATE_FAILED** if the video processing instance fails to be created. - -- **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE** if the instance is null or the pointer to the instance is not null. - -- **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER** if the video processing type is invalid. - - -### OH_VideoProcessing_DeinitializeEnvironment() - -``` -VideoProcessing_ErrorCode OH_VideoProcessing_DeinitializeEnvironment (void ) -``` - -**Description** - -Releases the global video processing environment. - -Before calling this API, you must call [OH_VideoProcessing_InitializeEnvironment](#oh_videoprocessing_initializeenvironment) to initialize the environment. Generally, this function is called when the main process is about to exit. Do not call this function when a video processing instance is running. - -**Since**: 12 - -**Returns** - -Returns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): - -- **VIDEO_PROCESSING_SUCCESS** if the processing is successful. - -- **VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED** if a video processing instance is not destroyed or [OH_VideoProcessing_InitializeEnvironment](#oh_videoprocessing_initializeenvironment) is not called to initialize the environment. - - -### OH_VideoProcessing_Destroy() - -``` -VideoProcessing_ErrorCode OH_VideoProcessing_Destroy (OH_VideoProcessing * videoProcessor) -``` - -**Description** - -Destroys a video processing instance. - -Before destroying the instance, call [OH_VideoProcessing_Stop](#oh_videoprocessing_stop) to stop it. - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| videoProcessor | Pointer to the video processing instance. You are advised to set the pointer to a null pointer after the instance is destroyed.| - -**Returns** - -Returns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): - -- **VIDEO_PROCESSING_SUCCESS** if the instance is destroyed. - -- **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE** if the instance is null or is not a video processing instance. - -- **VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED** if the instance is still running. - - -### OH_VideoProcessing_GetParameter() - -``` -VideoProcessing_ErrorCode OH_VideoProcessing_GetParameter (OH_VideoProcessing * videoProcessor, OH_AVFormat * parameter ) -``` - -**Description** - -Obtains video processing parameters. - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| videoProcessor | Pointer to a video processing instance.| -| parameter | Pointer to a video processing parameter instance.| - -**Returns** - -Returns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): - -- **VIDEO_PROCESSING_SUCCESS** if the parameters are obtained. - -- **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE** if the instance is null or is not a video processing instance. - -- **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER** if the parameter is empty. - - -### OH_VideoProcessing_GetSurface() - -``` -VideoProcessing_ErrorCode OH_VideoProcessing_GetSurface (OH_VideoProcessing * videoProcessor, OHNativeWindow ** window ) -``` - -**Description** - -Obtains a surface for video processing. - -An input surface must be created before video processing starts, and it must be destroyed by calling [OH_NativeWindow_DestroyNativeWindow](../apis-arkgraphics2d/_native_window.md#oh_nativewindow_destroynativewindow) when it is no longer needed. - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| videoProcessor | Pointer to a video processing instance.| -| window | Double pointer to the input surface. For example, the input surface pointer can point to an output surface of the video decoder.| - -**Returns** - -Returns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): - -- **VIDEO_PROCESSING_SUCCESS** if the processing is successful. - -- **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE** if the instance is null or is not a video processing instance. - -- **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER** if the window is a null pointer or the pointer to the window is not null. - -- **VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED** if the surface fails to be created, an input surface has been created, or the video processing instance is running. - - -### OH_VideoProcessing_InitializeEnvironment() - -``` -VideoProcessing_ErrorCode OH_VideoProcessing_InitializeEnvironment (void ) -``` - -**Description** - -Initializes the global video processing environment. - -This function is optional. It is called only once when the main process is started to initialize the global video processing environment. This reduces the duration for running [OH_VideoProcessing_Create](#oh_videoprocessing_create). The global video processing environment must be released by calling [OH_VideoProcessing_DeinitializeEnvironment](#oh_videoprocessing_deinitializeenvironment). For details about how and when to release the environment, see [OH_VideoProcessing_DeinitializeEnvironment](#oh_videoprocessing_deinitializeenvironment). - -**Since**: 12 - -**Returns** - -Returns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): - -- **VIDEO_PROCESSING_SUCCESS** if the initialization is successful. -- **VIDEO_PROCESSING_ERROR_INITIALIZE_FAILED** if the initialization fails. - -If the operation fails, check whether the GPU works properly. - - -### OH_VideoProcessing_IsColorSpaceConversionSupported() - -``` -bool OH_VideoProcessing_IsColorSpaceConversionSupported (const VideoProcessing_ColorSpaceInfo * sourceVideoInfo, const VideoProcessing_ColorSpaceInfo * destinationVideoInfo ) -``` - -**Description** - -Checks whether color space conversion is supported during video processing. - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| sourceVideoInfo | Pointer to the color space information of the input video.| -| destinationVideoInfo | Pointer to the color space information of the output video.| - -**Returns** - -Returns **true** if color space conversion is supported; returns **false** otherwise. - - -### OH_VideoProcessing_IsMetadataGenerationSupported() - -``` -bool OH_VideoProcessing_IsMetadataGenerationSupported (const VideoProcessing_ColorSpaceInfo * sourceVideoInfo) -``` - -**Description** - -Checks whether metadata generation is supported during video processing. - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| sourceVideoInfo | Pointer to the color space information of the input video.| - -**Returns** - -Returns **true** if metadata generation is supported; returns **false** otherwise. - - -### OH_VideoProcessing_RegisterCallback() - -``` -VideoProcessing_ErrorCode OH_VideoProcessing_RegisterCallback (OH_VideoProcessing * videoProcessor, const VideoProcessing_Callback * callback, void * userData ) -``` - -**Description** - -Registers a callback for video processing. - -The callback function should be registered before video processing starts. During video processing, it cannot be registered. - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| videoProcessor | Pointer to a video processing instance.| -| callback | Pointer to the callback function.| -| userData | Pointer to user-defined data.| - -**Returns** - -Returns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): - -- **VIDEO_PROCESSING_SUCCESS** if the callback function is registered. - -- **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE** if the instance is null or is not a video processing instance. - -- **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER** if the callback function pointer is null. - -- **VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED** if the instance is still running. - - -### OH_VideoProcessing_RenderOutputBuffer() - -``` -VideoProcessing_ErrorCode OH_VideoProcessing_RenderOutputBuffer (OH_VideoProcessing * videoProcessor, uint32_t index ) -``` - -**Description** - -Renders and processes the buffer, and then outputs it. - -If the callback function [OH_VideoProcessingCallback_OnNewOutputBuffer](#oh_videoprocessingcallback_onnewoutputbuffer) is set, the buffer index is returned through the callback function after the output buffer is ready. - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| videoProcessor | Pointer to a video processing instance.| -| index | Index of the output buffer.| - -**Returns** - -Returns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): - -- **VIDEO_PROCESSING_SUCCESS** if the processing is successful. - -- **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE** if the instance is null or is not a video processing instance. - -- **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER** if the index is invalid. - -- **VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED** if the callback function [OH_VideoProcessingCallback_OnNewOutputBuffer](#oh_videoprocessingcallback_onnewoutputbuffer) is not set or the instance is stopped. - - -### OH_VideoProcessing_SetParameter() - -``` -VideoProcessing_ErrorCode OH_VideoProcessing_SetParameter (OH_VideoProcessing * videoProcessor, const OH_AVFormat * parameter ) -``` - -**Description** - -Sets video processing parameters. - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| videoProcessor | Pointer to a video processing instance.| -| parameter | Pointer to a video processing parameter instance.| - -**Returns** - -Returns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): - -- **VIDEO_PROCESSING_SUCCESS** if the parameters are successfully set. - -- **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE** if the instance is null or is not a video processing instance. - -- **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER** if the parameter is empty. - -- **VIDEO_PROCESSING_ERROR_INVALID_VALUE** if some attributes of a parameter are invalid, for example, unsupported parameter value. - -- **VIDEO_PROCESSING_ERROR_NO_MEMORY** if memory allocation fails. - - -### OH_VideoProcessing_SetSurface() - -``` -VideoProcessing_ErrorCode OH_VideoProcessing_SetSurface (OH_VideoProcessing * videoProcessor, const OHNativeWindow * window ) -``` - -**Description** - -Sets an output surface for video processing. - -An output surface must be set before video processing starts. - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| videoProcessor | Pointer to a video processing instance.| -| window | Pointer to the output surface.| - -**Returns** - -Returns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): - -- **VIDEO_PROCESSING_SUCCESS** if the output surface is successfully set. - -- **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE** if the instance is null or is not a video processing instance. - -- **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER** if the window is a null pointer. - - -### OH_VideoProcessing_Start() - -``` -VideoProcessing_ErrorCode OH_VideoProcessing_Start (OH_VideoProcessing * videoProcessor) -``` - -**Description** - -Starts video processing. - -After video processing starts, the callback [OH_VideoProcessingCallback_OnState](#oh_videoprocessingcallback_onstate) reports the **VIDEO_PROCESSING_STATE_RUNNING** state. For details, see [VideoProcessing_State](#videoprocessing_state). - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| videoProcessor | Pointer to a video processing instance.| - -**Returns** - -Returns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): - -- **VIDEO_PROCESSING_SUCCESS** if the processing is successful. - -- **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE** if the instance is null or is not a video processing instance. - -- **VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED** if no output surface is set, no input surface is created, or the instance is running. - - -### OH_VideoProcessing_Stop() - -``` -VideoProcessing_ErrorCode OH_VideoProcessing_Stop (OH_VideoProcessing * videoProcessor) -``` - -**Description** - -Stops video processing. - -After video processing stops, the callback [OH_VideoProcessingCallback_OnState](#oh_videoprocessingcallback_onstate) reports the **VIDEO_PROCESSING_STATE_STOPPED** state. For details, see [VideoProcessing_State](#videoprocessing_state). - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| videoProcessor | Pointer to a video processing instance.| - -**Returns** - -Returns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): - -- **VIDEO_PROCESSING_SUCCESS** if the processing is successful. - -- **VIDEO_PROCESSING_ERROR_INVALID_INSTANCE** if the instance is null or is not a video processing instance. - -- **VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED** if the instance is stopped. - - -### OH_VideoProcessingCallback_BindOnError() - -``` -VideoProcessing_ErrorCode OH_VideoProcessingCallback_BindOnError (VideoProcessing_Callback * callback, OH_VideoProcessingCallback_OnError onError ) -``` - -**Description** - -Binds the callback function [OH_VideoProcessingCallback_OnError](#oh_videoprocessingcallback_onerror) to a video processing callback object. - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| callback | Pointer to a callback object.| -| onError | Callback function to bind.| - -**Returns** - -Returns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): - -- **VIDEO_PROCESSING_SUCCESS** if the binding is successful. - -- **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER** if **callback** or **onError** is null. - - -### OH_VideoProcessingCallback_BindOnNewOutputBuffer() - -``` -VideoProcessing_ErrorCode OH_VideoProcessingCallback_BindOnNewOutputBuffer (VideoProcessing_Callback * callback, OH_VideoProcessingCallback_OnNewOutputBuffer onNewOutputBuffer ) -``` - -**Description** - -Binds the callback function [OH_VideoProcessingCallback_OnNewOutputBuffer](#oh_videoprocessingcallback_onnewoutputbuffer) to a video processing callback object. - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| callback | Pointer to a callback object.| -| onNewOutputBuffer | Callback function to bind.| - -**Returns** - -Returns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): - -- **VIDEO_PROCESSING_SUCCESS** if the binding is successful. - -- **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER** if **callback** is null. - - -### OH_VideoProcessingCallback_BindOnState() - -``` -VideoProcessing_ErrorCode OH_VideoProcessingCallback_BindOnState (VideoProcessing_Callback * callback, OH_VideoProcessingCallback_OnState onState ) -``` - -**Description** - -Binds the callback function [OH_VideoProcessingCallback_OnState](#oh_videoprocessingcallback_onstate) to a video processing callback object. - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| callback | Pointer to a callback object.| -| onState | Callback function to bind.| - -**Returns** - -Returns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): - -- **VIDEO_PROCESSING_SUCCESS** if the binding is successful. - -- **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER** if **callback** or **onState** is null. - - -### OH_VideoProcessingCallback_Create() - -``` -VideoProcessing_ErrorCode OH_VideoProcessingCallback_Create (VideoProcessing_Callback ** callback) -``` - -**Description** - -Creates a video processing callback object. - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| callback | Double pointer to the video processing callback object. Before creating a callback object, **\*callback** must be a null pointer.| - -**Returns** - -Returns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): - -- **VIDEO_PROCESSING_SUCCESS** if the callback object is created. - -- **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER** if **callback** is null or **\*callback** is not null. - -- **VIDEO_PROCESSING_ERROR_NO_MEMORY** if the memory is insufficient. - - -### OH_VideoProcessingCallback_Destroy() - -``` -VideoProcessing_ErrorCode OH_VideoProcessingCallback_Destroy (VideoProcessing_Callback * callback) -``` - -**Description** - -Destroys a video processing callback object. - -The video processing callback object can be destroyed after the callback function is registered. - -**Since**: 12 - -**Parameters** - -| Name| Description| -| -------- | -------- | -| callback | Pointer to the callback object. You are advised to set the pointer to a null pointer after the callback object is destroyed.| - -**Returns** - -Returns one of the following error codes defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1): - -- **VIDEO_PROCESSING_SUCCESS** if the callback object is destroyed. - -- **VIDEO_PROCESSING_ERROR_INVALID_PARAMETER** if **callback** is null. - - -## Variable Description - - -### VIDEO_DETAIL_ENHANCER_PARAMETER_KEY_QUALITY_LEVEL - -``` -const char* VIDEO_DETAIL_ENHANCER_PARAMETER_KEY_QUALITY_LEVEL -``` - -**Description** - -Pointer to the quality level of video detail enhancement. - -For details about the available options, see [VideoDetailEnhancer_QualityLevel](#videodetailenhancer_qualitylevel). You can call [OH_VideoProcessing_SetParameter](#oh_videoprocessing_setparameter) to set the quality level, and call [OH_VideoProcessing_GetParameter](#oh_videoprocessing_getparameter) to obtain the quality level. - -**Since**: 12 - - -### VIDEO_PROCESSING_TYPE_COLOR_SPACE_CONVERSION - -``` -const int32_t VIDEO_PROCESSING_TYPE_COLOR_SPACE_CONVERSION -``` - -**Description** - -Instance created for color space conversion during video processing. - -Call [OH_VideoProcessing_Create](#oh_videoprocessing_create) to create such an instance for color space conversion. If color space conversion is not supported, **VIDEO_PROCESSING_ERROR_UNSUPPORTED_PROCESSING** defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1) is returned. - -**Since**: 12 - - -### VIDEO_PROCESSING_TYPE_DETAIL_ENHANCER - -``` -const int32_t VIDEO_PROCESSING_TYPE_DETAIL_ENHANCER -``` - -**Description** - -Instance for detail enhancement during video processing. - -Call [OH_VideoProcessing_Create](#oh_videoprocessing_create) to create such an instance for detail enhancement. If detail enhancement is not supported, **VIDEO_PROCESSING_ERROR_UNSUPPORTED_PROCESSING** defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1) is returned. - -**Since**: 12 - - -### VIDEO_PROCESSING_TYPE_METADATA_GENERATION - -``` -const int32_t VIDEO_PROCESSING_TYPE_METADATA_GENERATION -``` - -**Description** - -Instance created for metadata generation during video processing. - -Call [OH_VideoProcessing_Create](#oh_videoprocessing_create) to create such an instance for metadata generation. If metadata generation is not supported, **VIDEO_PROCESSING_ERROR_UNSUPPORTED_PROCESSING** defined in [VideoProcessing_ErrorCode](#videoprocessing_errorcode-1) is returned. - -**Since**: 12 diff --git a/en/application-dev/reference/apis-media-kit/_video_processing___color_space_info.md b/en/application-dev/reference/apis-media-kit/_video_processing___color_space_info.md deleted file mode 100644 index ed0621bc3dc..00000000000 --- a/en/application-dev/reference/apis-media-kit/_video_processing___color_space_info.md +++ /dev/null @@ -1,62 +0,0 @@ -# VideoProcessing_ColorSpaceInfo - - -## Overview - -The VideoProcessing_ColorSpaceInfo struct describes the color space information of video processing. - -**See also**: [OH_VideoProcessing_IsColorSpaceConversionSupported](_video_processing.md#oh_videoprocessing_iscolorspaceconversionsupported) - -**Since**: 12 - -**Related module**: [VideoProcessing](_video_processing.md) - -**Header file**: [video_processing_types.h](video__processing__types_8h.md) - - -## Summary - - -### Member Variables - -| Name| Description| -| -------- | -------- | -| int32_t [metadataType](#metadatatype) | Video metadata type. For details, see [OH_NativeBuffer_MetadataType](../apis-arkgraphics2d/_o_h___native_buffer.md#oh_nativebuffer_metadatatype-1).| -| int32_t [colorSpace](#colorspace) | Video color space type. For details, see [OH_NativeBuffer_ColorSpace](../apis-arkgraphics2d/_o_h___native_buffer.md#oh_nativebuffer_colorspace-1).| -| int32_t [pixelFormat](#pixelformat) | Video pixel format. For details, see [OH_NativeBuffer_Format](../apis-arkgraphics2d/_o_h___native_buffer.md#oh_nativebuffer_format-1).| - - -## Member Variable Description - - -### colorSpace - -``` -int32_t VideoProcessing_ColorSpaceInfo::colorSpace -``` - -**Description** - -Video color space type. For details, see [OH_NativeBuffer_ColorSpace](../apis-arkgraphics2d/_o_h___native_buffer.md#oh_nativebuffer_colorspace-1). - - -### metadataType - -``` -int32_t VideoProcessing_ColorSpaceInfo::metadataType -``` - -**Description** - -Video metadata type. For details, see [OH_NativeBuffer_MetadataType](../apis-arkgraphics2d/_o_h___native_buffer.md#oh_nativebuffer_metadatatype-1). - - -### pixelFormat - -``` -int32_t VideoProcessing_ColorSpaceInfo::pixelFormat -``` - -**Description** - -Video pixel format. For details, see [OH_NativeBuffer_Format](../apis-arkgraphics2d/_o_h___native_buffer.md#oh_nativebuffer_format-1). diff --git a/en/application-dev/reference/apis-media-kit/avimage__generator_8h.md b/en/application-dev/reference/apis-media-kit/avimage__generator_8h.md deleted file mode 100644 index 28b48eeae6b..00000000000 --- a/en/application-dev/reference/apis-media-kit/avimage__generator_8h.md +++ /dev/null @@ -1,34 +0,0 @@ -# avimage_generator.h - - -## Overview - -The **avimage_generator.h** file declares the AVImageGenerator APIs. With these native APIs, you can extract video frames at given time points from videos. - -**System capability**: SystemCapability.Multimedia.Media.AVImageGenerator - -**Library**: libavimage_generator.so - -**Since**: 18 - -**Related module**: [AVImageGenerator](_a_v_image_generator.md) - - -## Summary - - -### Types - -| Name| Description| -| -------- | -------- | -| typedef struct [OH_AVImageGenerator](_a_v_image_generator.md#oh_avimagegenerator) [OH_AVImageGenerator](_a_v_image_generator.md#oh_avimagegenerator) | Defines a struct for the OH_AVImageGenerator. | - - -### Functions - -| Name| Description| -| -------- | -------- | -| [OH_AVImageGenerator](_a_v_image_generator.md#oh_avimagegenerator) \* [OH_AVImageGenerator_Create](_a_v_image_generator.md#oh_avimagegenerator_create) (void) | Creates an **OH_AVImageGenerator** instance. | -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVImageGenerator_SetFDSource](_a_v_image_generator.md#oh_avimagegenerator_setfdsource) ([OH_AVImageGenerator](_a_v_image_generator.md#oh_avimagegenerator) \*generator, int32_t fd, int64_t offset, int64_t size) | Sets a data source based on the media file descriptor. | -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVImageGenerator_FetchFrameByTime](_a_v_image_generator.md#oh_avimagegenerator_fetchframebytime) ([OH_AVImageGenerator](_a_v_image_generator.md#oh_avimagegenerator) \*generator, int64_t timeUs, [OH_AVImageGenerator_QueryOptions](_a_v_image_generator.md#oh_avimagegenerator_queryoptions) options, OH_PixelmapNative \*\*pixelMap) | Extracts a video frame at a given time from a video. | -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVImageGenerator_Release](_a_v_image_generator.md#oh_avimagegenerator_release) ([OH_AVImageGenerator](_a_v_image_generator.md#oh_avimagegenerator) \*generator) | Releases the resources used by the **OH_AVImageGenerator** instance and destroys the instance. | diff --git a/en/application-dev/reference/apis-media-kit/avimage__generator__base_8h.md b/en/application-dev/reference/apis-media-kit/avimage__generator__base_8h.md deleted file mode 100644 index e58fe748250..00000000000 --- a/en/application-dev/reference/apis-media-kit/avimage__generator__base_8h.md +++ /dev/null @@ -1,31 +0,0 @@ -# avimage_generator_base.h - - -## Overview - -The **avimage_generator_base.h** file declares the enums used by the AVImageGenerator. - -**System capability**: SystemCapability.Multimedia.Media.AVImageGenerator - -**Library**: libavimage_generator.so - -**Since**: 18 - -**Related module**: [AVImageGenerator](_a_v_image_generator.md) - - -## Summary - - -### Types - -| Name| Description| -| -------- | -------- | -| typedef enum [OH_AVImageGenerator_QueryOptions](_a_v_image_generator.md#oh_avimagegenerator_queryoptions) [OH_AVImageGenerator_QueryOptions](_a_v_image_generator.md#oh_avimagegenerator_queryoptions) | Defines an enum for the mappings between time points and video frames. | - - -### Enums - -| Name| Description| -| -------- | -------- | -| [OH_AVImageGenerator_QueryOptions](_a_v_image_generator.md#oh_avimagegenerator_queryoptions-1) {
OH_AVIMAGE_GENERATOR_QUERY_NEXT_SYNC = 0,
OH_AVIMAGE_GENERATOR_QUERY_PREVIOUS_SYNC = 1,
OH_AVIMAGE_GENERATOR_QUERY_CLOSEST_SYNC = 2,
OH_AVIMAGE_GENERATOR_QUERY_CLOSEST = 3 } | Enumerates the mappings between time points and video frames. | diff --git a/en/application-dev/reference/apis-media-kit/avmetadata__extractor_8h.md b/en/application-dev/reference/apis-media-kit/avmetadata__extractor_8h.md deleted file mode 100644 index a47d1e2d11a..00000000000 --- a/en/application-dev/reference/apis-media-kit/avmetadata__extractor_8h.md +++ /dev/null @@ -1,35 +0,0 @@ -# avmetadata_extractor.h - - -## Overview - -The **avmetadata_extractor.h** file declares the AVMetadataExtractor APIs. With these native APIs, you can obtain metadata from media assets. - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Library**: libavmetadata_extractor.so - -**Since**: 18 - -**Related module**: [AVMetadataExtractor](_a_v_metadata_extractor.md) - - -## Summary - - -### Types - -| Name| Description| -| -------- | -------- | -| typedef struct [OH_AVMetadataExtractor](_a_v_metadata_extractor.md#oh_avmetadataextractor) [OH_AVMetadataExtractor](_a_v_metadata_extractor.md#oh_avmetadataextractor) | Defines a struct for the OH_AVMetadataExtractor. | - - -### Functions - -| Name| Description| -| -------- | -------- | -| [OH_AVMetadataExtractor](_a_v_metadata_extractor.md#oh_avmetadataextractor) \* [OH_AVMetadataExtractor_Create](_a_v_metadata_extractor.md#oh_avmetadataextractor_create) (void) | Creates an **OH_AVMetadataExtractor** instance. | -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVMetadataExtractor_SetFDSource](_a_v_metadata_extractor.md#oh_avmetadataextractor_setfdsource) ([OH_AVMetadataExtractor](_a_v_metadata_extractor.md#oh_avmetadataextractor) \*extractor, int32_t fd, int64_t offset, int64_t size) | Sets a data source based on the media file descriptor. | -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVMetadataExtractor_FetchMetadata](_a_v_metadata_extractor.md#oh_avmetadataextractor_fetchmetadata) ([OH_AVMetadataExtractor](_a_v_metadata_extractor.md#oh_avmetadataextractor) \*extractor, OH_AVFormat \*avMetadata) | Obtains metadata from a media asset. This function must be called after [SetFDSource](_a_v_metadata_extractor.md#oh_avmetadataextractor_setfdsource).| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVMetadataExtractor_FetchAlbumCover](_a_v_metadata_extractor.md#oh_avmetadataextractor_fetchalbumcover) ([OH_AVMetadataExtractor](_a_v_metadata_extractor.md#oh_avmetadataextractor) \*extractor, OH_PixelmapNative \*\*pixelMap) | Obtains the cover of an audio album. This function must be called after [SetFDSource](_a_v_metadata_extractor.md#oh_avmetadataextractor_setfdsource).| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVMetadataExtractor_Release](_a_v_metadata_extractor.md#oh_avmetadataextractor_release) ([OH_AVMetadataExtractor](_a_v_metadata_extractor.md#oh_avmetadataextractor) \*extractor) | Releases the resources used by the **OH_AVMetadataExtractor** instance and destroys the instance. | diff --git a/en/application-dev/reference/apis-media-kit/avmetadata__extractor__base_8h.md b/en/application-dev/reference/apis-media-kit/avmetadata__extractor__base_8h.md deleted file mode 100644 index 7c4c4b5101f..00000000000 --- a/en/application-dev/reference/apis-media-kit/avmetadata__extractor__base_8h.md +++ /dev/null @@ -1,41 +0,0 @@ -# avmetadata_extractor_base.h - - -## Overview - -The **avmetadata_extractor_base.h** file declares the constants used by the AVMetadataExtractor. - -**System capability**: SystemCapability.Multimedia.Media.AVMetadataExtractor - -**Library**: libavmetadata_extractor.so - -**Since**: 18 - -**Related module**: [AVMetadataExtractor](_a_v_metadata_extractor.md) - - -### Variables - -| Name| Description| -| -------- | -------- | -| static const char\* [OH_AVMETADATA_EXTRACTOR_ALBUM](_a_v_metadata_extractor.md#oh_avmetadata_extractor_album) = "album" | Pointer to the key for obtaining the title of the album. The value type is const char\*. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_ALBUM_ARTIST](_a_v_metadata_extractor.md#oh_avmetadata_extractor_album_artist) = "albumArtist" | Pointer to the key for obtaining the artist of the album. The value type is const char\*. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_ARTIST](_a_v_metadata_extractor.md#oh_avmetadata_extractor_artist) = "artist" | Pointer to the key for obtaining the artist of the media asset. The value type is const char\*. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_AUTHOR](_a_v_metadata_extractor.md#oh_avmetadata_extractor_author) = "author" | Pointer to the key for obtaining the author of the media asset. The value type is const char\*. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_DATE_TIME](_a_v_metadata_extractor.md#oh_avmetadata_extractor_date_time) = "dateTime" | Pointer to the key for obtaining the creation time of the media asset. The value type is const char\*. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_DATE_TIME_FORMAT](_a_v_metadata_extractor.md#oh_avmetadata_extractor_date_time_format) = "dateTimeFormat" | Pointer to the key for obtaining the creation time of the media asset. The value type is const char\* and the output format is YYYY-MM-DD HH:mm:ss. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_COMPOSER](_a_v_metadata_extractor.md#oh_avmetadata_extractor_composer) = "composer" | Pointer to the key for obtaining the composer of the media asset. The value type is const char\*. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_DURATION](_a_v_metadata_extractor.md#oh_avmetadata_extractor_duration) = "duration" | Pointer to the key for obtaining the duration of the media asset, in ms. The value type is int64_t. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_GENRE](_a_v_metadata_extractor.md#oh_avmetadata_extractor_genre) = "genre" | Pointer to the key for obtaining the type or genre of the media asset. The value type is const char\*. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_HAS_AUDIO](_a_v_metadata_extractor.md#oh_avmetadata_extractor_has_audio) = "hasAudio" | Pointer to the key for obtaining the flag indicating whether the media asset contains audio. The value type is int32_t. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_HAS_VIDEO](_a_v_metadata_extractor.md#oh_avmetadata_extractor_has_video) = "hasVideo" | Pointer to the key for obtaining the flag indicating whether the media asset contains video. The value type is int32_t. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_MIME_TYPE](_a_v_metadata_extractor.md#oh_avmetadata_extractor_mime_type) = "mimeType" | Pointer to the key for obtaining the MIME type of the media asset. The value type is const char\*, for example, video/mp4, audio/mp4, and audio/amr wb. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_TRACK_COUNT](_a_v_metadata_extractor.md#oh_avmetadata_extractor_track_count) = "trackCount" | Pointer to the key for obtaining the number of tracks of the media asset. The value type is int32_t. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_SAMPLE_RATE](_a_v_metadata_extractor.md#oh_avmetadata_extractor_sample_rate) = "sampleRate" | Pointer to the key for obtaining the audio sampling rate, in Hz. The value type is int32_t. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_TITLE](_a_v_metadata_extractor.md#oh_avmetadata_extractor_title) = "title" | Pointer to the key for obtaining the title of the media asset. The value type is const char\*. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_VIDEO_HEIGHT](_a_v_metadata_extractor.md#oh_avmetadata_extractor_video_height) = "videoHeight" | Pointer to the key for obtaining the video height, in px. The value type is int32_t. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_VIDEO_WIDTH](_a_v_metadata_extractor.md#oh_avmetadata_extractor_video_width) = "videoWidth" | Pointer to the key for obtaining the video weight, in px. The value type is int32_t. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_VIDEO_ORIENTATION](_a_v_metadata_extractor.md#oh_avmetadata_extractor_video_orientation) = "videoOrientation" | Pointer to the key for obtaining the video rotation direction, in degrees (°). The value type is int32_t. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_VIDEO_IS_HDR_VIVID](_a_v_metadata_extractor.md#oh_avmetadata_extractor_video_is_hdr_vivid) = "hdrType" | Pointer to the key for obtaining the flag indicating whether the video is an HDR Vivid video. The value type is int32_t. For details, see the definition of [OH_Core_HdrType](../apis-avcodec-kit/_core.md#oh_core_hdrtype) in [media_types.h](../apis-avcodec-kit/media__types_8h.md). | -| static const char\* [OH_AVMETADATA_EXTRACTOR_LOCATION_LATITUDE](_a_v_metadata_extractor.md#oh_avmetadata_extractor_location_latitude) = "latitude" | Pointer to the key for obtaining the latitude in the geographical location. The value type is float. | -| static const char\* [OH_AVMETADATA_EXTRACTOR_LOCATION_LONGITUDE](_a_v_metadata_extractor.md#oh_avmetadata_extractor_location_longitude) = "longitude" | Pointer to the key for obtaining the longitude in the geographical location. The value type is float. | diff --git a/en/application-dev/reference/apis-media-kit/avplayer_8h.md b/en/application-dev/reference/apis-media-kit/avplayer_8h.md deleted file mode 100644 index 87d7ef4f74c..00000000000 --- a/en/application-dev/reference/apis-media-kit/avplayer_8h.md +++ /dev/null @@ -1,69 +0,0 @@ -# avplayer.h - - -## Overview - -The **avplayer.h** file declares the AVPlayer APIs. You can use the native AVPlayer APIs to play a media asset. - -**Library**: libavplayer.so - -**File to include**: - -**Since**: 11 - -**Related module**: [AVPlayer](_a_v_player.md) - - -## Summary - - -### Types - -| Name| Description| -| -------- | -------- | -| typedef struct [MediaKeySession](_a_v_player.md#mediakeysession) [MediaKeySession](_a_v_player.md#mediakeysession) | Defines a struct for the media key session. | -| typedef struct [DRM_MediaKeySystemInfo](_a_v_player.md#drm_mediakeysysteminfo) [DRM_MediaKeySystemInfo](_a_v_player.md#drm_mediakeysysteminfo) | Defines a struct for the media key system information. | -| typedef void(\* [Player_MediaKeySystemInfoCallback](_a_v_player.md#player_mediakeysysteminfocallback)) (OH_AVPlayer \*player, [DRM_MediaKeySystemInfo](_a_v_player.md#drm_mediakeysysteminfo) \*mediaKeySystemInfo) | Defines a callback invoked when media key system information of the AVPlayer is updated. | - - -### Functions - -| Name| Description| -| -------- | -------- | -| OH_AVPlayer \*[OH_AVPlayer_Create](_a_v_player.md#oh_avplayer_create) (void) | Creates an **OH_AVPlayer** instance.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetURLSource](_a_v_player.md#oh_avplayer_seturlsource) (OH_AVPlayer \*player, const char \*url) | Sets the HTTP URL of a media source to be played by an AVPlayer. | -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetFDSource](_a_v_player.md#oh_avplayer_setfdsource) (OH_AVPlayer \*player, int32_t fd, int64_t offset, int64_t size) | Sets the file descriptor of a media source to be played by an AVPlayer.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_Prepare](_a_v_player.md#oh_avplayer_prepare) (OH_AVPlayer \*player) | Prepares the playback environment and buffers media data.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_Play](_a_v_player.md#oh_avplayer_play) (OH_AVPlayer \*player) | Starts playback.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_Pause](_a_v_player.md#oh_avplayer_pause) (OH_AVPlayer \*player) | Pauses playback.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_Stop](_a_v_player.md#oh_avplayer_stop) (OH_AVPlayer \*player) | Stops playback.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_Reset](_a_v_player.md#oh_avplayer_reset) (OH_AVPlayer \*player) | Restores the AVPlayer to the initial state.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_Release](_a_v_player.md#oh_avplayer_release) (OH_AVPlayer \*player) | Asynchronously releases an **OH_AVPlayer** instance.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_ReleaseSync](_a_v_player.md#oh_avplayer_releasesync) (OH_AVPlayer \*player) | Synchronously releases an **OH_AVPlayer** instance.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetVolume](_a_v_player.md#oh_avplayer_setvolume) (OH_AVPlayer \*player, float leftVolume, float rightVolume) | Sets the volume for an AVPlayer.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_Seek](_a_v_player.md#oh_avplayer_seek) (OH_AVPlayer \*player, int32_t mSeconds, [AVPlayerSeekMode](_a_v_player.md#avplayerseekmode) mode) | Seeks to a playback position.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_GetCurrentTime](_a_v_player.md#oh_avplayer_getcurrenttime) (OH_AVPlayer \*player, int32_t \*currentTime) | Obtains the playback position, in milliseconds.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_GetVideoWidth](_a_v_player.md#oh_avplayer_getvideowidth) (OH_AVPlayer \*player, int32_t \*videoWidth) | Obtains the video width.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_GetVideoHeight](_a_v_player.md#oh_avplayer_getvideoheight) (OH_AVPlayer \*player, int32_t \*videoHeight) | Obtains the video height.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetPlaybackSpeed](_a_v_player.md#oh_avplayer_setplaybackspeed) (OH_AVPlayer \*player, [AVPlaybackSpeed](_a_v_player.md#avplaybackspeed) speed) | Sets the playback speed for an AVPlayer.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_GetPlaybackSpeed](_a_v_player.md#oh_avplayer_getplaybackspeed) (OH_AVPlayer \*player, [AVPlaybackSpeed](_a_v_player.md#avplaybackspeed) \*speed) | Obtains the playback speed of an AVPlayer.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetAudioRendererInfo](_a_v_player.md#oh_avplayer_setaudiorendererinfo) (OH_AVPlayer \*player, OH_AudioStream_Usage streamUsage) | Sets the audio stream type for an AVPlayer. | -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetVolumeMode](_a_v_player.md#oh_avplayer_setvolumemode) (OH_AVPlayer \*player, [OH_AudioStream_VolumeMode](../apis-audio-kit/_o_h_audio.md#oh_audiostream_volumemode) volumeMode) | Sets the audio volume mode for an AVPlayer.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetAudioInterruptMode](_a_v_player.md#oh_avplayer_setaudiointerruptmode) (OH_AVPlayer \*player, OH_AudioInterrupt_Mode interruptMode) | Sets the audio interruption mode for an AVPlayer. | -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetAudioEffectMode](_a_v_player.md#oh_avplayer_setaudioeffectmode) (OH_AVPlayer \*player, OH_AudioStream_AudioEffectMode effectMode) | Sets the audio effect mode for an AVPlayer. | -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SelectBitRate](_a_v_player.md#oh_avplayer_selectbitrate) (OH_AVPlayer \*player, uint32_t bitRate) | Sets the bit rate used by an HLS player.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetVideoSurface](_a_v_player.md#oh_avplayer_setvideosurface) (OH_AVPlayer \*player, OHNativeWindow \*window) | Sets a playback window.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_GetDuration](_a_v_player.md#oh_avplayer_getduration) (OH_AVPlayer \*player, int32_t \*duration) | Obtains the total duration of a media file, in milliseconds.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_GetState](_a_v_player.md#oh_avplayer_getstate) (OH_AVPlayer \*player, [AVPlayerState](_a_v_player.md#avplayerstate) \*state) | Obtains the AVPlayer state.| -| bool [OH_AVPlayer_IsPlaying](_a_v_player.md#oh_avplayer_isplaying) (OH_AVPlayer \*player) | Checks whether an AVPlayer is playing.| -| bool [OH_AVPlayer_IsLooping](_a_v_player.md#oh_avplayer_islooping) (OH_AVPlayer \*player) | Checks whether an AVPlayer is looping.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetLooping](_a_v_player.md#oh_avplayer_setlooping) (OH_AVPlayer \*player, bool loop) | Enables loop playback.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetPlayerCallback](_a_v_player.md#oh_avplayer_setplayercallback) (OH_AVPlayer \*player, [AVPlayerCallback](_a_v_player_callback.md) callback) | Sets a callback for an AVPlayer.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SelectTrack](_a_v_player.md#oh_avplayer_selecttrack) (OH_AVPlayer \*player, int32_t index) | Selects an audio or subtitle track.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_DeselectTrack](_a_v_player.md#oh_avplayer_deselecttrack) (OH_AVPlayer \*player, int32_t index) | Deselects an audio or subtitle track.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_GetCurrentTrack](_a_v_player.md#oh_avplayer_getcurrenttrack) (OH_AVPlayer \*player, int32_t trackType, int32_t \*index) | Obtains the currently valid track.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetMediaKeySystemInfoCallback](_a_v_player.md#oh_avplayer_setmediakeysysteminfocallback) (OH_AVPlayer \*player, Player_MediaKeySystemInfoCallback callback) | Sets a callback to return the media key system information for an AVPlayer. | -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_GetMediaKeySystemInfo](_a_v_player.md#oh_avplayer_getmediakeysysteminfo) (OH_AVPlayer \*player, [DRM_MediaKeySystemInfo](../apis-drm-kit/_d_r_m___media_key_system_info.md) \*mediaKeySystemInfo) | Obtains the media key system information to create a media key session. | -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetDecryptionConfig](_a_v_player.md#oh_avplayer_setdecryptionconfig) (OH_AVPlayer \*player, [MediaKeySession](../apis-drm-kit/_drm.md#mediakeysession) \*mediaKeySession, bool secureVideoPath) | Sets the decryption information. | -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetOnInfoCallback](_a_v_player.md#oh_avplayer_setoninfocallback) (OH_AVPlayer \*player, [OH_AVPlayerOnInfoCallback](_a_v_player.md#oh_avplayeroninfocallback) callback, void \*userData) | Sets a callback for the event indicating that the AVPlayer receives a message. | -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVPlayer_SetOnErrorCallback](_a_v_player.md#oh_avplayer_setonerrorcallback) (OH_AVPlayer \*player, [OH_AVPlayerOnErrorCallback](_a_v_player.md#oh_avplayeronerrorcallback) callback, void \*userData) | Sets a callback for the event indicating that an error occurs in the AVPlayer. | diff --git a/en/application-dev/reference/apis-media-kit/avplayer__base_8h.md b/en/application-dev/reference/apis-media-kit/avplayer__base_8h.md deleted file mode 100644 index cf24c976c0b..00000000000 --- a/en/application-dev/reference/apis-media-kit/avplayer__base_8h.md +++ /dev/null @@ -1,76 +0,0 @@ -# avplayer_base.h - - -## Overview - -The **avplayer_base.h** file declares the structs and enums of the AVPlayer. - -**Library**: libavplayer.so - -**File to include**: - -**Since**: 11 - -**Related module**: [AVPlayer](_a_v_player.md) - - -## Summary - - -### Structs - -| Name| Description| -| -------- | -------- | -| struct [AVPlayerCallback](_a_v_player_callback.md) | (Deprecated) Contains the set of the **OH_AVPlayerOnInfo** and **OH_AVPlayerOnInfo** callback function pointers. To ensure the normal running of **OH_AVPlayer**, you must register the instance of this struct with the **OH_AVPlayer** instance and process the information reported by the callback functions. | - - -### Types - -| Name| Description| -| -------- | -------- | -| typedef enum [AVPlayerState](_a_v_player.md#avplayerstate-1) [AVPlayerState](_a_v_player.md#avplayerstate) | Defines an enum for the AVPlayer states. | -| typedef enum [AVPlayerSeekMode](_a_v_player.md#avplayerseekmode-1) [AVPlayerSeekMode](_a_v_player.md#avplayerseekmode) | Defines an enum for the seek modes of the AVPlayer. | -| typedef enum [AVPlaybackSpeed](_a_v_player.md#avplaybackspeed-1) [AVPlaybackSpeed](_a_v_player.md#avplaybackspeed) | Defines an enum for the playback speeds of the AVPlayer. | -| typedef enum [AVPlayerOnInfoType](_a_v_player.md#avplayeroninfotype-1) [AVPlayerOnInfoType](_a_v_player.md#avplayeroninfotype) | Defines an enum for the types of messages received by the AVPlayer. | -| typedef enum [AVPlayerBufferingType](_a_v_player.md#avplayerbufferingtype-1) [AVPlayerBufferingType](_a_v_player.md#avplayerbufferingtype) | Defines the types of buffer messages of the AVPlayer. | -| typedef void(\* [OH_AVPlayerOnInfo](_a_v_player.md#oh_avplayeroninfo)) (OH_AVPlayer \*player, [AVPlayerOnInfoType](_a_v_player.md#avplayeroninfotype) type, int32_t extra) | (Deprecated) Defines the callback invoked when the AVPlayer receives a message. | -| typedef void(\* [OH_AVPlayerOnInfoCallback](_a_v_player.md#oh_avplayeroninfocallback)) (OH_AVPlayer \*player, [AVPlayerOnInfoType](_a_v_player.md#avplayeroninfotype) type, OH_AVFormat \*infoBody, void \*userData) | Defines the callback invoked when the AVPlayer receives a message. If this callback is successfully set, the **OH_AVPlayerOnInfo** function will not be invoked. | -| typedef void(\* [OH_AVPlayerOnError](_a_v_player.md#oh_avplayeronerror)) (OH_AVPlayer \*player, int32_t errorCode, const char \*errorMsg) | (Deprecated) Defines the callback invoked when an error occurs in the AVPlayer. This type is available in API version 9 or later. | -| typedef void(\* [OH_AVPlayerOnErrorCallback](_a_v_player.md#oh_avplayeronerrorcallback)) (OH_AVPlayer \*player, int32_t errorCode, const char \*errorMsg, void \*userData) | Defines the callback invoked when an error occurs in the AVPlayer. If this callback is successfully set, the **OH_AVPlayerOnError** function will not be invoked. | -| typedef struct [AVPlayerCallback](_a_v_player_callback.md) [AVPlayerCallback](_a_v_player.md#avplayercallback) | Defines all the callback function pointers of an **OH_AVPlayer** instance. | - - -### Enums - -| Name| Description| -| -------- | -------- | -| [AVPlayerState](_a_v_player.md#avplayerstate-1) {
AV_IDLE = 0,
AV_INITIALIZED = 1,
AV_PREPARED = 2,
AV_PLAYING = 3,
AV_PAUSED = 4,
AV_STOPPED = 5,
AV_COMPLETED = 6,
AV_RELEASED = 7,
AV_ERROR = 8
} | Enumerates the AVPlayer states.| -| [AVPlayerSeekMode](_a_v_player.md#avplayerseekmode) {
AV_SEEK_NEXT_SYNC = 0,
AV_SEEK_PREVIOUS_SYNC,
AV_SEEK_CLOSEST = 2
} | Enumerates the seek modes of the AVPlayer.| -| [AVPlaybackSpeed](_a_v_player.md#avplaybackspeed-1) {
AV_SPEED_FORWARD_0_75_X,
AV_SPEED_FORWARD_1_00_X,
AV_SPEED_FORWARD_1_25_X,
AV_SPEED_FORWARD_1_75_X,
AV_SPEED_FORWARD_2_00_X,
AV_SPEED_FORWARD_0_50_X,
AV_SPEED_FORWARD_1_50_X
} | Enumerates the playback speeds of the AVPlayer. | -| [AVPlayerOnInfoType](_a_v_player.md#avplayeroninfotype-1) {
AV_INFO_TYPE_SEEKDONE = 0,
AV_INFO_TYPE_SPEEDDONE = 1,
AV_INFO_TYPE_BITRATEDONE = 2,
AV_INFO_TYPE_EOS = 3,
AV_INFO_TYPE_STATE_CHANGE = 4,
AV_INFO_TYPE_POSITION_UPDATE = 5,
AV_INFO_TYPE_MESSAGE = 6,
AV_INFO_TYPE_VOLUME_CHANGE = 7,
AV_INFO_TYPE_RESOLUTION_CHANGE = 8,
AV_INFO_TYPE_BUFFERING_UPDATE = 9,
AV_INFO_TYPE_BITRATE_COLLECT = 10,
AV_INFO_TYPE_INTERRUPT_EVENT = 11,
AV_INFO_TYPE_DURATION_UPDATE = 12,
AV_INFO_TYPE_IS_LIVE_STREAM = 13,
AV_INFO_TYPE_TRACKCHANGE = 14,
AV_INFO_TYPE_TRACK_INFO_UPDATE = 15,
AV_INFO_TYPE_SUBTITLE_UPDATE = 16, AV_INFO_TYPE_AUDIO_OUTPUT_DEVICE_CHANGE = 17
} | Enumerates the types of messages received by the AVPlayer.| -| [AVPlayerBufferingType](_a_v_player.md#avplayerbufferingtype-1) {
AVPLAYER_BUFFERING_START = 1,
AVPLAYER_BUFFERING_END,
AVPLAYER_BUFFERING_PERCENT,
AVPLAYER_BUFFERING_CACHED_DURATION
} | Enumerates the types of buffer messages of the AVPlayer. | - - -### Variables - -| Name| Description| -| -------- | -------- | -| const char \* [OH_PLAYER_STATE](_a_v_player.md#oh_player_state) | Pointer to the key for obtaining the AVPlayer state. The value is of the int32_t type. | -| const char \* [OH_PLAYER_STATE_CHANGE_REASON](_a_v_player.md#oh_player_state_change_reason) | Pointer to the key for obtaining the AVPlayer state change reason. The value is of the int32_t type. | -| const char \* [OH_PLAYER_VOLUME](_a_v_player.md#oh_player_volume) | Pointer to the key for obtaining the volume. The value type is float. | -| const char \* [OH_PLAYER_BITRATE_ARRAY](_a_v_player.md#oh_player_bitrate_array) | Pointer to the key for obtaining the bit rate array. The value is of the uint8_t byte array type, which is expressed by [AV_INFO_TYPE_BITRATE_COLLECT](_a_v_player.md#avplayeroninfotype-1). | -| const char \* [OH_PLAYER_AUDIO_INTERRUPT_TYPE](_a_v_player.md#oh_player_audio_interrupt_type) | Pointer to the key for obtaining the audio interruption type. The value is of the int32_t type. | -| const char \* [OH_PLAYER_AUDIO_INTERRUPT_FORCE](_a_v_player.md#oh_player_audio_interrupt_force) | Pointer to the key for obtaining the FORCE type of audio interruption. The value is of the int32_t type. | -| const char \* [OH_PLAYER_AUDIO_INTERRUPT_HINT](_a_v_player.md#oh_player_audio_interrupt_hint) | Pointer to the key for obtaining the HINT type of audio interruption. The value is of the int32_t type. | -| const char \* [OH_PLAYER_AUDIO_DEVICE_CHANGE_REASON](_a_v_player.md#oh_player_audio_device_change_reason) | Pointer to the key for obtaining the audio device change reason. The value is of the int32_t type. | -| const char \* [OH_PLAYER_BUFFERING_TYPE](_a_v_player.md#oh_player_buffering_type) | Pointer to the key for obtaining the type of the buffer update message. The value type is **AVPlayerBufferingType**. | -| const char \* [OH_PLAYER_BUFFERING_VALUE](_a_v_player.md#oh_player_buffering_value) | Pointer to the key for obtaining the value of the buffer update message. The value is of the int32_t type. | -| const char \* [OH_PLAYER_SEEK_POSITION](_a_v_player.md#oh_player_seek_position) | Pointer to the key for obtaining the playback progress after the seek operation. The value is of the int32_t type. | -| const char \* [OH_PLAYER_PLAYBACK_SPEED](_a_v_player.md#oh_player_playback_speed) | Pointer to the key for obtaining the playback speed. The value type is **AVPlaybackSpeed**. | -| const char \* [OH_PLAYER_BITRATE](_a_v_player.md#oh_player_bitrate) | Pointer to the key for obtaining the bit rate. The value is of the int32_t type. | -| const char \* [OH_PLAYER_CURRENT_POSITION](_a_v_player.md#oh_player_current_position) | Pointer to the key for obtaining the playback progress information. The value is of the int32_t type. | -| const char \* [OH_PLAYER_DURATION](_a_v_player.md#oh_player_duration) | Pointer to the key for obtaining the media asset duration. The value type is int64_t. | -| const char \* [OH_PLAYER_VIDEO_WIDTH](_a_v_player.md#oh_player_video_width) | Pointer to the key for obtaining the video width. The value is of the int32_t type. | -| const char \* [OH_PLAYER_VIDEO_HEIGHT](_a_v_player.md#oh_player_video_height) | Pointer to the key for obtaining the video height. The value is of the int32_t type. | -| const char \* [OH_PLAYER_MESSAGE_TYPE](_a_v_player.md#oh_player_message_type) | Pointer to the key for obtaining the type of message received by the AVPlayer. The value is of the int32_t type. | -| const char \* [OH_PLAYER_IS_LIVE_STREAM](_a_v_player.md#oh_player_is_live_stream) | Pointer to the key for checking whether a media asset is live TV. The value is of the int32_t type. | diff --git a/en/application-dev/reference/apis-media-kit/avrecorder_8h.md b/en/application-dev/reference/apis-media-kit/avrecorder_8h.md deleted file mode 100644 index 6df0ab26c0e..00000000000 --- a/en/application-dev/reference/apis-media-kit/avrecorder_8h.md +++ /dev/null @@ -1,40 +0,0 @@ -# avrecorder.h - - -## Overview - -The **avrecorder.h** file declares the AVRecorder APIs. Applications can use the APIs to record media data. - -**Library**: libavrecorder.so - -**File to include**: <multimedia/player_framework/avrecorder.h> - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -**Related module**: [AVRecorder](_a_v_recorder.md) - - -## Summary - - -### Functions - -| Name| Description| -| -------- | -------- | -| [OH_AVRecorder](_a_v_recorder.md#oh_avrecorder) \* [OH_AVRecorder_Create](_a_v_recorder.md#oh_avrecorder_create) (void) | Creates an AVRecorder instance. After this function is successfully called, the AVRecorder transitions to the AVRECORDER_IDLE state.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVRecorder_Prepare](_a_v_recorder.md#oh_avrecorder_prepare) ([OH_AVRecorder](_a_v_recorder.md#oh_avrecorder) \*recorder, [OH_AVRecorder_Config](_o_h___a_v_recorder___config.md) \*config) | Sets AVRecorder parameters to prepare for recording. This function must be called after [OH_AVRecorder_Start](_a_v_recorder.md#oh_avrecorder_start) is successfully triggered. After this function is successfully called, the AVRecorder transitions to the AVRECORDER_PREPARED state.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVRecorder_GetAVRecorderConfig](_a_v_recorder.md#oh_avrecorder_getavrecorderconfig) ([OH_AVRecorder](_a_v_recorder.md#oh_avrecorder) \*recorder, [OH_AVRecorder_Config](_o_h___a_v_recorder___config.md) \*\*config) | Obtains the AVRecorder configuration. This function must be called after the recording preparation is complete. **config** must be set to a null pointer. The framework layer allocates and releases the memory in a unified manner to avoid issues with memory management, such as leaks or double freeing.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVRecorder_GetInputSurface](_a_v_recorder.md#oh_avrecorder_getinputsurface) ([OH_AVRecorder](_a_v_recorder.md#oh_avrecorder) \*recorder, OHNativeWindow \*\*window) | Obtains an input surface. This function must be called after [OH_AVRecorder_Prepare](_a_v_recorder.md#oh_avrecorder_prepare) is successfully triggered and before [OH_AVRecorder_Start](_a_v_recorder.md#oh_avrecorder_start) is called.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVRecorder_UpdateRotation](_a_v_recorder.md#oh_avrecorder_updaterotation) ([OH_AVRecorder](_a_v_recorder.md#oh_avrecorder) \*recorder, int32_t rotation) | Updates the video rotation angle. This function must be called after [OH_AVRecorder_Prepare](_a_v_recorder.md#oh_avrecorder_prepare) is successfully triggered and before [OH_AVRecorder_Start](_a_v_recorder.md#oh_avrecorder_start) is called.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVRecorder_Start](_a_v_recorder.md#oh_avrecorder_start) ([OH_AVRecorder](_a_v_recorder.md#oh_avrecorder) \*recorder) | Starts recording. This function must be called after [OH_AVRecorder_Prepare](_a_v_recorder.md#oh_avrecorder_prepare) is successfully triggered. After this function is successfully called, the AVRecorder transitions to the AVRECORDER_STARTED state.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVRecorder_Pause](_a_v_recorder.md#oh_avrecorder_pause) ([OH_AVRecorder](_a_v_recorder.md#oh_avrecorder) \*recorder) | Pauses recording. This function must be called after [OH_AVRecorder_Start](_a_v_recorder.md#oh_avrecorder_start) is successfully triggered and the AVRecorder is in the AVRECORDER_STARTED state. After this function is successfully called, the AVRecorder transitions to the AVRECORDER_PAUSED state.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVRecorder_Resume](_a_v_recorder.md#oh_avrecorder_resume) ([OH_AVRecorder](_a_v_recorder.md#oh_avrecorder) \*recorder) | Resumes recording. This function must be called after [OH_AVRecorder_Pause](_a_v_recorder.md#oh_avrecorder_pause) is successfully triggered and the AVRecorder is in the AVRECORDER_PAUSED state. After this function is successfully called, the AVRecorder transitions to the AVRECORDER_STARTED state.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVRecorder_Stop](_a_v_recorder.md#oh_avrecorder_stop) ([OH_AVRecorder](_a_v_recorder.md#oh_avrecorder) \*recorder) | Stops recording. This function must be called after [OH_AVRecorder_Start](_a_v_recorder.md#oh_avrecorder_start) is successfully triggered. After this function is successfully called, the AVRecorder transitions to the AVRECORDER_STOPPED state.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVRecorder_Reset](_a_v_recorder.md#oh_avrecorder_reset) ([OH_AVRecorder](_a_v_recorder.md#oh_avrecorder) \*recorder) | Resets the recording state. This function must be called when the AVRecorder is not in the AVRECORDER_RELEASED state. After this function is successfully called, the AVRecorder transitions to the AVRECORDER_IDLE state.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVRecorder_Release](_a_v_recorder.md#oh_avrecorder_release) ([OH_AVRecorder](_a_v_recorder.md#oh_avrecorder) \*recorder) | Releases recording resources. After this API is successfully called, the AVRecorder transitions to the AVRECORDER_RELEASED state. The recorder memory will be released. The application layer must explicitly set the recorder to a null pointer to avoid access to wild pointers.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVRecorder_GetAvailableEncoder](_a_v_recorder.md#oh_avrecorder_getavailableencoder) ([OH_AVRecorder](_a_v_recorder.md#oh_avrecorder) \*recorder, [OH_AVRecorder_EncoderInfo](_o_h___a_v_recorder___encoder_info.md) \*\*info, int32_t \*length) | Obtains the available encoders and encoder information of the AVRecorder. **info** must be set to a null pointer. The framework layer allocates and releases the memory in a unified manner to avoid issues with memory management, such as leaks or double freeing.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVRecorder_SetStateCallback](_a_v_recorder.md#oh_avrecorder_setstatecallback) ([OH_AVRecorder](_a_v_recorder.md#oh_avrecorder) \*recorder, [OH_AVRecorder_OnStateChange](_a_v_recorder.md#oh_avrecorder_onstatechange) callback, void \*userData) | Sets a state callback so that the application can respond to state change events generated by the AVRecorder. This function must be called before [OH_AVRecorder_Start](_a_v_recorder.md#oh_avrecorder_start) is called.| -| [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode) [OH_AVRecorder_SetErrorCallback](_a_v_recorder.md#oh_avrecorder_seterrorcallback) ([OH_AVRecorder](_a_v_recorder.md#oh_avrecorder) \*recorder, [OH_AVRecorder_OnError](_a_v_recorder.md#oh_avrecorder_onerror) callback, void \*userData) | Sets an error callback so that the application can respond to error events generated by the AVRecorder. This function must be called before [OH_AVRecorder_Start](_a_v_recorder.md#oh_avrecorder_start) is called.| -| OH_AVE[OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode)rrCode [OH_AVRecorder_SetUriCallback](_a_v_recorder.md#oh_avrecorder_seturicallback) ([OH_AVRecorder](_a_v_recorder.md#oh_avrecorder) \*recorder, [OH_AVRecorder_OnUri](_a_v_recorder.md#oh_avrecorder_onuri) callback, void \*userData) | Sets a URI callback so that the application can respond to URI events generated by the AVRecorder. This function must be called before [OH_AVRecorder_Start](_a_v_recorder.md#oh_avrecorder_start) is called.| diff --git a/en/application-dev/reference/apis-media-kit/avrecorder__base_8h.md b/en/application-dev/reference/apis-media-kit/avrecorder__base_8h.md deleted file mode 100644 index cdd55fd1f36..00000000000 --- a/en/application-dev/reference/apis-media-kit/avrecorder__base_8h.md +++ /dev/null @@ -1,69 +0,0 @@ -# avrecorder_base.h - - -## Overview - -The **avrecorder_base.h** file declares the struct and enums used by the AVRecorder. - -**Library**: libavrecorder.so - -**File to include**: <multimedia/player_framework/avrecorder_base.h> - -**System capability**: SystemCapability.Multimedia.Media.AVRecorder - -**Since**: 18 - -**Related module**: [AVRecorder](_a_v_recorder.md) - - -## Summary - - -### Structs - -| Name| Description| -| -------- | -------- | -| struct  [OH_AVRecorder_Profile](_o_h___a_v_recorder___profile.md) | Describes the parameters used for audio and video recording.
You can choose to record only audio or only video by setting the parameters. When **audioBitrate** or **audioChannels** is set to 0, audio recording is disabled. When **videoFrameWidth** or **videoFrameHeight** is set to 0, video recording is disabled.| -| struct  [OH_AVRecorder_Location](_o_h___a_v_recorder___location.md) | Describes the geographical location information about a media asset.| -| struct  [OH_AVRecorder_MetadataTemplate](_o_h___a_v_recorder___metadata_template.md) | Describes the basic template of metadata.| -| struct  [OH_AVRecorder_Metadata](_o_h___a_v_recorder___metadata.md) | Describes the metadata.| -| struct  [OH_AVRecorder_Config](_o_h___a_v_recorder___config.md) | Describes the AVRecorder configuration.| -| struct  [OH_AVRecorder_Range](_o_h___a_v_recorder___range.md) | Describes the range.| -| struct  [OH_AVRecorder_EncoderInfo](_o_h___a_v_recorder___encoder_info.md) | Describes the encoder information.| - - -### Types - -| Name| Description| -| -------- | -------- | -| typedef struct [OH_AVRecorder](_a_v_recorder.md#oh_avrecorder) [OH_AVRecorder](_a_v_recorder.md#oh_avrecorder) | Defines a struct for the AVRecorder.| -| typedef enum [OH_AVRecorder_AudioSourceType](_a_v_recorder.md#oh_avrecorder_audiosourcetype-1) [OH_AVRecorder_AudioSourceType](_a_v_recorder.md#oh_avrecorder_audiosourcetype) | Defines an enum for the audio source types of the AVRecorder.| -| typedef enum [OH_AVRecorder_VideoSourceType](_a_v_recorder.md#oh_avrecorder_videosourcetype-1) [OH_AVRecorder_VideoSourceType](_a_v_recorder.md#oh_avrecorder_videosourcetype) | Defines an enum for the video source types of the AVRecorder.| -| typedef enum [OH_AVRecorder_CodecMimeType](_a_v_recorder.md#oh_avrecorder_codecmimetype-1) [OH_AVRecorder_CodecMimeType](_a_v_recorder.md#oh_avrecorder_codecmimetype) | Defines an enum for the MIME types of the encoder.| -| typedef enum [OH_AVRecorder_ContainerFormatType](_a_v_recorder.md#oh_avrecorder_containerformattype-1) [OH_AVRecorder_ContainerFormatType](_a_v_recorder.md#oh_avrecorder_containerformattype) | Defines an enum for the Container Format Types (CFTs).| -| typedef enum [OH_AVRecorder_State](_a_v_recorder.md#oh_avrecorder_state-1) [OH_AVRecorder_State](_a_v_recorder.md#oh_avrecorder_state) | Defines an enum for the AVRecorder states.| -| typedef enum [OH_AVRecorder_StateChangeReason](_a_v_recorder.md#oh_avrecorder_statechangereason-1) [OH_AVRecorder_StateChangeReason](_a_v_recorder.md#oh_avrecorder_statechangereason) | Defines an enum for the reasons for AVRecorder state changes.| -| typedef enum [OH_AVRecorder_FileGenerationMode](_a_v_recorder.md#oh_avrecorder_filegenerationmode-1) [OH_AVRecorder_FileGenerationMode](_a_v_recorder.md#oh_avrecorder_filegenerationmode) | Defines an enum for the modes available for creating a recording file.| -| typedef struct [OH_AVRecorder_Profile](_o_h___a_v_recorder___profile.md) [OH_AVRecorder_Profile](_a_v_recorder.md#oh_avrecorder_profile) | Defines a struct for the parameters used for audio and video recording.
You can choose to record only audio or only video by setting the parameters. When **audioBitrate** or **audioChannels** is set to 0, audio recording is disabled. When **videoFrameWidth** or **videoFrameHeight** is set to 0, video recording is disabled.| -| typedef struct [OH_AVRecorder_Location](_o_h___a_v_recorder___location.md) [OH_AVRecorder_Location](_a_v_recorder.md#oh_avrecorder_location) | Defines a struct for the geographical location information about a media asset.| -| typedef struct [OH_AVRecorder_MetadataTemplate](_o_h___a_v_recorder___metadata_template.md) [OH_AVRecorder_MetadataTemplate](_a_v_recorder.md#oh_avrecorder_metadatatemplate) | Defines a struct for the basic template of metadata.| -| typedef struct [OH_AVRecorder_Metadata](_o_h___a_v_recorder___metadata.md) [OH_AVRecorder_Metadata](_a_v_recorder.md#oh_avrecorder_metadata) | Defines a struct for the metadata.| -| typedef struct [OH_AVRecorder_Config](_o_h___a_v_recorder___config.md) [OH_AVRecorder_Config](_a_v_recorder.md#oh_avrecorder_config) | Defines a struct for the AVRecorder configuration.| -| typedef struct [OH_AVRecorder_Range](_o_h___a_v_recorder___range.md) [OH_AVRecorder_Range](_a_v_recorder.md#oh_avrecorder_range) | Defines a struct for the range.| -| typedef struct [OH_AVRecorder_EncoderInfo](_o_h___a_v_recorder___encoder_info.md) [OH_AVRecorder_EncoderInfo](_a_v_recorder.md#oh_avrecorder_encoderinfo) | Defines a struct for the encoder information.| -| typedef void(\* [OH_AVRecorder_OnStateChange](_a_v_recorder.md#oh_avrecorder_onstatechange)) ([OH_AVRecorder](_a_v_recorder.md#oh_avrecorder) \*recorder, [OH_AVRecorder_State](_a_v_recorder.md#oh_avrecorder_state) state, [OH_AVRecorder_StateChangeReason](_a_v_recorder.md#oh_avrecorder_statechangereason) reason, void \*userData) | Defines a callback invoked when the AVRecorder state changes.| -| typedef void(\* [OH_AVRecorder_OnError](_a_v_recorder.md#oh_avrecorder_onerror)) ([OH_AVRecorder](_a_v_recorder.md#oh_avrecorder) \*recorder, int32_t errorCode, const char \*errorMsg, void \*userData) | Defines a callback invoked when an error occurs during recording.| -| typedef void(\* [OH_AVRecorder_OnUri](_a_v_recorder.md#oh_avrecorder_onuri)) ([OH_AVRecorder](_a_v_recorder.md#oh_avrecorder) \*recorder, [OH_MediaAsset](../apis-media-library-kit/_media_asset_manager.md#oh_mediaasset) \*asset, void \*userData) | Defines a callback invoked when the recording is in OH_AVRecorder_FileGenerationMode.AVRECORDER_AUTO_CREATE_CAMERA_SCENE mode.| - - -### Enums - -| Name| Description| -| -------- | -------- | -| [OH_AVRecorder_AudioSourceType](_a_v_recorder.md#oh_avrecorder_audiosourcetype-1) {
AVRECORDER_DEFAULT = 0,
AVRECORDER_MIC = 1,
AVRECORDER_VOICE_RECOGNITION = 2,
AVRECORDER_VOICE_COMMUNICATION = 7,
AVRECORDER_VOICE_MESSAGE = 10,
AVRECORDER_CAMCORDER = 13
} | Enumerates the audio source types of the AVRecorder.| -| [OH_AVRecorder_VideoSourceType](_a_v_recorder.md#oh_avrecorder_videosourcetype-1) {
AVRECORDER_SURFACE_YUV = 0,
AVRECORDER_SURFACE_ES = 1
} | Enumerates the video source types of the AVRecorder.| -| [OH_AVRecorder_CodecMimeType](_a_v_recorder.md#oh_avrecorder_codecmimetype-1) {
AVRECORDER_VIDEO_AVC = 2,
AVRECORDER_AUDIO_AAC = 3,
AVRECORDER_AUDIO_MP3 = 4,
AVRECORDER_AUDIO_G711MU = 5,
AVRECORDER_VIDEO_MPEG4 = 6,
AVRECORDER_VIDEO_HEVC = 8,
AVRECORDER_AUDIO_AMR_NB = 9,
AVRECORDER_AUDIO_AMR_WB = 10
} | Enumerates the MIME types of the encoder.| -| [OH_AVRecorder_ContainerFormatType](_a_v_recorder.md#oh_avrecorder_containerformattype-1) {
AVRECORDER_CFT_MPEG_4 = 2,
AVRECORDER_CFT_MPEG_4A = 6,
AVRECORDER_CFT_AMR = 8,
AVRECORDER_CFT_MP3 = 9,
AVRECORDER_CFT_WAV = 10
} | Enumerates the CFTs.| -| [OH_AVRecorder_State](_a_v_recorder.md#oh_avrecorder_state-1) {
AVRECORDER_IDLE = 0,
AVRECORDER_PREPARED = 1,
AVRECORDER_STARTED = 2,
AVRECORDER_PAUSED = 3,
AVRECORDER_STOPPED = 4,
AVRECORDER_RELEASED = 5,
AVRECORDER_ERROR = 6
} | Enumerates the AVRecorder states.| -| [OH_AVRecorder_StateChangeReason](_a_v_recorder.md#oh_avrecorder_statechangereason-1) {
AVRECORDER_USER = 0,
AVRECORDER_BACKGROUND = 1
} | Enumerates the reasons for AVRecorder state changes.| -| [OH_AVRecorder_FileGenerationMode](_a_v_recorder.md#oh_avrecorder_filegenerationmode-1) {
AVRECORDER_APP_CREATE = 0,
AVRECORDER_AUTO_CREATE_CAMERA_SCENE = 1
} | Enumerates the modes available for creating a recording file.| diff --git a/en/application-dev/reference/apis-media-kit/native__avscreen__capture_8h.md b/en/application-dev/reference/apis-media-kit/native__avscreen__capture_8h.md deleted file mode 100644 index 8ef9f761123..00000000000 --- a/en/application-dev/reference/apis-media-kit/native__avscreen__capture_8h.md +++ /dev/null @@ -1,53 +0,0 @@ -# native_avscreen_capture.h - - -## Overview - -The **native_avscreen_capture.h** file declares the APIs used to create an **OH_AVScreenCapture** instance. - -**Library**: libnative_avscreen_capture.so - -**File to include**: - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Related module**: [AVScreenCapture](_a_v_screen_capture.md) - - -## Summary - - -### Functions - -| Name| Description| -| -------- | -------- | -| struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \* [OH_AVScreenCapture_Create](_a_v_screen_capture.md#oh_avscreencapture_create) (void) | Creates an **OH_AVScreenCapture** instance.| -| [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode) [OH_AVScreenCapture_Init](_a_v_screen_capture.md#oh_avscreencapture_init) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, [OH_AVScreenCaptureConfig](_o_h___a_v_screen_capture_config.md) config) | Initializes parameters related to an **OH_AVScreenCapture** instance, including audio sampling parameters for external capture using microphones (optional), audio sampling parameters for internal capture, and video resolution parameters.| -| [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode) [OH_AVScreenCapture_StartScreenCapture](_a_v_screen_capture.md#oh_avscreencapture_startscreencapture) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture) | Starts screen capture and collects original streams.| -| [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode) [OH_AVScreenCapture_StartScreenCaptureWithSurface](_a_v_screen_capture.md#oh_avscreencapture_startscreencapturewithsurface) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, [OHNativeWindow](../apis-arkgraphics2d/_native_window.md#ohnativewindow) \*window) | Starts screen capture in surface mode.| -| [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode) [OH_AVScreenCapture_StopScreenCapture](_a_v_screen_capture.md#oh_avscreencapture_stopscreencapture) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture) | Stops screen capture. This function is used in pair with **OH_AVScreenCapture_StartScreenCapture**.| -| [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode) [OH_AVScreenCapture_StartScreenRecording](_a_v_screen_capture.md#oh_avscreencapture_startscreenrecording) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture) | Starts screen recording, with recordings saved in files.| -| [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode) [OH_AVScreenCapture_StopScreenRecording](_a_v_screen_capture.md#oh_avscreencapture_stopscreenrecording) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture) | Stops screen recording. This function is used in pair with **OH_AVScreenCapture_StartScreenRecording**.| -| [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode) [OH_AVScreenCapture_AcquireAudioBuffer](_a_v_screen_capture.md#oh_avscreencapture_acquireaudiobuffer) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, [OH_AudioBuffer](_o_h___audio_buffer.md) \*\*audiobuffer, [OH_AudioCaptureSourceType](_a_v_screen_capture.md#oh_audiocapturesourcetype) type) | Obtains an audio buffer. When calling this function, the application must allocate the memory of the corresponding struct size to the audio buffer.| -| [OH_NativeBuffer](_a_v_screen_capture.md#oh_nativebuffer) \* [OH_AVScreenCapture_AcquireVideoBuffer](_a_v_screen_capture.md#oh_avscreencapture_acquirevideobuffer) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, int32_t \*fence, int64_t \*timestamp, struct [OH_Rect](_o_h___rect.md) \*region) | Obtains a video buffer. An application can call this function to obtain information such as the video buffer and timestamp.| -| [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode) [OH_AVScreenCapture_ReleaseAudioBuffer](_a_v_screen_capture.md#oh_avscreencapture_releaseaudiobuffer) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, [OH_AudioCaptureSourceType](_a_v_screen_capture.md#oh_audiocapturesourcetype) type) | Releases an audio buffer.| -| [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode) [OH_AVScreenCapture_ReleaseVideoBuffer](_a_v_screen_capture.md#oh_avscreencapture_releasevideobuffer) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture) | Releases a video buffer.| -| [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode) [OH_AVScreenCapture_SetCallback](_a_v_screen_capture.md#oh_avscreencapture_setcallback) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, struct [OH_AVScreenCaptureCallback](_o_h___a_v_screen_capture_callback.md) callback) | Sets a callback to listen for available video buffers and audio buffers and errors that occur during the function calling.| -| [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode) [OH_AVScreenCapture_Release](_a_v_screen_capture.md#oh_avscreencapture_release) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture) | Releases an **OH_AVScreenCapture** instance. This function is used in pair with **OH_AVScreenCapture_Create**.| -| [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode) [OH_AVScreenCapture_SetMicrophoneEnabled](_a_v_screen_capture.md#oh_avscreencapture_setmicrophoneenabled) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, bool isMicrophone) | Enables or disables the microphone.| -| [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode) [OH_AVScreenCapture_SetStateCallback](_a_v_screen_capture.md#oh_avscreencapture_setstatecallback) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, [OH_AVScreenCapture_OnStateChange](_a_v_screen_capture.md#oh_avscreencapture_onstatechange) callback, void \*userData) | Sets a state change callback. This function must be called before screen capture starts.| -| [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode) [OH_AVScreenCapture_SetDataCallback](_a_v_screen_capture.md#oh_avscreencapture_setdatacallback) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, [OH_AVScreenCapture_OnBufferAvailable](_a_v_screen_capture.md#oh_avscreencapture_onbufferavailable) callback, void \*userData) | Sets a data processing callback. This function must be called before screen capture starts.| -| [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode) [OH_AVScreenCapture_SetErrorCallback](_a_v_screen_capture.md#oh_avscreencapture_seterrorcallback) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, [OH_AVScreenCapture_OnError](_a_v_screen_capture.md#oh_avscreencapture_onerror) callback, void \*userData) | Sets an error processing callback. This function must be called before screen capture starts.| -| [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode) [OH_AVScreenCapture_SetCanvasRotation](_a_v_screen_capture.md#oh_avscreencapture_setcanvasrotation) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, bool canvasRotation) | Sets canvas rotation for screen capture.| -| struct [OH_AVScreenCapture_ContentFilter](_a_v_screen_capture.md#oh_avscreencapture_contentfilter) \* [OH_AVScreenCapture_CreateContentFilter](_a_v_screen_capture.md#oh_avscreencapture_createcontentfilter) (void) | Creates a content filter.| -| [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode) [OH_AVScreenCapture_ReleaseContentFilter](_a_v_screen_capture.md#oh_avscreencapture_releasecontentfilter) (struct [OH_AVScreenCapture_ContentFilter](_a_v_screen_capture.md#oh_avscreencapture_contentfilter) \*filter) | Releases a content filter.| -| [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode) [OH_AVScreenCapture_ContentFilter_AddAudioContent](_a_v_screen_capture.md#oh_avscreencapture_contentfilter_addaudiocontent) (struct [OH_AVScreenCapture_ContentFilter](_a_v_screen_capture.md#oh_avscreencapture_contentfilter) \*filter, [OH_AVScreenCaptureFilterableAudioContent](_a_v_screen_capture.md#oh_avscreencapturefilterableaudiocontent) content) | Adds audio content to a filter.| -| [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode) [OH_AVScreenCapture_ExcludeContent](_a_v_screen_capture.md#oh_avscreencapture_excludecontent) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, struct [OH_AVScreenCapture_ContentFilter](_a_v_screen_capture.md#oh_avscreencapture_contentfilter) \*filter) | Sets a content filter for an **OH_AVScreenCapture** instance.| -| [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode) [OH_AVScreenCapture_ContentFilter_AddWindowContent](_a_v_screen_capture.md#oh_avscreencapture_contentfilter_addwindowcontent) (struct [OH_AVScreenCapture_ContentFilter](_a_v_screen_capture.md#oh_avscreencapture_contentfilter) \*filter, int32_t \*windowIDs, int32_t windowCount) | Adds a list of window IDs to a **ContentFilter** instance. | -| [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode) [OH_AVScreenCapture_ResizeCanvas](_a_v_screen_capture.md#oh_avscreencapture_resizecanvas) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, int32_t width, int32_t height) | Adjusts the screen resolution.| -| [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode) [OH_AVScreenCapture_SkipPrivacyMode](_a_v_screen_capture.md#oh_avscreencapture_skipprivacymode) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, int32_t \*windowIDs, int32_t windowCount) | Exempts privacy windows during screen capture.| -| [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode) [OH_AVScreenCapture_SetMaxVideoFrameRate](_a_v_screen_capture.md#oh_avscreencapture_setmaxvideoframerate) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, int32_t frameRate) | Sets the maximum frame rate for screen capture.| -| [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode) [OH_AVScreenCapture_ShowCursor](_a_v_screen_capture.md#oh_avscreencapture_showcursor) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, bool showCursor) | Sets whether to show the cursor.| -| [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode) [OH_AVScreenCapture_SetDisplayCallback](_a_v_screen_capture.md#oh_avscreencapture_setdisplaycallback) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, [OH_AVScreenCapture_OnDisplaySelected](_a_v_screen_capture.md#oh_avscreencapture_ondisplayselected) callback, void \*userData) | Sets a callback function for obtaining the display ID.| diff --git a/en/application-dev/reference/apis-media-kit/native__avscreen__capture__base_8h.md b/en/application-dev/reference/apis-media-kit/native__avscreen__capture__base_8h.md deleted file mode 100644 index 9567764f562..00000000000 --- a/en/application-dev/reference/apis-media-kit/native__avscreen__capture__base_8h.md +++ /dev/null @@ -1,89 +0,0 @@ -# native_avscreen_capture_base.h - - -## Overview - -The **native_avscreen_capture_base.h** file declares the common structs, character constants, and enums used for running screen capture. - -**Library**: libnative_avscreen_capture.so - -**File to include**: - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Related module**: [AVScreenCapture](_a_v_screen_capture.md) - - -## Summary - - -### Structs - -| Name| Description| -| -------- | -------- | -| struct [OH_AudioCaptureInfo](_o_h___audio_capture_info.md) | Describes the audio capture information.| -| struct [OH_AudioEncInfo](_o_h___audio_enc_info.md) | Describes the audio encoding information.| -| struct [OH_AudioInfo](_o_h___audio_info.md) | Describes the audio information.| -| struct [OH_VideoCaptureInfo](_o_h___video_capture_info.md) | Describes the video capture information.| -| struct [OH_VideoEncInfo](_o_h___video_enc_info.md) | Describes the video encoding information.| -| struct [OH_VideoInfo](_o_h___video_info.md) | Describes the video information.| -| struct [OH_RecorderInfo](_o_h___recorder_info.md) | Describes the recording file information.| -| struct [OH_AVScreenCaptureConfig](_o_h___a_v_screen_capture_config.md) | Describes the screen capture configuration.| -| struct [OH_AVScreenCaptureCallback](_o_h___a_v_screen_capture_callback.md) | Describes all the asynchronous callback function pointers of an **OH_AVScreenCapture** instance.| -| struct [OH_Rect](_o_h___rect.md) | Describes the width, height, and image information of the rectangle used for screen capture.| -| struct [OH_AudioBuffer](_o_h___audio_buffer.md) | Describes the configuration such as the size, type, and timestamp of audio data.| - - -### Types - -| Name| Description| -| -------- | -------- | -| typedef struct [OH_NativeBuffer](_a_v_screen_capture.md#oh_nativebuffer) [OH_NativeBuffer](_a_v_screen_capture.md#oh_nativebuffer) | Defines the native video stream class for screen capture.| -| typedef struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) | Defines a screen capture instance used to obtain original video and audio streams.| -| typedef struct [OH_AVScreenCapture_ContentFilter](_a_v_screen_capture.md#oh_avscreencapture_contentfilter) [OH_AVScreenCapture_ContentFilter](_a_v_screen_capture.md#oh_avscreencapture_contentfilter) | Defines a struct that describes the filter used to filter audio and video content.| -| typedef enum [OH_CaptureMode](_a_v_screen_capture.md#oh_capturemode-1) [OH_CaptureMode](_a_v_screen_capture.md#oh_capturemode) | Defines an enum for the screen capture modes.| -| typedef enum [OH_AudioCaptureSourceType](_a_v_screen_capture.md#oh_audiocapturesourcetype-1) [OH_AudioCaptureSourceType](_a_v_screen_capture.md#oh_audiocapturesourcetype) | Defines an enum for the audio source types during screen capture.| -| typedef enum [OH_AudioCodecFormat](_a_v_screen_capture.md#oh_audiocodecformat-1) [OH_AudioCodecFormat](_a_v_screen_capture.md#oh_audiocodecformat) | Defines an enum for the audio encoding formats.| -| typedef enum [OH_VideoCodecFormat](_a_v_screen_capture.md#oh_videocodecformat-1) [OH_VideoCodecFormat](_a_v_screen_capture.md#oh_videocodecformat) | Defines an enum for the video encoding formats.| -| typedef enum [OH_DataType](_a_v_screen_capture.md#oh_datatype-1) [OH_DataType](_a_v_screen_capture.md#oh_datatype) | Defines an enum for the data types of screen capture streams.| -| typedef enum [OH_VideoSourceType](_a_v_screen_capture.md#oh_videosourcetype-1) [OH_VideoSourceType](_a_v_screen_capture.md#oh_videosourcetype) | Defines an enum for the video source formats. Currently, only the RGBA format is supported.| -| typedef enum [OH_ContainerFormatType](_a_v_screen_capture.md#oh_containerformattype-1) [OH_ContainerFormatType](_a_v_screen_capture.md#oh_containerformattype) | Defines an enum for the types of files generated during screen capture.| -| typedef struct [OH_AudioCaptureInfo](_o_h___audio_capture_info.md) [OH_AudioCaptureInfo](_a_v_screen_capture.md#oh_audiocaptureinfo) | Defines a struct that describes the audio capture information.| -| typedef struct [OH_AudioEncInfo](_o_h___audio_enc_info.md) [OH_AudioEncInfo](_a_v_screen_capture.md#oh_audioencinfo) | Defines a struct that describes the audio encoding information.| -| typedef struct [OH_AudioInfo](_o_h___audio_info.md) [OH_AudioInfo](_a_v_screen_capture.md#oh_audioinfo) | Defines a struct that describes the audio information.| -| typedef struct [OH_VideoCaptureInfo](_o_h___video_capture_info.md) [OH_VideoCaptureInfo](_a_v_screen_capture.md#oh_videocaptureinfo) | Defines a struct that describes the video capture information.| -| typedef struct [OH_VideoEncInfo](_o_h___video_enc_info.md) [OH_VideoEncInfo](_a_v_screen_capture.md#oh_videoencinfo) | Defines a struct that describes the video encoding information.| -| typedef struct [OH_VideoInfo](_o_h___video_info.md) [OH_VideoInfo](_a_v_screen_capture.md#oh_videoinfo) | Defines a struct that describes the video information.| -| typedef struct [OH_RecorderInfo](_o_h___recorder_info.md) [OH_RecorderInfo](_a_v_screen_capture.md#oh_recorderinfo) | Defines a struct that describes the recording file information.| -| typedef struct [OH_AVScreenCaptureConfig](_o_h___a_v_screen_capture_config.md) [OH_AVScreenCaptureConfig](_a_v_screen_capture.md#oh_avscreencaptureconfig) | Defines a struct that describes the screen capture configuration.| -| typedef void(\* [OH_AVScreenCaptureOnError](_a_v_screen_capture.md#oh_avscreencaptureonerror)) ([OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, int32_t errorCode) | Defines a pointer to a callback function that is called when an error occurs during the running of an **OH_AVScreenCapture** instance.| -| typedef void(\* [OH_AVScreenCaptureOnAudioBufferAvailable](_a_v_screen_capture.md#oh_avscreencaptureonaudiobufferavailable)) ([OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, bool isReady, [OH_AudioCaptureSourceType](_a_v_screen_capture.md#oh_audiocapturesourcetype) type) | Defines a pointer to a callback function that is called when an audio buffer is available during the running of an **OH_AVScreenCapture** instance.| -| typedef void(\* [OH_AVScreenCaptureOnVideoBufferAvailable](_a_v_screen_capture.md#oh_avscreencaptureonvideobufferavailable)) ([OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, bool isReady) | Defines a pointer to a callback function that is called when a video buffer is available during the running of an **OH_AVScreenCapture** instance.| -| typedef struct [OH_AVScreenCaptureCallback](_o_h___a_v_screen_capture_callback.md) [OH_AVScreenCaptureCallback](_a_v_screen_capture.md#oh_avscreencapturecallback) | Defines a struct that describes all the asynchronous callback function pointers of an **OH_AVScreenCapture** instance.| -| typedef struct [OH_Rect](_o_h___rect.md) [OH_Rect](_a_v_screen_capture.md#oh_rect) | Defines a struct that describes the width, height, and image information of the rectangle used for screen capture.| -| typedef struct [OH_AudioBuffer](_o_h___audio_buffer.md) [OH_AudioBuffer](_a_v_screen_capture.md#oh_audiobuffer) | Defines a struct that describes the configuration such as the size, type, and timestamp of audio data.| -| typedef enum [OH_AVScreenCaptureStateCode](_a_v_screen_capture.md#oh_avscreencapturestatecode-1) [OH_AVScreenCaptureStateCode](_a_v_screen_capture.md#oh_avscreencapturestatecode) | Defines an enum for the screen capture states.| -| typedef enum [OH_AVScreenCaptureBufferType](_a_v_screen_capture.md#oh_avscreencapturebuffertype-1) [OH_AVScreenCaptureBufferType](_a_v_screen_capture.md#oh_avscreencapturebuffertype) | Defines an enum for the buffer types.| -| typedef enum [OH_AVScreenCaptureFilterableAudioContent](_a_v_screen_capture.md#oh_avscreencapturefilterableaudiocontent-1) [OH_AVScreenCaptureFilterableAudioContent](_a_v_screen_capture.md#oh_avscreencapturefilterableaudiocontent) | Defines an enum for the types of audio that can be added to a content filter.| -| typedef void(\* [OH_AVScreenCapture_OnStateChange](_a_v_screen_capture.md#oh_avscreencapture_onstatechange)) (struct [OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, [OH_AVScreenCaptureStateCode](_a_v_screen_capture.md#oh_avscreencapturestatecode) stateCode, void \*userData) | Defines a pointer to a callback function that is called when the state changes during the running of an **OH_AVScreenCapture** instance.| -| typedef void(\* [OH_AVScreenCapture_OnError](_a_v_screen_capture.md#oh_avscreencapture_onerror)) ([OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, int32_t errorCode, void \*userData) | Defines a pointer to a callback function that is called when an error occurs during the running of an **OH_AVScreenCapture** instance.| -| typedef void(\* [OH_AVScreenCapture_OnBufferAvailable](_a_v_screen_capture.md#oh_avscreencapture_onbufferavailable)) ([OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, [OH_AVBuffer](../apis-avcodec-kit/_core.md#oh_avbuffer) \*buffer, [OH_AVScreenCaptureBufferType](_a_v_screen_capture.md#oh_avscreencapturebuffertype) bufferType, int64_t timestamp, void \*userData) | Defines a pointer to a callback function that is called when an audio or a video buffer is available during the running of an **OH_AVScreenCapture** instance.| -| typedef void(\* [OH_AVScreenCapture_OnDisplaySelected](_a_v_screen_capture.md#oh_avscreencapture_ondisplayselected)) ([OH_AVScreenCapture](_a_v_screen_capture.md#oh_avscreencapture) \*capture, uint64_t displayId, void \*userData) | Defines a pointer to a callback function that is called when screen capture starts.| - - -### Enums - -| Name| Description| -| -------- | -------- | -| [OH_CaptureMode](_a_v_screen_capture.md#oh_capturemode-1) {
OH_CAPTURE_HOME_SCREEN = 0,
OH_CAPTURE_SPECIFIED_SCREEN = 1,
OH_CAPTURE_SPECIFIED_WINDOW = 2,
OH_CAPTURE_INVAILD = -1
} | Enumerates the screen capture modes.| -| [OH_AudioCaptureSourceType](_a_v_screen_capture.md#oh_audiocapturesourcetype-1) {
OH_SOURCE_INVALID = -1,
OH_SOURCE_DEFAULT = 0,
OH_MIC = 1,
OH_ALL_PLAYBACK = 2,
OH_APP_PLAYBACK = 3
} | Enumerates the audio source types during screen capture.| -| [OH_AudioCodecFormat](_a_v_screen_capture.md#oh_audiocodecformat-1) {
OH_AUDIO_DEFAULT = 0,
OH_AAC_LC = 3,
OH_AUDIO_CODEC_FORMAT_BUTT
} | Enumerates the audio encoding formats.| -| [OH_VideoCodecFormat](_a_v_screen_capture.md#oh_videocodecformat-1) {
OH_VIDEO_DEFAULT = 0,
OH_H264 = 2,
OH_H265 = 4,
OH_MPEG4 = 6,
OH_VP8 = 8,
OH_VP9 = 10,
OH_VIDEO_CODEC_FORMAT_BUTT
} | Enumerates the video encoding formats.| -| [OH_DataType](_a_v_screen_capture.md#oh_datatype-1) {
OH_ORIGINAL_STREAM = 0,
OH_ENCODED_STREAM = 1,
OH_CAPTURE_FILE = 2,
OH_INVAILD = -1
} | Enumerates the data types of screen capture streams.| -| [OH_VideoSourceType](_a_v_screen_capture.md#oh_videosourcetype-1) {
OH_VIDEO_SOURCE_SURFACE_YUV = 0,
OH_VIDEO_SOURCE_SURFACE_ES,
OH_VIDEO_SOURCE_SURFACE_RGBA,
OH_VIDEO_SOURCE_BUTT
} | Enumerates the video source formats. Currently, only the RGBA format is supported.| -| [OH_ContainerFormatType](_a_v_screen_capture.md#oh_containerformattype-1) {
CFT_MPEG_4A = 0,
CFT_MPEG_4 = 1
} | Enumerates the types of files generated during screen capture.| -| [OH_AVScreenCaptureStateCode](_a_v_screen_capture.md#oh_avscreencapturestatecode-1) {
OH_SCREEN_CAPTURE_STATE_STARTED = 0,
OH_SCREEN_CAPTURE_STATE_CANCELED = 1,
OH_SCREEN_CAPTURE_STATE_STOPPED_BY_USER = 2,
OH_SCREEN_CAPTURE_STATE_INTERRUPTED_BY_OTHER = 3,
OH_SCREEN_CAPTURE_STATE_STOPPED_BY_CALL = 4,
OH_SCREEN_CAPTURE_STATE_MIC_UNAVAILABLE = 5,
OH_SCREEN_CAPTURE_STATE_MIC_MUTED_BY_USER = 6,
OH_SCREEN_CAPTURE_STATE_MIC_UNMUTED_BY_USER = 7,
OH_SCREEN_CAPTURE_STATE_ENTER_PRIVATE_SCENE = 8,
OH_SCREEN_CAPTURE_STATE_EXIT_PRIVATE_SCENE = 9,
OH_SCREEN_CAPTURE_STATE_STOPPED_BY_USER_SWITCHES = 10
} | Enumerates the screen capture states.| -| [OH_AVScreenCaptureBufferType](_a_v_screen_capture.md#oh_avscreencapturebuffertype-1) {
OH_SCREEN_CAPTURE_BUFFERTYPE_VIDEO = 0,
OH_SCREEN_CAPTURE_BUFFERTYPE_AUDIO_INNER = 1,
OH_SCREEN_CAPTURE_BUFFERTYPE_AUDIO_MIC = 2
} | Enumerates the buffer types.| -| [OH_AVScreenCaptureFilterableAudioContent](_a_v_screen_capture.md#oh_avscreencapturefilterableaudiocontent-1) {
OH_SCREEN_CAPTURE_NOTIFICATION_AUDIO = 0,
OH_SCREEN_CAPTURE_CURRENT_APP_AUDIO = 1
} | Enumerates the types of audio that can be added to a content filter. | diff --git a/en/application-dev/reference/apis-media-kit/native__avscreen__capture__errors_8h.md b/en/application-dev/reference/apis-media-kit/native__avscreen__capture__errors_8h.md deleted file mode 100644 index ed770542ff5..00000000000 --- a/en/application-dev/reference/apis-media-kit/native__avscreen__capture__errors_8h.md +++ /dev/null @@ -1,33 +0,0 @@ -# native_avscreen_capture_errors.h - - -## Overview - -The **native_avscreen_capture_errors.h** file declares the error codes generated during screen capture. - -**Library**: libnative_avscreen_capture.so - -**File to include**: - -**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture - -**Since**: 10 - -**Related module**: [AVScreenCapture](_a_v_screen_capture.md) - - -## Summary - - -### Types - -| Name| Description| -| -------- | -------- | -| typedef enum [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode-1) [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode) | Defines an enum for error codes generated during screen capture.| - - -### Enums - -| Name| Description| -| -------- | -------- | -| [OH_AVSCREEN_CAPTURE_ErrCode](_a_v_screen_capture.md#oh_avscreen_capture_errcode-1) {
AV_SCREEN_CAPTURE_ERR_BASE = 0,
AV_SCREEN_CAPTURE_ERR_OK = AV_SCREEN_CAPTURE_ERR_BASE,
AV_SCREEN_CAPTURE_ERR_NO_MEMORY = AV_SCREEN_CAPTURE_ERR_BASE + 1,
AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT = AV_SCREEN_CAPTURE_ERR_BASE + 2,
AV_SCREEN_CAPTURE_ERR_INVALID_VAL = AV_SCREEN_CAPTURE_ERR_BASE + 3,
AV_SCREEN_CAPTURE_ERR_IO = AV_SCREEN_CAPTURE_ERR_BASE + 4,
AV_SCREEN_CAPTURE_ERR_TIMEOUT = AV_SCREEN_CAPTURE_ERR_BASE + 5,
AV_SCREEN_CAPTURE_ERR_UNKNOWN = AV_SCREEN_CAPTURE_ERR_BASE + 6,
AV_SCREEN_CAPTURE_ERR_SERVICE_DIED = AV_SCREEN_CAPTURE_ERR_BASE + 7,
AV_SCREEN_CAPTURE_ERR_INVALID_STATE = AV_SCREEN_CAPTURE_ERR_BASE + 8,
AV_SCREEN_CAPTURE_ERR_UNSUPPORT = AV_SCREEN_CAPTURE_ERR_BASE + 9,
AV_SCREEN_CAPTURE_ERR_EXTEND_START = AV_SCREEN_CAPTURE_ERR_BASE + 100
} | Enumerates the error codes generated during screen capture.| diff --git a/en/application-dev/reference/apis-media-kit/video__processing_8h.md b/en/application-dev/reference/apis-media-kit/video__processing_8h.md deleted file mode 100644 index 50dc7d17a9e..00000000000 --- a/en/application-dev/reference/apis-media-kit/video__processing_8h.md +++ /dev/null @@ -1,46 +0,0 @@ -# video_processing.h - - -## Overview - -The **video_processing.h** file declares the video processing functions. - -It provides video processing capabilities, including color space conversion, metadata generation, and video scaling. - -**Library**: libvideo_processing.so - -**File to include**: - -**System capability**: SystemCapability.Multimedia.VideoProcessingEngine - -**Since**: 12 - -**Related module**: [VideoProcessing](_video_processing.md) - - -## Summary - - -### Functions - -| Name| Description| -| -------- | -------- | -| [VideoProcessing_ErrorCode](_video_processing.md#videoprocessing_errorcode) [OH_VideoProcessing_InitializeEnvironment](_video_processing.md#oh_videoprocessing_initializeenvironment) (void) | Initializes the global video processing environment.| -| [VideoProcessing_ErrorCode](_video_processing.md#videoprocessing_errorcode) [OH_VideoProcessing_DeinitializeEnvironment](_video_processing.md#oh_videoprocessing_deinitializeenvironment) (void) | Releases the global video processing environment.| -| bool [OH_VideoProcessing_IsColorSpaceConversionSupported](_video_processing.md#oh_videoprocessing_iscolorspaceconversionsupported) (const [VideoProcessing_ColorSpaceInfo](_video_processing___color_space_info.md) \*sourceVideoInfo, const [VideoProcessing_ColorSpaceInfo](_video_processing___color_space_info.md) \*destinationVideoInfo) | Checks whether color space conversion is supported during video processing.| -| bool [OH_VideoProcessing_IsMetadataGenerationSupported](_video_processing.md#oh_videoprocessing_ismetadatagenerationsupported) (const [VideoProcessing_ColorSpaceInfo](_video_processing___color_space_info.md) \*sourceVideoInfo) | Checks whether metadata generation is supported during video processing.| -| [VideoProcessing_ErrorCode](_video_processing.md#videoprocessing_errorcode) [OH_VideoProcessing_Create](_video_processing.md#oh_videoprocessing_create) ([OH_VideoProcessing](_video_processing.md#oh_videoprocessing) \*\*videoProcessor, int type) | Creates a video processing instance.| -| [VideoProcessing_ErrorCode](_video_processing.md#videoprocessing_errorcode) [OH_VideoProcessing_Destroy](_video_processing.md#oh_videoprocessing_destroy) ([OH_VideoProcessing](_video_processing.md#oh_videoprocessing) \*videoProcessor) | Destroys a video processing instance.| -| [VideoProcessing_ErrorCode](_video_processing.md#videoprocessing_errorcode) [OH_VideoProcessing_RegisterCallback](_video_processing.md#oh_videoprocessing_registercallback) ([OH_VideoProcessing](_video_processing.md#oh_videoprocessing) \*videoProcessor, const [VideoProcessing_Callback](_video_processing.md#videoprocessing_callback) \*callback, void \*userData) | Registers a callback for video processing.| -| [VideoProcessing_ErrorCode](_video_processing.md#videoprocessing_errorcode) [OH_VideoProcessing_SetSurface](_video_processing.md#oh_videoprocessing_setsurface) ([OH_VideoProcessing](_video_processing.md#oh_videoprocessing) \*videoProcessor, const [OHNativeWindow](_video_processing.md#ohnativewindow) \*window) | Sets an output surface for video processing.| -| [VideoProcessing_ErrorCode](_video_processing.md#videoprocessing_errorcode) [OH_VideoProcessing_GetSurface](_video_processing.md#oh_videoprocessing_getsurface) ([OH_VideoProcessing](_video_processing.md#oh_videoprocessing) \*videoProcessor, [OHNativeWindow](_video_processing.md#ohnativewindow) \*\*window) | Creates a surface for video processing.| -| [VideoProcessing_ErrorCode](_video_processing.md#videoprocessing_errorcode) [OH_VideoProcessing_SetParameter](_video_processing.md#oh_videoprocessing_setparameter) ([OH_VideoProcessing](_video_processing.md#oh_videoprocessing) \*videoProcessor, const [OH_AVFormat](_video_processing.md#oh_avformat) \*parameter) | Sets video processing parameters.| -| [VideoProcessing_ErrorCode](_video_processing.md#videoprocessing_errorcode) [OH_VideoProcessing_GetParameter](_video_processing.md#oh_videoprocessing_getparameter) ([OH_VideoProcessing](_video_processing.md#oh_videoprocessing) \*videoProcessor, [OH_AVFormat](_video_processing.md#oh_avformat) \*parameter) | Obtains video processing parameters.| -| [VideoProcessing_ErrorCode](_video_processing.md#videoprocessing_errorcode) [OH_VideoProcessing_Start](_video_processing.md#oh_videoprocessing_start) ([OH_VideoProcessing](_video_processing.md#oh_videoprocessing) \*videoProcessor) | Starts video processing.| -| [VideoProcessing_ErrorCode](_video_processing.md#videoprocessing_errorcode) [OH_VideoProcessing_Stop](_video_processing.md#oh_videoprocessing_stop) ([OH_VideoProcessing](_video_processing.md#oh_videoprocessing) \*videoProcessor) | Stops video processing.| -| [VideoProcessing_ErrorCode](_video_processing.md#videoprocessing_errorcode) [OH_VideoProcessing_RenderOutputBuffer](_video_processing.md#oh_videoprocessing_renderoutputbuffer) ([OH_VideoProcessing](_video_processing.md#oh_videoprocessing) \*videoProcessor, uint32_t index) | Renders and processes the buffer, and then outputs it.| -| [VideoProcessing_ErrorCode](_video_processing.md#videoprocessing_errorcode) [OH_VideoProcessingCallback_Create](_video_processing.md#oh_videoprocessingcallback_create) ([VideoProcessing_Callback](_video_processing.md#videoprocessing_callback) \*\*callback) | Creates a video processing callback object.| -| [VideoProcessing_ErrorCode](_video_processing.md#videoprocessing_errorcode) [OH_VideoProcessingCallback_Destroy](_video_processing.md#oh_videoprocessingcallback_destroy) ([VideoProcessing_Callback](_video_processing.md#videoprocessing_callback) \*callback) | Destroys a video processing callback object.| -| [VideoProcessing_ErrorCode](_video_processing.md#videoprocessing_errorcode) [OH_VideoProcessingCallback_BindOnError](_video_processing.md#oh_videoprocessingcallback_bindonerror) ([VideoProcessing_Callback](_video_processing.md#videoprocessing_callback) \*callback, [OH_VideoProcessingCallback_OnError](_video_processing.md#oh_videoprocessingcallback_onerror) onError) | Binds the callback function [OH_VideoProcessingCallback_OnError](_video_processing.md#oh_videoprocessingcallback_onerror) to a video processing callback object.| -| [VideoProcessing_ErrorCode](_video_processing.md#videoprocessing_errorcode) [OH_VideoProcessingCallback_BindOnState](_video_processing.md#oh_videoprocessingcallback_bindonstate) ([VideoProcessing_Callback](_video_processing.md#videoprocessing_callback) \*callback, [OH_VideoProcessingCallback_OnState](_video_processing.md#oh_videoprocessingcallback_onstate) onState) | Binds the callback function [OH_VideoProcessingCallback_OnState](_video_processing.md#oh_videoprocessingcallback_onstate) to a video processing callback object.| -| [VideoProcessing_ErrorCode](_video_processing.md#videoprocessing_errorcode) [OH_VideoProcessingCallback_BindOnNewOutputBuffer](_video_processing.md#oh_videoprocessingcallback_bindonnewoutputbuffer) ([VideoProcessing_Callback](_video_processing.md#videoprocessing_callback) \*callback, [OH_VideoProcessingCallback_OnNewOutputBuffer](_video_processing.md#oh_videoprocessingcallback_onnewoutputbuffer) onNewOutputBuffer) | Binds the callback function [OH_VideoProcessingCallback_OnNewOutputBuffer](_video_processing.md#oh_videoprocessingcallback_onnewoutputbuffer) to a video processing callback object.| diff --git a/en/application-dev/reference/apis-media-kit/video__processing__types_8h.md b/en/application-dev/reference/apis-media-kit/video__processing__types_8h.md deleted file mode 100644 index 22cf53fd289..00000000000 --- a/en/application-dev/reference/apis-media-kit/video__processing__types_8h.md +++ /dev/null @@ -1,62 +0,0 @@ -# video_processing_types.h - - -## Overview - -The **video_processing_types.h** file declares the video processing types. - -**Library**: libvideo_processing.so - -**File to include**: - -**System capability**: SystemCapability.Multimedia.VideoProcessingEngine - -**Since**: 12 - -**Related module**: [VideoProcessing](_video_processing.md) - - -## Summary - - -### Structs - -| Name| Description| -| -------- | -------- | -| struct [VideoProcessing_ColorSpaceInfo](_video_processing___color_space_info.md) | Describes the color space information of video processing.| - - -### Types - -| Name| Description| -| -------- | -------- | -| typedef struct [OH_VideoProcessing](_video_processing.md#oh_videoprocessing ) [OH_VideoProcessing](_video_processing.md#oh_videoprocessing) | Defines a struct for the video processing object.| -| typedef struct NativeWindow [OHNativeWindow](_video_processing.md#ohnativewindow) | Defines a struct for the NativeWindow object.| -| typedef struct [OH_AVFormat](_video_processing.md#oh_avformat-1) [OH_AVFormat](_video_processing.md#oh_avformat) | Defines a struct for the OH_AVFormat object.| -| typedef struct [VideoProcessing_ColorSpaceInfo](_video_processing___color_space_info.md) [VideoProcessing_ColorSpaceInfo](_video_processing.md#videoprocessing_colorspaceinfo) | Defines a struct for the color space information of video processing.| -| typedef enum [VideoDetailEnhancer_QualityLevel](_video_processing.md#videodetailenhancer_qualitylevel-1) [VideoDetailEnhancer_QualityLevel](_video_processing.md#videodetailenhancer_qualitylevel) | Defines an enum for the quality levels for detail enhancement.| -| typedef enum [VideoProcessing_ErrorCode](_video_processing.md#videoprocessing_errorcode-1) [VideoProcessing_ErrorCode](_video_processing.md#videoprocessing_errorcode) | Defines an enum for the video processing error codes.| -| typedef enum [VideoProcessing_State](_video_processing.md#videoprocessing_state-1) [VideoProcessing_State](_video_processing.md#videoprocessing_state) | Defines an enum for the video processing states.| -| typedef struct [VideoProcessing_Callback](_video_processing.md#videoprocessing_callback) [VideoProcessing_Callback](_video_processing.md#videoprocessing_callback) | Defines a struct for the video processing callback object.| -| typedef void(\* [OH_VideoProcessingCallback_OnError](_video_processing.md#oh_videoprocessingcallback_onerror)) ([OH_VideoProcessing](_video_processing.md#oh_videoprocessing) \*videoProcessor, [VideoProcessing_ErrorCode](_video_processing.md#videoprocessing_errorcode) error, void \*userData) | Defines a pointer to the callback function for reporting an error during video processing.| -| typedef void(\* [OH_VideoProcessingCallback_OnState](_video_processing.md#oh_videoprocessingcallback_onstate)) ([OH_VideoProcessing](_video_processing.md#oh_videoprocessing) \*videoProcessor, [VideoProcessing_State](_video_processing.md#videoprocessing_state) state, void \*userData) | Defines a pointer to the callback function for reporting the video processing state.| -| typedef void(\* [OH_VideoProcessingCallback_OnNewOutputBuffer](_video_processing.md#oh_videoprocessingcallback_onnewoutputbuffer)) ([OH_VideoProcessing](_video_processing.md#oh_videoprocessing) \*videoProcessor, uint32_t index, void \*userData) | Defines a pointer to the callback function for reporting the data filled in the output buffer.| - - -### Enums - -| Name| Description| -| -------- | -------- | -| [VideoDetailEnhancer_QualityLevel](_video_processing.md#videodetailenhancer_qualitylevel-1) {
VIDEO_DETAIL_ENHANCER_QUALITY_LEVEL_NONE,
VIDEO_DETAIL_ENHANCER_QUALITY_LEVEL_LOW,
VIDEO_DETAIL_ENHANCER_QUALITY_LEVEL_MEDIUM,
VIDEO_DETAIL_ENHANCER_QUALITY_LEVEL_HIGH
} | Enumerates the quality levels for detail enhancement.| -| [VideoProcessing_ErrorCode](_video_processing.md#videoprocessing_errorcode-1) {
VIDEO_PROCESSING_SUCCESS,
VIDEO_PROCESSING_ERROR_INVALID_PARAMETER = 401,
VIDEO_PROCESSING_ERROR_UNKNOWN = 29210001,
VIDEO_PROCESSING_ERROR_INITIALIZE_FAILED,
VIDEO_PROCESSING_ERROR_CREATE_FAILED,
VIDEO_PROCESSING_ERROR_PROCESS_FAILED,
VIDEO_PROCESSING_ERROR_UNSUPPORTED_PROCESSING,
VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED,
VIDEO_PROCESSING_ERROR_NO_MEMORY,
VIDEO_PROCESSING_ERROR_INVALID_INSTANCE,
VIDEO_PROCESSING_ERROR_INVALID_VALUE
} | Enumerates the video processing error codes.| -| [VideoProcessing_State](_video_processing.md#videoprocessing_state-1) {
VIDEO_PROCESSING_STATE_RUNNING,
VIDEO_PROCESSING_STATE_STOPPED
} | Enumerates the video processing states.| - - -### Variables - -| Name| Description| -| -------- | -------- | -| const int32_t [VIDEO_PROCESSING_TYPE_COLOR_SPACE_CONVERSION](_video_processing.md#video_processing_type_color_space_conversion) | Instance created for color space conversion during video processing.| -| const int32_t [VIDEO_PROCESSING_TYPE_METADATA_GENERATION](_video_processing.md#video_processing_type_metadata_generation) | Instance created for metadata generation during video processing.| -| const int32_t [VIDEO_PROCESSING_TYPE_DETAIL_ENHANCER](_video_processing.md#video_processing_type_detail_enhancer) | Instance for detail enhancement during video processing.| -| const char \* [VIDEO_DETAIL_ENHANCER_PARAMETER_KEY_QUALITY_LEVEL](_video_processing.md#video_detail_enhancer_parameter_key_quality_level) | Pointer to the quality level of video detail enhancement.| diff --git a/en/application-dev/ui/state-management/arkts-v1-v2-mixusage.md b/en/application-dev/ui/state-management/arkts-v1-v2-mixusage.md new file mode 100644 index 00000000000..40f13013586 --- /dev/null +++ b/en/application-dev/ui/state-management/arkts-v1-v2-mixusage.md @@ -0,0 +1,1025 @@ +# Mixing Use of State Management V1 and V2 + +## Overview + +During the evolution of the state management framework, state managements V1 and V2 are launched based on API version 7 and API version 12, respectively. For applications that have used state management V1 and need to be migrated to state management V2, see [Migrating Applications from V1 to V2](./arkts-v1-v2-migration.md). + +For large-scale applications, V1 and V2 may be used together during the migration. In versions earlier than API version 18, strict verification is performed in the mixed use scenario, mainly in the transfer of complex objects. For details, see [Mixing Use of Custom Components](./arkts-custom-component-mixed-scenarios.md). To facilitate smooth migration to V2, API version 18 and later versions reduce the restrictions on the mixed use of V1 and V2. In addition, new methods [enableV2Compatibility](../../reference/apis-arkui/js-apis-StateManagement.md#enablev2compatibility19) and [makeV1Observed](../../reference/apis-arkui/js-apis-StateManagement.md#makev1observed19) are provided to help you solve related problems. + +> **NOTE** +> +> In this topic, the symbol "->" is used to indicate the transfer of variables. For example, "V1 -> V2" indicates that the state variable of V1 is transferred to the V2. + + +## Verification Rules +In versions earlier than API version 18, the mixed use rules of state managements V1 and V2 can be summarized as follows: +1. Decorators of V1 cannot be used together with @ObservedV2. +2. Decorators of V2 cannot be used together with @Observed. +3. Only simple types can be transferred from V1 to V2. Complex types (built-in types), including Array, Map, Set, and Date, are not allowed. +4. Simple types or a common class can be transferred from V2 to V1, but built-in types such as Array, Map, Set, or Date are not allowed. + +Since API version 18, only the first rule is still enabled, and the rest rules are open for verification. The following table lists the verification during compilation. + +| Scenario | Earlier than API Version 18| API Version 18 and Later | +|------|----|------| +| Decorators of V1 and \@ObservedV2 are used together. | An error is reported.| An error is reported.| +| Decorators of V2 and \@Observed are used together.| An error is reported.| No error is reported.| +| A common class is transferred from V1 to V2. | An error is reported.| No error is reported.| +| Built-in types such as Array, Map, Set, Date are transferred from V1 to V2. | An error is reported.| No error is reported.| +| A \@Observed decorated class is transferred from V1 to V2. | An error is reported.| No error is reported.| +| A \@ObservedV2 decorated class is transferred from V2 to V1. | An error is reported.| An error is reported.| +| Built-in types such as Array, Map, Set, Date are transferred from V2 to V1. | An error is reported.| No error is reported.| +| \@ObjectLink is initialized by a class that is not decorated by \@Observed. | An error is reported.| No error is reported.| + +@ObservedV2 or @Trace has its own independent observation capability, which can be used in both \@ComponentV2 and \@Component. However, the state management framework does not allow the mixed use of observation capability of V1 and V2. Therefore, the first rule is still enabled. + +## Available APIs +### makeV1Observed + +static makeV1Observed\(source: T): T + +The [makeV1Observed](../../reference/apis-arkui/js-apis-StateManagement.md#makev1observed19) API encapsulates an unobservable object into an observable object of state management V1. **makeV1Observed** has the same capability as that of @Observed and its return value can be used to initialize @ObjectLink. + +>**NOTE** +> +>This API is supported since API version 18. + +**Description** +- **makeV1Observed** is used together with **enableV2Compatibility** for V2 -> V1 transfer. +- **makeV1Observed** converts a common class, Array, Map, Set, or Date type to a state variable of V1. Its capability is equivalent to \@Observed. Therefore, the return value can be used to initialize \@ObjectLink. +- If the data received by **makeV1Observed** is already the state variable of V1, **makeV1Observed** returns itself without any change. +- **makeV1Observed** does not execute recursively. It only wraps the first layer into the state variable of V1. + +**Constraints** +- The [collections](../../reference/apis-arkts/js-apis-arkts-collections.md) type and [\@Sendable](../../arkts-utils/arkts-sendable.md) decorated classes are not supported. +- Non-object types are not supported. +- **undefined** and **null** are not supported. +- The return values of \@ObservedV2 and [makeObserved](../../reference/apis-arkui/js-apis-StateManagement.md#makeobserved), and variables of built-in types (such as Array, Map, Set, and Date) decorated by the decorators of V2 are not supported. + + +### enableV2Compatibility + +static enableV2Compatibility\(source: T): T + +[enableV2Compatibility](../../reference/apis-arkui/js-apis-StateManagement.md#enablev2compatibility19) enables the observation capability of V2 for the state variable of V1, that is, the state variable of V1 can be observed in \@ComponentV2. + +>**NOTE** +> +>This API is supported since API version 18. + +**Description** +- This API is mainly used in the V1 -> V2 transfer. After the state variable of V1 calls this API and is transferred to \@ComponentV2, the change can be observed in V2 to implement associated data update. +- **enableV2Compatibility** applies only to state variables of V1. The state variable of V1 is a variable decorated by the decorator of V1, such as \@Observed, \@State, \@Prop, \@Link, \@Provide, \@Consume, and \@ObjectLink (\@ObjectLink must be an instance decorated by \@Observed or the return value of **makeV1Observed**). Otherwise, the input parameter itself is returned. +- **enableV2Compatibility** recursively traverses all properties of the class and all subitems of Array, Set, or Map until non-V1 state variable data is found. + +**Constraints** +- Non-object types are not supported. +- **undefined** and **null** are not supported. +- Non-V1 state variable data is not supported. +- The return values of \@ObservedV2 and [makeObserved](../../reference/apis-arkui/js-apis-StateManagement.md#makeobserved), and variables of built-in types (such as Array, Map, Set, and Date) decorated by the decorators of V2 are not supported. + +## Mixed Use Paradigm + +Based on the [enableV2Compatibility](../../reference/apis-arkui/js-apis-StateManagement.md#enablev2compatibility19) and [makeV1Observed](../../reference/apis-arkui/js-apis-StateManagement.md#makev1observed19) APIs, the mixed use paradigm of V1 and V2 is as follows: + +### V1->V2 +- The state variable of V1 is transferred to \@Param of V2. Call **UIUtils.enableV2Compatibility** to enable the state variable of V1 to be observed in \@ComponentV2. For details, see [Common Scenarios](#v1-v2-1). +```ts +import { UIUtils } from '@kit.ArkUI'; + +@Observed +class ObservedClass { +} + +@Entry +@Component +struct CompV1 { + @State observedClass: ObservedClass = new ObservedClass(); + + build() { + Column() { + CompV2({ observedClass: UIUtils.enableV2Compatibility(this.observedClass) }) + } + } +} + +@ComponentV2 +struct CompV2 { + @Param observedClass: ObservedClass = new ObservedClass(); + + build() { + } +} +``` +- The state variables of V1 can be used to observe the first-layer properties. After **UIUtils.enableV2Compatibility** is called to transfer the variables to \@Param, \@Param is able to observe the changes of the first-layer properties. + +The following table lists the observation capability in specific scenarios after **enableV2Compatibility** is called. + +| \@Component (Parent) - > \@ComponentV2 (Child) | Observation Capability| +|------|----| +| Normal variable| No. **enableV2Compatibility** supports only state variables of V1.| +| \@Observed decorated class | The first-layer properties can be observed.| +| Variable decorated by the decorator of V1, whose type is Array, Map, Set, or Date. | API calls can be observed.| +| Variable decorated by the decorator of V1, whose type is class decorated by non-\@Observed. | The first-layer properties can be observed. Note that if the data source is \@ObjectLink, it must be the instance of the \@Observed decorated class or the return value of **makeV1Observed**.| +| Normal array. The array item is the class decorated by \@Observed. | No. The outer array is a non-V1 state variable, so this API does not take effect and the data source itself is returned.| +| Variable decorated by the decorator of V1, whose type is a normal array. The array item is the class decorated by \@Observed. | In \@Component, only the first layer can be observed. To observe the deeper layers, use \@ObjectLink together. You can observe the deeper layers in \@ComponentV2.| +| \@ObservedV2 decorated class | Observable in V1 and V2. The observation capability is derived from the \@ObservedV2 and \@Trace capabilities. **enableV2Compatibility** does not take effect.| +| Variable decorated by the decorator of V1, whose type is a normal array. The array item is the class decorated by \@ObservedV2.| Observable because **enableV2Compatibility** makes the outer array observable in V2. The property observation capability of the class decorated by \@ObservedV2 is derived from \@ObservedV2 and \@Trace, and is irrelevant to **enableV2Compatibility**.| + +### V2->V1 + +For V2 -> V1 transfer, you are advised to use **UIUtils.enableV2Compatibility(UIUtils.makeV1Observed())**. If this object is observable in V1, only **UIUtils.enableV2Compatibility** needs to be called. For details, see [Common Scenarios](#v2-v1-1). + +```ts +import { UIUtils } from '@kit.ArkUI'; + +@Observed +class ObservedClass {} + +@Entry +@ComponentV2 +struct CompV2 { + @Local observedClass: ObservedClass = UIUtils.enableV2Compatibility(new ObservedClass()); + build() { + Column() { + CompV1({ observedClass: this.observedClass }) + } + } +} + +@Component +struct CompV1 { + @ObjectLink observedClass: ObservedClass; + build() {} +} +``` + +The following table lists the specific scenarios. + +| \@ComponentV2 (Parent) -> \@Component (Child) | Observation Capability| +|------|----| +| \@Observed decorated nested class| In \@ComponentV2, you can observe the changes of nested properties.| +| Normal class | Observable. Call **makeV1Observed** to execute **enableV2Compatibility** properly.| +| Array\ or other simple arrays | Observable. **makeV1Observed** needs to be called.
Example: **@Local local : Array\ = UIUtils.enableV2Compatibility(UIUtils.makeV1Observed([1, 2, 3]))**| +| Array\ (The array item is a class decorated by \@Observed.) | Observable. **makeV1Observed** needs to be called.
Example: **@Local local : Array\ = UIUtils.enableV2Compatibility(UIUtils.makeV1Observed([new ObservedClass()]))**| +| Array\\>: two-dimensional array, array item, or other simple types| Observable. **makeV1Observed** needs to be called.
Example: **@Local local : Array>> = UIUtils.enableV2Compatibility(UIUtils.makeV1Observed([UIUtils.makeV1Observed([1, 2, 3])]))**| + + +## Mixed Use Rules +- When complex data is transferred from V1 to V2, call **enableV2Compatibility**; otherwise, data association between V1 and V2 cannot be implemented. It is recommended that **enableV2Compatibility** be called at the construction position of the V2 component. Otherwise, **enableV2Compatibility** needs to be manually called again when a value is assigned to the entire variable. + +```ts +// Recommended. When this.state = new ObservedClass() is called, UIUtils.enableV2Compatibility is not required, simplifying the code. +SubComponentV2({param: UIUtils.enableV2Compatibility(this.state)}) + +// Not recommended. When a value is assigned to the state as a whole, UIUtils.enableV2Compatibility needs to be called again. +// Otherwise, the variable of V1 transferred to SubComponentV2 cannot be observed in V2. +// @State state: ObservedClass = UIUtils.enableV2Compatibility(new ObservedClass()); +// this.state = UIUtils.enableV2Compatibility(new ObservedClass()) +SubComponentV2({param: this.state}) +``` + +- When complex data is transferred from V2 to V1, preferentially declare the state variable data of V1 in V2 and call **UIUtils.enableV2Compatibility**. This is because in state management V1, state variables have the capability of observing the first layer by default, while state management V2 has only the capability of observing itself. If you want to associate data between V1 and V2, you need to call **UIUtils.enableV2Compatibility(UIUtils.makeV1Observed())** to align the observation capabilities of both state managements. + +```ts +// Recommended. +@Local unObservedClass: UnObservedClass = UIUtils.enableV2Compatibility(UIUtils.makeV1Observed(new UnObservedClass())); + +// Recommended. ObservedClass is a class decorated by @Observed. +@Local observedClass: ObservedClass = UIUtils.enableV2Compatibility(new ObservedClass()); +``` +- **UIUtils.enableV2Compatibility(UIUtils.makeV1Observed())** does not change the observation capabilities of V1 and V2. + - In V1, **UIUtils.enableV2Compatibility(UIUtils.makeV1Observed())** is equal to the observation capability of V1, which can observe the value assignment of the data and the first-layer property. If in-depth observation is required, \@ObjectLink should be used together. + - In V2, **UIUtils.enableV2Compatibility(UIUtils.makeV1Observed())** can be used to observe deeper layers, but each layer must be a class decorated by \@Observed or a return value of **makeV1Observed**. +- After **UIUtils.enableV2Compatibility** is called, the observation capability of V2 is enabled for new data by default. However, you need to ensure that the new data is also the class decorated by \@Observed or the return value of **makeV1Observed**. For details about the complete example, see [Common Scenarios](#nested-type). +```ts +let arr: Array = UIUtils.enableV2Compatibility(UIUtils.makeV1Observed(new ArrayItem())); + +arr.push(new ArrayItem()); // The new data is not a state variable of V1. Therefore, the observation capability of V2 is unavailable. +arr.push(UIUtils.makeV1Observed(new ArrayItem())); // The new data is the state variable of V1, which can be observed in V2 by default. +``` +- For built-in types, such as Array, Map, Set, and Date, both V1 and V2 can observe the changes caused by their own value assignment and API calls. Although data refreshes can be implemented in some simple scenarios without calling **UIUtils.enableV2Compatibility**, dual proxies may cause poor performance. Therefore, **UIUtils.enableV2Compatibility(UIUtils.makeV1Observed())** is recommended. For details, see [Common Scenarios](#built-in-type). +- For classes with \@Track decorated properties, the system does not crash when non-\@Track decorated properties are used in \@ComponentV2 but still crashes when they are used in \@Component. For details, see [Common Scenarios](#observed-decorated-class). + +When calling the two APIs to use V1 and V2 together, you can comply with the logic shown in the following figure. + +![mix-usage](./figures/V1V2_mix_usage.png) + + +## Common Scenarios +### Normal JS Object +#### V1->V2 +**Recommended** + +```ts +import { UIUtils } from '@kit.ArkUI'; + +@Observed +class ObservedClass { + name: string = 'Tom'; +} + +@Entry +@Component +struct CompV1 { + @State observedClass: ObservedClass = new ObservedClass(); + + build() { + Column() { + Text(`@State observedClass: ${this.observedClass.name}`) + .onClick(() => { + this.observedClass.name += '!'; // Refresh + }) + // Call UIUtils.enableV2Compatibility to enable the state variable of V1 to be observed in @ComponentV2. + CompV2({ observedClass: UIUtils.enableV2Compatibility(this.observedClass) }) + } + } +} + +@ComponentV2 +struct CompV2 { + @Param observedClass: ObservedClass = new ObservedClass(); + + build() { + // After the observation capability of V2 is enabled for the state variable of V1, the first-layer changes can be observed in V2. + Text(`@Param observedClass: ${this.observedClass.name}`) + .onClick(() => { + this.observedClass.name += '!'; // Refresh + }) + } +} +``` +**Not recommended** + +In the following example, when the state variable of V1 is transferred to V2, the **enableV2Compatibility** API is not called, and the observation capability of V2 is not enabled. Therefore, **observedClass** cannot observe the change of the **name** property in **CompV2**. The observation capabilities of the same state variable in **CompV1** and **CompV2** are different. + +```ts +@Observed +class ObservedClass { + name: string = 'Tom'; +} + +@Entry +@Component +struct CompV1 { + @State observedClass: ObservedClass = new ObservedClass(); + + build() { + Column() { + Text(`@State observedClass: ${this.observedClass.name}`) + .onClick(() => { + this.observedClass.name += '!'; // Refresh + }) + // The enableV2Compatibility API is not called. The state variable of V1 cannot be observed in CompV2. + // The change of name cannot be observed in CompV2. + CompV2({ observedClass: this.observedClass }) + } + } +} + +@ComponentV2 +struct CompV2 { + @Param observedClass: ObservedClass = new ObservedClass(); + + build() { + Text(`@Param observedClass: ${this.observedClass.name}`) + .onClick(() => { + this.observedClass.name += '!'; // Do not refresh. + }) + } +} +``` +#### V2->V1 + +**Recommended** + +During V2->V1 transfer, to align the observation capabilities of V2 and V1, the **makeV1Observed** API needs to be called in V2. In addition, the observation capability of V2 needs to be enabled by calling the **enableV2Compatibility** API. Therefore, the recommended sample code is as follows: + +```ts +import { UIUtils } from '@kit.ArkUI'; + +class ObservedClass { + name: string = 'Tom'; +} + +@Entry +@ComponentV2 +struct CompV2 { + @Local observedClass: ObservedClass = UIUtils.enableV2Compatibility(UIUtils.makeV1Observed(new ObservedClass())); + + build() { + Column() { + // @Local can only observe itself. + // However, UIUtils.makeV1Observed is called to change @Local to the state variable of V1, whose first-layer changes are observable. + // Call UIUtils.enableV2Compatibility to make it observable in V2. + // Currently, you can observe the changes of the first-layer properties. + Text(`@Local observedClass: ${this.observedClass.name}`) + .onClick(() => { + this.observedClass.name += '!'; // Refresh + }) + // @ObjectLink can receive the instance of the @Observed decorated class or the return value of makeV1Observed. + CompV1({ observedClass: this.observedClass }) + } + } +} + +@Component +struct CompV1 { + @ObjectLink observedClass: ObservedClass; + + build() { + // The change of the first layer can be observed in CompV1. + Text(`@ObjectLink observedClass: ${this.observedClass.name}`) + .onClick(() => { + this.observedClass.name += '!'; // Refresh + }) + } +} +``` +**Not recommended** + +The observation capabilities of V1 and V2 are different. If **UIUtils.enableV2Compatibility(UIUtils.makeV1Observed())** is not called to directly transfer data, the data is not updated or the update behavior is inconsistent. + +```ts +class ObservedClass { + name: string = 'Tom'; +} + +@Entry +@ComponentV2 +struct CompV2 { + @Local observedClass: ObservedClass = new ObservedClass(); + + build() { + Column() { + // @Local can only observe itself. Property changes cannot be observed here. + Text(`@Local observedClass: ${this.observedClass.name}`) + .onClick(() => { + this.observedClass.name += '!'; // Do not refresh. + }) + // @ObjectLink cannot receive instances of non-@Observed decorated classes or return values of makeV1Observed. + // The log indicates that the current ObjectLink is assigned an invalid value. + CompV1({ observedClass1: this.observedClass, observedClass2: this.observedClass }) + } + } +} + +@Component +struct CompV1 { + @ObjectLink observedClass1: ObservedClass; + @State observedClass2: ObservedClass = new ObservedClass(); + + build() { + Column() { + // The value of @ObjectLink is invalid and does not respond to the UI re-render. + Text(`@ObjectLink observedClass: ${this.observedClass1.name}`) + .onClick(() => { + this.observedClass1.name += '!'; // Do not refresh. + }) + + // Different from @ObjectLink, @State wraps unobservable objects into observable objects of V1 by default. The changes of itself and attributes can be observed. + Text(`@State observedClass: ${this.observedClass2.name}`) + .onClick(() => { + this.observedClass2.name += '!'; // Refresh + }) + } + } +} +``` +### \@Observed Decorated Class +#### V1->V2 +In the following example: +- **ObservedClass** is the class decorated by \@Observed and enables the observation capability in V2. +- **name** is a @Track decorated property and is observable in both V1 and V2. +- **count** is a non-@Track decorated property and is invalid in both V1 and V2. + - In V1, if a non-@Track decorated property is used on the UI, an error is reported during runtime. + - In V2, no error is reported during runtime when non-@Track decorated properties are used on the UI, but the refresh is not responded. + +```ts +import { UIUtils } from '@kit.ArkUI'; + +@Observed +class ObservedClass { + @Track name: string = 'a'; + count: number = 0; +} + +@Entry +@Component +struct CompV1 { + @State observedClass: ObservedClass = new ObservedClass(); + build() { + Column() { + Text(`name: ${this.observedClass.name}`).onClick(() => { + // Trigger the refresh. + this.observedClass.name += 'a'; + }) + // If a non-@Track decorated variable is used in V1, the system crashes. + // Text(`count: ${this.observedClass.count}`) + + CompV2({ observedClass: UIUtils.enableV2Compatibility(this.observedClass) }) + } + } +} + +@ComponentV2 +struct CompV2 { + @Param observedClass: ObservedClass = new ObservedClass(); + build() { + // The system does not crash when a non-@Track variable is used in V2, but the refresh is not responded as well. + Text(`count: ${this.observedClass.count}`).onClick(() => { + // No refresh is triggered. + this.observedClass.count++; + }) + } +} +``` +#### V2->V1 +- **ObservedClass** is a class decorated by \@Observed. Therefore, when **UIUtils.enableV2Compatibility** is transferred to V1, **UIUtils.makeV1Observed** does not need to be called. +- Only the \@Track decorated variables can be observed in V1 and V2. If a non-\@Track variable is used in V1, an error is reported on the UI. In V2, no error is reported but the variable does not respond to the refresh. +```ts +import { UIUtils } from '@kit.ArkUI'; + +@Observed +class ObservedClass { + @Track name: string = 'a'; + count: number = 0; +} + +@Entry +@ComponentV2 +struct CompV1 { + @Local observedClass: ObservedClass = UIUtils.enableV2Compatibility(new ObservedClass()); + + build() { + Column() { + Text(`name: ${this.observedClass.name}`).onClick(() => { + // Trigger the refresh. + this.observedClass.name += 'a'; + }) + // The system does not crash when a non-@Track variable is used in V2, but the refresh is not triggered as well. + Text(`count: ${this.observedClass.count}`).onClick(() => { + this.observedClass.count++; + }) + + CompV2({ observedClass: this.observedClass }) + } + } +} + +@Component +struct CompV2 { + @ObjectLink observedClass: ObservedClass; + + build() { + Column() { + Text(`count: ${this.observedClass.name}`).onClick(() => { + // Trigger the refresh. + this.observedClass.name += 'a'; + }) + // If a non-@Track decorated variable is used in V1, the system crashes. + // Text(`count: ${this.observedClass.count}`) + } + } +} +``` + +### Built-in Type +The following uses Array as an example. +#### V1->V2 +**Recommended** + +```ts +import { UIUtils } from '@kit.ArkUI'; + +@Entry +@Component +struct ArrayCompV1 { + @State arr: Array = UIUtils.makeV1Observed([1, 2, 3]); + + build() { + Column() { + Text(`V1 ${this.arr[0]}`).onClick(() => { + // Click to trigger the changes of ArrayCompV1 and ArrayCompV2. + this.arr[0]++; + }) + // When the variable is transferred to V2, it is found that the current proxy is wrapped by makeV1Observed and the observation capability of V2 is enabled. + // In ArrayCompV2, Param does not wrap the proxy again to avoid the dual proxy problem. + ArrayCompV2({ arr: UIUtils.enableV2Compatibility(this.arr) }) + } + .height('100%') + .width('100%') + } +} + +@ComponentV2 +struct ArrayCompV2 { + @Param arr: Array = [1, 2, 3]; + + build() { + Column() { + Text(`V2 ${this.arr[0]}`).onClick(() => { + // Click to trigger the changes of ArrayCompV1 and ArrayCompV2. + this.arr[0]++; + }) + } + } +} +``` +**Not recommended** + +In the following example, enableV2Compatibility and makeV1Observed are not called. Therefore, the proxy and refresh in V1 and V2 are inconsistent. +```ts +@Entry +@Component +struct ArrayCompV1 { + @State arr: Array = [1, 2, 3]; + + build() { + Column() { + Text(`V1 ${this.arr[0]}`).onClick(() => { + // V1 proxy, which can trigger the refresh of ArrayCompV1 but cannot trigger the refresh of ArrayCompV2. + this.arr[0]++; + }) + // After being transferred to ArrayCompV2, the variable will be wrapped with a proxy of V2. + ArrayCompV2({ arr: this.arr }) + } + .height('100%') + .width('100%') + } +} + +@ComponentV2 +struct ArrayCompV2 { + @Param arr: Array = [1, 2, 3]; + + build() { + Column() { + Text(`V2 ${this.arr[0]}`).onClick(() => { + // V1 and V2 proxy, which can trigger refresh of ArrayCompV1 or ArrayCompV2. + this.arr[0]++; + }) + } + } +} +``` +#### V2->V1 +**Recommended** + +```ts +import { UIUtils } from '@kit.ArkUI'; + +@Entry +@ComponentV2 +struct ArrayCompV2 { + @Local arr: Array = UIUtils.enableV2Compatibility(UIUtils.makeV1Observed([1, 2, 3])); + + build() { + Column() { + Text(`V2 ${this.arr[0]}`).fontSize(20).onClick(() => { + // Click to trigger changes in V2 and synchronize the change to the @ObjectLink of V1. + this.arr[0]++; + }) + ArrayCompV1({ arr: this.arr }) + } + .height('100%') + .width('100%') + } +} + +@Component +struct ArrayCompV1 { + @ObjectLink arr: Array; + + build() { + Column() { + Text(`V1 ${this.arr[0]}`).fontSize(20).onClick(() => { + // Click to trigger the change of V1 and synchronize the change to V2 in a two-way manner. + this.arr[0]++; + }) + } + } +} + +``` +**Not recommended** + +In the following example, **enableV2Compatibility** and **makeV1Observed** are not called, and \@ObjectLink is initialized illegally so that it cannot observe the property changes. +However, because the state variables of V2 are transferred to \@ObjectLink, the refresh in V2 can be triggered. +```ts +@Entry +@ComponentV2 +struct ArrayCompV2 { + @Local arr: Array = [1, 2, 3]; + + build() { + Column() { + Text(`V2 ${this.arr[0]}`).fontSize(20).onClick(() => { + // Click to trigger changes in V2. + this.arr[0]++; + }) + // The data passed to @ObjectLink is not @Observed or makeV1Observed data + // Invalid operation. @ObjectLink cannot observe property changes. + ArrayCompV1({ arr: this.arr }) + } + .height('100%') + .width('100%') + } +} + +@Component +struct ArrayCompV1 { + @ObjectLink arr: Array; + + build() { + Column() { + Text(`V1 ${this.arr[0]}`).fontSize(20).onClick(() => { + // V2 is refreshed while V1 is not. + this.arr[0]++; + }) + } + } +} +``` +### Two-Dimensional Array +#### V1->V2 + +In the following example: +- **makeV1Observed** is used to change the inner array of the two-dimensional array to the state variables of V1. +- When the state variables of V1 are passed to the child component of V2, **enableV2Compatibility** is called to make them observable in V2 and avoid the dual proxy of V1 and V2. + +```ts +import { UIUtils } from '@kit.ArkUI'; + +@ComponentV2 +struct Item { + @Require @Param itemArr: Array; + + build() { + Row() { + ForEach(this.itemArr, (item: string, index: number) => { + Text(`${index}: ${item}`) + }, (item: string) => item + Math.random()) + + Button('@Param push') + .onClick(() => { + this.itemArr.push('Param'); + }) + } + } +} + +@Entry +@Component +struct IndexPage { + @State arr: Array> = + [UIUtils.makeV1Observed(['apple']), UIUtils.makeV1Observed(['banana']), UIUtils.makeV1Observed(['orange'])]; + + build() { + Column() { + ForEach(this.arr, (itemArr: Array) => { + Item({ itemArr: UIUtils.enableV2Compatibility(itemArr) }) + }, (itemArr: Array) => JSON.stringify(itemArr) + Math.random()) + Divider() + Button('@State push two-dimensional array item') + .onClick(() => { + this.arr[0].push('strawberry'); + }) + + Button('@State push array item') + .onClick(() => { + this.arr.push(UIUtils.makeV1Observed(['pear'])); + }) + + Button('@State change two-dimensional array first item') + .onClick(() => { + this.arr[0][0] = 'APPLE'; + }) + + Button('@State change array first item') + .onClick(() => { + this.arr[0] = UIUtils.makeV1Observed(['watermelon']); + }) + } + } +} +``` + +#### V2->V1 + +In the following example: +- **makeV1Observed** is used to change the inner array of the two-dimensional array to the state variables of V1. **enableV2Compatibility** is called to make them observable in V2 and avoid the dual proxy of V1 and V2. +- In V1, \@ObjectLink is used to receive the inner array of the two-dimensional array. Because the inner array is the return value of **makeV1Observed**, the refresh response is normal when **Button('@ObjectLink push')** is clicked. + +```ts +import { UIUtils } from '@kit.ArkUI'; + +@Component +struct Item { + @ObjectLink itemArr: Array; + + build() { + Row() { + ForEach(this.itemArr, (item: string, index: number) => { + Text(`${index}: ${item}`) + }, (item: string) => item + Math.random()) + + Button('@ObjectLink push') + .onClick(() => { + this.itemArr.push('ObjectLink'); + }) + } + } +} + +@Entry +@ComponentV2 +struct IndexPage { + @Local arr: Array> = + UIUtils.enableV2Compatibility(UIUtils.makeV1Observed([UIUtils.makeV1Observed(['apple']), + UIUtils.makeV1Observed(['banana']), UIUtils.makeV1Observed(['orange'])])); + + build() { + Column() { + ForEach(this.arr, (itemArr: Array) => { + Item({ itemArr: itemArr }) + }, (itemArr: Array) => JSON.stringify(itemArr) + Math.random()) + Divider() + Button('@Local push two-dimensional array item') + .onClick(() => { + this.arr[0].push('strawberry'); + }) + + Button('@Local push array item') + .onClick(() => { + this.arr.push(UIUtils.makeV1Observed(['pear'])); + }) + + Button('@Local change two-dimensional array first item') + .onClick(() => { + this.arr[0][0] = 'APPLE'; + }) + + Button('@Local change array first item') + .onClick(() => { + this.arr[0] = UIUtils.makeV1Observed(['watermelon']); + }) + } + } +} +``` + +### Nested Type +#### V1->V2 +The following shows an example of the nested scenario, +which can be summarized as follows: +- \@State can observe only the first-layer changes. To perform in-depth observation, variables should be transferred to \@ObjectLink. +- The change of the second layer of \@State cannot cause the refresh of the current layer. However, the change can be observed by \@ObjectLink and \@Param and triggers the re-render of the associated components. +- \@ObjectLink and \@Param are referenced by the same object. If their properties are changed, other references are refreshed. +- After **enableV2Compatibility** is enabled, V2 has the in-depth observation capability. +- If **enableV2Compatibility** is not called when transferring the object to V2, **Param** cannot observe the object properties. +```ts +// Not recommended. +NestedClassV2({ outer: this.outer }) +``` +A complete example is as follows: +```ts +import { UIUtils } from '@kit.ArkUI'; + +class ArrayItem { + value: number = 0; + + constructor(value: number) { + this.value = value; + } +} + +class Inner { + innerValue: string = 'inner'; + arr: Array; + + constructor(arr: Array) { + this.arr = arr; + } +} + +class Outer { + @Track outerValue: string = 'out'; + @Track inner: Inner; + + constructor(inner: Inner) { + this.inner = inner; + } +} + +@Entry +@Component +struct NestedClassV1 { + // Ensure that each layer uses the state variable of V1. + @State outer: Outer = + UIUtils.makeV1Observed(new Outer( + UIUtils.makeV1Observed(new Inner(UIUtils.makeV1Observed([ + UIUtils.makeV1Observed(new ArrayItem(1)), + UIUtils.makeV1Observed(new ArrayItem(2)) + ]))) + )); + + build() { + Column() { + Text(`@State outer.outerValue can update ${this.outer.outerValue}`) + .fontSize(20) + .onClick(() => { + // @State can observe the first-layer changes. + // Notify @ObjectLink and @Param of the change. + this.outer.outerValue += '!'; + }) + + Text(`@State outer.inner.innerValue cannot update ${this.outer.inner.innerValue}`) + .fontSize(20) + .onClick(() => { + // @State cannot observe the changes at the second layer. + // However, the change will be observed by @ObjectLink and @Param. + this.outer.inner.innerValue += '!'; + }) + // Transfer inner to @ObjectLink to observe the property change of inner. + NestedClassV1ObjectLink({ inner: this.outer.inner }) + // Pass the data for enabling enableV2Compatibility to V2. + NestedClassV2({ outer: UIUtils.enableV2Compatibility(this.outer) }) + } + .height('100%') + .width('100%') + } +} + +@Component +struct NestedClassV1ObjectLink { + @ObjectLink inner: Inner; + + build() { + Text(`@ObjectLink inner.innerValue can update ${this.inner.innerValue}`) + .fontSize(20) + .onClick(() => { + // Trigger refresh. @ObjectLink and @Param are referenced by the same object and @Param is also refreshed. + this.inner.innerValue += '!'; + }) + } +} + +@ComponentV2 +struct NestedClassV2 { + @Require @Param outer: Outer; + + build() { + Column() { + Text(`@Param outer.outerValue can update ${this.outer.outerValue}`) + .fontSize(20) + .onClick(() => { + // The value changes at the first layer can be observed. + this.outer.outerValue += '!'; + }) + Text(`@Param outer.inner.innerValue can update ${this.outer.inner.innerValue}`) + .fontSize(20) + .onClick(() => { + // Changes on the second layer can be obtained. @Param and @ObjectLink are referenced by the same object, which also triggers a refresh. + this.outer.inner.innerValue += '!'; + }) + + Repeat(this.outer.inner.arr) + .each((item: RepeatItem) => { + Text(`@Param outer.inner.arr index: ${item.index} item: ${item.item.value}`) + }) + + Button('@Param push').onClick(() => { + // The observation capability of V2 has been enabled for outer. For new data, the observation capability of V2 is enabled by default. + this.outer.inner.arr.push(UIUtils.makeV1Observed(new ArrayItem(20))); + }) + + Button('@Param change the last Item').onClick(() => { + // The property change of the last array item can be observed. + this.outer.inner.arr[this.outer.inner.arr.length - 1].value++; + }) + } + } +} +``` + +#### V2->V1 +- In the following example, **outer** in **NestedClassV2** calls **UIUtils.enableV2Compatibility**, and **UIUtils.makeV1Observed** is used in each layer. Therefore, **outer** has the in-depth observation capability in V2. +- In V1, only the changes at the first layer can be observed. Therefore, multiple layers of custom components are required, and each layer uses \@ObjectLink to receive data to implement in-depth observation. + +```ts +import { UIUtils } from '@kit.ArkUI'; + +class ArrayItem { + value: number = 0; + + constructor(value: number) { + this.value = value; + } +} + +class Inner { + innerValue: string = 'inner'; + arr: Array; + + constructor(arr: Array) { + this.arr = arr; + } +} + +class Outer { + @Track outerValue: string = 'out'; + @Track inner: Inner; + + constructor(inner: Inner) { + this.inner = inner; + } +} + +@Entry +@ComponentV2 +struct NestedClassV2 { + // Ensure that each layer uses the state variable of V1. + @Local outer: Outer = UIUtils.enableV2Compatibility( + UIUtils.makeV1Observed(new Outer( + UIUtils.makeV1Observed(new Inner(UIUtils.makeV1Observed([ + UIUtils.makeV1Observed(new ArrayItem(1)), + UIUtils.makeV1Observed(new ArrayItem(2)) + ]))) + ))); + + build() { + Column() { + Text(`@Local outer.outerValue can update ${this.outer.outerValue}`) + .fontSize(20) + .onClick(() => { + // The changes at the first layer can be observed. + this.outer.outerValue += '!'; + }) + + Text(`@Local outer.inner.innerValue can update ${this.outer.inner.innerValue}`) + .fontSize(20) + .onClick(() => { + // The changes at the second layer can be observed. + this.outer.inner.innerValue += '!'; + }) + // Transfer inner to @ObjectLink to observe the property change of inner. + NestedClassV1ObjectLink({ inner: this.outer.inner }) + } + .height('100%') + .width('100%') + } +} + +@Component +struct NestedClassV1ObjectLink { + @ObjectLink inner: Inner; + + build() { + Column() { + Text(`@ObjectLink inner.innerValue can update ${this.inner.innerValue}`) + .fontSize(20) + .onClick(() => { + // Trigger the refresh. + this.inner.innerValue += '!'; + }) + NestedClassV1ObjectLinkArray({ arr: this.inner.arr }) + } + } +} + +@Component +struct NestedClassV1ObjectLinkArray { + @ObjectLink arr: Array; + + build() { + Column() { + ForEach(this.arr, (item: ArrayItem) => { + NestedClassV1ObjectLinkArrayItem({ item: item }) + }, (item: ArrayItem, index: number) => { + return item.value.toString() + index.toString(); + }) + + Button('@ObjectLink push').onClick(() => { + this.arr.push(UIUtils.makeV1Observed(new ArrayItem(20))); + }) + + Button('@ObjectLink change the last Item').onClick(() => { + // Observe the property change of the last array item in NestedClassV1ObjectLinkArrayItem. + this.arr[this.arr.length - 1].value++; + }) + } + } +} + +@Component +struct NestedClassV1ObjectLinkArrayItem { + @ObjectLink item: ArrayItem; + + build() { + Text(`@ObjectLink outer.inner.arr item: ${this.item.value}`) + } +} + +``` + diff --git a/en/application-dev/website.md b/en/application-dev/website.md index 110a7a202fe..a40dde24754 100644 --- a/en/application-dev/website.md +++ b/en/application-dev/website.md @@ -237,9 +237,7 @@ - Many-to-Many Data Sharing - [Sharing Data via Unified Data Channels](database/unified-data-channels.md) - - Intelligent Data Construction and Retrieval - - [AIP Overview](database/aip-data-intelligence-overview.md) - - [Application Data Vectorization](database/aip-data-intelligence-embedding.md) + - [Application Data Vectorization](database/aip-data-intelligence-embedding.md) - [RelationalStore Development (C/C++)](database/native-relational-store-guidelines.md) - [UDMF Development (C/C++)](database/native-unified-data-management-framework-guidelines.md) - ArkTS @@ -252,13 +250,14 @@ - [XML Parsing](arkts-utils/xml-parsing.md) - [XML Conversion](arkts-utils/xml-conversion.md) - [Buffer](arkts-utils/buffer.md) + - [JSON Extension Library](arkts-utils/arkts-json.md) - ArkTS Container Library - [Overview of the ArkTS Container Library](arkts-utils/container-overview.md) - [Linear Containers](arkts-utils/linear-container.md) - [Nonlinear Containers](arkts-utils/nonlinear-container.md) - ArkTS Concurrency - [Overview of Concurrency](arkts-utils/concurrency-overview.md) - - [Asynchronous Concurrency (Promise and Async/Await)](arkts-utils/async-concurrency-overview.md) + - [Asynchronous Concurrency](arkts-utils/async-concurrency-overview.md) - Multithreaded Concurrency - [Overview of Multithreaded Concurrency](arkts-utils/multi-thread-concurrency-overview.md) - [TaskPool](arkts-utils/taskpool-introduction.md) @@ -267,6 +266,7 @@ - Inter-Thread Communication - [Overview of ArkTS Inter-Thread Communication](arkts-utils/interthread-communication-overview.md) - Inter-Thread Communication Objects + - [Overview of Inter-Thread Communication Objects](arkts-utils/serializable-overview.md) - [Regular Object](arkts-utils/normal-object.md) - [ArrayBuffer Object](arkts-utils/arraybuffer-object.md) - [SharedArrayBuffer Object](arkts-utils/shared-arraybuffer-object.md) @@ -311,6 +311,10 @@ - [ArkUI Waterfall Rendering](arkts-utils/taskpool-waterflow.md) - [Obtaining the Recently Accessed List](arkts-utils/sendablelrucache-recent-list.md) - [Canceling Tasks in Multithreading with TaskPool](arkts-utils/multi-thread-cancel-task.md) + - [Multithreaded Operations with Custom Native Transferable Objects](arkts-utils/napi-coerce-to-native-binding-object.md) + - [Multithreaded Operations with Custom Native Sendable Objects](arkts-utils/napi-define-sendable-object.md) + - [Persistent Worker Threads Handling Concurrent Tasks via TaskPool](arkts-utils/worker-and-taskpool.md) + - [Common Concurrency Issues](arkts-utils/concurrency-faq.md) - [ArkTS Cross-Language Interaction](arkts-utils/arkts-cross-language-interaction.md) - ArkTS Runtime - [Overview of ArkTS Runtime](arkts-utils/arkts-runtime-overview.md) @@ -332,12 +336,12 @@ - [Naming Conventions for Ark Bytecode Functions](arkts-utils/arkts-bytecode-function-name.md) - [Customizing Ark Bytecode During Compilation](arkts-utils/customize-bytecode-during-compilation.md) - [Disassembler](arkts-utils/tool-disassembler.md) - - ArkGuard for Code Obfuscation - - [Overview of ArkGuard](arkts-utils/source-obfuscation-overview.md) - - [Obfuscation Principles and Capabilities of ArkGuard](arkts-utils/source-obfuscation.md) - - [Using ArkGuard for Obfuscation](arkts-utils/source-obfuscation-guide.md) - - [Package-specific Obfuscation Recommendations](arkts-utils/source-obfuscation-practice.md) - - [Common Issues with ArkGuard](arkts-utils/source-obfuscation-questions.md) + - ArkGuard for Source Code Obfuscation + - [Overview of ArkGuard for Source Code Obfuscation](arkts-utils/source-obfuscation-overview.md) + - [ArkGuard Principles and Capabilities for Source Code Obfuscation](arkts-utils/source-obfuscation.md) + - [Using ArkGuard for Source Code Obfuscation](arkts-utils/source-obfuscation-guide.md) + - [Package-specific Source Code Obfuscation Recommendations](arkts-utils/source-obfuscation-practice.md) + - [Common Issues with ArkGuard in Source Code Obfuscation](arkts-utils/source-obfuscation-questions.md) - [Configuring arkOptions in build-profile.json5](arkts-utils/arkoptions-guide.md) - ArkUI - [Introduction to ArkUI](ui/arkui-overview.md) @@ -704,19 +708,14 @@ - [Debugging Frontend Pages by Using DevTools](web/web-debugging-with-devtools.md) - [Using Crashpad to Collect Web Component Crash Information](web/web-crashpad.md) - Background Tasks Kit - - - Background Task Management - - [Background Task Overview](task-management/background-task-overview.md) - - [Transient Task (ArkTS)](task-management/transient-task.md) - - [Transient Task (C/C++)](task-management/native-transient-task.md) - - [Continuous Task (ArkTS)](task-management/continuous-task.md) - - [Deferred Task (ArkTS)](task-management/work-scheduler.md) - - [Agent-powered Reminder (ArkTS)](task-management/agent-powered-reminder.md) - - - [Requesting Efficiency Resources (ArkTS) (for Privileged System Applications Only)](task-management/efficiency-resource-request.md) - - - - Device Usage Statistics (for System Applications Only) + - [Background Task Overview](task-management/background-task-overview.md) + - [Transient Task (ArkTS)](task-management/transient-task.md) + - [Transient Task (C/C++)](task-management/native-transient-task.md) + - [Continuous Task (ArkTS)](task-management/continuous-task.md) + - [Deferred Task (ArkTS)](task-management/work-scheduler.md) + - [Agent-powered Reminder (ArkTS)](task-management/agent-powered-reminder.md) + - [Requesting Efficiency Resources (ArkTS) (for Privileged System Applications Only)](task-management/efficiency-resource-request.md) + - Device Usage Statistics (ArkTS) (for System Applications Only) - [Device Usage Statistics Overview](device-usage-statistics/device-usage-statistics-overview.md) - [Device Usage Statistics Development](device-usage-statistics/device-usage-statistics-use-guide.md) @@ -1105,8 +1104,10 @@ - [Introduction to Connectivity Kit](connectivity/connectivity-kit-intro.md) - Bluetooth - [Bluetooth Overview](connectivity/bluetooth/bluetooth-overview.md) + - [Bluetooth Setting Development](connectivity/bluetooth/br-development-guide.md) - Classic Bluetooth - - [Bluetooth Setting Development](connectivity/bluetooth/br-development-guide.md) + - [BLE Advertising and Scanning Development](connectivity/bluetooth/br-discovery-development-guide.md) + - [Device Pairing](connectivity/bluetooth/br-pair-device-development-guide.md) - [SPP-based Data Transmission Development](connectivity/bluetooth/spp-development-guide.md) - BLE - [BLE Advertising and Scanning Development](connectivity/bluetooth/ble-development-guide.md) @@ -1118,6 +1119,9 @@ - WLAN - [WLAN Service Development Overview](connectivity/wlan/wlan-overview.md) - [P2P Development Guide](connectivity/wlan/p2p-development-guide.md) + - [STA Development](connectivity/wlan/sta-development-guide.md) + - [Wi-Fi Scanning Development](connectivity/wlan/scan-development-guide.md) + - [Terminology](connectivity/terminology.md) - Distributed Service Kit - [Introduction to Distributed Service Kit](distributedservice/distributedservice-kit-intro.md) - [Distributed Device Management Development](distributedservice/devicemanager-guidelines.md) @@ -1170,7 +1174,7 @@ - Account Management - [Account Management Overview](basic-services/account/account-overview.md) - - System Accounts + - System Accounts (for System Applications Only) - [Managing System Accounts](basic-services/account/manage-os-account.md) - [Applying Constraints for System Accounts](basic-services/account/control-os-account-by-constraints.md) - [Managing System Account Credentials](basic-services/account/manage-os-account-credential.md) @@ -1310,15 +1314,15 @@ - Task Execution Timeout Events - [Task Execution Timeout Event Overview](dfx/hiappevent-watcher-apphicollie-events.md) - [Subscribing to Task Execution Timeout Events (C/C++)](dfx/hiappevent-watcher-apphicollie-events-ndk.md) - + - [Event Reporting](dfx/hiappevent-event-reporting.md) - + - HiTraceMeter - - [Using HiTraceMeter (ArkTS/JS)](dfx/hitracemeter-guidelines-arkts.md) + - [Using HiTraceMeter (ArkTS)](dfx/hitracemeter-guidelines-arkts.md) - [Using HiTraceMeter (C/C++)](dfx/hitracemeter-guidelines-ndk.md) - [Viewing HiTraceMeter Logs](dfx/hitracemeter-view.md) - HiTraceChain - - [Using HiTraceChain (ArkTS/JS)](dfx/hitracechain-guidelines-arkts.md) + - [Using HiTraceChain (ArkTS)](dfx/hitracechain-guidelines-arkts.md) - [Using HiTraceChain (C/C++)](dfx/hitracechain-guidelines-ndk.md) - HiChecker - [Using HiChecker (ArkTS/JS)](dfx/hichecker-guidelines-arkts.md) @@ -1341,10 +1345,10 @@ - [hidumper](dfx/hidumper.md) - [hitrace](dfx/hitrace.md) - [hiperf](dfx/hiperf.md) - + - [hisysevent](dfx/hisysevent.md) - [uinput](dfx/uinput.md) - + - Test Kit - [arkXtest User Guide](application-test/arkxtest-guidelines.md) - [SmartPerf User Guide](application-test/smartperf-guidelines.md) @@ -1359,10 +1363,8 @@ - [Common Event Manager](tools/cem-tool.md) - [Advanced Notification Manager](tools/anm-tool.md) - [Enterprise Device Manager](tools/edm-tool.md) - - [restool](tools/restool.md) - - - [LLDB](tools/lldb-tool.md) - + - [restool](tools/restool.md) + - [LLDB](tools/lldb-tool.md) - [param](tools/param-tool.md) - [power-shell](tools/power-shell.md) - [Access Token Manager](tools/atm-tool.md) @@ -1637,7 +1639,6 @@ - [Resetting OAID Information (for System Applications Only)](ads-service/oaid/oaid-service-sys.md) - - Calendar Kit - [Introduction to Calendar Kit](calendarmanager/calendarmanager-overview.md) - [Calendar Management](calendarmanager/calendarmanager-calendar-developer.md) @@ -1668,6 +1669,9 @@ - [Adding a WantAgent Object to a Notification](notification/notification-with-wantagent.md) - [Enabling Quick Reply for Cross-device Notifications](notification/notification-quickreply.md) + + - [Cross-Device Notification Management (for System Applications Only)](notification/notification-distributed-notdistributed.md) + - [Updating a Notification](notification/notification-update.md) - [Canceling a Notification](notification/notification-cancel.md) @@ -1682,6 +1686,7 @@ - [Using the MindSpore Lite Engine for On-Device Training (C/C++)](ai/mindspore/mindspore-lite-train-guidelines.md) - [Using MindSpore Lite for Image Classification (ArkTS)](ai/mindspore/mindspore-guidelines-based-js.md) - [Using MindSpore Lite for Image Classification (C/C++)](ai/mindspore/mindspore-guidelines-based-native.md) + - [Using MindSpore Lite for Speech Recognition (C/C++)](ai/mindspore/mindspore-asr-based-native.md) - Neural Network Runtime Kit - [Introduction to Neural Network Runtime Kit](ai/nnrt/Neural-Network-Runtime-Kit-Introduction.md) - [Connecting the Neural Network Runtime to an AI Inference Framework](ai/nnrt/neural-network-runtime-guidelines.md) @@ -1742,46 +1747,46 @@ - [JSVM-API Data Types and APIs](napi/jsvm-data-types-interfaces.md) - [JSVM-API Development Process](napi/use-jsvm-process.md) - JSVM-API Development Specifications - - [JSVM-API Development Specifications](napi/jsvm-guidelines.md) - - [JSVM-API FAQs](napi/jsvm-frequently-questions.md) + - [JSVM-API Development Specifications](napi/jsvm-guidelines.md) + - [JSVM-API FAQs](napi/jsvm-frequently-questions.md) - JSVM-API Usage Guide - - [Working with Task Queues Using JSVM-API](napi/use-jsvm-execute_tasks.md) - - [Working with VM Snapshots Using JSVM-API](napi/use-jsvm-create-snapshot.md) - - [Developing Wasm Using JSVM-API](napi/use-jsvm-about-wasm.md) - - [Creating and Calling JS Functions Using JSVM-API](napi/use-jsvm-function-call.md) - - [Performing JSON Operations Using JSVM-API](napi/use-jsvm-about-JSON.md) - - [Working with Arrays Using JSVM-API](napi/use-jsvm-about-array.md) - - [Working with ArrayBuffer Using JSVM-API](napi/use-jsvm-about-arraybuffer.md) - - [Working with BigInt Using JSVM-API](napi/use-jsvm-about-bigint.md) - - [Working with Classes Using JSVM-API](napi/use-jsvm-about-class.md) - - [Working with Date Using JSVM-API](napi/use-jsvm-about-date.md) - - [Working with Objects Using JSVM-API](napi/use-jsvm-about-object.md) - - [Working with Primitives Using JSVM-API](napi/use-jsvm-about-primitive.md) - - [Implementing Asynchronous Operations Using JSVM-API](napi/use-jsvm-about-promise.md) - - [Setting JS Object Properties Using JSVM-API](napi/use-jsvm-about-property.md) - - [Creating and Obtaining String Values Using JSVM-API](napi/use-jsvm-about-string.md) - - [Obtaining the JSVM API Version Using JSVM-API](napi/use-jsvm-about-version.md) - - [Error Handling Using JSVM-API](napi/use-jsvm-error.md) - - [Debugging and Profiling JS Code Using JSVM-API](napi/use-jsvm-heapstatistics-debugger-cpuprofiler-heapsnapshot.md) - - [Performing Lifecycle Management Using JSVM-API](napi/use-jsvm-life-cycle.md) - - [Performing Memory Management Using JSVM-API](napi/use-jsvm-memory-management.md) - - [Comparing JS Values Using JSVM-API](napi/use-jsvm-strict-equals.md) - - [Customizing Exception Handling Using JSVM-API](napi/use-jsvm-trigger-exceptions.md) - - [Triggering GC Using JSVM-API](napi/use-jsvm-trigger-gc.md) - - [Setting the private Property Using JSVM-API](napi/use-jsvm-about-private.md) - - [Working with Latin1/UTF16 Strings Using JSVM-API](napi/use-jsvm-about-external-string.md) - - [Working with Proxy Using JSVM-API](napi/use-jsvm-about-proxy.md) - - [Working with Well-Known Symbols Using JSVM-API](napi/use-jsvm-about-well-known-symbols.md) - - [Working with Wrapper Objects Using JSVM-API](napi/use-jsvm-about-wrapper-object.md) - - [Creating Basic Data Types Using JSVM-API](napi/use-jsvm-basic-data-types.md) + - [Working with Task Queues Using JSVM-API](napi/use-jsvm-execute_tasks.md) + - [Working with VM Snapshots Using JSVM-API](napi/use-jsvm-create-snapshot.md) + - [Developing Wasm Using JSVM-API](napi/use-jsvm-about-wasm.md) + - [Creating and Calling JS Functions Using JSVM-API](napi/use-jsvm-function-call.md) + - [Performing JSON Operations Using JSVM-API](napi/use-jsvm-about-JSON.md) + - [Working with Arrays Using JSVM-API](napi/use-jsvm-about-array.md) + - [Working with ArrayBuffer Using JSVM-API](napi/use-jsvm-about-arraybuffer.md) + - [Working with BigInt Using JSVM-API](napi/use-jsvm-about-bigint.md) + - [Working with Classes Using JSVM-API](napi/use-jsvm-about-class.md) + - [Working with Date Using JSVM-API](napi/use-jsvm-about-date.md) + - [Working with Objects Using JSVM-API](napi/use-jsvm-about-object.md) + - [Working with Primitives Using JSVM-API](napi/use-jsvm-about-primitive.md) + - [Implementing Asynchronous Operations Using JSVM-API](napi/use-jsvm-about-promise.md) + - [Setting JS Object Properties Using JSVM-API](napi/use-jsvm-about-property.md) + - [Creating and Obtaining String Values Using JSVM-API](napi/use-jsvm-about-string.md) + - [Obtaining the JSVM API Version Using JSVM-API](napi/use-jsvm-about-version.md) + - [Error Handling Using JSVM-API](napi/use-jsvm-error.md) + - [Debugging and Profiling JS Code Using JSVM-API](napi/use-jsvm-heapstatistics-debugger-cpuprofiler-heapsnapshot.md) + - [Performing Lifecycle Management Using JSVM-API](napi/use-jsvm-life-cycle.md) + - [Performing Memory Management Using JSVM-API](napi/use-jsvm-memory-management.md) + - [Comparing JS Values Using JSVM-API](napi/use-jsvm-strict-equals.md) + - [Customizing Exception Handling Using JSVM-API](napi/use-jsvm-trigger-exceptions.md) + - [Triggering GC Using JSVM-API](napi/use-jsvm-trigger-gc.md) + - [Setting the private Property Using JSVM-API](napi/use-jsvm-about-private.md) + - [Working with Latin1/UTF16 Strings Using JSVM-API](napi/use-jsvm-about-external-string.md) + - [Working with Proxy Using JSVM-API](napi/use-jsvm-about-proxy.md) + - [Working with Well-Known Symbols Using JSVM-API](napi/use-jsvm-about-well-known-symbols.md) + - [Working with Wrapper Objects Using JSVM-API](napi/use-jsvm-about-wrapper-object.md) + - [Creating Basic Data Types Using JSVM-API](napi/use-jsvm-basic-data-types.md) - JSVM-API Use Cases - - [JSVM-API Debugging](napi/jsvm-debugger-cpuprofiler-heapsnapshot.md) - - [JSVM-API Tracing](napi/use-jsvm-about-trace.md) - - [Requesting the JIT Profile for JSVMs](napi/jsvm-apply-jit-profile.md) - - JSVM-API Tuning and Performant Coding Cases - - [Creating and Destroying JS VMs Using JSVM-API](napi/use-jsvm-runtime-task.md) - - [Accelerating Compilation Using a Code Cache](napi/use-jsvm-about-code-cache.md) - - [JSVM Tuning Practices](napi/jsvm-optimizations.md) + - [JSVM-API Debugging](napi/jsvm-debugger-cpuprofiler-heapsnapshot.md) + - [JSVM-API Tracing](napi/use-jsvm-about-trace.md) + - [Requesting the JIT Profile for JSVMs](napi/jsvm-apply-jit-profile.md) + - JSVM-API Tuning and Performant Coding Cases + - [Creating and Destroying JS VMs Using JSVM-API](napi/use-jsvm-runtime-task.md) + - [Accelerating Compilation Using a Code Cache](napi/use-jsvm-about-code-cache.md) + - [JSVM Tuning Practices](napi/jsvm-optimizations.md) - OpenMP Support - [OpenMP Overview](napi/openmp-overview.md) - [Building and Running Applications Using OpenMP](napi/openmp-guideline.md) @@ -2365,7 +2370,7 @@ - [Foreground Effect](reference/apis-arkui/arkui-ts/ts-universal-attributes-foreground-effect.md) - [Foreground Blur](reference/apis-arkui/arkui-ts/ts-universal-attributes-foreground-blur-style.md) - [Motion Blur](reference/apis-arkui/arkui-ts/ts-universal-attributes-motionBlur.md) - - [Click Effect](reference/apis-arkui/arkui-ts/ts-universal-attributes-click-effect.md) + - [Click Feedback Effect](reference/apis-arkui/arkui-ts/ts-universal-attributes-click-effect.md) - [Accessibility](reference/apis-arkui/arkui-ts/ts-universal-attributes-accessibility.md) - [Attribute Modifier](reference/apis-arkui/arkui-ts/ts-universal-attributes-attribute-modifier.md) - [Gesture Modifier](reference/apis-arkui/arkui-ts/ts-universal-attributes-gesture-modifier.md) @@ -2413,7 +2418,7 @@ - [Row](reference/apis-arkui/arkui-ts/ts-container-row.md) - [Stack](reference/apis-arkui/arkui-ts/ts-container-stack.md) - [RelativeContainer](reference/apis-arkui/arkui-ts/ts-container-relativecontainer.md) - + - [Flex (System API)](reference/apis-arkui/arkui-ts/ts-container-flex-sys.md) - [Column (System API)](reference/apis-arkui/arkui-ts/ts-container-column-sys.md) - [Row (System API)](reference/apis-arkui/arkui-ts/ts-container-row-sys.md) @@ -2564,7 +2569,7 @@ - [Immediate Delivery of Explicit Animation (animateToImmediately)](reference/apis-arkui/arkui-ts/ts-explicit-animatetoimmediately.md) - [Implicit Shared Element Transition (geometryTransition) (System API)](reference/apis-arkui/arkui-ts/ts-transition-animation-geometrytransition-sys.md) - + - Dialog Boxes - [Alert Dialog Box (AlertDialog)](reference/apis-arkui/arkui-ts/ts-methods-alert-dialog-box.md) - [Action Sheet (ActionSheet)](reference/apis-arkui/arkui-ts/ts-methods-action-sheet.md) @@ -2927,7 +2932,7 @@ - [promptAction Error Codes](reference/apis-arkui/errorcode-promptAction.md) - [Router Error Codes](reference/apis-arkui/errorcode-router.md) - [Drag Event Error Codes](reference/apis-arkui/errorcode-drag-event.md) - - [AI Image Analyzer Error Codes](reference/apis-arkui/errorcode-image-analyzer.md) + - [AI Image Analyzer Error Codes](reference/apis-arkui/arkui-ts/errorcode-image-analyzer.md) - [Focus Error Codes](reference/apis-arkui/errorcode-focus.md) - [System Resource Error Codes](reference/apis-arkui/errorcode-system-resource.md) - [Sheet Error Codes](reference/apis-arkui/errorcode-bindSheet.md) @@ -2948,27 +2953,27 @@ - C APIs - Modules - [Web](reference/apis-arkweb/_web.md) - - Header Files - - [arkweb_error_code.h](reference/apis-arkweb/arkweb__error__code_8h.md) - - [arkweb_interface.h](reference/apis-arkweb/arkweb__interface_8h.md) - - [arkweb_net_error_list.h](reference/apis-arkweb/arkweb__net__error__list_8h.md) - - [arkweb_scheme_handler.h](reference/apis-arkweb/arkweb__scheme__handler_8h.md) - - [arkweb_type.h](reference/apis-arkweb/arkweb__type_8h.md) - - [native_interface_arkweb.h](reference/apis-arkweb/native__interface__arkweb_8h.md) - - Structs - - [ArkWeb_AnyNativeAPI](reference/apis-arkweb/_ark_web___any_native_a_p_i.md) - - [ArkWeb_ComponentAPI](reference/apis-arkweb/_ark_web___component_a_p_i.md) - - [ArkWeb_ControllerAPI](reference/apis-arkweb/_ark_web___controller_a_p_i.md) - - [ArkWeb_CookieManagerAPI](reference/apis-arkweb/_ark_web___cookie_manager_a_p_i.md) - - [ArkWeb_JavaScriptBridgeData](reference/apis-arkweb/_ark_web___java_script_bridge_data.md) - - [ArkWeb_JavaScriptObject](reference/apis-arkweb/_ark_web___java_script_object.md) - - [ArkWeb_JavaScriptValueAPI](reference/apis-arkweb/_ark_web___java_script_value_a_p_i.md) - - [ArkWeb_ProxyMethod](reference/apis-arkweb/_ark_web___proxy_method.md) - - [ArkWeb_ProxyMethodWithResult](reference/apis-arkweb/_ark_web___proxy_method_with_result.md) - - [ArkWeb_ProxyObject](reference/apis-arkweb/_ark_web___proxy_object.md) - - [ArkWeb_ProxyObjectWithResult](reference/apis-arkweb/_ark_web___proxy_object_with_result.md) - - [ArkWeb_WebMessageAPI](reference/apis-arkweb/_ark_web___web_message_a_p_i.md) - - [ArkWeb_WebMessagePortAPI](reference/apis-arkweb/_ark_web___web_message_port_a_p_i.md) + - Header Files + - [arkweb_error_code.h](reference/apis-arkweb/arkweb__error__code_8h.md) + - [arkweb_interface.h](reference/apis-arkweb/arkweb__interface_8h.md) + - [arkweb_net_error_list.h](reference/apis-arkweb/arkweb__net__error__list_8h.md) + - [arkweb_scheme_handler.h](reference/apis-arkweb/arkweb__scheme__handler_8h.md) + - [arkweb_type.h](reference/apis-arkweb/arkweb__type_8h.md) + - [native_interface_arkweb.h](reference/apis-arkweb/native__interface__arkweb_8h.md) + - Structs + - [ArkWeb_AnyNativeAPI](reference/apis-arkweb/_ark_web___any_native_a_p_i.md) + - [ArkWeb_ComponentAPI](reference/apis-arkweb/_ark_web___component_a_p_i.md) + - [ArkWeb_ControllerAPI](reference/apis-arkweb/_ark_web___controller_a_p_i.md) + - [ArkWeb_CookieManagerAPI](reference/apis-arkweb/_ark_web___cookie_manager_a_p_i.md) + - [ArkWeb_JavaScriptBridgeData](reference/apis-arkweb/_ark_web___java_script_bridge_data.md) + - [ArkWeb_JavaScriptObject](reference/apis-arkweb/_ark_web___java_script_object.md) + - [ArkWeb_JavaScriptValueAPI](reference/apis-arkweb/_ark_web___java_script_value_a_p_i.md) + - [ArkWeb_ProxyMethod](reference/apis-arkweb/_ark_web___proxy_method.md) + - [ArkWeb_ProxyMethodWithResult](reference/apis-arkweb/_ark_web___proxy_method_with_result.md) + - [ArkWeb_ProxyObject](reference/apis-arkweb/_ark_web___proxy_object.md) + - [ArkWeb_ProxyObjectWithResult](reference/apis-arkweb/_ark_web___proxy_object_with_result.md) + - [ArkWeb_WebMessageAPI](reference/apis-arkweb/_ark_web___web_message_a_p_i.md) + - [ArkWeb_WebMessagePortAPI](reference/apis-arkweb/_ark_web___web_message_port_a_p_i.md) - Error Codes - [Webview Error Codes](reference/apis-arkweb/errorcode-webview.md) - Background Tasks Kit @@ -3009,7 +3014,9 @@ - [TransientTask_DelaySuspendInfo](reference/apis-backgroundtasks-kit/_transient_task___delay_suspend_info.md) - Error Codes - [BackgroundTaskManager Error Codes](reference/apis-backgroundtasks-kit/errorcode-backgroundTaskMgr.md) + - [DeviceUsageStatistics Error Codes](reference/apis-backgroundtasks-kit/errorcode-DeviceUsageStatistics.md) + - [reminderAgentManager Error Codes](reference/apis-backgroundtasks-kit/errorcode-reminderAgentManager.md) - [workScheduler Error Codes](reference/apis-backgroundtasks-kit/errorcode-workScheduler.md) - Core File Kit @@ -3035,6 +3042,7 @@ - [@ohos.file.fileAccess (User File Access and Management) (System API)](reference/apis-core-file-kit/js-apis-fileAccess-sys.md) - [@ohos.file.fileExtensionInfo (User File Extension Information) (System API)](reference/apis-core-file-kit/js-apis-fileExtensionInfo-sys.md) - [@ohos.file.keyManager (User Key Management) (System API)](reference/apis-core-file-kit/js-apis-file-keymanager-sys.md) + - [@ohos.file.picker (Picker) (System API)](reference/apis-core-file-kit/js-apis-file-picker-sys.md) - [@ohos.file.recent (Latest Access List) (System API)](reference/apis-core-file-kit/js-apis-file-recent-sys.md) - [@ohos.file.storageStatistics (Application Space Statistics) (System API)](reference/apis-core-file-kit/js-apis-file-storage-statistics-sys.md) - [@ohos.file.trash (Trash) (System API)](reference/apis-core-file-kit/js-apis-file-trash-sys.md) @@ -3084,7 +3092,7 @@ - [FormEditExtensionContext](reference/apis-form-kit/js-apis-inner-application-formEditExtensionContext.md) - [FormExtensionContext (System API)](reference/apis-form-kit/js-apis-inner-application-formExtensionContext-sys.md) - + - APIs No Longer Maintained - [@ohos.application.formBindingData (formBindingData)](reference/apis-form-kit/js-apis-application-formBindingData.md) - [@ohos.application.formError (FormError)](reference/apis-form-kit/js-apis-application-formError.md) @@ -3136,13 +3144,13 @@ - [OHIPCErrorCode](reference/apis-ipc-kit/_o_h_i_p_c_error_code.md) - [IPCKit](reference/apis-ipc-kit/_i_p_c_kit.md) - Header Files - - [ipc_cparcel.h](reference/apis-ipc-kit/ipc__cparcel_8h.md) - - [ipc_cremote_object.h](reference/apis-ipc-kit/ipc__cremote__object_8h.md) - - [ipc_cskeleton.h](reference/apis-ipc-kit/ipc__cskeleton_8h.md) - - [ipc_error_code.h](reference/apis-ipc-kit/ipc__error__code_8h.md) - - [ipc_kit.h](reference/apis-ipc-kit/ipc__kit_8h.md) + - [ipc_cparcel.h](reference/apis-ipc-kit/ipc__cparcel_8h.md) + - [ipc_cremote_object.h](reference/apis-ipc-kit/ipc__cremote__object_8h.md) + - [ipc_cskeleton.h](reference/apis-ipc-kit/ipc__cskeleton_8h.md) + - [ipc_error_code.h](reference/apis-ipc-kit/ipc__error__code_8h.md) + - [ipc_kit.h](reference/apis-ipc-kit/ipc__kit_8h.md) - Structs - - [OH_IPC_MessageOption](reference/apis-ipc-kit/_o_h___i_p_c___message_option.md) + - [OH_IPC_MessageOption](reference/apis-ipc-kit/_o_h___i_p_c___message_option.md) - Error Codes - [RPC Error Codes](reference/apis-ipc-kit/errorcode-rpc.md) - Localization Kit @@ -3155,7 +3163,7 @@ - [@ohos.i18n (Internationalization) (System API)](reference/apis-localization-kit/js-apis-i18n-sys.md) - global - - [RawFileDescriptor](reference/apis-localization-kit/js-apis-rawFileDescriptor.md) + - [RawFileDescriptor](reference/apis-localization-kit/js-apis-rawFileDescriptor.md) - [Resource](reference/apis-localization-kit/js-apis-resource.md) - [SendableResource](reference/apis-localization-kit/js-apis-sendableResource.md) - C APIs @@ -3320,6 +3328,7 @@ - [@ohos.bluetooth.constant (Bluetooth Constant Module) (Recommended) (System API)](reference/apis-connectivity-kit/js-apis-bluetooth-constant-sys.md) - [@ohos.bluetooth.hfp (Bluetooth HFP Module) (Recommended) (System API)](reference/apis-connectivity-kit/js-apis-bluetooth-hfp-sys.md) - [@ohos.bluetooth.hid (Bluetooth HID Module) (Recommended) (System API)](reference/apis-connectivity-kit/js-apis-bluetooth-hid-sys.md) + - [@ohos.bluetooth.opp (Bluetooth OPP Module) (System API)](reference/apis-connectivity-kit/js-apis-bluetooth-opp-sys.md) - [@ohos.bluetooth.pan (Bluetooth PAN Module) (Recommended) (System API)](reference/apis-connectivity-kit/js-apis-bluetooth-pan-sys.md) - [@ohos.bluetooth.pbap (Bluetooth PBAP Module) (Recommended) (System API)](reference/apis-connectivity-kit/js-apis-bluetooth-pbap-sys.md) - [@ohos.bluetooth.map (Bluetooth MAP module) (Recommended) (System API)](reference/apis-connectivity-kit/js-apis-bluetooth-map-sys.md) @@ -3454,7 +3463,7 @@ - [@ohos.telephony.radio (Radio)](reference/apis-telephony-kit/js-apis-radio.md) - [@ohos.telephony.sim (SIM Management)](reference/apis-telephony-kit/js-apis-sim.md) - [@ohos.telephony.sms (SMS)](reference/apis-telephony-kit/js-apis-sms.md) - + - [@ohos.telephony.call (Call) (System API)](reference/apis-telephony-kit/js-apis-call-sys.md) - [@ohos.telephony.data (Cellular Data) (System API)](reference/apis-telephony-kit/js-apis-telephony-data-sys.md) - [@ohos.telephony.esim (eSIM Management) (System API)](reference/apis-telephony-kit/js-apis-esim-sys.md) @@ -3463,7 +3472,7 @@ - [@ohos.telephony.sim (SIM Management) (System API)](reference/apis-telephony-kit/js-apis-sim-sys.md) - [@ohos.telephony.sms (SMS) (System API)](reference/apis-telephony-kit/js-apis-sms-sys.md) - [@ohos.telephony.vcard (VCard) (System API)](reference/apis-telephony-kit/js-apis-vcard-sys.md) - + - C APIs - Modules - [Telephony Data](reference/apis-telephony-kit/ndk-apis-telephony-data.md) @@ -3494,6 +3503,7 @@ - [@ohos.runningLock (Running Lock)](reference/apis-basic-services-kit/js-apis-runninglock.md) - [@ohos.thermal (Thermal Management)](reference/apis-basic-services-kit/js-apis-thermal.md) - [@ohos.usbManager (USB Manager)](reference/apis-basic-services-kit/js-apis-usbManager.md) + - [@ohos.usbManager.serial (Serial Port Management)](reference/apis-basic-services-kit/js-apis-serialManager.md) - [@ohos.batteryInfo (Battery Information) (System API)](reference/apis-basic-services-kit/js-apis-battery-info-sys.md) - [@ohos.batteryStatistics (Power Consumption Statistics) (System API)](reference/apis-basic-services-kit/js-apis-batteryStatistics-sys.md) @@ -3505,6 +3515,7 @@ - [@ohos.systemParameterEnhance (System Parameter) (System API)](reference/apis-basic-services-kit/js-apis-system-parameterEnhance-sys.md) - [@ohos.screenLock (Screen Lock) (System API)](reference/apis-basic-services-kit/js-apis-screen-lock-sys.md) - [@ohos.usbManager (USB Management) (System API)](reference/apis-basic-services-kit/js-apis-usbManager-sys.md) + - [@ohos.usbManager.serial (Serial Port Management) (system API)](reference/apis-basic-services-kit/js-apis-serialManager-sys.md) - [@ohos.update (Update) (System API)](reference/apis-basic-services-kit/js-apis-update-sys.md) - Data File Processing @@ -3636,6 +3647,7 @@ - [loop.h](reference/apis-ffrt-kit/loop_8h.md) - [mutex.h](reference/apis-ffrt-kit/mutex_8h.md) - [queue.h](reference/apis-ffrt-kit/queue_8h.md) + - [shared_mutex.h](reference/apis-ffrt-kit/shared__mutex_8h.md) - [sleep.h](reference/apis-ffrt-kit/sleep_8h.md) - [task.h](reference/apis-ffrt-kit/task_8h.md) - [timer.h](reference/apis-ffrt-kit/timer_8h.md) @@ -3649,6 +3661,8 @@ - [ffrt_mutex_t](reference/apis-ffrt-kit/ffrt__mutex__t.md) - [ffrt_mutexattr_t](reference/apis-ffrt-kit/ffrt__mutexattr__t.md) - [ffrt_queue_attr_t](reference/apis-ffrt-kit/ffrt__queue__attr__t.md) + - [ffrt_rwlock_t](reference/apis-ffrt-kit/ffrt__rwlock__t.md) + - [ffrt_rwlockattr_t](reference/apis-ffrt-kit/ffrt__rwlockattr__t.md) - [ffrt_task_attr_t](reference/apis-ffrt-kit/ffrt__task__attr__t.md) - Input Kit - ArkTS APIs @@ -3662,11 +3676,11 @@ - [@ohos.multimodalInput.pointer (Mouse Pointer)](reference/apis-input-kit/js-apis-pointer.md) - [@ohos.multimodalInput.touchEvent (Touch Event)](reference/apis-input-kit/js-apis-touchevent.md) - [@ohos.multimodalInput.infraredEmitter (IR Management)](reference/apis-input-kit/js-apis-infraredemitter.md) - - [@ohos.multimodalInput.inputConsumer (Input Consumer)](reference/apis-input-kit/js-apis-inputconsumer.md) + - [@ohos.multimodalInput.inputConsumer (Global Shortcut Keys)](reference/apis-input-kit/js-apis-inputconsumer.md) - [@ohos.multimodalInput.pointer (Mouse Pointer) (System API)](reference/apis-input-kit/js-apis-pointer-sys.md) - - [@ohos.multimodalInput.shortKey (Shortcut Key) (System API)](reference/apis-input-kit/js-apis-shortKey-sys.md) - - [@ohos.multimodalInput.inputConsumer (Input Consumer) (System API)](reference/apis-input-kit/js-apis-inputconsumer-sys.md) + - [@ohos.multimodalInput.shortKey (Preset Global Shortcut Keys) (System API)](reference/apis-input-kit/js-apis-shortKey-sys.md) + - [@ohos.multimodalInput.inputConsumer (Global Shortcut Keys) (System API)](reference/apis-input-kit/js-apis-inputconsumer-sys.md) - [@ohos.multimodalInput.inputDevice (Input Device) (System API)](reference/apis-input-kit/js-apis-inputdevice-sys.md) - [@ohos.multimodalInput.inputEventClient (Input Event Injection) (System API)](reference/apis-input-kit/js-apis-inputeventclient-sys.md) - [@ohos.multimodalInput.inputMonitor (Input Monitor) (System API)](reference/apis-input-kit/js-apis-inputmonitor-sys.md) @@ -3676,19 +3690,30 @@ - C APIs - Modules - - [Input](reference/apis-input-kit/input.md) + - [Input](reference/apis-input-kit/capi-input.md) - Header Files - - [oh_axis_type.h](reference/apis-input-kit/oh__axis__type_8h.md) - - [oh_input_manager.h](reference/apis-input-kit/oh__input__manager_8h.md) - - [oh_key_code.h](reference/apis-input-kit/oh__key__code_8h.md) + - [oh_axis_type.h](reference/apis-input-kit/capi-oh-axis-type-h.md) + - [oh_input_manager.h](reference/apis-input-kit/capi-oh-input-manager-h.md) + - [oh_key_code.h](reference/apis-input-kit/capi-oh-key-code-h.md) - Structs - - [Input_DeviceListener](reference/apis-input-kit/_input___device_listener.md) - - [Input_InterceptorEventCallback](reference/apis-input-kit/_input___interceptor_event_callback.md) + - [Input_InterceptorEventCallback](reference/apis-input-kit/capi-input-interceptoreventcallback.md) + - [Input_DeviceListener](reference/apis-input-kit/capi-input-devicelistener.md) + - [Input_KeyState](reference/apis-input-kit/capi-input-keystate.md) + - [Input_KeyEvent](reference/apis-input-kit/capi-input-keyevent.md) + - [Input_MouseEvent](reference/apis-input-kit/capi-input-mouseevent.md) + - [Input_TouchEvent](reference/apis-input-kit/capi-input-touchevent.md) + - [Input_AxisEvent](reference/apis-input-kit/capi-input-axisevent.md) + - [Input_Hotkey](reference/apis-input-kit/capi-input-hotkey.md) + - [Input_DeviceInfo](reference/apis-input-kit/capi-input-deviceinfo.md) + - [Input_InterceptorOptions](reference/apis-input-kit/capi-input-interceptoroptions.md) - Error Codes - - [Screen Hopping Error Codes](reference/apis-input-kit/errorcode-multimodalinput.md) + + - [Screen Hopping Error Codes](reference/apis-input-kit/errorcode-cooperator.md) + - [Input Monitor Error Codes](reference/apis-input-kit/errorcode-inputmonitor.md) + - [Input Consumer Error Codes](reference/apis-input-kit/errorcode-inputconsumer.md) - - [Input Key Monitor Error Codes](reference/apis-input-kit/errorcode-inputkeymonitor.md) - [Input Device Error Codes](reference/apis-input-kit/errorcode-inputdevice.md) + - [Mouse Pointer Error Codes](reference/apis-input-kit/errorcode-pointer.md) - MDM Kit - ArkTS APIs - [@ohos.enterprise.accountManager (Account Management)](reference/apis-mdm-kit/js-apis-enterprise-accountManager.md) @@ -3886,17 +3911,17 @@ - Test Kit - ArkTS APIs - - [@ohos.app.ability.abilityDelegatorRegistry (AbilityDelegatorRegistry)](reference/apis-test-kit/js-apis-app-ability-abilityDelegatorRegistry.md) - - [@ohos.application.testRunner (TestRunner)](reference/apis-test-kit/js-apis-application-testRunner.md) - - [@ohos.UiTest](reference/apis-test-kit/js-apis-uitest.md) - - Dependent Elements and Definitions - - [abilityDelegator](reference/apis-test-kit/js-apis-inner-application-abilityDelegator.md) - - [abilityDelegatorArgs](reference/apis-test-kit/js-apis-inner-application-abilityDelegatorArgs.md) - - [shellCmdResult](reference/apis-test-kit/js-apis-inner-application-shellCmdResult.md) - - APIs No Longer Maintained - - [@ohos.application.abilityDelegatorRegistry (AbilityDelegatorRegistry)](reference/apis-test-kit/js-apis-application-abilityDelegatorRegistry.md) + - [@ohos.app.ability.abilityDelegatorRegistry (AbilityDelegatorRegistry)](reference/apis-test-kit/js-apis-app-ability-abilityDelegatorRegistry.md) + - [@ohos.application.testRunner (TestRunner)](reference/apis-test-kit/js-apis-application-testRunner.md) + - [@ohos.UiTest](reference/apis-test-kit/js-apis-uitest.md) + - Dependent Elements and Definitions + - [abilityDelegator](reference/apis-test-kit/js-apis-inner-application-abilityDelegator.md) + - [abilityDelegatorArgs](reference/apis-test-kit/js-apis-inner-application-abilityDelegatorArgs.md) + - [shellCmdResult](reference/apis-test-kit/js-apis-inner-application-shellCmdResult.md) + - APIs No Longer Maintained + - [@ohos.application.abilityDelegatorRegistry (AbilityDelegatorRegistry)](reference/apis-test-kit/js-apis-application-abilityDelegatorRegistry.md) - Error Codes - - [UiTest Error Codes](reference/apis-test-kit/errorcode-uitest.md) + - [UiTest Error Codes](reference/apis-test-kit/errorcode-uitest.md) - Media - Audio Kit - ArkTS APIs @@ -3924,12 +3949,6 @@ - [native_audiorenderer.h](reference/apis-audio-kit/native__audiorenderer_8h.md) - [native_audiostream_base.h](reference/apis-audio-kit/native__audiostream__base_8h.md) - [native_audiostreambuilder.h](reference/apis-audio-kit/native__audiostreambuilder_8h.md) - - Structs - - [OH_AudioCapturer_Callbacks_Struct](reference/apis-audio-kit/_o_h___audio_capturer___callbacks___struct.md) - - [OH_AudioDeviceDescriptorArray](reference/apis-audio-kit/_o_h___audio_device_descriptor_array.md) - - [OH_AudioRenderer_Callbacks_Struct](reference/apis-audio-kit/_o_h___audio_renderer___callbacks___struct.md) - - [OH_AudioSession_DeactivatedEvent](reference/apis-audio-kit/_o_h___audio_session___deactivated_event.md) - - [OH_AudioSession_Strategy](reference/apis-audio-kit/_o_h___audio_session___strategy.md) - Error Codes - [Audio Error Codes](reference/apis-audio-kit/errorcode-audio.md) - [Ringtone Error Codes](reference/apis-audio-kit/errorcode-ringtone.md) @@ -4025,6 +4044,7 @@ - Structs - [Camera_CaptureEndInfo](reference/apis-camera-kit/_camera___capture_end_info.md) - [Camera_CaptureStartInfo](reference/apis-camera-kit/_camera___capture_start_info.md) + - [Camera_ConcurrentInfo](reference/apis-camera-kit/_camera___concurrent_info.md) - [Camera_Device](reference/apis-camera-kit/_camera___device.md) - [Camera_FrameRateRange](reference/apis-camera-kit/_camera___frame_rate_range.md) - [Camera_FrameShutterEndInfo](reference/apis-camera-kit/_camera___frame_shutter_end_info.md) @@ -4156,47 +4176,58 @@ - C APIs - Modules - - [AVImageGenerator](reference/apis-media-kit/_a_v_image_generator.md) - - [AVMetadataExtractor](reference/apis-media-kit/_a_v_metadata_extractor.md) - - [AVPlayer](reference/apis-media-kit/_a_v_player.md) - - [AVRecorder](reference/apis-media-kit/_a_v_recorder.md) - - [AVScreenCapture](reference/apis-media-kit/_a_v_screen_capture.md) - - [VideoProcessing](reference/apis-media-kit/_video_processing.md) + - [AVImageGenerator](reference/apis-media-kit/capi-avimagegenerator.md) + - [AVMetadataExtractor](reference/apis-media-kit/capi-avmetadataextractor.md) + - [AVPlayer](reference/apis-media-kit/capi-avplayer.md) + - [AVRecorder](reference/apis-media-kit/capi-avrecorder.md) + - [AVScreenCapture](reference/apis-media-kit/capi-avscreencapture.md) + - [VideoProcessing](reference/apis-media-kit/capi-videoprocessing.md) - Header Files - - [avimage_generator.h](reference/apis-media-kit/avimage__generator_8h.md) - - [avimage_generator_base.h](reference/apis-media-kit/avimage__generator__base_8h.md) - - [avmetadata_extractor_base.h](reference/apis-media-kit/avmetadata__extractor__base_8h.md) - - [avmetadata_extractor.h](reference/apis-media-kit/avmetadata__extractor_8h.md) - - [avplayer.h](reference/apis-media-kit/avplayer_8h.md) - - [avplayer_base.h](reference/apis-media-kit/avplayer__base_8h.md) - - [avrecorder.h](reference/apis-media-kit/avrecorder_8h.md) - - [avrecorder_base.h](reference/apis-media-kit/avrecorder__base_8h.md) - - [native_avscreen_capture.h](reference/apis-media-kit/native__avscreen__capture_8h.md) - - [native_avscreen_capture_base.h](reference/apis-media-kit/native__avscreen__capture__base_8h.md) - - [native_avscreen_capture_errors.h](reference/apis-media-kit/native__avscreen__capture__errors_8h.md) - - [video_processing.h](reference/apis-media-kit/video__processing_8h.md) - - [video_processing_types.h](reference/apis-media-kit/video__processing__types_8h.md) + - [avimage_generator.h](reference/apis-media-kit/capi-avimage-generator-h.md) + - [avimage_generator_base.h](reference/apis-media-kit/capi-avimage-generator-base-h.md) + - [avmetadata_extractor.h](reference/apis-media-kit/capi-avmetadata-extractor-h.md) + - [avmetadata_extractor_base.h](reference/apis-media-kit/capi-avmetadata-extractor-base-h.md) + - [avplayer.h](reference/apis-media-kit/capi-avplayer-h.md) + - [avplayer_base.h](reference/apis-media-kit/capi-avplayer-base-h.md) + - [avrecorder.h](reference/apis-media-kit/capi-avrecorder-h.md) + - [avrecorder_base.h](reference/apis-media-kit/capi-avrecorder-base-h.md) + - [native_avscreen_capture.h](reference/apis-media-kit/capi-native-avscreen-capture-h.md) + - [native_avscreen_capture_base.h](reference/apis-media-kit/capi-native-avscreen-capture-base-h.md) + - [native_avscreen_capture_errors.h](reference/apis-media-kit/capi-native-avscreen-capture-errors-h.md) + - [video_processing.h](reference/apis-media-kit/capi-video-processing-h.md) + - [video_processing_types.h](reference/apis-media-kit/capi-video-processing-types-h.md) - Structs - - [AVPlayerCallback](reference/apis-media-kit/_a_v_player_callback.md) - - [OH_AVRecorder_Config](reference/apis-media-kit/_o_h___a_v_recorder___config.md) - - [OH_AVRecorder_EncoderInfo](reference/apis-media-kit/_o_h___a_v_recorder___encoder_info.md) - - [OH_AVRecorder_Location](reference/apis-media-kit/_o_h___a_v_recorder___location.md) - - [OH_AVRecorder_Metadata](reference/apis-media-kit/_o_h___a_v_recorder___metadata.md) - - [OH_AVRecorder_MetadataTemplate](reference/apis-media-kit/_o_h___a_v_recorder___metadata_template.md) - - [OH_AVRecorder_Profile](reference/apis-media-kit/_o_h___a_v_recorder___profile.md) - - [OH_AVRecorder_Range](reference/apis-media-kit/_o_h___a_v_recorder___range.md) - - [OH_AudioBuffer](reference/apis-media-kit/_o_h___audio_buffer.md) - - [OH_AudioCaptureInfo](reference/apis-media-kit/_o_h___audio_capture_info.md) - - [OH_AudioEncInfo](reference/apis-media-kit/_o_h___audio_enc_info.md) - - [OH_AudioInfo](reference/apis-media-kit/_o_h___audio_info.md) - - [OH_AVScreenCaptureCallback](reference/apis-media-kit/_o_h___a_v_screen_capture_callback.md) - - [OH_AVScreenCaptureConfig](reference/apis-media-kit/_o_h___a_v_screen_capture_config.md) - - [OH_RecorderInfo](reference/apis-media-kit/_o_h___recorder_info.md) - - [OH_Rect](reference/apis-media-kit/_o_h___rect.md) - - [OH_VideoCaptureInfo](reference/apis-media-kit/_o_h___video_capture_info.md) - - [OH_VideoEncInfo](reference/apis-media-kit/_o_h___video_enc_info.md) - - [OH_VideoInfo](reference/apis-media-kit/_o_h___video_info.md) - - [VideoProcessing_ColorSpaceInfo](reference/apis-media-kit/_video_processing___color_space_info.md) + - [MediaKeySession](reference/apis-media-kit/capi-mediakeysession.md) + - [DRM_MediaKeySystemInfo](reference/apis-media-kit/capi-drm-mediakeysysteminfo.md) + - [AVPlayerCallback](reference/apis-media-kit/capi-avplayercallback.md) + - [OH_AVPlayer](reference/apis-media-kit/capi-oh-avplayer.md) + - [OH_AVImageGenerator](reference/apis-media-kit/capi-oh-avimagegenerator.md) + - [OH_AVMetadataExtractor](reference/apis-media-kit/capi-oh-avmetadataextractor.md) + - [OH_AVRecorder_Profile](reference/apis-media-kit/capi-oh-avrecorder-profile.md) + - [OH_AVRecorder](reference/apis-media-kit/capi-oh-avrecorder.md) + - [OH_AVRecorder_Location](reference/apis-media-kit/capi-oh-avrecorder-location.md) + - [OH_AVRecorder_MetadataTemplate](reference/apis-media-kit/capi-oh-avrecorder-metadatatemplate.md) + - [OH_AVRecorder_Metadata](reference/apis-media-kit/capi-oh-avrecorder-metadata.md) + - [OH_AVRecorder_Config](reference/apis-media-kit/capi-oh-avrecorder-config.md) + - [OH_AVRecorder_Range](reference/apis-media-kit/capi-oh-avrecorder-range.md) + - [OH_AVRecorder_EncoderInfo](reference/apis-media-kit/capi-oh-avrecorder-encoderinfo.md) + - [OH_AudioCaptureInfo](reference/apis-media-kit/capi-oh-audiocaptureinfo.md) + - [OH_NativeBuffer](reference/apis-media-kit/capi-oh-nativebuffer.md) + - [OH_AVScreenCapture](reference/apis-media-kit/capi-oh-avscreencapture.md) + - [OH_AVScreenCapture_ContentFilter](reference/apis-media-kit/capi-oh-avscreencapture-contentfilter.md) + - [OH_AudioEncInfo](reference/apis-media-kit/capi-oh-audioencinfo.md) + - [OH_AudioInfo](reference/apis-media-kit/capi-oh-audioinfo.md) + - [OH_VideoCaptureInfo](reference/apis-media-kit/capi-oh-videocaptureinfo.md) + - [OH_VideoEncInfo](reference/apis-media-kit/capi-oh-videoencinfo.md) + - [OH_VideoInfo](reference/apis-media-kit/capi-oh-videoinfo.md) + - [OH_RecorderInfo](reference/apis-media-kit/capi-oh-recorderinfo.md) + - [OH_AVScreenCaptureConfig](reference/apis-media-kit/capi-oh-avscreencaptureconfig.md) + - [OH_AVScreenCaptureCallback](reference/apis-media-kit/capi-oh-avscreencapturecallback.md) + - [OH_Rect](reference/apis-media-kit/capi-oh-rect.md) + - [OH_AudioBuffer](reference/apis-media-kit/capi-oh-audiobuffer.md) + - [VideoProcessing_ColorSpaceInfo](reference/apis-media-kit/capi-videoprocessing-colorspaceinfo.md) + - [OH_VideoProcessing](reference/apis-media-kit/capi-oh-videoprocessing.md) + - [VideoProcessing_Callback](reference/apis-media-kit/capi-videoprocessing-callback.md) - Error Codes - [Media Error Codes](reference/apis-media-kit/errorcode-media.md) - Media Library Kit @@ -4212,19 +4243,26 @@ - [@ohos.file.PhotoPickerComponent (PhotoPicker Component)](reference/apis-media-library-kit/ohos-file-PhotoPickerComponent.md) - [@ohos.file.RecentPhotoComponent (RecentPhotoComponent)](reference/apis-media-library-kit/ohos-file-RecentPhotoComponent.md) - [@ohos.multimedia.movingphotoview (MovingPhotoView Component)](reference/apis-media-library-kit/ohos-multimedia-movingphotoview.md) + + - [@ohos.multimedia.movingphotoview (MovingPhotoView) (System API)](reference/apis-media-library-kit/ohos-multimedia-movingphotoview-sys.md) + - C APIs - Modules - - [MediaAssetManager](reference/apis-media-library-kit/_media_asset_manager.md) + - [MediaAssetManager](reference/apis-media-library-kit/capi-mediaassetmanager.md) - Header Files - - [media_access_helper_capi.h](reference/apis-media-library-kit/media__access__helper__capi_8h.md) - - [media_asset_base_capi.h](reference/apis-media-library-kit/media__asset__base__capi_8h.md) - - [media_asset_capi.h](reference/apis-media-library-kit/media__asset__capi_8h.md) - - [media_asset_change_request_capi.h](reference/apis-media-library-kit/media__asset__change__request__capi_8h.md) - - [media_asset_manager_capi.h](reference/apis-media-library-kit/media__asset__manager__capi_8h.md) - - [moving_photo_capi.h](reference/apis-media-library-kit/moving__photo__capi_8h.md) + - [media_access_helper_capi.h](reference/apis-media-library-kit/capi-media-access-helper-capi-h.md) + - [media_asset_base_capi.h](reference/apis-media-library-kit/capi-media-asset-base-capi-h.md) + - [media_asset_capi.h](reference/apis-media-library-kit/capi-media-asset-capi-h.md) + - [media_asset_change_request_capi.h](reference/apis-media-library-kit/capi-media-asset-change-request-capi-h.md) + - [media_asset_manager_capi.h](reference/apis-media-library-kit/capi-media-asset-manager-capi-h.md) + - [moving_photo_capi.h](reference/apis-media-library-kit/capi-moving-photo-capi-h.md) - Structs - - [MediaLibrary_RequestId](reference/apis-media-library-kit/_media_library___request_id.md) - - [MediaLibrary_RequestOptions](reference/apis-media-library-kit/_media_library___request_options.md) + - [MediaLibrary_RequestId](reference/apis-media-library-kit/capi-medialibrary-requestid.md) + - [OH_MediaAssetManager](reference/apis-media-library-kit/capi-oh-mediaassetmanager.md) + - [OH_MediaAssetChangeRequest](reference/apis-media-library-kit/capi-oh-mediaassetchangerequest.md) + - [OH_MovingPhoto](reference/apis-media-library-kit/capi-oh-movingphoto.md) + - [OH_MediaAsset](reference/apis-media-library-kit/capi-oh-mediaasset.md) + - [MediaLibrary_RequestOptions](reference/apis-media-library-kit/capi-medialibrary-requestoptions.md) - Graphics - ArkGraphics 2D - ArkTS APIs @@ -4321,10 +4359,9 @@ - [OH_Drawing_Point2D](reference/apis-arkgraphics2d/_o_h___drawing___point2_d.md) - [OH_Drawing_Point3D](reference/apis-arkgraphics2d/_o_h___drawing___point3_d.md) - [OH_Drawing_RectStyle_Info](reference/apis-arkgraphics2d/_o_h___drawing___rect_style___info.md) - - [OH_Drawing_RunBuffer](reference/apis-arkgraphics2d/_o_h___drawing___run_buffer.md) + - [OH_Drawing_RunBuffer](reference/apis-arkgraphics2d/_o_h___drawing___run_buffer.md) - [OH_Drawing_String](reference/apis-arkgraphics2d/_o_h___drawing___string.md) - [OH_Drawing_StrutStyle](reference/apis-arkgraphics2d/_o_h___drawing___strut_style.md) - - [OH_Filter](reference/apis-arkgraphics2d/_o_h___filter.md) - [OH_Filter_ColorMatrix](reference/apis-arkgraphics2d/_o_h___filter___color_matrix.md) - [OH_NativeBuffer_ColorXY](reference/apis-arkgraphics2d/_o_h___native_buffer___color_x_y.md) - [OH_NativeBuffer_Config](reference/apis-arkgraphics2d/_o_h___native_buffer___config.md) @@ -4352,7 +4389,7 @@ - [SceneType](reference/apis-arkgraphics3d/js-apis-inner-scene-types.md) - [SceneResources](reference/apis-arkgraphics3d/js-apis-inner-scene-resources.md) - [ScenePostProcessSettings](reference/apis-arkgraphics3d/js-apis-inner-scene-post-process-settings.md) - - Application Services + - Application Services - Ads Kit - ArkTS APIs @@ -4374,8 +4411,6 @@ - Calendar Kit - ArkTS APIs - [@ohos.calendarManager (Calendar Manager)](reference/apis-calendar-kit/js-apis-calendarManager.md) - - Error Codes - - [CalendarManager Error Codes](reference/apis-calendar-kit/errorcode-calendarManager.md) - Contacts Kit - ArkTS APIs - [@ohos.contact (Contacts)](reference/apis-contacts-kit/js-apis-contact.md) @@ -4389,7 +4424,7 @@ - [@ohos.app.ability.FenceExtensionAbility (FenceExtensionAbility)](reference/apis-location-kit/js-apis-app-ability-FenceExtensionAbility.md) - [@ohos.app.ability.FenceExtensionContext (FenceExtensionContext)](reference/apis-location-kit/js-apis-app-ability-FenceExtensionContext.md) - + - [@ohos.app.ability.FenceExtensionContext (FenceExtensionContext) (System API)](reference/apis-location-kit/js-apis-app-ability-FenceExtensionContext-sys.md) - APIs No Longer Maintained @@ -4476,7 +4511,6 @@ - [OH_NN_QuantParam](reference/apis-neural-network-runtime-kit/_o_h___n_n___quant_param.md) - [OH_NN_Tensor](reference/apis-neural-network-runtime-kit/_o_h___n_n___tensor.md) - [OH_NN_UInt32Array](reference/apis-neural-network-runtime-kit/_o_h___n_n___u_int32_array.md) - - Common Basic Capability - ArkTS APIs - [Console](reference/common/js-apis-logs.md) -- Gitee