179a732c7Sopenharmony_ci/* 279a732c7Sopenharmony_ci * Copyright (c) 2020-2024 Huawei Device Co., Ltd. 379a732c7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 479a732c7Sopenharmony_ci * you may not use this file except in compliance with the License. 579a732c7Sopenharmony_ci * You may obtain a copy of the License at 679a732c7Sopenharmony_ci * 779a732c7Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 879a732c7Sopenharmony_ci * 979a732c7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1079a732c7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1179a732c7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1279a732c7Sopenharmony_ci * See the License for the specific language governing permissions and 1379a732c7Sopenharmony_ci * limitations under the License. 1479a732c7Sopenharmony_ci */ 1579a732c7Sopenharmony_ci 1679a732c7Sopenharmony_ciimport type { AsyncCallback, Callback } from './@ohos.base'; 1779a732c7Sopenharmony_ci 1879a732c7Sopenharmony_ci/** 1979a732c7Sopenharmony_ci * Providers interfaces to create a {@link deviceManager} instances. 2079a732c7Sopenharmony_ci * 2179a732c7Sopenharmony_ci * @since 7 2279a732c7Sopenharmony_ci * @Syscap SystemCapability.DISTRIBUTEDHARDWARE.deviceManager 2379a732c7Sopenharmony_ci * 2479a732c7Sopenharmony_ci */ 2579a732c7Sopenharmony_cideclare namespace deviceManager { 2679a732c7Sopenharmony_ci /** 2779a732c7Sopenharmony_ci * DeviceInfo 2879a732c7Sopenharmony_ci * 2979a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 3079a732c7Sopenharmony_ci */ 3179a732c7Sopenharmony_ci interface DeviceInfo { 3279a732c7Sopenharmony_ci /** 3379a732c7Sopenharmony_ci * DeviceId ID. 3479a732c7Sopenharmony_ci */ 3579a732c7Sopenharmony_ci deviceId: string; 3679a732c7Sopenharmony_ci 3779a732c7Sopenharmony_ci /** 3879a732c7Sopenharmony_ci * Device name of the device. 3979a732c7Sopenharmony_ci */ 4079a732c7Sopenharmony_ci deviceName: string; 4179a732c7Sopenharmony_ci 4279a732c7Sopenharmony_ci /** 4379a732c7Sopenharmony_ci * Device type of the device. 4479a732c7Sopenharmony_ci */ 4579a732c7Sopenharmony_ci deviceType: DeviceType; 4679a732c7Sopenharmony_ci 4779a732c7Sopenharmony_ci /** 4879a732c7Sopenharmony_ci * NetworkId of the device. 4979a732c7Sopenharmony_ci * 5079a732c7Sopenharmony_ci * @since 8 5179a732c7Sopenharmony_ci */ 5279a732c7Sopenharmony_ci networkId: string; 5379a732c7Sopenharmony_ci 5479a732c7Sopenharmony_ci /** 5579a732c7Sopenharmony_ci * @since 9 5679a732c7Sopenharmony_ci * The distance of dicovered device, in centimeters(cm). 5779a732c7Sopenharmony_ci */ 5879a732c7Sopenharmony_ci range: number; 5979a732c7Sopenharmony_ci 6079a732c7Sopenharmony_ci /** 6179a732c7Sopenharmony_ci * Indicates the device's trusted type 6279a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 6379a732c7Sopenharmony_ci * @since 10 6479a732c7Sopenharmony_ci */ 6579a732c7Sopenharmony_ci authForm: AuthForm; 6679a732c7Sopenharmony_ci } 6779a732c7Sopenharmony_ci 6879a732c7Sopenharmony_ci /** 6979a732c7Sopenharmony_ci * Device trusted type definitions 7079a732c7Sopenharmony_ci * @enum {number} 7179a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 7279a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 7379a732c7Sopenharmony_ci * @since 10 7479a732c7Sopenharmony_ci */ 7579a732c7Sopenharmony_ci enum AuthForm { 7679a732c7Sopenharmony_ci /** 7779a732c7Sopenharmony_ci * Indicates invalid trusted device type. 7879a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 7979a732c7Sopenharmony_ci * @since 10 8079a732c7Sopenharmony_ci */ 8179a732c7Sopenharmony_ci INVALID_TYPE = -1, 8279a732c7Sopenharmony_ci 8379a732c7Sopenharmony_ci /** 8479a732c7Sopenharmony_ci * Indicates peer to peer trusted device type without account. 8579a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 8679a732c7Sopenharmony_ci * @since 10 8779a732c7Sopenharmony_ci */ 8879a732c7Sopenharmony_ci PEER_TO_PEER = 0, 8979a732c7Sopenharmony_ci 9079a732c7Sopenharmony_ci /** 9179a732c7Sopenharmony_ci * Indicates identical account trusted device type. 9279a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 9379a732c7Sopenharmony_ci * @since 10 9479a732c7Sopenharmony_ci */ 9579a732c7Sopenharmony_ci IDENTICAL_ACCOUNT = 1, 9679a732c7Sopenharmony_ci 9779a732c7Sopenharmony_ci /** 9879a732c7Sopenharmony_ci * Indicates across account trusted device type. 9979a732c7Sopenharmony_ci * @syscap SystemCapability.DistributedHardware.DeviceManager 10079a732c7Sopenharmony_ci * @since 10 10179a732c7Sopenharmony_ci */ 10279a732c7Sopenharmony_ci ACROSS_ACCOUNT = 2 10379a732c7Sopenharmony_ci } 10479a732c7Sopenharmony_ci 10579a732c7Sopenharmony_ci /** 10679a732c7Sopenharmony_ci * Device Type definitions 10779a732c7Sopenharmony_ci */ 10879a732c7Sopenharmony_ci enum DeviceType { 10979a732c7Sopenharmony_ci /** 11079a732c7Sopenharmony_ci * Indicates an unknown device type. 11179a732c7Sopenharmony_ci */ 11279a732c7Sopenharmony_ci UNKNOWN_TYPE = 0, 11379a732c7Sopenharmony_ci 11479a732c7Sopenharmony_ci /** 11579a732c7Sopenharmony_ci * Indicates a speaker. 11679a732c7Sopenharmony_ci */ 11779a732c7Sopenharmony_ci SPEAKER = 0x0A, 11879a732c7Sopenharmony_ci 11979a732c7Sopenharmony_ci /** 12079a732c7Sopenharmony_ci * Indicates a smartphone. 12179a732c7Sopenharmony_ci */ 12279a732c7Sopenharmony_ci PHONE = 0x0E, 12379a732c7Sopenharmony_ci 12479a732c7Sopenharmony_ci /** 12579a732c7Sopenharmony_ci * Indicates a tablet. 12679a732c7Sopenharmony_ci */ 12779a732c7Sopenharmony_ci TABLET = 0x11, 12879a732c7Sopenharmony_ci 12979a732c7Sopenharmony_ci /** 13079a732c7Sopenharmony_ci * Indicates a smart watch. 13179a732c7Sopenharmony_ci */ 13279a732c7Sopenharmony_ci WEARABLE = 0x6D, 13379a732c7Sopenharmony_ci 13479a732c7Sopenharmony_ci /** 13579a732c7Sopenharmony_ci * Indicates a car. 13679a732c7Sopenharmony_ci */ 13779a732c7Sopenharmony_ci CAR = 0x83, 13879a732c7Sopenharmony_ci 13979a732c7Sopenharmony_ci /** 14079a732c7Sopenharmony_ci * Indicates a smart TV. 14179a732c7Sopenharmony_ci */ 14279a732c7Sopenharmony_ci TV = 0x9C 14379a732c7Sopenharmony_ci } 14479a732c7Sopenharmony_ci 14579a732c7Sopenharmony_ci /** 14679a732c7Sopenharmony_ci * Device state change event definition 14779a732c7Sopenharmony_ci * 14879a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 14979a732c7Sopenharmony_ci */ 15079a732c7Sopenharmony_ci enum DeviceStateChangeAction { 15179a732c7Sopenharmony_ci /** 15279a732c7Sopenharmony_ci * device online action 15379a732c7Sopenharmony_ci */ 15479a732c7Sopenharmony_ci ONLINE = 0, 15579a732c7Sopenharmony_ci 15679a732c7Sopenharmony_ci /** 15779a732c7Sopenharmony_ci * device ready action, the device information synchronization was completed. 15879a732c7Sopenharmony_ci */ 15979a732c7Sopenharmony_ci READY = 1, 16079a732c7Sopenharmony_ci 16179a732c7Sopenharmony_ci /** 16279a732c7Sopenharmony_ci * device offline action 16379a732c7Sopenharmony_ci */ 16479a732c7Sopenharmony_ci OFFLINE = 2, 16579a732c7Sopenharmony_ci 16679a732c7Sopenharmony_ci /** 16779a732c7Sopenharmony_ci * device change action 16879a732c7Sopenharmony_ci */ 16979a732c7Sopenharmony_ci CHANGE = 3 17079a732c7Sopenharmony_ci } 17179a732c7Sopenharmony_ci 17279a732c7Sopenharmony_ci /** 17379a732c7Sopenharmony_ci * Service subscribe info for device discover 17479a732c7Sopenharmony_ci * 17579a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 17679a732c7Sopenharmony_ci */ 17779a732c7Sopenharmony_ci interface SubscribeInfo { 17879a732c7Sopenharmony_ci /** 17979a732c7Sopenharmony_ci * Service subscribe ID, the value is in scope [0, 65535], should be unique for each discover process 18079a732c7Sopenharmony_ci */ 18179a732c7Sopenharmony_ci subscribeId: number; 18279a732c7Sopenharmony_ci 18379a732c7Sopenharmony_ci /** 18479a732c7Sopenharmony_ci * Discovery mode for service subscription. 18579a732c7Sopenharmony_ci */ 18679a732c7Sopenharmony_ci mode: DiscoverMode; 18779a732c7Sopenharmony_ci 18879a732c7Sopenharmony_ci /** 18979a732c7Sopenharmony_ci * Service subscription medium. 19079a732c7Sopenharmony_ci */ 19179a732c7Sopenharmony_ci medium: ExchangeMedium; 19279a732c7Sopenharmony_ci 19379a732c7Sopenharmony_ci /** 19479a732c7Sopenharmony_ci * Service subscription frequency. 19579a732c7Sopenharmony_ci */ 19679a732c7Sopenharmony_ci freq: ExchangeFreq; 19779a732c7Sopenharmony_ci 19879a732c7Sopenharmony_ci /** 19979a732c7Sopenharmony_ci * only find the device with the same account. 20079a732c7Sopenharmony_ci */ 20179a732c7Sopenharmony_ci isSameAccount: boolean; 20279a732c7Sopenharmony_ci 20379a732c7Sopenharmony_ci /** 20479a732c7Sopenharmony_ci * find the sleeping devices. 20579a732c7Sopenharmony_ci */ 20679a732c7Sopenharmony_ci isWakeRemote: boolean; 20779a732c7Sopenharmony_ci 20879a732c7Sopenharmony_ci /** 20979a732c7Sopenharmony_ci * Subscribe capability. 21079a732c7Sopenharmony_ci */ 21179a732c7Sopenharmony_ci capability: SubscribeCap; 21279a732c7Sopenharmony_ci } 21379a732c7Sopenharmony_ci 21479a732c7Sopenharmony_ci /** 21579a732c7Sopenharmony_ci * Service publish info for device discover 21679a732c7Sopenharmony_ci * @since 9 21779a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 21879a732c7Sopenharmony_ci */ 21979a732c7Sopenharmony_ci interface PublishInfo { 22079a732c7Sopenharmony_ci /** 22179a732c7Sopenharmony_ci * Service publish ID, the value is in scope [0, 65535], should be unique for each publish process 22279a732c7Sopenharmony_ci */ 22379a732c7Sopenharmony_ci publishId: number; 22479a732c7Sopenharmony_ci 22579a732c7Sopenharmony_ci /** 22679a732c7Sopenharmony_ci * Discovery mode for service subscription. 22779a732c7Sopenharmony_ci */ 22879a732c7Sopenharmony_ci mode: DiscoverMode; 22979a732c7Sopenharmony_ci 23079a732c7Sopenharmony_ci /** 23179a732c7Sopenharmony_ci * Service subscription frequency. 23279a732c7Sopenharmony_ci */ 23379a732c7Sopenharmony_ci freq: ExchangeFreq; 23479a732c7Sopenharmony_ci 23579a732c7Sopenharmony_ci /** 23679a732c7Sopenharmony_ci * Whether the device should be ranged by discoverers. 23779a732c7Sopenharmony_ci */ 23879a732c7Sopenharmony_ci ranging: boolean; 23979a732c7Sopenharmony_ci } 24079a732c7Sopenharmony_ci 24179a732c7Sopenharmony_ci /** 24279a732c7Sopenharmony_ci * device discover mode 24379a732c7Sopenharmony_ci * 24479a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 24579a732c7Sopenharmony_ci */ 24679a732c7Sopenharmony_ci enum DiscoverMode { 24779a732c7Sopenharmony_ci /** 24879a732c7Sopenharmony_ci * when using this key at client side, it means discovering for available nearby devices by 24979a732c7Sopenharmony_ci * calling @startDeviceDiscovery function, while using this key at server side indicating that 25079a732c7Sopenharmony_ci * a device publication or advertisement by calling @publishDeviceDiscovery. 25179a732c7Sopenharmony_ci */ 25279a732c7Sopenharmony_ci DISCOVER_MODE_PASSIVE = 0x55, 25379a732c7Sopenharmony_ci 25479a732c7Sopenharmony_ci /** 25579a732c7Sopenharmony_ci * when using this key at server side, it means discovering for available nearby devices by 25679a732c7Sopenharmony_ci * calling @startDeviceDiscovery function, while using this key at client side indicating that 25779a732c7Sopenharmony_ci * a device publication or advertisement by calling @publishDeviceDiscovery. 25879a732c7Sopenharmony_ci */ 25979a732c7Sopenharmony_ci DISCOVER_MODE_ACTIVE = 0xAA 26079a732c7Sopenharmony_ci } 26179a732c7Sopenharmony_ci 26279a732c7Sopenharmony_ci /** 26379a732c7Sopenharmony_ci * device discover medium 26479a732c7Sopenharmony_ci * 26579a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 26679a732c7Sopenharmony_ci */ 26779a732c7Sopenharmony_ci enum ExchangeMedium { 26879a732c7Sopenharmony_ci /** 26979a732c7Sopenharmony_ci * Automatic medium selection 27079a732c7Sopenharmony_ci */ 27179a732c7Sopenharmony_ci AUTO = 0, 27279a732c7Sopenharmony_ci 27379a732c7Sopenharmony_ci /** 27479a732c7Sopenharmony_ci * Bluetooth 27579a732c7Sopenharmony_ci */ 27679a732c7Sopenharmony_ci BLE = 1, 27779a732c7Sopenharmony_ci 27879a732c7Sopenharmony_ci /** 27979a732c7Sopenharmony_ci * Wi-Fi 28079a732c7Sopenharmony_ci */ 28179a732c7Sopenharmony_ci COAP = 2, 28279a732c7Sopenharmony_ci 28379a732c7Sopenharmony_ci /** 28479a732c7Sopenharmony_ci * USB 28579a732c7Sopenharmony_ci */ 28679a732c7Sopenharmony_ci USB = 3 28779a732c7Sopenharmony_ci } 28879a732c7Sopenharmony_ci 28979a732c7Sopenharmony_ci /** 29079a732c7Sopenharmony_ci * device discover freq 29179a732c7Sopenharmony_ci * 29279a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 29379a732c7Sopenharmony_ci */ 29479a732c7Sopenharmony_ci enum ExchangeFreq { 29579a732c7Sopenharmony_ci /** 29679a732c7Sopenharmony_ci * Low 29779a732c7Sopenharmony_ci */ 29879a732c7Sopenharmony_ci LOW = 0, 29979a732c7Sopenharmony_ci 30079a732c7Sopenharmony_ci /** 30179a732c7Sopenharmony_ci * Medium 30279a732c7Sopenharmony_ci */ 30379a732c7Sopenharmony_ci MID = 1, 30479a732c7Sopenharmony_ci 30579a732c7Sopenharmony_ci /** 30679a732c7Sopenharmony_ci * High 30779a732c7Sopenharmony_ci */ 30879a732c7Sopenharmony_ci HIGH = 2, 30979a732c7Sopenharmony_ci 31079a732c7Sopenharmony_ci /** 31179a732c7Sopenharmony_ci * Super-high 31279a732c7Sopenharmony_ci */ 31379a732c7Sopenharmony_ci SUPER_HIGH = 3 31479a732c7Sopenharmony_ci } 31579a732c7Sopenharmony_ci 31679a732c7Sopenharmony_ci /** 31779a732c7Sopenharmony_ci * device discover capability 31879a732c7Sopenharmony_ci * 31979a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 32079a732c7Sopenharmony_ci */ 32179a732c7Sopenharmony_ci enum SubscribeCap { 32279a732c7Sopenharmony_ci /** 32379a732c7Sopenharmony_ci * ddmpCapability, will be discarded later. Currently, it will be converted to OSD capability inner. 32479a732c7Sopenharmony_ci */ 32579a732c7Sopenharmony_ci SUBSCRIBE_CAPABILITY_DDMP = 0, 32679a732c7Sopenharmony_ci 32779a732c7Sopenharmony_ci /** 32879a732c7Sopenharmony_ci * One Super Device Capability 32979a732c7Sopenharmony_ci */ 33079a732c7Sopenharmony_ci SUBSCRIBE_CAPABILITY_OSD = 1 33179a732c7Sopenharmony_ci } 33279a732c7Sopenharmony_ci 33379a732c7Sopenharmony_ci /** 33479a732c7Sopenharmony_ci * Device Authentication param 33579a732c7Sopenharmony_ci * 33679a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications 33779a732c7Sopenharmony_ci */ 33879a732c7Sopenharmony_ci interface AuthParam { 33979a732c7Sopenharmony_ci /** 34079a732c7Sopenharmony_ci * Authentication type, 1 for pin code. 34179a732c7Sopenharmony_ci */ 34279a732c7Sopenharmony_ci authType: number; 34379a732c7Sopenharmony_ci 34479a732c7Sopenharmony_ci /** 34579a732c7Sopenharmony_ci * Authentication extra infos. 34679a732c7Sopenharmony_ci */ 34779a732c7Sopenharmony_ci extraInfo: { [key: string]: any }; 34879a732c7Sopenharmony_ci } 34979a732c7Sopenharmony_ci 35079a732c7Sopenharmony_ci /** 35179a732c7Sopenharmony_ci * Device auth info. 35279a732c7Sopenharmony_ci * 35379a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications 35479a732c7Sopenharmony_ci */ 35579a732c7Sopenharmony_ci interface AuthInfo { 35679a732c7Sopenharmony_ci /** 35779a732c7Sopenharmony_ci * Authentication type, 1 for pin code. 35879a732c7Sopenharmony_ci */ 35979a732c7Sopenharmony_ci authType: number; 36079a732c7Sopenharmony_ci 36179a732c7Sopenharmony_ci /** 36279a732c7Sopenharmony_ci * the token used for this authentication. 36379a732c7Sopenharmony_ci */ 36479a732c7Sopenharmony_ci token: number; 36579a732c7Sopenharmony_ci 36679a732c7Sopenharmony_ci /** 36779a732c7Sopenharmony_ci * Authentication extra infos. 36879a732c7Sopenharmony_ci */ 36979a732c7Sopenharmony_ci extraInfo: { [key: string]: any }; 37079a732c7Sopenharmony_ci } 37179a732c7Sopenharmony_ci 37279a732c7Sopenharmony_ci /** 37379a732c7Sopenharmony_ci * Creates a {@code DeviceManager} instance. 37479a732c7Sopenharmony_ci * 37579a732c7Sopenharmony_ci * <p>To manage devices, you must first call this method to obtain a {@code DeviceManager} instance and then 37679a732c7Sopenharmony_ci * use this instance to call other device management methods. 37779a732c7Sopenharmony_ci * 37879a732c7Sopenharmony_ci * @param bundleName Indicates the bundle name of the application. 37979a732c7Sopenharmony_ci * @param callback Indicates the callback to be invoked upon {@code DeviceManager} instance creation. 38079a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 38179a732c7Sopenharmony_ci */ 38279a732c7Sopenharmony_ci function createDeviceManager(bundleName: string, callback: AsyncCallback<DeviceManager>): void; 38379a732c7Sopenharmony_ci 38479a732c7Sopenharmony_ci /** 38579a732c7Sopenharmony_ci * Provides methods for managing devices. 38679a732c7Sopenharmony_ci */ 38779a732c7Sopenharmony_ci interface DeviceManager { 38879a732c7Sopenharmony_ci /** 38979a732c7Sopenharmony_ci * Releases the {@code DeviceManager} instance after the methods for device management are no longer used. 39079a732c7Sopenharmony_ci * 39179a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 39279a732c7Sopenharmony_ci */ 39379a732c7Sopenharmony_ci release(): void; 39479a732c7Sopenharmony_ci 39579a732c7Sopenharmony_ci /** 39679a732c7Sopenharmony_ci * Obtains a list of trusted devices. 39779a732c7Sopenharmony_ci * 39879a732c7Sopenharmony_ci * @return Returns a list of trusted devices. 39979a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 40079a732c7Sopenharmony_ci */ 40179a732c7Sopenharmony_ci getTrustedDeviceListSync(): Array<DeviceInfo>; 40279a732c7Sopenharmony_ci 40379a732c7Sopenharmony_ci /** 40479a732c7Sopenharmony_ci * Obtains a list of trusted devices. 40579a732c7Sopenharmony_ci * 40679a732c7Sopenharmony_ci * @since 10 40779a732c7Sopenharmony_ci * @param isRefresh Quickly refresh the list, and make nearby devices with the same account go online. 40879a732c7Sopenharmony_ci * @return Returns a list of trusted devices. 40979a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 41079a732c7Sopenharmony_ci */ 41179a732c7Sopenharmony_ci getTrustedDeviceListSync(isRefresh: boolean): Array<DeviceInfo>; 41279a732c7Sopenharmony_ci 41379a732c7Sopenharmony_ci /** 41479a732c7Sopenharmony_ci * Obtains a list of trusted devices. 41579a732c7Sopenharmony_ci * 41679a732c7Sopenharmony_ci * @since 8 41779a732c7Sopenharmony_ci * @param callback Indicates the callback to be invoked upon getTrustedDeviceList 41879a732c7Sopenharmony_ci * @return Returns a list of trusted devices. 41979a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 42079a732c7Sopenharmony_ci */ 42179a732c7Sopenharmony_ci getTrustedDeviceList(callback: AsyncCallback<Array<DeviceInfo>>): void; 42279a732c7Sopenharmony_ci 42379a732c7Sopenharmony_ci /** 42479a732c7Sopenharmony_ci * Obtains a list of trusted devices. 42579a732c7Sopenharmony_ci * 42679a732c7Sopenharmony_ci * @since 8 42779a732c7Sopenharmony_ci * @return Returns a list of trusted devices. 42879a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 42979a732c7Sopenharmony_ci */ 43079a732c7Sopenharmony_ci getTrustedDeviceList(): Promise<Array<DeviceInfo>>; 43179a732c7Sopenharmony_ci 43279a732c7Sopenharmony_ci /** 43379a732c7Sopenharmony_ci * Obtains local device info 43479a732c7Sopenharmony_ci * 43579a732c7Sopenharmony_ci * @since 8 43679a732c7Sopenharmony_ci * @return Returns local device info. 43779a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 43879a732c7Sopenharmony_ci */ 43979a732c7Sopenharmony_ci getLocalDeviceInfoSync(): DeviceInfo; 44079a732c7Sopenharmony_ci 44179a732c7Sopenharmony_ci /** 44279a732c7Sopenharmony_ci * Obtains local device info 44379a732c7Sopenharmony_ci * 44479a732c7Sopenharmony_ci * @since 8 44579a732c7Sopenharmony_ci * @param callback Indicates the callback to be invoked upon getLocalDeviceInfo 44679a732c7Sopenharmony_ci * @return Returns local device info. 44779a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 44879a732c7Sopenharmony_ci */ 44979a732c7Sopenharmony_ci getLocalDeviceInfo(callback: AsyncCallback<DeviceInfo>): void; 45079a732c7Sopenharmony_ci 45179a732c7Sopenharmony_ci /** 45279a732c7Sopenharmony_ci * Obtains local device info 45379a732c7Sopenharmony_ci * 45479a732c7Sopenharmony_ci * @since 8 45579a732c7Sopenharmony_ci * @return Returns local device info. 45679a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 45779a732c7Sopenharmony_ci */ 45879a732c7Sopenharmony_ci getLocalDeviceInfo(): Promise<DeviceInfo>; 45979a732c7Sopenharmony_ci 46079a732c7Sopenharmony_ci /** 46179a732c7Sopenharmony_ci * Obtains device info 46279a732c7Sopenharmony_ci * 46379a732c7Sopenharmony_ci * @since 10 46479a732c7Sopenharmony_ci * @param networkId device network id. 46579a732c7Sopenharmony_ci * @param callback Indicates the callback to be invoked upon getDeviceInfo 46679a732c7Sopenharmony_ci * @throws {BusinessError} 401 - Parameter error. Possible causes: 46779a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 46879a732c7Sopenharmony_ci * 2. Incorrect parameter type; 46979a732c7Sopenharmony_ci * 3. Parameter verification failed; 47079a732c7Sopenharmony_ci * 4. The size of specified networkId is greater than 255. 47179a732c7Sopenharmony_ci * @return Returns local device info. 47279a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 47379a732c7Sopenharmony_ci */ 47479a732c7Sopenharmony_ci getDeviceInfo(networkId: string, callback: AsyncCallback<DeviceInfo>): void; 47579a732c7Sopenharmony_ci 47679a732c7Sopenharmony_ci /** 47779a732c7Sopenharmony_ci * Obtains device info 47879a732c7Sopenharmony_ci * 47979a732c7Sopenharmony_ci * @since 10 48079a732c7Sopenharmony_ci * @param networkId device network id. 48179a732c7Sopenharmony_ci * @throws {BusinessError} 401 - Parameter error. Possible causes: 48279a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 48379a732c7Sopenharmony_ci * 2. Incorrect parameter type; 48479a732c7Sopenharmony_ci * 3. Parameter verification failed; 48579a732c7Sopenharmony_ci * 4. The size of specified networkId is greater than 255. 48679a732c7Sopenharmony_ci * @return Returns local device info. 48779a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 48879a732c7Sopenharmony_ci */ 48979a732c7Sopenharmony_ci getDeviceInfo(networkId: string): Promise<DeviceInfo>; 49079a732c7Sopenharmony_ci 49179a732c7Sopenharmony_ci /** 49279a732c7Sopenharmony_ci * Start to discover device. 49379a732c7Sopenharmony_ci * 49479a732c7Sopenharmony_ci * @since 8 49579a732c7Sopenharmony_ci * @param subscribeInfo subscribe info to discovery device 49679a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 49779a732c7Sopenharmony_ci */ 49879a732c7Sopenharmony_ci startDeviceDiscovery(subscribeInfo: SubscribeInfo): void; 49979a732c7Sopenharmony_ci 50079a732c7Sopenharmony_ci /** 50179a732c7Sopenharmony_ci * Start to discover device. 50279a732c7Sopenharmony_ci * 50379a732c7Sopenharmony_ci * @since 9 50479a732c7Sopenharmony_ci * @param subscribeInfo subscribe info to discovery device 50579a732c7Sopenharmony_ci * @param filterOptions filterOptions to filter discovery device 50679a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 50779a732c7Sopenharmony_ci */ 50879a732c7Sopenharmony_ci startDeviceDiscovery(subscribeInfo: SubscribeInfo, filterOptions?: string): void; 50979a732c7Sopenharmony_ci 51079a732c7Sopenharmony_ci /** 51179a732c7Sopenharmony_ci * Stop to discover device. 51279a732c7Sopenharmony_ci * 51379a732c7Sopenharmony_ci * @param subscribeId Service subscribe ID 51479a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 51579a732c7Sopenharmony_ci */ 51679a732c7Sopenharmony_ci stopDeviceDiscovery(subscribeId: number): void; 51779a732c7Sopenharmony_ci 51879a732c7Sopenharmony_ci /** 51979a732c7Sopenharmony_ci * Publish discover device. 52079a732c7Sopenharmony_ci * @since 9 52179a732c7Sopenharmony_ci * @param publishInfo publish info to Publish discovery device 52279a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 52379a732c7Sopenharmony_ci */ 52479a732c7Sopenharmony_ci publishDeviceDiscovery(publishInfo: PublishInfo): void; 52579a732c7Sopenharmony_ci 52679a732c7Sopenharmony_ci /** 52779a732c7Sopenharmony_ci * UnPublish discover device. 52879a732c7Sopenharmony_ci * @since 9 52979a732c7Sopenharmony_ci * @param publishId Service publish ID, identify a publish operation, should be a unique id in package range 53079a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 53179a732c7Sopenharmony_ci */ 53279a732c7Sopenharmony_ci unPublishDeviceDiscovery(publishId: number): void; 53379a732c7Sopenharmony_ci 53479a732c7Sopenharmony_ci /** 53579a732c7Sopenharmony_ci * Request credential registerInfo. 53679a732c7Sopenharmony_ci * 53779a732c7Sopenharmony_ci * @since 10 53879a732c7Sopenharmony_ci * @param requestInfo Request credential params. 53979a732c7Sopenharmony_ci * @param callback Indicates the callback to be invoked upon requestCredential 54079a732c7Sopenharmony_ci * @throws {BusinessError} 401 - Parameter error. Possible causes: 54179a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 54279a732c7Sopenharmony_ci * 2. Incorrect parameter type; 54379a732c7Sopenharmony_ci * 3. Parameter verification failed; 54479a732c7Sopenharmony_ci * 4. The size of specified requestInfo is greater than 255. 54579a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 54679a732c7Sopenharmony_ci */ 54779a732c7Sopenharmony_ci requestCredentialRegisterInfo(requestInfo: string, callback: AsyncCallback<{ registerInfo: string }>): void; 54879a732c7Sopenharmony_ci 54979a732c7Sopenharmony_ci /** 55079a732c7Sopenharmony_ci * Import credential information. 55179a732c7Sopenharmony_ci * 55279a732c7Sopenharmony_ci * @since 10 55379a732c7Sopenharmony_ci * @param credentialInfo Import credential params. 55479a732c7Sopenharmony_ci * @param callback Indicates the callback to be invoked upon importCredential 55579a732c7Sopenharmony_ci * @throws {BusinessError} 401 - Parameter error. Possible causes: 55679a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 55779a732c7Sopenharmony_ci * 2. Incorrect parameter type; 55879a732c7Sopenharmony_ci * 3. Parameter verification failed; 55979a732c7Sopenharmony_ci * 4. The size of specified credentialInfo is greater than 5999. 56079a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 56179a732c7Sopenharmony_ci */ 56279a732c7Sopenharmony_ci importCredential(credentialInfo: string, callback: AsyncCallback<{ resultInfo: string }>): void; 56379a732c7Sopenharmony_ci 56479a732c7Sopenharmony_ci /** 56579a732c7Sopenharmony_ci * delete credential information. 56679a732c7Sopenharmony_ci * 56779a732c7Sopenharmony_ci * @since 10 56879a732c7Sopenharmony_ci * @param queryInfo delete credential params. 56979a732c7Sopenharmony_ci * @param callback Indicates the callback to be invoked upon deleteCredential 57079a732c7Sopenharmony_ci * @throws {BusinessError} 401 - Parameter error. Possible causes: 57179a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 57279a732c7Sopenharmony_ci * 2. Incorrect parameter type; 57379a732c7Sopenharmony_ci * 3. Parameter verification failed; 57479a732c7Sopenharmony_ci * 4. The size of specified queryInfo is greater than 5999. 57579a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 57679a732c7Sopenharmony_ci */ 57779a732c7Sopenharmony_ci deleteCredential(queryInfo: string, callback: AsyncCallback<{ resultInfo: string }>): void; 57879a732c7Sopenharmony_ci 57979a732c7Sopenharmony_ci /** 58079a732c7Sopenharmony_ci * Authenticate the specified device. 58179a732c7Sopenharmony_ci * 58279a732c7Sopenharmony_ci * @param deviceInfo deviceInfo of device to authenticate 58379a732c7Sopenharmony_ci * @param authParam authParam of device to authenticate 58479a732c7Sopenharmony_ci * @param callback Indicates the callback to be invoked upon authenticateDevice 58579a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 58679a732c7Sopenharmony_ci */ 58779a732c7Sopenharmony_ci authenticateDevice(deviceInfo: DeviceInfo, authParam: AuthParam, callback: AsyncCallback<{ deviceId: string, pinTone?: number }>): void; 58879a732c7Sopenharmony_ci 58979a732c7Sopenharmony_ci /** 59079a732c7Sopenharmony_ci * unAuthenticate the specified device. 59179a732c7Sopenharmony_ci * 59279a732c7Sopenharmony_ci * @since 8 59379a732c7Sopenharmony_ci * @param deviceInfo deviceInfo of device to unAuthenticate 59479a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 59579a732c7Sopenharmony_ci */ 59679a732c7Sopenharmony_ci unAuthenticateDevice(deviceInfo: DeviceInfo): void; 59779a732c7Sopenharmony_ci 59879a732c7Sopenharmony_ci /** 59979a732c7Sopenharmony_ci * verify auth info, such as pin code. 60079a732c7Sopenharmony_ci * 60179a732c7Sopenharmony_ci * @param authInfo device auth info o verify 60279a732c7Sopenharmony_ci * @param callback Indicates the callback to be invoked upon verifyAuthInfo 60379a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 60479a732c7Sopenharmony_ci */ 60579a732c7Sopenharmony_ci verifyAuthInfo(authInfo: AuthInfo, callback: AsyncCallback<{ deviceId: string, level: number }>): void; 60679a732c7Sopenharmony_ci 60779a732c7Sopenharmony_ci /** 60879a732c7Sopenharmony_ci * Set user Operation from devicemanager ui, this interface can only be used by devicemanager ui. 60979a732c7Sopenharmony_ci * 61079a732c7Sopenharmony_ci * @since 9 61179a732c7Sopenharmony_ci * @param operateAction User Operation Actions. 61279a732c7Sopenharmony_ci * operateAction = 0 - allow authentication 61379a732c7Sopenharmony_ci * operateAction = 1 - cancel authentication 61479a732c7Sopenharmony_ci * operateAction = 2 - user operation timeout for authentication confirm 61579a732c7Sopenharmony_ci * operateAction = 3 - cancel pincode display 61679a732c7Sopenharmony_ci * operateAction = 4 - cancel pincode input 61779a732c7Sopenharmony_ci * operateAction = 5 - confirm pincode input 61879a732c7Sopenharmony_ci * @param params Indicates the input param of the user. 61979a732c7Sopenharmony_ci * @throws {BusinessError} 401 - Parameter error. Possible causes: 62079a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 62179a732c7Sopenharmony_ci * 2. Incorrect parameter type; 62279a732c7Sopenharmony_ci * 3. Parameter verification failed; 62379a732c7Sopenharmony_ci * 4. The size of specified params is greater than 255. 62479a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 62579a732c7Sopenharmony_ci */ 62679a732c7Sopenharmony_ci setUserOperation(operateAction: number, params: string): void; 62779a732c7Sopenharmony_ci 62879a732c7Sopenharmony_ci /** 62979a732c7Sopenharmony_ci * Register a callback from deviceManager service so that the devicemanager ui can be notified when ui statue 63079a732c7Sopenharmony_ci * changes. 63179a732c7Sopenharmony_ci * 63279a732c7Sopenharmony_ci * @since 9 63379a732c7Sopenharmony_ci * @param callback Indicates the devicemanager ui state to register. 63479a732c7Sopenharmony_ci * @throws {BusinessError} 401 - Parameter error. Possible causes: 63579a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 63679a732c7Sopenharmony_ci * 2. Incorrect parameter type; 63779a732c7Sopenharmony_ci * 3. Parameter verification failed; 63879a732c7Sopenharmony_ci * 4. The size of specified eventType is greater than 255. 63979a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 64079a732c7Sopenharmony_ci */ 64179a732c7Sopenharmony_ci on(type: 'uiStateChange', callback: Callback<{ param: string }>): void; 64279a732c7Sopenharmony_ci 64379a732c7Sopenharmony_ci /** 64479a732c7Sopenharmony_ci * Unregister uiStatueChange, this interface can only be used by devicemanager ui. 64579a732c7Sopenharmony_ci * 64679a732c7Sopenharmony_ci * @since 9 64779a732c7Sopenharmony_ci * @param callback Indicates the devicemanager ui state to unregister. 64879a732c7Sopenharmony_ci * @throws {BusinessError} 401 - Parameter error. Possible causes: 64979a732c7Sopenharmony_ci * 1. Mandatory parameters are left unspecified; 65079a732c7Sopenharmony_ci * 2. Incorrect parameter type; 65179a732c7Sopenharmony_ci * 3. Parameter verification failed; 65279a732c7Sopenharmony_ci * 4. The size of specified eventType is greater than 255. 65379a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 65479a732c7Sopenharmony_ci */ 65579a732c7Sopenharmony_ci off(type: 'uiStateChange', callback?: Callback<{ param: string }>): void; 65679a732c7Sopenharmony_ci 65779a732c7Sopenharmony_ci /** 65879a732c7Sopenharmony_ci * Register a device state callback so that the application can be notified upon device state changes based on 65979a732c7Sopenharmony_ci * the application bundle name. 66079a732c7Sopenharmony_ci * 66179a732c7Sopenharmony_ci * @param bundleName Indicates the bundle name of the application. 66279a732c7Sopenharmony_ci * @param callback Indicates the device state callback to register. 66379a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 66479a732c7Sopenharmony_ci */ 66579a732c7Sopenharmony_ci on(type: 'deviceStateChange', callback: Callback<{ action: DeviceStateChangeAction, device: DeviceInfo }>): void; 66679a732c7Sopenharmony_ci 66779a732c7Sopenharmony_ci /** 66879a732c7Sopenharmony_ci * UnRegister device state callback based on the application bundle name. 66979a732c7Sopenharmony_ci * 67079a732c7Sopenharmony_ci * @param bundleName Indicates the bundle name of the application. 67179a732c7Sopenharmony_ci * @param callback Indicates the device state callback to register. 67279a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 67379a732c7Sopenharmony_ci */ 67479a732c7Sopenharmony_ci off(type: 'deviceStateChange', callback?: Callback<{ action: DeviceStateChangeAction, device: DeviceInfo }>): void; 67579a732c7Sopenharmony_ci 67679a732c7Sopenharmony_ci /** 67779a732c7Sopenharmony_ci * Register a device found callback so that the application can be notified when the device was found 67879a732c7Sopenharmony_ci * 67979a732c7Sopenharmony_ci * @param callback Indicates the device found callback to register. 68079a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 68179a732c7Sopenharmony_ci */ 68279a732c7Sopenharmony_ci on(type: 'deviceFound', callback: Callback<{ subscribeId: number, device: DeviceInfo }>): void; 68379a732c7Sopenharmony_ci 68479a732c7Sopenharmony_ci /** 68579a732c7Sopenharmony_ci * UnRegister a device found callback so that the application can be notified when the device was found 68679a732c7Sopenharmony_ci * 68779a732c7Sopenharmony_ci * @param callback Indicates the device found callback to register. 68879a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 68979a732c7Sopenharmony_ci */ 69079a732c7Sopenharmony_ci off(type: 'deviceFound', callback?: Callback<{ subscribeId: number, device: DeviceInfo }>): void; 69179a732c7Sopenharmony_ci 69279a732c7Sopenharmony_ci /** 69379a732c7Sopenharmony_ci * Register a device found result callback so that the application can be notified when the device discover was failed 69479a732c7Sopenharmony_ci * 69579a732c7Sopenharmony_ci * @param callback Indicates the device found result callback to register. 69679a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 69779a732c7Sopenharmony_ci */ 69879a732c7Sopenharmony_ci on(type: 'discoverFail', callback: Callback<{ subscribeId: number, reason: number }>): void; 69979a732c7Sopenharmony_ci 70079a732c7Sopenharmony_ci /** 70179a732c7Sopenharmony_ci * UnRegister a device found result callback so that the application can be notified when the device discover was failed 70279a732c7Sopenharmony_ci * 70379a732c7Sopenharmony_ci * @param callback Indicates the device found result callback to register. 70479a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 70579a732c7Sopenharmony_ci */ 70679a732c7Sopenharmony_ci off(type: 'discoverFail', callback?: Callback<{ subscribeId: number, reason: number }>): void; 70779a732c7Sopenharmony_ci 70879a732c7Sopenharmony_ci /** 70979a732c7Sopenharmony_ci * Register a device publish result callback so that the application can be notified when the device publish success 71079a732c7Sopenharmony_ci * 71179a732c7Sopenharmony_ci * @since 9 71279a732c7Sopenharmony_ci * @param callback Indicates the device publish result callback to register. 71379a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 71479a732c7Sopenharmony_ci */ 71579a732c7Sopenharmony_ci on(type: 'publishSuccess', callback: Callback<{ publishId: number }>): void; 71679a732c7Sopenharmony_ci 71779a732c7Sopenharmony_ci /** 71879a732c7Sopenharmony_ci * UnRegister a device publish result callback so that the application can be notified when the device publish was failed 71979a732c7Sopenharmony_ci * 72079a732c7Sopenharmony_ci * @since 9 72179a732c7Sopenharmony_ci * @param callback Indicates the device publish result callback to register. 72279a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 72379a732c7Sopenharmony_ci */ 72479a732c7Sopenharmony_ci off(type: 'publishSuccess', callback?: Callback<{ publishId: number }>): void; 72579a732c7Sopenharmony_ci 72679a732c7Sopenharmony_ci /** 72779a732c7Sopenharmony_ci * Register a device publish result callback so that the application can be notified when the device publish was failed 72879a732c7Sopenharmony_ci * 72979a732c7Sopenharmony_ci * @since 9 73079a732c7Sopenharmony_ci * @param callback Indicates the device publish result callback to register. 73179a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 73279a732c7Sopenharmony_ci */ 73379a732c7Sopenharmony_ci on(type: 'publishFail', callback: Callback<{ publishId: number, reason: number }>): void; 73479a732c7Sopenharmony_ci 73579a732c7Sopenharmony_ci /** 73679a732c7Sopenharmony_ci * UnRegister a device publish result callback so that the application can be notified when the device publish was failed 73779a732c7Sopenharmony_ci * 73879a732c7Sopenharmony_ci * @since 9 73979a732c7Sopenharmony_ci * @param callback Indicates the device publish result callback to register. 74079a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 74179a732c7Sopenharmony_ci */ 74279a732c7Sopenharmony_ci off(type: 'publishFail', callback?: Callback<{ publishId: number, reason: number }>): void; 74379a732c7Sopenharmony_ci 74479a732c7Sopenharmony_ci /** 74579a732c7Sopenharmony_ci * Register a serviceError callback so that the application can be notified when devicemanager service died 74679a732c7Sopenharmony_ci * 74779a732c7Sopenharmony_ci * @param callback Indicates the service error callback to register. 74879a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 74979a732c7Sopenharmony_ci */ 75079a732c7Sopenharmony_ci on(type: 'serviceDie', callback: () => void): void; 75179a732c7Sopenharmony_ci 75279a732c7Sopenharmony_ci /** 75379a732c7Sopenharmony_ci * UnRegister a serviceError callback so that the application can be notified when devicemanager service died 75479a732c7Sopenharmony_ci * 75579a732c7Sopenharmony_ci * @param callback Indicates the service error callback to register. 75679a732c7Sopenharmony_ci * @systemapi this method can be used only by system applications. 75779a732c7Sopenharmony_ci */ 75879a732c7Sopenharmony_ci off(type: 'serviceDie', callback?: () => void): void; 75979a732c7Sopenharmony_ci } 76079a732c7Sopenharmony_ci} 76179a732c7Sopenharmony_ci 76279a732c7Sopenharmony_ciexport default deviceManager; 763