mirror of git://git.sysmocom.de/ofono
ifxmodem: update to new gprs context interface
This commit is contained in:
parent
df64b12758
commit
cbda267674
|
@ -67,10 +67,7 @@ struct gprs_context_data {
|
||||||
char address[32];
|
char address[32];
|
||||||
char dns1[32];
|
char dns1[32];
|
||||||
char dns2[32];
|
char dns2[32];
|
||||||
union {
|
ofono_gprs_context_cb_t cb;
|
||||||
ofono_gprs_context_cb_t down_cb; /* Down callback */
|
|
||||||
ofono_gprs_context_up_cb_t up_cb; /* Up callback */
|
|
||||||
};
|
|
||||||
void *cb_data; /* Callback data */
|
void *cb_data; /* Callback data */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -123,13 +120,12 @@ static void failed_setup(struct ofono_gprs_context *gc,
|
||||||
gcd->state = STATE_IDLE;
|
gcd->state = STATE_IDLE;
|
||||||
|
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
CALLBACK_WITH_FAILURE(gcd->up_cb, NULL, 0, NULL, NULL,
|
CALLBACK_WITH_FAILURE(gcd->cb, gcd->cb_data);
|
||||||
NULL, NULL, gcd->cb_data);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
decode_at_error(&error, g_at_result_final_response(result));
|
decode_at_error(&error, g_at_result_final_response(result));
|
||||||
gcd->up_cb(&error, NULL, 0, NULL, NULL, NULL, NULL, gcd->cb_data);
|
gcd->cb(&error, gcd->cb_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void session_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
static void session_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
||||||
|
@ -157,10 +153,14 @@ static void session_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
||||||
if (interface == NULL)
|
if (interface == NULL)
|
||||||
interface = "invalid";
|
interface = "invalid";
|
||||||
|
|
||||||
CALLBACK_WITH_SUCCESS(gcd->up_cb, interface, TRUE, gcd->address,
|
ofono_gprs_context_set_interface(gc, interface);
|
||||||
STATIC_IP_NETMASK, NULL, dns, gcd->cb_data);
|
ofono_gprs_context_set_ipv4_address(gc, gcd->address, TRUE);
|
||||||
|
ofono_gprs_context_set_ipv4_netmask(gc, STATIC_IP_NETMASK);
|
||||||
|
ofono_gprs_context_set_ipv4_dns_servers(gc, dns);
|
||||||
|
|
||||||
gcd->up_cb = NULL;
|
CALLBACK_WITH_SUCCESS(gcd->cb, gcd->cb_data);
|
||||||
|
|
||||||
|
gcd->cb = NULL;
|
||||||
gcd->cb_data = NULL;
|
gcd->cb_data = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -316,16 +316,20 @@ error:
|
||||||
|
|
||||||
static void ifx_gprs_activate_primary(struct ofono_gprs_context *gc,
|
static void ifx_gprs_activate_primary(struct ofono_gprs_context *gc,
|
||||||
const struct ofono_gprs_primary_context *ctx,
|
const struct ofono_gprs_primary_context *ctx,
|
||||||
ofono_gprs_context_up_cb_t cb, void *data)
|
ofono_gprs_context_cb_t cb, void *data)
|
||||||
{
|
{
|
||||||
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
|
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
|
||||||
char buf[OFONO_GPRS_MAX_APN_LENGTH + 128];
|
char buf[OFONO_GPRS_MAX_APN_LENGTH + 128];
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
|
/* IPv6 support not implemented */
|
||||||
|
if (ctx->proto != OFONO_GPRS_PROTO_IP)
|
||||||
|
goto error;
|
||||||
|
|
||||||
DBG("cid %u", ctx->cid);
|
DBG("cid %u", ctx->cid);
|
||||||
|
|
||||||
gcd->active_context = ctx->cid;
|
gcd->active_context = ctx->cid;
|
||||||
gcd->up_cb = cb;
|
gcd->cb = cb;
|
||||||
gcd->cb_data = data;
|
gcd->cb_data = data;
|
||||||
memcpy(gcd->username, ctx->username, sizeof(ctx->username));
|
memcpy(gcd->username, ctx->username, sizeof(ctx->username));
|
||||||
memcpy(gcd->password, ctx->password, sizeof(ctx->password));
|
memcpy(gcd->password, ctx->password, sizeof(ctx->password));
|
||||||
|
@ -342,7 +346,8 @@ static void ifx_gprs_activate_primary(struct ofono_gprs_context *gc,
|
||||||
setup_cb, gc, NULL) > 0)
|
setup_cb, gc, NULL) > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CALLBACK_WITH_FAILURE(cb, NULL, 0, NULL, NULL, NULL, NULL, data);
|
error:
|
||||||
|
CALLBACK_WITH_FAILURE(cb, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deactivate_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
static void deactivate_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
||||||
|
@ -360,7 +365,7 @@ static void deactivate_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
||||||
|
|
||||||
g_at_chat_resume(gcd->chat);
|
g_at_chat_resume(gcd->chat);
|
||||||
|
|
||||||
CALLBACK_WITH_SUCCESS(gcd->down_cb, gcd->cb_data);
|
CALLBACK_WITH_SUCCESS(gcd->cb, gcd->cb_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ifx_gprs_deactivate_primary(struct ofono_gprs_context *gc,
|
static void ifx_gprs_deactivate_primary(struct ofono_gprs_context *gc,
|
||||||
|
@ -374,7 +379,7 @@ static void ifx_gprs_deactivate_primary(struct ofono_gprs_context *gc,
|
||||||
DBG("cid %u", cid);
|
DBG("cid %u", cid);
|
||||||
|
|
||||||
gcd->state = STATE_DISABLING;
|
gcd->state = STATE_DISABLING;
|
||||||
gcd->down_cb = cb;
|
gcd->cb = cb;
|
||||||
gcd->cb_data = data;
|
gcd->cb_data = data;
|
||||||
|
|
||||||
g_at_rawip_shutdown(gcd->rawip);
|
g_at_rawip_shutdown(gcd->rawip);
|
||||||
|
|
Loading…
Reference in New Issue