Beispiel #1
0
static void dummy_handler(NOPH_Exception_t exception, void *arg) {
	if (arg) {
		RoadMapImage i = (RoadMapImage) arg;
		roadmap_log(ROADMAP_ERROR, "Error drawing image: %s\n", i->file_name);
	}
	NOPH_delete(exception);
}
/*************************************************************************************************
 * FreeMapNativeManager_OpenExternalBrowser
 * Loads the url to the external browser
 *
 */
void FreeMapNativeManager_OpenExternalBrowser( const char* aUrl )
{
    android_method_context_type lMthdContext;
    int retVal = -1;
    jmethodID mid;
    jstring url = NULL;

    JNI_LOG( ROADMAP_INFO, "Trying to call method %s through JNI", JNI_CALL_FreeMapNativeManager_OpenExternalBrowser );
    mid = InitJNIMethodContext( &gJniObj, &lMthdContext, JNI_CALL_FreeMapNativeManager_OpenExternalBrowser,
                                                                            JNI_CALL_FreeMapNativeManager_OpenExternalBrowser_Sig );
    if ( !mid || !lMthdContext.env )
    {
        roadmap_log( ROADMAP_ERROR, "Failed to obtain method context!" );
        return;
    }

    if ( aUrl != NULL )
    {
       url = (*lMthdContext.env)->NewStringUTF( lMthdContext.env, aUrl );
    }

    // Calling the method
    (*lMthdContext.env)->CallVoidMethod( lMthdContext.env, gJniObj.obj, lMthdContext.mid, url );

    // Release local references
    if ( url )
       (*lMthdContext.env)->DeleteLocalRef( lMthdContext.env, url );
}
/*************************************************************************************************
 * FreeMapNativeManager_GetThumbnail
 * Returns the thumbnail in the supplied byte buffer with the last taken image
 *
 */
int FreeMapNativeManager_GetThumbnail( int aThumbWidth, int aThumbHeight, int bytePP, int* aBuf )
{
    android_method_context_type lMthdContext;
    int retVal = -1;
    int buf_size;
    jmethodID mid;
    jintArray bufJNI;

    JNI_LOG( ROADMAP_INFO, "Trying to call method %s through JNI", JNI_CALL_FreeMapNativeManager_GetThumbnail );

    mid = InitJNIMethodContext( &gJniObj, &lMthdContext, JNI_CALL_FreeMapNativeManager_GetThumbnail,
                                            JNI_CALL_FreeMapNativeManager_GetThumbnail_Sig );
    if ( !mid || !lMthdContext.env )
    {
        roadmap_log( ROADMAP_ERROR, "Failed to obtain method context!" );
        return retVal;
    }

    buf_size = aThumbHeight*aThumbWidth;
    bufJNI = (*lMthdContext.env)->NewIntArray( lMthdContext.env, buf_size );

    // Calling the method
    retVal = (*lMthdContext.env)->CallIntMethod( lMthdContext.env, gJniObj.obj, lMthdContext.mid,
            aThumbWidth, aThumbHeight, bufJNI );

    // Copy the elements
    (*lMthdContext.env)->GetIntArrayRegion( lMthdContext.env, bufJNI, 0, buf_size, aBuf );

    return retVal;
}
/*************************************************************************************************
 * FreeMapNativeManager_TakePictureAsync()
 * Shows the camera capture preview and saves the taken image
 *
 */
