From 1584a74a4acdfb17aab0d6a2b13b18a7799aa37d Mon Sep 17 00:00:00 2001 From: laforge Date: Sat, 2 Sep 2006 10:32:06 +0000 Subject: first compiling (unfinished, not-working) version of userspace gsm infrastructure git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@40 99fdad57-331a-0410-800a-d7fa5415bdb3 --- include/libgsmd/event.h | 14 +++++++++ include/libgsmd/handset.h | 15 ++++++++++ include/libgsmd/libgsmd.h | 50 +++++++++++++++++++++++++++++++ include/libgsmd/misc.h | 72 +++++++++++++++++++++++++++++++++++++++++++++ include/libgsmd/phonebook.h | 51 ++++++++++++++++++++++++++++++++ include/libgsmd/voicecall.h | 18 ++++++++++++ 6 files changed, 220 insertions(+) create mode 100644 include/libgsmd/event.h create mode 100644 include/libgsmd/handset.h create mode 100644 include/libgsmd/libgsmd.h create mode 100644 include/libgsmd/misc.h create mode 100644 include/libgsmd/phonebook.h create mode 100644 include/libgsmd/voicecall.h (limited to 'include/libgsmd') diff --git a/include/libgsmd/event.h b/include/libgsmd/event.h new file mode 100644 index 0000000..d7faa9b --- /dev/null +++ b/include/libgsmd/event.h @@ -0,0 +1,14 @@ +#ifndef _LIBGSMD_EVENT_H +#define _LIBGSMD_EVENT_H + +#include + +/* Prototype of libgsmd callback handler function */ +typedef int evt_cb_func(struct lgsm_handle *lh, enum gsmd_events evt, + void *user); + +/* Register an event callback handler with libgsmd */ +extern int lgsm_register_evt_cb(struct lgsm_handle *lh, + evt_cb_func *cb, void *user); + +#endif diff --git a/include/libgsmd/handset.h b/include/libgsmd/handset.h new file mode 100644 index 0000000..c6b5ef8 --- /dev/null +++ b/include/libgsmd/handset.h @@ -0,0 +1,15 @@ +#ifndef _LIBGSMD_HANDSET_H +#define _LIBGSMD_HANDSET_H + +#include +/* Set speaker level (Chapter 8.23) */ +extern int lgsm_set_spkr_level(struct lgsm_handle *lh, + u_int32_t level); + +/* Mute call during voice call */ +extern int lgsm_mute_set(struct lgsm_handle *lh, u_int8_t on); + +/* Get information on whether voice call is muted or not */ +extern int lgsm_mute_get(struct lgsm_handle *lh, u_int8_t *on); + +#endif diff --git a/include/libgsmd/libgsmd.h b/include/libgsmd/libgsmd.h new file mode 100644 index 0000000..579f13d --- /dev/null +++ b/include/libgsmd/libgsmd.h @@ -0,0 +1,50 @@ +#ifndef _LIBGSMD_H +#define _LIBGSMD_H + +/* libgsmd.h - Library API for gsmd, the GSM Daemon + * (C) 2006 by Harald Welte + * Development funded by First International Computers, Inc. + */ + +#include +#include + +/* Generic Information + * + * Return value: + * < 0 Error, see libgsmd/errno.h and errno.h + * = 0 Success + * > 0 Success, number of information elements returned + * + * Allocation: + * All data structures are caller-allocated. The only exception + * is struct lgsm_handle which is allocatedi in lgsm_init() and + * free'd in lgsm_exit() + * + * References: + * Recefences to "Chapter X" are referring to 3GPP TS 07.07 version 7.8.0 + */ + +/* Opaque data structure, content only known to libgsm implementation */ +struct lgsm_handle; + +/* initialize usage of libgsmd, obtain handle for othe API calls */ +extern struct lgsm_handle *lgsm_init(void); + +/* Terminate usage of libgsmd */ +extern int lgsm_exit(struct lgsm_handle *lh); + +/* Refer to GSM 04.08 [8] subclause 10.5.4.7 */ +enum lgsm_addr_type { + LGSM_ATYPE_ISDN_UNKN = 161, + LGSM_ATYPE_ISDN_INTL = , + LGSM_ATYPE_ISDN_NATIONAL = , +}; + +#define LGSM_ADDR_MAXLEN 31 +struct lgsm_addr { + char addr[LGSM_ADDR_MAXLEN+1]; + enum lgsm_addr_type tyoe; +}; + +#endif diff --git a/include/libgsmd/misc.h b/include/libgsmd/misc.h new file mode 100644 index 0000000..e191ce6 --- /dev/null +++ b/include/libgsmd/misc.h @@ -0,0 +1,72 @@ +#ifndef _LIBGSMD_H +#define _LIBGSMD_H + +/* libgsmd.h - Library API for gsmd, the GSM Daemon + * (C) 2006 by Harald Welte + * Development funded by First International Computers, Inc. + */ + +#include + +enum lgsm_netreg_state { + LGSM_NETREG_ST_NOTREG = 0, + LGSM_NETREG_ST_REG_HOME = 1, + LGSM_NETREG_ST_NOTREG_SEARCH = 2, + LGSM_NETREG_ST_DENIED = 3, + LGSM_NETREG_ST_UNKNOWN = 4, + LGSM_NETREG_ST_REG_ROAMING = 5, +}; + +/* Get the current network registration status */ +extern int lgsm_get_netreg_state(struct lgsm_handle *lh, + enum lgsm_netreg_state *state); + +enum lgsm_info_type { + LGSM_INFO_TYPE_NONE = 0, + LGSM_INFO_TYPE_MANUF = 1, + LGSM_INFO_TYPE_MODEL = 2, + LGSM_INFO_TYPE_REVISION = 3, + LGSM_INFO_TYPE_SERIAL = 4, + LGSM_INFO_TYPE_IMSI = 5, +}; + +/* Get some information about the handset */ +extern int lgsm_get_info(struct lgsm_handle *lh, + enum lgsm_info_type type, + char *ret_string, u_int16_t len); + +/* Authenticate to SIM Card using specified null-terminated pin */ +extern int lgsm_pin_auth(struct lgsm_handle *lh, const char *pin); + + +/* General Commands */ + +/* Get Signal Strehngth (Chapter 8.5) */ +extern int lgsm_get_signal_quality(struct lgsm_handle *h, + unsigned int *rssi); + +/* Set voice mail number */ +extern int lgsm_voicemail_set(struct lgsm_handle *lh, + struct lgsm_addr *addr); + +/* Get currently configured voice mail number */ +extern int lgsm_voicemail_get(struct lgsm_handle *lh, + struct lgsm_addr *addr); + +/* Operator Selection, Network Registration */ +/* TBD */ + + +/* CLIP, CLIR, COLP, Call Forwarding, Call Waiting, Call Deflecting */ +/* TBD */ + + +/* SMS related functions */ +/* TBD */ + + +/* GPRS related functions */ +/* TBD */ + + +#endif diff --git a/include/libgsmd/phonebook.h b/include/libgsmd/phonebook.h new file mode 100644 index 0000000..92c3a7f --- /dev/null +++ b/include/libgsmd/phonebook.h @@ -0,0 +1,51 @@ +#ifndef _LIBGSMD_PBOOK_H +#define _LIBGSMD_PBOOK_H + +#include + +/* Phonebook */ + +/* Chapter 8.11 */ +enum lgsm_pbook_type { + LGSM_PB_ME_DIALLED = 1, + LGSM_PB_SIM_EMERGENCY = 2, + LGSM_PB_SIM_FIXDIAL = 3, + LGSM_PB_SIM_DIALLED = 4, + LGSM_PB_ME_MISSED = 5, + LGSM_PB_ME_PHONEBOOK = 6, + LGSM_PB_COMB_PHONEBOOK = 7, + LGSM_PB_SIM_OWN_NUMBERS = 8, + LGSM_PB_ME_RECEIVED = 9, + LGSM_PB_SIM_PHONEBOOK = 10, + LGSM_PB_TA_PHONEBOOK = 11, +}; + +/* Get a bitmask of supported phonebook types */ +extern int lgsm_pb_get_types(struct lgsm_handle *lh, u_int32 *typemask); + +/* Get a range of supported indexes in given phonebook type, Chapter 8.12 */ +extern int lgsm_pb_get_range(struct lgsm_handle *lh, + enum lgsm_pbook_type type, + u_int32_t *from, u_int32_t *to, + u_int32_t *nlength, *u_int32_t tlength); + +#define LGSM_PB_TEXT_MAXLEN 31 + +struct lgsm_pb_entry { + struct lgsm_pb_entry *next; + enum lgsm_pbook_type type; + u_int32_t index; + char text[LGSM_PB_TEXT_MAXLEN+1]; +}; + +/* Get a specific phonebook entry and store it to 'pb' + * pb' is caller-allocated */ +extern int lgsm_pb_get_entry(struct lgsm_handle *lh, + struct lgsm_pb_entry *pb); + +/* Store a specific phonebook entry 'pb' into phone */ +extern int lgsm_pb_set_entry(struct lgsm_handle *lh, + struct lgsm_pb_entry *pb); + + +#endif diff --git a/include/libgsmd/voicecall.h b/include/libgsmd/voicecall.h new file mode 100644 index 0000000..4fffe4e --- /dev/null +++ b/include/libgsmd/voicecall.h @@ -0,0 +1,18 @@ +#ifndef _LIBGSMD_VCALL_H +#define _LIBGSMD_VCALL_H + +#include + +/* Voice Calls */ + +/* Initiate an outgoing voice call */ +extern int lgsm_voice_out_init(struct lgsm_handle *lh, + const struct lgsm_addr *number); + +/* Accept incoming voice call */ +extern int lgsm_voice_in_accept(struct lgsm_handle *lh); + +/* Terminate outgoing (or incoming) voice call */ +extern int lgsm_voice_hangup(struct lgsm_handle *lh); + +#endif -- cgit v1.2.3