1/* Copyright (C) 2007-2008 The Android Open Source Project
2**
3** This software is licensed under the terms of the GNU General Public
4** License version 2, as published by the Free Software Foundation, and
5** may be copied, distributed, and modified under those terms.
6**
7** This program is distributed in the hope that it will be useful,
8** but WITHOUT ANY WARRANTY; without even the implied warranty of
9** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10** GNU General Public License for more details.
11*/
12#ifndef _REMOTE_CALL_H
13#define _REMOTE_CALL_H
14
15#include "sms.h"
16
17/* convert a base console port into a remote phone number, -1 on error */
18extern int         remote_number_from_port( int  port );
19
20/* convert a remote phone number into a remote console port, -1 on error */
21extern int         remote_number_to_port( int  number );
22
23extern int         remote_number_string_to_port( const char*  number );
24
25typedef void   (*RemoteResultFunc)( void*  opaque, int  success );
26
27typedef enum {
28    REMOTE_CALL_DIAL = 0,
29    REMOTE_CALL_BUSY,
30    REMOTE_CALL_HANGUP,
31    REMOTE_CALL_HOLD,
32    REMOTE_CALL_ACCEPT,
33    REMOTE_CALL_SMS
34} RemoteCallType;
35
36/* call this function when you need to dial a remote voice call.
37 * this will try to connect to a remote emulator. the result function
38 * is called to indicate success or failure after some time.
39 *
40 * returns 0 if the number is to a remote phone, or -1 otherwise
41 */
42extern  int     remote_call_dial( const char*       to_number,
43                                  int               from_port,
44                                  RemoteResultFunc  result_func,
45                                  void*             result_opaque );
46
47/* call this function to send a SMS to a remote emulator */
48extern int      remote_call_sms( const char*   number, int  from_port, SmsPDU  pdu );
49
50/* call this function to indicate that you're busy to a remote caller */
51extern void     remote_call_other( const char*  to_number, int  from_port, RemoteCallType  type );
52
53extern void     remote_call_cancel( const char*  to_number, int from_port );
54
55#endif /* _REMOTE_CALL_H */
56