#include "src/log.h"
#include "src/sdpd.h"
#include "src/shared/queue.h"
+#include "src/shared/timeout.h"
#include "src/shared/util.h"
#include "btio/btio.h"
struct avdtp_local_sep *lsep;
struct avdtp *session;
struct avdtp_stream *stream;
- guint suspend_timer;
+ unsigned int suspend_timer;
#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
gboolean remote_suspended;
#endif
#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
if (new_state == AVDTP_STATE_STREAMING && sep->suspend_timer) {
- g_source_remove(sep->suspend_timer);
+ timeout_remove(sep->suspend_timer);
sep->suspend_timer = 0;
}
#endif
return;
if (sep->suspend_timer) {
- g_source_remove(sep->suspend_timer);
+ timeout_remove(sep->suspend_timer);
sep->suspend_timer = 0;
}
return;
}
-static gboolean suspend_timeout(struct a2dp_sep *sep)
+static bool suspend_timeout(struct a2dp_sep *sep)
{
if (avdtp_suspend(sep->session, sep->stream) == 0)
sep->suspending = TRUE;
if (!a2dp_sep->locked) {
if (a2dp_sep->remote_suspended == FALSE) {
a2dp_sep->session = avdtp_ref(session);
- a2dp_sep->suspend_timer = g_timeout_add_seconds(SUSPEND_TIMEOUT,
- (GSourceFunc) suspend_timeout,
- a2dp_sep);
+ a2dp_sep->suspend_timer = timeout_add_seconds(SUSPEND_TIMEOUT,
+ (timeout_func_t) suspend_timeout,
+ a2dp_sep, NULL);
} else
a2dp_sep->remote_suspended = FALSE;
}
if (!a2dp_sep->locked) {
a2dp_sep->session = avdtp_ref(session);
- a2dp_sep->suspend_timer = g_timeout_add_seconds(SUSPEND_TIMEOUT,
- (GSourceFunc) suspend_timeout,
- a2dp_sep);
+ a2dp_sep->suspend_timer = timeout_add_seconds(SUSPEND_TIMEOUT,
+ (timeout_func_t) suspend_timeout,
+ a2dp_sep, NULL);
}
#endif
#endif
if (a2dp_sep->suspend_timer) {
- g_source_remove(a2dp_sep->suspend_timer);
+ timeout_remove(a2dp_sep->suspend_timer);
a2dp_sep->suspend_timer = 0;
avdtp_unref(a2dp_sep->session);
a2dp_sep->session = NULL;
break;
case AVDTP_STATE_STREAMING:
if (!sep->suspending && sep->suspend_timer) {
- g_source_remove(sep->suspend_timer);
+ timeout_remove(sep->suspend_timer);
sep->suspend_timer = 0;
avdtp_unref(sep->session);
sep->session = NULL;
#include "src/log.h"
#include "src/error.h"
#include "src/uinput.h"
+#include "src/shared/timeout.h"
#include "avctp.h"
#include "avrcp.h"
struct avctp_pending_req {
struct avctp_queue *queue;
uint8_t transaction;
- guint timeout;
+ unsigned int timeout;
bool retry;
int err;
avctp_process_cb process;
struct key_pressed {
uint16_t op;
- guint timer;
+ unsigned int timer;
#ifndef TIZEN_FEATURE_BLUEZ_MODIFY
bool hold;
#endif
send_event(fd, EV_SYN, SYN_REPORT, 0);
}
-static gboolean auto_release(gpointer user_data)
+static bool auto_release(gpointer user_data)
{
struct avctp *session = user_data;
#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
send_key(session->uinput, op, 1);
done:
- session->key.timer = g_timeout_add_seconds(AVC_PRESS_TIMEOUT,
- auto_release, session);
+ session->key.timer = timeout_add_seconds(AVC_PRESS_TIMEOUT,
+ auto_release, session, NULL);
}
static void handle_release(struct avctp *session, uint16_t op)
{
if (session->key.timer > 0) {
- g_source_remove(session->key.timer);
+ timeout_remove(session->key.timer);
session->key.timer = 0;
}
req->destroy(req->data);
if (req->timeout > 0)
- g_source_remove(req->timeout);
+ timeout_remove(req->timeout);
g_free(req);
}
}
if (session->key.timer > 0)
- g_source_remove(session->key.timer);
+ timeout_remove(session->key.timer);
if (session->uinput >= 0) {
char address[18];
g_free(req);
}
-static gboolean req_timeout(gpointer user_data)
+static bool req_timeout(gpointer user_data)
{
struct avctp_queue *queue = user_data;
struct avctp_pending_req *p = queue->p;
if (ret < 0)
return ret;
- p->timeout = g_timeout_add_seconds(AVC_PRESS_TIMEOUT, req_timeout,
- p->queue);
+ p->timeout = timeout_add_seconds(AVC_PRESS_TIMEOUT, req_timeout,
+ p->queue, NULL);
return 0;
}
p->retry = !p->retry;
- p->timeout = g_timeout_add_seconds(CONTROL_TIMEOUT, req_timeout,
- p->queue);
+ p->timeout = timeout_add_seconds(CONTROL_TIMEOUT, req_timeout,
+ p->queue, NULL);
return 0;
}
if (ret < 0)
return ret;
- p->timeout = g_timeout_add_seconds(BROWSING_TIMEOUT, req_timeout,
- p->queue);
+ p->timeout = timeout_add_seconds(BROWSING_TIMEOUT, req_timeout,
+ p->queue, NULL);
return 0;
}
control->processed = g_slist_prepend(control->processed, p);
if (p->timeout > 0) {
- g_source_remove(p->timeout);
+ timeout_remove(p->timeout);
p->timeout = 0;
}
browsing->processed = g_slist_prepend(browsing->processed, p);
if (p->timeout > 0) {
- g_source_remove(p->timeout);
+ timeout_remove(p->timeout);
p->timeout = 0;
}
NULL, NULL);
}
-static gboolean repeat_timeout(gpointer user_data)
+static bool repeat_timeout(gpointer user_data)
{
struct avctp *session = user_data;
int ret = avctp_passthrough_release(session, session->key.op);
#endif
if (session->key.timer > 0)
- g_source_remove(session->key.timer);
+ timeout_remove(session->key.timer);
session->key.timer = 0;
#ifndef TIZEN_FEATURE_BLUEZ_MODIFY
#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
session->key.op = op;
- session->key.timer = g_timeout_add_seconds(AVC_PRESS_TIMEOUT,
+ session->key.timer = timeout_add_seconds(AVC_PRESS_TIMEOUT,
#else
if (session->key.timer == 0)
- session->key.timer = g_timeout_add_seconds(AVC_HOLD_TIMEOUT,
+ session->key.timer = timeout_add_seconds(AVC_HOLD_TIMEOUT,
#endif
repeat_timeout,
- session);
+ session, NULL);
return TRUE;
}
#include "btio/btio.h"
#include "src/btd.h"
#include "src/log.h"
+#include "src/shared/timeout.h"
#include "src/shared/util.h"
#include "src/shared/queue.h"
#include "src/adapter.h"
void *data;
size_t data_size;
struct avdtp_stream *stream; /* Set if the request targeted a stream */
- guint timeout;
+ unsigned int timeout;
gboolean collided;
};
GSList *callbacks;
struct avdtp_service_capability *codec;
guint io_id; /* Transport GSource ID */
- guint timer; /* Waiting for other side to close or open
+ unsigned int timer; /* Waiting for other side to close or open
* the transport channel */
gboolean open_acp; /* If we are in ACT role for Open */
gboolean close_int; /* If we are in INT role for Close */
gboolean abort_int; /* If we are in INT role for Abort */
- guint start_timer; /* Wait START command timer */
+ unsigned int start_timer; /* Wait START command timer */
gboolean delay_reporting;
uint16_t delay; /* AVDTP 1.3 Delay Reporting feature */
gboolean starting; /* only valid while sep state == OPEN */
struct discover_callback *discover;
struct pending_req *req;
- guint dc_timer;
+ unsigned int dc_timer;
int dc_timeout;
/* Attempt stream setup instead of disconnecting */
struct pending_req *req = data;
if (req->timeout)
- g_source_remove(req->timeout);
+ timeout_remove(req->timeout);
g_free(req->data);
g_free(req);
}
stream->io = NULL;
}
-static gboolean stream_close_timeout(gpointer user_data)
+static bool stream_close_timeout(gpointer user_data)
{
struct avdtp_stream *stream = user_data;
return FALSE;
}
-static gboolean stream_open_timeout(gpointer user_data)
+static bool stream_open_timeout(gpointer user_data)
{
struct avdtp_stream *stream = user_data;
}
static void stream_set_timer(struct avdtp_stream *stream, guint timeout,
- GSourceFunc func)
+ timeout_func_t func)
{
if (stream->timer)
- g_source_remove(stream->timer);
+ timeout_remove(stream->timer);
- stream->timer = g_timeout_add_seconds(timeout, func, stream);
+ stream->timer = timeout_add_seconds(timeout, func, stream, NULL);
}
static void stream_set_pending_open(struct avdtp_stream *stream, GIOChannel *io)
rsep->stream = NULL;
if (stream->timer)
- g_source_remove(stream->timer);
+ timeout_remove(stream->timer);
if (stream->io)
close_stream(stream);
session->pending_open = NULL;
if (stream->timer) {
- g_source_remove(stream->timer);
+ timeout_remove(stream->timer);
stream->timer = 0;
}
break;
case AVDTP_STATE_STREAMING:
if (stream->start_timer) {
- g_source_remove(stream->start_timer);
+ timeout_remove(stream->start_timer);
stream->start_timer = 0;
}
case AVDTP_STATE_CLOSING:
case AVDTP_STATE_ABORTING:
if (stream->start_timer) {
- g_source_remove(stream->start_timer);
+ timeout_remove(stream->start_timer);
stream->start_timer = 0;
}
break;
case AVDTP_STATE_IDLE:
if (stream->start_timer) {
- g_source_remove(stream->start_timer);
+ timeout_remove(stream->start_timer);
stream->start_timer = 0;
}
if (session->pending_open == stream)
if (!session->dc_timer)
return;
- g_source_remove(session->dc_timer);
+ timeout_remove(session->dc_timer);
session->dc_timer = 0;
session->stream_setup = FALSE;
}
#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
-static gboolean disconnect_acl_timeout(gpointer user_data)
+static bool disconnect_acl_timeout(gpointer user_data)
{
struct btd_device *device = user_data;
}
#endif
-static gboolean disconnect_timeout(gpointer user_data)
+static bool disconnect_timeout(gpointer user_data)
{
struct avdtp *session = user_data;
struct btd_service *service;
#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
if (device)
- g_timeout_add(100,
+ timeout_add(100,
disconnect_acl_timeout,
- device);
+ device, NULL);
#endif
return FALSE;
DBG("name : [%s]", name);
if (g_str_equal(name, "VW BT") || g_str_equal(name, "VW MI") ||
g_str_equal(name, "Seat ") || g_str_equal(name, "Galax")) {
- session->dc_timer = g_timeout_add_seconds(3, disconnect_timeout,
- session);
+ session->dc_timer = timeout_add_seconds(3, disconnect_timeout,
+ session, NULL);
} else if (g_str_equal(name, "CAR M")) {
- session->dc_timer = g_timeout_add(200, disconnect_timeout,
- session);
+ session->dc_timer = timeout_add(200, disconnect_timeout,
+ session, NULL);
} else {
if (disconn == TRUE)
- session->dc_timer = g_timeout_add(100,
+ session->dc_timer = timeout_add(100,
disconnect_timeout,
- session);
+ session, NULL);
else
- session->dc_timer = g_timeout_add_seconds(DISCONNECT_TIMEOUT,
+ session->dc_timer = timeout_add_seconds(DISCONNECT_TIMEOUT,
disconnect_timeout,
- session);
+ session, NULL);
}
}
#endif
DBG("name : [%s]", name);
if (g_str_equal(name, "VW BT") || g_str_equal(name, "VW MI") ||
g_str_equal(name, "Seat ") || g_str_equal(name, "Galax")) {
- session->dc_timer = g_timeout_add_seconds(3, disconnect_timeout,
- session);
+ session->dc_timer = timeout_add_seconds(3, disconnect_timeout,
+ session, NULL);
} else if (g_str_equal(name, "CAR M")) {
- session->dc_timer = g_timeout_add(200, disconnect_timeout,
- session);
+ session->dc_timer = timeout_add(200, disconnect_timeout,
+ session, NULL);
} else {
- session->dc_timer = g_timeout_add_seconds(DISCONNECT_TIMEOUT,
+ session->dc_timer = timeout_add_seconds(DISCONNECT_TIMEOUT,
disconnect_timeout,
- session);
+ session, NULL);
}
#else
DBG("timeout %d", session->dc_timeout);
- if (!session->dc_timeout)
- session->dc_timer = g_idle_add(disconnect_timeout, session);
- else
- session->dc_timer = g_timeout_add_seconds(session->dc_timeout,
- disconnect_timeout,
- session);
+ session->dc_timer = timeout_add_seconds(session->dc_timeout,
+ disconnect_timeout,
+ session, NULL);
#endif
}
AVDTP_CLOSE, NULL, 0))
return FALSE;
- stream->timer = g_timeout_add_seconds(REQ_TIMEOUT,
+ stream->timer = timeout_add_seconds(REQ_TIMEOUT,
stream_close_timeout,
- stream);
+ stream, NULL);
return TRUE;
return TRUE;
}
- g_source_remove(session->req->timeout);
+ timeout_remove(session->req->timeout);
session->req->timeout = 0;
switch (header->message_type) {
return err;
}
-static gboolean request_timeout(gpointer user_data)
+static bool request_timeout(gpointer user_data)
{
struct avdtp *session = user_data;
timeout = REQ_TIMEOUT;
}
- req->timeout = g_timeout_add_seconds(timeout, request_timeout, session);
+ req->timeout = timeout_add_seconds(timeout, request_timeout,
+ session, NULL);
return 0;
failed:
&req, sizeof(req));
}
-static gboolean start_timeout(gpointer user_data)
+static bool start_timeout(gpointer user_data)
{
struct avdtp_stream *stream = user_data;
struct avdtp *session = stream->session;
return 0;
}
- stream->start_timer = g_timeout_add_seconds(timeout_sec,
+ stream->start_timer = timeout_add_seconds(timeout_sec,
start_timeout,
- stream);
+ stream, NULL);
return 0;
}
#else
- stream->start_timer = g_timeout_add_seconds(START_TIMEOUT,
+ stream->start_timer = timeout_add_seconds(START_TIMEOUT,
start_timeout,
- stream);
+ stream, NULL);
return 0;
#endif
}
#include "src/error.h"
#include "src/sdpd.h"
#include "src/dbus-common.h"
+#include "src/shared/timeout.h"
#include "src/shared/util.h"
#include "avctp.h"
pos_timer_id = 0;
}
}
-gboolean send_playback_position_event(gpointer user_data)
+bool send_playback_position_event(gpointer user_data)
{
struct avrcp_player *player = user_data;
uint32_t playback_position;
DBG("Play Pos Changed Event is skipped(%d)", play_status);
} else {
DBG("Playback interval : %d secs", playback_interval);
- pos_timer_id = g_timeout_add_seconds(
+ pos_timer_id = timeout_add_seconds(
playback_interval,
- send_playback_position_event, player);
+ send_playback_position_event, player, NULL);
}
/* retrieve current playback position for interim response */
}
}
-static gboolean avrcp_get_playback_status(gpointer user_data)
+static bool avrcp_get_playback_status(gpointer user_data)
{
struct avrcp *session = user_data;
/* Connect browsing if pending */
if (session->browsing_timer > 0) {
- g_source_remove(session->browsing_timer);
+ timeout_remove(session->browsing_timer);
session->browsing_timer = 0;
avctp_connect_browsing(session->conn);
}
#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
if ((events & (1 << AVRCP_EVENT_STATUS_CHANGED)) == 0) {
- session->playback_status_id = g_timeout_add_seconds(1,
- avrcp_get_playback_status, session);
+ session->playback_status_id = timeout_add_seconds(1,
+ avrcp_get_playback_status, session, NULL);
}
#endif
return FALSE;
static void session_init_browsing(struct avrcp *session)
{
if (session->browsing_timer > 0) {
- g_source_remove(session->browsing_timer);
+ timeout_remove(session->browsing_timer);
session->browsing_timer = 0;
}
return data;
}
-static gboolean connect_browsing(gpointer user_data)
+static bool connect_browsing(gpointer user_data)
{
struct avrcp *session = user_data;
if (session->browsing_timer > 0)
return;
- session->browsing_timer = g_timeout_add_seconds(AVRCP_BROWSING_TIMEOUT,
+ session->browsing_timer = timeout_add_seconds(AVRCP_BROWSING_TIMEOUT,
connect_browsing,
- session);
+ session, NULL);
}
#ifdef TIZEN_FEATURE_BLUEZ_AVRCP_TARGET
#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
if (session->playback_status_id > 0) {
DBG("Removing the timer for playback status polling");
- g_source_remove(session->playback_status_id);
+ timeout_remove(session->playback_status_id);
session->playback_status_id = 0;
}
#endif
}
if (session->browsing_timer > 0)
- g_source_remove(session->browsing_timer);
+ timeout_remove(session->browsing_timer);
if (session->controller != NULL)
controller_destroy(session);
#include "src/adapter.h"
#include "src/device.h"
#include "src/sdpd.h"
+#include "src/shared/timeout.h"
#include "btio/btio.h"
#include "hdp_types.h"
struct hdp_echo_data {
gboolean echo_done; /* Is a echo was already done */
gpointer buf; /* echo packet sent */
- guint tid; /* echo timeout */
+ unsigned int tid; /* echo timeout */
};
static struct hdp_channel *hdp_channel_ref(struct hdp_channel *chan)
return;
if (edata->tid > 0)
- g_source_remove(edata->tid);
+ timeout_remove(edata->tid);
if (edata->buf != NULL)
g_free(edata->buf);
reply = g_dbus_create_reply(hdp_conn->msg, DBUS_TYPE_BOOLEAN, &value,
DBUS_TYPE_INVALID);
g_dbus_send_message(btd_get_dbus_connection(), reply);
- g_source_remove(edata->tid);
+ timeout_remove(edata->tid);
edata->tid = 0;
g_free(edata->buf);
edata->buf = NULL;
return FALSE;
}
-static gboolean echo_timeout(gpointer data)
+static bool echo_timeout(gpointer data)
{
struct hdp_channel *chan = data;
GIOChannel *io;
g_io_add_watch(io, G_IO_ERR | G_IO_HUP | G_IO_NVAL | G_IO_IN,
check_echo, hdp_tmp_dc_data_ref(hdp_conn));
- edata->tid = g_timeout_add_seconds_full(G_PRIORITY_DEFAULT,
- ECHO_TIMEOUT, echo_timeout,
- hdp_channel_ref(hdp_conn->hdp_chann),
- (GDestroyNotify) hdp_channel_unref);
+ edata->tid = timeout_add_seconds(ECHO_TIMEOUT, echo_timeout,
+ hdp_channel_ref(hdp_conn->hdp_chann),
+ (timeout_destroy_func_t) hdp_channel_unref);
g_io_channel_unref(io);
}
#include "bluetooth/l2cap.h"
#include "btio/btio.h"
#include "src/log.h"
+#include "src/shared/timeout.h"
#include "mcap.h"
#define RELEASE_TIMER(__mcl) do { \
if (__mcl->tid) { \
- g_source_remove(__mcl->tid); \
+ timeout_remove(__mcl->tid); \
__mcl->tid = 0; \
} \
} while(0)
return 1;
}
-static gboolean wait_response_timer(gpointer data)
+static bool wait_response_timer(gpointer data)
{
struct mcap_mcl *mcl = data;
mcl->mdls = g_slist_insert_sorted(mcl->mdls, mcap_mdl_ref(mdl),
compare_mdl);
- mcl->tid = g_timeout_add_seconds(RESPONSE_TIMER, wait_response_timer,
- mcl);
+ mcl->tid = timeout_add_seconds(RESPONSE_TIMER, wait_response_timer,
+ mcl, NULL);
return TRUE;
}
mcl->state = MCL_ACTIVE;
mcl->priv_data = con;
- mcl->tid = g_timeout_add_seconds(RESPONSE_TIMER, wait_response_timer,
- mcl);
+ mcl->tid = timeout_add_seconds(RESPONSE_TIMER, wait_response_timer,
+ mcl, NULL);
return TRUE;
}
mcl->priv_data = con;
- mcl->tid = g_timeout_add_seconds(RESPONSE_TIMER, wait_response_timer,
- mcl);
+ mcl->tid = timeout_add_seconds(RESPONSE_TIMER, wait_response_timer,
+ mcl, NULL);
return TRUE;
}
con->user_data = user_data;
mcl->priv_data = con;
- mcl->tid = g_timeout_add_seconds(RESPONSE_TIMER, wait_response_timer,
- mcl);
+ mcl->tid = timeout_add_seconds(RESPONSE_TIMER, wait_response_timer,
+ mcl, NULL);
return TRUE;
}
#include "src/dbus-common.h"
#include "src/error.h"
#include "src/sdp-client.h"
+#include "src/shared/timeout.h"
#include "src/shared/uhid.h"
#include "device.h"
struct hidp_connadd_req *req;
bool disable_sdp;
enum reconnect_mode_t reconnect_mode;
- guint reconnect_timer;
+ unsigned int reconnect_timer;
uint32_t reconnect_attempt;
struct bt_uhid *uhid;
bool uhid_created;
uint8_t report_req_pending;
- guint report_req_timer;
+ unsigned int report_req_timer;
uint32_t report_rsp_id;
bool virtual_cable_unplug;
#ifdef TIZEN_BT_HID_DEVICE_ENABLE
}
if (idev->reconnect_timer > 0)
- g_source_remove(idev->reconnect_timer);
+ timeout_remove(idev->reconnect_timer);
if (idev->report_req_timer > 0)
- g_source_remove(idev->report_req_timer);
+ timeout_remove(idev->report_req_timer);
g_free(idev);
}
if (pending_req_complete) {
idev->report_req_pending = 0;
if (idev->report_req_timer > 0) {
- g_source_remove(idev->report_req_timer);
+ timeout_remove(idev->report_req_timer);
idev->report_req_timer = 0;
}
idev->report_rsp_id = 0;
idev->report_req_pending = 0;
if (idev->report_req_timer > 0) {
- g_source_remove(idev->report_req_timer);
+ timeout_remove(idev->report_req_timer);
idev->report_req_timer = 0;
}
idev->report_rsp_id = 0;
#define REPORT_REQ_TIMEOUT 3
-static gboolean hidp_report_req_timeout(gpointer data)
+static bool hidp_report_req_timeout(gpointer data)
{
struct input_device *idev = data;
uint8_t pending_req_type;
if (sent) {
idev->report_req_pending = hdr;
idev->report_req_timer =
- g_timeout_add_seconds(REPORT_REQ_TIMEOUT,
- hidp_report_req_timeout, idev);
+ timeout_add_seconds(REPORT_REQ_TIMEOUT,
+ hidp_report_req_timeout, idev, NULL);
idev->report_rsp_id = ev->u.set_report.id;
} else
uhid_send_set_report_reply(idev, ev->u.set_report.id, EIO);
if (sent) {
idev->report_req_pending = hdr;
idev->report_req_timer =
- g_timeout_add_seconds(REPORT_REQ_TIMEOUT,
- hidp_report_req_timeout, idev);
+ timeout_add_seconds(REPORT_REQ_TIMEOUT,
+ hidp_report_req_timeout, idev, NULL);
idev->report_rsp_id = ev->u.get_report.id;
} else
uhid_send_get_report_reply(idev, NULL, 0, ev->u.get_report.id,
return -EIO;
}
-static gboolean input_device_auto_reconnect(gpointer user_data)
+static bool input_device_auto_reconnect(gpointer user_data)
{
struct input_device *idev = user_data;
return;
if (idev->reconnect_timer > 0)
- g_source_remove(idev->reconnect_timer);
+ timeout_remove(idev->reconnect_timer);
DBG("registering auto-reconnect");
idev->reconnect_attempt = 0;
- idev->reconnect_timer = g_timeout_add_seconds(30,
- input_device_auto_reconnect, idev);
+ idev->reconnect_timer = timeout_add_seconds(30,
+ input_device_auto_reconnect, idev, NULL);
}
#include "lib/uuid.h"
#include "src/log.h"
+#include "src/shared/timeout.h"
#include "src/shared/util.h"
#include "btio/btio.h"
bdaddr_t dst_addr;
char iface[16];
guint attempts;
- guint setup_to;
+ unsigned int setup_to;
guint watch;
bnep_connect_cb conn_cb;
void *conn_data;
return FALSE;
if (session->setup_to > 0) {
- g_source_remove(session->setup_to);
+ timeout_remove(session->setup_to);
session->setup_to = 0;
}
return 0;
}
-static gboolean bnep_conn_req_to(gpointer user_data)
+static bool bnep_conn_req_to(gpointer user_data)
{
struct bnep *session = user_data;
if (err < 0)
return err;
- session->setup_to = g_timeout_add_seconds(CON_SETUP_TO,
- bnep_conn_req_to, session);
+ session->setup_to = timeout_add_seconds(CON_SETUP_TO,
+ bnep_conn_req_to, session, NULL);
return 0;
}
#include "src/log.h"
#include "src/error.h"
#include "src/dbus-common.h"
+#include "src/shared/timeout.h"
#include "src/shared/util.h"
#include "sap.h"
GIOChannel *io;
uint32_t state;
uint8_t processing_req;
- guint timer_id;
+ unsigned int timer_id;
};
struct sap_server {
static void start_guard_timer(struct sap_server *server, guint interval);
static void stop_guard_timer(struct sap_server *server);
-static gboolean guard_timeout(gpointer data);
+static bool guard_timeout(gpointer data);
static size_t add_result_parameter(uint8_t result,
struct sap_parameter *param)
return;
if (!conn->timer_id)
- conn->timer_id = g_timeout_add_seconds(interval, guard_timeout,
- server);
+ conn->timer_id = timeout_add_seconds(interval, guard_timeout,
+ server, NULL);
else
error("Timer is already active.");
}
struct sap_connection *conn = server->conn;
if (conn && conn->timer_id) {
- g_source_remove(conn->timer_id);
+ timeout_remove(conn->timer_id);
conn->timer_id = 0;
}
}
-static gboolean guard_timeout(gpointer data)
+static bool guard_timeout(gpointer data)
{
struct sap_server *server = data;
struct sap_connection *conn = server->conn;