1 Star 0 Fork 4K

Feng Lin/interface_sdk-js

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
@ohos.hiSysEvent.d.ts 17.74 KB
一键复制 编辑 原始数据 按行查看 历史
honghecun 提交于 2024-08-26 10:57 +08:00 . modify the annotate for tags&params
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* @kit PerformanceAnalysisKit
*/
import { AsyncCallback } from './@ohos.base';
/**
* Provides the system event logging function for applications to log the fault, statistical, security,
* and user behavior events reported during running. Based on event information,
* you will be able to analyze the running status of applications.
*
* @namespace hiSysEvent
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
declare namespace hiSysEvent {
/**
* Enumerate system event types.
*
* @enum {number}
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
enum EventType {
/**
* Fault event
*
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
FAULT = 1,
/**
* Statistic event
*
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
STATISTIC = 2,
/**
* Security event
*
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
SECURITY = 3,
/**
* System behavior event
*
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
BEHAVIOR = 4
}
/**
* Definition of written system event information.
*
* @interface SysEventInfo
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
interface SysEventInfo {
/**
* The domain of the event.
*
* @type { string }
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
domain: string;
/**
* The name of the event.
*
* @type { string }
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
name: string;
/**
* The type of the event.
*
* @type { EventType }
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
eventType: EventType;
/**
* The params of the event.
*
* @type { object }
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
/**
* The params of the event.
*
* @type { ?object }
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 12
*/
params?: object;
}
/**
* Write system event.
*
* @param {SysEventInfo} info - system event information to be written.
* @returns {Promise<void>} - Return Promise
* @throws {BusinessError} 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* 3. Parameter verification failed.
* @throws {BusinessError} 11200001 - Invalid event domain.
* @throws {BusinessError} 11200002 - Invalid event name.
* @throws {BusinessError} 11200003 - Abnormal environment.
* @throws {BusinessError} 11200004 - The event length exceeds the limit.
* @throws {BusinessError} 11200051 - Invalid event parameter.
* @throws {BusinessError} 11200052 - The size of the event parameter of the string type exceeds the limit.
* @throws {BusinessError} 11200053 - The number of event parameters exceeds the limit.
* @throws {BusinessError} 11200054 - The number of event parameters of the array type exceeds the limit.
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
function write(info: SysEventInfo): Promise<void>;
/**
* Write system event.
*
* @param {SysEventInfo} info - system event information to be written.
* @param {AsyncCallback<void>} callback - callback function.
* @throws {BusinessError} 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* 3. Parameter verification failed.
* @throws {BusinessError} 11200001 - Invalid event domain.
* @throws {BusinessError} 11200002 - Invalid event name.
* @throws {BusinessError} 11200003 - Abnormal environment.
* @throws {BusinessError} 11200004 - The event length exceeds the limit.
* @throws {BusinessError} 11200051 - Invalid event parameter.
* @throws {BusinessError} 11200052 - The size of the event parameter of the string type exceeds the limit.
* @throws {BusinessError} 11200053 - The number of event parameters exceeds the limit.
* @throws {BusinessError} 11200054 - The number of event parameters of the array type exceeds the limit.
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
function write(info: SysEventInfo, callback: AsyncCallback<void>): void;
/**
* Enumerate search system event rule type.
*
* @enum {number}
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
enum RuleType {
/**
* Whole word match
*
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
WHOLE_WORD = 1,
/**
* Prefix match
*
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
PREFIX = 2,
/**
* Regular match
*
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
REGULAR = 3
}
/**
* Definition listener rule for system event information.
*
* @interface WatchRule
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
interface WatchRule {
/**
* The domain of the event.
*
* @type { string }
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
domain: string;
/**
* The name of the event.
*
* @type { string }
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
name: string;
/**
* The tag of the event.
*
* @type { string }
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
/**
* The tag of the event.
*
* @type { ?string }
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 12
*/
tag?: string;
/**
* The rule of match system event
*
* @type { RuleType }
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
ruleType: RuleType;
}
/**
* Definition watcher for system event information.
*
* @interface Watcher
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
interface Watcher {
/**
* Rule of filter system event
*
* @type { WatchRule[] }
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
rules: WatchRule[];
/**
* Receive system event.
*
* @type { function }
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
onEvent: (info: SysEventInfo) => void;
/**
* Hisysevent service shutdown.
*
* @type { function }
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
onServiceDied: () => void;
}
/**
* Definition arguments for query system event information.
*
* @interface QueryArg
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
interface QueryArg {
/**
* Begin time
*
* @type { number }
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
beginTime: number;
/**
* End time
*
* @type { number }
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
endTime: number;
/**
* Max number of receive system event
*
* @type { number }
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
maxEvents: number;
/**
* Begin sequence
*
* @type { ?number }
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 10
*/
fromSeq?: number;
/**
* End sequence
*
* @type { ?number }
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 10
*/
toSeq?: number;
}
/**
* Definition event for query system event information
*
* @interface QueryRule
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
interface QueryRule {
/**
* The domain of the event
*
* @type { string }
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
domain: string;
/**
* List of event name
*
* @type { string[] }
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
names: string[];
/**
* Extra parameter condition of event
*
* @type { ?string }
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 10
*/
condition?: string;
}
/**
* Definition query result handler
*
* @interface Querier
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
interface Querier {
/**
* Handle query result, the query result will be send in several times.
*
* @type { function }
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
onQuery: (infos: SysEventInfo[]) => void;
/**
* Notify querier execute query has finished.
*
* @type { function }
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
onComplete: (reason: number, total: number) => void;
}
/**
* Add watcher to watch system event
*
* @permission ohos.permission.READ_DFX_SYSEVENT
* @param {Watcher} watcher watch system event
* @throws {BusinessError} 201 - Permission denied. An attempt was made to read system event forbidden by permission: ohos.permission.READ_DFX_SYSEVENT.
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
* @throws {BusinessError} 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* 3. Parameter verification failed.
* @throws {BusinessError} 11200101 - The number of watchers exceeds the limit.
* @throws {BusinessError} 11200102 - The number of watch rules exceeds the limit.
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
function addWatcher(watcher: Watcher): void;
/**
* Remove watcher
*
* @permission ohos.permission.READ_DFX_SYSEVENT
* @param {Watcher} watcher watch system event
* @throws {BusinessError} 201 - Permission denied. An attempt was made to read system event forbidden by permission: ohos.permission.READ_DFX_SYSEVENT.
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
* @throws {BusinessError} 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* 3. Parameter verification failed.
* @throws {BusinessError} 11200201 - The watcher does not exist.
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
function removeWatcher(watcher: Watcher): void;
/**
* Query system event
*
* @permission ohos.permission.READ_DFX_SYSEVENT
* @param {QueryArg} queryArg common arguments of query system event
* @param {QueryRule[]} rules rule of query system event
* @param {Querier} querier receive query result
* @throws {BusinessError} 201 - Permission denied. An attempt was made to read system event forbidden by permission: ohos.permission.READ_DFX_SYSEVENT.
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
* @throws {BusinessError} 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* 3. Parameter verification failed.
* @throws {BusinessError} 11200301 - The number of query rules exceeds the limit.
* @throws {BusinessError} 11200302 - Invalid query rule.
* @throws {BusinessError} 11200303 - The number of concurrent queriers exceeds the limit.
* @throws {BusinessError} 11200304 - The query frequency exceeds the limit.
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 9
*/
function query(queryArg: QueryArg, rules: QueryRule[], querier: Querier): void;
/**
* Export system event
*
* @permission ohos.permission.READ_DFX_SYSEVENT
* @param {QueryArg} queryArg common arguments of query system event
* @param {QueryRule[]} rules rule of query system event
* @returns {number} return hiview receive task time.
* @throws {BusinessError} 201 - Permission denied. An attempt was made to read system event forbidden by permission: ohos.permission.READ_DFX_SYSEVENT.
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
* @throws {BusinessError} 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* 3. Parameter verification failed.
* @throws {BusinessError} 11200301 - The number of query rules exceeds the limit.
* @throws {BusinessError} 11200302 - Invalid query rule.
* @throws {BusinessError} 11200304 – The query frequency exceeds the limit.
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 10
*/
function exportSysEvents(queryArg: QueryArg, rules: QueryRule[]): number;
/**
* Subscribe system event
*
* @permission ohos.permission.READ_DFX_SYSEVENT
* @param {QueryRule[]} rules rule of subscribe system event
* @returns {number} return hiview receive task time.
* @throws {BusinessError} 201 - Permission denied. An attempt was made to read system event forbidden by permission: ohos.permission.READ_DFX_SYSEVENT.
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
* @throws {BusinessError} 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* 3. Parameter verification failed.
* @throws {BusinessError} 11200301 - The number of query rules exceeds the limit.
* @throws {BusinessError} 11200302 - Invalid query rule.
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 10
*/
function subscribe(rules: QueryRule[]): number;
/**
* Unsubscribe system event
*
* @permission ohos.permission.READ_DFX_SYSEVENT
* @throws {BusinessError} 201 - Permission denied. An attempt was made to read system event forbidden by permission: ohos.permission.READ_DFX_SYSEVENT.
* @throws {BusinessError} 202 - System API is not allowed called by Non-system application.
* @throws {BusinessError} 401 - Parameter error. Possible causes:
* 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types.
* 3. Parameter verification failed.
* @throws {BusinessError} 11200305 – Unsubscription failed.
* @syscap SystemCapability.HiviewDFX.HiSysEvent
* @systemapi hide for inner use
* @since 10
*/
function unsubscribe(): void;
}
export default hiSysEvent;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lffl8796/interface_sdk-js.git
git@gitee.com:lffl8796/interface_sdk-js.git
lffl8796
interface_sdk-js
interface_sdk-js
master

搜索帮助