File: emulator.h

package info (click to toggle)
ofono 2.18-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,064 kB
  • sloc: ansic: 224,979; sh: 5,012; python: 4,040; makefile: 956
file content (110 lines) | stat: -rw-r--r-- 3,309 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*
 * oFono - Open Source Telephony
 * Copyright (C) 2011  Intel Corporation
 *
 * SPDX-License-Identifier: GPL-2.0-only
 */

#ifndef __OFONO_EMULATOR_H
#define __OFONO_EMULATOR_H

#ifdef __cplusplus
extern "C" {
#endif

#include <ofono/types.h>

#define OFONO_EMULATOR_IND_BATTERY "battchg"
#define OFONO_EMULATOR_IND_CALL "call"
#define OFONO_EMULATOR_IND_CALLHELD "callheld"
#define OFONO_EMULATOR_IND_CALLSETUP "callsetup"
#define OFONO_EMULATOR_IND_ROAMING "roam"
#define OFONO_EMULATOR_IND_SERVICE "service"
#define OFONO_EMULATOR_IND_SIGNAL "signal"

#define OFONO_EMULATOR_CALL_INACTIVE 0
#define OFONO_EMULATOR_CALL_ACTIVE 1

#define OFONO_EMULATOR_CALLSETUP_INACTIVE 0
#define OFONO_EMULATOR_CALLSETUP_INCOMING 1
#define OFONO_EMULATOR_CALLSETUP_OUTGOING 2
#define OFONO_EMULATOR_CALLSETUP_ALERTING 3

#define OFONO_EMULATOR_CALLHELD_NONE 0
#define OFONO_EMULATOR_CALLHELD_MULTIPLE 1
#define OFONO_EMULATOR_CALLHELD_ON_HOLD 2

struct ofono_emulator;
struct ofono_emulator_request;
struct ofono_handsfree_card;

enum ofono_emulator_type {
	OFONO_EMULATOR_TYPE_DUN,
	OFONO_EMULATOR_TYPE_HFP,
};

enum ofono_emulator_request_type {
	OFONO_EMULATOR_REQUEST_TYPE_COMMAND_ONLY,
	OFONO_EMULATOR_REQUEST_TYPE_QUERY,
	OFONO_EMULATOR_REQUEST_TYPE_SUPPORT,
	OFONO_EMULATOR_REQUEST_TYPE_SET,
};

typedef void (*ofono_emulator_request_cb_t)(struct ofono_emulator *em,
					struct ofono_emulator_request *req,
					void *data);

struct ofono_emulator *ofono_emulator_create(struct ofono_modem *modem,
						enum ofono_emulator_type type);

void ofono_emulator_register(struct ofono_emulator *em, int fd);

void ofono_emulator_remove(struct ofono_emulator *em);

void ofono_emulator_send_final(struct ofono_emulator *em,
				const struct ofono_error *final);
void ofono_emulator_send_unsolicited(struct ofono_emulator *em,
					const char *result);
void ofono_emulator_send_intermediate(struct ofono_emulator *em,
					const char *result);
void ofono_emulator_send_info(struct ofono_emulator *em, const char *line,
				ofono_bool_t last);

ofono_bool_t ofono_emulator_add_handler(struct ofono_emulator *em,
					const char *prefix,
					ofono_emulator_request_cb_t cb,
					void *data, ofono_destroy_func destroy);
ofono_bool_t ofono_emulator_remove_handler(struct ofono_emulator *em,
						const char *prefix);

ofono_bool_t ofono_emulator_request_next_string(
					struct ofono_emulator_request *req,
					const char **str);
ofono_bool_t ofono_emulator_request_next_number(
					struct ofono_emulator_request *req,
					int *number);

const char *ofono_emulator_request_get_raw(struct ofono_emulator_request *req);

enum ofono_emulator_request_type ofono_emulator_request_get_type(
					struct ofono_emulator_request *req);

void ofono_emulator_set_indicator(struct ofono_emulator *em,
					const char *name, int value);
void ofono_emulator_set_hf_indicator_active(struct ofono_emulator *em,
						int indicator,
						ofono_bool_t active);

void ofono_emulator_set_handsfree_card(struct ofono_emulator *em,
					struct ofono_handsfree_card *card);

typedef void (*ofono_emulator_codec_negotiation_cb)(int err, void *data);

int ofono_emulator_start_codec_negotiation(struct ofono_emulator *em,
		ofono_emulator_codec_negotiation_cb cb, void *data);

#ifdef __cplusplus
}
#endif

#endif /* __OFONO_EMULATOR_H */