Desktop

/* $Id: gsm.h,v 1.70.2.15 2011/01/23 17:39:50 khorben Exp $ */
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Phone */
/* 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, version 3 of the License.
*
* 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, see <http://www.gnu.org/licenses/>. */
#ifndef PHONE_GSM_H
# define PHONE_GSM_H
# include <glib.h>
# include "modem.h"
/* GSM */
/* types */
typedef struct _GSM GSM;
typedef enum _GSMEncoding
{
GSM_ENCODING_UTF8 = 0,
GSM_ENCODING_RAW_DATA
} GSMEncoding;
typedef enum _GSMMessageList
{
GSM_MESSAGE_LIST_UNREAD = 0,
GSM_MESSAGE_LIST_READ = 1,
GSM_MESSAGE_LIST_UNSENT = 2,
GSM_MESSAGE_LIST_SENT = 3,
GSM_MESSAGE_LIST_ALL = 4
} GSMMessageList;
/* functions */
GSM * gsm_new(Config * config, char const * plugin, unsigned int retry);
void gsm_delete(GSM * gsm);
/* accessors */
ModemConfig * gsm_get_config(GSM * gsm);
unsigned int gsm_get_retry(GSM * gsm);
void gsm_set_callback(GSM * gsm, ModemEventCallback callback, void * priv);
int gsm_set_call_presentation(GSM * gsm, int set);
int gsm_set_call_waiting_control(GSM * gsm, int unsollicited);
int gsm_set_extended_ring_reports(GSM * gsm, int extended);
int gsm_set_mute(GSM * gsm, int mute);
/* useful */
/* call management */
int gsm_call_answer(GSM * gsm);
int gsm_call(GSM * gsm, ModemCallType calltype, char const * number,
int anonymous);
int gsm_call_contact(GSM * gsm, ModemCallType calltype, unsigned int index);
int gsm_call_hangup(GSM * gsm);
int gsm_call_reject(GSM * gsm);
/* callbacks */
void gsm_callback_on_message_deleted(GSM * gsm);
/* contacts */
int gsm_contact_delete(GSM * gsm, unsigned int index);
int gsm_contact_edit(GSM * gsm, unsigned int index, char const * name,
char const * number);
int gsm_contact_new(GSM * gsm, char const * name, char const * number);
int gsm_enter_sim_pin(GSM * gsm, char const * code);
/* fetching data */
int gsm_fetch_contact_list(GSM * gsm);
int gsm_fetch_contacts(GSM * gsm, unsigned int start, unsigned int end);
int gsm_fetch_message_list(GSM * gsm, GSMMessageList list);
int gsm_fetch_message(GSM * gsm, unsigned int id);
int gsm_fetch_mute(GSM * gsm);
int gsm_fetch_registration(GSM * gsm);
/* messaging */
int gsm_message_delete(GSM * gsm, unsigned int id);
int gsm_message_send(GSM * gsm, char const * number, GSMEncoding encoding,
char const * text, size_t length);
/* queries */
int gsm_is_alive(GSM * gsm);
int gsm_is_mute(GSM * gsm);
int gsm_is_phone_active(GSM * gsm);
int gsm_is_pin_valid(GSM * gsm);
int gsm_is_registered(GSM * gsm);
int gsm_request(GSM * gsm, ModemRequest * request);
int gsm_start(GSM * gsm, unsigned int delay);
int gsm_stop(GSM * gsm);
int gsm_trigger(GSM * gsm, ModemEventType event);
#endif /* !PHONE_GSM_H */