void RealtimeTrafficInfoPluginInit () { roadmap_config_declare ("schema", &RouteInfoConfigRouteColorGood, "#fdf66b", NULL); //Yellow roadmap_config_declare ("schema", &RouteInfoConfigRouteColorMild, "#f57a24", NULL); //Orange roadmap_config_declare ("schema", &RouteInfoConfigRouteColorBad, "#FF0000", NULL); //Red roadmap_config_declare_enumeration ("preferences", &RouteInfoConfigDisplayTraffic, NULL, "yes", "no", NULL); pens[TRAFFIC_OK] = roadmap_canvas_create_pen ("RealtimeTrafficInfoPenGood"); roadmap_canvas_set_foreground (roadmap_config_get (&RouteInfoConfigRouteColorGood)); roadmap_canvas_set_thickness (TRAFFIC_PEN_WIDTH); pens[TRAFFIC_MILD] = roadmap_canvas_create_pen ("RealtimeTrafficInfoPenMild"); roadmap_canvas_set_foreground (roadmap_config_get (&RouteInfoConfigRouteColorMild)); roadmap_canvas_set_thickness (TRAFFIC_PEN_WIDTH); pens[TRAFFIC_BAD] = roadmap_canvas_create_pen ("RealtimeTrafficInfoPenBad"); roadmap_canvas_set_foreground (roadmap_config_get (&RouteInfoConfigRouteColorBad)); roadmap_canvas_set_thickness (TRAFFIC_PEN_WIDTH); speed_text_pen = roadmap_canvas_create_pen("SpeedText"); roadmap_canvas_set_foreground("#000000"); if (roadmap_config_match(&RouteInfoConfigDisplayTraffic, "yes")){ RealtimeTrafficInfoRegister(); Realtime_SendTrafficInfo(1); } }
void roadmap_voice_announce (const char *title) { int i; char text[1024]; char expanded[1024]; char *final; char *arguments; if (!featureEnabled) return; if (RoadMapVoiceMuted) { if (strcasecmp (roadmap_config_get (&RoadMapVoiceMute), "no") == 0) { RoadMapVoiceMuted = 0; } else { return; } } RoadMapVoiceActive.handler = roadmap_voice_complete; for (i = 0; RoadMapVoiceText[i].default_text != NULL; ++i) { if (strcmp (title, RoadMapVoiceText[i].config.name) == 0) { break; } } if (RoadMapVoiceText[i].default_text == NULL) { roadmap_log (ROADMAP_ERROR, "invalid voice %s", title); return; } if (!roadmap_message_format (text, sizeof(text), roadmap_config_get (&RoadMapVoiceText[i].config)) || (text[0] == 0)) { /* No message. */ return; } if (roadmap_voice_expand (text, expanded, sizeof(expanded))) { final = expanded; } else {
const char *roadmap_lang_get_default_lang(){ if (!initialized) roadmap_lang_initialize_params(); return roadmap_config_get (&RoadMapConfigDefaultLanguage); }
static void roadmap_help_make_url (const char *path) { int size; const char *options = roadmap_config_get(&RoadMapConfigBrowserOptions); char *url; size = strlen(options) + strlen(RDM_URLHEAD) + strlen(path) + strlen(RDM_MANUAL) + 8; url = malloc (size); strcpy(url, RDM_URLHEAD); strcat(url, path); strcat(url, "/" RDM_MANUAL "#%s"); if (options[0] != 0) { RoadMapHelpManual = malloc(size); sprintf (RoadMapHelpManual, options, url); free (url); } else { RoadMapHelpManual = url; } }
static void set_state () { gState = ERTVisabilityGroup_from_string (roadmap_config_get ( &RT_CFG_PRM_VISGRP_Var)); // gReportState = ERTVisabilityReport_from_string (roadmap_config_get ( // &RT_CFG_PRM_VISREP_Var)); }
void roadmap_help_menu(void){ int count = 0; const char *help_menu[10]; if (roadmap_introduction_is_available()){ help_menu[count++] = "nutshell"; help_menu[count++] = "guided_tour"; if (!strcmp(roadmap_config_get(&RoadMapConfigHelpShowWhatToExpect), "yes")) { help_menu[count++] = "what_to_expect"; } //help_menu[count++] = "geoinfo"; } help_menu[count++] = "submit_logs"; help_menu[count++] = "about"; help_menu[count++] = NULL; roadmap_list_menu_simple ("Help menu", NULL, help_menu, NULL, NULL, NULL, NULL, RoadMapStartActions, 0); }
static BOOL custom_bonus_feature_enabled (void) { if (0 == strcmp (roadmap_config_get (&RoadMapConfigCustomBonusFeatureEnabled), "yes")){ return TRUE; } return FALSE; }
static int open_data_file (void) { char *file_name; if (track_file) return 0; file_name = roadmap_path_join(roadmap_config_get(&RoadMapConfigMapPath), "track_data.bin"); track_file = roadmap_file_fopen(NULL, file_name, "a"); roadmap_path_free(file_name); if (track_file == NULL) { roadmap_messagebox("Error", "Can't open track_data"); return -1; } if (ftell(track_file) == 0) { unsigned char version[4] = {0, 10, 0, 1}; if (fwrite(version, sizeof(version), 1, track_file) != 1) { roadmap_messagebox("Error", "Can't write to track_data"); fclose(track_file); track_file = NULL; return -1; } } return 0; }
static RoadMapPen roadmap_display_new_pen (RoadMapConfigDescriptor * descriptor) { const char *color = roadmap_config_get (descriptor); if (strcasecmp (color, "#000000") != 0) { RoadMapPen pen; char pen_name[256]; if (sizeof(pen_name) < strlen(descriptor->category) + strlen(descriptor->name) + 2) { roadmap_log(ROADMAP_FATAL, "not enough space for pen name %s.%s\n", descriptor->category, descriptor->name); } strcpy (pen_name, descriptor->category); strcat (pen_name, "."); strcat (pen_name, descriptor->name); pen = roadmap_canvas_create_pen (pen_name); roadmap_canvas_set_foreground (color); return pen; } return RoadMapMessageContour; }
static BOOL roadmap_groups_tip_shown (void) { if (0 == strcmp (roadmap_config_get (&RoadMapConfigGroupsTipShown), "yes")){ return TRUE; } return FALSE; }
BOOL roadmap_groups_feature_enabled (void) { if (0 == strcmp (roadmap_config_get (&RoadMapConfigGroupsFeatureEnabled), "yes")){ return TRUE; } return FALSE; }
const char *roadmap_mood_get_top_name(){ static char mood_top[100]; roadmap_config_declare ("user", &MoodCfg, "happy", NULL); sprintf(mood_top, "top_mood_%s", roadmap_config_get (&MoodCfg)); return &mood_top[0]; }
BOOL roadmap_reminder_feature_enabled (void) { #ifdef IPHONE_NATIVE return FALSE; // Feature not ready yet for iPhone #endif //IPHONE_NATIVE if (0 == strcmp (roadmap_config_get (&RoadMapConfigFeatureEnabled), "yes_new")) return TRUE; return FALSE; }
const char *roadmap_lang_get_lang_file_update_time(const char *lang_value){ RoadMapConfigDescriptor descriptor; descriptor.category = lang_value; descriptor.name = "Update time"; roadmap_config_declare("session",&descriptor, "", NULL); return roadmap_config_get (&descriptor); }
int roadmap_groups_get_popup_config(void){ const char *conf_value; conf_value = roadmap_config_get(&RoadMapConfigGroupsPopUpReports); if (!strcmp(conf_value, POPUP_REPORT_VAL_NONE)) return POPUP_REPORT_NONE; else if (!strcmp(conf_value, POPUP_REPORT_VAL_FOLLOWING_GROUPS)) return POPUP_REPORT_FOLLOWING_GROUPS; else if (!strcmp(conf_value, POPUP_REPORT_VAL_ONLY_MAIN_GROUP)) return POPUP_REPORT_ONLY_MAIN_GROUP; else return POPUP_REPORT_NONE; }
static const char *roadmap_option_get_geometry (const char *name) { RoadMapConfigDescriptor descriptor; descriptor.category = "Geometry"; descriptor.name = name; descriptor.reference = NULL; return roadmap_config_get (&descriptor); }
int roadmap_groups_get_show_wazer_config(void){ const char *conf_value; conf_value = roadmap_config_get(&RoadMapConfigGroupsShowWazers); if (!strcmp(conf_value, SHOW_WAZER_GROUP_VAL_ALL)) return SHOW_WAZER_GROUP_ALL; else if (!strcmp(conf_value, SHOW_WAZER_GROUP_VAL_FOLLOWING)) return SHOW_WAZER_GROUP_FOLLOWING; else if (!strcmp(conf_value, SHOW_WAZER_GROUP_VAL_MAIN)) return SHOW_WAZER_GROUP_MAIN; else return SHOW_WAZER_GROUP_MAIN; }
static BOOL is_terms_accepted(void){ roadmap_config_declare_enumeration( WELCOME_WIZ_CONFIG_TYPE, &WELCOME_WIZ_TERMS_OF_USE_Var, NULL, WELCOME_WIZ_FIRST_TIME_No, WELCOME_WIZ_FIRST_TIME_Yes, NULL); if( 0 == strcmp( roadmap_config_get( &WELCOME_WIZ_TERMS_OF_USE_Var), WELCOME_WIZ_FIRST_TIME_Yes)) return TRUE; return FALSE; }
static BOOL is_first_time(void){ roadmap_config_declare_enumeration( WELCOME_WIZ_CONFIG_TYPE, &WELCOME_WIZ_FIRST_TIME_Var, NULL, WELCOME_WIZ_FIRST_TIME_Yes, WELCOME_WIZ_FIRST_TIME_No, NULL); if( 0 == strcmp( roadmap_config_get( &WELCOME_WIZ_FIRST_TIME_Var), WELCOME_WIZ_FIRST_TIME_Yes)) return TRUE; return FALSE; }
static BOOL geo_location_displayed(void){ roadmap_config_declare_enumeration( GEO_LOCATION_CONFIG_TYPE, &GEO_LOCATION_DISPLAYED_Var, NULL, GEO_LOCATION_No, GEO_LOCATION_Yes, NULL); if( 0 == strcmp( roadmap_config_get( &GEO_LOCATION_DISPLAYED_Var), GEO_LOCATION_Yes)) return TRUE; return FALSE; }
static BOOL is_show_intro_screen(void){ roadmap_config_declare_enumeration( WELCOME_WIZ_SHOW_INTRO_CONFIG_TYPE, &WELCOME_WIZ_SHOW_INTRO_SCREEN_Var, NULL, WELCOME_WIZ_SHOW_INTRO_SCREEN_No, WELCOME_WIZ_SHOW_INTRO_SCREEN_Yes, NULL); if( 0 == strcmp( roadmap_config_get( &WELCOME_WIZ_SHOW_INTRO_SCREEN_Var), WELCOME_WIZ_SHOW_INTRO_SCREEN_Yes)) return TRUE; return FALSE; }
/*********************************************************** * Name : roadmap_native_keyboard_enabled * Purpose : If the native keyboard enabled * Params : void * */ BOOL roadmap_native_keyboard_enabled( void ) { #ifdef EMBEDDED_CE return FALSE; #else if (0 == strcmp (roadmap_config_get (&RoadMapConfigUseNativeKeyboard), "yes")) return TRUE; return FALSE; #endif }
const char *roadmap_lang_get_system_lang(){ const char *lang = roadmap_config_get (&RoadMapConfigSystemLanguage); if (!initialized) roadmap_lang_initialize_params(); if (!strcmp(lang,"default")) return roadmap_lang_get_default_lang(); else return lang; }
static BOOL is_geo_location_enabled(void){ roadmap_config_declare_enumeration( GEO_LOCATION_ENABLE_CONFIG_TYPE, &GEO_LOCATION_ENABLED_Var, NULL, GEO_LOCATION_No, GEO_LOCATION_Yes, NULL); if( 0 == strcmp( roadmap_config_get( &GEO_LOCATION_ENABLED_Var), GEO_LOCATION_Yes)) return TRUE; return FALSE; }
const char *roadmap_mood_get(){ const char * mood_cfg; if (!initialized) roadmap_mood_init(); mood_cfg = roadmap_config_get (&MoodCfg); if (strstr(mood_cfg, "wazer")) return strdup(mood_cfg); else return roadmap_path_join("moods", mood_cfg); }
BOOL roadmap_splash_feature_enabled (void) { #ifdef ANDROID if ( roadmap_main_is_widget_mode() ) return FALSE; #endif if (0 == strcmp (roadmap_config_get (&RoadMapConfigSplashFeatureEnabled), "yes")) return TRUE; return FALSE; }
static BOOL is_wizard_enabled(void){ roadmap_config_declare_enumeration( WELCOME_WIZ_ENABLE_CONFIG_TYPE, &WELCOME_WIZ_ENABLED_Var, NULL, WELCOME_WIZ_FIRST_TIME_No, WELCOME_WIZ_FIRST_TIME_Yes, NULL); if( 0 == strcmp( roadmap_config_get( &WELCOME_WIZ_ENABLED_Var), WELCOME_WIZ_FIRST_TIME_Yes)) return TRUE; return FALSE; }
/* * Called once one file was sent successfully. Starts the sending of the next file, if there is one. */ static void upload_done( void *context, const char *format, ... ) { upload_context * uContext = (upload_context *)context; int new_count; char ** new_cursor; const char * target_url; char * new_full_path; char msg[500]; int total; va_list ap; if(format){ va_start(ap, format); vsnprintf(msg,sizeof(msg),format,ap); va_end(ap); roadmap_log(ROADMAP_DEBUG,"done uploading log file : %s. Received response : %s",*uContext->cursor,msg); } new_cursor = (uContext->cursor)+1; new_count = (uContext->file_num)+1; total = uContext->total; roadmap_file_remove(NULL, uContext->full_path); // remove the previous file if(new_count==total){ // finished - sent all the files! in_process = 0 ; roadmap_path_list_free(uContext->files); ssd_progress_msg_dialog_hide(); roadmap_messagebox_timeout("Thank you!!!", "Logs submitted successfully to waze",3); }else{ // still more files - call the next one upload_context * new_context; sprintf (warning_message,"%s\n%d/%d",roadmap_lang_get("Uploading logs..."),new_count+1, total); ssd_progress_msg_dialog_show(warning_message); roadmap_main_flush(); new_full_path = roadmap_path_join( roadmap_path_debug(), *new_cursor ); new_context= malloc(sizeof(upload_context)); new_context->cursor = new_cursor; new_context->files = uContext->files; new_context->full_path = new_full_path; new_context->file_num = new_count; new_context->total = total; target_url = roadmap_config_get ( &RMCfgDebugInfoServer); if ( editor_upload_auto( new_full_path, &gUploadCallbackFunctions, target_url, LOG_UPLOAD_CONTENT_TYPE,(void *)new_context) ) { roadmap_log( ROADMAP_ERROR, "File upload error. for file %s , number %d", new_full_path, new_count); roadmap_path_free(new_full_path); roadmap_path_list_free (new_context->files); ssd_progress_msg_dialog_hide(); roadmap_messagebox_timeout("Error", "Error sending files",5); in_process = 0; } } roadmap_path_free(uContext->full_path); free(uContext); }
void roadmap_help_nutshell () { int count; if (strcmp(roadmap_config_get(&RoadMapConfigHelpRollerNutshell), "yes")) { for (count = 0; nutshell_images[count] != NULL; ++count) {} roadmap_image_viewer_show(nutshell_images, count); } else { for (count = 0; nutshell_int_images[count] != NULL; ++count) {} roadmap_image_viewer_show(nutshell_int_images, count); } }
void tts_load_config( void ) { static BOOL initialized = FALSE; if ( !initialized ) { /* * Configuration declarations */ roadmap_config_declare("preferences", &RMConfigTTSEnabled, TTS_CFG_FEATURE_ENABLED_DEFAULT, NULL); roadmap_config_declare("preferences", &RMConfigTTSDefaultVoiceId, TTS_CFG_VOICE_ID_DEFAULT, NULL); roadmap_config_declare( "user", &RMConfigTTSVoiceId, TTS_CFG_VOICE_ID_NOT_DEFINED, NULL ); initialized = TRUE; } /* * Load state from the configuration */ sgTtsDefaultVoiceId = roadmap_config_get( &RMConfigTTSDefaultVoiceId ); sgTtsFeatureEnabled = !strcmp( "yes", roadmap_config_get( &RMConfigTTSEnabled ) ); sgTtsVoiceId = roadmap_config_get( &RMConfigTTSVoiceId ); }