summaryrefslogtreecommitdiffstats
path: root/afb-timer.c
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2019-01-04 14:24:11 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2019-01-04 14:37:24 +0100
commitaba89b590ef0d1743dd0aa82a8b8ed1bf8809909 (patch)
treec29aa2571f0d315ccf14616828ac2fb39275f6ae /afb-timer.c
parenta1976ff1b2bccc8689182505828f7e3814d0d21b (diff)
Little code cleaning.
Rename apiHandle to api. Add a missing parameter to QAfbWebsocketClient::call function comment. Change-Id: I6fb1acd7357fbea3132cd429e9477a1a0b8a4f43 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'afb-timer.c')
-rw-r--r--afb-timer.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/afb-timer.c b/afb-timer.c
index 30ab80d..b302278 100644
--- a/afb-timer.c
+++ b/afb-timer.c
@@ -66,32 +66,23 @@ void TimerEvtStop(TimerHandleT *timerHandle) {
free (timerHandle);
}
-
-void TimerEvtStart(afb_api_t apiHandle, TimerHandleT *timerHandle, timerCallbackT callback, void *context) {
+void TimerEvtStart(afb_api_t api, TimerHandleT *timerHandle, timerCallbackT callback, void *context) {
uint64_t usec;
// populate CB handle
timerHandle->callback=callback;
timerHandle->context=context;
- timerHandle->api=apiHandle;
+ timerHandle->api=api;
// set a timer with ~250us accuracy
- sd_event_now(afb_api_get_event_loop(apiHandle), CLOCK_MONOTONIC, &usec);
- sd_event_add_time(afb_api_get_event_loop(apiHandle), &timerHandle->evtSource, CLOCK_MONOTONIC, usec+timerHandle->delay*1000, 250, TimerNext, timerHandle);
-}
-
-
-// Create Binding Event at Init
-int TimerEvtInit (afb_api_t apiHandle) {
-
- AFB_API_DEBUG (apiHandle, "Timer-Init Done");
- return 0;
+ sd_event_now(afb_api_get_event_loop(api), CLOCK_MONOTONIC, &usec);
+ sd_event_add_time(afb_api_get_event_loop(api), &timerHandle->evtSource, CLOCK_MONOTONIC, usec+timerHandle->delay*1000, 250, TimerNext, timerHandle);
}
-uint64_t LockWait(afb_api_t apiHandle, uint64_t utimeout) {
+uint64_t LockWait(afb_api_t api, uint64_t utimeout) {
uint64_t current_usec, pre_usec;
- struct sd_event *event = afb_api_get_event_loop(apiHandle);
+ struct sd_event *event = afb_api_get_event_loop(api);
sd_event_now(event, CLOCK_MONOTONIC, &pre_usec);
sd_event_run(event, utimeout);