Example #1
0
/*---------------------------------------------------------------------*/
gint
dbus_req_handler( const gchar *interface, const gchar *method,
		  GArray *arguments, gpointer data, osso_rpc_t *retval ) {
    AppData *appdata;
    appdata = (AppData *)data;

    /* osso_system_note_infoprint( appdata->osso_context, method, retval ); */
    osso_rpc_free_val( retval );

    return OSSO_OK;
}
Example #2
0
/* only the screen is refreshed, useful if e.g. the poi database changed */
gboolean dbus_mm_set_position(osso_context_t *osso_context) {
  osso_rpc_t retval;
  osso_return_t ret;

  ret = osso_rpc_run(osso_context,
		     MM_DBUS_SERVICE,
		     MM_DBUS_PATH,
		     MM_DBUS_INTERFACE,
		     "set_view_center",
		     &retval,
		     DBUS_TYPE_INVALID);

  osso_rpc_free_val(&retval);

  return(ret == OSSO_OK);
}
static bool OssoIsScreenOn(osso_context_t* ctx)
{
  osso_return_t rv;
  osso_rpc_t ret;
  bool result = false;

  rv = osso_rpc_run_system(ctx, MCE_SERVICE, MCE_REQUEST_PATH, MCE_REQUEST_IF,
                           "get_display_status", &ret, DBUS_TYPE_INVALID);
  if (rv == OSSO_OK) {
      if (strcmp(ret.value.s, "on") == 0)
          result = true;

      osso_rpc_free_val(&ret);
  }
  return result;
}
static void OssoRequestAccelerometer(osso_context_t *ctx, bool aEnabled)
{
  osso_return_t rv;
  osso_rpc_t ret;

  rv = osso_rpc_run_system(ctx, 
                           MCE_SERVICE,
                           MCE_REQUEST_PATH, MCE_REQUEST_IF,
                           aEnabled ? "req_accelerometer_enable" : "req_accelerometer_disable",
                           aEnabled ? &ret : NULL,
                           DBUS_TYPE_INVALID);

  // Orientation might changed while the accelerometer was off, so let's update
  // the window's orientation
  if (rv == OSSO_OK && aEnabled) {    
      OssoSetWindowOrientation(strcmp(ret.value.s, "portrait") == 0);
      osso_rpc_free_val(&ret);
  }
}
Example #5
0
/**
 * he_helper_request_orientation:
 * @context: An osso_initialize()d osso_context_t.
 *
 * Returns the current physical orientation of the device.
 *
 * Return value: TRUE if in portrait; FALSE if otherwise.
 **/
gboolean
he_helper_request_orientation          (osso_context_t *context)
{
    osso_rpc_t ret = { 0 };
    gboolean retval = FALSE;

    g_return_val_if_fail (context, retval);

    if (osso_rpc_run_system (context,
                     MCE_SERVICE, MCE_REQUEST_PATH, MCE_REQUEST_IF, MCE_DEVICE_ORIENTATION_GET,
                     &ret, DBUS_TYPE_INVALID) == OSSO_OK) {

        if (!g_strcmp0 (ret.value.s, MCE_ORIENTATION_PORTRAIT)) {
            retval = TRUE;
        }

        osso_rpc_free_val(&ret);
    }

    return retval;
}
Example #6
0
/* callback for the dbus calls */
static gint 
dbus_req_handler(const gchar *interface, const gchar *method,
		 GArray *arguments, gpointer data,
		 osso_rpc_t *retval)
{
	osso_context_t *ctx;
	int i;
	ctx = (osso_context_t *)data;
	
	LOG_INFO("We got D-BUS message %s\n", method);
	
	if (!strcmp(method, "top_application")) {
		/* ui_open_frontpage */
		ui_open_frontpage();
	} else if (!strcmp(method, "mime_open")) {
		/* import .. */
		for (i = 0; i < arguments->len; i++) {
			osso_rpc_t val = g_array_index(arguments, osso_rpc_t, i);
			if (val.type == DBUS_TYPE_STRING && val.value.s != NULL) {
				LOG_INFO("\tparam %s\n", val.value.s);
				
				/* the file might be as an url or just the path */
				if (strstr(val.value.s, "file://") == val.value.s) {
					ident_import_file((char*)(val.value.s + strlen("file://")), 1);
				} else {
					ident_import_file((char*)(val.value.s), 1);
				}
				
				/* we should save the idents stuff now .. */
			}
		}
	} else {
		osso_system_note_infoprint(ctx, method, retval);
	}
	osso_rpc_free_val(retval);
	
	return OSSO_OK;
}
/**
 * Callback for the button clicked signal
 *
 * @param widget the button widget
 * @param data applet info struct
 */
