gril: Remove g_ril_reply_parse_data_reg_state

This commit is contained in:
Denis Kenzior 2015-12-03 10:04:07 -06:00
parent c99a5303c9
commit a02f164730
3 changed files with 0 additions and 220 deletions

View File

@ -33,8 +33,6 @@ extern "C" {
#include "ril_constants.h"
#include "drivers/rilmodem/vendor.h"
#define RIL_MAX_NUM_ACTIVE_DATA_CALLS 2
struct _GRil;
typedef struct _GRil GRil;

View File

@ -43,209 +43,6 @@
#include "grilreply.h"
#include "grilutil.h"
/* Indexes for registration state replies */
#define RST_IX_STATE 0
#define RST_IX_LAC 1
#define RST_IX_CID 2
#define RST_IX_RAT 3
#define RDST_IX_MAXDC 5
#define MTK_MODEM_MAX_CIDS 3
static void set_reg_state(GRil *gril, struct reply_reg_state *reply,
int i, const char *str)
{
int val;
char *endp;
int base;
const char *strstate;
if (str == NULL || *str == '\0')
goto no_val;
if (i == RST_IX_LAC || i == RST_IX_CID)
base = 16;
else
base = 10;
val = (int) strtol(str, &endp, base);
if (*endp != '\0')
goto no_val;
switch (i) {
case RST_IX_STATE:
switch (val) {
case RIL_REG_STATE_NOT_REGISTERED:
case RIL_REG_STATE_REGISTERED:
case RIL_REG_STATE_SEARCHING:
case RIL_REG_STATE_DENIED:
case RIL_REG_STATE_UNKNOWN:
case RIL_REG_STATE_ROAMING:
/* Only valid values for ofono */
strstate = registration_status_to_string(val);
break;
case RIL_REG_STATE_EMERGENCY_NOT_REGISTERED:
case RIL_REG_STATE_EMERGENCY_SEARCHING:
case RIL_REG_STATE_EMERGENCY_DENIED:
case RIL_REG_STATE_EMERGENCY_UNKNOWN:
/* Map to states valid for ofono core */
val -= RIL_REG_STATE_EMERGENCY_NOT_REGISTERED;
strstate = str;
break;
default:
val = NETWORK_REGISTRATION_STATUS_UNKNOWN;
strstate = str;
}
reply->status = val;
g_ril_append_print_buf(gril, "%s%s", print_buf, strstate);
break;
case RST_IX_LAC:
reply->lac = val;
g_ril_append_print_buf(gril, "%s0x%x", print_buf, val);
break;
case RST_IX_CID:
reply->ci = val;
g_ril_append_print_buf(gril, "%s0x%x", print_buf, val);
break;
case RST_IX_RAT:
g_ril_append_print_buf(gril, "%s%s", print_buf,
ril_radio_tech_to_string(val));
if (g_ril_vendor(gril) == OFONO_RIL_VENDOR_MTK) {
switch (val) {
case MTK_RADIO_TECH_HSDPAP:
case MTK_RADIO_TECH_HSDPAP_UPA:
case MTK_RADIO_TECH_HSUPAP:
case MTK_RADIO_TECH_HSUPAP_DPA:
val = RADIO_TECH_HSPAP;
break;
case MTK_RADIO_TECH_DC_DPA:
val = RADIO_TECH_HSDPA;
break;
case MTK_RADIO_TECH_DC_UPA:
val = RADIO_TECH_HSUPA;
break;
case MTK_RADIO_TECH_DC_HSDPAP:
case MTK_RADIO_TECH_DC_HSDPAP_UPA:
case MTK_RADIO_TECH_DC_HSDPAP_DPA:
case MTK_RADIO_TECH_DC_HSPAP:
val = RADIO_TECH_HSPAP;
break;
}
}
reply->tech = val;
break;
default:
goto no_val;
}
return;
no_val:
g_ril_append_print_buf(gril, "%s%s", print_buf, str ? str : "(null)");
}
static void set_data_reg_state(GRil *gril, struct reply_data_reg_state *reply,
int i, const char *str)
{
unsigned val;
char *endp;
if (str == NULL || *str == '\0')
goto no_val;
val = (unsigned) strtoul(str, &endp, 10);
if (*endp != '\0')
goto no_val;
switch (i) {
case RDST_IX_MAXDC:
/*
* MTK modem does not return max_cids, string for this index
* actually contains the maximum data bearer capability.
*/
if (g_ril_vendor(gril) == OFONO_RIL_VENDOR_MTK)
reply->max_cids = MTK_MODEM_MAX_CIDS;
else
reply->max_cids = val;
g_ril_append_print_buf(gril, "%s%u", print_buf, val);
break;
default:
goto no_val;
}
return;
no_val:
g_ril_append_print_buf(gril, "%s%s", print_buf, str ? str : "(null)");
}
struct reply_data_reg_state *g_ril_reply_parse_data_reg_state(GRil *gril,
const struct ril_msg *message)
{
struct parcel rilp;
struct parcel_str_array *str_arr;
struct reply_data_reg_state *reply = NULL;
int i;
g_ril_init_parcel(message, &rilp);
str_arr = parcel_r_str_array(&rilp);
if (str_arr == NULL) {
ofono_error("%s: parse error for %s", __func__,
ril_request_id_to_string(message->req));
goto out;
}
reply = g_try_malloc0(sizeof(*reply));
if (reply == NULL) {
ofono_error("%s: out of memory", __func__);
goto out;
}
reply->reg_state.status = -1;
reply->reg_state.lac = -1;
reply->reg_state.ci = -1;
g_ril_append_print_buf(gril, "{");
for (i = 0; i < str_arr->num_str; ++i) {
char *str = str_arr->str[i];
if (i > 0)
g_ril_append_print_buf(gril, "%s,", print_buf);
switch (i) {
case RST_IX_STATE: case RST_IX_LAC:
case RST_IX_CID: case RST_IX_RAT:
set_reg_state(gril, &reply->reg_state, i, str);
break;
case RDST_IX_MAXDC:
set_data_reg_state(gril, reply, i, str);
break;
default:
g_ril_append_print_buf(gril, "%s%s", print_buf,
str ? str : "(null)");
}
}
g_ril_append_print_buf(gril, "%s}", print_buf);
g_ril_print_response(gril, message);
/* As a minimum we require a valid status string */
if (reply->reg_state.status == -1) {
ofono_error("%s: invalid status", __func__);
g_free(reply);
reply = NULL;
}
out:
parcel_free_str_array(str_arr);
return reply;
}
static gint g_ril_call_compare(gconstpointer a, gconstpointer b)
{
const struct ofono_call *ca = a;

View File

@ -32,26 +32,11 @@
extern "C" {
#endif
struct reply_reg_state {
int status;
int lac;
int ci;
int tech;
};
struct reply_data_reg_state {
struct reply_reg_state reg_state;
unsigned int max_cids;
};
struct reply_oem_hook {
int length;
void *data;
};
struct reply_data_reg_state *g_ril_reply_parse_data_reg_state(GRil *gril,
const struct ril_msg *message);
GSList *g_ril_reply_parse_get_calls(GRil *gril, const struct ril_msg *message);
int *g_ril_reply_parse_retries(GRil *gril, const struct ril_msg *message,