Exemplo n.º 1
0
static int
vehicle_demo_set_attr_do(struct vehicle_priv *priv, struct attr *attr)
{
	switch(attr->type) {
	case attr_navit:
		priv->navit = attr->u.navit;
		break;
	case attr_route:
		priv->route = attr->u.route;
		break;
	case attr_speed:
		priv->config_speed=attr->u.num;
		break;
	case attr_interval:
		priv->interval=attr->u.num;
		if (priv->timer)
			event_remove_timeout(priv->timer);
		priv->timer=event_add_timeout(priv->interval, 1, priv->timer_callback);
		break;
	case attr_position_coord_geo:
		priv->geo=*(attr->u.coord_geo);
		priv->position_set=1;
		dbg(1,"position_set %f %f\n", priv->geo.lat, priv->geo.lng);
		break;
	case attr_profilename:
	case attr_source:
	case attr_name:
		// Ignore; used by Navit's infrastructure, but not relevant for this vehicle.
		break;
	default:
		dbg(0,"unsupported attribute %s\n",attr_to_name(attr->type));
		return 0;
	}
	return 1;
}
Exemplo n.º 2
0
static void
vehicle_demo_destroy(struct vehicle_priv *priv)
{
	if (priv->timer)
		event_remove_timeout(priv->timer);
	callback_destroy(priv->timer_callback);
	g_free(priv->timep);
	g_free(priv);
}
Exemplo n.º 3
0
void
log_destroy(struct log *this_)
{
	callback_destroy(this_->timer_callback);
	event_remove_timeout(this_->timer);
	log_flush(this_);
	log_close(this_);
	g_free(this_);
}
Exemplo n.º 4
0
Arquivo: log.c Projeto: Jalakas/navit
void
log_destroy(struct log *this_)
{
	dbg(0,"enter\n");
	attr_list_free(this_->attrs);
	callback_destroy(this_->timer_callback);
	event_remove_timeout(this_->timer);
	log_flush(this_,0);
	log_close(this_);
	g_free(this_);
}
Exemplo n.º 5
0
static void
script_destroy(struct script *scr)
{
    dbg(lvl_debug,"enter %p\n",scr);
    if (scr->timeout)
        event_remove_timeout(scr->timeout);
    if (scr->cs)
        command_saved_destroy(scr->cs);
    callback_destroy(scr->cb);
    attr_list_free(scr->attrs);
    g_free(scr);
}
Exemplo n.º 6
0
/** @fn static void vehicle_file_disable_watch(struct vehicle_priv *priv)
*****************************************************************************
* @b Description: Disable watch
*****************************************************************************
* @param      priv : pointer on the private data of the plugin
*****************************************************************************
**/
static void
vehicle_file_disable_watch(struct vehicle_priv *priv)
{
	dbg(1, "vehicle_file_disable_watch : enter\n");
#ifdef _WIN32
    if (priv->timeout) {
		event_remove_timeout(priv->timeout);
		priv->timeout=NULL;		// dangling pointer! prevent double freeing.
    }
#else
	if (priv->watch)
		event_remove_watch(priv->watch);
	priv->watch = NULL;
#endif
}
Exemplo n.º 7
0
void
vehicle_webos_close(struct vehicle_priv *priv)
{
	event_remove_timeout(priv->ev_timeout);
	priv->ev_timeout = NULL;

	callback_destroy(priv->timeout_cb);

	if (priv->pdk_version <= 100)
		PDL_UnregisterServiceCallback((PDL_ServiceCallbackFunc)vehicle_webos_callback);
	else {
		PDL_EnableLocationTracking(PDL_FALSE);
		vehicle_webos_bt_close(priv);
	}
}
Exemplo n.º 8
0
static int
script_set_attr_int(struct script *scr, struct attr *attr)
{
    switch (attr->type) {
    case attr_refresh_cond:
        dbg(lvl_debug,"refresh_cond\n");
        if (scr->cs)
            command_saved_destroy(scr->cs);
        scr->cs=command_saved_attr_new(attr->u.str, &scr->parent, scr->cb, 0);
        return 1;
    case attr_update_period:
        if (scr->timeout)
            event_remove_timeout(scr->timeout);
        scr->timeout=event_add_timeout(attr->u.num, 1, scr->cb);
        return 1;
    default:
        return 0;
    }
}
Exemplo n.º 9
0
static void event_sdl_main_loop_run(void) {
#ifdef USE_WEBOS_ACCELEROMETER
	struct callback* accel_cb = NULL;
	struct event_timeout* accel_to = NULL;
	if (PDL_GetPDKVersion() > 100) {
		accel_cb = callback_new_1(callback_cast(sdl_accelerometer_handler), gr);
		accel_to = event_add_timeout(200, 1, accel_cb);
	}
#endif
	graphics_sdl_idle(NULL);

	event_sdl_watch_stopthread();

#ifdef USE_WEBOS_ACCELEROMETER
	SDL_JoystickClose(accelerometer);
	if (PDL_GetPDKVersion() > 100) {
		event_remove_timeout(accel_to);
		callback_destroy(accel_cb);
	}
#endif
}