From 0382f6435357ec41be496702aa8d27bd6e1bf4c3 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Tue, 12 Jan 2010 11:27:31 -0600 Subject: 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 --- src/sim.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/sim.c') diff --git a/src/sim.c b/src/sim.c index 502dd372..1d17fa35 100644 --- a/src/sim.c +++ b/src/sim.c @@ -89,7 +89,7 @@ struct ofono_sim { unsigned char *efli; unsigned char efli_length; enum ofono_sim_cphs_phase cphs_phase; - unsigned short cphs_support; + unsigned char cphs_service_table[2]; struct ofono_watchlist *ready_watches; const struct ofono_sim_driver *driver; 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) 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: 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) { if (sim == NULL) - return OFONO_SIM_CPHS_NONE; + return OFONO_SIM_CPHS_PHASE_NONE; 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) - return 0; + return NULL; - return sim->cphs_support; + return sim->cphs_service_table; } unsigned int ofono_sim_add_ready_watch(struct ofono_sim *sim, -- cgit v1.2.3