static gboolean applet_icon_pressed(GtkWidget *widget, GdkEventButton *button, gpointer data)
{
    LauncherNavigatorAppletPrivate *info;

    g_return_val_if_fail(data, FALSE);
    info = (LauncherNavigatorAppletPrivate*)data;

    gtk_button_released(GTK_BUTTON(info->button));

    osso_rpc_t retval;
    osso_return_t result;
    
    result = osso_rpc_run(info->osso,
                 "org.telescope",
                 "/Launcher",
                 "org.telescope.Launcher",
                 "Show", &retval, DBUS_TYPE_INVALID);

    osso_rpc_free_val(&retval);

    (void) button;

    return TRUE;
}
Example #8
0
/**************************************************************************
* D-Bus callback handler...
*
**************************************************************************/
gint dbus_req_handler(const gchar * interface, const gchar * method, GArray *arguments, gpointer data, osso_rpc_t * retval)
{
	osso_rpc_t argValue;
	long alarmTime = 0;	//Used for triggerAlarm call
	int alarmIndex = -1;	//Used for triggerAlarm call (-1 means no index passed)
	int alarmDResult = 0;	//Status of alarmD calls.
	unsigned int frequency = 107100;
	

	//char test[100];
	

	//osso_system_note_infoprint(ossoAppContext, test, NULL);
	
	if (arguments->len > 0) {
		argValue = g_array_index(arguments, osso_rpc_t, 0);
		
		if (argValue.type == DBUS_TYPE_UINT32) {
			frequency = argValue.value.u;
		}
		
		//printf("args len: %i\n", arguments->len);
		
		//check for fadeIn time
		if (arguments->len > 1) {
			argValue = g_array_index(arguments, osso_rpc_t, 1);
			
			if (argValue.type == DBUS_TYPE_UINT32) {
				//printf("new max vol is %u\n", argValue.value.u);
				fadeTime = argValue.value.u;
			}
		}
		
		//check for max volume
		if (arguments->len > 2) {
			argValue = g_array_index(arguments, osso_rpc_t, 2);
			
			if (argValue.type == DBUS_TYPE_UINT32) {
				//printf("new max vol is %u\n", argValue.value.u);
				maxVol = argValue.value.u;
			}
		}
	}
	
	

	//Handle dbus calls here!
	if (strcmp(method, "radioOn") == 0) {
		printf("Turn radio on!\n");
		//Just turn the radio on
		radio_unmute(radioObj);
		radio_setfreq(radioObj, frequency);	
		radio_setvolume(radioObj, maxVol);
	} else if (strcmp(method, "radioFadeIn") == 0) {
		//Fade the radio in like a regular alarm
		radio_unmute(radioObj);
		radio_setfreq(radioObj, frequency);	
		radio_setvolume(radioObj, 0);
		
		//Start the fade in
		stepVolumeUp(fadeTime / 20);
		
		
	} else if (strcmp(method, "radioOff") == 0) {
		printf("turn radio off!\n");
		//Just turn the radio on
		radio_mute(radioObj);
		
	} else if (strcmp(method, "exit") == 0) {
		//Request to exit
		osso_rpc_free_val(retval);
		deinitializeApp();
   		exit(0);
	} 
	
	
	//Cleanup
	osso_rpc_free_val(retval);

	return OSSO_OK;
}