1 /*
2  * Copyright (C) 2022 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  #![allow(missing_docs)]
17 
18 use std::ffi::{c_char, c_void};
19 
20 type XCollieCallbackRust = extern "C" fn(arg: *mut c_void);
21 
22 extern "C" {
23 #[allow(unused)]
SetTimerRust( data: *const c_char, timeout: u32, func: XCollieCallbackRust, arg: *mut c_void, flag: u32, ) -> i3224     pub fn SetTimerRust(
25         data: *const c_char,
26         timeout: u32,
27         func: XCollieCallbackRust,
28         arg: *mut c_void,
29         flag: u32,
30     ) -> i32;
31 
32 #[allow(unused)]
CancelTimerRust(id: i32)33     fn CancelTimerRust(id: i32);
34 }
35 
36 /**
37 * # Safety
38 */
39 #[allow(unused)]
set_timer( data: *const c_char, timeout: u32, func: XCollieCallbackRust, arg: *mut c_void, flag: u32, ) -> i3240 pub unsafe fn set_timer(
41     data: *const c_char,
42     timeout: u32,
43     func: XCollieCallbackRust,
44     arg: *mut c_void,
45     flag: u32,
46 ) -> i32 {
47     unsafe { SetTimerRust(data, timeout, func, arg, flag) }
48 }
49 
50 #[allow(unused)]
cancel_timer(id: i32)51 pub fn cancel_timer(id: i32) {
52     unsafe { CancelTimerRust(id) };
53 }
54