161847f8eSopenharmony_ci/*
261847f8eSopenharmony_ci * Copyright (c) 2020 Huawei Device Co., Ltd.
361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
461847f8eSopenharmony_ci * you may not use this file except in compliance with the License.
561847f8eSopenharmony_ci * You may obtain a copy of the License at
661847f8eSopenharmony_ci *
761847f8eSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
861847f8eSopenharmony_ci *
961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and
1361847f8eSopenharmony_ci * limitations under the License.
1461847f8eSopenharmony_ci */
1561847f8eSopenharmony_ci
1661847f8eSopenharmony_ci/**
1761847f8eSopenharmony_ci * @file
1861847f8eSopenharmony_ci * @kit ArkUI
1961847f8eSopenharmony_ci */
2061847f8eSopenharmony_ci
2161847f8eSopenharmony_ci/**
2261847f8eSopenharmony_ci * @typedef SubscribeMessageResponse
2361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Lite
2461847f8eSopenharmony_ci * @since 5
2561847f8eSopenharmony_ci * @deprecated since 8
2661847f8eSopenharmony_ci */
2761847f8eSopenharmony_ciexport interface SubscribeMessageResponse {
2861847f8eSopenharmony_ci  /**
2961847f8eSopenharmony_ci   * Peer device ID.
3061847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Lite
3161847f8eSopenharmony_ci   * @since 5
3261847f8eSopenharmony_ci   * @deprecated since 8
3361847f8eSopenharmony_ci   */
3461847f8eSopenharmony_ci  deviceId: string;
3561847f8eSopenharmony_ci
3661847f8eSopenharmony_ci  /**
3761847f8eSopenharmony_ci   * Name of the bundle where the peer ability has been located. The name is case sensitive.
3861847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Lite
3961847f8eSopenharmony_ci   * @since 5
4061847f8eSopenharmony_ci   * @deprecated since 8
4161847f8eSopenharmony_ci   */
4261847f8eSopenharmony_ci  bundleName: string;
4361847f8eSopenharmony_ci
4461847f8eSopenharmony_ci  /**
4561847f8eSopenharmony_ci   * Peer ability name, which is case sensitive.
4661847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Lite
4761847f8eSopenharmony_ci   * @since 5
4861847f8eSopenharmony_ci   * @deprecated since 8
4961847f8eSopenharmony_ci   */
5061847f8eSopenharmony_ci  abilityName: string;
5161847f8eSopenharmony_ci
5261847f8eSopenharmony_ci  /**
5361847f8eSopenharmony_ci   * Messages received from the device.
5461847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Lite
5561847f8eSopenharmony_ci   * @since 5
5661847f8eSopenharmony_ci   * @deprecated since 8
5761847f8eSopenharmony_ci   */
5861847f8eSopenharmony_ci  message: string;
5961847f8eSopenharmony_ci}
6061847f8eSopenharmony_ci
6161847f8eSopenharmony_ci/**
6261847f8eSopenharmony_ci * @typedef SendMessageOptions
6361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Lite
6461847f8eSopenharmony_ci * @since 5
6561847f8eSopenharmony_ci * @deprecated since 8
6661847f8eSopenharmony_ci */
6761847f8eSopenharmony_ciexport interface SendMessageOptions {
6861847f8eSopenharmony_ci  /**
6961847f8eSopenharmony_ci   * Destination device ID.
7061847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Lite
7161847f8eSopenharmony_ci   * @since 5
7261847f8eSopenharmony_ci   * @deprecated since 8
7361847f8eSopenharmony_ci   */
7461847f8eSopenharmony_ci  deviceId: string;
7561847f8eSopenharmony_ci
7661847f8eSopenharmony_ci  /**
7761847f8eSopenharmony_ci   * Name of the destination bundle where the ability has been located. The name is case sensitive.
7861847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Lite
7961847f8eSopenharmony_ci   * @since 5
8061847f8eSopenharmony_ci   * @deprecated since 8
8161847f8eSopenharmony_ci   */
8261847f8eSopenharmony_ci  bundleName: string;
8361847f8eSopenharmony_ci
8461847f8eSopenharmony_ci  /**
8561847f8eSopenharmony_ci   * Destination ability name, which is case sensitive.
8661847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Lite
8761847f8eSopenharmony_ci   * @since 5
8861847f8eSopenharmony_ci   * @deprecated since 8
8961847f8eSopenharmony_ci   */
9061847f8eSopenharmony_ci  abilityName: string;
9161847f8eSopenharmony_ci
9261847f8eSopenharmony_ci  /**
9361847f8eSopenharmony_ci   * Messages sent to the destination device.
9461847f8eSopenharmony_ci   * A maximum of 1 KB of data can be transmitted at a time.
9561847f8eSopenharmony_ci   * If more than 1 KB of data needs to be transmitted, split the messages into multiple parts to transmit.
9661847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Lite
9761847f8eSopenharmony_ci   * @since 5
9861847f8eSopenharmony_ci   * @deprecated since 8
9961847f8eSopenharmony_ci   */
10061847f8eSopenharmony_ci  message?: string;
10161847f8eSopenharmony_ci
10261847f8eSopenharmony_ci  /**
10361847f8eSopenharmony_ci   * Called when the messages are sent successfully.
10461847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Lite
10561847f8eSopenharmony_ci   * @since 5
10661847f8eSopenharmony_ci   * @deprecated since 8
10761847f8eSopenharmony_ci   */
10861847f8eSopenharmony_ci  success?: () => void;
10961847f8eSopenharmony_ci
11061847f8eSopenharmony_ci  /**
11161847f8eSopenharmony_ci   * Called when the messages fail to be sent.
11261847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Lite
11361847f8eSopenharmony_ci   * @since 5
11461847f8eSopenharmony_ci   * @deprecated since 8
11561847f8eSopenharmony_ci   */
11661847f8eSopenharmony_ci  fail?: (data: string, code: number) => void;
11761847f8eSopenharmony_ci
11861847f8eSopenharmony_ci  /**
11961847f8eSopenharmony_ci   * Called when the execution is completed.
12061847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Lite
12161847f8eSopenharmony_ci   * @since 5
12261847f8eSopenharmony_ci   * @deprecated since 8
12361847f8eSopenharmony_ci   */
12461847f8eSopenharmony_ci  complete?: () => void;
12561847f8eSopenharmony_ci}
12661847f8eSopenharmony_ci
12761847f8eSopenharmony_ci/**
12861847f8eSopenharmony_ci * @typedef SubscribeMessageOptions
12961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Lite
13061847f8eSopenharmony_ci * @since 5
13161847f8eSopenharmony_ci * @deprecated since 8
13261847f8eSopenharmony_ci */
13361847f8eSopenharmony_ciexport interface SubscribeMessageOptions {
13461847f8eSopenharmony_ci  /**
13561847f8eSopenharmony_ci   * Called when the messages are sent successfully.
13661847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Lite
13761847f8eSopenharmony_ci   * @since 5
13861847f8eSopenharmony_ci   * @deprecated since 8
13961847f8eSopenharmony_ci   */
14061847f8eSopenharmony_ci  success?: (data: SubscribeMessageResponse) => void;
14161847f8eSopenharmony_ci
14261847f8eSopenharmony_ci  /**
14361847f8eSopenharmony_ci   * Called when the messages fail to be sent.
14461847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Lite
14561847f8eSopenharmony_ci   * @since 5
14661847f8eSopenharmony_ci   * @deprecated since 8
14761847f8eSopenharmony_ci   */
14861847f8eSopenharmony_ci  fail?: (data: string, code: number) => void;
14961847f8eSopenharmony_ci}
15061847f8eSopenharmony_ci
15161847f8eSopenharmony_ci/**
15261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Lite
15361847f8eSopenharmony_ci * @systemapi
15461847f8eSopenharmony_ci * @since 5
15561847f8eSopenharmony_ci * @deprecated since 8
15661847f8eSopenharmony_ci * @useinstead ohos.ability.featureAbility.FeatureAbility
15761847f8eSopenharmony_ci */
15861847f8eSopenharmony_ciexport declare class FeatureAbility {
15961847f8eSopenharmony_ci  /**
16061847f8eSopenharmony_ci   * Sends messages to the destination device.
16161847f8eSopenharmony_ci   * @param { SendMessageOptions } options - Options.
16261847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Lite
16361847f8eSopenharmony_ci   * @systemapi
16461847f8eSopenharmony_ci   * @since 5
16561847f8eSopenharmony_ci   * @deprecated since 8
16661847f8eSopenharmony_ci   */
16761847f8eSopenharmony_ci  static sendMsg(options: SendMessageOptions): void;
16861847f8eSopenharmony_ci
16961847f8eSopenharmony_ci  /**
17061847f8eSopenharmony_ci   * Listens for messages sent from other devices.
17161847f8eSopenharmony_ci   * @param { SubscribeMessageOptions } options - Options.
17261847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Lite
17361847f8eSopenharmony_ci   * @systemapi
17461847f8eSopenharmony_ci   * @since 5
17561847f8eSopenharmony_ci   * @deprecated since 8
17661847f8eSopenharmony_ci   */
17761847f8eSopenharmony_ci  static subscribeMsg(options: SubscribeMessageOptions): void;
17861847f8eSopenharmony_ci
17961847f8eSopenharmony_ci  /**
18061847f8eSopenharmony_ci   * Cancel the listening for messages sent from other devices.
18161847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Lite
18261847f8eSopenharmony_ci   * @systemapi
18361847f8eSopenharmony_ci   * @since 5
18461847f8eSopenharmony_ci   * @deprecated since 8
18561847f8eSopenharmony_ci   */
18661847f8eSopenharmony_ci  static unsubscribeMsg(): void;
18761847f8eSopenharmony_ci}
188