Skip to main content

ohos_basic_services_kit_sys/commonevent/
commonevent_ffi.rs

1// automatically generated by rust-bindgen 0.71.1
2
3#![allow(non_upper_case_globals)]
4#![allow(non_camel_case_types)]
5#![allow(non_snake_case)]
6
7#[cfg(feature = "api-12")]
8#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
9impl CommonEvent_ErrCode {
10    /// Execution successful.
11    pub const COMMONEVENT_ERR_OK: CommonEvent_ErrCode = CommonEvent_ErrCode(0);
12    /// permission verification failed.
13    pub const COMMONEVENT_ERR_PERMISSION_ERROR: CommonEvent_ErrCode = CommonEvent_ErrCode(201);
14    /// invalid input parameter.
15    pub const COMMONEVENT_ERR_INVALID_PARAMETER: CommonEvent_ErrCode = CommonEvent_ErrCode(401);
16    /// The common event send frequency too high.
17    ///
18    ///
19    /// Available since API-level: 20
20    #[cfg(feature = "api-20")]
21    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
22    pub const COMMONEVENT_ERR_SENDING_LIMIT_EXCEEDED: CommonEvent_ErrCode =
23        CommonEvent_ErrCode(1500003);
24    /// the application cannot send system common events.
25    pub const COMMONEVENT_ERR_NOT_SYSTEM_SERVICE: CommonEvent_ErrCode =
26        CommonEvent_ErrCode(1500004);
27    /// IPC request failed to send.
28    pub const COMMONEVENT_ERR_SENDING_REQUEST_FAILED: CommonEvent_ErrCode =
29        CommonEvent_ErrCode(1500007);
30    /// Common event service not init.
31    pub const COMMONEVENT_ERR_INIT_UNDONE: CommonEvent_ErrCode = CommonEvent_ErrCode(1500008);
32    /// Failed to obtain system parameters.
33    pub const COMMONEVENT_ERR_OBTAIN_SYSTEM_PARAMS: CommonEvent_ErrCode =
34        CommonEvent_ErrCode(1500009);
35    /// The subscriber number exceed system specification
36    pub const COMMONEVENT_ERR_SUBSCRIBER_NUM_EXCEEDED: CommonEvent_ErrCode =
37        CommonEvent_ErrCode(1500010);
38    /// A memory allocation error occurs.
39    pub const COMMONEVENT_ERR_ALLOC_MEMORY_FAILED: CommonEvent_ErrCode =
40        CommonEvent_ErrCode(1500011);
41}
42#[repr(transparent)]
43/// Defines error codes.
44///
45///
46/// Available since API-level: 12
47///
48/// Version: 1.0
49#[cfg(feature = "api-12")]
50#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
51#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
52pub struct CommonEvent_ErrCode(pub ::core::ffi::c_uint);
53/// the information of the subscriber
54///
55///
56/// Available since API-level: 12
57#[cfg(feature = "api-12")]
58#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
59#[repr(C)]
60pub struct CommonEvent_SubscribeInfo {
61    _unused: [u8; 0],
62}
63/// the subscriber of common event
64///
65///
66/// Available since API-level: 12
67#[cfg(feature = "api-12")]
68#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
69pub type CommonEvent_Subscriber = ::core::ffi::c_void;
70/// the common event publish information containing content and attributes of the common event
71///
72///
73/// Available since API-level: 18
74#[cfg(feature = "api-18")]
75#[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
76#[repr(C)]
77pub struct CommonEvent_PublishInfo {
78    _unused: [u8; 0],
79}
80/// the data of the commonEvent callback
81///
82///
83/// Available since API-level: 12
84#[cfg(feature = "api-12")]
85#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
86#[repr(C)]
87pub struct CommonEvent_RcvData {
88    _unused: [u8; 0],
89}
90/// The description of the parameters in a common event callback data.
91///
92///
93/// Available since API-level: 12
94#[cfg(feature = "api-12")]
95#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
96pub type CommonEvent_Parameters = ::core::ffi::c_void;
97/// Common event callback.
98///
99/// # Arguments
100///
101/// * `data` - common event callback data.
102///
103/// Available since API-level: 12
104#[cfg(feature = "api-12")]
105#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
106pub type CommonEvent_ReceiveCallback =
107    ::core::option::Option<unsafe extern "C" fn(data: *const CommonEvent_RcvData)>;
108extern "C" {
109    /// Create subscribe information.
110    ///
111    /// # Arguments
112    ///
113    /// * `events` - Indicates the subscribed events.
114    ///
115    /// * `eventsNum` - Indicates the subscribed events of number.
116    ///
117    /// # Returns
118    ///
119    /// * Returns the CommonEvent_SubscribeInfo, if allocate memory failed, returns null.
120    ///
121    /// Available since API-level: 12
122    #[cfg(feature = "api-12")]
123    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
124    pub fn OH_CommonEvent_CreateSubscribeInfo(
125        events: *mut *const ::core::ffi::c_char,
126        eventsNum: i32,
127    ) -> *mut CommonEvent_SubscribeInfo;
128    /// Set the permission of the subscribe information.
129    ///
130    /// # Arguments
131    ///
132    /// * `info` - Indicates the subscribe information.
133    ///
134    /// * `permission` - Indicates the permission.
135    ///
136    /// # Returns
137    ///
138    /// * Returns the error code.
139    /// Returns [`COMMONEVENT_ERR_OK`] if the operation is successful.
140    /// Returns [`COMMONEVENT_ERR_INVALID_PARAMETER`] if a parameter error occurs.
141    ///
142    /// Available since API-level: 12
143    #[cfg(feature = "api-12")]
144    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
145    pub fn OH_CommonEvent_SetPublisherPermission(
146        info: *mut CommonEvent_SubscribeInfo,
147        permission: *const ::core::ffi::c_char,
148    ) -> CommonEvent_ErrCode;
149    /// Set the bundleName of the subscribe information.
150    ///
151    /// # Arguments
152    ///
153    /// * `info` - Indicates the subscribed events.
154    ///
155    /// * `bundleName` - Indicates the bundleName.
156    ///
157    /// # Returns
158    ///
159    /// * Returns the error code.
160    /// Returns [`COMMONEVENT_ERR_OK`] if the operation is successful.
161    /// Returns [`COMMONEVENT_ERR_INVALID_PARAMETER`] if a parameter error occurs.
162    ///
163    /// Available since API-level: 12
164    #[cfg(feature = "api-12")]
165    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
166    pub fn OH_CommonEvent_SetPublisherBundleName(
167        info: *mut CommonEvent_SubscribeInfo,
168        bundleName: *const ::core::ffi::c_char,
169    ) -> CommonEvent_ErrCode;
170    /// Destroy the subscribe information.
171    ///
172    /// # Arguments
173    ///
174    /// * `info` - Indicates the subscribe info.
175    ///
176    /// Available since API-level: 12
177    #[cfg(feature = "api-12")]
178    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
179    pub fn OH_CommonEvent_DestroySubscribeInfo(info: *mut CommonEvent_SubscribeInfo);
180    /// Create a subscriber.
181    ///
182    /// # Arguments
183    ///
184    /// * `info` - Indicates the created subscribe Info.
185    ///
186    /// * `callback` - Indicates the received common event callback.
187    ///
188    /// # Returns
189    ///
190    /// * Returns the CommonEvent_Subscriber, if allocate memory failed, returns null.
191    ///
192    /// Available since API-level: 12
193    #[cfg(feature = "api-12")]
194    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
195    pub fn OH_CommonEvent_CreateSubscriber(
196        info: *const CommonEvent_SubscribeInfo,
197        callback: CommonEvent_ReceiveCallback,
198    ) -> *mut CommonEvent_Subscriber;
199    /// Destory the subscriber.
200    ///
201    /// # Arguments
202    ///
203    /// * `subscriber` - Indicates the created subscriber.
204    ///
205    /// Available since API-level: 12
206    #[cfg(feature = "api-12")]
207    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
208    pub fn OH_CommonEvent_DestroySubscriber(subscriber: *mut CommonEvent_Subscriber);
209    /// Subscribe event by a subscriber.
210    ///
211    /// # Arguments
212    ///
213    /// * `subscriber` - Indicates the subscriber.
214    ///
215    /// # Returns
216    ///
217    /// * Returns the error code.
218    /// Returns [`COMMONEVENT_ERR_OK`] if the operation is successful.
219    /// Returns [`COMMONEVENT_ERR_INVALID_PARAMETER`] if the input parameter is invalid.
220    /// Returns [`COMMONEVENT_ERR_SENDING_REQUEST_FAILED`] if IPC request failed to send.
221    /// Returns [`COMMONEVENT_ERR_INIT_UNDONE`] if ces not init done.
222    /// Returns [`COMMONEVENT_ERR_SUBSCRIBER_NUM_EXCEEDED`] if the subscriber number is exceeded.
223    /// Returns [`COMMONEVENT_ERR_ALLOC_MEMORY_FAILED`] if a memory allocation error occurs.
224    ///
225    /// Available since API-level: 12
226    #[cfg(feature = "api-12")]
227    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
228    pub fn OH_CommonEvent_Subscribe(
229        subscriber: *const CommonEvent_Subscriber,
230    ) -> CommonEvent_ErrCode;
231    /// Unsubscribe event by a subscriber.
232    ///
233    /// # Arguments
234    ///
235    /// * `subscriber` - Indicates the subscriber.
236    ///
237    /// # Returns
238    ///
239    /// * Returns the error code.
240    /// Returns [`COMMONEVENT_ERR_OK`] if the operation is successful.
241    /// Returns [`COMMONEVENT_ERR_INVALID_PARAMETER`] if the input parameter is invalid.
242    /// Returns [`COMMONEVENT_ERR_SENDING_REQUEST_FAILED`] if IPC request failed to send.
243    /// Returns [`COMMONEVENT_ERR_INIT_UNDONE`] if ces not init done.
244    ///
245    /// Available since API-level: 12
246    #[cfg(feature = "api-12")]
247    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
248    pub fn OH_CommonEvent_UnSubscribe(
249        subscriber: *const CommonEvent_Subscriber,
250    ) -> CommonEvent_ErrCode;
251    /// Get event name from callback data.
252    ///
253    /// # Arguments
254    ///
255    /// * `rcvData` - Indicates the callback data.
256    ///
257    /// # Returns
258    ///
259    /// * Returns the event name.
260    ///
261    /// Available since API-level: 12
262    #[cfg(feature = "api-12")]
263    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
264    pub fn OH_CommonEvent_GetEventFromRcvData(
265        rcvData: *const CommonEvent_RcvData,
266    ) -> *const ::core::ffi::c_char;
267    /// Get event code from callback data.
268    ///
269    /// # Arguments
270    ///
271    /// * `rcvData` - Indicates the callback data.
272    ///
273    /// # Returns
274    ///
275    /// * Returns the event of code, default is 0.
276    ///
277    /// Available since API-level: 12
278    #[cfg(feature = "api-12")]
279    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
280    pub fn OH_CommonEvent_GetCodeFromRcvData(rcvData: *const CommonEvent_RcvData) -> i32;
281    /// Get event data from callback data.
282    ///
283    /// # Arguments
284    ///
285    /// * `rcvData` - Indicates the callback data.
286    ///
287    /// # Returns
288    ///
289    /// * Returns the event of data, default is null.
290    ///
291    /// Available since API-level: 12
292    #[cfg(feature = "api-12")]
293    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
294    pub fn OH_CommonEvent_GetDataStrFromRcvData(
295        rcvData: *const CommonEvent_RcvData,
296    ) -> *const ::core::ffi::c_char;
297    /// Get event bundlename from callback data.
298    ///
299    /// # Arguments
300    ///
301    /// * `rcvData` - Indicates the callback data.
302    ///
303    /// # Returns
304    ///
305    /// * Returns the event of bundlename, default is null.
306    ///
307    /// Available since API-level: 12
308    #[cfg(feature = "api-12")]
309    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
310    pub fn OH_CommonEvent_GetBundleNameFromRcvData(
311        rcvData: *const CommonEvent_RcvData,
312    ) -> *const ::core::ffi::c_char;
313    /// Get event parameters data from callback data.
314    ///
315    /// # Arguments
316    ///
317    /// * `rcvData` - Indicates the callback data.
318    ///
319    /// # Returns
320    ///
321    /// * Returns the event parameters data, default is null.
322    ///
323    /// Available since API-level: 12
324    #[cfg(feature = "api-12")]
325    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
326    pub fn OH_CommonEvent_GetParametersFromRcvData(
327        rcvData: *const CommonEvent_RcvData,
328    ) -> *const CommonEvent_Parameters;
329    /// Create a common event publish information.
330    ///
331    /// # Arguments
332    ///
333    /// * `ordered` - Indicates whether the common event is ordered.
334    ///
335    /// # Returns
336    ///
337    /// * Returns the CommonEvent_PublishInfo, if create failed, returns null.
338    ///
339    /// Available since API-level: 18
340    #[cfg(feature = "api-18")]
341    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
342    pub fn OH_CommonEvent_CreatePublishInfo(ordered: bool) -> *mut CommonEvent_PublishInfo;
343    /// Destroy the common event publish information.
344    ///
345    /// # Arguments
346    ///
347    /// * `info` - Indicates the publish information.
348    ///
349    /// Available since API-level: 18
350    #[cfg(feature = "api-18")]
351    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
352    pub fn OH_CommonEvent_DestroyPublishInfo(info: *mut CommonEvent_PublishInfo);
353    /// Set the bundleName of publish information.
354    ///
355    /// # Arguments
356    ///
357    /// * `info` - Indicates the publish information.
358    ///
359    /// * `bundleName` - Indicates the bundleName.
360    ///
361    /// # Returns
362    ///
363    /// * Returns the error code.
364    /// Returns [`COMMONEVENT_ERR_OK`] if the operation is successful.
365    /// Returns [`COMMONEVENT_ERR_INVALID_PARAMETER`] if a parameter error occurs.
366    ///
367    /// Available since API-level: 18
368    #[cfg(feature = "api-18")]
369    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
370    pub fn OH_CommonEvent_SetPublishInfoBundleName(
371        info: *mut CommonEvent_PublishInfo,
372        bundleName: *const ::core::ffi::c_char,
373    ) -> CommonEvent_ErrCode;
374    /// Set the permissions of publish information.
375    ///
376    /// # Arguments
377    ///
378    /// * `info` - Indicates the publish information.
379    ///
380    /// * `permissions` - Indicates the array of permissions.
381    ///
382    /// * `num` - Indicates the count of permissions.
383    ///
384    /// # Returns
385    ///
386    /// * Returns the error code.
387    /// Returns [`COMMONEVENT_ERR_OK`] if the operation is successful.
388    /// Returns [`COMMONEVENT_ERR_INVALID_PARAMETER`] if a parameter error occurs.
389    ///
390    /// Available since API-level: 18
391    #[cfg(feature = "api-18")]
392    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
393    pub fn OH_CommonEvent_SetPublishInfoPermissions(
394        info: *mut CommonEvent_PublishInfo,
395        permissions: *mut *const ::core::ffi::c_char,
396        num: i32,
397    ) -> CommonEvent_ErrCode;
398    /// Set the code of publish information.
399    ///
400    /// # Arguments
401    ///
402    /// * `info` - Indicates the publish information.
403    ///
404    /// * `code` - Indicates the code.
405    ///
406    /// # Returns
407    ///
408    /// * Returns the error code.
409    /// Returns [`COMMONEVENT_ERR_OK`] if the operation is successful.
410    /// Returns [`COMMONEVENT_ERR_INVALID_PARAMETER`] if a parameter error occurs.
411    ///
412    /// Available since API-level: 18
413    #[cfg(feature = "api-18")]
414    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
415    pub fn OH_CommonEvent_SetPublishInfoCode(
416        info: *mut CommonEvent_PublishInfo,
417        code: i32,
418    ) -> CommonEvent_ErrCode;
419    /// Set the data of publish information.
420    ///
421    /// # Arguments
422    ///
423    /// * `info` - Indicates the publish information.
424    ///
425    /// * `data` - Indicates the data.
426    ///
427    /// * `length` - Indicates the length of data.
428    ///
429    /// # Returns
430    ///
431    /// * Returns the error code.
432    /// Returns [`COMMONEVENT_ERR_OK`] if the operation is successful.
433    /// Returns [`COMMONEVENT_ERR_INVALID_PARAMETER`] if a parameter error occurs.
434    ///
435    /// Available since API-level: 18
436    #[cfg(feature = "api-18")]
437    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
438    pub fn OH_CommonEvent_SetPublishInfoData(
439        info: *mut CommonEvent_PublishInfo,
440        data: *const ::core::ffi::c_char,
441        length: usize,
442    ) -> CommonEvent_ErrCode;
443    /// Set the parameters of publish information.
444    ///
445    /// # Arguments
446    ///
447    /// * `info` - Indicates the publish information.
448    ///
449    /// * `param` - Indicates the parameters.
450    ///
451    /// # Returns
452    ///
453    /// * Returns the error code.
454    /// Returns [`COMMONEVENT_ERR_OK`] if the operation is successful.
455    /// Returns [`COMMONEVENT_ERR_INVALID_PARAMETER`] if a parameter error occurs.
456    ///
457    /// Available since API-level: 18
458    #[cfg(feature = "api-18")]
459    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
460    pub fn OH_CommonEvent_SetPublishInfoParameters(
461        info: *mut CommonEvent_PublishInfo,
462        param: *mut CommonEvent_Parameters,
463    ) -> CommonEvent_ErrCode;
464    /// Create a common event publish information.
465    ///
466    ///
467    /// # Returns
468    ///
469    /// * Returns the CommonEvent_PublishInfo, if create failed, returns null.
470    ///
471    /// Available since API-level: 18
472    #[cfg(feature = "api-18")]
473    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
474    pub fn OH_CommonEvent_CreateParameters() -> *mut CommonEvent_Parameters;
475    /// Destroy the common event publish information.
476    ///
477    /// # Arguments
478    ///
479    /// * `param` - Indicates the publish information.
480    ///
481    /// Available since API-level: 18
482    #[cfg(feature = "api-18")]
483    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
484    pub fn OH_CommonEvent_DestroyParameters(param: *mut CommonEvent_Parameters);
485    /// Check whether the parameters data contains a key.
486    ///
487    /// # Arguments
488    ///
489    /// * `para` - Indicates the parameters data.
490    ///
491    /// * `key` - Indicates the key.
492    ///
493    /// # Returns
494    ///
495    /// * Returns the result of check, true means it contains.
496    ///
497    /// Available since API-level: 12
498    #[cfg(feature = "api-12")]
499    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
500    pub fn OH_CommonEvent_HasKeyInParameters(
501        para: *const CommonEvent_Parameters,
502        key: *const ::core::ffi::c_char,
503    ) -> bool;
504    /// Get int data from parameters data by key.
505    ///
506    /// # Arguments
507    ///
508    /// * `para` - Indicates the parameters data.
509    ///
510    /// * `key` - Indicates the key.
511    ///
512    /// * `defaultValue` - Indicates default return value.
513    ///
514    /// # Returns
515    ///
516    /// * Returns the int data of the key in the parameters.
517    ///
518    /// Available since API-level: 12
519    #[cfg(feature = "api-12")]
520    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
521    pub fn OH_CommonEvent_GetIntFromParameters(
522        para: *const CommonEvent_Parameters,
523        key: *const ::core::ffi::c_char,
524        defaultValue: ::core::ffi::c_int,
525    ) -> ::core::ffi::c_int;
526    /// Set int data to parameters data by key.
527    ///
528    /// # Arguments
529    ///
530    /// * `param` - Indicates the parameters data.
531    ///
532    /// * `key` - Indicates the key.
533    ///
534    /// * `value` - Indicates the int data.
535    ///
536    /// # Returns
537    ///
538    /// * Returns the error code.
539    /// Returns [`COMMONEVENT_ERR_OK`] if the operation is successful.
540    /// Returns [`COMMONEVENT_ERR_INVALID_PARAMETER`] if a parameter error occurs.
541    ///
542    /// Available since API-level: 18
543    #[cfg(feature = "api-18")]
544    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
545    pub fn OH_CommonEvent_SetIntToParameters(
546        param: *mut CommonEvent_Parameters,
547        key: *const ::core::ffi::c_char,
548        value: ::core::ffi::c_int,
549    ) -> CommonEvent_ErrCode;
550    /// Get int array data from parameters data by key.
551    ///
552    /// # Arguments
553    ///
554    /// * `para` - Indicates the parameters data.
555    ///
556    /// * `key` - Indicates the key.
557    ///
558    /// * `array` - Indicates the int array.
559    ///
560    /// # Returns
561    ///
562    /// * Returns the length of the array.
563    ///
564    /// Available since API-level: 12
565    #[cfg(feature = "api-12")]
566    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
567    pub fn OH_CommonEvent_GetIntArrayFromParameters(
568        para: *const CommonEvent_Parameters,
569        key: *const ::core::ffi::c_char,
570        array: *mut *mut ::core::ffi::c_int,
571    ) -> i32;
572    /// Set int array data to parameters data by key.
573    ///
574    /// # Arguments
575    ///
576    /// * `param` - Indicates the parameters data.
577    ///
578    /// * `key` - Indicates the key.
579    ///
580    /// * `value` - Indicates the int array data.
581    ///
582    /// * `num` - Indicates the length of the array.
583    ///
584    /// # Returns
585    ///
586    /// * Returns the error code.
587    /// Returns [`COMMONEVENT_ERR_OK`] if the operation is successful.
588    /// Returns [`COMMONEVENT_ERR_INVALID_PARAMETER`] if a parameter error occurs.
589    /// Returns [`COMMONEVENT_ERR_ALLOC_MEMORY_FAILED`] if a memory allocation error occurs.
590    ///
591    /// Available since API-level: 18
592    #[cfg(feature = "api-18")]
593    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
594    pub fn OH_CommonEvent_SetIntArrayToParameters(
595        param: *mut CommonEvent_Parameters,
596        key: *const ::core::ffi::c_char,
597        value: *const ::core::ffi::c_int,
598        num: usize,
599    ) -> CommonEvent_ErrCode;
600    /// Get long data from parameters data by key.
601    ///
602    /// # Arguments
603    ///
604    /// * `para` - Indicates the parameters data.
605    ///
606    /// * `key` - Indicates the key.
607    ///
608    /// * `defaultValue` - Indicates default return value.
609    ///
610    /// # Returns
611    ///
612    /// * Returns the long data of the key in the parameters.
613    ///
614    /// Available since API-level: 12
615    #[cfg(feature = "api-12")]
616    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
617    pub fn OH_CommonEvent_GetLongFromParameters(
618        para: *const CommonEvent_Parameters,
619        key: *const ::core::ffi::c_char,
620        defaultValue: ::core::ffi::c_long,
621    ) -> ::core::ffi::c_long;
622    /// Set long data to parameters data by key.
623    ///
624    /// # Arguments
625    ///
626    /// * `param` - Indicates the parameters data.
627    ///
628    /// * `key` - Indicates the key.
629    ///
630    /// * `value` - Indicates the long data.
631    ///
632    /// # Returns
633    ///
634    /// * Returns the error code.
635    /// Returns [`COMMONEVENT_ERR_OK`] if the operation is successful.
636    /// Returns [`COMMONEVENT_ERR_INVALID_PARAMETER`] if a parameter error occurs.
637    ///
638    /// Available since API-level: 18
639    #[cfg(feature = "api-18")]
640    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
641    pub fn OH_CommonEvent_SetLongToParameters(
642        param: *mut CommonEvent_Parameters,
643        key: *const ::core::ffi::c_char,
644        value: ::core::ffi::c_long,
645    ) -> CommonEvent_ErrCode;
646    /// Get long array data from parameters data by key.
647    ///
648    /// # Arguments
649    ///
650    /// * `para` - Indicates the parameters data.
651    ///
652    /// * `key` - Indicates the key.
653    ///
654    /// * `array` - Indicates the long array.
655    ///
656    /// # Returns
657    ///
658    /// * Returns the length of the array.
659    ///
660    /// Available since API-level: 12
661    #[cfg(feature = "api-12")]
662    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
663    pub fn OH_CommonEvent_GetLongArrayFromParameters(
664        para: *const CommonEvent_Parameters,
665        key: *const ::core::ffi::c_char,
666        array: *mut *mut ::core::ffi::c_long,
667    ) -> i32;
668    /// Set long array data to parameters data by key.
669    ///
670    /// # Arguments
671    ///
672    /// * `param` - Indicates the parameters data.
673    ///
674    /// * `key` - Indicates the key.
675    ///
676    /// * `value` - Indicates the long array data.
677    ///
678    /// * `num` - Indicates the length of the array.
679    ///
680    /// # Returns
681    ///
682    /// * Returns the error code.
683    /// Returns [`COMMONEVENT_ERR_OK`] if the operation is successful.
684    /// Returns [`COMMONEVENT_ERR_INVALID_PARAMETER`] if a parameter error occurs.
685    /// Returns [`COMMONEVENT_ERR_ALLOC_MEMORY_FAILED`] if a memory allocation error occurs.
686    ///
687    /// Available since API-level: 18
688    #[cfg(feature = "api-18")]
689    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
690    pub fn OH_CommonEvent_SetLongArrayToParameters(
691        param: *mut CommonEvent_Parameters,
692        key: *const ::core::ffi::c_char,
693        value: *const ::core::ffi::c_long,
694        num: usize,
695    ) -> CommonEvent_ErrCode;
696    /// Get bool data from parameters data by key.
697    ///
698    /// # Arguments
699    ///
700    /// * `para` - Indicates the parameters data.
701    ///
702    /// * `key` - Indicates the key.
703    ///
704    /// * `defaultValue` - Indicates default return value.
705    ///
706    /// # Returns
707    ///
708    /// * Returns the bool data of the key in the parameters.
709    ///
710    /// Available since API-level: 12
711    #[cfg(feature = "api-12")]
712    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
713    pub fn OH_CommonEvent_GetBoolFromParameters(
714        para: *const CommonEvent_Parameters,
715        key: *const ::core::ffi::c_char,
716        defaultValue: bool,
717    ) -> bool;
718    /// Set bool data to parameters data by key.
719    ///
720    /// # Arguments
721    ///
722    /// * `param` - Indicates the parameters data.
723    ///
724    /// * `key` - Indicates the key.
725    ///
726    /// * `value` - Indicates the bool data.
727    ///
728    /// # Returns
729    ///
730    /// * Returns the error code.
731    /// Returns [`COMMONEVENT_ERR_OK`] if the operation is successful.
732    /// Returns [`COMMONEVENT_ERR_INVALID_PARAMETER`] if a parameter error occurs.
733    ///
734    /// Available since API-level: 18
735    #[cfg(feature = "api-18")]
736    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
737    pub fn OH_CommonEvent_SetBoolToParameters(
738        param: *mut CommonEvent_Parameters,
739        key: *const ::core::ffi::c_char,
740        value: bool,
741    ) -> CommonEvent_ErrCode;
742    /// Get bool array data from parameters data by key.
743    ///
744    /// # Arguments
745    ///
746    /// * `para` - Indicates the parameters data.
747    ///
748    /// * `key` - Indicates the key.
749    ///
750    /// * `array` - Indicates the bool array.
751    ///
752    /// # Returns
753    ///
754    /// * Returns the length of the array.
755    ///
756    /// Available since API-level: 12
757    #[cfg(feature = "api-12")]
758    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
759    pub fn OH_CommonEvent_GetBoolArrayFromParameters(
760        para: *const CommonEvent_Parameters,
761        key: *const ::core::ffi::c_char,
762        array: *mut *mut bool,
763    ) -> i32;
764    /// Set bool array data to parameters data by key.
765    ///
766    /// # Arguments
767    ///
768    /// * `param` - Indicates the parameters data.
769    ///
770    /// * `key` - Indicates the key.
771    ///
772    /// * `value` - Indicates the bool array data.
773    ///
774    /// * `num` - Indicates the length of the array.
775    ///
776    /// # Returns
777    ///
778    /// * Returns the error code.
779    /// Returns [`COMMONEVENT_ERR_OK`] if the operation is successful.
780    /// Returns [`COMMONEVENT_ERR_INVALID_PARAMETER`] if a parameter error occurs.
781    /// Returns [`COMMONEVENT_ERR_ALLOC_MEMORY_FAILED`] if a memory allocation error occurs.
782    ///
783    /// Available since API-level: 18
784    #[cfg(feature = "api-18")]
785    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
786    pub fn OH_CommonEvent_SetBoolArrayToParameters(
787        param: *mut CommonEvent_Parameters,
788        key: *const ::core::ffi::c_char,
789        value: *const bool,
790        num: usize,
791    ) -> CommonEvent_ErrCode;
792    /// Get char data from parameters data by key.
793    ///
794    /// # Arguments
795    ///
796    /// * `para` - Indicates the parameters data.
797    ///
798    /// * `key` - Indicates the key.
799    ///
800    /// * `defaultValue` - Indicates default return value.
801    ///
802    /// # Returns
803    ///
804    /// * Returns the char data of the key in the parameters.
805    ///
806    /// Available since API-level: 12
807    #[cfg(feature = "api-12")]
808    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
809    pub fn OH_CommonEvent_GetCharFromParameters(
810        para: *const CommonEvent_Parameters,
811        key: *const ::core::ffi::c_char,
812        defaultValue: ::core::ffi::c_char,
813    ) -> ::core::ffi::c_char;
814    /// Set char data to parameters data by key.
815    ///
816    /// # Arguments
817    ///
818    /// * `param` - Indicates the parameters data.
819    ///
820    /// * `key` - Indicates the key.
821    ///
822    /// * `value` - Indicates the char data.
823    ///
824    /// # Returns
825    ///
826    /// * Returns the error code.
827    /// Returns [`COMMONEVENT_ERR_OK`] if the operation is successful.
828    /// Returns [`COMMONEVENT_ERR_INVALID_PARAMETER`] if a parameter error occurs.
829    ///
830    /// Available since API-level: 18
831    #[cfg(feature = "api-18")]
832    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
833    pub fn OH_CommonEvent_SetCharToParameters(
834        param: *mut CommonEvent_Parameters,
835        key: *const ::core::ffi::c_char,
836        value: ::core::ffi::c_char,
837    ) -> CommonEvent_ErrCode;
838    /// Get char array data from parameters data by key.
839    ///
840    /// # Arguments
841    ///
842    /// * `para` - Indicates the parameters data.
843    ///
844    /// * `key` - Indicates the key.
845    ///
846    /// * `array` - Indicates the char array.
847    ///
848    /// # Returns
849    ///
850    /// * Returns the length of the array.
851    ///
852    /// Available since API-level: 12
853    #[cfg(feature = "api-12")]
854    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
855    pub fn OH_CommonEvent_GetCharArrayFromParameters(
856        para: *const CommonEvent_Parameters,
857        key: *const ::core::ffi::c_char,
858        array: *mut *mut ::core::ffi::c_char,
859    ) -> i32;
860    /// Set char array data to parameters data by key.
861    ///
862    /// # Arguments
863    ///
864    /// * `param` - Indicates the parameters data.
865    ///
866    /// * `key` - Indicates the key.
867    ///
868    /// * `value` - Indicates the char array data.
869    ///
870    /// * `num` - Indicates the length of the array.
871    ///
872    /// # Returns
873    ///
874    /// * Returns the error code.
875    /// Returns [`COMMONEVENT_ERR_OK`] if the operation is successful.
876    /// Returns [`COMMONEVENT_ERR_INVALID_PARAMETER`] if a parameter error occurs.
877    ///
878    /// Available since API-level: 18
879    #[cfg(feature = "api-18")]
880    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
881    pub fn OH_CommonEvent_SetCharArrayToParameters(
882        param: *mut CommonEvent_Parameters,
883        key: *const ::core::ffi::c_char,
884        value: *const ::core::ffi::c_char,
885        num: usize,
886    ) -> CommonEvent_ErrCode;
887    /// Get double data from parameters data by key.
888    ///
889    /// # Arguments
890    ///
891    /// * `para` - Indicates the parameters data.
892    ///
893    /// * `key` - Indicates the key.
894    ///
895    /// * `defaultValue` - Indicates default return value.
896    ///
897    /// # Returns
898    ///
899    /// * Returns the double data of the key in the parameters.
900    ///
901    /// Available since API-level: 12
902    #[cfg(feature = "api-12")]
903    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
904    pub fn OH_CommonEvent_GetDoubleFromParameters(
905        para: *const CommonEvent_Parameters,
906        key: *const ::core::ffi::c_char,
907        defaultValue: f64,
908    ) -> f64;
909    /// Set double data to parameters data by key.
910    ///
911    /// # Arguments
912    ///
913    /// * `param` - Indicates the parameters data.
914    ///
915    /// * `key` - Indicates the key.
916    ///
917    /// * `value` - Indicates the double data.
918    ///
919    /// # Returns
920    ///
921    /// * Returns the error code.
922    /// Returns [`COMMONEVENT_ERR_OK`] if the operation is successful.
923    /// Returns [`COMMONEVENT_ERR_INVALID_PARAMETER`] if a parameter error occurs.
924    ///
925    /// Available since API-level: 18
926    #[cfg(feature = "api-18")]
927    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
928    pub fn OH_CommonEvent_SetDoubleToParameters(
929        param: *mut CommonEvent_Parameters,
930        key: *const ::core::ffi::c_char,
931        value: f64,
932    ) -> CommonEvent_ErrCode;
933    /// Get double array data from parameters data by key.
934    ///
935    /// # Arguments
936    ///
937    /// * `para` - Indicates the parameters data.
938    ///
939    /// * `key` - Indicates the key.
940    ///
941    /// * `array` - Indicates the double array.
942    ///
943    /// # Returns
944    ///
945    /// * Returns the length of the array, default is 0.
946    ///
947    /// Available since API-level: 12
948    #[cfg(feature = "api-12")]
949    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
950    pub fn OH_CommonEvent_GetDoubleArrayFromParameters(
951        para: *const CommonEvent_Parameters,
952        key: *const ::core::ffi::c_char,
953        array: *mut *mut f64,
954    ) -> i32;
955    /// Set double array data to parameters data by key.
956    ///
957    /// # Arguments
958    ///
959    /// * `param` - Indicates the parameters data.
960    ///
961    /// * `key` - Indicates the key.
962    ///
963    /// * `value` - Indicates the double array data.
964    ///
965    /// * `num` - Indicates the length of the array.
966    ///
967    /// # Returns
968    ///
969    /// * Returns the error code.
970    /// Returns [`COMMONEVENT_ERR_OK`] if the operation is successful.
971    /// Returns [`COMMONEVENT_ERR_INVALID_PARAMETER`] if a parameter error occurs.
972    /// Returns [`COMMONEVENT_ERR_ALLOC_MEMORY_FAILED`] if a memory allocation error occurs.
973    ///
974    /// Available since API-level: 18
975    #[cfg(feature = "api-18")]
976    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
977    pub fn OH_CommonEvent_SetDoubleArrayToParameters(
978        param: *mut CommonEvent_Parameters,
979        key: *const ::core::ffi::c_char,
980        value: *const f64,
981        num: usize,
982    ) -> CommonEvent_ErrCode;
983    /// Publish a commen event.
984    ///
985    /// # Arguments
986    ///
987    /// * `event` - Indicates the name of the common event.
988    ///
989    /// # Returns
990    ///
991    /// * Returns the error code.
992    /// Returns [`COMMONEVENT_ERR_OK`] if the operation is successful.
993    /// Returns [`COMMONEVENT_ERR_INVALID_PARAMETER`] if a parameter error occurs.
994    /// Returns [`COMMONEVENT_ERR_SENDING_LIMIT_EXCEEDED`] if the common event sending frequency too high,
995    /// add since api 20.
996    /// Returns [`COMMONEVENT_ERR_FAIL_SEND_REQUEST`] if IPC request failed to send.
997    /// Returns [`COMMONEVENT_ERR_INIT_UNDONE`] if ces not init done.
998    ///
999    /// Available since API-level: 18
1000    #[cfg(feature = "api-18")]
1001    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
1002    pub fn OH_CommonEvent_Publish(event: *const ::core::ffi::c_char) -> CommonEvent_ErrCode;
1003    /// Publish a commen event with specified publish information.
1004    ///
1005    /// # Arguments
1006    ///
1007    /// * `event` - Indicates the name of the common event.
1008    ///
1009    /// * `info` - Indicates the publish information.
1010    ///
1011    /// # Returns
1012    ///
1013    /// * Returns the error code.
1014    /// Returns [`COMMONEVENT_ERR_OK`] if the operation is successful.
1015    /// Returns [`COMMONEVENT_ERR_INVALID_PARAMETER`] if a parameter error occurs.
1016    /// Returns [`COMMONEVENT_ERR_SENDING_LIMIT_EXCEEDED`] if the common event sending frequency too high,
1017    /// add since api 20.
1018    /// Returns [`COMMONEVENT_ERR_FAIL_SEND_REQUEST`] if IPC request failed to send.
1019    /// Returns [`COMMONEVENT_ERR_INIT_UNDONE`] if ces not init done.
1020    ///
1021    /// Available since API-level: 18
1022    #[cfg(feature = "api-18")]
1023    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
1024    pub fn OH_CommonEvent_PublishWithInfo(
1025        event: *const ::core::ffi::c_char,
1026        info: *const CommonEvent_PublishInfo,
1027    ) -> CommonEvent_ErrCode;
1028    /// Check an event by a subscriber whether it is ordered.
1029    ///
1030    /// # Arguments
1031    ///
1032    /// * `subscriber` - Indicates the subscriber.
1033    ///
1034    /// # Returns
1035    ///
1036    /// * Returns the result of check, true means ordered.
1037    ///
1038    /// Available since API-level: 18
1039    #[cfg(feature = "api-18")]
1040    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
1041    pub fn OH_CommonEvent_IsOrderedCommonEvent(subscriber: *const CommonEvent_Subscriber) -> bool;
1042    /// Finish an ordered event by a subscriber.
1043    ///
1044    /// # Arguments
1045    ///
1046    /// * `subscriber` - Indicates the subscriber.
1047    ///
1048    /// # Returns
1049    ///
1050    /// * Returns the result of operation, true means succeeded.
1051    ///
1052    /// Available since API-level: 18
1053    #[cfg(feature = "api-18")]
1054    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
1055    pub fn OH_CommonEvent_FinishCommonEvent(subscriber: *mut CommonEvent_Subscriber) -> bool;
1056    /// Check an event by a subscriber whether it is aborted.
1057    ///
1058    /// # Arguments
1059    ///
1060    /// * `subscriber` - Indicates the subscriber.
1061    ///
1062    /// # Returns
1063    ///
1064    /// * Returns the result of check, true means aborted.
1065    ///
1066    /// Available since API-level: 18
1067    #[cfg(feature = "api-18")]
1068    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
1069    pub fn OH_CommonEvent_GetAbortCommonEvent(subscriber: *const CommonEvent_Subscriber) -> bool;
1070    /// Abort an ordered event by a subscriber.
1071    ///
1072    /// # Arguments
1073    ///
1074    /// * `subscriber` - Indicates the subscriber.
1075    ///
1076    /// # Returns
1077    ///
1078    /// * Returns the result of operation, true means succeeded.
1079    ///
1080    /// Available since API-level: 18
1081    #[cfg(feature = "api-18")]
1082    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
1083    pub fn OH_CommonEvent_AbortCommonEvent(subscriber: *mut CommonEvent_Subscriber) -> bool;
1084    /// Clear the aborted flag of an ordered event by a subscriber.
1085    ///
1086    /// # Arguments
1087    ///
1088    /// * `subscriber` - Indicates the subscriber.
1089    ///
1090    /// # Returns
1091    ///
1092    /// * Returns the result of operation, true means succeeded.
1093    ///
1094    /// Available since API-level: 18
1095    #[cfg(feature = "api-18")]
1096    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
1097    pub fn OH_CommonEvent_ClearAbortCommonEvent(subscriber: *mut CommonEvent_Subscriber) -> bool;
1098    /// Get code from an ordered event by a subscriber.
1099    ///
1100    /// # Arguments
1101    ///
1102    /// * `subscriber` - Indicates the subscriber.
1103    ///
1104    /// # Returns
1105    ///
1106    /// * Returns the code, default is 0.
1107    ///
1108    /// Available since API-level: 18
1109    #[cfg(feature = "api-18")]
1110    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
1111    pub fn OH_CommonEvent_GetCodeFromSubscriber(subscriber: *const CommonEvent_Subscriber) -> i32;
1112    /// Set code to an ordered event by a subscriber.
1113    ///
1114    /// # Arguments
1115    ///
1116    /// * `subscriber` - Indicates the subscriber.
1117    ///
1118    /// * `code` - Indicates the code.
1119    ///
1120    /// # Returns
1121    ///
1122    /// * Returns the result of operation, true means succeeded.
1123    ///
1124    /// Available since API-level: 18
1125    #[cfg(feature = "api-18")]
1126    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
1127    pub fn OH_CommonEvent_SetCodeToSubscriber(
1128        subscriber: *mut CommonEvent_Subscriber,
1129        code: i32,
1130    ) -> bool;
1131    /// Get data from an ordered event by a subscriber.
1132    ///
1133    /// # Arguments
1134    ///
1135    /// * `subscriber` - Indicates the subscriber.
1136    ///
1137    /// # Returns
1138    ///
1139    /// * Returns the data, default is null.
1140    ///
1141    /// Available since API-level: 18
1142    #[cfg(feature = "api-18")]
1143    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
1144    pub fn OH_CommonEvent_GetDataFromSubscriber(
1145        subscriber: *const CommonEvent_Subscriber,
1146    ) -> *const ::core::ffi::c_char;
1147    /// Set data to an ordered event by a subscriber.
1148    ///
1149    /// # Arguments
1150    ///
1151    /// * `subscriber` - Indicates the subscriber.
1152    ///
1153    /// * `data` - Indicates the data.
1154    ///
1155    /// * `length` - Indicates the length of data.
1156    ///
1157    /// # Returns
1158    ///
1159    /// * Returns the result of operation, true means succeeded.
1160    ///
1161    /// Available since API-level: 18
1162    #[cfg(feature = "api-18")]
1163    #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
1164    pub fn OH_CommonEvent_SetDataToSubscriber(
1165        subscriber: *mut CommonEvent_Subscriber,
1166        data: *const ::core::ffi::c_char,
1167        length: usize,
1168    ) -> bool;
1169}