int FreeMapNativeManager_TakePictureAsync( int aImageWidth, int aImageHeight, int aImageQuality,
        char* aImageFolder, char* aImageFile )
{
    android_method_context_type lMthdContext;
    int retVal = -1;
    jmethodID mid;
    jbyteArray imageFolder, imageFile;
      JNI_LOG( ROADMAP_INFO, "Trying to call method %s through JNI", JNI_CALL_FreeMapNativeManager_TakePictureAsync );
    mid = InitJNIMethodContext( &gJniObj, &lMthdContext, JNI_CALL_FreeMapNativeManager_TakePictureAsync,
                                            JNI_CALL_FreeMapNativeManager_TakePictureAsync_Sig );
    if ( !mid || !lMthdContext.env )
    {
        roadmap_log( ROADMAP_ERROR, "Failed to obtain method context!" );
        return retVal;
    }

    imageFolder = (*lMthdContext.env)->NewByteArray( lMthdContext.env, strlen( aImageFolder ) );
    (*lMthdContext.env)->SetByteArrayRegion( lMthdContext.env, imageFolder, 0, strlen( aImageFolder ), aImageFolder );

    imageFile = (*lMthdContext.env)->NewByteArray( lMthdContext.env, strlen( aImageFile ) );
    (*lMthdContext.env)->SetByteArrayRegion( lMthdContext.env, imageFile, 0, strlen( aImageFile ), aImageFile );

    // Calling the method
    retVal = (*lMthdContext.env)->CallIntMethod( lMthdContext.env, gJniObj.obj, lMthdContext.mid,
            aImageWidth, aImageHeight, aImageQuality, imageFolder, imageFile  );

    return retVal;
}
Beispiel #5
0
static void upload_error_callback( void *context, int connection_failure, const char *format, ...) {
    upload_context *  ctx = (upload_context *)context;
    roadmap_log(ROADMAP_ERROR,"error in uploading voice : %s",ctx->full_path);
    (*ctx->cb ) (ctx->context);
    roadmap_path_free(ctx->full_path);
    free(ctx);
}
Beispiel #6
0
int roadmap_plugin_get_direction (PluginLine *line, int who) {
   
   if (line->plugin_id == ROADMAP_PLUGIN_ID) {

		roadmap_square_set_current (line->square);
      return roadmap_line_route_get_direction (line->line_id, who);

   } else {
      RoadMapPluginHooks *hooks = get_hooks (line->plugin_id);

      if (hooks == NULL) {
         roadmap_log (ROADMAP_ERROR, "plugin id:%d is missing.",
               line->plugin_id);

         return 0;
      }

      if (hooks->route_direction != NULL) {
         return (*hooks->route_direction) (line, who);
      }

      return 0;
   }

}
/*************************************************************************************************
 * Java_com_waze_FreeMapNativeManager_AppStartNTV
 * Starts the application
 *
 */
JNIEXPORT void JNICALL Java_com_waze_FreeMapNativeManager_AppStartNTV
  ( JNIEnv* aJNIEnv, jobject aJObj, jstring aUrl, int aAppMode )
{
	roadmap_main_start_init();

	const char* url = NULL;
	if ( aUrl )
	{
	   char query[URL_MAX_LENGTH];
	   jboolean isCopy;
		url = (*aJNIEnv)->GetStringUTFChars( aJNIEnv, aUrl, &isCopy );
		roadmap_urlscheme_remove_prefix( query, url );
      roadmap_urlscheme_init( query );
      (*aJNIEnv)->ReleaseStringUTFChars( aJNIEnv, aUrl, url );
	}

  roadmap_log( ROADMAP_WARNING, "Applicaiton started with URL string: %s", url );

  roadmap_main_set_app_mode( aAppMode );

  // Widget Mode
  if ( aAppMode == 1 )
  {
     roadmap_screen_set_background_run( TRUE );
  }

  roadmap_start(0, NULL);
}
Beispiel #8
0
const char *roadmap_plugin_street_full_name (const PluginLine *line) {

   if (line->plugin_id == ROADMAP_PLUGIN_ID) {

      RoadMapStreetProperties properties;
      roadmap_square_set_current (line->square);
      roadmap_street_get_properties (line->line_id, &properties);

      return roadmap_street_get_full_name (&properties);

   } else {
      RoadMapPluginHooks *hooks = get_hooks (line->plugin_id);

      if (hooks == NULL) {
         roadmap_log (ROADMAP_ERROR, "plugin id:%d is missing.",
               line->plugin_id);

         return "";
      }

      if (hooks->get_street_full_name != NULL) {
         return (*hooks->get_street_full_name) (line);
      }

      return "";
   }
}
/*************************************************************************************************
 * Java_com_waze_FreeMapNativeManager_UrlHandlerNTV
 * JNI wrapper for
 *
 */
