1 /* Copyright 2015-present Samsung Electronics Co., Ltd. and other contributors
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
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #ifndef IOTJS_MODULE_TIMER_H
17 #define IOTJS_MODULE_TIMER_H
20 #include "iotjs_binding.h"
21 #include "iotjs_handlewrap.h"
25 iotjs_handlewrap_t handlewrap;
27 } IOTJS_VALIDATED_STRUCT(iotjs_timerwrap_t);
30 iotjs_timerwrap_t* iotjs_timerwrap_create(const iotjs_jval_t* jtimer);
32 iotjs_timerwrap_t* iotjs_timerwrap_from_jobject(const iotjs_jval_t* jtimer);
33 iotjs_timerwrap_t* iotjs_timerwrap_from_handle(uv_timer_t* timer_handle);
35 uv_timer_t* iotjs_timerwrap_handle(iotjs_timerwrap_t* timerwrap);
36 iotjs_jval_t* iotjs_timerwrap_jobject(iotjs_timerwrap_t* timerwrap);
39 int iotjs_timerwrap_start(iotjs_timerwrap_t* timerwrap, int64_t timeout,
41 // Stop & close timer.
42 int iotjs_timerwrap_stop(iotjs_timerwrap_t* timerwrap);
45 #endif /* IOTJS_MODULE_TIMER_H */