/* Initialise GSM interface, returning gn_error as appropriate */ static gn_error VM_GSMInitialise(struct gn_statemachine *sm) { gn_error error; /* Initialise the code for the GSM interface. */ error = gn_gsm_initialise(sm); if (error != GN_ERR_NONE) fprintf(stderr, _("GSM/FBUS init failed! (Unknown model?). Quitting.\n")); return (error); }
/* pmon allows fbus code to run in a passive state - it doesn't worry about whether comms are established with the phone. A debugging/development tool. */ gn_error pmon(gn_data *data, struct gn_statemachine *state) { gn_error error; /* Initialise the code for the GSM interface. */ error = gn_gsm_initialise(state); if (error != GN_ERR_NONE) { fprintf(stderr, _("GSM/FBUS init failed! (Unknown model?). Quitting.\n")); return error; } while (1) { usleep(50000); } return GN_ERR_NONE; }
static QString businit(void) { gn_error error; char *aux; if (gn_cfg_read(&BinDir)<0 || !gn_cfg_phone_load("", &state)) return i18n("GNOKII isn't yet configured."); gn_data_clear(&data); aux = gn_cfg_get(gn_cfg_info, "global", "use_locking"); // Defaults to 'no' if (aux && !strcmp(aux, "yes")) { lockfile = gn_device_lock(state.config.port_device); if (lockfile == NULL) { return i18n("Lock file error.\n " "Please exit all other running instances of gnokii and try again."); } } // Initialise the code for the GSM interface. int old_dcd = state.config.require_dcd; // work-around for older gnokii versions state.config.require_dcd = false; error = gn_gsm_initialise(&state); GNOKII_CHECK_ERROR(error); state.config.require_dcd = old_dcd; if (error != GN_ERR_NONE) { busterminate(); return i18n("Mobile phone interface initialization failed:\n%1").arg(gn_error_print(error)); } // model gn_data_clear(&data); data.model = model; model[0] = 0; error = gn_sm_functions(GN_OP_GetModel, &data, &state); GNOKII_CHECK_ERROR(error); if (model[0] == 0) strcpy(model, i18n("unknown").utf8()); data.model = NULL; // revision data.revision = revision; revision[0] = 0; error = gn_sm_functions(GN_OP_GetRevision, &data, &state); GNOKII_CHECK_ERROR(error); data.revision = NULL; // imei data.imei = imei; imei[0] = 0; error = gn_sm_functions(GN_OP_GetImei, &data, &state); GNOKII_CHECK_ERROR(error); data.imei = NULL; GNOKII_DEBUG( QString("Found mobile phone: Model: %1, Revision: %2, IMEI: %3\n") .arg(model).arg(revision).arg(imei) ); PhoneProductId = QString("%1-%2-%3-%4").arg(APP).arg(model).arg(revision).arg(imei); return QString::null; }