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