void CAboutDlg::OnShowWindow(BOOL bShow, UINT nStatus) { CString txt; CDialog::OnShowWindow(bShow, nStatus); txt = "Built "; txt = txt + __TIME__; txt = txt + " "; txt = txt + __DATE__; if (strlen(GetCompiler()) != 0) { txt = txt + " in "; txt = txt + GetCompiler(); } SetDlgItemText (IDC_STATIC3, txt); txt = "Using Gammu "; txt = txt + VERSION; SetDlgItemText (IDC_STATIC4, txt); txt = "Using MySQL library "; txt = txt + mysql_get_client_info(); SetDlgItemText (IDC_STATIC5, txt); txt = ""; if (strlen(GetOS()) != 0) { txt = "Run on "; txt = txt + GetOS(); } SetDlgItemText (IDC_STATIC6, txt); }
wxString CompilerFactory::GetCompilerVersionString(const wxString& Id) { wxString Version; if (const Compiler* pCompiler = GetCompiler(Id)) Version = pCompiler->GetVersionString(); return Version; }
bool CompilerFactory::CompilerInheritsFrom(Compiler* compiler, const wxString& from_id) { if (!compiler) return false; wxString id = compiler->GetID(); if (id.Matches(from_id)) return true; while (compiler) { id = compiler->GetParentID(); if (id.Matches(from_id)) return true; // traverse up the chain Compiler* newcompiler = GetCompiler(id); if (compiler == newcompiler) { Manager::Get()->GetLogManager()->DebugLog(_T("Compiler circular dependency detected?!?!?")); break; } compiler = newcompiler; } return false; }
void CompilersFoundDlg::OnItemActivated(wxDataViewEvent& event) { CompilerPtr compiler = GetCompiler(event.GetItem()); if(compiler) { m_defaultCompilers.erase(compiler->GetCompilerFamily()); compiler->SetIsDefault(true); m_defaultCompilers.insert(std::make_pair(compiler->GetCompilerFamily(), compiler)); m_dataview->UnselectAll(); m_dataview->CallAfter(&wxDataViewCtrl::Refresh, true, (const wxRect*)NULL); MSWUpdateToolchain(compiler); } }
void CompilerFactory::RegisterUserCompilers() { ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("compiler")); wxArrayString paths = cfg->EnumerateSubPaths(_T("/user_sets")); for (unsigned int i = 0; i < paths.GetCount(); ++i) { wxString base = _T("/user_sets/") + paths[i]; wxString parent = cfg->Read(base + _T("/parent"), wxEmptyString); if (!parent.IsEmpty()) { Compiler* compiler = GetCompiler(parent); wxString name = cfg->Read(base + _T("/name"), wxEmptyString); CreateCompilerCopy(compiler, name); } } }
FileType CompilerFactory::GetFileTypeByCompilerTool(wxString& fileExt, const wxString& cmpId ) { if(const Compiler* pCompiler = GetCompiler(cmpId)) { int result; CompilerTool ct = pCompiler->GetCompilerTool(fileExt, &result); if(result != -1) { if( ct == pCompiler->GetCompilerTool(ctCompileObjectCmd)) return ftSource; if( ct == pCompiler->GetCompilerTool(ctCompileCppObjectCmd)) return ftSource; if( ct == pCompiler->GetCompilerTool(ctAssembleObjectCmd)) return ftAssembler; } } return ftOther; }
NORETURN void version(void) { printf("Gammu-smsd-monitor version %s\n", VERSION); printf("Built %s on %s using %s\n", __TIME__, __DATE__, GetCompiler()); printf("Compiled in features:\n"); printf("OS support:\n"); #ifdef HAVE_SHM printf(" - %s\n", "SHM"); #endif #ifdef HAVE_GETOPT printf(" - %s\n", "GETOPT"); #endif #ifdef HAVE_GETOPT_LONG printf(" - %s\n", "GETOPT_LONG"); #endif printf("Backend services:\n"); printf(" - %s\n", "NULL"); printf(" - %s\n", "FILES"); #ifdef HAVE_MYSQL_MYSQL_H printf(" - %s\n", "MYSQL"); #endif #ifdef HAVE_POSTGRESQL_LIBPQ_FE_H printf(" - %s\n", "POSTGRESQL"); #endif #ifdef LIBDBI_FOUND printf(" - %s\n", "DBI"); #endif printf("\n"); printf("Copyright (C) 2003 - 2010 Michal Cihar <*****@*****.**> and other authors.\n"); printf("\n"); printf("License GPLv2: GNU GPL version 2 <http://creativecommons.org/licenses/GPL/2.0/>.\n"); printf("This is free software: you are free to change and redistribute it.\n"); printf("There is NO WARRANTY, to the extent permitted by law.\n"); printf("\n"); printf("Check <http://wammu.eu/gammu/> for updates.\n"); printf("\n"); exit(0); }
static SQL_Error SMSDSQL_NamedQuery(GSM_SMSDConfig * Config, const char *sql_query, GSM_SMSMessage *sms, const SQL_Var *params, SQL_result * res) { char buff[65536], *ptr, c, static_buff[8192]; char *buffer2, *end; const char *to_print, *q = sql_query; int int_to_print; int numeric; int n, argc = 0; struct GSM_SMSDdbobj *db = Config->db; if (params != NULL) { while (params[argc].type != SQL_TYPE_NONE) argc++; } ptr = buff; do { if (*q != '%') { *ptr++ = *q; continue; } c = *(++q); if( c >= '0' && c <= '9'){ n = strtoul(q, &end, 10) - 1; if (n < argc && n >= 0) { switch(params[n].type){ case SQL_TYPE_INT: ptr += sprintf(ptr, "%i", params[n].v.i); break; case SQL_TYPE_STRING: buffer2 = db->QuoteString(Config, params[n].v.s); memcpy(ptr, buffer2, strlen(buffer2)); ptr += strlen(buffer2); free(buffer2); break; default: SMSD_Log(DEBUG_ERROR, Config, "SQL: unknown type: %i (application bug) in query: `%s`", params[n].type, sql_query); return SQL_BUG; break; } } else { SMSD_Log(DEBUG_ERROR, Config, "SQL: wrong number of parameter: %i (max %i) in query: `%s`", n+1, argc, sql_query); return SQL_BUG; } q = end - 1; continue; } numeric = 0; to_print = NULL; switch (c) { case 'I': to_print = Config->Status->IMEI; break; case 'P': to_print = Config->PhoneID; break; case 'N': snprintf(static_buff, sizeof(static_buff), "Gammu %s, %s, %s", GAMMU_VERSION, GetOS(), GetCompiler()); to_print = static_buff; break; case 'A': to_print = Config->CreatorID; break; default: if (sms != NULL) { switch (c) { case 'R': EncodeUTF8(static_buff, sms->Number); to_print = static_buff; break; case 'F': EncodeUTF8(static_buff, sms->SMSC.Number); to_print = static_buff; break; case 'u': if (sms->UDH.Type != UDH_NoUDH) { EncodeHexBin(static_buff, sms->UDH.Text, sms->UDH.Length); to_print = static_buff; }else{ to_print = ""; } break; case 'x': int_to_print = sms->Class; numeric = 1; break; case 'c': to_print = GSM_SMSCodingToString(sms->Coding); break; case 't': int_to_print = sms->MessageReference; numeric = 1; break; case 'E': switch (sms->Coding) { case SMS_Coding_Unicode_No_Compression: case SMS_Coding_Default_No_Compression: EncodeHexUnicode(static_buff, sms->Text, UnicodeLength(sms->Text)); break; case SMS_Coding_8bit: EncodeHexBin(static_buff, sms->Text, sms->Length); break; default: *static_buff = '\0'; break; } to_print = static_buff; break; case 'T': switch (sms->Coding) { case SMS_Coding_Unicode_No_Compression: case SMS_Coding_Default_No_Compression: EncodeUTF8(static_buff, sms->Text); to_print = static_buff; break; default: to_print = ""; break; } break; case 'V': if (sms->SMSC.Validity.Format == SMS_Validity_RelativeFormat) { int_to_print = sms->SMSC.Validity.Relative; } else { int_to_print = -1; } numeric = 1; break; case 'C': SMSDSQL_Time2String(Config, Fill_Time_T(sms->SMSCTime), static_buff, sizeof(static_buff)); to_print = static_buff; break; case 'd': SMSDSQL_Time2String(Config, Fill_Time_T(sms->DateTime), static_buff, sizeof(static_buff)); to_print = static_buff; break; case 'e': int_to_print = sms->DeliveryStatus; numeric = 1; break; default: SMSD_Log(DEBUG_ERROR, Config, "SQL: uexpected char '%c' in query: %s", c, sql_query); return SQL_BUG; } /* end of switch */ } else { SMSD_Log(DEBUG_ERROR, Config, "Syntax error in query.. uexpected char '%c' in query: %s", c, sql_query); return SQL_BUG; } break; } /* end of switch */ if (numeric) { ptr += sprintf(ptr, "%i", int_to_print); } else if (to_print != NULL) { buffer2 = db->QuoteString(Config, to_print); memcpy(ptr, buffer2, strlen(buffer2)); ptr += strlen(buffer2); free(buffer2); } else { memcpy(ptr, "NULL", 4); ptr += 4; } } while (*(++q) != '\0'); *ptr = '\0'; return SMSDSQL_Query(Config, buff, res); }
void DoBackup(int argc, char *argv[]) { GSM_Error error = ERR_NONE; int i, used; GSM_ToDoEntry ToDo; GSM_ToDoStatus ToDoStatus; GSM_CalendarEntry Calendar; GSM_Bitmap Bitmap; GSM_WAPBookmark Bookmark; GSM_Profile Profile; GSM_MultiWAPSettings Settings; GSM_SyncMLSettings SyncML; GSM_ChatSettings Chat; GSM_Ringtone Ringtone; GSM_SMSC SMSC; GSM_Backup Backup; GSM_NoteEntry Note; GSM_Backup_Info Info; GSM_FMStation FMStation; GSM_GPRSAccessPoint GPRSPoint; gboolean DoBackupPart; char buffer[GSM_MAX_INFO_LENGTH]; if (argc == 4 && strcasecmp(argv[3],"-yes") == 0) always_answer_yes = TRUE; GSM_ClearBackup(&Backup); GSM_GetBackupFormatFeatures(GSM_GuessBackupFormat(argv[2], FALSE),&Info); sprintf(Backup.Creator,"Gammu %s",VERSION); if (strlen(GetOS()) != 0) { strcat(Backup.Creator+strlen(Backup.Creator),", "); strcat(Backup.Creator+strlen(Backup.Creator),GetOS()); } if (strlen(GetCompiler()) != 0) { strcat(Backup.Creator+strlen(Backup.Creator),", "); strcat(Backup.Creator+strlen(Backup.Creator),GetCompiler()); } signal(SIGINT, interrupt); fprintf(stderr, "%s\n", _("Press Ctrl+C to break...")); GSM_Init(TRUE); if (Info.UseUnicode) { Info.UseUnicode=answer_yes("%s", _("Use Unicode subformat of backup file?")); } if (Info.DateTime) { GSM_GetCurrentDateTime (&Backup.DateTime); Backup.DateTimeAvailable=TRUE; } if (Info.Model) { error=GSM_GetManufacturer(gsm, Backup.Model); Print_Error(error); strcat(Backup.Model," "); error=GSM_GetModel(gsm, buffer); strcat(Backup.Model, buffer); if (GSM_GetModelInfo(gsm)->model[0]!=0) { strcat(Backup.Model," ("); strcat(Backup.Model,GSM_GetModelInfo(gsm)->model); strcat(Backup.Model,")"); } strcat(Backup.Model," "); error=GSM_GetFirmware(gsm, buffer, NULL, NULL); strcat(Backup.Model,buffer); } if (Info.IMEI) { error=GSM_GetIMEI(gsm, Backup.IMEI); if (error != ERR_NOTSUPPORTED) { Print_Error(error); } else { Backup.IMEI[0] = 0; } } printf("\n"); if (Info.PhonePhonebook) { printf("%s\n", _("Checking phone phonebook")); ReadPhonebook(Backup.PhonePhonebook, MEM_ME, _("Backup phone phonebook?"), GSM_BACKUP_MAX_PHONEPHONEBOOK); } if (Info.SIMPhonebook) { printf("%s\n", _("Checking SIM phonebook")); ReadPhonebook(Backup.SIMPhonebook, MEM_SM, _("Backup SIM phonebook?"), GSM_BACKUP_MAX_SIMPHONEBOOK); } DoBackupPart = FALSE; if (Info.Calendar) { printf("%s\n", _("Checking phone calendar")); Calendar.Location = 0; error=GSM_GetNextCalendar(gsm,&Calendar,TRUE); if (error==ERR_NONE) { if (answer_yes(" %s", _("Backup phone calendar notes?"))) DoBackupPart = TRUE; } } if (DoBackupPart) { used = 0; fprintf(stderr, LISTFORMAT, _("Reading")); while (error == ERR_NONE) { if (used < GSM_MAXCALENDARTODONOTES) { Backup.Calendar[used] = malloc(sizeof(GSM_CalendarEntry)); if (Backup.Calendar[used] == NULL) Print_Error(ERR_MOREMEMORY); Backup.Calendar[used+1] = NULL; } else { printf("\n "); printf(_("Only part of data saved, please increase %s.") , "GSM_MAXCALENDARTODONOTES"); printf("\n"); break; } *Backup.Calendar[used]=Calendar; used ++; error=GSM_GetNextCalendar(gsm,&Calendar,FALSE); fprintf(stderr, "*"); if (gshutdown) { GSM_Terminate(); Terminate(4); } } fprintf(stderr, "\n"); fflush(stderr); } DoBackupPart = FALSE; if (Info.ToDo) { printf("%s\n", _("Checking phone todos")); error=GSM_GetToDoStatus(gsm,&ToDoStatus); if (error == ERR_NONE && ToDoStatus.Used != 0) { if (answer_yes(" %s", _("Backup phone todos?"))) DoBackupPart = TRUE; } } if (DoBackupPart) { used = 0; ToDo.Location = 0; error=GSM_GetNextToDo(gsm,&ToDo,TRUE); while (error == ERR_NONE) { if (used < GSM_MAXCALENDARTODONOTES) { Backup.ToDo[used] = malloc(sizeof(GSM_ToDoEntry)); if (Backup.ToDo[used] == NULL) Print_Error(ERR_MOREMEMORY); Backup.ToDo[used+1] = NULL; } else { printf("\n "); printf(_("Only part of data saved, please increase %s.") , "GSM_MAXCALENDARTODONOTES"); printf("\n"); break; } *Backup.ToDo[used]=ToDo; used ++; error=GSM_GetNextToDo(gsm,&ToDo,FALSE); fprintf(stderr, "\r "); fprintf(stderr, "%s ", _("Reading:")); fprintf(stderr, _("%i percent"), used * 100 / ToDoStatus.Used); if (gshutdown) { GSM_Terminate(); Terminate(4); } } fprintf(stderr, "\n"); } DoBackupPart = FALSE; if (Info.Note) { printf("%s\n", _("Checking phone notes")); Note.Location = 0; error=GSM_GetNextNote(gsm,&Note,TRUE); if (error==ERR_NONE) { if (answer_yes(" %s", _("Backup phone notes?"))) DoBackupPart = TRUE; } } if (DoBackupPart) { used = 0; fprintf(stderr, LISTFORMAT, _("Reading")); while (error == ERR_NONE) { if (used < GSM_BACKUP_MAX_NOTE) { Backup.Note[used] = malloc(sizeof(GSM_NoteEntry)); if (Backup.Note[used] == NULL) Print_Error(ERR_MOREMEMORY); Backup.Note[used+1] = NULL; } else { printf("\n "); printf(_("Only part of data saved, please increase %s.") , "GSM_BACKUP_MAX_NOTE"); printf("\n"); break; } *Backup.Note[used]=Note; used ++; error=GSM_GetNextNote(gsm,&Note,FALSE); fprintf(stderr, "*"); if (gshutdown) { GSM_Terminate(); Terminate(4); } } fprintf(stderr, "\n"); fflush(stderr); } DoBackupPart = FALSE; if (Info.CallerLogos) { printf("%s\n", _("Checking phone caller logos")); Bitmap.Type = GSM_CallerGroupLogo; Bitmap.Location = 1; error=GSM_GetBitmap(gsm,&Bitmap); if (error == ERR_NONE) { if (answer_yes(" %s", _("Backup phone caller groups and logos?"))) DoBackupPart = TRUE; } } if (DoBackupPart) { fprintf(stderr, LISTFORMAT, _("Reading")); error = ERR_NONE; used = 0; while (error == ERR_NONE) { if (used < GSM_BACKUP_MAX_CALLER) { Backup.CallerLogos[used] = malloc(sizeof(GSM_Bitmap)); if (Backup.CallerLogos[used] == NULL) Print_Error(ERR_MOREMEMORY); Backup.CallerLogos[used+1] = NULL; } else { printf("\n "); printf(_("Only part of data saved, please increase %s.") , "GSM_BACKUP_MAX_CALLER"); printf("\n"); break; } *Backup.CallerLogos[used] = Bitmap; used ++; Bitmap.Location = used + 1; error=GSM_GetBitmap(gsm,&Bitmap); fprintf(stderr, "*"); if (gshutdown) { GSM_Terminate(); Terminate(4); } } fprintf(stderr, "\n"); fflush(stderr); } DoBackupPart = FALSE; if (Info.SMSC) { printf("%s\n", _("Checking SIM SMS profiles")); if (answer_yes(" %s", _("Backup SIM SMS profiles?"))) DoBackupPart = TRUE; } if (DoBackupPart) { used = 0; fprintf(stderr, LISTFORMAT, _("Reading")); while (TRUE) { SMSC.Location = used + 1; error = GSM_GetSMSC(gsm,&SMSC); if (error != ERR_NONE) break; if (used < GSM_BACKUP_MAX_SMSC) { Backup.SMSC[used] = malloc(sizeof(GSM_SMSC)); if (Backup.SMSC[used] == NULL) Print_Error(ERR_MOREMEMORY); Backup.SMSC[used + 1] = NULL; } else { printf("\n "); printf(_("Only part of data saved, please increase %s.") , "GSM_BACKUP_MAX_SMSC"); printf("\n"); break; } *Backup.SMSC[used]=SMSC; used++; fprintf(stderr, "*"); } fprintf(stderr, "\n"); fflush(stderr); } DoBackupPart = FALSE; if (Info.StartupLogo) { printf("%s\n", _("Checking phone startup text")); Bitmap.Type = GSM_WelcomeNote_Text; error = GSM_GetBitmap(gsm,&Bitmap); if (error == ERR_NONE) { if (answer_yes(" %s", _("Backup phone startup logo/text?"))) DoBackupPart = TRUE; } } if (DoBackupPart) { Backup.StartupLogo = malloc(sizeof(GSM_Bitmap)); if (Backup.StartupLogo == NULL) Print_Error(ERR_MOREMEMORY); *Backup.StartupLogo = Bitmap; if (Bitmap.Text[0]==0 && Bitmap.Text[1]==0) { Bitmap.Type = GSM_StartupLogo; error = GSM_GetBitmap(gsm,&Bitmap); if (error == ERR_NONE) *Backup.StartupLogo = Bitmap; } } DoBackupPart = FALSE; if (Info.OperatorLogo) { printf("%s\n", _("Checking phone operator logo")); Bitmap.Type = GSM_OperatorLogo; error=GSM_GetBitmap(gsm,&Bitmap); if (error == ERR_NONE) { if (strcmp(Bitmap.NetworkCode,"000 00")!=0) { if (answer_yes(" %s", _("Backup phone operator logo?"))) DoBackupPart = TRUE; } } } if (DoBackupPart) { Backup.OperatorLogo = malloc(sizeof(GSM_Bitmap)); if (Backup.OperatorLogo == NULL) Print_Error(ERR_MOREMEMORY); *Backup.OperatorLogo = Bitmap; } DoBackupPart = FALSE; if (Info.WAPBookmark) { printf("%s\n", _("Checking phone WAP bookmarks")); Bookmark.Location = 1; error=GSM_GetWAPBookmark(gsm,&Bookmark); if (error==ERR_NONE) { if (answer_yes(" %s", _("Backup phone WAP bookmarks?"))) DoBackupPart = TRUE; } } if (DoBackupPart) { used = 0; fprintf(stderr, LISTFORMAT, _("Reading")); error = ERR_NONE; while (error == ERR_NONE) { if (used < GSM_BACKUP_MAX_WAPBOOKMARK) { Backup.WAPBookmark[used] = malloc(sizeof(GSM_WAPBookmark)); if (Backup.WAPBookmark[used] == NULL) Print_Error(ERR_MOREMEMORY); Backup.WAPBookmark[used+1] = NULL; } else { printf("\n "); printf(_("Only part of data saved, please increase %s.") , "GSM_BACKUP_MAX_WAPBOOKMARK"); printf("\n"); break; } *Backup.WAPBookmark[used]=Bookmark; used ++; Bookmark.Location = used+1; error=GSM_GetWAPBookmark(gsm,&Bookmark); fprintf(stderr, "*"); if (gshutdown) { GSM_Terminate(); Terminate(4); } } fprintf(stderr, "\n"); fflush(stderr); } DoBackupPart = FALSE; if (Info.WAPSettings) { printf("%s\n", _("Checking phone WAP settings")); Settings.Location = 1; error=GSM_GetWAPSettings(gsm,&Settings); if (error==ERR_NONE) { if (answer_yes(" %s", _("Backup phone WAP settings?"))) DoBackupPart = TRUE; } } if (DoBackupPart) { used = 0; fprintf(stderr, LISTFORMAT, _("Reading")); error = ERR_NONE; while (error == ERR_NONE) { if (used < GSM_BACKUP_MAX_WAPSETTINGS) { Backup.WAPSettings[used] = malloc(sizeof(GSM_MultiWAPSettings)); if (Backup.WAPSettings[used] == NULL) Print_Error(ERR_MOREMEMORY); Backup.WAPSettings[used+1] = NULL; } else { printf("\n "); printf(_("Only part of data saved, please increase %s.") , "GSM_BACKUP_MAX_WAPSETTINGS"); printf("\n"); break; } *Backup.WAPSettings[used]=Settings; used ++; Settings.Location = used+1; error=GSM_GetWAPSettings(gsm,&Settings); fprintf(stderr, "*"); if (gshutdown) { GSM_Terminate(); Terminate(4); } } fprintf(stderr, "\n"); fflush(stderr); } DoBackupPart = FALSE; if (Info.MMSSettings) { printf("%s\n", _("Checking phone MMS settings")); Settings.Location = 1; error=GSM_GetMMSSettings(gsm,&Settings); if (error==ERR_NONE) { if (answer_yes(" %s", _("Backup phone MMS settings?"))) DoBackupPart = TRUE; } } if (DoBackupPart) { used = 0; fprintf(stderr, LISTFORMAT, _("Reading")); error = ERR_NONE; while (error == ERR_NONE) { if (used < GSM_BACKUP_MAX_MMSSETTINGS) { Backup.MMSSettings[used] = malloc(sizeof(GSM_MultiWAPSettings)); if (Backup.MMSSettings[used] == NULL) Print_Error(ERR_MOREMEMORY); Backup.MMSSettings[used+1] = NULL; } else { printf("\n "); printf(_("Only part of data saved, please increase %s.") , "GSM_BACKUP_MAX_MMSSETTINGS"); printf("\n"); break; } *Backup.MMSSettings[used]=Settings; used ++; Settings.Location = used+1; error=GSM_GetMMSSettings(gsm,&Settings); fprintf(stderr, "*"); if (gshutdown) { GSM_Terminate(); Terminate(4); } } fprintf(stderr, "\n"); fflush(stderr); } DoBackupPart = FALSE; if (Info.ChatSettings) { printf("%s\n", _("Checking phone Chat settings")); Chat.Location = 1; error=GSM_GetChatSettings(gsm,&Chat); if (error==ERR_NONE) { if (answer_yes(" %s", _("Backup phone Chat settings?"))) DoBackupPart = TRUE; } } if (DoBackupPart) { used = 0; fprintf(stderr, LISTFORMAT, _("Reading")); error = ERR_NONE; while (error == ERR_NONE) { if (used < GSM_BACKUP_MAX_CHATSETTINGS) { Backup.ChatSettings[used] = malloc(sizeof(GSM_ChatSettings)); if (Backup.ChatSettings[used] == NULL) Print_Error(ERR_MOREMEMORY); Backup.ChatSettings[used+1] = NULL; } else { printf("\n "); printf(_("Only part of data saved, please increase %s.") , "GSM_BACKUP_MAX_CHATSETTINGS"); printf("\n"); break; } *Backup.ChatSettings[used]=Chat; used ++; Chat.Location = used+1; error=GSM_GetChatSettings(gsm,&Chat); fprintf(stderr, "*"); if (gshutdown) { GSM_Terminate(); Terminate(4); } } fprintf(stderr, "\n"); fflush(stderr); } DoBackupPart = FALSE; if (Info.SyncMLSettings) { printf("%s\n", _("Checking phone SyncML settings")); SyncML.Location = 1; error=GSM_GetSyncMLSettings(gsm,&SyncML); if (error==ERR_NONE) { if (answer_yes(" %s", _("Backup phone SyncML settings?"))) DoBackupPart = TRUE; } } if (DoBackupPart) { used = 0; fprintf(stderr, LISTFORMAT, _("Reading")); while (error == ERR_NONE) { if (used < GSM_BACKUP_MAX_SYNCMLSETTINGS) { Backup.SyncMLSettings[used] = malloc(sizeof(GSM_SyncMLSettings)); if (Backup.SyncMLSettings[used] == NULL) Print_Error(ERR_MOREMEMORY); Backup.SyncMLSettings[used+1] = NULL; } else { printf("\n "); printf(_("Only part of data saved, please increase %s.") , "GSM_BACKUP_MAX_SYNCMLSETTINGS"); printf("\n"); break; } *Backup.SyncMLSettings[used]=SyncML; used ++; SyncML.Location = used+1; error=GSM_GetSyncMLSettings(gsm,&SyncML); fprintf(stderr, "*"); if (gshutdown) { GSM_Terminate(); Terminate(4); } } fprintf(stderr, "\n"); fflush(stderr); } DoBackupPart = FALSE; if (Info.Ringtone) { printf("%s\n", _("Checking phone user ringtones")); Ringtone.Location = 1; Ringtone.Format = 0; error=GSM_GetRingtone(gsm,&Ringtone,FALSE); if (error==ERR_EMPTY || error == ERR_NONE) { if (answer_yes(" %s", _("Backup phone user ringtones?"))) DoBackupPart = TRUE; } } if (DoBackupPart) { used = 0; i = 1; fprintf(stderr, LISTFORMAT, _("Reading")); error = ERR_NONE; while (error == ERR_NONE || error == ERR_EMPTY) { if (error == ERR_NONE) { if (used < GSM_BACKUP_MAX_RINGTONES) { Backup.Ringtone[used] = malloc(sizeof(GSM_Ringtone)); if (Backup.Ringtone[used] == NULL) Print_Error(ERR_MOREMEMORY); Backup.Ringtone[used+1] = NULL; } else { printf("\n "); printf(_("Only part of data saved, please increase %s.") , "GSM_BACKUP_MAX_RINGTONES"); printf("\n"); break; } *Backup.Ringtone[used]=Ringtone; used ++; } i++; Ringtone.Location = i; Ringtone.Format = 0; error=GSM_GetRingtone(gsm,&Ringtone,FALSE); fprintf(stderr, "*"); if (gshutdown) { GSM_Terminate(); Terminate(4); } } fprintf(stderr, "\n"); fflush(stderr); } DoBackupPart = FALSE; if (Info.Profiles) { printf("%s\n", _("Checking phone profiles")); Profile.Location = 1; error = GSM_GetProfile(gsm,&Profile); if (error == ERR_NONE) { if (answer_yes(" %s", _("Backup phone profiles?"))) DoBackupPart = TRUE; } } if (DoBackupPart) { used = 0; fprintf(stderr, LISTFORMAT, _("Reading")); while (TRUE) { Profile.Location = used + 1; error = GSM_GetProfile(gsm,&Profile); if (error != ERR_NONE) break; if (used < GSM_BACKUP_MAX_PROFILES) { Backup.Profiles[used] = malloc(sizeof(GSM_Profile)); if (Backup.Profiles[used] == NULL) Print_Error(ERR_MOREMEMORY); Backup.Profiles[used + 1] = NULL; } else { printf("\n "); printf(_("Only part of data saved, please increase %s.") , "GSM_BACKUP_MAX_PROFILES"); printf("\n"); break; } *Backup.Profiles[used]=Profile; used++; fprintf(stderr, "*"); } fprintf(stderr, "\n"); fflush(stderr); } DoBackupPart = FALSE; if (Info.FMStation) { printf("%s\n", _("Checking phone FM radio stations")); FMStation.Location = 1; error = GSM_GetFMStation(gsm,&FMStation); if (error == ERR_NONE || error == ERR_EMPTY) { if (answer_yes(" %s", _("Backup phone FM radio stations?"))) DoBackupPart=TRUE; } } if (DoBackupPart) { used = 0; i = 1; fprintf(stderr, LISTFORMAT, _("Reading")); error = ERR_NONE; while (error == ERR_NONE || error == ERR_EMPTY) { error = GSM_GetFMStation(gsm,&FMStation); if (error == ERR_NONE) { if (used < GSM_BACKUP_MAX_FMSTATIONS) { Backup.FMStation[used] = malloc(sizeof(GSM_FMStation)); if (Backup.FMStation[used] == NULL) Print_Error(ERR_MOREMEMORY); Backup.FMStation[used + 1] = NULL; } else { printf("\n "); printf(_("Only part of data saved, please increase %s.") , "GSM_BACKUP_MAX_FMSTATIONS"); printf("\n"); break; } *Backup.FMStation[used]=FMStation; used++; } i++; FMStation.Location = i; fprintf(stderr, "*"); } fprintf(stderr, "\n"); fflush(stderr); } DoBackupPart = FALSE; if (Info.GPRSPoint) { printf("%s\n", _("Checking phone GPRS access points")); GPRSPoint.Location = 1; error = GSM_GetGPRSAccessPoint(gsm,&GPRSPoint); if (error == ERR_NONE || error == ERR_EMPTY) { if (answer_yes(" %s", _("Backup phone GPRS access points?"))) DoBackupPart = TRUE; } } if (DoBackupPart) { used = 0; i = 1; fprintf(stderr, LISTFORMAT, _("Reading")); error = ERR_NONE; while (error == ERR_NONE || error == ERR_EMPTY) { error = GSM_GetGPRSAccessPoint(gsm,&GPRSPoint); if (error == ERR_NONE) { if (used < GSM_BACKUP_MAX_GPRSPOINT) { Backup.GPRSPoint[used] = malloc(sizeof(GSM_GPRSAccessPoint)); if (Backup.GPRSPoint[used] == NULL) Print_Error(ERR_MOREMEMORY); Backup.GPRSPoint[used + 1] = NULL; } else { printf("\n "); printf(_("Only part of data saved, please increase %s.") , "GSM_BACKUP_MAX_GPRSPOINT"); printf("\n"); break; } *Backup.GPRSPoint[used]=GPRSPoint; used++; } i++; GPRSPoint.Location = i; fprintf(stderr, "*"); } fprintf(stderr, "\n"); fflush(stderr); } GSM_Terminate(); GSM_SaveBackupFile(argv[2], &Backup, GSM_GuessBackupFormat(argv[2], Info.UseUnicode)); GSM_FreeBackup(&Backup); }
bool CompilerFactory::CompilerInheritsFrom(const wxString& id, const wxString& from_id) { return CompilerInheritsFrom(GetCompiler(id), from_id); }
void CompilerFactory::SetDefaultCompiler(const wxString& id) { Compiler* compiler = GetCompiler(id.Lower()); SetDefaultCompiler(compiler); }
GSM_Error GSM_InitConnection_Log(GSM_StateMachine *s, int ReplyNum, GSM_Log_Function log_function, void *user_data) { GSM_Error error; GSM_DateTime current_time; int i; for (i=0;i<s->ConfigNum;i++) { s->CurrentConfig = &s->Config[i]; /* Skip non configured sections */ if (s->CurrentConfig->Connection == NULL) { smprintf_level(s, D_ERROR, "[Empty section - %d]\n", i); continue; } s->Speed = 0; s->ReplyNum = ReplyNum; s->Phone.Data.ModelInfo = GetModelData(s, "unknown", NULL, NULL); s->Phone.Data.Manufacturer[0] = 0; s->Phone.Data.Model[0] = 0; s->Phone.Data.Version[0] = 0; s->Phone.Data.VerDate[0] = 0; s->Phone.Data.VerNum = 0; s->Phone.Data.StartInfoCounter = 0; s->Phone.Data.SentMsg = NULL; s->Phone.Data.HardwareCache[0] = 0; s->Phone.Data.ProductCodeCache[0] = 0; s->Phone.Data.EnableIncomingCall = FALSE; s->Phone.Data.EnableIncomingSMS = FALSE; s->Phone.Data.EnableIncomingCB = FALSE; s->Phone.Data.EnableIncomingUSSD = FALSE; s->User.UserReplyFunctions = NULL; s->User.IncomingCall = NULL; s->User.IncomingSMS = NULL; s->User.IncomingCB = NULL; s->User.IncomingUSSD = NULL; s->User.SendSMSStatus = NULL; s->LockFile = NULL; s->opened = FALSE; s->Phone.Functions = NULL; s->di = GSM_none_debug; s->di.use_global = s->CurrentConfig->UseGlobalDebugFile; if (!s->di.use_global) { GSM_SetDebugFunction(log_function, user_data, &s->di); GSM_SetDebugLevel(s->CurrentConfig->DebugLevel, &s->di); error = GSM_SetDebugFile(s->CurrentConfig->DebugFile, &s->di); if (error != ERR_NONE) { GSM_LogError(s, "Init:GSM_SetDebugFile" , error); return error; } } smprintf_level(s, D_ERROR, "[Gammu - %s built %s %s using %s]\n", GAMMU_VERSION, __TIME__, __DATE__, GetCompiler() ); StripSpaces(s->CurrentConfig->Connection); StripSpaces(s->CurrentConfig->Model); StripSpaces(s->CurrentConfig->Device); smprintf_level(s, D_ERROR, "[Connection - \"%s\"]\n", s->CurrentConfig->Connection); smprintf_level(s, D_ERROR, "[Connection index - %d]\n", i); smprintf_level(s, D_ERROR, "[Model type - \"%s\"]\n", s->CurrentConfig->Model); smprintf_level(s, D_ERROR, "[Device - \"%s\"]\n", s->CurrentConfig->Device); if (strlen(GetOS()) != 0) { smprintf_level(s, D_ERROR, "[Running on - %s]\n", GetOS()); } if (GSM_GetDI(s)->dl == DL_BINARY) { smprintf(s,"%c",((unsigned char)strlen(GAMMU_VERSION))); smprintf(s,"%s",GAMMU_VERSION); } error = GSM_RegisterAllConnections(s, s->CurrentConfig->Connection); if (error != ERR_NONE) { GSM_LogError(s, "Init:GSM_RegisterAllConnections" , error); return error; } autodetect: /* Model auto */ /* Try to guess correct driver based on model */ if (s->CurrentConfig->Model[0] == 0 && s->ConnectionType != GCT_NONE && s->ConnectionType != GCT_IRDAOBEX && s->ConnectionType != GCT_BLUEOBEX && s->ConnectionType != GCT_BLUEGNAPBUS && s->ConnectionType != GCT_IRDAGNAPBUS && s->ConnectionType != GCT_BLUES60) { error = GSM_TryGetModel(s); /* Fall back to other configuraitons if the device is not existing (or similar error) */ if ((i != s->ConfigNum - 1) && ( (error == ERR_DEVICEOPENERROR) || (error == ERR_DEVICELOCKED) || (error == ERR_DEVICENOTEXIST) || (error == ERR_DEVICEBUSY) || (error == ERR_DEVICENOPERMISSION) || (error == ERR_DEVICENODRIVER) || (error == ERR_DEVICENOTWORK))) { GSM_CloseConnection(s); continue; } if (error != ERR_NONE) { GSM_LogError(s, "Init:GSM_TryGetModel" , error); return error; } } /* Switching to "correct" module */ error = GSM_RegisterAllPhoneModules(s); /* If user selected soemthing which is not supported, try autodetection */ if (s->CurrentConfig->Model[0] != 0 && error == ERR_UNKNOWNMODELSTRING) { smprintf(s, "Configured model %s is not known, retrying with autodetection!\n", s->CurrentConfig->Model); s->CurrentConfig->Model[0] = 0; goto autodetect; } if (error != ERR_NONE) { GSM_LogError(s, "Init:GSM_RegisterAllPhoneModules" , error); return error; } /* We didn't open device earlier ? Make it now */ if (!s->opened) { error = GSM_OpenConnection(s); if ((i != s->ConfigNum - 1) && ( (error == ERR_DEVICEOPENERROR) || (error == ERR_DEVICELOCKED) || (error == ERR_DEVICENOTEXIST) || (error == ERR_DEVICEBUSY) || (error == ERR_DEVICENOPERMISSION) || (error == ERR_DEVICENODRIVER) || (error == ERR_DEVICENOTWORK))) { GSM_CloseConnection(s); continue; } if (error != ERR_NONE) { GSM_LogError(s, "Init:GSM_OpenConnection" , error); return error; } } /* Initialize phone layer */ error=s->Phone.Functions->Initialise(s); if (error == ERR_TIMEOUT && i != s->ConfigNum - 1) { GSM_CloseConnection(s); continue; } if (error != ERR_NONE) { GSM_LogError(s, "Init:Phone->Initialise" , error); return error; } if (s->CurrentConfig->StartInfo) { s->Phone.Functions->ShowStartInfo(s,TRUE); s->Phone.Data.StartInfoCounter = 30; } if (s->CurrentConfig->SyncTime) { GSM_GetCurrentDateTime (¤t_time); s->Phone.Functions->SetDateTime(s,¤t_time); } /* For debug it's good to have firmware and real model version and manufacturer */ error=s->Phone.Functions->GetManufacturer(s); if (error == ERR_TIMEOUT && i != s->ConfigNum - 1) { GSM_CloseConnection(s); continue; } if (error != ERR_NONE && error != ERR_NOTSUPPORTED) { GSM_LogError(s, "Init:Phone->GetManufacturer" , error); return error; } error=s->Phone.Functions->GetModel(s); if (error != ERR_NONE && error != ERR_NOTSUPPORTED) { GSM_LogError(s, "Init:Phone->GetModel" , error); return error; } error=s->Phone.Functions->GetFirmware(s); if (error != ERR_NONE && error != ERR_NOTSUPPORTED) { GSM_LogError(s, "Init:Phone->GetFirmware" , error); return error; } smprintf(s,"[Connected]\n"); return ERR_NONE; } return ERR_UNCONFIGURED; }