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>
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);
// ----------------------
typedef struct TimerHandleS {
- int magic;
int count;
int delay;
const char*uid;
typedef int (*timerCallbackT)(TimerHandleT *context);
-extern int TimerEvtInit (afb_api_t apiHandle);
-extern void TimerEvtStart(afb_api_t apiHandle, TimerHandleT *timerHandle, timerCallbackT callback, void *context);
+extern void TimerEvtStart(afb_api_t api, TimerHandleT *timerHandle, timerCallbackT callback, void *context);
extern void TimerEvtStop(TimerHandleT *timerHandle);
-extern uint64_t LockWait(afb_api_t apiHandle, uint64_t utimeout);
+extern uint64_t LockWait(afb_api_t api, uint64_t utimeout);
#ifdef __cplusplus
}
#endif
#include <curl/curl.h>
-extern char *curl_wrap_url (const char *base, const char *path,
- const char *const *query, size_t * size);
-
extern int curl_wrap_perform (CURL * curl, char **result, size_t * size);
extern void curl_wrap_do(CURL *curl, void (*callback)(void *closure, int status, CURL *curl, const char *result, size_t size), void *closure);
__attribute__((alias("GetBindingDirPath_v2")))
static char *GetBindingDirPath();
#else
-static char *GetBindingDirPath_v3(struct afb_api_x3* apiHandle)
+static char *GetBindingDirPath_v3(struct afb_api_x3* api)
{
- return GetBindingDirPath_(afb_api_x3_rootdir_get_fd(apiHandle));
+ return GetBindingDirPath_(afb_api_x3_rootdir_get_fd(api));
}
__attribute__((alias("GetBindingDirPath_v3")))
-static char *GetBindingDirPath(struct afb_api_x3* apiHandle);
+static char *GetBindingDirPath(struct afb_api_x3* api);
#endif
/**
* \param api Api to call.
* \param verb Verb to call.
* \param arg Argument to pass.
+ * \param closure callback to call at the verb reply
*/
void QAfbWebsocketClient::call(const QString& api, const QString& verb, const QJsonValue& arg, closure_t closure)
{