mirror of git://git.sysmocom.de/ofono
Refactor: Rename & Restructure cphs_support
- Rename to cphs_service_table to be more inline with the specification. - Since the spec allows arbitrary length service tables, use an unsigned char * return instead of a short. - Use bit_field function instead of defining an enum
This commit is contained in:
parent
2b231c3f84
commit
0382f64353
|
@ -171,7 +171,7 @@ const char *ofono_sim_get_imsi(struct ofono_sim *sim);
|
||||||
enum ofono_sim_phase ofono_sim_get_phase(struct ofono_sim *sim);
|
enum ofono_sim_phase ofono_sim_get_phase(struct ofono_sim *sim);
|
||||||
|
|
||||||
enum ofono_sim_cphs_phase ofono_sim_get_cphs_phase(struct ofono_sim *sim);
|
enum ofono_sim_cphs_phase ofono_sim_get_cphs_phase(struct ofono_sim *sim);
|
||||||
unsigned short ofono_sim_get_cphs_support(struct ofono_sim *sim);
|
const unsigned char *ofono_sim_get_cphs_service_table(struct ofono_sim *sim);
|
||||||
|
|
||||||
unsigned int ofono_sim_add_ready_watch(struct ofono_sim *sim,
|
unsigned int ofono_sim_add_ready_watch(struct ofono_sim *sim,
|
||||||
ofono_sim_ready_notify_cb_t cb,
|
ofono_sim_ready_notify_cb_t cb,
|
||||||
|
|
|
@ -895,6 +895,8 @@ void ofono_message_waiting_register(struct ofono_message_waiting *mw)
|
||||||
sim_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_SIM);
|
sim_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_SIM);
|
||||||
|
|
||||||
if (sim_atom) {
|
if (sim_atom) {
|
||||||
|
const unsigned char *st;
|
||||||
|
|
||||||
/* Assume that if sim atom exists, it is ready */
|
/* Assume that if sim atom exists, it is ready */
|
||||||
mw->sim = __ofono_atom_get_data(sim_atom);
|
mw->sim = __ofono_atom_get_data(sim_atom);
|
||||||
|
|
||||||
|
@ -906,9 +908,13 @@ void ofono_message_waiting_register(struct ofono_message_waiting *mw)
|
||||||
OFONO_SIM_FILE_STRUCTURE_FIXED,
|
OFONO_SIM_FILE_STRUCTURE_FIXED,
|
||||||
mw_mbi_read_cb, mw);
|
mw_mbi_read_cb, mw);
|
||||||
|
|
||||||
if ((ofono_sim_get_cphs_support(mw->sim) &
|
st = ofono_sim_get_cphs_service_table(mw->sim);
|
||||||
OFONO_SIM_CPHS_ST_MAILBOX_NUMBERS_MASK) ==
|
|
||||||
OFONO_SIM_CPHS_ST_MAILBOX_NUMBERS_MASK) {
|
/*
|
||||||
|
* Mailbox numbers located in Byte 1, bits 6 & 5,
|
||||||
|
* Check for Activated & Allocated
|
||||||
|
*/
|
||||||
|
if (st && bit_field(st[0], 5, 2) == 3) {
|
||||||
ofono_sim_read(mw->sim, SIM_EF_CPHS_MWIS_FILEID,
|
ofono_sim_read(mw->sim, SIM_EF_CPHS_MWIS_FILEID,
|
||||||
OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
|
OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
|
||||||
mw_cphs_mwis_read_cb, mw);
|
mw_cphs_mwis_read_cb, mw);
|
||||||
|
|
12
src/sim.c
12
src/sim.c
|
@ -89,7 +89,7 @@ struct ofono_sim {
|
||||||
unsigned char *efli;
|
unsigned char *efli;
|
||||||
unsigned char efli_length;
|
unsigned char efli_length;
|
||||||
enum ofono_sim_cphs_phase cphs_phase;
|
enum ofono_sim_cphs_phase cphs_phase;
|
||||||
unsigned short cphs_support;
|
unsigned char cphs_service_table[2];
|
||||||
struct ofono_watchlist *ready_watches;
|
struct ofono_watchlist *ready_watches;
|
||||||
const struct ofono_sim_driver *driver;
|
const struct ofono_sim_driver *driver;
|
||||||
void *driver_data;
|
void *driver_data;
|
||||||
|
@ -969,7 +969,7 @@ static void sim_cphs_information_read_cb(int ok, int length, int record,
|
||||||
else if (data[0] >= 0x02)
|
else if (data[0] >= 0x02)
|
||||||
sim->cphs_phase = OFONO_SIM_CPHS_PHASE_2G;
|
sim->cphs_phase = OFONO_SIM_CPHS_PHASE_2G;
|
||||||
|
|
||||||
sim->cphs_support = (data[2] << 8) | data[1];
|
memcpy(sim->cphs_service_table, data + 1, 2);
|
||||||
|
|
||||||
ready:
|
ready:
|
||||||
ofono_sim_set_ready(sim);
|
ofono_sim_set_ready(sim);
|
||||||
|
@ -1729,17 +1729,17 @@ enum ofono_sim_phase ofono_sim_get_phase(struct ofono_sim *sim)
|
||||||
enum ofono_sim_cphs_phase ofono_sim_get_cphs_phase(struct ofono_sim *sim)
|
enum ofono_sim_cphs_phase ofono_sim_get_cphs_phase(struct ofono_sim *sim)
|
||||||
{
|
{
|
||||||
if (sim == NULL)
|
if (sim == NULL)
|
||||||
return OFONO_SIM_CPHS_NONE;
|
return OFONO_SIM_CPHS_PHASE_NONE;
|
||||||
|
|
||||||
return sim->cphs_phase;
|
return sim->cphs_phase;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned short ofono_sim_get_cphs_support(struct ofono_sim *sim)
|
const unsigned char *ofono_sim_get_cphs_service_table(struct ofono_sim *sim)
|
||||||
{
|
{
|
||||||
if (sim == NULL)
|
if (sim == NULL)
|
||||||
return 0;
|
return NULL;
|
||||||
|
|
||||||
return sim->cphs_support;
|
return sim->cphs_service_table;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int ofono_sim_add_ready_watch(struct ofono_sim *sim,
|
unsigned int ofono_sim_add_ready_watch(struct ofono_sim *sim,
|
||||||
|
|
Loading…
Reference in New Issue