1 /*
2  * Copyright (C) 2015-2020 Alibaba Group Holding Limited
3  */
4 
5 #ifndef _AOS_SMARTCARD_H_
6 #define _AOS_SMARTCARD_H_
7 
8 
9 typedef enum {
10     AOS_SMARTCARD_ACT_NULL = 0,
11     AOS_SMARTCARD_ACT_2G,
12     AOS_SMARTCARD_ACT_3G,
13     AOS_SMARTCARD_ACT_4G
14 } aos_smartcard_act_t;
15 
16 /**
17  * Configure smartcard
18  *
19  * @param[in]  module_type - module type buffer
20  *             size - module type buffer size
21  *             reset_while_switch - flag to enable/disable reset while switch
22  *             card_switch_time - card switch time
23  *             module_startup_time - module startup time
24  *
25  * @return  0 : on success, -1 : if an error occurred with any step
26  */
27 int aos_smartcard_configure(char *module_type, int size, int *reset_while_switch, unsigned short *card_switch_time, unsigned short *module_startup_time);
28 
29 /**
30  * Get imei
31  *
32  * @param[in]  imei - imei buffer, size - imei buffer size
33  *
34  * @return  0 : on success, -1 : if an error occurred with any step
35  */
36 int aos_smartcard_get_imei(char *imei, int size);
37 
38 /**
39  * Get iccid
40  *
41  * @param[in]  iccid - iccid buffer, size - iccid buffer size
42  *
43  * @return  0 : on success, -1 : if an error occurred with any step
44  */
45 int aos_smartcard_get_iccid(char *iccid, int size);
46 
47 /**
48  * Get rssi
49  *
50  * @param[in]  rssi - rssi buffer
51  *
52  * @return  0 : on success, -1 : if an error occurred with any step
53  */
54 int aos_smartcard_get_rssi(int *rssi);
55 
56 /**
57  * Get act
58  *
59  * @param[in]  act - act buffer
60  *
61  * @return  0 : on success, -1 : if an error occurred with any step
62  */
63 int aos_smartcard_get_act(aos_smartcard_act_t *act);
64 
65 /**
66  * Reset module
67  *
68  * @return  0 : on success, -1 : if an error occurred with any step
69  */
70 int aos_smartcard_reset_module(void);
71 
72 /**
73  * Update phonebook recordings by slot
74  *
75  * @param[in]  slot - phone number slot, number - phone number
76  *
77  * @return  0 : on success, -1 : if an error occurred with any step
78  */
79 int aos_smartcard_cpbw(int slot, char *number);
80 
81 /**
82  * Set phonebook storage location to sim card
83  *
84  * @return  0 : on success, -1 : if an error occurred with any step
85  */
86 int aos_smartcard_cpbs(void);
87 
88 /**
89  * Read phonebook by slot
90  *
91  * @param[in]  slot - phone number slot
92  *             name - name buffer
93  *             name_size - name buffer size
94  *             number - number buffer
95  *             number_size - number buffer size
96  *
97  * @return  0 : on success, -1 : if an error occurred with any step
98  */
99 int aos_smartcard_cpbr(int slot, char *name, int name_size, char *number, int number_size);
100 
101 
102 #endif
103 
104