本文整理汇总了C++中CALLBACK_WITH_FAILURE函数的典型用法代码示例。如果您正苦于以下问题:C++ CALLBACK_WITH_FAILURE函数的具体用法?C++ CALLBACK_WITH_FAILURE怎么用?C++ CALLBACK_WITH_FAILURE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CALLBACK_WITH_FAILURE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ril_sim_read_record
static void ril_sim_read_record(struct ofono_sim *sim, int fileid,
int record, int length,
const unsigned char *path,
unsigned int path_len,
ofono_sim_read_cb_t cb, void *data)
{
struct sim_data *sd = ofono_sim_get_data(sim);
struct cb_data *cbd = cb_data_new(cb, data, sd);
char *hex_path;
struct parcel rilp;
DBG("file %04x", fileid);
hex_path = get_path(g_ril_vendor(sd->ril),
sd->app_type, fileid, path, path_len);
if (hex_path == NULL) {
ofono_error("Couldn't build SIM read info request - NULL path");
goto error;
}
parcel_init(&rilp);
parcel_w_int32(&rilp, CMD_READ_RECORD);
parcel_w_int32(&rilp, fileid);
parcel_w_string(&rilp, hex_path);
parcel_w_int32(&rilp, record); /* P1 */
parcel_w_int32(&rilp, 4); /* P2 */
parcel_w_int32(&rilp, length); /* P3 */
parcel_w_string(&rilp, NULL); /* data; only req'd for writes */
parcel_w_string(&rilp, NULL); /* pin2; only req'd for writes */
parcel_w_string(&rilp, sd->aid_str); /* AID (Application ID) */
/* sessionId, specific to latest MTK modems (harmless for older ones) */
if (g_ril_vendor(sd->ril) == OFONO_RIL_VENDOR_MTK)
parcel_w_int32(&rilp, 0);
g_ril_append_print_buf(sd->ril, "(cmd=0x%.2X,efid=0x%.4X,path=%s,"
"%d,%d,%d,(null),pin2=(null),aid=%s)",
CMD_READ_RECORD, fileid, hex_path,
record, 4, length, sd->aid_str);
g_free(hex_path);
if (g_ril_send(sd->ril, RIL_REQUEST_SIM_IO, &rilp,
ril_file_io_cb, cbd, g_free) > 0)
return;
error:
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, NULL, 0, data);
}
示例2: mtk_pin_retries_cb
static void mtk_pin_retries_cb(struct ril_msg *message, gpointer user_data)
{
struct cb_data *cbd = user_data;
ofono_sim_pin_retries_cb_t cb = cbd->cb;
struct sim_data *sd = cbd->user;
struct parcel rilp;
char **strv;
char *debug_str;
int pin[MTK_EPINC_NUM_PASSWD];
int num_pin;
if (message->error != RIL_E_SUCCESS) {
ofono_error("Reply failure: %s",
ril_error_to_string(message->error));
goto error;
}
g_ril_init_parcel(message, &rilp);
strv = parcel_r_strv(&rilp);
if (strv == NULL) {
ofono_error("%s: parse error", __func__);
goto error;
}
debug_str = g_strjoinv(",", strv);
g_ril_append_print_buf(sd->ril, "{%d,%s}",
g_strv_length(strv), debug_str);
g_free(debug_str);
g_ril_print_response(sd->ril, message);
num_pin = sscanf(strv[0], "+EPINC:%d,%d,%d,%d",
&pin[0], &pin[1], &pin[2], &pin[3]);
g_strfreev(strv);
if (num_pin != MTK_EPINC_NUM_PASSWD)
goto error;
sd->retries[OFONO_SIM_PASSWORD_SIM_PIN] = pin[0];
sd->retries[OFONO_SIM_PASSWORD_SIM_PIN2] = pin[1];
sd->retries[OFONO_SIM_PASSWORD_SIM_PUK] = pin[2];
sd->retries[OFONO_SIM_PASSWORD_SIM_PUK2] = pin[3];
CALLBACK_WITH_SUCCESS(cb, sd->retries, cbd->data);
return;
error:
CALLBACK_WITH_FAILURE(cb, NULL, cbd->data);
}
示例3: ste_cgdcont_cb
static void ste_cgdcont_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct cb_data *cbd = user_data;
ofono_gprs_context_up_cb_t cb = cbd->cb;
struct ofono_gprs_context *gc = cbd->user;
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
struct cb_data *ncbd = NULL;
char buf[128];
struct conn_info *conn;
GSList *l;
if (!ok) {
struct ofono_error error;
gcd->active_context = 0;
decode_at_error(&error, g_at_result_final_response(result));
cb(&error, NULL, 0, NULL, NULL, NULL, NULL, cbd->data);
return;
}
ncbd = g_memdup(cbd, sizeof(struct cb_data));
l = g_slist_find_custom(g_caif_devices, GUINT_TO_POINTER(0),
conn_compare_by_cid);
if (!l) {
DBG("at_cgdcont_cb, no more available devices");
goto error;
}
conn = l->data;
conn->cid = gcd->active_context;
snprintf(buf, sizeof(buf), "AT*EPPSD=1,%u,%u",
conn->channel_id, conn->cid);
if (g_at_chat_send(gcd->chat, buf, NULL,
ste_eppsd_up_cb, ncbd, g_free) > 0)
return;
error:
if (ncbd)
g_free(ncbd);
gcd->active_context = 0;
CALLBACK_WITH_FAILURE(cb, NULL, 0, NULL, NULL,
NULL, NULL, cbd->data);
}
示例4: ril_rat_mode_cb
static void ril_rat_mode_cb(struct ril_msg *message, gpointer user_data)
{
DBG("");
struct cb_data *cbd = user_data;
ofono_radio_settings_rat_mode_query_cb_t cb = cbd->cb;
struct parcel rilp;
int mode = OFONO_RADIO_ACCESS_MODE_ANY;
int pref;
if (message->error == RIL_E_SUCCESS) {
ril_util_init_parcel(message, &rilp);
/*first item in int[] is len so let's skip that*/
parcel_r_int32(&rilp);
pref = parcel_r_int32(&rilp);
switch (pref) {
case PREF_NET_TYPE_LTE_ONLY:
mode = OFONO_RADIO_ACCESS_MODE_LTE;
case PREF_NET_TYPE_GSM_ONLY:
mode = OFONO_RADIO_ACCESS_MODE_GSM;
break;
case PREF_NET_TYPE_GSM_WCDMA_AUTO:/* according to UI design */
if (!cb)
ril_force_rat_mode(cbd->user, pref);
case PREF_NET_TYPE_WCDMA:
case PREF_NET_TYPE_GSM_WCDMA: /* according to UI design */
mode = OFONO_RADIO_ACCESS_MODE_UMTS;
break;
case PREF_NET_TYPE_LTE_CDMA_EVDO:
case PREF_NET_TYPE_LTE_GSM_WCDMA:
case PREF_NET_TYPE_LTE_CMDA_EVDO_GSM_WCDMA:
if (!cb)
ril_force_rat_mode(cbd->user, pref);
break;
case PREF_NET_TYPE_CDMA_EVDO_AUTO:
case PREF_NET_TYPE_CDMA_ONLY:
case PREF_NET_TYPE_EVDO_ONLY:
case PREF_NET_TYPE_GSM_WCDMA_CDMA_EVDO_AUTO:
default:
break;
}
if (cb)
CALLBACK_WITH_SUCCESS(cb, mode, cbd->data);
} else {
if (cb)
CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
ofono_error("rat mode query failed");
}
}
示例5: ste_set_rat_mode
static void ste_set_rat_mode(struct ofono_radio_settings *rs,
enum ofono_radio_access_mode mode,
ofono_radio_settings_rat_mode_set_cb_t cb,
void *data)
{
struct radio_settings_data *rsd = ofono_radio_settings_get_data(rs);
struct cb_data *cbd = cb_data_new(cb, data);
char buf[20];
enum ste_radio_mode value;
if (!ofono_mode_to_ste_mode(mode, &value)) {
CALLBACK_WITH_FAILURE(cb, data);
g_free(cbd);
return;
}
snprintf(buf, sizeof(buf), "AT+CFUN=%u", value);
if (g_at_chat_send(rsd->chat, buf, none_prefix,
rat_modify_cb, cbd, g_free) == 0) {
CALLBACK_WITH_FAILURE(cb, data);
g_free(cbd);
}
}
示例6: at_discover_apps
static void at_discover_apps(struct ofono_sim_auth *sa,
ofono_sim_list_apps_cb_t cb,
void *data)
{
struct sim_auth_data *sad = ofono_sim_auth_get_data(sa);
struct cb_data *cbd = cb_data_new(cb, data);
if (g_at_chat_send(sad->chat, "AT+CUAD", cuad_prefix,
at_discover_apps_cb, cbd, g_free) > 0)
return;
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, NULL, 0, data);
}
示例7: ril_clir_query
static void ril_clir_query(struct ofono_call_settings *cs,
ofono_call_settings_clir_cb_t cb, void *data)
{
struct settings_data *sd = ofono_call_settings_get_data(cs);
struct cb_data *cbd = cb_data_new(cb, data, cs);
int ret;
ret = g_ril_send(sd->ril, RIL_REQUEST_GET_CLIR, NULL,
ril_clir_query_cb, cbd, g_free);
if (ret <= 0) {
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, -1, -1, data);
}
}
示例8: at_query_revision
static void at_query_revision(struct ofono_devinfo *info,
ofono_devinfo_query_cb_t cb, void *data)
{
struct cb_data *cbd = cb_data_new(cb, data);
GAtChat *chat = ofono_devinfo_get_data(info);
cbd->user = "+CGMR:";
if (g_at_chat_send(chat, "AT+CGMR", NULL, attr_cb, cbd, g_free) > 0)
return;
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, NULL, data);
}
示例9: ril_set_rat_cb
static void ril_set_rat_cb(struct ril_msg *message, gpointer user_data)
{
struct cb_data *cbd = user_data;
struct ofono_radio_settings *rs = cbd->user;
struct radio_data *rd = ofono_radio_settings_get_data(rs);
ofono_radio_settings_rat_mode_set_cb_t cb = cbd->cb;
if (message->error == RIL_E_SUCCESS) {
g_ril_print_response_no_args(rd->ril, message);
CALLBACK_WITH_SUCCESS(cb, cbd->data);
} else {
ofono_error("%s: rat mode setting failed", __func__);
CALLBACK_WITH_FAILURE(cb, cbd->data);
}
}
示例10: ril_read_imsi
static void ril_read_imsi(struct ofono_sim *sim, ofono_sim_imsi_cb_t cb,
void *data)
{
struct sim_data *sd = ofono_sim_get_data(sim);
struct cb_data *cbd = cb_data_new(cb, data, sd);
struct parcel rilp;
g_ril_request_read_imsi(sd->ril, sd->aid_str, &rilp);
if (g_ril_send(sd->ril, RIL_REQUEST_GET_IMSI, &rilp,
ril_imsi_cb, cbd, g_free) == 0) {
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, NULL, data);
}
}
示例11: ril_ussd_cancel
static void ril_ussd_cancel(struct ofono_ussd *ussd,
ofono_ussd_cb_t cb, void *user_data)
{
struct ussd_data *ud = ofono_ussd_get_data(ussd);
struct cb_data *cbd = cb_data_new(cb, user_data, ussd);
int ret;
ret = g_ril_send(ud->ril, RIL_REQUEST_CANCEL_USSD, NULL,
ril_ussd_cancel_cb, cbd, g_free);
if (ret <= 0) {
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, user_data);
}
}
示例12: at_discover_apps_cb
static void at_discover_apps_cb(gboolean ok, GAtResult *result,
gpointer user_data)
{
struct cb_data *cbd = user_data;
GAtResultIter iter;
ofono_sim_list_apps_cb_t cb = cbd->cb;
struct ofono_error error;
const unsigned char *dataobj;
gint linelen;
unsigned char *buffer;
int len;
decode_at_error(&error, g_at_result_final_response(result));
if (!ok) {
cb(&error, NULL, 0, cbd->data);
return;
}
g_at_result_iter_init(&iter, result);
len = 0;
while (g_at_result_iter_next(&iter, "+CUAD:")) {
if (!g_at_result_iter_next_hexstring(&iter, NULL, &linelen))
goto error;
len += linelen;
}
g_at_result_iter_init(&iter, result);
buffer = g_malloc(len);
len = 0;
while (g_at_result_iter_next(&iter, "+CUAD:")) {
g_at_result_iter_next_hexstring(&iter, &dataobj, &linelen);
memcpy(buffer + len, dataobj, linelen);
len += linelen;
}
cb(&error, buffer, len, cbd->data);
g_free(buffer);
return;
error:
CALLBACK_WITH_FAILURE(cb, NULL, 0, cbd->data);
}
示例13: ril_registration
static void ril_registration(struct ofono_call_forwarding *cf, int type,
int cls,
const struct ofono_phone_number *number,
int time, ofono_call_forwarding_set_cb_t cb,
void *data)
{
struct forw_data *fd = ofono_call_forwarding_get_data(cf);
struct cb_data *cbd = cb_data_new(cb, data);
struct parcel rilp;
int ret = 0;
ofono_info("cf registration");
parcel_init(&rilp);
parcel_w_int32(&rilp, CF_ACTION_REGISTRATION);
parcel_w_int32(&rilp, type);
/*
* Modem seems to respond with error to all queries
* or settings made with bearer class
* BEARER_CLASS_DEFAULT. Design decision: If given
* class is BEARER_CLASS_DEFAULT let's map it to
* SERVICE_CLASS_NONE as with it e.g. ./send-ussd '*21*<phone_number>#'
* returns cls:53 i.e. 1+4+16+32 as service class.
*/
if (cls == BEARER_CLASS_DEFAULT)
cls = SERVICE_CLASS_NONE;
parcel_w_int32(&rilp, cls);
parcel_w_int32(&rilp, number->type);
parcel_w_string(&rilp, (char *) number->number);
parcel_w_int32(&rilp, time);
ret = g_ril_send(fd->ril, RIL_REQUEST_SET_CALL_FORWARD,
rilp.data, rilp.size, ril_set_forward_cb, cbd, g_free);
/* In case of error free cbd and return the cb with failure */
if (ret <= 0) {
ofono_error("CF registration failed");
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, data);
}
}
示例14: cgact_disable_cb
static void cgact_disable_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct ofono_gprs_context *gc = user_data;
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
DBG("ok %d", ok);
if (!ok) {
CALLBACK_WITH_FAILURE(gcd->cb, gcd->cb_data);
return;
}
gcd->active_context = 0;
CALLBACK_WITH_SUCCESS(gcd->cb, gcd->cb_data);
}
示例15: hfp_signal_strength
static void hfp_signal_strength(struct ofono_netreg *netreg,
ofono_netreg_strength_cb_t cb, void *data)
{
struct netreg_data *nd = ofono_netreg_get_data(netreg);
struct cb_data *cbd = cb_data_new(cb, data);
cbd->user = netreg;
if (g_at_chat_send(nd->chat, "AT+CIND?", cind_prefix,
signal_strength_cb, cbd, g_free) > 0)
return;
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, -1, data);
}