JNIEXPORT jboolean JNICALL Java_com_waze_FreeMapNativeManager_UrlHandlerNTV
( JNIEnv* aJNIEnv, jobject aJObj, jstring aUrl )
{
   jboolean isCopy;
   jboolean res = JNI_FALSE;
   const char* url = (*aJNIEnv)->GetStringUTFChars( aJNIEnv, aUrl, &isCopy );

   /*
    * Try to handle by browser
    */
   roadmap_log( ROADMAP_INFO, "Processing url: %s", url );
   if ( roadmap_browser_url_handler( url ) == TRUE )
   {
      res = JNI_TRUE;
   }

   /*
     * Try to handle by url scheme
     */
   if ( ( res == JNI_FALSE ) && roadmap_urlscheme_valid( url ) )
   {
      char query[URL_MAX_LENGTH];
      roadmap_urlscheme_remove_prefix( query, url );
      roadmap_urlscheme_init( query );
      res = JNI_TRUE;
   }

   (*aJNIEnv)->ReleaseStringUTFChars( aJNIEnv, aUrl, url );

   return res;
}
Beispiel #10
0
int roadmap_plugin_get_distance
            (const RoadMapPosition *point,
             const PluginLine *line,
             RoadMapNeighbour *result) {

   if (line->plugin_id == ROADMAP_PLUGIN_ID) {

		roadmap_square_set_current (line->square);
      return roadmap_street_get_distance
                     (point,
                      line->line_id,
                      line->cfcc,
                      result);
   } else {

      RoadMapPluginHooks *hooks = get_hooks (line->plugin_id);

      if (hooks == NULL) {
         roadmap_log (ROADMAP_ERROR, "plugin id:%d is missing.",
               line->plugin_id);

         return 0;
      }

      if (hooks->activate_db != NULL) {
         return (*hooks->get_distance) (point, line, result);
      }

      return 0;
   }
}
Beispiel #11
0
void roadmap_plugin_get_street (const PluginLine *line, PluginStreet *street) {

   if (line->plugin_id == ROADMAP_PLUGIN_ID) {

      RoadMapStreetProperties properties;

		roadmap_square_set_current (line->square);
      roadmap_street_get_properties (line->line_id, &properties);
      street->plugin_id = ROADMAP_PLUGIN_ID;
      street->street_id = properties.street;
      street->square = line->square;

   } else {
      RoadMapPluginHooks *hooks = get_hooks (line->plugin_id);
      street->plugin_id = line->plugin_id;
      street->square = line->square;

      if (hooks == NULL) {
         roadmap_log (ROADMAP_ERROR, "plugin id:%d is missing.",
               line->plugin_id);

         street->street_id = -1;
         return;
      }

      if (hooks->get_street != NULL) {
         (*hooks->get_street) (line, street);

      } else {
         street->street_id = -1;
      }

      return;
   }
}
Beispiel #12
0
int roadmap_plugin_activate_db (const PluginLine *line) {

   if (line->plugin_id == ROADMAP_PLUGIN_ID) {

      if (roadmap_locator_activate (line->fips) != ROADMAP_US_OK) {
         return -1;
      }

      return 0;

   } else {
      RoadMapPluginHooks *hooks = get_hooks (line->plugin_id);

      if (hooks == NULL) {
         roadmap_log (ROADMAP_ERROR, "plugin id:%d is missing.",
               line->plugin_id);

         return -1;
      }

      if (hooks->activate_db != NULL) {
         return (*hooks->activate_db) (line);
      }

      return 0;
   }
}
Beispiel #13
0
	void roadmap_main_set_input (RoadMapIO *io, RoadMapInput callback)
	{
      int i;
      
      for (i = 0; i < ROADMAP_MAX_IO; ++i) {
         if (RoadMapMainIo[i] == NULL) {
            RoadMapMainIo[i] = (roadmap_main_io *) malloc (sizeof(roadmap_main_io));
            RoadMapMainIo[i]->io = io;
            RoadMapMainIo[i]->callback = callback;
            RoadMapMainIo[i]->is_valid = 1;
            break;
         }
      }
      
      if (i == ROADMAP_MAX_IO) {
         roadmap_log (ROADMAP_FATAL, "Too many set input calls");
         return;
      }
      
     if ( io == NULL || callback == NULL )  return;
     if ( io->subsystem != ROADMAP_IO_NET ) return; 
     
     CRoadMapNativeNet* net = (CRoadMapNativeNet*)(io->os.socket);
     if ( net == NULL ) return;
     
     net->StartPolling((void*)callback, (void*)RoadMapMainIo[i]);
   }
