/** * he_helper_accelerometer_disable: * @context: An osso_initialize()d osso_context_t. * * Tells MCE (Mode Control Entity) to disable the accelerometer. **/ void he_helper_accelerometer_disable (osso_context_t *context) { g_return_if_fail (context); osso_rpc_run_system (context, MCE_SERVICE, MCE_REQUEST_PATH, MCE_REQUEST_IF, MCE_ACCELEROMETER_DISABLE_REQ, NULL, DBUS_TYPE_INVALID); }
static void send_gchar_mce_request (osso_context_t *context, const gchar *method, const gchar *arg_string) { g_return_if_fail (context); g_return_if_fail (method); g_return_if_fail (arg_string); osso_rpc_run_system (context, MCE_SERVICE, MCE_REQUEST_PATH, MCE_REQUEST_IF, method, NULL, DBUS_TYPE_STRING, arg_string, DBUS_TYPE_INVALID); }
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); } }
/** * 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; }