/* control-equipment.c - * * Copyright 2008 OpenMoko, Inc. * Authored by Chia-I Wu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include #include "diversity-control.h" #define IFACE_CHECK(eqp, iface) \ if (!DIVERSITY_IS_##iface(eqp)) { \ g_set_error(error, DIVERSITY_CONTROL_ERROR, 0, \ "equipment \"%s\" does not have " \ #iface " interface", \ diversity_equipment_get_name(eqp)); \ \ return FALSE; \ } static gboolean control_equipment_get_equipped(DiversityEquipment *eqp, gboolean *OUT_equipped, GError **error); static gboolean control_equipment_set_config(DiversityEquipment *eqp, const gchar *IN_key, const GValue *IN_val, GError **error); static gboolean control_equipment_get_config(DiversityEquipment *eqp, const gchar *IN_key, GValue *OUT_val, GError **error); #include "control-equipment-glue.h" static gboolean control_equipment_get_equipped(DiversityEquipment *eqp, gboolean *OUT_equipped, GError **error) { *OUT_equipped = (diversity_equipment_get_equipper(eqp) != NULL); return TRUE; } static gboolean control_equipment_set_config(DiversityEquipment *eqp, const gchar *IN_key, const GValue *IN_val, GError **error) { if (!diversity_equipment_set_config(eqp, IN_key, IN_val)) { g_set_error(error, DIVERSITY_CONTROL_ERROR, 0, "failed to set %s on %s\n", IN_key, diversity_equipment_get_name(eqp)); return FALSE; } return TRUE; } static gboolean control_equipment_get_config(DiversityEquipment *eqp, const gchar *IN_key, GValue *OUT_val, GError **error) { if (!diversity_equipment_get_config(eqp, IN_key, OUT_val)) { g_set_error(error, DIVERSITY_CONTROL_ERROR, 0, "failed to get %s on %s\n", IN_key, diversity_equipment_get_name(eqp)); return FALSE; } return TRUE; }