1 /*
2 
3   $Id$
4 
5   G N O K I I
6 
7   A Linux/Unix toolset and driver for the mobile phones.
8 
9   This file is part of gnokii.
10 
11   Gnokii is free software; you can redistribute it and/or modify
12   it under the terms of the GNU General Public License as published by
13   the Free Software Foundation; either version 2 of the License, or
14   (at your option) any later version.
15 
16   Gnokii is distributed in the hope that it will be useful,
17   but WITHOUT ANY WARRANTY; without even the implied warranty of
18   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19   GNU General Public License for more details.
20 
21   You should have received a copy of the GNU General Public License
22   along with gnokii; if not, write to the Free Software
23   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24 
25   Copyright (C) 1999-2000 Hugh Blemings, Pavel Janik
26   Copyright (C) 2002-2003 Pawel Kot, BORBELY Zoltan <bozo@andrews.hu>
27 
28   Include file for the call management library.
29 
30 */
31 
32 #ifndef _gnokii_call_h
33 #define _gnokii_call_h
34 
35 #include <gnokii/error.h>
36 
37 typedef enum {
38 	GN_CALL_Voice,		/* Voice call */
39 	GN_CALL_NonDigitalData,	/* Data call on non digital line */
40 	GN_CALL_DigitalData	/* Data call on digital line */
41 } gn_call_type;
42 
43 typedef enum {
44 	GN_CALL_Never,			/* Never send my number */
45 	GN_CALL_Always,			/* Always send my number */
46 	GN_CALL_Default			/* Use the network default settings */
47 } gn_call_send_number;
48 
49 typedef enum {
50 	GN_CALL_Idle,
51 	GN_CALL_Ringing,
52 	GN_CALL_Dialing,
53 	GN_CALL_Incoming,		/* Incoming call */
54 	GN_CALL_LocalHangup,		/* Local end terminated the call */
55 	GN_CALL_RemoteHangup,		/* Remote end terminated the call */
56 	GN_CALL_Established,		/* Remote end answered the call */
57 	GN_CALL_Held,			/* Call placed on hold */
58 	GN_CALL_Resumed			/* Held call resumed */
59 } gn_call_status;
60 
61 typedef struct {
62 	gn_call_type type;
63 	char number[GN_PHONEBOOK_NUMBER_MAX_LENGTH + 1];
64 	char name[GN_PHONEBOOK_NAME_MAX_LENGTH + 1];
65 	gn_call_send_number send_number;
66 	int call_id;
67 } gn_call_info;
68 
69 typedef struct {
70 	int call_id;
71 	int channel;
72 	char number[GN_PHONEBOOK_NUMBER_MAX_LENGTH + 1];
73 	char name[GN_PHONEBOOK_NAME_MAX_LENGTH + 1];
74 	gn_call_status state;
75 	gn_call_status prev_state;
76 } gn_call_active;
77 
78 /* Call functions and structs */
79 typedef struct {
80 	struct gn_statemachine *state;
81 	int call_id;
82 	gn_call_status status;
83 	gn_call_type type;
84 	char remote_number[GN_PHONEBOOK_NUMBER_MAX_LENGTH + 1];
85 	char remote_name[GN_PHONEBOOK_NAME_MAX_LENGTH + 1];
86 	struct timeval start_time;
87 	struct timeval answer_time;
88 	int local_originated;
89 } gn_call;
90 
91 #define	GN_CALL_MAX_PARALLEL 2
92 
93 GNOKII_API void gn_call_notifier(gn_call_status call_status, gn_call_info *call_info, struct gn_statemachine *state);
94 GNOKII_API gn_call *gn_call_get_active(int call_id);
95 GNOKII_API gn_error gn_call_answer(int call_id);
96 GNOKII_API gn_error gn_call_cancel(int call_id);
97 
98 #endif /* _gnokii_call_h */
99