summaryrefslogtreecommitdiff
path: root/include/tapi.h
blob: ca76a2d8bf3719591b8b89bbaf58fec8e9da3af9 (plain)
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
/*
 *  pwlock
 *
 * Copyright 2012  Samsung Electronics Co., Ltd
 *
 * Licensed under the Flora License, Version 1.1 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://floralicense.org/license/
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

#ifndef __PWLOCK_TAPI_H__
#define __PWLOCK_TAPI_H__

#include <tapi_common.h>
#include <TapiUtility.h>
#include <ITapiSim.h>

enum sim_stat {
	SIM_ERROR = -1,
	SIM_RETRY = 0,
	SIM_OK,
	SIM_EMPTY,
	SIM_REQ_PIN,
	SIM_REQ_PUK,
	SIM_REQ_LOCK,
	SIM_REQ_NCK,
	SIM_REQ_NSCK,
	SIM_REQ_SPCK,
	SIM_REQ_CCK,
	SIM_BLOCKED,
	SIM_WAITING,
	SIM_REQUIRED_EVENT,
	SIM_LOCK_INFO
};

struct pwlock_tapi_info {
	enum sim_stat st;	/* RETRY, OK, ERROR */
	int retry_cnt;
};

struct tapi {
	TapiHandle *handle;
	struct tapi_event *evt;
	int evt_sz;

	void *cb_data;
	void (*cb) (struct pwlock_tapi_info *, void *);
};

struct tapi_event {
	char *event;
	void (*tapi_notification_cb)(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
};

struct tapi *pwlock_tapi_init(void (*cb) (struct pwlock_tapi_info *, void *), void *data);
void pwlock_tapi_exit(struct tapi **t);
int pwlock_tapi_ready_check(void);
int pwlock_tapi_get_sim_lock_info(struct tapi* t);

enum sim_stat pwlock_tapi_check_sim(struct tapi *t, int *changed);

/* tapi wrapper */
int pwlock_tapi_verify_pins(struct tapi *t, char *code);
int pwlock_tapi_verify_puks(struct tapi *t, char *code, char *newcode);
int pwlock_tapi_verify_lock(struct tapi *t, char *code);
int pwlock_tapi_disable_net_pers(struct tapi *t, char *code, TelSimLockType_t type);

/* callbacks */
void pwlock_tapi_noti_modem_power_cb(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
void pwlock_tapi_noti_sim_status_cb(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
void pwlock_tapi_verify_sim_pins_and_puks_cb(TapiHandle *handle, int result, void *data, void *user_data);
void pwlock_tapi_disable_sim_facility_cb(TapiHandle *handle, int result, void *data, void *user_data);
void pwlock_tapi_get_sim_lock_info_cb(TapiHandle *handle, int result, void *data, void *user_data);

#endif				/* __PWLOCK_TAPI_H__ */