• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023-2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit DistributedServiceKit
19 */
20
21import { AsyncCallback } from './@ohos.base';
22import { Callback } from './@ohos.base';
23
24/**
25 * Implements screen hopping operation management.
26 *
27 * @namespace cooperate
28 * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
29 * @systemapi Hide this for inner system use.
30 * @since 10
31 */
32declare namespace cooperate {
33  /**
34   * Enumerates screen hopping message notifications.
35   *
36   * @enum { number }
37   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
38   * @systemapi Hide this for inner system use.
39   * @since 10
40   * @deprecated since 11
41   * @useinstead cooperate#CooperateState
42   */
43  enum CooperateMsg {
44    /**
45     * Preparing for screen hopping.
46     *
47     * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
48     * @systemapi Hide this for inner system use.
49     * @since 10
50     * @deprecated since 11
51     * @useinstead cooperate.CooperateState#COOPERATE_PREPARE
52     */
53    COOPERATE_PREPARE = 0,
54
55    /**
56     * Canceling the preparation for screen hopping.
57     *
58     * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
59     * @systemapi Hide this for inner system use.
60     * @since 10
61     * @deprecated since 11
62     * @useinstead cooperate.CooperateState#COOPERATE_UNPREPARE
63     */
64    COOPERATE_UNPREPARE = 1,
65
66    /**
67     * Starting screen hopping.
68     *
69     * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
70     * @systemapi Hide this for inner system use.
71     * @since 10
72     * @deprecated since 11
73     * @useinstead cooperate.CooperateState#COOPERATE_ACTIVATE
74     */
75    COOPERATE_ACTIVATE = 2,
76
77    /**
78     * Success in starting screen hopping.
79     *
80     * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
81     * @systemapi Hide this for inner system use.
82     * @since 10
83     * @deprecated since 11
84     * @useinstead cooperate.CooperateState#COOPERATE_ACTIVATE_SUCCESS
85     */
86    COOPERATE_ACTIVATE_SUCCESS = 3,
87
88    /**
89     * Failure to start screen hopping.
90     *
91     * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
92     * @systemapi Hide this for inner system use.
93     * @since 10
94     * @deprecated since 11
95     * @useinstead cooperate.CooperateState#COOPERATE_ACTIVATE_FAILURE
96     */
97    COOPERATE_ACTIVATE_FAIL = 4,
98
99    /**
100     * Success in stopping screen hopping.
101     *
102     * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
103     * @systemapi Hide this for inner system use.
104     * @since 10
105     * @deprecated since 11
106     * @useinstead cooperate.CooperateState#COOPERATE_DEACTIVATE_SUCCESS
107     */
108    COOPERATE_DEACTIVATE_SUCCESS = 5,
109
110    /**
111     * Failure to stop screen hopping.
112     *
113     * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
114     * @systemapi Hide this for inner system use.
115     * @since 10
116     * @deprecated since 11
117     * @useinstead cooperate.CooperateState#COOPERATE_DEACTIVATE_FAILURE
118     */
119    COOPERATE_DEACTIVATE_FAIL = 6,
120
121    /**
122     * Inter-device session disconnected.
123     *
124     * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
125     * @systemapi Hide this for inner system use.
126     * @since 10
127     * @deprecated since 11
128     * @useinstead cooperate.CooperateState#COOPERATE_SESSION_DISCONNECTED
129     */
130    COOPERATE_SESSION_DISCONNECTED = 7,
131  }
132
133  /**
134   * Enumerates the screen hopping states.
135   *
136   * @enum { number }
137   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
138   * @systemapi Hide this for inner system use.
139   * @since 11
140   */
141  enum CooperateState {
142    /**
143     * Preparing for screen hopping.
144     *
145     * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
146     * @systemapi Hide this for inner system use.
147     * @since 11
148     */
149    COOPERATE_PREPARE = 0,
150
151    /**
152     * Canceling the preparation for screen hopping.
153     *
154     * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
155     * @systemapi Hide this for inner system use.
156     * @since 11
157     */
158    COOPERATE_UNPREPARE = 1,
159
160    /**
161     * Starting screen hopping.
162     *
163     * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
164     * @systemapi Hide this for inner system use.
165     * @since 11
166     */
167    COOPERATE_ACTIVATE = 2,
168
169    /**
170     * Success in starting screen hopping.
171     *
172     * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
173     * @systemapi Hide this for inner system use.
174     * @since 11
175     */
176    COOPERATE_ACTIVATE_SUCCESS = 3,
177
178    /**
179     * Failure to start screen hopping.
180     *
181     * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
182     * @systemapi Hide this for inner system use.
183     * @since 11
184     */
185    COOPERATE_ACTIVATE_FAILURE = 4,
186
187    /**
188     * Success in stopping screen hopping.
189     *
190     * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
191     * @systemapi Hide this for inner system use.
192     * @since 11
193     */
194    COOPERATE_DEACTIVATE_SUCCESS = 5,
195
196    /**
197     * Failure to stop screen hopping.
198     *
199     * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
200     * @systemapi Hide this for inner system use.
201     * @since 11
202     */
203    COOPERATE_DEACTIVATE_FAILURE = 6,
204
205    /**
206     * Inter-device session disconnected.
207     *
208     * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
209     * @systemapi Hide this for inner system use.
210     * @since 11
211     */
212    COOPERATE_SESSION_DISCONNECTED = 7,
213  }
214
215  /**
216   * Defines a screen hopping message.
217   *
218   * @interface CooperateMessage
219   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
220   * @systemapi Hide this for inner system use.
221   * @since 11
222   */
223  interface CooperateMessage {
224    /**
225     * Descriptor of the target device for screen hopping.
226     *
227     * @type { string }
228     * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
229     * @systemapi Hide this for inner system use.
230     * @since 11
231     */
232    networkId: string;
233
234    /**
235     * Screen hopping state.
236     *
237     * @type { CooperateState }
238     * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
239     * @systemapi Hide this for inner system use.
240     * @since 11
241     */
242    state: CooperateState;
243  }
244
245  /**
246   *  MouseLocation
247   *
248   * @typedef MouseLocation
249   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
250   * @systemapi Hide this for inner system use.
251   * @since 12
252   */
253  interface MouseLocation {
254    /**
255     * The mouse pointer is located at the X coordinate on the screen.
256     *
257     * @type { number }
258     * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
259     * @systemapi Hide this for inner system use.
260     * @since 12
261     */
262    displayX: number;
263
264    /**
265     * The mouse pointer is located at the Y coordinate on the screen.
266     *
267     * @type { number }
268     * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
269     * @systemapi Hide this for inner system use.
270     * @since 12
271     */
272    displayY: number;
273
274    /**
275     * Screen width.
276     *
277     * @type { number }
278     * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
279     * @systemapi Hide this for inner system use.
280     * @since 12
281     */
282    displayWidth: number;
283
284    /**
285     * Screen height.
286     *
287     * @type { number }
288     * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
289     * @systemapi Hide this for inner system use.
290     * @since 12
291     */
292    displayHeight: number;
293  }
294
295  /**
296   * Prepares for screen hopping.
297   *
298   * @param { AsyncCallback<void> } callback Asynchronous callback used to return the operation result.
299   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
300   * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
301   * <br>2.Incorrect parameter types.3.Parameter verification failed.
302   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
303   * @systemapi Hide this for inner system use.
304   * @since 10
305   * @deprecated since 11
306   * @useinstead cooperate#prepareCooperate
307   */
308  function prepare(callback: AsyncCallback<void>): void;
309
310  /**
311   * Prepares for screen hopping.
312   *
313   * @returns { Promise<void> } the promise returned by the function.
314   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
315   * @throws {BusinessError} 401 - Parameter error.Possible causes: 1. Mandatory parameters are left unspecified.
316   * <br>2.Incorrect parameter types.3.Parameter verification failed.
317   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
318   * @systemapi Hide this for inner system use.
319   * @since 10
320   * @deprecated since 11
321   * @useinstead cooperate#prepareCooperate
322   */
323  function prepare(): Promise<void>;
324
325  /**
326   * Prepares for screen hopping.
327   *
328   * @permission ohos.permission.COOPERATE_MANAGER
329   * @param { AsyncCallback<void> } callback - Asynchronous callback used to return the operation result.
330   * @throws {BusinessError} 201 - Permission denied.
331   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
332   * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
333   * <br>2.Incorrect parameter types.3.Parameter verification failed.
334   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
335   * @systemapi Hide this for inner system use.
336   * @since 11
337   */
338  function prepareCooperate(callback: AsyncCallback<void>): void;
339
340  /**
341   * Prepares for screen hopping.
342   *
343   * @permission ohos.permission.COOPERATE_MANAGER
344   * @returns { Promise<void> } the promise returned by the function.
345   * @throws {BusinessError} 201 - Permission denied.
346   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
347   * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
348   * <br>2.Incorrect parameter types.3.Parameter verification failed.
349   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
350   * @systemapi Hide this for inner system use.
351   * @since 11
352   */
353  function prepareCooperate(): Promise<void>;
354
355  /**
356   * Cancels the preparation for screen hopping.
357   *
358   * @param { AsyncCallback<void> } callback Asynchronous callback used to return the operation result.
359   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
360   * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
361   * <br>2.Incorrect parameter types.3.Parameter verification failed.
362   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
363   * @systemapi Hide this for inner system use.
364   * @since 10
365   * @deprecated since 11
366   * @useinstead cooperate#unprepareCooperate
367   */
368  function unprepare(callback: AsyncCallback<void>): void;
369
370  /**
371   * Cancels the preparation for screen hopping.
372   *
373   * @returns { Promise<void> } the promise returned by the function.
374   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
375   * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
376   * <br>2.Incorrect parameter types.3.Parameter verification failed.
377   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
378   * @systemapi Hide this for inner system use.
379   * @since 10
380   * @deprecated since 11
381   * @useinstead cooperate#unprepareCooperate
382   */
383  function unprepare(): Promise<void>;
384
385  /**
386   * Cancels the preparation for screen hopping.
387   *
388   * @permission ohos.permission.COOPERATE_MANAGER
389   * @param { AsyncCallback<void> } callback - Asynchronous callback used to return the operation result.
390   * @throws {BusinessError} 201 - Permission denied.
391   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
392   * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
393   * <br>2.Incorrect parameter types.3.Parameter verification failed.
394   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
395   * @systemapi Hide this for inner system use.
396   * @since 11
397   */
398  function unprepareCooperate(callback: AsyncCallback<void>): void;
399
400  /**
401   * Cancels the preparation for screen hopping.
402   *
403   * @permission ohos.permission.COOPERATE_MANAGER
404   * @returns { Promise<void> } the promise returned by the function.
405   * @throws {BusinessError} 201 - Permission denied.
406   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
407   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
408   * @systemapi Hide this for inner system use.
409   * @since 11
410   */
411  function unprepareCooperate(): Promise<void>;
412
413  /**
414   * Starts screen hopping.
415   *
416   * @param { string } targetNetworkId Descriptor of the target device for screen hopping.
417   * @param { number } inputDeviceId Identifier of the input device for screen hopping.
418   * @param { AsyncCallback<void> } callback Asynchronous callback used to return the operation result.
419   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
420   * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
421   * <br>2.Incorrect parameter types.3.Parameter verification failed.
422   * @throws {BusinessError} 20900001 - Service exception. Possible causes: 1. A system error, such as null pointer,
423   * <br>container-related exception, or IPC exception. 2. N-API invocation exception or invalid N-API status.
424   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
425   * @systemapi Hide this for inner system use.
426   * @since 10
427   * @deprecated since 11
428   * @useinstead cooperate#activateCooperate
429   */
430  function activate(targetNetworkId: string, inputDeviceId: number, callback: AsyncCallback<void>): void;
431
432  /**
433   * Starts screen hopping.
434   *
435   * @param { string } targetNetworkId Descriptor of the target device for screen hopping.
436   * @param { number }inputDeviceId Identifier of the input device for screen hopping.
437   * @returns { Promise<void> } the promise returned by the function.
438   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
439   * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
440   * <br>2.Incorrect parameter types.3.Parameter verification failed.
441   * @throws {BusinessError} 20900001 - Service exception. Possible causes: 1. A system error, such as null pointer,
442   * <br>container-related exception, or IPC exception. 2. N-API invocation exception or invalid N-API status.
443   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
444   * @systemapi Hide this for inner system use.
445   * @since 10
446   * @deprecated since 11
447   * @useinstead cooperate#activateCooperate
448   */
449  function activate(targetNetworkId: string, inputDeviceId: number): Promise<void>;
450
451  /**
452   * Starts screen hopping.
453   *
454   * @permission ohos.permission.COOPERATE_MANAGER
455   * @param { string } targetNetworkId - Descriptor of the target device for screen hopping.
456   * @param { number } inputDeviceId - Identifier of the input device for screen hopping.
457   * @param { AsyncCallback<void> } callback - Asynchronous callback used to return the operation result.
458   * @throws {BusinessError} 201 - Permission denied.
459   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
460   * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
461   * <br>2.Incorrect parameter types.3.Parameter verification failed.
462   * @throws {BusinessError} 20900001 - Service exception. Possible causes: 1. A system error, such as null pointer,
463   * <br>container-related exception, or IPC exception. 2. N-API invocation exception or invalid N-API status.
464   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
465   * @systemapi Hide this for inner system use.
466   * @since 11
467   */
468  function activateCooperate(targetNetworkId: string, inputDeviceId: number, callback: AsyncCallback<void>): void;
469
470  /**
471   * Starts screen hopping.
472   *
473   * @permission ohos.permission.COOPERATE_MANAGER
474   * @param { string } targetNetworkId - Descriptor of the target device for screen hopping.
475   * @param { number }inputDeviceId - Identifier of the input device for screen hopping.
476   * @returns { Promise<void> } the promise returned by the function.
477   * @throws {BusinessError} 201 - Permission denied.
478   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
479   * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
480   * <br>2.Incorrect parameter types.3.Parameter verification failed.
481   * @throws {BusinessError} 20900001 - Service exception. Possible causes: 1. A system error, such as null pointer,
482   * <br>container-related exception, or IPC exception. 2. N-API invocation exception or invalid N-API status.
483   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
484   * @systemapi Hide this for inner system use.
485   * @since 11
486   */
487  function activateCooperate(targetNetworkId: string, inputDeviceId: number): Promise<void>;
488
489  /**
490   * Stops screen hopping.
491   *
492   * @param { boolean } isUnchained Whether the cross-device link is unchained.
493   * @param { AsyncCallback<void> } callback Asynchronous callback used to return the operation result.
494   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
495   * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
496   * <br>2.Incorrect parameter types.3.Parameter verification failed.
497   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
498   * @systemapi Hide this for inner system use.
499   * @since 10
500   * @deprecated since 11
501   * @useinstead cooperate#deactivateCooperate
502   */
503  function deactivate(isUnchained: boolean, callback: AsyncCallback<void>): void;
504
505  /**
506   * Stops screen hopping.
507   *
508   * @param { boolean } isUnchained Whether the cross-device link is unchained.
509   * @returns { Promise<void> } the promise returned by the function.
510   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
511   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
512   * @systemapi Hide this for inner system use.
513   * @since 10
514   * @deprecated since 11
515   * @useinstead cooperate#deactivateCooperate
516   */
517  function deactivate(isUnchained: boolean): Promise<void>;
518
519  /**
520   * Stops screen hopping.
521   *
522   * @permission ohos.permission.COOPERATE_MANAGER
523   * @param { boolean } isUnchained - Whether the cross-device link is unchained.
524   * @param { AsyncCallback<void> } callback - Asynchronous callback used to return the operation result.
525   * @throws {BusinessError} 201 - Permission denied.
526   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
527   * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
528   * <br>2.Incorrect parameter types.3.Parameter verification failed.
529   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
530   * @systemapi Hide this for inner system use.
531   * @since 11
532   */
533  function deactivateCooperate(isUnchained: boolean, callback: AsyncCallback<void>): void;
534
535  /**
536   * Stops screen hopping.
537   *
538   * @permission ohos.permission.COOPERATE_MANAGER
539   * @param { boolean } isUnchained - Whether the cross-device link is unchained.
540   * @returns { Promise<void> } the promise returned by the function.
541   * @throws {BusinessError} 201 - Permission denied.
542   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
543   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
544   * @systemapi Hide this for inner system use.
545   * @since 11
546   */
547  function deactivateCooperate(isUnchained: boolean): Promise<void>;
548
549  /**
550   * Obtains the screen hopping status.
551   *
552   * @param { string } networkId Descriptor of the target device for screen hopping.
553   * @param { AsyncCallback<boolean> } callback Asynchronous callback used to return the screen hopping status.
554   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
555   * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
556   * <br>2.Incorrect parameter types.3.Parameter verification failed.
557   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
558   * @systemapi Hide this for inner system use.
559   * @since 10
560   * @deprecated since 11
561   * @useinstead cooperate#getCooperateSwitchState
562   */
563  function getCrossingSwitchState(networkId: string, callback: AsyncCallback<boolean>): void;
564
565  /**
566   * Obtains the status of the screen hopping switch.
567   *
568   * @param { string } networkId Descriptor of the target device for screen hopping.
569   * @returns { Promise<boolean> } Returns {@code true} the screen hopping status;
570   *                               returns {@code false} otherwise.
571   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
572   * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
573   * <br>2.Incorrect parameter types.3.Parameter verification failed.
574   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
575   * @systemapi Hide this for inner system use.
576   * @since 10
577   * @deprecated since 11
578   * @useinstead cooperate#getCooperateSwitchState
579   */
580  function getCrossingSwitchState(networkId: string): Promise<boolean>;
581
582
583  /**
584   * Obtains the screen hopping status.
585   *
586   * @permission ohos.permission.COOPERATE_MANAGER
587   * @param { string } networkId - Descriptor of the target device for screen hopping.
588   * @param { AsyncCallback<boolean> } callback - Asynchronous callback used to return the screen hopping status.
589   * @throws {BusinessError} 201 - Permission denied.
590   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
591   * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
592   * <br>2.Incorrect parameter types.3.Parameter verification failed.
593   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
594   * @systemapi Hide this for inner system use.
595   * @since 11
596   */
597  function getCooperateSwitchState(networkId: string, callback: AsyncCallback<boolean>): void;
598
599  /**
600   * Obtains the status of the screen hopping switch.
601   *
602   * @permission ohos.permission.COOPERATE_MANAGER
603   * @param { string } networkId - Descriptor of the target device for screen hopping.
604   * @returns { Promise<boolean> } Returns {@code true} the screen hopping status;
605   *                               returns {@code false} otherwise.
606   * @throws {BusinessError} 201 - Permission denied.
607   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
608   * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
609   * <br>2.Incorrect parameter types.3.Parameter verification failed.
610   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
611   * @systemapi Hide this for inner system use.
612   * @since 11
613   */
614  function getCooperateSwitchState(networkId: string): Promise<boolean>;
615
616  /**
617   * Enables listening for screen hopping status change events.
618   *
619   * @param { 'cooperate' } type Change type.
620   * @param { Callback<{ networkId: string, msg: CooperateMsg }> } callback Asynchronous callback used to
621   * <br>return the screen hopping status change event.
622   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
623   * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
624   * <br>2.Incorrect parameter types.3.Parameter verification failed.
625   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
626   * @systemapi Hide this for inner system use.
627   * @since 10
628   * @deprecated since 11
629   * @useinstead cooperate#on
630   */
631  function on(type: 'cooperate', callback: Callback<{ networkId: string, msg: CooperateMsg }>): void;
632
633  /**
634   * Disables listening for screen hopping status change events.
635   *
636   * @param { 'cooperate' } type Change type.
637   * @param { Callback<void> } callback Callback for which listening
638   * <br>is disabled. If this parameter is not specified, listening will be disabled for all registered callbacks.
639   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
640   * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
641   * <br>2.Incorrect parameter types.3.Parameter verification failed.
642   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
643   * @systemapi Hide this for inner system use.
644   * @since 10
645   * @deprecated since 11
646   * @useinstead cooperate#on
647   */
648  function off(type: 'cooperate', callback?: Callback<void>): void;
649
650  /**
651   * Enables listening for screen hopping status change events.
652   *
653   * @permission ohos.permission.COOPERATE_MANAGER
654   * @param { 'cooperateMessage' } type - Change type.
655   * @param { Callback<CooperateMessage> } callback - Asynchronous callback used to
656   * <br>return the screen hopping status change event.
657   * @throws {BusinessError} 201 - Permission denied.
658   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
659   * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
660   * <br>2.Incorrect parameter types.3.Parameter verification failed.
661   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
662   * @systemapi Hide this for inner system use.
663   * @since 11
664   */
665  function on(type: 'cooperateMessage', callback: Callback<CooperateMessage>): void;
666
667  /**
668   * Disables listening for screen hopping status change events.
669   *
670   * @permission ohos.permission.COOPERATE_MANAGER
671   * @param { 'cooperateMessage' } type - Change type.
672   * @param { Callback<CooperateMessage> } [callback] - Callback for which listening
673   * <br>is disabled. If this parameter is not specified, listening will be disabled for all registered callbacks.
674   * @throws {BusinessError} 201 - Permission denied.
675   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
676   * @throws {BusinessError} 401 - Parameter error. Possible causes:1.Incorrect parameter types.2.Parameter
677   * <br>verification failed.
678   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
679   * @systemapi Hide this for inner system use.
680   * @since 11
681   */
682  function off(type: 'cooperateMessage', callback?: Callback<CooperateMessage>): void;
683
684  /**
685   * Enables listening for mouse pointer position information on the specified device.
686   *
687   * @permission ohos.permission.COOPERATE_MANAGER
688   * @param { 'cooperateMouse' } type - Event type, which is **cooperateMouse**.
689   * @param { string } networkId - Specified device.
690   * @param { Callback<MouseLocation> } callback - Callback for receiving reported events.
691   * @throws {BusinessError} 201 - Permission denied.
692   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
693   * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
694   * <br>2.Incorrect parameter types.3.Parameter verification failed.
695   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
696   * @systemapi Hide this for inner system use.
697   * @since 12
698   */
699  function on(type: 'cooperateMouse', networkId: string, callback: Callback<MouseLocation>): void;
700
701 /**
702   * Disables listening for mouse pointer position information on the specified device.
703   *
704   * @permission ohos.permission.COOPERATE_MANAGER
705   * @param { 'cooperateMouse' } type - Event type, which is **cooperateMouse**.
706   * @param { string } networkId - Specified device.
707   * @param { Callback<MouseLocation> } [callback] - Callback for receiving reported events.
708   * <br>If no callback is specified, listening will be disabled for all **cooperateMouse** events of the device specified by **networkId**.
709   * @throws {BusinessError} 201 - Permission denied.
710   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
711   * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
712   * <br>2.Incorrect parameter types.3.Parameter verification failed.
713   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
714   * @systemapi Hide this for inner system use.
715   * @since 12
716   */
717  function off(type: 'cooperateMouse', networkId: string, callback?: Callback<MouseLocation>): void;
718
719/**
720   * Starts screen hopping with options.
721   *
722   * @permission ohos.permission.COOPERATE_MANAGER
723   * @param { string } targetNetworkId - Descriptor of the target device for screen hopping.
724   * @param { number } inputDeviceId - Identifier of the input device for screen hopping.
725   * @param { CooperateOptions } cooperateOptions - Cooperation options for peer device, optional.
726   * @returns { Promise<void> } the promise returned by the function.
727   * @throws {BusinessError} 201 - Permission denied.
728   * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API.
729   * @throws {BusinessError} 20900001 - Operation failed.
730   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
731   * @systemapi Hide this for inner system use.
732   * @since 20
733   */
734  function activateCooperateWithOptions(targetNetworkId: string, inputDeviceId: number,
735    cooperateOptions?: CooperateOptions
736  ): Promise<void>;
737
738  /**
739   * Cooperation options for peer device.
740   * @interface { CooperateOptions }
741   * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
742   * @systemapi Hide this for inner system use.
743   * @since 20
744   */
745  interface CooperateOptions {
746
747    /**
748     * The mouse pointer is located at the X coordinate on the screen.
749     *
750     * @type { number }
751     * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
752     * @systemapi Hide this for inner system use.
753     * @since 20
754     */
755    displayX: number;
756
757    /**
758     * Identifier of the peer device screen.
759     *
760     * @type { number }
761     * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
762     * @systemapi Hide this for inner system use.
763     * @since 20
764     */
765    displayId: number;
766
767    /**
768     * The mouse pointer is located at the Y coordinate on the screen.
769     *
770     * @type { number }
771     * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate
772     * @systemapi Hide this for inner system use.
773     * @since 20
774     */
775    displayY: number;
776  }
777}
778
779export default cooperate;
780