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