static void qmi_ussd_remove(struct ofono_ussd *ussd) { struct ussd_data *data = ofono_ussd_get_data(ussd); DBG(""); ofono_ussd_set_data(ussd, NULL); qmi_service_unref(data->voice); g_free(data); }
static void qmi_sim_remove(struct ofono_sim *sim) { struct sim_data *data = ofono_sim_get_data(sim); DBG(""); ofono_sim_set_data(sim, NULL); qmi_service_unregister_all(data->dms); qmi_service_unref(data->dms); g_free(data); }
static void create_nas_cb(struct qmi_service *service, void *user_data) { struct ofono_netreg *netreg = user_data; struct netreg_data *data = ofono_netreg_get_data(netreg); struct qmi_param *param; struct qmi_nas_param_event_signal_strength ss = { .report = 0x01, .count = 5, .dbm[0] = -55, .dbm[1] = -65, .dbm[2] = -75, .dbm[3] = -85, .dbm[4] = -95 }; DBG(""); if (!service) { ofono_error("Failed to request NAS service"); ofono_netreg_remove(netreg); return; } data->nas = qmi_service_ref(service); qmi_service_register(data->nas, QMI_NAS_EVENT, event_notify, netreg, NULL); qmi_service_register(data->nas, QMI_NAS_SS_INFO_IND, ss_info_notify, netreg, NULL); param = qmi_param_new(); if (!param) goto done; qmi_param_append(param, QMI_NAS_PARAM_REPORT_SIGNAL_STRENGTH, sizeof(ss), &ss); qmi_param_append_uint8(param, QMI_NAS_PARAM_REPORT_RF_INFO, 0x01); if (qmi_service_send(data->nas, QMI_NAS_SET_EVENT, param, set_event_cb, netreg, NULL) > 0) return; qmi_param_free(param); done: ofono_netreg_register(netreg); } static int qmi_netreg_probe(struct ofono_netreg *netreg, unsigned int vendor, void *user_data) { struct qmi_device *device = user_data; struct netreg_data *data; DBG(""); data = g_new0(struct netreg_data, 1); data->operator.name[0] = '\0'; data->operator.mcc[0] = '\0'; data->operator.mnc[0] = '\0'; data->operator.status = -1; data->operator.tech = -1; data->current_rat = QMI_NAS_NETWORK_RAT_NO_CHANGE; ofono_netreg_set_data(netreg, data); qmi_service_create_shared(device, QMI_SERVICE_NAS, create_nas_cb, netreg, NULL); return 0; } static void qmi_netreg_remove(struct ofono_netreg *netreg) { struct netreg_data *data = ofono_netreg_get_data(netreg); DBG(""); ofono_netreg_set_data(netreg, NULL); qmi_service_unregister_all(data->nas); qmi_service_unref(data->nas); g_free(data); } static struct ofono_netreg_driver driver = { .name = "qmimodem", .probe = qmi_netreg_probe, .remove = qmi_netreg_remove, .registration_status = qmi_registration_status, .current_operator = qmi_current_operator, .list_operators = qmi_list_operators, .register_auto = qmi_register_auto, .register_manual = qmi_register_manual, .strength = qmi_signal_strength, }; void qmi_netreg_init(void) { ofono_netreg_driver_register(&driver); } void qmi_netreg_exit(void) { ofono_netreg_driver_unregister(&driver); }