1/* 2 * Copyright (c) 2023-2024 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 - Operation failed. 423 * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate 424 * @systemapi Hide this for inner system use. 425 * @since 10 426 * @deprecated since 11 427 * @useinstead cooperate#activateCooperate 428 */ 429 function activate(targetNetworkId: string, inputDeviceId: number, callback: AsyncCallback<void>): void; 430 431 /** 432 * Starts screen hopping. 433 * 434 * @param { string } targetNetworkId Descriptor of the target device for screen hopping. 435 * @param { number }inputDeviceId Identifier of the input device for screen hopping. 436 * @returns { Promise<void> } the promise returned by the function. 437 * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API. 438 * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 439 * <br>2.Incorrect parameter types.3.Parameter verification failed. 440 * @throws {BusinessError} 20900001 - Operation failed. 441 * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate 442 * @systemapi Hide this for inner system use. 443 * @since 10 444 * @deprecated since 11 445 * @useinstead cooperate#activateCooperate 446 */ 447 function activate(targetNetworkId: string, inputDeviceId: number): Promise<void>; 448 449 /** 450 * Starts screen hopping. 451 * 452 * @permission ohos.permission.COOPERATE_MANAGER 453 * @param { string } targetNetworkId - Descriptor of the target device for screen hopping. 454 * @param { number } inputDeviceId - Identifier of the input device for screen hopping. 455 * @param { AsyncCallback<void> } callback - Asynchronous callback used to return the operation result. 456 * @throws {BusinessError} 201 - Permission denied. 457 * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API. 458 * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 459 * <br>2.Incorrect parameter types.3.Parameter verification failed. 460 * @throws {BusinessError} 20900001 - Operation failed. 461 * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate 462 * @systemapi Hide this for inner system use. 463 * @since 11 464 */ 465 function activateCooperate(targetNetworkId: string, inputDeviceId: number, callback: AsyncCallback<void>): void; 466 467 /** 468 * Starts screen hopping. 469 * 470 * @permission ohos.permission.COOPERATE_MANAGER 471 * @param { string } targetNetworkId - Descriptor of the target device for screen hopping. 472 * @param { number }inputDeviceId - Identifier of the input device for screen hopping. 473 * @returns { Promise<void> } the promise returned by the function. 474 * @throws {BusinessError} 201 - Permission denied. 475 * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API. 476 * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 477 * <br>2.Incorrect parameter types.3.Parameter verification failed. 478 * @throws {BusinessError} 20900001 - Operation failed. 479 * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate 480 * @systemapi Hide this for inner system use. 481 * @since 11 482 */ 483 function activateCooperate(targetNetworkId: string, inputDeviceId: number): Promise<void>; 484 485 /** 486 * Stops screen hopping. 487 * 488 * @param { boolean } isUnchained Whether the cross-device link is unchained. 489 * @param { AsyncCallback<void> } callback Asynchronous callback used to return the operation result. 490 * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API. 491 * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 492 * <br>2.Incorrect parameter types.3.Parameter verification failed. 493 * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate 494 * @systemapi Hide this for inner system use. 495 * @since 10 496 * @deprecated since 11 497 * @useinstead cooperate#deactivateCooperate 498 */ 499 function deactivate(isUnchained: boolean, callback: AsyncCallback<void>): void; 500 501 /** 502 * Stops screen hopping. 503 * 504 * @param { boolean } isUnchained Whether the cross-device link is unchained. 505 * @returns { Promise<void> } the promise returned by the function. 506 * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API. 507 * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate 508 * @systemapi Hide this for inner system use. 509 * @since 10 510 * @deprecated since 11 511 * @useinstead cooperate#deactivateCooperate 512 */ 513 function deactivate(isUnchained: boolean): Promise<void>; 514 515 /** 516 * Stops screen hopping. 517 * 518 * @permission ohos.permission.COOPERATE_MANAGER 519 * @param { boolean } isUnchained - Whether the cross-device link is unchained. 520 * @param { AsyncCallback<void> } callback - Asynchronous callback used to return the operation result. 521 * @throws {BusinessError} 201 - Permission denied. 522 * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API. 523 * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 524 * <br>2.Incorrect parameter types.3.Parameter verification failed. 525 * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate 526 * @systemapi Hide this for inner system use. 527 * @since 11 528 */ 529 function deactivateCooperate(isUnchained: boolean, callback: AsyncCallback<void>): void; 530 531 /** 532 * Stops screen hopping. 533 * 534 * @permission ohos.permission.COOPERATE_MANAGER 535 * @param { boolean } isUnchained - Whether the cross-device link is unchained. 536 * @returns { Promise<void> } the promise returned by the function. 537 * @throws {BusinessError} 201 - Permission denied. 538 * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API. 539 * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate 540 * @systemapi Hide this for inner system use. 541 * @since 11 542 */ 543 function deactivateCooperate(isUnchained: boolean): Promise<void>; 544 545 /** 546 * Obtains the screen hopping status. 547 * 548 * @param { string } networkId Descriptor of the target device for screen hopping. 549 * @param { AsyncCallback<boolean> } callback Asynchronous callback used to return the screen hopping status. 550 * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API. 551 * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 552 * <br>2.Incorrect parameter types.3.Parameter verification failed. 553 * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate 554 * @systemapi Hide this for inner system use. 555 * @since 10 556 * @deprecated since 11 557 * @useinstead cooperate#getCooperateSwitchState 558 */ 559 function getCrossingSwitchState(networkId: string, callback: AsyncCallback<boolean>): void; 560 561 /** 562 * Obtains the status of the screen hopping switch. 563 * 564 * @param { string } networkId Descriptor of the target device for screen hopping. 565 * @returns { Promise<boolean> } Returns {@code true} the screen hopping status; 566 * returns {@code false} otherwise. 567 * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API. 568 * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 569 * <br>2.Incorrect parameter types.3.Parameter verification failed. 570 * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate 571 * @systemapi Hide this for inner system use. 572 * @since 10 573 * @deprecated since 11 574 * @useinstead cooperate#getCooperateSwitchState 575 */ 576 function getCrossingSwitchState(networkId: string): Promise<boolean>; 577 578 579 /** 580 * Obtains the screen hopping status. 581 * 582 * @permission ohos.permission.COOPERATE_MANAGER 583 * @param { string } networkId - Descriptor of the target device for screen hopping. 584 * @param { AsyncCallback<boolean> } callback - Asynchronous callback used to return the screen hopping status. 585 * @throws {BusinessError} 201 - Permission denied. 586 * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API. 587 * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 588 * <br>2.Incorrect parameter types.3.Parameter verification failed. 589 * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate 590 * @systemapi Hide this for inner system use. 591 * @since 11 592 */ 593 function getCooperateSwitchState(networkId: string, callback: AsyncCallback<boolean>): void; 594 595 /** 596 * Obtains the status of the screen hopping switch. 597 * 598 * @permission ohos.permission.COOPERATE_MANAGER 599 * @param { string } networkId - Descriptor of the target device for screen hopping. 600 * @returns { Promise<boolean> } Returns {@code true} the screen hopping status; 601 * returns {@code false} otherwise. 602 * @throws {BusinessError} 201 - Permission denied. 603 * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API. 604 * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 605 * <br>2.Incorrect parameter types.3.Parameter verification failed. 606 * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate 607 * @systemapi Hide this for inner system use. 608 * @since 11 609 */ 610 function getCooperateSwitchState(networkId: string): Promise<boolean>; 611 612 /** 613 * Enables listening for screen hopping status change events. 614 * 615 * @param { 'cooperate' } type Change type. 616 * @param { Callback<{ networkId: string, msg: CooperateMsg }> } callback Asynchronous callback used to 617 * <br>return the screen hopping status change event. 618 * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API. 619 * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 620 * <br>2.Incorrect parameter types.3.Parameter verification failed. 621 * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate 622 * @systemapi Hide this for inner system use. 623 * @since 10 624 * @deprecated since 11 625 * @useinstead cooperate#on 626 */ 627 function on(type: 'cooperate', callback: Callback<{ networkId: string, msg: CooperateMsg }>): void; 628 629 /** 630 * Disables listening for screen hopping status change events. 631 * 632 * @param { 'cooperate' } type Change type. 633 * @param { Callback<void> } callback Callback for which listening 634 * <br>is disabled. If this parameter is not specified, listening will be disabled for all registered callbacks. 635 * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API. 636 * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 637 * <br>2.Incorrect parameter types.3.Parameter verification failed. 638 * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate 639 * @systemapi Hide this for inner system use. 640 * @since 10 641 * @deprecated since 11 642 * @useinstead cooperate#on 643 */ 644 function off(type: 'cooperate', callback?: Callback<void>): void; 645 646 /** 647 * Enables listening for screen hopping status change events. 648 * 649 * @permission ohos.permission.COOPERATE_MANAGER 650 * @param { 'cooperateMessage' } type - Change type. 651 * @param { Callback<CooperateMessage> } callback - Asynchronous callback used to 652 * <br>return the screen hopping status change event. 653 * @throws {BusinessError} 201 - Permission denied. 654 * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API. 655 * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 656 * <br>2.Incorrect parameter types.3.Parameter verification failed. 657 * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate 658 * @systemapi Hide this for inner system use. 659 * @since 11 660 */ 661 function on(type: 'cooperateMessage', callback: Callback<CooperateMessage>): void; 662 663 /** 664 * Disables listening for screen hopping status change events. 665 * 666 * @permission ohos.permission.COOPERATE_MANAGER 667 * @param { 'cooperateMessage' } type - Change type. 668 * @param { Callback<CooperateMessage> } [callback] - Callback for which listening 669 * <br>is disabled. If this parameter is not specified, listening will be disabled for all registered callbacks. 670 * @throws {BusinessError} 201 - Permission denied. 671 * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API. 672 * @throws {BusinessError} 401 - Parameter error. Possible causes:1.Incorrect parameter types.2.Parameter 673 * <br>verification failed. 674 * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate 675 * @systemapi Hide this for inner system use. 676 * @since 11 677 */ 678 function off(type: 'cooperateMessage', callback?: Callback<CooperateMessage>): void; 679 680 /** 681 * Enables listening for mouse pointer position information on the specified device. 682 * 683 * @permission ohos.permission.COOPERATE_MANAGER 684 * @param { 'cooperateMouse' } type - Event type, which is **cooperateMouse**. 685 * @param { string } networkId - Specified device. 686 * @param { Callback<MouseLocation> } callback - Callback for receiving reported events. 687 * @throws {BusinessError} 201 - Permission denied. 688 * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API. 689 * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 690 * <br>2.Incorrect parameter types.3.Parameter verification failed. 691 * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate 692 * @systemapi Hide this for inner system use. 693 * @since 12 694 */ 695 function on(type: 'cooperateMouse', networkId: string, callback: Callback<MouseLocation>): void; 696 697 /** 698 * Disables listening for mouse pointer position information on the specified device. 699 * 700 * @permission ohos.permission.COOPERATE_MANAGER 701 * @param { 'cooperateMouse' } type - Event type, which is **cooperateMouse**. 702 * @param { string } networkId - Specified device. 703 * @param { Callback<MouseLocation> } [callback] - Callback for receiving reported events. 704 * <br>If no callback is specified, listening will be disabled for all **cooperateMouse** events of the device specified by **networkId**. 705 * @throws {BusinessError} 201 - Permission denied. 706 * @throws {BusinessError} 202 - Permission verification failed. A non-system application calls a system API. 707 * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 708 * <br>2.Incorrect parameter types.3.Parameter verification failed. 709 * @syscap SystemCapability.Msdp.DeviceStatus.Cooperate 710 * @systemapi Hide this for inner system use. 711 * @since 12 712 */ 713 function off(type: 'cooperateMouse', networkId: string, callback?: Callback<MouseLocation>): void; 714 715} 716 717export default cooperate; 718