• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2021-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 IPCKit
19 */
20
21/*** if arkts 1.1 */
22import type { AsyncCallback } from './@ohos.base';
23/*** endif */
24
25/**
26 * This module provides inter process communication capability.
27 *
28 * @namespace rpc
29 * @syscap SystemCapability.Communication.IPC.Core
30 * @since arkts {'1.1':'7', '1.2':'20'}
31 * @arkts 1.1&1.2
32 */
33declare namespace rpc {
34  /**
35   * The error code of rpc.
36   *
37   * @enum { number }
38   * @syscap SystemCapability.Communication.IPC.Core
39   * @since 9
40   */
41  enum ErrorCode {
42    /**
43     * Parameter error.
44     *
45     * @syscap SystemCapability.Communication.IPC.Core
46     * @since 9
47     */
48    CHECK_PARAM_ERROR = 401,
49
50    /**
51     * Failed to call mmap.
52     *
53     * @syscap SystemCapability.Communication.IPC.Core
54     * @since 9
55     */
56    OS_MMAP_ERROR = 1900001,
57
58    /**
59     * Failed to call ioctl.
60     *
61     * @syscap SystemCapability.Communication.IPC.Core
62     * @since 9
63     */
64    OS_IOCTL_ERROR = 1900002,
65
66    /**
67     * Failed to write data to the shared memory.
68     *
69     * @syscap SystemCapability.Communication.IPC.Core
70     * @since 9
71     */
72    WRITE_TO_ASHMEM_ERROR = 1900003,
73
74    /**
75     * Failed to read data from the shared memory.
76     *
77     * @syscap SystemCapability.Communication.IPC.Core
78     * @since 9
79     */
80    READ_FROM_ASHMEM_ERROR = 1900004,
81
82    /**
83     * Operation allowed only for the proxy object.
84     *
85     * @syscap SystemCapability.Communication.IPC.Core
86     * @since 9
87     */
88    ONLY_PROXY_OBJECT_PERMITTED_ERROR = 1900005,
89
90    /**
91     * Operation allowed only for the remote object.
92     *
93     * @syscap SystemCapability.Communication.IPC.Core
94     * @since 9
95     */
96    ONLY_REMOTE_OBJECT_PERMITTED_ERROR = 1900006,
97
98    /**
99     * Communication failed.
100     *
101     * @syscap SystemCapability.Communication.IPC.Core
102     * @since 9
103     */
104    COMMUNICATION_ERROR = 1900007,
105
106    /**
107     * The proxy or remote object is invalid.
108     *
109     * @syscap SystemCapability.Communication.IPC.Core
110     * @since 9
111     */
112    PROXY_OR_REMOTE_OBJECT_INVALID_ERROR = 1900008,
113
114    /**
115     * Failed to write data to the message sequence.
116     *
117     * @syscap SystemCapability.Communication.IPC.Core
118     * @since 9
119     */
120    WRITE_DATA_TO_MESSAGE_SEQUENCE_ERROR = 1900009,
121
122    /**
123     * Failed to read data from the message sequence.
124     *
125     * @syscap SystemCapability.Communication.IPC.Core
126     * @since 9
127     */
128    READ_DATA_FROM_MESSAGE_SEQUENCE_ERROR = 1900010,
129
130    /**
131     * Memory allocation failed.
132     *
133     * @syscap SystemCapability.Communication.IPC.Core
134     * @since 9
135     */
136    PARCEL_MEMORY_ALLOC_ERROR = 1900011,
137
138    /**
139     * Call js method failed
140     *
141     * @syscap SystemCapability.Communication.IPC.Core
142     * @since 9
143     */
144    CALL_JS_METHOD_ERROR = 1900012,
145
146    /**
147     * Os dup function failed
148     *
149     * @syscap SystemCapability.Communication.IPC.Core
150     * @since 9
151     */
152    OS_DUP_ERROR = 1900013
153  }
154
155  /**
156   * Enumerates the types of the TypedArray object converted from an ArrayBuffer object.
157   *
158   * @enum { number }
159   * @syscap SystemCapability.Communication.IPC.Core
160   * @since 12
161   */
162  enum TypeCode {
163    /**
164     * The TypedArray type is Int8Array.
165     *
166     * @syscap SystemCapability.Communication.IPC.Core
167     * @since 12
168     */
169    INT8_ARRAY = 0,
170
171    /**
172     * The TypedArray type is Uint8Array.
173     *
174     * @syscap SystemCapability.Communication.IPC.Core
175     * @since 12
176     */
177    UINT8_ARRAY = 1,
178
179    /**
180     * The TypedArray type is Int16Array.
181     *
182     * @syscap SystemCapability.Communication.IPC.Core
183     * @since 12
184     */
185    INT16_ARRAY = 2,
186
187    /**
188     * The TypedArray type is Uint16Array.
189     *
190     * @syscap SystemCapability.Communication.IPC.Core
191     * @since 12
192     */
193    UINT16_ARRAY = 3,
194
195    /**
196     * The TypedArray type is Int32Array.
197     *
198     * @syscap SystemCapability.Communication.IPC.Core
199     * @since 12
200     */
201    INT32_ARRAY = 4,
202
203    /**
204     * The TypedArray type is Uint32Array.
205     *
206     * @syscap SystemCapability.Communication.IPC.Core
207     * @since 12
208     */
209    UINT32_ARRAY = 5,
210
211    /**
212     * The TypedArray type is Float32Array.
213     *
214     * @syscap SystemCapability.Communication.IPC.Core
215     * @since 12
216     */
217    FLOAT32_ARRAY = 6,
218
219    /**
220     * The TypedArray type is Float64Array.
221     *
222     * @syscap SystemCapability.Communication.IPC.Core
223     * @since 12
224     */
225    FLOAT64_ARRAY = 7,
226
227    /**
228     * The TypedArray type is BigInt64Array.
229     *
230     * @syscap SystemCapability.Communication.IPC.Core
231     * @since 12
232     */
233    BIGINT64_ARRAY = 8,
234
235    /**
236     * The TypedArray type is BigUint64Array.
237     *
238     * @syscap SystemCapability.Communication.IPC.Core
239     * @since 12
240     */
241    BIGUINT64_ARRAY = 9
242  }
243
244  /**
245   * A data object used for remote procedure call (RPC).
246   * <p>
247   * During RPC, the sender can use the write methods provided by {@link MessageParcel} to
248   * write the to-be-sent data into a {@link MessageParcel} object in a specific format, and the receiver can use the
249   * read methods provided by {@link MessageParcel} to read data of the specific format from the
250   * {@link MessageParcel} object.
251   * <p>
252   * <p>
253   * The default capacity of a {@link MessageParcel} instance is 200KB. If you want more or less,
254   * use {@link #setCapacity(int)} to change it.
255   * </p>
256   * <b>Note</b>: Only data of the following data types can be written into or read from a {@link MessageParcel}: byte,
257   * byteArray, short, shortArray, int, intArray, long, longArray, float, floatArray, double, doubleArray, boolean,
258   * booleanArray, char, charArray, String, StringArray, {@link IRemoteObject}, IRemoteObjectArray,
259   * {@link Sequenceable}, and SequenceableArray.
260   *
261   * @syscap SystemCapability.Communication.IPC.Core
262   * @since 7
263   * @deprecated since 9
264   * @useinstead ohos.rpc.MessageSequence
265   */
266  class MessageParcel {
267    /**
268     * Creates an empty {@link MessageParcel} object.
269     *
270     * @returns { MessageParcel } Return the object created.
271     * @syscap SystemCapability.Communication.IPC.Core
272     * @since 7
273     * @deprecated since 9
274     */
275    static create(): MessageParcel;
276
277    /**
278     * Reclaim the {@link MessageParcel} object.
279     *
280     * @syscap SystemCapability.Communication.IPC.Core
281     * @since 7
282     * @deprecated since 9
283     */
284    reclaim(): void;
285
286    /**
287     * Serialize a remote object and writes it to the {@link MessageParcel} object.
288     *
289     * @param { IRemoteObject } object - Remote object to serialize.
290     * @returns { boolean } Return {@code true} if it is successful; return {@code false} otherwise.
291     * @syscap SystemCapability.Communication.IPC.Core
292     * @since 7
293     * @deprecated since 9
294     */
295    writeRemoteObject(object: IRemoteObject): boolean;
296
297    /**
298     * Reads a remote object from {@link MessageParcel} object.
299     *
300     * @returns { IRemoteObject } Return the remote object.
301     * @syscap SystemCapability.Communication.IPC.Core
302     * @since 7
303     * @deprecated since 9
304     */
305    readRemoteObject(): IRemoteObject;
306
307    /**
308     * Writes an interface token into the {@link MessageParcel} object.
309     *
310     * @param { string } token - Interface descriptor to write.
311     * @returns { boolean } Return {@code true} if the interface token has been written into the {@link MessageParcel};
312     *                      return {@code false} otherwise.
313     * @syscap SystemCapability.Communication.IPC.Core
314     * @since 7
315     * @deprecated since 9
316     */
317    writeInterfaceToken(token: string): boolean;
318
319    /**
320     * Reads an interface token from the {@link MessageParcel} object.
321     *
322     * @returns { string } Return a string value.
323     * @syscap SystemCapability.Communication.IPC.Core
324     * @since 7
325     * @deprecated since 9
326     */
327    readInterfaceToken(): string;
328
329    /**
330     * Obtains the size of data (in bytes) contained in the {@link MessageParcel} object.
331     *
332     * @returns { number } Return the size of data contained in the {@link MessageParcel} object.
333     * @syscap SystemCapability.Communication.IPC.Core
334     * @since 7
335     * @deprecated since 9
336     */
337    getSize(): number;
338
339    /**
340     * Obtains the storage capacity (in bytes) of the {@link MessageParcel} object.
341     *
342     * @returns { number } Return the storage capacity of the {@link MessageParcel} object.
343     * @syscap SystemCapability.Communication.IPC.Core
344     * @since 7
345     * @deprecated since 9
346     */
347    getCapacity(): number;
348
349    /**
350     * Sets the size of data (in bytes) contained in the {@link MessageParcel} object.
351     * <p>{@code false} is returned if the data size set in this method is greater
352     * than the storage capacity of the {@link MessageParcel}.
353     *
354     * @param { number } size - Indicates the data size of the {@link MessageParcel} object.
355     * @returns { boolean } Return {@code true} if the setting is successful; return {@code false} otherwise.
356     * @syscap SystemCapability.Communication.IPC.Core
357     * @since 7
358     * @deprecated since 9
359     */
360    setSize(size: number): boolean;
361
362    /**
363     * Sets the storage capacity (in bytes) of the {@link MessageParcel} object.
364     * <p>{@code false} is returned if the capacity set in this method is less than
365     * the size of data contained in the {@link MessageParcel}.
366     *
367     * @param { number } size - Indicates the storage capacity of the {@link MessageParcel} object.
368     * @returns { boolean } Return {@code true} if the setting is successful; return {@code false} otherwise.
369     * @syscap SystemCapability.Communication.IPC.Core
370     * @since 7
371     * @deprecated since 9
372     */
373    setCapacity(size: number): boolean;
374
375    /**
376     * Obtains the writable data space (in bytes) in the {@link MessageParcel} object.
377     * <p>Writable data space = Storage capacity of the {@link MessageParcel} – Size of data contained
378     * in the {@link MessageParcel}.
379     *
380     * @returns { number } Return the writable data space of the {@link MessageParcel} object.
381     * @syscap SystemCapability.Communication.IPC.Core
382     * @since 7
383     * @deprecated since 9
384     */
385    getWritableBytes(): number;
386
387    /**
388     * Obtains the readable data space (in bytes) in the {@link MessageParcel} object.
389     * <p>Readable data space = Size of data contained in the {@link MessageParcel} – Size of data that has been read.
390     *
391     * @returns { number } Return the readable data space of the {@link MessageParcel} object.
392     * @syscap SystemCapability.Communication.IPC.Core
393     * @since 7
394     * @deprecated since 9
395     */
396    getReadableBytes(): number;
397
398    /**
399     * Obtains the current read position in the {@link MessageParcel} object.
400     *
401     * @returns { number } Return the current read position in the {@link MessageParcel} object.
402     * @syscap SystemCapability.Communication.IPC.Core
403     * @since 7
404     * @deprecated since 9
405     */
406    getReadPosition(): number;
407
408    /**
409     * Obtains the current write position in the {@link MessageParcel} object.
410     *
411     * @returns { number } Return the current write position in the {@link MessageParcel} object.
412     * @syscap SystemCapability.Communication.IPC.Core
413     * @since 7
414     * @deprecated since 9
415     */
416    getWritePosition(): number;
417
418    /**
419     * Changes the current read position in the {@link MessageParcel} object.
420     * <p>Generally, you are advised not to change the current read position. If you must
421     * change it, change it to an accurate position. Otherwise, the read data may be incorrect.
422     *
423     * @param { number } pos - Indicates the target position to start data reading.
424     * @returns { boolean } Return {@code true} if the read position is changed; return {@code false} otherwise.
425     * @syscap SystemCapability.Communication.IPC.Core
426     * @since 7
427     * @deprecated since 9
428     */
429    rewindRead(pos: number): boolean;
430
431    /**
432     * Changes the current write position in the {@link MessageParcel} object.
433     * <p>Generally, you are advised not to change the current write position. If you must
434     * change it, change it to an accurate position. Otherwise, the data to be read may be incorrect.
435     *
436     * @param { number } pos - Indicates the target position to start data writing.
437     * @returns { boolean } Return {@code true} if the write position is changed; return {@code false} otherwise.
438     * @syscap SystemCapability.Communication.IPC.Core
439     * @since 7
440     * @deprecated since 9
441     */
442    rewindWrite(pos: number): boolean;
443
444    /**
445     * Writes information to this MessageParcel object indicating that no exception occurred.
446     * <p>After handling requests, you should call this method before writing any data to reply {@link MessageParcel}.
447     *
448     * @syscap SystemCapability.Communication.IPC.Core
449     * @since 8
450     * @deprecated since 9
451     */
452    writeNoException(): void;
453
454    /**
455     * Reads the exception information from this MessageParcel object.
456     * <p>If exception was thrown in server side, it will be thrown here.
457     * This method should be called before reading any data from reply {@link MessageParcel}
458     * if {@link writeNoException} was invoked in server side.
459     *
460     * @syscap SystemCapability.Communication.IPC.Core
461     * @since 8
462     * @deprecated since 9
463     */
464    readException(): void;
465
466    /**
467     * Writes a byte value into the {@link MessageParcel} object.
468     *
469     * @param { number } val - Indicates the byte value to write.
470     * @returns { boolean } Return {@code true} if the value has been written into the {@link MessageParcel};
471     *                      return {@code false} otherwise.
472     * @syscap SystemCapability.Communication.IPC.Core
473     * @since 7
474     * @deprecated since 9
475     */
476    writeByte(val: number): boolean;
477
478    /**
479     * Writes a short integer value into the {@link MessageParcel} object.
480     *
481     * @param { number } val - Indicates the short integer value to write.
482     * @returns { boolean } Return {@code true} if the value has been written into the {@link MessageParcel};
483     *                      return {@code false} otherwise.
484     * @syscap SystemCapability.Communication.IPC.Core
485     * @since 7
486     * @deprecated since 9
487     */
488    writeShort(val: number): boolean;
489
490    /**
491     * Writes an integer value into the {@link MessageParcel} object.
492     *
493     * @param { number } val - Indicates the integer value to write.
494     * @returns { boolean } Return {@code true} if the value has been written into the {@link MessageParcel};
495     *                      return {@code false} otherwise.
496     * @syscap SystemCapability.Communication.IPC.Core
497     * @since 7
498     * @deprecated since 9
499     */
500    writeInt(val: number): boolean;
501
502    /**
503     * Writes a long integer value into the {@link MessageParcel} object.
504     *
505     * @param { number } val - Indicates the long integer value to write.
506     * @returns { boolean } Return {@code true} if the value has been written into the {@link MessageParcel};
507     *                      return {@code false} otherwise.
508     * @syscap SystemCapability.Communication.IPC.Core
509     * @since 7
510     * @deprecated since 9
511     */
512    writeLong(val: number): boolean;
513
514    /**
515     * Writes a double-precision floating point value into the {@link MessageParcel} object.
516     * Note: This API writes a double-precision floating value since ArkTS only supports double-precision
517     * floating point numbers.
518     *
519     * @param { number } val - Indicates the double-precision floating point value to write.
520     * @returns { boolean } Return {@code true} if the value has been written into the {@link MessageParcel};
521     *                      return {@code false} otherwise.
522     * @syscap SystemCapability.Communication.IPC.Core
523     * @since 7
524     * @deprecated since 9
525     */
526    writeFloat(val: number): boolean;
527
528    /**
529     * Writes a double-precision floating point value into the {@link MessageParcel} object.
530     *
531     * @param { number } val - Indicates the double-precision floating point value to write.
532     * @returns { boolean } Return {@code true} if the value has been written into the {@link MessageParcel};
533     *                      return {@code false} otherwise.
534     * @syscap SystemCapability.Communication.IPC.Core
535     * @since 7
536     * @deprecated since 9
537     */
538    writeDouble(val: number): boolean;
539
540    /**
541     * Writes a boolean value into the {@link MessageParcel} object.
542     *
543     * @param { boolean } val - Indicates the boolean value to write.
544     * @returns { boolean } Return {@code true} if the value has been written into the {@link MessageParcel};
545     *                      return {@code false} otherwise.
546     * @syscap SystemCapability.Communication.IPC.Core
547     * @since 7
548     * @deprecated since 9
549     */
550    writeBoolean(val: boolean): boolean;
551
552    /**
553     * Writes a single character value into the {@link MessageParcel} object.
554     *
555     * @param { number } val - Indicates the single character value to write.
556     * @returns { boolean } Return {@code true} if the value has been written into the {@link MessageParcel};
557     *                      return {@code false} otherwise.
558     * @syscap SystemCapability.Communication.IPC.Core
559     * @since 7
560     * @deprecated since 9
561     */
562    writeChar(val: number): boolean;
563
564    /**
565     * Writes a string value into the {@link MessageParcel} object.
566     *
567     * @param { string } val - Indicates the string value to write.
568     * @returns { boolean } Return {@code true} if the value has been written into the {@link MessageParcel};
569     *                      return {@code false} otherwise.
570     * @syscap SystemCapability.Communication.IPC.Core
571     * @since 7
572     * @deprecated since 9
573     */
574    writeString(val: string): boolean;
575
576    /**
577     * Writes a {@link Sequenceable} object into the {@link MessageParcel} object.
578     *
579     * @param { Sequenceable } val - Indicates the {@link Sequenceable} object to write.
580     * @returns { boolean } Return {@code true} if the {@link Sequenceable} object has been written into
581     *                      the {@link MessageParcel}; return {@code false} otherwise.
582     * @syscap SystemCapability.Communication.IPC.Core
583     * @since 7
584     * @deprecated since 9
585     */
586    writeSequenceable(val: Sequenceable): boolean;
587
588    /**
589     * Writes a byte array into the {@link MessageParcel} object.
590     *
591     * @param { number[] } byteArray - Indicates the byte array to write.
592     * @returns { boolean } Return {@code true} if the array has been written into the {@link MessageParcel};
593     *                      return {@code false} otherwise.
594     * @syscap SystemCapability.Communication.IPC.Core
595     * @since 7
596     * @deprecated since 9
597     */
598    writeByteArray(byteArray: number[]): boolean;
599
600    /**
601     * Writes a short integer array into the {@link MessageParcel} object.
602     * Ensure that the data type and size comply with the interface definition.
603     * Otherwise,data may be truncated.
604     *
605     * @param { number[] } shortArray - Indicates the short integer array to write.
606     * @returns { boolean } Return {@code true} if the array has been written into the {@link MessageParcel};
607     *                      return {@code false} otherwise.
608     * @syscap SystemCapability.Communication.IPC.Core
609     * @since 7
610     * @deprecated since 9
611     */
612    writeShortArray(shortArray: number[]): boolean;
613
614    /**
615     * Writes an integer array into the {@link MessageParcel} object.
616     * Ensure that the data type and size comply with the interface definition.
617     * Otherwise,data may be truncated.
618     *
619     * @param { number[] } intArray - Indicates the integer array to write.
620     * @returns { boolean } Return {@code true} if the array has been written into the {@link MessageParcel};
621     *                      return {@code false} otherwise.
622     * @syscap SystemCapability.Communication.IPC.Core
623     * @since 7
624     * @deprecated since 9
625     */
626    writeIntArray(intArray: number[]): boolean;
627
628    /**
629     * Writes a long integer array into the {@link MessageParcel} object.
630     * Ensure that the data type and size comply with the interface definition.
631     * Otherwise,data may be truncated.
632     *
633     * @param { number[] } longArray - Indicates the long integer array to write.
634     * @returns { boolean } Return {@code true} if the array has been written into the {@link MessageParcel};
635     *                      return {@code false} otherwise.
636     * @syscap SystemCapability.Communication.IPC.Core
637     * @since 7
638     * @deprecated since 9
639     */
640    writeLongArray(longArray: number[]): boolean;
641
642    /**
643     * Writes a double-precision floating point array into the {@link MessageParcel} object.
644     * Ensure that the data type and size comply with the interface definition.
645     * Otherwise,data may be truncated.
646     * Note: This API writes a double-precision floating point array since ArkTS only supports double-precision
647     * floating point numbers.
648     *
649     * @param { number[] } floatArray - Indicates the double-precision floating point array to write.
650     * @returns { boolean } Return {@code true} if the array has been written into the {@link MessageParcel};
651     *                      return {@code false} otherwise.
652     * @syscap SystemCapability.Communication.IPC.Core
653     * @since 7
654     * @deprecated since 9
655     */
656    writeFloatArray(floatArray: number[]): boolean;
657
658    /**
659     * Writes a double-precision floating point array into the {@link MessageParcel} object.
660     * Ensure that the data type and size comply with the interface definition.
661     * Otherwise,data may be truncated.
662     *
663     * @param { number[] } doubleArray - Indicates the double-precision floating point array to write.
664     * @returns { boolean } Return {@code true} if the array has been written into the {@link MessageParcel};
665     *                      return {@code false} otherwise.
666     * @syscap SystemCapability.Communication.IPC.Core
667     * @since 7
668     * @deprecated since 9
669     */
670    writeDoubleArray(doubleArray: number[]): boolean;
671
672    /**
673     * Writes a boolean array into the {@link MessageParcel} object.
674     * Ensure that the data type and size comply with the interface definition.
675     * Otherwise,data may be truncated.
676     *
677     * @param { boolean[] } booleanArray - Indicates the boolean array to write.
678     * @returns { boolean } Return {@code true} if the array has been written into the {@link MessageParcel};
679     *                      return {@code false} otherwise.
680     * @syscap SystemCapability.Communication.IPC.Core
681     * @since 7
682     * @deprecated since 9
683     */
684    writeBooleanArray(booleanArray: boolean[]): boolean;
685
686    /**
687     * Writes a single character array into the {@link MessageParcel} object.
688     * Ensure that the data type and size comply with the interface definition.
689     * Otherwise,data may be truncated.
690     *
691     * @param { number[] } charArray - Indicates the single character array to write.
692     * @returns { boolean } Return {@code true} if the array has been written into the {@link MessageParcel};
693     *                      return {@code false} otherwise.
694     * @syscap SystemCapability.Communication.IPC.Core
695     * @since 7
696     * @deprecated since 9
697     */
698    writeCharArray(charArray: number[]): boolean;
699
700    /**
701     * Writes a string array into the {@link MessageParcel} object.
702     * Ensure that the data type and size comply with the interface definition.
703     * Otherwise,data may be truncated.
704     *
705     * @param { string[] } stringArray - Indicates the string array to write.
706     * @returns { boolean } Return {@code true} if the array has been written into the {@link MessageParcel};
707     *                      return {@code false} otherwise.
708     * @syscap SystemCapability.Communication.IPC.Core
709     * @since 7
710     * @deprecated since 9
711     */
712    writeStringArray(stringArray: string[]): boolean;
713
714    /**
715     * Writes a {@link Sequenceable} object array into the {@link MessageParcel} object.
716     *
717     * @param { Sequenceable[] } sequenceableArray - Indicates the {@link Sequenceable} object array to write.
718     * @returns { boolean } Return {@code true} if the array has been written into the {@link MessageParcel};
719     *                      return {@code false} otherwise.
720     * @syscap SystemCapability.Communication.IPC.Core
721     * @since 7
722     * @deprecated since 9
723     */
724    writeSequenceableArray(sequenceableArray: Sequenceable[]): boolean;
725
726    /**
727     * Writes an array of {@link IRemoteObject} objects to this {@link MessageParcel} object.
728     *
729     * @param { IRemoteObject[] } objectArray - Array of {@link IRemoteObject} objects to write.
730     * @returns { boolean } Return {@code true} if the {@link IRemoteObject} array is successfully written
731     *                      to the {@link MessageParcel};
732     *                      return {@code false} if the {@link IRemoteObject} array is null or fails to be written
733     *                      to the {@link MessageParcel}.
734     * @syscap SystemCapability.Communication.IPC.Core
735     * @since 8
736     * @deprecated since 9
737     */
738    writeRemoteObjectArray(objectArray: IRemoteObject[]): boolean;
739
740    /**
741     * Reads a byte value from the {@link MessageParcel} object.
742     *
743     * @returns { number } Return a byte value.
744     * @syscap SystemCapability.Communication.IPC.Core
745     * @since 7
746     * @deprecated since 9
747     */
748    readByte(): number;
749
750    /**
751     * Reads a short integer value from the {@link MessageParcel} object.
752     *
753     * @returns { number } Return a short integer value.
754     * @syscap SystemCapability.Communication.IPC.Core
755     * @since 7
756     * @deprecated since 9
757     */
758    readShort(): number;
759
760    /**
761     * Reads an integer value from the {@link MessageParcel} object.
762     *
763     * @returns { number } Return an integer value.
764     * @syscap SystemCapability.Communication.IPC.Core
765     * @since 7
766     * @deprecated since 9
767     */
768    readInt(): number;
769
770    /**
771     * Reads a long integer value from the {@link MessageParcel} object.
772     *
773     * @returns { number } Return a long integer value.
774     * @syscap SystemCapability.Communication.IPC.Core
775     * @since 7
776     * @deprecated since 9
777     */
778    readLong(): number;
779
780    /**
781     * Reads a double-precision floating point value from the {@link MessageParcel} object.
782     * Note: This API reads a double-precision floating value since ArkTS only supports double-precision
783     * floating point numbers.
784     *
785     * @returns { number } Return a double-precision floating point value.
786     * @syscap SystemCapability.Communication.IPC.Core
787     * @since 7
788     * @deprecated since 9
789     */
790    readFloat(): number;
791
792    /**
793     * Reads a double-precision floating point value from the {@link MessageParcel} object.
794     *
795     * @returns { number } Return a double-precision floating point value.
796     * @syscap SystemCapability.Communication.IPC.Core
797     * @since 7
798     * @deprecated since 9
799     */
800    readDouble(): number;
801
802    /**
803     * Reads a boolean value from the {@link MessageParcel} object.
804     *
805     * @returns { boolean } Return a boolean value.
806     * @syscap SystemCapability.Communication.IPC.Core
807     * @since 7
808     * @deprecated since 9
809     */
810    readBoolean(): boolean;
811
812    /**
813     * Reads a single character value from the {@link MessageParcel} object.
814     *
815     * @returns { number } Return a single character value.
816     * @syscap SystemCapability.Communication.IPC.Core
817     * @since 7
818     * @deprecated since 9
819     */
820    readChar(): number;
821
822    /**
823     * Reads a string value from the {@link MessageParcel} object.
824     *
825     * @returns { string } Return a string value.
826     * @syscap SystemCapability.Communication.IPC.Core
827     * @since 7
828     * @deprecated since 9
829     */
830    readString(): string;
831
832    /**
833     * Reads a {@link Sequenceable} object from the {@link MessageParcel} instance.
834     *
835     * @param { Sequenceable } dataIn - Indicates the {@link Sequenceable} object that needs to perform
836     *                         the {@code unmarshalling} operation using the {@link MessageParcel}.
837     * @returns { boolean } Return {@code true} if the unmarshalling is successful; return {@code false} otherwise.
838     * @syscap SystemCapability.Communication.IPC.Core
839     * @since 7
840     * @deprecated since 9
841     */
842    readSequenceable(dataIn: Sequenceable): boolean;
843
844    /**
845     * Writes a byte array into the {@link MessageParcel} object.
846     *
847     * @param { number[] } dataIn - Indicates the byte array read from MessageParcel.
848     * @syscap SystemCapability.Communication.IPC.Core
849     * @since 7
850     * @deprecated since 9
851     */
852    readByteArray(dataIn: number[]): void;
853
854    /**
855     * Reads a byte array from the {@link MessageParcel} object.
856     *
857     * @returns { number[] } Return a byte array.
858     * @syscap SystemCapability.Communication.IPC.Core
859     * @since 7
860     * @deprecated since 9
861     */
862    readByteArray(): number[];
863
864    /**
865     * Reads a short integer array from the {@link MessageParcel} object.
866     *
867     * @param { number[] } dataIn - Indicates the short integer array read from MessageParcel.
868     * @syscap SystemCapability.Communication.IPC.Core
869     * @since 7
870     * @deprecated since 9
871     */
872    readShortArray(dataIn: number[]): void;
873
874    /**
875     * Reads a short integer array from the {@link MessageParcel} object.
876     *
877     * @returns { number[] } Return a short integer array.
878     * @syscap SystemCapability.Communication.IPC.Core
879     * @since 7
880     * @deprecated since 9
881     */
882    readShortArray(): number[];
883
884    /**
885     * Reads an integer array from the {@link MessageParcel} object.
886     *
887     * @param { number[] } dataIn - Indicates the integer array to read.
888     * @syscap SystemCapability.Communication.IPC.Core
889     * @since 7
890     * @deprecated since 9
891     */
892    readIntArray(dataIn: number[]): void;
893
894    /**
895     * Reads an integer array from the {@link MessageParcel} object.
896     *
897     * @returns { number[] } Return an integer array.
898     * @syscap SystemCapability.Communication.IPC.Core
899     * @since 7
900     * @deprecated since 9
901     */
902    readIntArray(): number[];
903
904    /**
905     * Reads a long integer array from the {@link MessageParcel} object.
906     *
907     * @param { number[] } dataIn - Indicates the long integer array to read.
908     * @syscap SystemCapability.Communication.IPC.Core
909     * @since 7
910     * @deprecated since 9
911     */
912    readLongArray(dataIn: number[]): void;
913
914    /**
915     * Reads a long integer array from the {@link MessageParcel} object.
916     *
917     * @returns { number[] } Return a long integer array.
918     * @syscap SystemCapability.Communication.IPC.Core
919     * @since 7
920     * @deprecated since 9
921     */
922    readLongArray(): number[];
923
924    /**
925     * Reads a double-precision floating point array from the {@link MessageParcel} object.
926     * Note: This API reads a double-precision floating point array since ArkTS only supports double-precision
927     * floating point numbers.
928     *
929     * @param { number[] } dataIn - Indicates the double-precision floating point array to read.
930     * @syscap SystemCapability.Communication.IPC.Core
931     * @since 7
932     * @deprecated since 9
933     */
934    readFloatArray(dataIn: number[]): void;
935
936    /**
937     * Reads a double-precision floating point array from the {@link MessageParcel} object.
938     * Note: This API reads a double-precision floating point array since ArkTS only supports double-precision
939     * floating point numbers.
940     *
941     * @returns { number[] } Return a double-precision floating point array.
942     * @syscap SystemCapability.Communication.IPC.Core
943     * @since 7
944     * @deprecated since 9
945     */
946    readFloatArray(): number[];
947
948    /**
949     * Reads a double-precision floating point array from the {@link MessageParcel} object.
950     *
951     * @param { number[] } dataIn - Indicates the double-precision floating point array to read.
952     * @syscap SystemCapability.Communication.IPC.Core
953     * @since 7
954     * @deprecated since 9
955     */
956    readDoubleArray(dataIn: number[]): void;
957
958    /**
959     * Reads a double-precision floating point array from the {@link MessageParcel} object.
960     *
961     * @returns { number[] } Return a double-precision floating point array.
962     * @syscap SystemCapability.Communication.IPC.Core
963     * @since 7
964     * @deprecated since 9
965     */
966    readDoubleArray(): number[];
967
968    /**
969     * Reads a boolean array from the {@link MessageParcel} object.
970     *
971     * @param { boolean[] } dataIn - Indicates the boolean array to read.
972     * @syscap SystemCapability.Communication.IPC.Core
973     * @since 7
974     * @deprecated since 9
975     */
976    readBooleanArray(dataIn: boolean[]): void;
977
978    /**
979     * Reads a boolean array from the {@link MessageParcel} object.
980     *
981     * @returns { boolean[] } Return a boolean array.
982     * @syscap SystemCapability.Communication.IPC.Core
983     * @since 7
984     * @deprecated since 9
985     */
986    readBooleanArray(): boolean[];
987
988    /**
989     * Reads a single character array from the {@link MessageParcel} object.
990     *
991     * @param { number[] } dataIn - Indicates the single character array to read.
992     * @syscap SystemCapability.Communication.IPC.Core
993     * @since 7
994     * @deprecated since 9
995     */
996    readCharArray(dataIn: number[]): void;
997
998    /**
999     * Reads a single character array from the {@link MessageParcel} object.
1000     *
1001     * @returns { number[] } Return a single character array.
1002     * @syscap SystemCapability.Communication.IPC.Core
1003     * @since 7
1004     * @deprecated since 9
1005     */
1006    readCharArray(): number[];
1007
1008    /**
1009     * Reads a string array from the {@link MessageParcel} object.
1010     *
1011     * @param { string[] } dataIn - Indicates the string array to read.
1012     * @syscap SystemCapability.Communication.IPC.Core
1013     * @since 7
1014     * @deprecated since 9
1015     */
1016    readStringArray(dataIn: string[]): void;
1017
1018    /**
1019     * Reads a string array from the {@link MessageParcel} object.
1020     *
1021     * @returns { string[] } Return a string array.
1022     * @syscap SystemCapability.Communication.IPC.Core
1023     * @since 7
1024     * @deprecated since 9
1025     */
1026    readStringArray(): string[];
1027
1028    /**
1029     * Reads the specified {@link Sequenceable} array from this {@link MessageParcel} object.
1030     *
1031     * @param { Sequenceable[] } sequenceableArray - Sequenceable array to read.
1032     * @syscap SystemCapability.Communication.IPC.Core
1033     * @since 8
1034     * @deprecated since 9
1035     */
1036    readSequenceableArray(sequenceableArray: Sequenceable[]): void;
1037
1038    /**
1039     * Reads the specified {@link IRemoteObject} array from this {@link MessageParcel} object.
1040     *
1041     * @param { IRemoteObject[] } objects - Reads data from this {@link MessageParcel} object to the specified
1042     *                            {@link IRemoteObject} array.
1043     * @syscap SystemCapability.Communication.IPC.Core
1044     * @since 8
1045     * @deprecated since 9
1046     */
1047    readRemoteObjectArray(objects: IRemoteObject[]): void;
1048
1049    /**
1050     * Reads {@link IRemoteObject} objects from this {@link MessageParcel} object.
1051     *
1052     * @returns { IRemoteObject[] } An array of {@link IRemoteObject} objects obtained.
1053     * @syscap SystemCapability.Communication.IPC.Core
1054     * @since 8
1055     * @deprecated since 9
1056     */
1057    readRemoteObjectArray(): IRemoteObject[];
1058
1059    /**
1060     * Closes the specified file descriptor.
1061     *
1062     * @param { number } fd - File descriptor to be closed.
1063     * @syscap SystemCapability.Communication.IPC.Core
1064     * @since 8
1065     * @deprecated since 9
1066     */
1067    static closeFileDescriptor(fd: number): void;
1068
1069    /**
1070     * Duplicates the specified file descriptor.
1071     *
1072     * @param { number } fd - File descriptor to be duplicated.
1073     * @returns { number } Return a duplicated file descriptor.
1074     * @syscap SystemCapability.Communication.IPC.Core
1075     * @since 8
1076     * @deprecated since 9
1077     */
1078    static dupFileDescriptor(fd: number): number;
1079
1080    /**
1081     * Checks whether this {@link MessageParcel} object contains a file descriptor.
1082     *
1083     * @returns { boolean } Return {@code true} if the {@link MessageParcel} object contains a file descriptor;
1084     *                      return {@code false} otherwise.
1085     * @syscap SystemCapability.Communication.IPC.Core
1086     * @since 8
1087     * @deprecated since 9
1088     */
1089    containFileDescriptors(): boolean;
1090
1091    /**
1092     * Writes a file descriptor to this {@link MessageParcel} object.
1093     *
1094     * @param { number } fd - File descriptor to wrote.
1095     * @returns { boolean } Return {@code true} if the operation is successful; return {@code false} otherwise.
1096     * @syscap SystemCapability.Communication.IPC.Core
1097     * @since 8
1098     * @deprecated since 9
1099     */
1100    writeFileDescriptor(fd: number): boolean;
1101
1102    /**
1103     * Reads a file descriptor from this {@link MessageParcel} object.
1104     *
1105     * @returns { number } Return a file descriptor obtained.
1106     * @syscap SystemCapability.Communication.IPC.Core
1107     * @since 8
1108     * @deprecated since 9
1109     */
1110    readFileDescriptor(): number;
1111
1112    /**
1113     * Writes an anonymous shared memory object to this {@link MessageParcel} object.
1114     *
1115     * @param { Ashmem } ashmem - Anonymous shared memory object to wrote.
1116     * @returns { boolean } Return {@code true} if the operation is successful; return {@code false} otherwise.
1117     * @syscap SystemCapability.Communication.IPC.Core
1118     * @since 8
1119     * @deprecated since 9
1120     */
1121    writeAshmem(ashmem: Ashmem): boolean;
1122
1123    /**
1124     * Reads the anonymous shared memory object from this {@link MessageParcel} object.
1125     *
1126     * @returns { Ashmem } Anonymous share object obtained.
1127     * @syscap SystemCapability.Communication.IPC.Core
1128     * @since 8
1129     * @deprecated since 9
1130     */
1131    readAshmem(): Ashmem;
1132
1133    /**
1134     * Obtains the maximum amount of raw data that can be sent in a time.
1135     *
1136     * @returns { number } 128 MB.
1137     * @syscap SystemCapability.Communication.IPC.Core
1138     * @since 8
1139     * @deprecated since 9
1140     */
1141    getRawDataCapacity(): number;
1142
1143    /**
1144     * Writes raw data to this {@link MessageParcel} object.
1145     *
1146     * @param { number[] } rawData - Raw data to wrote.
1147     * @param { number } size - Size of the raw data, in bytes.
1148     * @returns { boolean } Return {@code true} if the operation is successful; return {@code false} otherwise.
1149     * @syscap SystemCapability.Communication.IPC.Core
1150     * @since 8
1151     * @deprecated since 9
1152     */
1153    writeRawData(rawData: number[], size: number): boolean;
1154
1155    /**
1156     * Reads raw data from this {@link MessageParcel} object.
1157     *
1158     * @param { number } size - Size of the raw data to read.
1159     * @returns { number[] } Return the raw data obtained, in bytes.
1160     * @syscap SystemCapability.Communication.IPC.Core
1161     * @since 8
1162     * @deprecated since 9
1163     */
1164    readRawData(size: number): number[];
1165  }
1166
1167  /**
1168   * A data object used for remote procedure call (RPC).
1169   * <p>
1170   * During RPC, the sender can use the write methods provided by {@link MessageSequence} to
1171   * write the to-be-sent data into a {@link MessageSequence} object in a specific format, and the receiver can use the
1172   * read methods provided by {@link MessageSequence} to read data of the specific format from
1173   * the {@link MessageSequence} object.
1174   * <p>
1175   * <p>
1176   * The default capacity of a {@link MessageSequence} instance is 200KB. If you want more or less,
1177   * use {@link #setCapacity(int)} to change it.
1178   * </p>
1179   * <b>Note</b>: Only data of the following data types can be written into or read from a {@link MessageSequence}:
1180   * byte, byteArray, short, shortArray, int, intArray, long, longArray, float, floatArray, double, doubleArray,
1181   * boolean, booleanArray, char, charArray, String, StringArray, {@link IRemoteObject}, IRemoteObjectArray,
1182   * {@link Parcelable}, and ParcelableArray.
1183   *
1184   * @syscap SystemCapability.Communication.IPC.Core
1185   * @since arkts {'1.1':'9', '1.2':'20'}
1186   * @arkts 1.1&1.2
1187   */
1188  class MessageSequence {
1189    /**
1190     * Creates an empty {@link MessageSequence} object.
1191     *
1192     * @returns { MessageSequence } Return the object created.
1193     * @syscap SystemCapability.Communication.IPC.Core
1194     * @since 9
1195     */
1196    static create(): MessageSequence;
1197
1198    /**
1199     * Reclaim the {@link MessageSequence} object.
1200     *
1201     * @syscap SystemCapability.Communication.IPC.Core
1202     * @since 9
1203     */
1204    reclaim(): void;
1205
1206    /**
1207     * Serialize a remote object and writes it to the {@link MessageSequence} object.
1208     *
1209     * @param { IRemoteObject } object - Remote object to serialize.
1210     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1211     *     1.The number of parameters is incorrect;
1212     *     2.The parameter type does not match.
1213     * @throws { BusinessError } 1900008 - The proxy or remote object is invalid.
1214     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
1215     * @syscap SystemCapability.Communication.IPC.Core
1216     * @since 9
1217     */
1218    writeRemoteObject(object: IRemoteObject): void;
1219
1220    /**
1221     * Reads a remote object from {@link MessageSequence} object.
1222     *
1223     * @returns { IRemoteObject } Return the remote object.
1224     * @throws { BusinessError } 1900008 - The proxy or remote object is invalid.
1225     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
1226     * @syscap SystemCapability.Communication.IPC.Core
1227     * @since 9
1228     */
1229    readRemoteObject(): IRemoteObject;
1230
1231    /**
1232     * Writes an interface token into the {@link MessageSequence} object.
1233     *
1234     * @param { string } token - Interface descriptor to write.
1235     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1236     *     1.The number of parameters is incorrect;
1237     *     2.The parameter type does not match;
1238     *     3.The string length exceeds 40960 bytes;
1239     *     4.The number of bytes copied to the buffer is different from the length of the obtained string.
1240     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
1241     * @syscap SystemCapability.Communication.IPC.Core
1242     * @since 9
1243     */
1244    writeInterfaceToken(token: string): void;
1245
1246    /**
1247     * Reads an interface token from the {@link MessageSequence} object.
1248     *
1249     * @returns { string } Return a string value.
1250     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
1251     * @syscap SystemCapability.Communication.IPC.Core
1252     * @since arkts {'1.1':'9', '1.2':'20'}
1253     * @arkts 1.1&1.2
1254     */
1255    readInterfaceToken(): string;
1256
1257    /**
1258     * Obtains the size of data (in bytes) contained in the {@link MessageSequence} object.
1259     *
1260     * @returns { number } Return the size of data contained in the {@link MessageSequence} object.
1261     * @syscap SystemCapability.Communication.IPC.Core
1262     * @since 9
1263     */
1264    getSize(): number;
1265
1266    /**
1267     * Obtains the storage capacity (in bytes) of the {@link MessageSequence} object.
1268     *
1269     * @returns { number } Return the storage capacity of the {@link MessageSequence} object.
1270     * @syscap SystemCapability.Communication.IPC.Core
1271     * @since 9
1272     */
1273    getCapacity(): number;
1274
1275    /**
1276     * Sets the size of data (in bytes) contained in the {@link MessageSequence} object.
1277     * <p>{@code false} is returned if the data size set in this method is greater
1278     * than the storage capacity of the {@link MessageSequence}.
1279     *
1280     * @param { number } size - Indicates the data size of the {@link MessageSequence} object.
1281     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1282     *     1.The number of parameters is incorrect;
1283     *     2.The parameter type does not match.
1284     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
1285     * @syscap SystemCapability.Communication.IPC.Core
1286     * @since 9
1287     */
1288    setSize(size: number): void;
1289
1290    /**
1291     * Sets the storage capacity (in bytes) of the {@link MessageSequence} object.
1292     * <p>{@code false} is returned if the capacity set in this method is less than
1293     * the size of data contained in the {@link MessageSequence}.
1294     *
1295     * @param { number } size - Indicates the storage capacity of the {@link MessageSequence} object.
1296     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1297     *     1.The number of parameters is incorrect;
1298     *     2.The parameter type does not match.
1299     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
1300     * @throws { BusinessError } 1900011 - Memory allocation failed.
1301     * @syscap SystemCapability.Communication.IPC.Core
1302     * @since 9
1303     */
1304    setCapacity(size: number): void;
1305
1306    /**
1307     * Obtains the writable data space (in bytes) in the {@link MessageSequence} object.
1308     * <p>Writable data space = Storage capacity of the {@link MessageSequence} – Size of data contained in
1309     * the {@link MessageSequence}.
1310     *
1311     * @returns { number } Return the writable data space of the {@link MessageSequence} object.
1312     * @syscap SystemCapability.Communication.IPC.Core
1313     * @since 9
1314     */
1315    getWritableBytes(): number;
1316
1317    /**
1318     * Obtains the readable data space (in bytes) in the {@link MessageSequence} object.
1319     * <p>Readable data space = Size of data contained in the {@link MessageSequence} – Size of data that has been read.
1320     *
1321     * @returns { number } Return the readable data space of the {@link MessageSequence} object.
1322     * @syscap SystemCapability.Communication.IPC.Core
1323     * @since 9
1324     */
1325    getReadableBytes(): number;
1326
1327    /**
1328     * Obtains the current read position in the {@link MessageSequence} object.
1329     *
1330     * @returns { number } Return the current read position in the {@link MessageSequence} object.
1331     * @syscap SystemCapability.Communication.IPC.Core
1332     * @since 9
1333     */
1334    getReadPosition(): number;
1335
1336    /**
1337     * Obtains the current write position in the {@link MessageSequence} object.
1338     *
1339     * @returns { number } Return the current write position in the {@link MessageSequence} object.
1340     * @syscap SystemCapability.Communication.IPC.Core
1341     * @since 9
1342     */
1343    getWritePosition(): number;
1344
1345    /**
1346     * Changes the current read position in the {@link MessageSequence} object.
1347     * <p>Generally, you are advised not to change the current read position. If you must
1348     * change it, change it to an accurate position. Otherwise, the read data may be incorrect.
1349     *
1350     * @param { number } pos - Indicates the target position to start data reading.
1351     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1352     *     1.The number of parameters is incorrect;
1353     *     2.The parameter type does not match.
1354     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
1355     * @syscap SystemCapability.Communication.IPC.Core
1356     * @since 9
1357     */
1358    rewindRead(pos: number): void;
1359
1360    /**
1361     * Changes the current write position in the {@link MessageSequence} object.
1362     * <p>Generally, you are advised not to change the current write position. If you must
1363     * change it, change it to an accurate position. Otherwise, the data to be read may be incorrect.
1364     *
1365     * @param { number } pos - Indicates the target position to start data writing.
1366     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1367     *     1.The number of parameters is incorrect;
1368     *     2.The parameter type does not match.
1369     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
1370     * @syscap SystemCapability.Communication.IPC.Core
1371     * @since 9
1372     */
1373    rewindWrite(pos: number): void;
1374
1375    /**
1376     * Writes information to this MessageSequence object indicating that no exception occurred.
1377     * <p>After handling requests, you should call this method before writing any data to reply
1378     * {@link MessageSequence}.
1379     *
1380     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
1381     * @syscap SystemCapability.Communication.IPC.Core
1382     * @since 9
1383     */
1384    writeNoException(): void;
1385
1386    /**
1387     * Reads the exception information from this MessageSequence object.
1388     * <p>If exception was thrown in server side, it will be thrown here.
1389     * This method should be called before reading any data from reply {@link MessageSequence}
1390     * if {@link writeNoException} was invoked in server side.
1391     *
1392     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
1393     * @syscap SystemCapability.Communication.IPC.Core
1394     * @since 9
1395     */
1396    readException(): void;
1397
1398    /**
1399     * Writes a byte value into the {@link MessageSequence} object.
1400     *
1401     * @param { number } val - Indicates the byte value to write.
1402     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1403     *     1.The number of parameters is incorrect;
1404     *     2.The parameter type does not match.
1405     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
1406     * @syscap SystemCapability.Communication.IPC.Core
1407     * @since 9
1408     */
1409    writeByte(val: number): void;
1410
1411    /**
1412     * Writes a short integer value into the {@link MessageSequence} object.
1413     *
1414     * @param { number } val - Indicates the short integer value to write.
1415     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1416     *     1.The number of parameters is incorrect;
1417     *     2.The parameter type does not match.
1418     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
1419     * @syscap SystemCapability.Communication.IPC.Core
1420     * @since 9
1421     */
1422    writeShort(val: number): void;
1423
1424    /**
1425     * Writes an integer value into the {@link MessageSequence} object.
1426     *
1427     * @param { number } val - Indicates the integer value to write.
1428     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1429     *     1.The number of parameters is incorrect;
1430     *     2.The parameter type does not match.
1431     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
1432     * @syscap SystemCapability.Communication.IPC.Core
1433     * @since 9
1434     */
1435    writeInt(val: number): void;
1436
1437    /**
1438     * Writes a long integer value into the {@link MessageSequence} object.
1439     *
1440     * @param { number } val - Indicates the long integer value to write.
1441     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1442     *     1.The number of parameters is incorrect;
1443     *     2.The parameter type does not match.
1444     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
1445     * @syscap SystemCapability.Communication.IPC.Core
1446     * @since 9
1447     */
1448    writeLong(val: number): void;
1449
1450    /**
1451     * Writes a double-precision floating point value into the {@link MessageSequence} object.
1452     * Note: This API writes a double-precision floating value since ArkTS only supports double-precision
1453     * floating point numbers.
1454     *
1455     * @param { number } val - Indicates the double-precision floating point value to write.
1456     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1457     *     1.The number of parameters is incorrect;
1458     *     2.The parameter type does not match.
1459     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
1460     * @syscap SystemCapability.Communication.IPC.Core
1461     * @since 9
1462     */
1463    writeFloat(val: number): void;
1464
1465    /**
1466     * Writes a double-precision floating point value into the {@link MessageSequence} object.
1467     *
1468     * @param { number } val - Indicates the double-precision floating point value to write.
1469     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1470     *     1.The number of parameters is incorrect;
1471     *     2.The parameter type does not match.
1472     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
1473     * @syscap SystemCapability.Communication.IPC.Core
1474     * @since 9
1475     */
1476    writeDouble(val: number): void;
1477
1478    /**
1479     * Writes a boolean value into the {@link MessageSequence} object.
1480     *
1481     * @param { boolean } val - Indicates the boolean value to write.
1482     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1483     *     1.The number of parameters is incorrect;
1484     *     2.The parameter type does not match.
1485     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
1486     * @syscap SystemCapability.Communication.IPC.Core
1487     * @since 9
1488     */
1489    writeBoolean(val: boolean): void;
1490
1491    /**
1492     * Writes a single character value into the {@link MessageSequence} object.
1493     *
1494     * @param { number } val - Indicates the single character value to write.
1495     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1496     *     1.The number of parameters is incorrect;
1497     *     2.The parameter type does not match.
1498     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
1499     * @syscap SystemCapability.Communication.IPC.Core
1500     * @since 9
1501     */
1502    writeChar(val: number): void;
1503
1504    /**
1505     * Writes a string value into the {@link MessageSequence} object.
1506     *
1507     * @param { string } val - Indicates the string value to write.
1508     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1509     *     1.The number of parameters is incorrect;
1510     *     2.The parameter type does not match;
1511     *     3.The string length exceeds 40960 bytes;
1512     *     4.The number of bytes copied to the buffer is different from the length of the obtained string.
1513     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
1514     * @syscap SystemCapability.Communication.IPC.Core
1515     * @since arkts {'1.1':'9', '1.2':'20'}
1516     * @arkts 1.1&1.2
1517     */
1518    writeString(val: string): void;
1519
1520    /**
1521     * Writes a {@link Parcelable} object into the {@link MessageSequence} object.
1522     *
1523     * @param { Parcelable } val - Indicates the {@link Parcelable} object to write.
1524     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1525     *     1.The number of parameters is incorrect;
1526     *     2.The parameter type does not match.
1527     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
1528     * @syscap SystemCapability.Communication.IPC.Core
1529     * @since 9
1530     */
1531    writeParcelable(val: Parcelable): void;
1532
1533    /**
1534     * Writes a byte array into the {@link MessageSequence} object.
1535     *
1536     * @param { number[] } byteArray - Indicates the byte array to write.
1537     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1538     *     1.The parameter is an empty array;
1539     *     2.The number of parameters is incorrect;
1540     *     3.The parameter type does not match;
1541     *     4.The element does not exist in the array.
1542     *     5.The type of the element in the array is incorrect.
1543     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
1544     * @syscap SystemCapability.Communication.IPC.Core
1545     * @since 9
1546     */
1547    writeByteArray(byteArray: number[]): void;
1548
1549    /**
1550     * Writes a short integer array into the {@link MessageSequence} object.
1551     * Ensure that the data type and size comply with the interface definition.
1552     * Otherwise,data may be truncated.
1553     *
1554     * @param { number[] } shortArray - Indicates the short integer array to write.
1555     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1556     *     1.The parameter is an empty array;
1557     *     2.The number of parameters is incorrect;
1558     *     3.The parameter type does not match;
1559     *     4.The element does not exist in the array;
1560     *     5.The type of the element in the array is incorrect.
1561     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
1562     * @syscap SystemCapability.Communication.IPC.Core
1563     * @since 9
1564     */
1565    writeShortArray(shortArray: number[]): void;
1566
1567    /**
1568     * Writes an integer array into the {@link MessageSequence} object.
1569     * Ensure that the data type and size comply with the interface definition.
1570     * Otherwise,data may be truncated.
1571     *
1572     * @param { number[] } intArray - Indicates the integer array to write.
1573     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1574     *     1.The parameter is an empty array;
1575     *     2.The number of parameters is incorrect;
1576     *     3.The parameter type does not match;
1577     *     4.The element does not exist in the array;
1578     *     5.The type of the element in the array is incorrect.
1579     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
1580     * @syscap SystemCapability.Communication.IPC.Core
1581     * @since 9
1582     */
1583    writeIntArray(intArray: number[]): void;
1584
1585    /**
1586     * Writes a long integer array into the {@link MessageSequence} object.
1587     * Ensure that the data type and size comply with the interface definition.
1588     * Otherwise,data may be truncated.
1589     *
1590     * @param { number[] } longArray - Indicates the long integer array to write.
1591     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1592     *     1.The parameter is an empty array;
1593     *     2.The number of parameters is incorrect;
1594     *     3.The parameter type does not match;
1595     *     4.The element does not exist in the array;
1596     *     5.The type of the element in the array is incorrect.
1597     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
1598     * @syscap SystemCapability.Communication.IPC.Core
1599     * @since 9
1600     */
1601    writeLongArray(longArray: number[]): void;
1602
1603    /**
1604     * Writes a double-precision floating point array into the {@link MessageSequence} object.
1605     * Ensure that the data type and size comply with the interface definition.
1606     * Otherwise,data may be truncated.
1607     * Note: This API writes a double-precision floating point array since ArkTS only supports double-precision
1608     * floating point numbers.
1609     *
1610     * @param { number[] } floatArray - Indicates the double-precision floating point array to write.
1611     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1612     *     1.The parameter is an empty array;
1613     *     2.The number of parameters is incorrect;
1614     *     3.The parameter type does not match;
1615     *     4.The element does not exist in the array;
1616     *     5.The type of the element in the array is incorrect.
1617     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
1618     * @syscap SystemCapability.Communication.IPC.Core
1619     * @since 9
1620     */
1621    writeFloatArray(floatArray: number[]): void;
1622
1623    /**
1624     * Writes a double-precision floating point array into the {@link MessageSequence} object.
1625     * Ensure that the data type and size comply with the interface definition.
1626     * Otherwise,data may be truncated.
1627     *
1628     * @param { number[] } doubleArray - Indicates the double-precision floating point array to write.
1629     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1630     *     1.The parameter is an empty array;
1631     *     2.The number of parameters is incorrect;
1632     *     3.The parameter type does not match;
1633     *     4.The element does not exist in the array;
1634     *     5.The type of the element in the array is incorrect.
1635     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
1636     * @syscap SystemCapability.Communication.IPC.Core
1637     * @since 9
1638     */
1639    writeDoubleArray(doubleArray: number[]): void;
1640
1641    /**
1642     * Writes a boolean array into the {@link MessageSequence} object.
1643     * Ensure that the data type and size comply with the interface definition.
1644     * Otherwise,data may be truncated.
1645     *
1646     * @param { boolean[] } booleanArray - Indicates the boolean array to write.
1647     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1648     *     1.The parameter is an empty array;
1649     *     2.The number of parameters is incorrect;
1650     *     3.The parameter type does not match;
1651     *     4.The element does not exist in the array.
1652     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
1653     * @syscap SystemCapability.Communication.IPC.Core
1654     * @since 9
1655     */
1656    writeBooleanArray(booleanArray: boolean[]): void;
1657
1658    /**
1659     * Writes a single character array into the {@link MessageSequence} object.
1660     * Ensure that the data type and size comply with the interface definition.
1661     * Otherwise,data may be truncated.
1662     *
1663     * @param { number[] } charArray - Indicates the single character array to write.
1664     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1665     *     1.The parameter is an empty array;
1666     *     2.The number of parameters is incorrect;
1667     *     3.The parameter type does not match;
1668     *     4.The element does not exist in the array.
1669     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
1670     * @syscap SystemCapability.Communication.IPC.Core
1671     * @since 9
1672     */
1673    writeCharArray(charArray: number[]): void;
1674
1675    /**
1676     * Writes a string array into the {@link MessageSequence} object.
1677     * Ensure that the data type and size comply with the interface definition.
1678     * Otherwise,data may be truncated.
1679     *
1680     * @param { string[] } stringArray - Indicates the string array to write.
1681     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1682     *     1.The parameter is an empty array;
1683     *     2.The number of parameters is incorrect;
1684     *     3.The parameter type does not match;
1685     *     4.The string length exceeds 40960 bytes;
1686     *     5.The number of bytes copied to the buffer is different from the length of the obtained string.
1687     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
1688     * @syscap SystemCapability.Communication.IPC.Core
1689     * @since 9
1690     */
1691    writeStringArray(stringArray: string[]): void;
1692
1693    /**
1694     * Writes a {@link Parcelable} object array into the {@link MessageSequence} object.
1695     *
1696     * @param { Parcelable[] } parcelableArray - Indicates the {@link Parcelable} object array to write.
1697     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1698     *     1.The parameter is an empty array;
1699     *     2.The number of parameters is incorrect;
1700     *     3.The parameter type does not match;
1701     *     4.The element does not exist in the array.
1702     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
1703     * @syscap SystemCapability.Communication.IPC.Core
1704     * @since 9
1705     */
1706    writeParcelableArray(parcelableArray: Parcelable[]): void;
1707
1708    /**
1709     * Writes an array of {@link IRemoteObject} objects to this {@link MessageSequence} object.
1710     *
1711     * @param { IRemoteObject[] } objectArray - Array of {@link IRemoteObject} objects to write.
1712     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1713     *     1.The parameter is an empty array;
1714     *     2.The number of parameters is incorrect;
1715     *     3.The parameter type does not match;
1716     *     4.The element does not exist in the array;
1717     *     5.The obtained remoteObject is null.
1718     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
1719     * @syscap SystemCapability.Communication.IPC.Core
1720     * @since 9
1721     */
1722    writeRemoteObjectArray(objectArray: IRemoteObject[]): void;
1723
1724    /**
1725     * Reads a byte value from the {@link MessageSequence} object.
1726     *
1727     * @returns { number } Return a byte value.
1728     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
1729     * @syscap SystemCapability.Communication.IPC.Core
1730     * @since 9
1731     */
1732    readByte(): number;
1733
1734    /**
1735     * Reads a short integer value from the {@link MessageSequence} object.
1736     *
1737     * @returns { number } Return a short integer value.
1738     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
1739     * @syscap SystemCapability.Communication.IPC.Core
1740     * @since 9
1741     */
1742    readShort(): number;
1743
1744    /**
1745     * Reads an integer value from the {@link MessageSequence} object.
1746     *
1747     * @returns { number } Return an integer value.
1748     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
1749     * @syscap SystemCapability.Communication.IPC.Core
1750     * @since 9
1751     */
1752    readInt(): number;
1753
1754    /**
1755     * Reads a long integer value from the {@link MessageSequence} object.
1756     *
1757     * @returns { number } Return a long integer value.
1758     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
1759     * @syscap SystemCapability.Communication.IPC.Core
1760     * @since 9
1761     */
1762    readLong(): number;
1763
1764    /**
1765     * Reads a double-precision floating point value from the {@link MessageSequence} object.
1766     * Note: This API reads a double-precision floating value since ArkTS only supports double-precision
1767     * floating point numbers.
1768     *
1769     * @returns { number } Return a double-precision floating point value.
1770     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
1771     * @syscap SystemCapability.Communication.IPC.Core
1772     * @since 9
1773     */
1774    readFloat(): number;
1775
1776    /**
1777     * Reads a double-precision floating point value from the {@link MessageSequence} object.
1778     *
1779     * @returns { number } Return a double-precision floating point value.
1780     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
1781     * @syscap SystemCapability.Communication.IPC.Core
1782     * @since 9
1783     */
1784    readDouble(): number;
1785
1786    /**
1787     * Reads a boolean value from the {@link MessageSequence} object.
1788     *
1789     * @returns { boolean } Return a boolean value.
1790     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
1791     * @syscap SystemCapability.Communication.IPC.Core
1792     * @since 9
1793     */
1794    readBoolean(): boolean;
1795
1796    /**
1797     * Reads a single character value from the {@link MessageSequence} object.
1798     *
1799     * @returns { number } Return a single character value.
1800     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
1801     * @syscap SystemCapability.Communication.IPC.Core
1802     * @since 9
1803     */
1804    readChar(): number;
1805
1806    /**
1807     * Reads a string value from the {@link MessageSequence} object.
1808     *
1809     * @returns { string } Return a string value.
1810     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
1811     * @syscap SystemCapability.Communication.IPC.Core
1812     * @since arkts {'1.1':'9', '1.2':'20'}
1813     * @arkts 1.1&1.2
1814     */
1815    readString(): string;
1816
1817    /**
1818     * Reads a {@link Parcelable} object from the {@link MessageSequence} instance.
1819     *
1820     * @param { Parcelable } dataIn - Indicates the {@link Parcelable} object that needs to perform
1821     *                       the {@code unmarshalling} operation using the {@link MessageSequence}.
1822     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1823     *     1.The number of parameters is incorrect.
1824     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
1825     * @throws { BusinessError } 1900012 - Failed to call the JS callback function.
1826     * @syscap SystemCapability.Communication.IPC.Core
1827     * @since 9
1828     */
1829    readParcelable(dataIn: Parcelable): void;
1830
1831    /**
1832     * Writes a byte array into the {@link MessageSequence} object.
1833     *
1834     * @param { number[] } dataIn - Indicates the byte array read from MessageSequence.
1835     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1836     *     1.The parameter is an empty array;
1837     *     2.The number of parameters is incorrect;
1838     *     3.The parameter type does not match.
1839     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
1840     * @syscap SystemCapability.Communication.IPC.Core
1841     * @since 9
1842     */
1843    readByteArray(dataIn: number[]): void;
1844
1845    /**
1846     * Reads a byte array from the {@link MessageSequence} object.
1847     *
1848     * @returns { number[] } Return a byte array.
1849     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
1850     * @syscap SystemCapability.Communication.IPC.Core
1851     * @since 9
1852     */
1853    readByteArray(): number[];
1854
1855    /**
1856     * Reads a short integer array from the {@link MessageSequence} object.
1857     *
1858     * @param { number[] } dataIn - Indicates the short integer array read from MessageSequence.
1859     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1860     *     1.The parameter is an empty array;
1861     *     2.The number of parameters is incorrect;
1862     *     3.The parameter type does not match.
1863     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
1864     * @syscap SystemCapability.Communication.IPC.Core
1865     * @since 9
1866     */
1867    readShortArray(dataIn: number[]): void;
1868
1869    /**
1870     * Reads a short integer array from the {@link MessageSequence} object.
1871     *
1872     * @returns { number[] } Return a short integer array.
1873     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
1874     * @syscap SystemCapability.Communication.IPC.Core
1875     * @since 9
1876     */
1877    readShortArray(): number[];
1878
1879    /**
1880     * Reads an integer array from the {@link MessageSequence} object.
1881     *
1882     * @param { number[] } dataIn - Indicates the integer array to read.
1883     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1884     *     1.The parameter is an empty array;
1885     *     2.The number of parameters is incorrect;
1886     *     3.The parameter type does not match.
1887     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
1888     * @syscap SystemCapability.Communication.IPC.Core
1889     * @since 9
1890     */
1891    readIntArray(dataIn: number[]): void;
1892
1893    /**
1894     * Reads an integer array from the {@link MessageSequence} object.
1895     *
1896     * @returns { number[] } Return an integer array.
1897     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
1898     * @syscap SystemCapability.Communication.IPC.Core
1899     * @since 9
1900     */
1901    readIntArray(): number[];
1902
1903    /**
1904     * Reads a long integer array from the {@link MessageSequence} object.
1905     *
1906     * @param { number[] } dataIn - Indicates the long integer array to read.
1907     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1908     *     1.The parameter is an empty array;
1909     *     2.The number of parameters is incorrect;
1910     *     3.The parameter type does not match.
1911     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
1912     * @syscap SystemCapability.Communication.IPC.Core
1913     * @since 9
1914     */
1915    readLongArray(dataIn: number[]): void;
1916
1917    /**
1918     * Reads a long integer array from the {@link MessageSequence} object.
1919     *
1920     * @returns { number[] } Return a long integer array.
1921     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
1922     * @syscap SystemCapability.Communication.IPC.Core
1923     * @since 9
1924     */
1925    readLongArray(): number[];
1926
1927    /**
1928     * Reads a double-precision floating point array from the {@link MessageSequence} object.
1929     * Note: This API reads a double-precision floating point array since ArkTS only supports double-precision
1930     * floating point numbers.
1931     *
1932     * @param { number[] } dataIn - Indicates the double-precision floating point array to read.
1933     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1934     *     1.The parameter is an empty array;
1935     *     2.The number of parameters is incorrect;
1936     *     3.The parameter type does not match.
1937     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
1938     * @syscap SystemCapability.Communication.IPC.Core
1939     * @since 9
1940     */
1941    readFloatArray(dataIn: number[]): void;
1942
1943    /**
1944     * Reads a double-precision floating point array from the {@link MessageSequence} object.
1945     * Note: This API reads a double-precision floating point array since ArkTS only supports double-precision
1946     * floating point numbers.
1947     *
1948     * @returns { number[] } Return a double-precision floating point array.
1949     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
1950     * @syscap SystemCapability.Communication.IPC.Core
1951     * @since 9
1952     */
1953    readFloatArray(): number[];
1954
1955    /**
1956     * Reads a double-precision floating point array from the {@link MessageSequence} object.
1957     *
1958     * @param { number[] } dataIn - Indicates the double-precision floating point array to read.
1959     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1960     *     1.The parameter is an empty array;
1961     *     2.The number of parameters is incorrect;
1962     *     3.The parameter type does not match.
1963     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
1964     * @syscap SystemCapability.Communication.IPC.Core
1965     * @since 9
1966     */
1967    readDoubleArray(dataIn: number[]): void;
1968
1969    /**
1970     * Reads a double-precision floating point array from the {@link MessageSequence} object.
1971     *
1972     * @returns { number[] } Return a double-precision floating point array.
1973     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
1974     * @syscap SystemCapability.Communication.IPC.Core
1975     * @since 9
1976     */
1977    readDoubleArray(): number[];
1978
1979    /**
1980     * Reads a boolean array from the {@link MessageSequence} object.
1981     *
1982     * @param { boolean[] } dataIn - Indicates the boolean array to read.
1983     * @throws { BusinessError } 401 - Parameter error. Possible causes:
1984     *     1.The parameter is an empty array;
1985     *     2.The number of parameters is incorrect;
1986     *     3.The parameter type does not match.
1987     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
1988     * @syscap SystemCapability.Communication.IPC.Core
1989     * @since 9
1990     */
1991    readBooleanArray(dataIn: boolean[]): void;
1992
1993    /**
1994     * Reads a boolean array from the {@link MessageSequence} object.
1995     *
1996     * @returns { boolean[] } Return a boolean array.
1997     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
1998     * @syscap SystemCapability.Communication.IPC.Core
1999     * @since 9
2000     */
2001    readBooleanArray(): boolean[];
2002
2003    /**
2004     * Reads a single character array from the {@link MessageSequence} object.
2005     *
2006     * @param { number[] } dataIn - Indicates the single character array to read.
2007     * @throws { BusinessError } 401 - Parameter error. Possible causes:
2008     *     1.The parameter is an empty array;
2009     *     2.The number of parameters is incorrect;
2010     *     3.The parameter type does not match.
2011     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
2012     * @syscap SystemCapability.Communication.IPC.Core
2013     * @since 9
2014     */
2015    readCharArray(dataIn: number[]): void;
2016
2017    /**
2018     * Reads a single character array from the {@link MessageSequence} object.
2019     *
2020     * @returns { number[] } Return a single character array.
2021     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
2022     * @syscap SystemCapability.Communication.IPC.Core
2023     * @since 9
2024     */
2025    readCharArray(): number[];
2026
2027    /**
2028     * Reads a string array from the {@link MessageSequence} object.
2029     *
2030     * @param { string[] } dataIn - Indicates the string array to read.
2031     * @throws { BusinessError } 401 - Parameter error. Possible causes:
2032     *     1.The parameter is an empty array;
2033     *     2.The number of parameters is incorrect;
2034     *     3.The parameter type does not match.
2035     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
2036     * @syscap SystemCapability.Communication.IPC.Core
2037     * @since 9
2038     */
2039    readStringArray(dataIn: string[]): void;
2040
2041    /**
2042     * Reads a string array from the {@link MessageSequence} object.
2043     *
2044     * @returns { string[] } Return a string array.
2045     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
2046     * @syscap SystemCapability.Communication.IPC.Core
2047     * @since 9
2048     */
2049    readStringArray(): string[];
2050
2051    /**
2052     * Reads the specified {@link Parcelable} array from this {@link MessageSequence} object.
2053     *
2054     * @param { Parcelable[] } parcelableArray - Parcelable array to read.
2055     * @throws { BusinessError } 401 - Parameter error. Possible causes:
2056     *     1.The parameter is an empty array;
2057     *     2.The number of parameters is incorrect;
2058     *     3.The parameter type does not match;
2059     *     4.The length of the array passed when reading is not equal to the length passed when writing to the array;
2060     *     5.The element does not exist in the array.
2061     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
2062     * @throws { BusinessError } 1900012 - Failed to call the JS callback function.
2063     * @syscap SystemCapability.Communication.IPC.Core
2064     * @since 9
2065     */
2066    readParcelableArray(parcelableArray: Parcelable[]): void;
2067
2068    /**
2069     * Reads the specified {@link IRemoteObject} array from this {@link MessageSequence} object.
2070     *
2071     * @param { IRemoteObject[] } objects - Reads data from this {@link MessageSequence} object to
2072     *                            the specified {@link IRemoteObject} array.
2073     * @throws { BusinessError } 401 - Parameter error. Possible causes:
2074     *     1.The parameter is an empty array;
2075     *     2.The number of parameters is incorrect;
2076     *     3.The parameter type does not match;
2077     *     4.The length of the array passed when reading is not equal to the length passed when writing to the array.
2078     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
2079     * @syscap SystemCapability.Communication.IPC.Core
2080     * @since 9
2081     */
2082    readRemoteObjectArray(objects: IRemoteObject[]): void;
2083
2084    /**
2085     * Reads {@link IRemoteObject} objects from this {@link MessageSequence} object.
2086     *
2087     * @returns { IRemoteObject[] } Return an array of {@link IRemoteObject} objects obtained.
2088     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
2089     * @syscap SystemCapability.Communication.IPC.Core
2090     * @since 9
2091     */
2092    readRemoteObjectArray(): IRemoteObject[];
2093
2094    /**
2095     * Closes the specified file descriptor.
2096     *
2097     * @param { number } fd - File descriptor to be closed.
2098     * @throws { BusinessError } 401 - Parameter error. Possible causes:
2099     *     1.The number of parameters is incorrect;
2100     *     2.The parameter type does not match.
2101     * @syscap SystemCapability.Communication.IPC.Core
2102     * @since 9
2103     */
2104    static closeFileDescriptor(fd: number): void;
2105
2106    /**
2107     * Duplicates the specified file descriptor.
2108     *
2109     * @param { number } fd - File descriptor to be duplicated.
2110     * @returns { number } Return a duplicated file descriptor.
2111     * @throws { BusinessError } 401 - Parameter error. Possible causes:
2112     *     1.The number of parameters is incorrect;
2113     *     2.The parameter type does not match.
2114     * @throws { BusinessError } 1900013 - Failed to call dup.
2115     * @syscap SystemCapability.Communication.IPC.Core
2116     * @since 9
2117     */
2118    static dupFileDescriptor(fd: number): number;
2119
2120    /**
2121     * Checks whether this {@link MessageSequence} object contains a file descriptor.
2122     *
2123     * @returns { boolean } Return {@code true} if the {@link MessageSequence} object contains a file descriptor;
2124     *                      return {@code false} otherwise.
2125     * @syscap SystemCapability.Communication.IPC.Core
2126     * @since 9
2127     */
2128    containFileDescriptors(): boolean;
2129
2130    /**
2131     * Writes a file descriptor to this {@link MessageSequence} object.
2132     *
2133     * @param { number } fd - File descriptor to wrote.
2134     * @throws { BusinessError } 401 - Parameter error. Possible causes:
2135     *     1.The number of parameters is incorrect;
2136     *     2.The parameter type does not match.
2137     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
2138     * @syscap SystemCapability.Communication.IPC.Core
2139     * @since 9
2140     */
2141    writeFileDescriptor(fd: number): void;
2142
2143    /**
2144     * Reads a file descriptor from this {@link MessageSequence} object.
2145     *
2146     * @returns { number } Return a file descriptor obtained.
2147     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
2148     * @syscap SystemCapability.Communication.IPC.Core
2149     * @since 9
2150     */
2151    readFileDescriptor(): number;
2152
2153    /**
2154     * Writes an anonymous shared memory object to this {@link MessageSequence} object.
2155     *
2156     * @param { Ashmem } ashmem - Anonymous shared memory object to wrote.
2157     * @throws { BusinessError } 401 - Parameter error. Possible causes:
2158     *     1.The number of parameters is incorrect;
2159     *     2.The parameter is not an instance of the Ashmem object.
2160     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
2161     * @syscap SystemCapability.Communication.IPC.Core
2162     * @since 9
2163     */
2164    writeAshmem(ashmem: Ashmem): void;
2165
2166    /**
2167     * Reads the anonymous shared memory object from this {@link MessageSequence} object.
2168     *
2169     * @returns { Ashmem } Return the anonymous share object obtained.
2170     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
2171     * @syscap SystemCapability.Communication.IPC.Core
2172     * @since 9
2173     */
2174    readAshmem(): Ashmem;
2175
2176    /**
2177     * Obtains the maximum amount of raw data that can be sent in a time.
2178     *
2179     * @returns { number } 128 MB.
2180     * @syscap SystemCapability.Communication.IPC.Core
2181     * @since 9
2182     */
2183    getRawDataCapacity(): number;
2184
2185    /**
2186     * Writes raw data to this {@link MessageSequence} object.
2187     *
2188     * @param { number[] } rawData - Raw data to wrote.
2189     * @param { number } size - Size of the raw data, in bytes.
2190     * @throws { BusinessError } 401 - Parameter error. Possible causes:
2191     *     1.The parameter is an empty array;
2192     *     2.The number of parameters is incorrect;
2193     *     3.The parameter type does not match;
2194     *     4.The transferred size cannot be obtained;
2195     *     5.The transferred size is less than or equal to 0;
2196     *     6.The element does not exist in the array;
2197     *     7.Failed to obtain typedArray information;
2198     *     8.The array is not of type int32;
2199     *     9.The length of typedarray is smaller than the size of the original data sent.
2200     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
2201     * @syscap SystemCapability.Communication.IPC.Core
2202     * @since 9
2203     * @deprecated since 11
2204     * @useinstead ohos.rpc.MessageSequence#writeRawDataBuffer
2205     */
2206    writeRawData(rawData: number[], size: number): void;
2207
2208    /**
2209     * Writes raw data to this {@link MessageSequence} object.
2210     *
2211     * @param { ArrayBuffer } rawData - Raw data to wrote.
2212     * @param { number } size - Size of the raw data, in bytes.
2213     * @throws { BusinessError } 401 - Parameter error. Possible causes:
2214     *     1.The number of parameters is incorrect;
2215     *     2.The parameter type does not match;
2216     *     3.Failed to obtain arrayBuffer information;
2217     *     4.The transferred size cannot be obtained;
2218     *     5.The transferred size is less than or equal to 0;
2219     *     6.The transferred size is greater than the byte length of ArrayBuffer.
2220     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
2221     * @syscap SystemCapability.Communication.IPC.Core
2222     * @since 11
2223     */
2224    writeRawDataBuffer(rawData: ArrayBuffer, size: number): void;
2225
2226    /**
2227     * Reads raw data from this {@link MessageSequence} object.
2228     *
2229     * @param { number } size - Size of the raw data to read.
2230     * @returns { number[] } Return the raw data obtained, in bytes.
2231     * @throws { BusinessError } 401 - Parameter error. Possible causes:
2232     *     1.The number of parameters is incorrect;
2233     *     2.The parameter type does not match.
2234     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
2235     * @syscap SystemCapability.Communication.IPC.Core
2236     * @since 9
2237     * @deprecated since 11
2238     * @useinstead ohos.rpc.MessageSequence#readRawDataBuffer
2239     */
2240    readRawData(size: number): number[];
2241
2242    /**
2243     * Reads raw data from this {@link MessageSequence} object.
2244     *
2245     * @param { number } size - Size of the raw data to read.
2246     * @returns { ArrayBuffer } Return the raw data obtained, in bytes.
2247     * @throws { BusinessError } 401 - Parameter error. Possible causes:
2248     *     1.The number of parameters is incorrect;
2249     *     2.The parameter type does not match.
2250     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
2251     * @syscap SystemCapability.Communication.IPC.Core
2252     * @since 11
2253     */
2254    readRawDataBuffer(size: number): ArrayBuffer;
2255
2256    /**
2257     * Writes the data in an ArrayBuffer object into this {@Link MessageSequence} object.
2258     *
2259     * @param { ArrayBuffer } buf - Data to write.
2260     * @param { TypeCode } typeCode - Type of the ArrayBuffer data to write.
2261     * @throws { BusinessError } 401 - Parameter error. Possible causes:
2262     *     1.The parameter is an empty array;
2263     *     2.The number of parameters is incorrect;
2264     *     3.The parameter type does not match;
2265     *     4.The obtained value of typeCode is incorrect;
2266     *     5.Failed to obtain arrayBuffer information.
2267     * @throws { BusinessError } 1900009 - Failed to write data to the message sequence.
2268     * @syscap SystemCapability.Communication.IPC.Core
2269     * @since 12
2270     */
2271    writeArrayBuffer(buf: ArrayBuffer, typeCode: TypeCode): void;
2272
2273    /**
2274     * Reads raw data from this {@link MessageSequence} object.
2275     *
2276     * @param { TypeCode } typeCode - Type of the ArrayBuffer read.
2277     * @returns { ArrayBuffer } Returns the Arraybuffer obtained.
2278     * @throws { BusinessError } 401 - Parameter error. Possible causes:
2279     *     1.The number of parameters is incorrect;
2280     *     2.The parameter type does not match;
2281     *     3.The obtained value of typeCode is incorrect;
2282     * @throws { BusinessError } 1900010 - Failed to read data from the message sequence.
2283     * @syscap SystemCapability.Communication.IPC.Core
2284     * @since 12
2285     */
2286    readArrayBuffer(typeCode: TypeCode): ArrayBuffer;
2287  }
2288
2289  /**
2290   * @typedef Sequenceable
2291   * @syscap SystemCapability.Communication.IPC.Core
2292   * @since 7
2293   * @deprecated since 9
2294   * @useinstead ohos.rpc.Parcelable
2295   */
2296  interface Sequenceable {
2297    /**
2298     * Marshal this {@code Sequenceable} object into a {@link MessageParcel}.
2299     *
2300     * @param { MessageParcel } dataOut - Indicates the {@link MessageParcel} object to which the {@code Sequenceable}
2301     *                          object will be marshalled.
2302     * @returns { boolean } Return {@code true} if the marshalling is successful; return {@code false} otherwise.
2303     * @syscap SystemCapability.Communication.IPC.Core
2304     * @since 7
2305     * @deprecated since 9
2306     */
2307    marshalling(dataOut: MessageParcel): boolean;
2308
2309    /**
2310     * Unmarshal this {@code Sequenceable} object from a {@link MessageParcel}.
2311     *
2312     * @param { MessageParcel } dataIn - Indicates the {@link MessageParcel} object into which the {@code Sequenceable}
2313     *                          object has been marshalled.
2314     * @returns { boolean } Return {@code true} if the unmarshalling is successful; return {@code false} otherwise.
2315     * @syscap SystemCapability.Communication.IPC.Core
2316     * @since 7
2317     * @deprecated since 9
2318     */
2319    unmarshalling(dataIn: MessageParcel): boolean;
2320  }
2321
2322  /**
2323   * @typedef Parcelable
2324   * @syscap SystemCapability.Communication.IPC.Core
2325   * @since 9
2326   */
2327  /**
2328   * During inter-process communication, objects of the class are written to the {@link MessageSequence} and
2329   * they are recovered from the {@link MessageSequence}.
2330   *
2331   * @typedef Parcelable
2332   * @syscap SystemCapability.Communication.IPC.Core
2333   * @since arkts {'1.1':'11', '1.2':'20'}
2334   * @arkts 1.1&1.2
2335   */
2336  interface Parcelable {
2337    /**
2338     * Marshal this {@code Parcelable} object into a {@link MessageSequence}.
2339     *
2340     * @param { MessageSequence } dataOut - Indicates the {@link MessageSequence} object to which the {@code Parcelable}
2341     *                            object will be marshalled.
2342     * @returns { boolean } Return {@code true} if the marshalling is successful; return {@code false} otherwise.
2343     * @syscap SystemCapability.Communication.IPC.Core
2344     * @since 9
2345     */
2346    marshalling(dataOut: MessageSequence): boolean;
2347
2348    /**
2349     * Unmarshal this {@code Parcelable} object from a {@link MessageSequence}.
2350     *
2351     * @param { MessageSequence } dataIn - Indicates the {@link MessageSequence} object into
2352     *                            which the {@code Parcelable} object has been marshalled.
2353     * @returns { boolean } Return {@code true} if the unmarshalling is successful; return {@code false} otherwise.
2354     * @syscap SystemCapability.Communication.IPC.Core
2355     * @since 9
2356     */
2357    unmarshalling(dataIn: MessageSequence): boolean;
2358  }
2359
2360  /**
2361   * Defines the response to the request.
2362   * <p> SendRequestResult object contains four members, namely error code of this operation, request code, data parcel
2363   * and reply parcel.
2364   *
2365   * @typedef SendRequestResult
2366   * @syscap SystemCapability.Communication.IPC.Core
2367   * @since 8
2368   * @deprecated since 9
2369   * @useinstead ohos.rpc.RequestResult
2370   */
2371  interface SendRequestResult {
2372    /**
2373     * Error code. 0 indicates successful, otherwise it is failed.
2374     *
2375     * @type { number }
2376     * @syscap SystemCapability.Communication.IPC.Core
2377     * @since 8
2378     * @deprecated since 9
2379     */
2380    errCode: number;
2381
2382    /**
2383     * Message code. It is same as the code in {@link SendRequest} method.
2384     *
2385     * @type { number }
2386     * @syscap SystemCapability.Communication.IPC.Core
2387     * @since 8
2388     * @deprecated since 9
2389     */
2390    code: number;
2391
2392    /**
2393     * MessageParcel object sent to the peer process.
2394     * It is the same object in {@link SendRequest} method.
2395     *
2396     * @type { MessageParcel }
2397     * @syscap SystemCapability.Communication.IPC.Core
2398     * @since 8
2399     * @deprecated since 9
2400     */
2401    data: MessageParcel;
2402
2403    /**
2404     * MessageParcel object returned by the peer process.
2405     * It is the same object in {@link SendRequest} method.
2406     *
2407     * @type { MessageParcel }
2408     * @syscap SystemCapability.Communication.IPC.Core
2409     * @since 8
2410     * @deprecated since 9
2411     */
2412    reply: MessageParcel;
2413  }
2414
2415  /**
2416   * Defines the response to the request.
2417   * <p> SendRequestResult object contains four members, namely error code of this operation, request code, data parcel
2418   * and reply parcel.
2419   *
2420   * @typedef RequestResult
2421   * @syscap SystemCapability.Communication.IPC.Core
2422   * @since 9
2423   */
2424  interface RequestResult {
2425    /**
2426     * Error code. 0 indicates successful, otherwise it is failed.
2427     *
2428     * @type { number }
2429     * @syscap SystemCapability.Communication.IPC.Core
2430     * @since 9
2431     */
2432    errCode: number;
2433
2434    /**
2435     * Message code. It is same as the code in {@link SendRequest} method.
2436     *
2437     * @type { number }
2438     * @syscap SystemCapability.Communication.IPC.Core
2439     * @since 9
2440     */
2441    code: number;
2442
2443    /**
2444     * MessageSequence object sent to the peer process.
2445     * It is the same object in {@link SendRequest} method.
2446     *
2447     * @type { MessageSequence }
2448     * @syscap SystemCapability.Communication.IPC.Core
2449     * @since 9
2450     */
2451    data: MessageSequence;
2452
2453    /**
2454     * MessageSequence object returned by the peer process.
2455     * It is the same object in {@link SendRequest} method.
2456     *
2457     * @type { MessageSequence }
2458     * @syscap SystemCapability.Communication.IPC.Core
2459     * @since 9
2460     */
2461    reply: MessageSequence;
2462  }
2463
2464  /**
2465   * @syscap SystemCapability.Communication.IPC.Core
2466   * @since 7
2467   */
2468  /**
2469   * Used to query or get interface descriptors, add or remove death notifications, dump object status to
2470   * a specific file, and send messages.
2471   *
2472   * @syscap SystemCapability.Communication.IPC.Core
2473   * @since arkts {'1.1':'11', '1.2':'20'}
2474   * @arkts 1.1&1.2
2475   */
2476  abstract class IRemoteObject {
2477    /**
2478     * Queries the description of an interface.
2479     * <p>A valid {@link IRemoteBroker} object is returned for an interface used by the service provider;
2480     * {@code null} is returned for an interface used by the service user,
2481     * indicating that the interface is not a local one.
2482     *
2483     * @param { string } descriptor - Indicates the interface descriptor.
2484     * @returns { IRemoteBroker } Return the {@link IRemoteBroker} object bound to the specified interface descriptor.
2485     * @syscap SystemCapability.Communication.IPC.Core
2486     * @since 7
2487     * @deprecated since 9
2488     * @useinstead ohos.rpc.IRemoteObject#getLocalInterface
2489     */
2490    queryLocalInterface(descriptor: string): IRemoteBroker;
2491
2492    /**
2493     * Queries the description of an interface.
2494     * <p>A valid {@link IRemoteBroker} object is returned for an interface used by the service provider;
2495     * {@code null} is returned for an interface used by the service user,
2496     * indicating that the interface is not a local one.
2497     *
2498     * @param { string } descriptor - Indicates the interface descriptor.
2499     * @returns { IRemoteBroker } Return the {@link IRemoteBroker} object bound to the specified interface descriptor.
2500     * @throws { BusinessError } 401 - Parameter error. Possible causes:
2501     *     1.The number of parameters is incorrect;
2502     *     2.The parameter type does not match;
2503     *     3.The string length exceeds 40960 bytes;
2504     *     4.The number of bytes copied to the buffer is different from the length of the obtained string.
2505     * @syscap SystemCapability.Communication.IPC.Core
2506     * @since 9
2507     */
2508    getLocalInterface(descriptor: string): IRemoteBroker;
2509
2510    /**
2511     * Sends a {@link MessageParcel} message to the peer process in synchronous or asynchronous mode.
2512     * <p>If asynchronous mode is set for {@code option}, a response is returned immediately.
2513     * If synchronous mode is set for {@code option}, the interface will wait for a response from the peer process
2514     * until the request times out. The user must prepare {@code reply} for receiving the execution result
2515     * given by the peer process.
2516     *
2517     * @param { number } code - Indicates the message code, which is determined by both sides of the communication.
2518     * If the interface is generated by the IDL tool, the message code is automatically generated by IDL.
2519     * @param { MessageParcel } data - Indicates the {@link MessageParcel} object sent to the peer process.
2520     * @param { MessageParcel } reply - Indicates the {@link MessageParcel} object returned by the peer process.
2521     * @param { MessageOption } options - Indicates the synchronous or asynchronous mode to send messages.
2522     * @returns { boolean } Return {@code true} if the method is called successfully; return {@code false} otherwise.
2523     * @syscap SystemCapability.Communication.IPC.Core
2524     * @since 7
2525     * @deprecated since 9
2526     */
2527    sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): boolean;
2528
2529    /**
2530     * Sends a {@link MessageParcel} message to the peer process in synchronous or asynchronous mode.
2531     * <p>If options indicates the asynchronous mode, a promise will be fulfilled immediately
2532     * and the reply message does not contain any content. If options indicates the synchronous mode,
2533     * a promise will be fulfilled when the response to sendRequest is returned,
2534     * and the reply message contains the returned information.
2535     *
2536     * @param { number } code - Message code called by the request, which is determined by the client and server.
2537     * If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.
2538     * @param { MessageParcel } data - {@link MessageParcel} object holding the data to send.
2539     * @param { MessageParcel } reply - {@link MessageParcel} object that receives the response.
2540     * @param { MessageOption } options - Indicates the synchronous or asynchronous mode to send messages.
2541     * @returns { Promise<SendRequestResult> } Promise used to return the {@link SendRequestResult} instance.
2542     * @syscap SystemCapability.Communication.IPC.Core
2543     * @since 8
2544     * @deprecated since 9
2545     * @useinstead ohos.rpc.IRemoteObject#sendMessageRequest
2546     */
2547    sendRequest(
2548      code: number,
2549      data: MessageParcel,
2550      reply: MessageParcel,
2551      options: MessageOption
2552    ): Promise<SendRequestResult>;
2553
2554    /**
2555     * Sends a {@link MessageSequence} message to the peer process asynchronously.
2556     * <p>If options indicates the asynchronous mode, a promise will be fulfilled immediately
2557     * and the reply message does not contain any content. If options indicates the synchronous mode,
2558     * a promise will be fulfilled when the response to sendMessageRequest is returned,
2559     * and the reply message contains the returned information.
2560     *
2561     * @param { number } code - Message code called by the request, which is determined by the client and server.
2562     * If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.
2563     * @param {MessageSequence } data - {@link MessageSequence} object holding the data to send.
2564     * @param {MessageSequence } reply - {@link MessageSequence} object that receives the response.
2565     * @param { MessageOption } options - Indicates the synchronous or asynchronous mode to send messages.
2566     * @returns { Promise<RequestResult> } Promise used to return the {@link RequestResult} instance.
2567     * @throws { BusinessError } 401 - Parameter error. Possible causes:
2568     *     1.The number of parameters is incorrect;
2569     *     2.The parameter type does not match;
2570     *     3.Failed to obtain the passed object instance.
2571     * @syscap SystemCapability.Communication.IPC.Core
2572     * @since 9
2573     */
2574    sendMessageRequest(
2575      code: number,
2576      data: MessageSequence,
2577      reply: MessageSequence,
2578      options: MessageOption
2579    ): Promise<RequestResult>;
2580
2581    /**
2582     * Sends a {@link MessageParcel} message to the peer process in synchronous or asynchronous mode.
2583     * <p>If options indicates the asynchronous mode, a callback will be invoked immediately
2584     * and the reply message does not contain any content. If options indicates the synchronous mode,
2585     * a callback will be invoked when the response to sendRequest is returned,
2586     * and the reply message contains the returned information.
2587     *
2588     * @param { number } code - Message code called by the request, which is determined by the client and server.
2589     * If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.
2590     * @param { MessageParcel } data - {@link MessageParcel} object holding the data to send.
2591     * @param { MessageParcel } reply - {@link MessageParcel} object that receives the response.
2592     * @param { MessageOption } options - Indicates the synchronous or asynchronous mode to send messages.
2593     * @param { AsyncCallback<SendRequestResult> } callback - Callback for receiving the sending result.
2594     * @syscap SystemCapability.Communication.IPC.Core
2595     * @since 8
2596     * @deprecated since 9
2597     * @useinstead ohos.rpc.IRemoteObject#sendMessageRequest
2598     */
2599    sendRequest(
2600      code: number,
2601      data: MessageParcel,
2602      reply: MessageParcel,
2603      options: MessageOption,
2604      callback: AsyncCallback<SendRequestResult>
2605    ): void;
2606
2607    /**
2608     * Sends a {@link MessageSequence} message to the peer process in synchronous or asynchronous mode.
2609     * <p>If options indicates the asynchronous mode, a callback will be invoked immediately
2610     * and the reply message does not contain any content. If options indicates the synchronous mode,
2611     * a callback will be invoked when the response to sendMessageRequest is returned,
2612     * and the reply message contains the returned information.
2613     *
2614     * @param {number } code - Message code called by the request, which is determined by the client and server.
2615     * If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.
2616     * @param { MessageSequence } data - {@link MessageSequence} object holding the data to send.
2617     * @param { MessageSequence } reply - {@link MessageSequence} object that receives the response.
2618     * @param { MessageOption } options - Indicates the synchronous or asynchronous mode to send messages.
2619     * @param { AsyncCallback<RequestResult> } callback - Callback for receiving the sending result.
2620     * @throws { BusinessError } 401 - Parameter error. Possible causes:
2621     *     1.The number of parameters is incorrect;
2622     *     2.The parameter type does not match;
2623     *     3.Failed to obtain the passed object instance.
2624     * @syscap SystemCapability.Communication.IPC.Core
2625     * @since 9
2626     */
2627    sendMessageRequest(
2628      code: number,
2629      data: MessageSequence,
2630      reply: MessageSequence,
2631      options: MessageOption,
2632      callback: AsyncCallback<RequestResult>
2633    ): void;
2634
2635    /**
2636     * Register a callback used to receive notifications of the death of a remote object.
2637     *
2638     * @param { DeathRecipient } recipient - Indicates the callback to be registered.
2639     * @param { number } flags - Indicates the flag of the death notification.
2640     * @returns { boolean } Return {@code true} if the callback is registered successfully;
2641     *                      return {@code false} otherwise.
2642     * @syscap SystemCapability.Communication.IPC.Core
2643     * @since 7
2644     * @deprecated since 9
2645     * @useinstead ohos.rpc.IRemoteObject#registerDeathRecipient
2646     */
2647    addDeathRecipient(recipient: DeathRecipient, flags: number): boolean;
2648
2649    /**
2650     * Register a callback used to receive notifications of the death of a remote object.
2651     *
2652     * @param { DeathRecipient } recipient - Indicates the callback to be registered.
2653     * @param { number } flags - Indicates the flag of the death notification.
2654     * @throws { BusinessError } 401 - Parameter error. Possible causes:
2655     *     1.The number of parameters is incorrect;
2656     *     2.The parameter type does not match;
2657     *     3.The callback used to receive remote object death notifications is empty.
2658     * @throws { BusinessError } 1900005 - Operation allowed only for the proxy object.
2659     * @throws { BusinessError } 1900008 - The proxy or remote object is invalid.
2660     * @syscap SystemCapability.Communication.IPC.Core
2661     * @since 9
2662     */
2663    registerDeathRecipient(recipient: DeathRecipient, flags: number): void;
2664
2665    /**
2666     * Unregister a callback used to receive notifications of the death of a remote object.
2667     *
2668     * @param { DeathRecipient } recipient - Indicates the callback to be unregister.
2669     * @param { number } flags - Indicates the flag of the death notification.
2670     * @returns { boolean } Return {@code true} if the callback is unregister successfully;
2671     *                      return {@code false} otherwise.
2672     * @syscap SystemCapability.Communication.IPC.Core
2673     * @since 7
2674     * @deprecated since 9
2675     * @useinstead ohos.rpc.IRemoteObject#unregisterDeathRecipient
2676     */
2677    removeDeathRecipient(recipient: DeathRecipient, flags: number): boolean;
2678
2679    /**
2680     * Unregister a callback used to receive notifications of the death of a remote object.
2681     *
2682     * @param { DeathRecipient } recipient - Indicates the callback to be unregister.
2683     * @param { number } flags - Indicates the flag of the death notification.
2684     * @throws { BusinessError } 401 - Parameter error. Possible causes:
2685     *     1.The number of parameters is incorrect;
2686     *     2.The parameter type does not match;
2687     *     3.The callback used to receive remote object death notifications is empty.
2688     * @throws { BusinessError } 1900005 - Operation allowed only for the proxy object.
2689     * @throws { BusinessError } 1900008 - The proxy or remote object is invalid.
2690     * @syscap SystemCapability.Communication.IPC.Core
2691     * @since 9
2692     */
2693    unregisterDeathRecipient(recipient: DeathRecipient, flags: number): void;
2694
2695    /**
2696     * Obtains the interface descriptor of an object.
2697     * <p>The interface descriptor is a character string.
2698     *
2699     * @returns { string } Return the interface descriptor.
2700     * @syscap SystemCapability.Communication.IPC.Core
2701     * @since 7
2702     * @deprecated since 9
2703     * @useinstead ohos.rpc.IRemoteObject#getDescriptor
2704     */
2705    getInterfaceDescriptor(): string;
2706
2707    /**
2708     * Obtains the interface descriptor of an object.
2709     * <p>The interface descriptor is a character string.
2710     *
2711     * @returns { string } Return the interface descriptor.
2712     * @throws { BusinessError } 1900008 - The proxy or remote object is invalid.
2713     * @syscap SystemCapability.Communication.IPC.Core
2714     * @since arkts {'1.1':'9', '1.2':'20'}
2715     * @arkts 1.1&1.2
2716     */
2717    getDescriptor(): string;
2718
2719    /**
2720     * Checks whether an object is dead.
2721     *
2722     * @returns { boolean } Return {@code true} if the object is dead; return {@code false} otherwise.
2723     * @syscap SystemCapability.Communication.IPC.Core
2724     * @since 7
2725     */
2726    isObjectDead(): boolean;
2727  }
2728
2729  /**
2730   * @typedef IRemoteBroker
2731   * @syscap SystemCapability.Communication.IPC.Core
2732   * @since 7
2733   */
2734  /**
2735   * Used to define the communication interface of the IPC communication objects.
2736   *
2737   * @typedef IRemoteBroker
2738   * @syscap SystemCapability.Communication.IPC.Core
2739   * @since 11
2740   */
2741  interface IRemoteBroker {
2742    /**
2743     * Obtains a proxy or remote object. This method must be implemented by its derived classes.
2744     *
2745     * @returns { IRemoteObject } Return the RemoteObject if the caller is a RemoteObject; return the IRemoteObject,
2746     * that is, the holder of this RemoteProxy object, if the caller is a RemoteProxy object.
2747     * @syscap SystemCapability.Communication.IPC.Core
2748     * @since 7
2749     */
2750    asObject(): IRemoteObject;
2751  }
2752
2753  /**
2754   * @typedef DeathRecipient
2755   * @syscap SystemCapability.Communication.IPC.Core
2756   * @since 7
2757   */
2758  /**
2759   * Used to subscribe to death notifications for remote objects.
2760   * <p>
2761   * When a remote object subscribed to the notification dies, the local end can receive a message and call
2762   * the onRemoteDied operation. The death of a remote object can be caused by the death of the process to which the
2763   * remote object belongs, the shutdown or restart of the device to which the remote object belongs,
2764   * or the death of the remote object when the remote object and the local object belong to different devices,
2765   * and when the remote object leaves the network.
2766   * </p>
2767   *
2768   * @typedef DeathRecipient
2769   * @syscap SystemCapability.Communication.IPC.Core
2770   * @since 11
2771   */
2772  interface DeathRecipient {
2773    /**
2774     * Called to perform subsequent operations when a death notification of the remote object is received.
2775     *
2776     * @syscap SystemCapability.Communication.IPC.Core
2777     * @since 7
2778     */
2779    onRemoteDied(): void;
2780  }
2781
2782  /**
2783   * @syscap SystemCapability.Communication.IPC.Core
2784   * @since 7
2785   */
2786  /**
2787   * Public Message Option, using the specified flag type, constructs the specified MessageOption object.
2788   *
2789   * @syscap SystemCapability.Communication.IPC.Core
2790   * @since arkts {'1.1':'11', '1.2':'20'}
2791   * @arkts 1.1&1.2
2792   */
2793  class MessageOption {
2794    /**
2795     * Indicates synchronous call.
2796     *
2797     * @type { number }
2798     * @default 0
2799     * @static
2800     * @syscap SystemCapability.Communication.IPC.Core
2801     * @since 7
2802     */
2803    static TF_SYNC: number;
2804
2805    /**
2806     * Indicates asynchronous call.
2807     *
2808     * @type { number }
2809     * @default 1
2810     * @static
2811     * @syscap SystemCapability.Communication.IPC.Core
2812     * @since 7
2813     */
2814    static TF_ASYNC: number;
2815
2816    /**
2817     * Indicates the sendRequest API for returning the file descriptor.
2818     *
2819     * @type { number }
2820     * @default 16
2821     * @static
2822     * @syscap SystemCapability.Communication.IPC.Core
2823     * @since 7
2824     */
2825    static TF_ACCEPT_FDS: number;
2826
2827    /**
2828     * Indicates the wait time for RPC, in seconds. It is NOT used in IPC case.
2829     *
2830     * @default 4
2831     * @static
2832     * @syscap SystemCapability.Communication.IPC.Core
2833     * @since 7
2834     */
2835    /**
2836     * Indicates the wait time for RPC, in seconds. It is NOT used in IPC case.
2837     *
2838     * @type { number }
2839     * @default 8
2840     * @static
2841     * @syscap SystemCapability.Communication.IPC.Core
2842     * @since 11
2843     */
2844    static TF_WAIT_TIME: number;
2845
2846    /**
2847     * A constructor used to create a MessageOption instance.
2848     *
2849     * @param { number } syncFlags - Specifies whether the SendRequest is called synchronously (default) or asynchronously.
2850     * @param { number } waitTime - Maximum wait time for a RPC call. The default value is TF_WAIT_TIME.
2851     * @syscap SystemCapability.Communication.IPC.Core
2852     * @since arkts {'1.1':'7', '1.2':'20'}
2853     * @arkts 1.1&1.2
2854     */
2855    constructor(syncFlags?: number, waitTime?: number);
2856
2857    /**
2858     * A constructor used to create a MessageOption instance.
2859     *
2860     * @param { boolean } async - Specifies whether the SendRequest is called synchronously (default) or asynchronously.
2861     * @syscap SystemCapability.Communication.IPC.Core
2862     * @since 9
2863     */
2864    constructor(async?: boolean);
2865
2866    /**
2867     * A constructor used to create a MessageOption instance.
2868     *
2869     * @param { boolean } isAsync - Specifies whether the SendRequest is called synchronously (default) or asynchronously.
2870     * @syscap SystemCapability.Communication.IPC.Core
2871     * @since 20
2872     * @arkts 1.2
2873     */
2874    constructor(isAsync: boolean);
2875
2876    /**
2877     * Obtains the SendRequest call flag, which can be synchronous or asynchronous.
2878     *
2879     * @returns { number } Return whether the SendRequest is called synchronously or asynchronously.
2880     * @syscap SystemCapability.Communication.IPC.Core
2881     * @since 7
2882     */
2883    getFlags(): number;
2884
2885    /**
2886     * Sets the SendRequest call flag, which can be synchronous or asynchronous.
2887     *
2888     * @param { number } flags - Indicates the call flag, which can be synchronous or asynchronous.
2889     * @syscap SystemCapability.Communication.IPC.Core
2890     * @since 7
2891     */
2892    setFlags(flags: number): void;
2893
2894    /**
2895     * Obtains the SendRequest call flag, which can be synchronous or asynchronous.
2896     *
2897     * @returns { boolean } Return {@code true} if the asynchronous call succeeds;
2898     *                      return {@code false} if the synchronous call succeeds.
2899     * @syscap SystemCapability.Communication.IPC.Core
2900     * @since 9
2901     */
2902    isAsync(): boolean;
2903
2904    /**
2905     * Sets the SendRequest call flag, which can be synchronous or asynchronous.
2906     *
2907     * @param { boolean } async - Indicates the call flag, which can be synchronous or asynchronous.
2908     * @syscap SystemCapability.Communication.IPC.Core
2909     * @since 9
2910     */
2911    setAsync(async: boolean): void;
2912
2913    /**
2914     * Obtains the maximum wait time for this RPC call.
2915     *
2916     * @returns { number } Return maximum wait time obtained.
2917     * @syscap SystemCapability.Communication.IPC.Core
2918     * @since 7
2919     */
2920    getWaitTime(): number;
2921
2922    /**
2923     * Sets the maximum wait time for this RPC call.
2924     *
2925     * @param { number } waitTime - Indicates maximum wait time to set.
2926     * @syscap SystemCapability.Communication.IPC.Core
2927     * @since 7
2928     */
2929    setWaitTime(waitTime: number): void;
2930  }
2931
2932  /**
2933   * @extends IRemoteObject
2934   * @syscap SystemCapability.Communication.IPC.Core
2935   * @since 7
2936   */
2937  /**
2938   * Implement remote objects. The service provider must inherit this class.
2939   *
2940   * @extends IRemoteObject
2941   * @syscap SystemCapability.Communication.IPC.Core
2942   * @since arkts {'1.1':'11', '1.2':'20'}
2943   * @arkts 1.1&1.2
2944   */
2945  class RemoteObject extends IRemoteObject {
2946    /**
2947     * A constructor to create a RemoteObject instance.
2948     *
2949     * @param { string } descriptor - Specifies interface descriptor.
2950     * @syscap SystemCapability.Communication.IPC.Core
2951     * @since arkts {'1.1':'7', '1.2':'20'}
2952     * @arkts 1.1&1.2
2953     */
2954    constructor(descriptor: string);
2955
2956    /**
2957     * Queries a remote object using an interface descriptor.
2958     *
2959     * @param { string } descriptor - Indicates the interface descriptor used to query the remote object.
2960     * @returns { IRemoteBroker } Return the remote object matching the interface descriptor;
2961     *                            return null if no such remote object is found.
2962     * @syscap SystemCapability.Communication.IPC.Core
2963     * @since 7
2964     * @deprecated since 9
2965     * @useinstead ohos.rpc.RemoteObject#getLocalInterface
2966     */
2967    queryLocalInterface(descriptor: string): IRemoteBroker;
2968
2969    /**
2970     * Queries a remote object using an interface descriptor.
2971     *
2972     * @param { string } descriptor - Indicates the interface descriptor used to query the remote object.
2973     * @returns { IRemoteBroker } Return the remote object matching the interface descriptor;
2974     *                            return null if no such remote object is found.
2975     * @throws { BusinessError } 401 - Parameter error. Possible causes:
2976     *     1.The number of parameters is incorrect;
2977     *     2.The parameter type does not match;
2978     *     3.The string length exceeds 40960 bytes;
2979     *     4.The number of bytes copied to the buffer is different from the length of the obtained string.
2980     * @syscap SystemCapability.Communication.IPC.Core
2981     * @since 9
2982     */
2983    getLocalInterface(descriptor: string): IRemoteBroker;
2984
2985    /**
2986     * Queries an interface descriptor.
2987     *
2988     * @returns { string } Return the interface descriptor.
2989     * @syscap SystemCapability.Communication.IPC.Core
2990     * @since 7
2991     * @deprecated since 9
2992     * @useinstead ohos.rpc.RemoteObject#getDescriptor
2993     */
2994    getInterfaceDescriptor(): string;
2995
2996    /**
2997     * Queries an interface descriptor.
2998     *
2999     * @returns { string } Return the interface descriptor.
3000     * @throws { BusinessError } 1900008 - The proxy or remote object is invalid.
3001     * @syscap SystemCapability.Communication.IPC.Core
3002     * @since arkts {'1.1':'9', '1.2':'20'}
3003     * @arkts 1.1&1.2
3004     */
3005    getDescriptor(): string;
3006
3007    /**
3008     * Sets an entry for receiving requests.
3009     * <p>This method is implemented by the remote service provider. You need to override this method with
3010     * your own service logic when you are using IPC.
3011     *
3012     * @param { number } code - Indicates the service request code sent from the peer end.
3013     * @param { MessageSequence } data - Indicates the {@link MessageSequence} object sent from the peer end.
3014     * @param { MessageSequence } reply - Indicates the response message object sent from the remote service.
3015     * The local service writes the response data to the {@link MessageSequence} object.
3016     * @param { MessageOption } options - Indicates whether the operation is synchronous or asynchronous.
3017     * @returns { boolean | Promise<boolean> }
3018     * Return a simple boolean which is {@code true} if the operation succeeds;
3019     * {{@code false} otherwise} when the function call is synchronous.
3020     * Return a promise object with a boolean when the function call is asynchronous.
3021     * @syscap SystemCapability.Communication.IPC.Core
3022     * @since arkts {'1.1':'9', '1.2':'20'}
3023     * @arkts 1.1&1.2
3024     */
3025    onRemoteMessageRequest(
3026      code: number,
3027      data: MessageSequence,
3028      reply: MessageSequence,
3029      options: MessageOption
3030    ): boolean | Promise<boolean>;
3031
3032    /**
3033     * Sets an entry for receiving requests.
3034     * <p>This method is implemented by the remote service provider. You need to override this method with
3035     * your own service logic when you are using IPC.
3036     *
3037     * @param { number } code - Indicates the service request code sent from the peer end.
3038     * @param { MessageParcel } data - Indicates the {@link MessageParcel} object sent from the peer end.
3039     * @param { MessageParcel } reply - Indicates the response message object sent from the remote service.
3040     * The local service writes the response data to the {@link MessageParcel} object.
3041     * @param { MessageOption } options - Indicates whether the operation is synchronous or asynchronous.
3042     * @returns { boolean } Return {@code true} if the operation succeeds; return {@code false} otherwise.
3043     * @syscap SystemCapability.Communication.IPC.Core
3044     * @since 7
3045     * @deprecated since 9
3046     * @useinstead ohos.rpc.RemoteObject#onRemoteMessageRequest
3047     */
3048    onRemoteRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): boolean;
3049
3050    /**
3051     * Sends a request to the peer object.
3052     * <p>If the peer object and {@code RemoteObject} are on the same device, the request is sent by the IPC driver.
3053     * If they are on different devices, the request is sent by the socket driver.
3054     *
3055     * @param { number } code - Indicates the message code of the request.
3056     * @param { MessageParcel } data - Indicates the {@link MessageParcel} object storing the data to be sent.
3057     * @param { MessageParcel } reply - Indicates the {@link MessageParcel} object receiving the response data.
3058     * @param { MessageOption } options - Indicates a synchronous (default) or asynchronous request.
3059     * @returns { boolean } Return {@code true} if the operation succeeds; return {@code false} otherwise.
3060     * @syscap SystemCapability.Communication.IPC.Core
3061     * @since 7
3062     * @deprecated since 8
3063     */
3064    sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): boolean;
3065
3066    /**
3067     * Sends a {@link MessageParcel} message to the peer process in synchronous or asynchronous mode.
3068     * <p>If options indicates the asynchronous mode, a promise will be fulfilled immediately
3069     * and the reply message does not contain any content. If options indicates the synchronous mode,
3070     * a promise will be fulfilled when the response to sendRequest is returned,
3071     * and the reply message contains the returned information.
3072     *
3073     * @param { number } code - Message code called by the request, which is determined by the client and server.
3074     * If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.
3075     * @param { MessageParcel } data - {@link MessageParcel} object holding the data to send.
3076     * @param { MessageParcel } reply - {@link MessageParcel} object that receives the response.
3077     * @param { MessageOption } options - Indicates the synchronous or asynchronous mode to send messages.
3078     * @returns { Promise<SendRequestResult> } Promise used to return the {@link SendRequestResult} instance.
3079     * @syscap SystemCapability.Communication.IPC.Core
3080     * @since 8
3081     * @deprecated since 9
3082     * @useinstead ohos.rpc.RemoteObject#sendMessageRequest
3083     */
3084    sendRequest(
3085      code: number,
3086      data: MessageParcel,
3087      reply: MessageParcel,
3088      options: MessageOption
3089    ): Promise<SendRequestResult>;
3090
3091    /**
3092     * Sends a {@link MessageSequence} message to the peer process in synchronous or asynchronous mode.
3093     * <p>If options indicates the asynchronous mode, a promise will be fulfilled immediately
3094     * and the reply message does not contain any content. If options indicates the synchronous mode,
3095     * a promise will be fulfilled when the response to sendMessageRequest is returned,
3096     * and the reply message contains the returned information.
3097     *
3098     * @param { number } code - Message code called by the request, which is determined by the client and server.
3099     * If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.
3100     * @param { MessageSequence } data - {@link MessageSequence} object holding the data to send.
3101     * @param { MessageSequence } reply - {@link MessageSequence} object that receives the response.
3102     * @param { MessageOption } options - Indicates the synchronous or asynchronous mode to send messages.
3103     * @returns { Promise<RequestResult> } Promise used to return the {@link RequestResult} instance.
3104     * @throws { BusinessError } 401 - Parameter error. Possible causes:
3105     *     1.The number of parameters is incorrect;
3106     *     2.The parameter type does not match;
3107     *     3.Failed to obtain the passed object instance.
3108     * @syscap SystemCapability.Communication.IPC.Core
3109     * @since 9
3110     */
3111    sendMessageRequest(
3112      code: number,
3113      data: MessageSequence,
3114      reply: MessageSequence,
3115      options: MessageOption
3116    ): Promise<RequestResult>;
3117
3118    /**
3119     * Sends a {@link MessageParcel} message to the peer process in synchronous or asynchronous mode.
3120     * <p>If options indicates the asynchronous mode, a callback will be invoked immediately
3121     * and the reply message does not contain any content. If options indicates the synchronous mode,
3122     * a callback will be invoked when the response to sendRequest is returned,
3123     * and the reply message contains the returned information.
3124     *
3125     * @param { number } code - Message code called by the request, which is determined by the client and server.
3126     * If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.
3127     * @param { MessageParcel } data - {@link MessageParcel} object holding the data to send.
3128     * @param { MessageParcel} reply - {@link MessageParcel} object that receives the response.
3129     * @param { MessageOption } options - Indicates the synchronous or asynchronous mode to send messages.
3130     * @param { AsyncCallback<SendRequestResult> } callback - Callback for receiving the sending result.
3131     * @syscap SystemCapability.Communication.IPC.Core
3132     * @since 8
3133     * @deprecated since 9
3134     * @useinstead ohos.rpc.RemoteObject#sendMessageRequest
3135     */
3136    sendRequest(
3137      code: number,
3138      data: MessageParcel,
3139      reply: MessageParcel,
3140      options: MessageOption,
3141      callback: AsyncCallback<SendRequestResult>
3142    ): void;
3143
3144    /**
3145     * Sends a {@link MessageSequence} message to the peer process in synchronous or asynchronous mode.
3146     * <p>If options indicates the asynchronous mode, a callback will be invoked immediately
3147     * and the reply message does not contain any content. If options indicates the synchronous mode,
3148     * a callback will be invoked when the response to sendMessageRequest is returned,
3149     * and the reply message contains the returned information.
3150     *
3151     * @param { number } code - Message code called by the request, which is determined by the client and server.
3152     * If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.
3153     * @param { MessageSequence } data - {@link MessageSequence} object holding the data to send.
3154     * @param { MessageSequence } reply - {@link MessageSequence} object that receives the response.
3155     * @param { MessageOption } options - Indicates the synchronous or asynchronous mode to send messages.
3156     * @param { AsyncCallback<RequestResult> } callback - Callback for receiving the sending result.
3157     * @throws { BusinessError } 401 - Parameter error. Possible causes:
3158     *     1.The number of parameters is incorrect;
3159     *     2.The parameter type does not match;
3160     *     3.Failed to obtain the passed object instance.
3161     * @syscap SystemCapability.Communication.IPC.Core
3162     * @since 9
3163     */
3164    sendMessageRequest(
3165      code: number,
3166      data: MessageSequence,
3167      reply: MessageSequence,
3168      options: MessageOption,
3169      callback: AsyncCallback<RequestResult>
3170    ): void;
3171
3172    /**
3173     * Obtains the PID of the {@link RemoteProxy} object.
3174     *
3175     * @returns { number } Return the PID of the {@link RemoteProxy} object.
3176     * @syscap SystemCapability.Communication.IPC.Core
3177     * @since 7
3178     */
3179    getCallingPid(): number;
3180
3181    /**
3182     * Obtains the UID of the {@link RemoteProxy} object.
3183     *
3184     * @returns { number } Return the UID of the {@link RemoteProxy} object.
3185     * @syscap SystemCapability.Communication.IPC.Core
3186     * @since 7
3187     */
3188    getCallingUid(): number;
3189
3190    /**
3191     * Modifies the description of the current {@code RemoteObject}.
3192     * <p>This method is used to change the default descriptor specified during the creation of {@code RemoteObject}.
3193     *
3194     * @param { IRemoteBroker } localInterface - Indicates the {@code RemoteObject} whose descriptor is to be changed.
3195     * @param { string } descriptor - Indicates the new descriptor of the {@code RemoteObject}.
3196     * @syscap SystemCapability.Communication.IPC.Core
3197     * @since 7
3198     * @deprecated since 9
3199     * @useinstead ohos.rpc.RemoteObject#modifyLocalInterface
3200     */
3201    attachLocalInterface(localInterface: IRemoteBroker, descriptor: string): void;
3202
3203    /**
3204     * Modifies the description of the current {@code RemoteObject}.
3205     * <p>This method is used to change the default descriptor specified during the creation of {@code RemoteObject}.
3206     *
3207     * @param { IRemoteBroker } localInterface - Indicates the {@code RemoteObject} whose descriptor is to be changed.
3208     * @param { string } descriptor - Indicates the new descriptor of the {@code RemoteObject}.
3209     * @throws { BusinessError } 401 - Parameter error. Possible causes:
3210     *     1.The number of parameters is incorrect;
3211     *     2.The parameter type does not match;
3212     *     3.The string length exceeds 40960 bytes;
3213     *     4.The number of bytes copied to the buffer is different from the length of the obtained string.
3214     * @syscap SystemCapability.Communication.IPC.Core
3215     * @since 9
3216     */
3217    modifyLocalInterface(localInterface: IRemoteBroker, descriptor: string): void;
3218  }
3219
3220  /**
3221   * @syscap SystemCapability.Communication.IPC.Core
3222   * @since 7
3223   */
3224  /**
3225   * Implement the IRemoteObject proxy object.
3226   *
3227   * @extends IRemoteObject
3228   * @syscap SystemCapability.Communication.IPC.Core
3229   * @since arkts {'1.1':'11', '1.2':'20'}
3230   * @arkts 1.1&1.2
3231   */
3232  class RemoteProxy extends IRemoteObject {
3233    /**
3234     * Indicates the message code for a Ping operation.
3235     *
3236     * @type { number }
3237     * @default 1599098439
3238     * @static
3239     * @syscap SystemCapability.Communication.IPC.Core
3240     * @since 7
3241     */
3242    static PING_TRANSACTION: number;
3243
3244    /**
3245     * Indicates the message code for a dump operation.
3246     *
3247     * @type { number }
3248     * @default 1598311760
3249     * @static
3250     * @syscap SystemCapability.Communication.IPC.Core
3251     * @since 7
3252     */
3253    static DUMP_TRANSACTION: number;
3254
3255    /**
3256     * Indicates the message code for a transmission.
3257     *
3258     * @type { number }
3259     * @default 1598968902
3260     * @static
3261     * @syscap SystemCapability.Communication.IPC.Core
3262     * @since 7
3263     */
3264    static INTERFACE_TRANSACTION: number;
3265
3266    /**
3267     * Indicates the minimum value of a valid message code.
3268     * <p>This constant is used to check the validity of an operation.
3269     *
3270     * @type { number }
3271     * @default 0x1
3272     * @static
3273     * @syscap SystemCapability.Communication.IPC.Core
3274     * @since 7
3275     */
3276    static MIN_TRANSACTION_ID: number;
3277
3278    /**
3279     * Indicates the maximum value of a valid message code.
3280     * <p>This constant is used to check the validity of an operation.
3281     *
3282     * @type { number }
3283     * @default 0x00FFFFFF
3284     * @static
3285     * @syscap SystemCapability.Communication.IPC.Core
3286     * @since 7
3287     */
3288    static MAX_TRANSACTION_ID: number;
3289
3290    /**
3291     * Queries a local interface with a specified descriptor.
3292     *
3293     * @param { string } interface - Indicates the descriptor of the interface to query.
3294     * @returns { IRemoteBroker } Return null by default, indicating a proxy interface.
3295     * @syscap SystemCapability.Communication.IPC.Core
3296     * @since 7
3297     * @deprecated since 9
3298     * @useinstead ohos.rpc.RemoteProxy#getLocalInterface
3299     */
3300    queryLocalInterface(interface: string): IRemoteBroker;
3301
3302    /**
3303     * Queries a local interface with a specified descriptor.
3304     *
3305     * @param { string } interface - Indicates the descriptor of the interface to query.
3306     * @returns { IRemoteBroker } Return null by default, indicating a proxy interface.
3307     * @throws { BusinessError } 401 - check param failed
3308     * @throws { BusinessError } 1900006 - Operation allowed only for the remote object.
3309     * @syscap SystemCapability.Communication.IPC.Core
3310     * @since 9
3311     */
3312    getLocalInterface(interface: string): IRemoteBroker;
3313
3314    /**
3315     * Register a callback used to receive death notifications of a remote object.
3316     *
3317     * @param { DeathRecipient } recipient - Indicates the callback to be registered.
3318     * @param { number } flags - Indicates the flag of the death notification. This is a reserved parameter.
3319     *                   Set it to {@code 0}.
3320     * @returns { boolean } Return {@code true} if the callback is registered successfully;
3321     *                      return {@code false} otherwise.
3322     * @syscap SystemCapability.Communication.IPC.Core
3323     * @since 7
3324     * @deprecated since 9
3325     * @useinstead ohos.rpc.RemoteProxy#registerDeathRecipient
3326     */
3327    addDeathRecipient(recipient: DeathRecipient, flags: number): boolean;
3328
3329    /**
3330     * Register a callback used to receive death notifications of a remote object.
3331     *
3332     * @param { DeathRecipient } recipient - Indicates the callback to be registered.
3333     * @param { number } flags - Indicates the flag of the death notification. This is a reserved parameter.
3334     *                   Set it to {@code 0}.
3335     * @throws { BusinessError } 401 - Parameter error. Possible causes:
3336     *     1.The number of parameters is incorrect;
3337     *     2.The parameter type does not match;
3338     *     3.The callback used to receive remote object death notifications is empty.
3339     * @throws { BusinessError } 1900008 - The proxy or remote object is invalid.
3340     * @syscap SystemCapability.Communication.IPC.Core
3341     * @since 9
3342     */
3343    registerDeathRecipient(recipient: DeathRecipient, flags: number): void;
3344
3345    /**
3346     * Unregister a callback used to receive death notifications of a remote object.
3347     *
3348     * @param { DeathRecipient } recipient - Indicates the callback to be unregister.
3349     * @param { number } flags - Indicates the flag of the death notification. This is a reserved parameter.
3350     *                   Set it to {@code 0}.
3351     * @returns { boolean } Return {@code true} if the callback is unregister successfully;
3352     *                      return {@code false} otherwise.
3353     * @syscap SystemCapability.Communication.IPC.Core
3354     * @since 7
3355     * @deprecated since 9
3356     * @useinstead ohos.rpc.RemoteProxy#unregisterDeathRecipient
3357     */
3358    removeDeathRecipient(recipient: DeathRecipient, flags: number): boolean;
3359
3360    /**
3361     * Unregister a callback used to receive death notifications of a remote object.
3362     *
3363     * @param { DeathRecipient } recipient - Indicates the callback to be unregister.
3364     * @param { number } flags - Indicates the flag of the death notification. This is a reserved parameter.
3365     *                   Set it to {@code 0}.
3366     * @throws { BusinessError } 401 - Parameter error. Possible causes:
3367     *     1.The number of parameters is incorrect;
3368     *     2.The parameter type does not match;
3369     *     3.The callback used to receive remote object death notifications is empty.
3370     * @throws { BusinessError } 1900008 - The proxy or remote object is invalid.
3371     * @syscap SystemCapability.Communication.IPC.Core
3372     * @since 9
3373     */
3374    unregisterDeathRecipient(recipient: DeathRecipient, flags: number): void;
3375
3376    /**
3377     * Queries the interface descriptor of remote object.
3378     *
3379     * @returns { string } Return the interface descriptor.
3380     * @syscap SystemCapability.Communication.IPC.Core
3381     * @since 7
3382     * @deprecated since 9
3383     * @useinstead ohos.rpc.RemoteProxy#getDescriptor
3384     */
3385    getInterfaceDescriptor(): string;
3386
3387    /**
3388     * Queries the interface descriptor of remote object.
3389     *
3390     * @returns { string } Return the interface descriptor.
3391     * @throws { BusinessError } 1900007 - communication failed.
3392     * @throws { BusinessError } 1900008 - The proxy or remote object is invalid.
3393     * @syscap SystemCapability.Communication.IPC.Core
3394     * @since arkts {'1.1':'9', '1.2':'20'}
3395     * @arkts 1.1&1.2
3396     */
3397    getDescriptor(): string;
3398
3399    /**
3400     * Sends a request to the peer object.
3401     * <p>If the peer object and {@code RemoteProxy} are on the same device, the request is sent by the IPC driver.
3402     * If they are on different devices, the request is sent by the socket driver.
3403     *
3404     * @param { number } code - Indicates the message code of the request.
3405     * @param { MessageParcel } data - Indicates the {@link MessageParcel} object storing the data to be sent.
3406     * @param { MessageParcel } reply - Indicates the {@link MessageParcel} object receiving the response data.
3407     * @param { MessageOption } options - Indicates a synchronous (default) or asynchronous request.
3408     * @returns { boolean } Return {@code true} if the operation succeeds; return {@code false} otherwise.
3409     * @syscap SystemCapability.Communication.IPC.Core
3410     * @since 7
3411     * @deprecated since 8
3412     */
3413    sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): boolean;
3414
3415    /**
3416     * Sends a {@link MessageParcel} message to the peer process in synchronous or asynchronous mode.
3417     * <p>If options indicates the asynchronous mode, a promise will be fulfilled immediately
3418     * and the reply message does not contain any content. If options indicates the synchronous mode,
3419     * a promise will be fulfilled when the response to sendRequest is returned,
3420     * and the reply message contains the returned information.
3421     *
3422     * @param { number } code - Message code called by the request, which is determined by the client and server.
3423     * If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.
3424     * @param { MessageParcel } data - {@link MessageParcel} object holding the data to send.
3425     * @param { MessageParcel} reply - {@link MessageParcel} object that receives the response.
3426     * @param { MessageOption } options - Indicates the synchronous or asynchronous mode to send messages.
3427     * @returns { Promise<SendRequestResult> } Promise used to return the {@link sendRequestResult} instance.
3428     * @syscap SystemCapability.Communication.IPC.Core
3429     * @since 8
3430     * @deprecated since 9
3431     * @useinstead ohos.rpc.RemoteProxy#sendMessageRequest
3432     */
3433    sendRequest(
3434      code: number,
3435      data: MessageParcel,
3436      reply: MessageParcel,
3437      options: MessageOption
3438    ): Promise<SendRequestResult>;
3439
3440    /**
3441     * Sends a {@link MessageSequence} message to the peer process in synchronous or asynchronous mode.
3442     * <p>If options indicates the asynchronous mode, a promise will be fulfilled immediately
3443     * and the reply message does not contain any content. If options indicates the synchronous mode,
3444     * a promise will be fulfilled when the response to sendMessageRequest is returned,
3445     * and the reply message contains the returned information.
3446     *
3447     * @param { number } code - Message code called by the request, which is determined by the client and server.
3448     * If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.
3449     * @param { MessageSequence } data - {@link MessageSequence} object holding the data to send.
3450     * @param { MessageSequence } reply - {@link MessageSequence} object that receives the response.
3451     * @param { MessageOption } options - Indicates the synchronous or asynchronous mode to send messages.
3452     * @returns { Promise<RequestResult> } Promise used to return the {@link RequestResult} instance.
3453     * @throws { BusinessError } 401 - Parameter error. Possible causes:
3454     *     1.The number of parameters is incorrect;
3455     *     2.The parameter type does not match;
3456     *     3.Failed to obtain the passed object instance.
3457     * @syscap SystemCapability.Communication.IPC.Core
3458     * @since 9
3459     */
3460    sendMessageRequest(
3461      code: number,
3462      data: MessageSequence,
3463      reply: MessageSequence,
3464      options: MessageOption
3465    ): Promise<RequestResult>;
3466
3467    /**
3468     * Sends a {@link MessageParcel} message to the peer process in synchronous or asynchronous mode.
3469     * <p>If options indicates the asynchronous mode, a callback will be invoked immediately
3470     * and the reply message does not contain any content. If options indicates the synchronous mode,
3471     * a callback will be invoked when the response to sendRequest is returned,
3472     * and the reply message contains the returned information.
3473     *
3474     * @param { number } code - Message code called by the request, which is determined by the client and server.
3475     * If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.
3476     * @param { MessageParcel } data - {@link MessageParcel} object holding the data to send.
3477     * @param { MessageParcel } reply - {@link MessageParcel} object that receives the response.
3478     * @param { MessageOption } options - Indicates the synchronous or asynchronous mode to send messages.
3479     * @param { AsyncCallback<SendRequestResult> } callback - Callback for receiving the sending result.
3480     * @syscap SystemCapability.Communication.IPC.Core
3481     * @since 8
3482     * @deprecated since 9
3483     * @useinstead ohos.rpc.RemoteProxy#sendMessageRequest
3484     */
3485    sendRequest(
3486      code: number,
3487      data: MessageParcel,
3488      reply: MessageParcel,
3489      options: MessageOption,
3490      callback: AsyncCallback<SendRequestResult>
3491    ): void;
3492
3493    /**
3494     * Sends a {@link MessageSequence} message to the peer process in synchronous or asynchronous mode.
3495     * <p>If options indicates the asynchronous mode, a callback will be invoked immediately
3496     * and the reply message does not contain any content. If options indicates the synchronous mode,
3497     * a callback will be invoked when the response to sendRequest is returned,
3498     * and the reply message contains the returned information.
3499     *
3500     * @param { number } code - Message code called by the request, which is determined by the client and server.
3501     * If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.
3502     * @param { MessageSequence } data - {@link MessageSequence} object holding the data to send.
3503     * @param { MessageSequence } reply - {@link MessageSequence} object that receives the response.
3504     * @param { MessageOption } options - Indicates the synchronous or asynchronous mode to send messages.
3505     * @param { AsyncCallback<RequestResult> } callback - Callback for receiving the sending result.
3506     * @throws { BusinessError } 401 - Parameter error. Possible causes:
3507     *     1.The number of parameters is incorrect;
3508     *     2.The parameter type does not match;
3509     *     3.Failed to obtain the passed object instance.
3510     * @syscap SystemCapability.Communication.IPC.Core
3511     * @since 9
3512     */
3513    sendMessageRequest(
3514      code: number,
3515      data: MessageSequence,
3516      reply: MessageSequence,
3517      options: MessageOption,
3518      callback: AsyncCallback<RequestResult>
3519    ): void;
3520
3521    /**
3522     * Checks whether the {@code RemoteObject} corresponding to a {@code RemoteProxy} is dead.
3523     *
3524     * @returns { boolean } Return {@code true} if the {@code RemoteObject} is dead; return {@code false} otherwise.
3525     * @syscap SystemCapability.Communication.IPC.Core
3526     * @since 7
3527     */
3528    isObjectDead(): boolean;
3529  }
3530
3531  /**
3532   * @syscap SystemCapability.Communication.IPC.Core
3533   * @since 7
3534   */
3535  /**
3536   * Used to obtain IPC context information, including obtaining the UID and PID, obtaining the local and
3537   * peer device IDs, and checking whether the API call is on the same device.
3538   *
3539   * @syscap SystemCapability.Communication.IPC.Core
3540   * @since 11
3541   */
3542  class IPCSkeleton {
3543    /**
3544     * Obtains a local {@link IRemoteObject} reference of a registered service.
3545     * <p>This method is static.
3546     *
3547     * @returns { IRemoteObject } Return an {@link IRemoteObject} reference of the registered service.
3548     * @syscap SystemCapability.Communication.IPC.Core
3549     * @since 7
3550     */
3551    static getContextObject(): IRemoteObject;
3552
3553    /**
3554     * Obtains the PID of a proxy.
3555     * <p>This method is static. The PID is a positive integer during the communication between
3556     * the {@link RemoteProxy} object and {@link RemoteObject} object, and resumes to {@code 0}
3557     * when the communication ends. If this method is called from the {@link RemoteProxy} object,
3558     * {@code 0} is returned; if this method is called from the {@link RemoteObject} object,
3559     * the PID of the corresponding {@link RemoteProxy} object is returned.
3560     *
3561     * @returns { number } Return the PID of the proxy.
3562     * @syscap SystemCapability.Communication.IPC.Core
3563     * @since 7
3564     */
3565    static getCallingPid(): number;
3566
3567    /**
3568     * Obtains the UID of a proxy.
3569     * <p>This method is static. The UID is a positive integer during the communication between
3570     * the {@link RemoteProxy} object and {@link RemoteObject} object, and resumes to {@code 0}
3571     * when the communication ends. If this method is called from the {@link RemoteProxy} object,
3572     * {@code 0} is returned; if this method is called from the {@link RemoteObject} object,
3573     * the UID of the corresponding {@link RemoteProxy} object is returned.
3574     *
3575     * @returns { number } Return the UID of the proxy.
3576     * @syscap SystemCapability.Communication.IPC.Core
3577     * @since 7
3578     */
3579    static getCallingUid(): number;
3580
3581    /**
3582     * Obtains the TOKENID.
3583     * <p>This method is static.
3584     *
3585     * @returns { number } Return the TOKENID.
3586     * @syscap SystemCapability.Communication.IPC.Core
3587     * @since 8
3588     */
3589    static getCallingTokenId(): number;
3590
3591    /**
3592     * Obtains the ID of the device where the peer process resides.
3593     * <p>This method is static.
3594     *
3595     * @returns { string } Return the ID of the device where the peer process resides.
3596     * @syscap SystemCapability.Communication.IPC.Core
3597     * @since 7
3598     */
3599    static getCallingDeviceID(): string;
3600
3601    /**
3602     * Obtains the ID of the local device.
3603     * <p>This method is static.
3604     *
3605     * @returns { string } Return the ID of the local device.
3606     * @syscap SystemCapability.Communication.IPC.Core
3607     * @since 7
3608     */
3609    static getLocalDeviceID(): string;
3610
3611    /**
3612     * Checks whether a call is made on the same device.
3613     * <p>This method is static.
3614     *
3615     * @returns { boolean } Return {@code true} if the call is made on the same device; return {@code false} otherwise.
3616     * @syscap SystemCapability.Communication.IPC.Core
3617     * @since 7
3618     */
3619    static isLocalCalling(): boolean;
3620
3621    /**
3622     * Flush all pending commands from a specified {@link RemoteProxy} to the corresponding {@link RemoteObject}.
3623     * <p>This method is static. You are advised to call this method before performing any time-sensitive operations.
3624     *
3625     * @param { IRemoteObject } object - Indicates the specified {@link RemoteProxy}.
3626     * @returns { number } Return {@code 0} if the operation succeeds; return an error code if the input object
3627     *                     is empty or {@link RemoteObject}, or the operation fails.
3628     * @syscap SystemCapability.Communication.IPC.Core
3629     * @since 7
3630     * @deprecated since 9
3631     * @useinstead ohos.rpc.IPCSkeleton#flushCmdBuffer
3632     */
3633    static flushCommands(object: IRemoteObject): number;
3634
3635    /**
3636     * Flush all pending commands from a specified {@link RemoteProxy} to the corresponding {@link RemoteObject}.
3637     * <p>This method is static. You are advised to call this method before performing any time-sensitive operations.
3638     *
3639     * @param { IRemoteObject } object - Indicates the specified {@link RemoteProxy}.
3640     * @throws { BusinessError } 401 - Parameter error. Possible causes:
3641     *     1.The number of parameters is incorrect;
3642     *     2.The parameter type does not match.
3643     * @syscap SystemCapability.Communication.IPC.Core
3644     * @since 9
3645     */
3646    static flushCmdBuffer(object: IRemoteObject): void;
3647
3648    /**
3649     * Replaces the UID and PID of the remote user with those of the local user.
3650     * <p>This method is static. It can be used in scenarios like authentication.
3651     *
3652     * @returns { string } Return a string containing the UID and PID of the remote user.
3653     * @syscap SystemCapability.Communication.IPC.Core
3654     * @since 7
3655     */
3656    static resetCallingIdentity(): string;
3657
3658    /**
3659     * Restore the UID and PID to those of the remote user.
3660     * <p>This method is static. It is usually called after {@code resetCallingIdentity} is used
3661     * and requires the UID and PID of the remote user returned by {@code resetCallingIdentity}.
3662     *
3663     * @param { string } identity - Indicates the string containing the UID and PID of the remote user,
3664     *                   which is returned by {@code resetCallingIdentity}.
3665     * @returns { boolean } Return {@code true} if the operation succeeds; return {@code false} otherwise.
3666     * @syscap SystemCapability.Communication.IPC.Core
3667     * @since 7
3668     * @deprecated since 9
3669     * @useinstead ohos.rpc.IPCSkeleton#restoreCallingIdentity
3670     */
3671    static setCallingIdentity(identity: string): boolean;
3672
3673    /**
3674     * Restore the UID and PID to those of the remote user.
3675     * <p>This method is static. It is usually called after {@code resetCallingIdentity} is used
3676     * and requires the UID and PID of the remote user returned by {@code resetCallingIdentity}.
3677     *
3678     * @param { string } identity - Indicates the string containing the UID and PID of the remote user,
3679     *                   which is returned by {@code resetCallingIdentity}.
3680     * @throws { BusinessError } 401 - Parameter error. Possible causes:
3681     *     1.The number of parameters is incorrect;
3682     *     2.The parameter type does not match;
3683     *     3.The string length exceeds 40960 bytes;
3684     *     4.The number of bytes copied to the buffer is different from the length of the obtained string.
3685     * @syscap SystemCapability.Communication.IPC.Core
3686     * @since 9
3687     */
3688    static restoreCallingIdentity(identity: string): void;
3689  }
3690
3691  /**
3692   * Provides methods related to anonymous shared memory objects,
3693   * including creating, closing, mapping, and unmapping an Ashmem object,
3694   * reading data from and writing data to an Ashmem object,
3695   * obtaining the Ashmem size, and setting Ashmem protection.
3696   *
3697   * @syscap SystemCapability.Communication.IPC.Core
3698   * @since 8
3699   */
3700  class Ashmem {
3701    /**
3702     * The mapped memory is executable.
3703     *
3704     * @type { number }
3705     * @default 4
3706     * @static
3707     * @syscap SystemCapability.Communication.IPC.Core
3708     * @since 8
3709     */
3710    static PROT_EXEC: number;
3711
3712    /**
3713     * The mapped memory is inaccessible.
3714     *
3715     * @type { number }
3716     * @default 0
3717     * @static
3718     * @syscap SystemCapability.Communication.IPC.Core
3719     * @since 8
3720     */
3721    static PROT_NONE: number;
3722
3723    /**
3724     * The mapped memory is readable.
3725     *
3726     * @type { number }
3727     * @default 1
3728     * @static
3729     * @syscap SystemCapability.Communication.IPC.Core
3730     * @since 8
3731     */
3732    static PROT_READ: number;
3733
3734    /**
3735     * The mapped memory is writable.
3736     *
3737     * @type { number }
3738     * @default 2
3739     * @static
3740     * @syscap SystemCapability.Communication.IPC.Core
3741     * @since 8
3742     */
3743    static PROT_WRITE: number;
3744
3745    /**
3746     * Creates an Ashmem object with the specified name and size.
3747     *
3748     * @param { string } name - Name of the Ashmem object to create.
3749     * @param { number } size - Size (in bytes) of the Ashmem object to create.
3750     * @returns { Ashmem } Return the Ashmem object if it is created successfully; return null otherwise.
3751     * @syscap SystemCapability.Communication.IPC.Core
3752     * @since 8
3753     * @deprecated since 9
3754     * @useinstead ohos.rpc.Ashmem#create
3755     */
3756    static createAshmem(name: string, size: number): Ashmem;
3757
3758    /**
3759     * Creates an Ashmem object with the specified name and size.
3760     *
3761     * @param { string } name - Name of the Ashmem object to create.
3762     * @param { number } size - Size (in bytes) of the Ashmem object to create.
3763     * @returns { Ashmem } Return the Ashmem object if it is created successfully; return null otherwise.
3764     * @throws { BusinessError } 401 - Parameter error. Possible causes:
3765     *     1.The number of parameters is incorrect;
3766     *     2.The parameter type does not match;
3767     *     3.The Ashmem name passed is empty;
3768     *     4.The Ashmem size passed is less than or equal to 0.
3769     * @syscap SystemCapability.Communication.IPC.Core
3770     * @since 9
3771     */
3772    static create(name: string, size: number): Ashmem;
3773
3774    /**
3775     * Creates an Ashmem object by copying the file descriptor (FD) of an existing Ashmem object.
3776     * The two Ashmem objects point to the same shared memory region.
3777     *
3778     * @param { Ashmem } ashmem - Existing Ashmem object.
3779     * @returns { Ashmem } Ashmem object created.
3780     * @syscap SystemCapability.Communication.IPC.Core
3781     * @since 8
3782     * @deprecated since 9
3783     * @useinstead ohos.rpc.Ashmem#create
3784     */
3785    static createAshmemFromExisting(ashmem: Ashmem): Ashmem;
3786
3787    /**
3788     * Creates an Ashmem object by copying the file descriptor (FD) of an existing Ashmem object.
3789     * The two Ashmem objects point to the same shared memory region.
3790     *
3791     * @param { Ashmem } ashmem - Existing Ashmem object.
3792     * @returns { Ashmem } Ashmem object created.
3793     * @throws { BusinessError } 401 - Parameter error. Possible causes:
3794     *     1.The number of parameters is incorrect;
3795     *     2.The passed parameter is not an Ahmem object;
3796     *     3.The ashmem instance for obtaining packaging is empty.
3797     * @syscap SystemCapability.Communication.IPC.Core
3798     * @since 9
3799     */
3800    static create(ashmem: Ashmem): Ashmem;
3801
3802    /**
3803     * Closes this Ashmem object.
3804     *
3805     * @syscap SystemCapability.Communication.IPC.Core
3806     * @since 8
3807     */
3808    closeAshmem(): void;
3809
3810    /**
3811     * Deletes the mappings for the specified address range of this Ashmem object.
3812     *
3813     * @syscap SystemCapability.Communication.IPC.Core
3814     * @since 8
3815     */
3816    unmapAshmem(): void;
3817
3818    /**
3819     * Obtains the mapped memory size of this Ashmem object.
3820     *
3821     * @returns { number } Memory size mapped.
3822     * @syscap SystemCapability.Communication.IPC.Core
3823     * @since 8
3824     */
3825    getAshmemSize(): number;
3826
3827    /**
3828     * Creates the shared file mapping on the virtual address space of this process.
3829     * The size of the mapping region is specified by this Ashmem object.
3830     *
3831     * @param { number } mapType - Protection level of the memory region to which the shared file is mapped.
3832     * @returns { boolean } Return {@code true} if the operation is successful; return {@code false} otherwise.
3833     * @syscap SystemCapability.Communication.IPC.Core
3834     * @since 8
3835     * @deprecated since 9
3836     * @useinstead ohos.rpc.Ashmem#mapTypedAshmem
3837     */
3838    mapAshmem(mapType: number): boolean;
3839
3840    /**
3841     * Creates the shared file mapping on the virtual address space of this process.
3842     * The size of the mapping region is specified by this Ashmem object.
3843     *
3844     * @param { number } mapType - Protection level of the memory region to which the shared file is mapped.
3845     * @throws { BusinessError } 401 - Parameter error. Possible causes:
3846     *     1.The number of parameters is incorrect;
3847     *     2.The parameter type does not match;
3848     *     3.The passed mapType exceeds the maximum protection level.
3849     * @throws { BusinessError } 1900001 - Failed to call mmap.
3850     * @syscap SystemCapability.Communication.IPC.Core
3851     * @since 9
3852     */
3853    mapTypedAshmem(mapType: number): void;
3854
3855    /**
3856     * Maps the shared file to the readable and writable virtual address space of the process.
3857     *
3858     * @returns { boolean } Return {@code true} if the operation is successful; return {@code false} otherwise.
3859     * @syscap SystemCapability.Communication.IPC.Core
3860     * @since 8
3861     * @deprecated since 9
3862     * @useinstead ohos.rpc.Ashmem#mapReadWriteAshmem
3863     */
3864    mapReadAndWriteAshmem(): boolean;
3865
3866    /**
3867     * Maps the shared file to the readable and writable virtual address space of the process.
3868     *
3869     * @throws { BusinessError } 1900001 - Failed to call mmap.
3870     * @syscap SystemCapability.Communication.IPC.Core
3871     * @since 9
3872     */
3873    mapReadWriteAshmem(): void;
3874
3875    /**
3876     * Maps the shared file to the read-only virtual address space of the process.
3877     *
3878     * @returns { boolean } Return {@code true} if the operation is successful; return {@code false} otherwise.
3879     * @syscap SystemCapability.Communication.IPC.Core
3880     * @since 8
3881     * @deprecated since 9
3882     * @useinstead ohos.rpc.Ashmem#mapReadonlyAshmem
3883     */
3884    mapReadOnlyAshmem(): boolean;
3885
3886    /**
3887     * Maps the shared file to the read-only virtual address space of the process.
3888     *
3889     * @throws { BusinessError } 1900001 - Failed to call mmap.
3890     * @syscap SystemCapability.Communication.IPC.Core
3891     * @since 9
3892     */
3893    mapReadonlyAshmem(): void;
3894
3895    /**
3896     * Sets the protection level of the memory region to which the shared file is mapped.
3897     *
3898     * @param { number } protectionType - Protection type to set.
3899     * @returns { boolean } Return true if the operation is successful; return false otherwise.
3900     * @syscap SystemCapability.Communication.IPC.Core
3901     * @since 8
3902     * @deprecated since 9
3903     * @useinstead ohos.rpc.Ashmem#setProtectionType
3904     */
3905    setProtection(protectionType: number): boolean;
3906
3907    /**
3908     * Sets the protection level of the memory region to which the shared file is mapped.
3909     *
3910     * @param { number } protectionType - Protection type to set.
3911     * @throws { BusinessError } 401 - Parameter error. Possible causes:
3912     *     1.The number of parameters is incorrect;
3913     *     2.The parameter type does not match.
3914     * @throws { BusinessError } 1900002 - Failed to call ioctl.
3915     * @syscap SystemCapability.Communication.IPC.Core
3916     * @since 9
3917     */
3918    setProtectionType(protectionType: number): void;
3919
3920    /**
3921     * Writes data to the shared file associated with this Ashmem object.
3922     *
3923     * @param { number[] } buf - Data to write.
3924     * @param { number } size - Size of the data to write.
3925     * @param { number } offset - Start position of the data to write in the memory region associated
3926     *                   with this Ashmem object.
3927     * @returns { boolean } Return {@code true} is the data is written successfully; return {@code false} otherwise.
3928     * @syscap SystemCapability.Communication.IPC.Core
3929     * @since 8
3930     * @deprecated since 9
3931     * @useinstead ohos.rpc.Ashmem#writeAshmem
3932     */
3933    writeToAshmem(buf: number[], size: number, offset: number): boolean;
3934
3935    /**
3936     * Writes data to the shared file associated with this Ashmem object.
3937     *
3938     * @param { number[] } buf - Data to write
3939     * @param { number } size - Size of the data to write
3940     * @param { number } offset - Start position of the data to write in the memory region associated
3941     *                   with this Ashmem object.
3942     * @throws { BusinessError } 401 - Parameter error. Possible causes:
3943     *     1.The number of parameters is incorrect;
3944     *     2.The parameter type does not match;
3945     *     3.The element does not exist in the array.
3946     * @throws { BusinessError } 1900003 - Failed to write data to the shared memory.
3947     * @syscap SystemCapability.Communication.IPC.Core
3948     * @since 9
3949     * @deprecated since 11
3950     * @useinstead ohos.rpc.Ashmem#writeDataToAshmem
3951     */
3952    writeAshmem(buf: number[], size: number, offset: number): void;
3953
3954    /**
3955     * Writes data to the shared file associated with this Ashmem object.
3956     *
3957     * @param { ArrayBuffer } buf - Data to write
3958     * @param { number } size - Size of the data to write
3959     * @param { number } offset - Start position of the data to write in the memory region associated
3960     *                   with this Ashmem object.
3961     * @throws { BusinessError } 401 - Parameter error. Possible causes:
3962     *     1.The number of parameters is incorrect;
3963     *     2.The parameter type does not match;
3964     *     3.Failed to obtain arrayBuffer information.
3965     * @throws { BusinessError } 1900003 - Failed to write data to the shared memory.
3966     * @syscap SystemCapability.Communication.IPC.Core
3967     * @since 11
3968     */
3969    writeDataToAshmem(buf: ArrayBuffer, size: number, offset: number): void;
3970
3971    /**
3972     * Reads data from the shared file associated with this Ashmem object.
3973     *
3974     * @param { number } size - Size of the data to read.
3975     * @param { number } offset - Start position of the data to read in the memory region associated
3976     *                   with this Ashmem object.
3977     * @returns { number[] } Data read.
3978     * @syscap SystemCapability.Communication.IPC.Core
3979     * @since 8
3980     * @deprecated since 9
3981     * @useinstead ohos.rpc.Ashmem#readAshmem
3982     */
3983    readFromAshmem(size: number, offset: number): number[];
3984
3985    /**
3986     * Reads data from the shared file associated with this Ashmem object.
3987     *
3988     * @param { number } size - Size of the data to read.
3989     * @param { number } offset - Start position of the data to read in the memory region associated
3990     *                   with this Ashmem object.
3991     * @returns { number[] } Data read.
3992     * @throws { BusinessError } 401 - Parameter error. Possible causes:
3993     *     1.The number of parameters is incorrect;
3994     *     2.The parameter type does not match.
3995     * @throws { BusinessError } 1900004 - Failed to read data from the shared memory.
3996     * @syscap SystemCapability.Communication.IPC.Core
3997     * @since 9
3998     * @deprecated since 11
3999     * @useinstead ohos.rpc.Ashmem#readDataFromAshmem
4000     */
4001    readAshmem(size: number, offset: number): number[];
4002
4003    /**
4004     * Reads data from the shared file associated with this Ashmem object.
4005     *
4006     * @param { number } size - Size of the data to read.
4007     * @param { number } offset - Start position of the data to read in the memory region associated
4008     *                   with this Ashmem object.
4009     * @returns { ArrayBuffer } Data read.
4010     * @throws { BusinessError } 401 - Parameter error. Possible causes:
4011     *     1.The number of parameters is incorrect;
4012     *     2.The parameter type does not match.
4013     * @throws { BusinessError } 1900004 - Failed to read data from the shared memory.
4014     * @syscap SystemCapability.Communication.IPC.Core
4015     * @since 11
4016     */
4017    readDataFromAshmem(size: number, offset: number): ArrayBuffer;
4018  }
4019}
4020
4021export default rpc;
4022