Beispiel #14
0
/*************************************************************************************************
 * WazeSoundRecorder_Start()
 * Starts the audio recorder
 * aPath - path to
 * aTimeout - timeout for recording in ms
 */
int WazeSoundRecorder_Start( const char* aPath, int aTimeout )
{
   jmethodID mid;
   android_method_context_type lMthdContext;
   jstring path = NULL;
   int res;

   JNI_LOG( ROADMAP_INFO, "Trying to call method %s through JNI", JNI_CALL_WazeSoundRecorder_Start );
   mid = InitJNIMethodContext( &gJniObj, &lMthdContext, JNI_CALL_WazeSoundRecorder_Start,
         JNI_CALL_WazeSoundRecorder_Start_Sig );
   if ( !mid || !lMthdContext.env )
   {
      roadmap_log( ROADMAP_ERROR, "Failed to obtain method context!" );
      return -1;
   }

   if ( aPath != NULL )
   {
      path = (*lMthdContext.env)->NewStringUTF( lMthdContext.env, aPath );
   }

   // Call the method
   res = (*lMthdContext.env)->CallIntMethod( lMthdContext.env, gJniObj.obj, mid, path, aTimeout );


   // Release local references
   if ( path )
      (*lMthdContext.env)->DeleteLocalRef( lMthdContext.env, path );

   return res;
}
Beispiel #15
0
const char* roadmap_lang_get (const char *name) {

   int hash;
   int i;

   if (!RoadMapLangLoaded) return name;

   if ( name == NULL )
   {
	   roadmap_log( ROADMAP_ERROR, "String is not initialized! Language module can't work with NULL strings" );
	   return ("");
   }

   hash = roadmap_hash_string (name);

   for (i = roadmap_hash_get_first (RoadMapLangHash, hash);
        i >= 0;
        i = roadmap_hash_get_next (RoadMapLangHash, i)) {

      if (!strcmp(name, RoadMapLangItems[i].name)) {

         return RoadMapLangItems[i].value;
      }
   }

   return name;
}
Beispiel #16
0
/***********************************************************
 *  Name        : roadmap_camera_take_picture
 *  Purpose     : Shows the camera preview, passes target image attributes
 *                   and defines the target capture file location
 *
 */
BOOL roadmap_camera_take_picture( CameraImageFile* image_file, CameraImageBuf* image_thumbnail )
{
    int image_quality_percent;  // Image quality in percents
    int retVal, retValThumb = -1;
    int byte_per_pix = roadmap_camera_image_bytes_pp( image_thumbnail->pixfmt );
    // Transform to percent low - 34, medium - 67, high - 100
    image_quality_percent = 34 + 33 * (int) image_file->quality;

    // Set the target path
    CAMERA_IMG_FILE_SET_PATH( *image_file, roadmap_path_user(), gCaptureFileName );

    // Call the JNI for the file
    retVal = FreeMapNativeManager_TakePicture( image_file->width, image_file->height, image_quality_percent,
            image_file->folder, image_file->file );

    // Call the JNI for the thumbnail if requested and the picture was taken successfully
    if ( ( retVal == 0 ) && image_thumbnail )
    {
        // Assume 4 byte per pixel
        // Only int array can be accepted for the Android
        // Malloc SHOULD preserve 4-byte alignment so further casting is possible !!!!!!!
        image_thumbnail->buf = malloc( image_thumbnail->width * image_thumbnail->height * byte_per_pix );
        retValThumb = FreeMapNativeManager_GetThumbnail( image_thumbnail->width, image_thumbnail->height,
                                                                    byte_per_pix, (int*) image_thumbnail->buf );
        if ( retValThumb != 0 )
        {
            roadmap_log( ROADMAP_WARNING, "Thumbnail request to Android is failed" );
        }
    }
    return ( retVal == 0 );
}
Beispiel #17
0
void roadmap_canvas3_ogl_updateScale(int zoom) {
	float angRad;
	//static float maxAngle= 67.3;
   static float maxAngle= 62;
	float ang= 24;
	//float angZoom= 384;
   float angZoom= 3000;

   if (!isInitialized || zoom== 0)
      return;
   if ( !is_canvas_ready() )
      return;

   if ( roadmap_screen_is_hd_screen() ) {
	   zoom /= 2;
   }

	while (angZoom > zoom) {
		angZoom/= 1.1;
		ang= ang* 1.026; // (5/4)^(ln(1.1)/ln(2))
	}
	if (ang > maxAngle)
		ang= maxAngle;
	angRad= ang*M_PI/180;
	if (angRad!= angle) {
		double distH;
		angle= angRad;
		distH= roadmap_canvas_ogl_rotateMe(0);
		roadmap_log(ROADMAP_DEBUG,"zoom= %d angle= %lf y dist= %lg\n",zoom,ang,distH);
	}
}
Beispiel #18
0
void roadmap_main_set_seconds_timer(int interval_in_seconds, RoadMapCallback callback){
	 int index;
	 struct RoadMapSecondTimer *timer = NULL;
	 for (index = 0; index < ROADMAP_MAX_TIMER; ++index) {

	      if (RoadMapSecondTimers[index].callback == callback) {
	         return;
	      }
	      if (timer == NULL) {
	         if (RoadMapSecondTimers[index].callback == NULL) {
	            timer = RoadMapSecondTimers + index;
	         }
	      }
	   }

    if (timer == NULL) {
	      roadmap_log (ROADMAP_FATAL, "Timer table saturated");
    }

    timer->callback = callback;
    timer->how_many_seconds_left = interval_in_seconds + 1;
    // added +1 to be harsh in the nearest call to the timeout - better to call it in 1.1 seconds than
    // 0.1 for example.
    timer->interval_in_seconds = interval_in_seconds;
}
Beispiel #19
0
void rim_on_scheduledTask(int id) {

	int index = id & 0x0000ffff;
	int uid = id >> 16;
   RoadMapCallback callback;

	if (uid != RoadMapMainPeriodicTimer[index].uid) {
		roadmap_log(ROADMAP_ERROR, "invokelater on old timer! %d:%d", uid, RoadMapMainPeriodicTimer[index].uid);
		return;
	}

	callback = RoadMapMainPeriodicTimer[index].callback;

   time_t start = NOPH_System_currentTimeMillis();

	if (callback != NULL) {
	   last_called_cb = callback;
	   //printf("callback is : 0x%x \n", callback);
	   (*callback) ();
	}
      time_t t = NOPH_System_currentTimeMillis() - start;

      if (t > 1000) {
	      printf("In rim_on_invokeLater, too long! %d 0x%x\n",
			      t, (int)callback);

      }
}
Beispiel #20
0
void battery_status_print(int cur_battery_level){
	static int last_printed_battery_level = 100;
	if( (cur_battery_level< MIN_BATTERY_LEVEL_TO_PRINT) && ( cur_battery_level <  last_printed_battery_level - BATTERY_LEVEL_PRINT_STEPS) ) {
		roadmap_log(ROADMAP_ERROR,"battery level is low : %d", cur_battery_level);
		last_printed_battery_level  = cur_battery_level;
	}
}
Beispiel #21
0
void roadmap_main_remove_periodic (RoadMapCallback callback) {

   int index;

   for (index = 0; index < ROADMAP_MAX_TIMER; ++index) {

      if (RoadMapMainPeriodicTimer[index].callback == callback) {

         RoadMapMainPeriodicTimer[index].callback = NULL;
         NOPH_TimerMgr_remove (timer_mgr, index);

         return;
      }

      if (RoadMapSecondTimers[index].callback == callback){
      		  RoadMapSecondTimers[index].callback = NULL;
      		  RoadMapSecondTimers[index].how_many_seconds_left = -1;
      		  RoadMapSecondTimers[index].interval_in_seconds = -1;
      		  return;
       }
   }



   roadmap_log (ROADMAP_ERROR, "timer 0x%08x not found", callback);
}
Beispiel #22
0
void roadmap_path_create (const char *path)
{
   LPWSTR path_unicode;
   int res, stopFlag = 0;
	char parent_path[512] = {0};
	char *pNext = parent_path;
	char delim = '\\';
   
	strncpy( parent_path, path, 512 );
   
	while( !stopFlag )
	{
		pNext = strchr( pNext+1, delim );
		if ( pNext )
			*pNext = 0;
		else
			stopFlag = 1;
      
		path_unicode = ConvertToWideChar(parent_path, CP_UTF8);
      res = CreateDirectory(path_unicode, NULL);
      free(path_unicode);
		if ( res == 0 && GetLastError() != 183) // error 183 = path already exists
		{
			roadmap_log( ROADMAP_ERROR, "Error creating path: %s, Error: %d", path, GetLastError() );
			stopFlag = 1;
		}
		if ( pNext )
			*pNext = delim;
	}
}
Beispiel #23
0
void roadmap_main_menu_button_register(RoadMapMainIntCallback callback,const char * dialog_name,int addr){
	int i;
	struct RoadMapMenuCallbackInfo * pCallbackInfo=NULL;

	/*
	 * check in cache first
	 */
	for (i=0;i<MAX_MENU_BUTTON_CALLBACKS;i++){
		if(!strcmp(RoadMapMenuButtonAllCallbacks[i].dialog_name,dialog_name)){
						callback = RoadMapMenuButtonAllCallbacks[i].callback;
						addr = RoadMapMenuButtonAllCallbacks[i].addr;
						break;
		}
		if((RoadMapMenuButtonAllCallbacks[i].callback==NULL)&&(addr!=0)){
			RoadMapMenuButtonAllCallbacks[i].callback = callback;
			RoadMapMenuButtonAllCallbacks[i].addr = addr;
			RoadMapMenuButtonAllCallbacks[i].dialog_name = strdup(dialog_name);
			break;
		}
	}

	if(addr==0){
		need_to_show_context_menu = FALSE;
		return; // no callback to register
	}
	need_to_show_context_menu = TRUE;

	for (i=0;i<MAX_ACTIVE_MENU_BUTTON_CALLBACKS;i++){
		if (!strcmp(RoadMapMenuButtonActiveCallbacks[i].dialog_name,dialog_name)){
			roadmap_log (ROADMAP_DEBUG, "tried to register a menu button callback to dialog %s which " \
					"already has one. doing nothing.",dialog_name );
			return;
		}else{
			if(pCallbackInfo==NULL){
				if (RoadMapMenuButtonActiveCallbacks[i].callback==NULL){
					pCallbackInfo = RoadMapMenuButtonActiveCallbacks + i;
				}
			}
		}
	}
	if ( pCallbackInfo == NULL){
		  roadmap_log (ROADMAP_FATAL, "Menu buttons callback table saturated");
	}
	pCallbackInfo->addr = addr;
	pCallbackInfo->callback = callback;
	pCallbackInfo->dialog_name = strdup(dialog_name); // need to be freed when unregistering
}
void roadmap_nmea_subscribe (const char *vendor,
                             const char *sentence,
                             RoadMapNmeaListener listener,
                             RoadMapNmeaAccount  account) {

   int i;
   int found;


   for (i = 0; RoadMapNmeaPhrase[i].decoder != NULL; ++i) {

       if (strcmp (sentence, RoadMapNmeaPhrase[i].sentence) == 0) {

          if ((vendor == NULL) && (RoadMapNmeaPhrase[i].vendor == NULL)) {
             found = 1;
          }
          else if ((vendor != NULL) &&
                   (RoadMapNmeaPhrase[i].vendor != NULL) &&
                   (strcmp (vendor, RoadMapNmeaPhrase[i].vendor) == 0)) {
             found = 1;
          } else {
             found = 0;
          }

          if (found) {

             if (account->count <= i) {
                roadmap_log (ROADMAP_FATAL,
                             "invalid size for account '%s'", account->name);
             }

             account->listener[i] = listener;

             return;
          }
       }
   }

   if (vendor == NULL) {
      roadmap_log (ROADMAP_FATAL, "unsupported standard NMEA sentence '%s'",
                   sentence);
   } else {
      roadmap_log (ROADMAP_FATAL,
                   "unsupported NMEA sentence '%s' for vendor '%s'",
                   sentence, vendor);
   }
}
Beispiel #25
0
void tts_initialize( void )
{
   // Load the configuraiton
   tts_load_config();

   // Set the comfiguration to the Server defined
   if ( !sgTtsVoiceId[0] || !strcmp( sgTtsVoiceId, TTS_CFG_VOICE_ID_NOT_DEFINED ) )
   {
      roadmap_config_set( &RMConfigTTSVoiceId, sgTtsDefaultVoiceId );
      sgTtsVoiceId = sgTtsDefaultVoiceId;
   }

   // Voices initialization
   tts_voices_initialize( _voice_updated );

   // Queue initialization
   tts_queue_init();

   // Cache initialization
   tts_cache_initialize();

   // Provider context pool initialization
   _provider_ctx_init();

   if ( !tts_feature_enabled() )
      return;

   // Find active provider
   if ( !( sgActiveProvider = _voice_service_provider( sgTtsVoiceId ) ) )
   {
      roadmap_log( ROADMAP_WARNING, TTS_LOG_STR( "Provider is not registered for current voice id: %s." ), sgTtsVoiceId );
      sgTtsVoiceId = sgTtsDefaultVoiceId;
      if ( !( sgActiveProvider = _voice_service_provider( sgTtsVoiceId ) ) )
      {
         roadmap_log( ROADMAP_ERROR, TTS_LOG_STR( "Critical TTS Engine error. Provider is not registered for default voice id: %s." ), sgTtsVoiceId );
         return;
      }
   }

   if ( sgActiveProvider->prepare_cb )
      sgActiveProvider->prepare_cb();

   sgActiveRequestsCount = 0;

   // Cache voice
   tts_cache_set_voice( sgTtsVoiceId, sgActiveProvider->storage_type );
}
Beispiel #26
0
static RoadMapConfig *roadmap_config_search_file (const char *name) {

   RoadMapConfig *file;

   if (!RoadMapConfigLoaded) {
      roadmap_log (ROADMAP_FATAL, "%s: not yet loaded", name);
   }

   for (file = RoadMapConfigFiles; file->name != NULL; ++file) {
      if (strcmp (name, file->name) == 0) {
         return file;
      }
   }

   roadmap_log (ROADMAP_FATAL, "%s: not a valid config file name", name);
   return NULL;
}
Beispiel #27
0
void roadmap_main_add_tool_space (void) {

   if (RoadMapMainToolbar == NULL) {
      roadmap_log (ROADMAP_FATAL, "Invalid toolbar space: no toolbar yet");
   }

   gtk_toolbar_append_space (GTK_TOOLBAR(RoadMapMainToolbar));
}
Beispiel #28
0
void exit_handler(NOPH_Exception_t exception, void *arg){
	char msg[512];
	NOPH_String_toCharPtr(NOPH_Throwable_toString(exception), msg, sizeof(msg));
	roadmap_log(ROADMAP_ERROR,"Exception in main_exit!! Exception mesage :%s", msg);
	NOPH_Throwable_printStackTrace(exception);
	NOPH_delete(exception);
	exit(0);
}
Beispiel #29
0
void roadmap_browser_show_embeded( RMBrowserContext* context ){
   if (!RMBrowserLauncher )
   {
      roadmap_log( ROADMAP_ERROR, "roadmap_browser_show_embeded - Browser launcher is not initialized..." );
      return;
   }

   if (!context)
   {
      roadmap_log( ROADMAP_ERROR, "roadmap_browser_show_embeded - Context is null..." );
      return;
   }

   context->flags |= BROWSER_FLAG_WINDOW_TYPE_EMBEDDED;

   RMBrowserLauncher( context );
}
Beispiel #30
0
void *ssd_dialog_context (void) {
   if (!RoadMapDialogCurrent) {
      roadmap_log (ROADMAP_FATAL,
         "Trying to get dialog context, but no active dialogs exist");
   }

   return RoadMapDialogCurrent->container->context;
}