platform-api-0.20+14.04.20140411/0000755000015301777760000000000012322055312016413 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/android/0000755000015301777760000000000012322055312020033 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/android/mock/0000755000015301777760000000000012322055312020764 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/android/mock/mock.cpp0000644000015301777760000001163612322054725022437 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #include #include #include #include #include #include #include #include // C apis #include #include namespace { struct MockPhysicalDisplayInfo : public ubuntu::application::ui::PhysicalDisplayInfo { MockPhysicalDisplayInfo() {} int dpi() { return 96; } int horizontal_resolution() { return 1024; } int vertical_resolution() { return 768; } }; struct MockSession : public ubuntu::application::ui::Session { MockSession() { } const ubuntu::application::ui::PhysicalDisplayInfo::Ptr& physical_display_info( ubuntu::application::ui::PhysicalDisplayIdentifier id) { static ubuntu::application::ui::PhysicalDisplayInfo::Ptr display( new MockPhysicalDisplayInfo()); return display; } const ubuntu::application::ui::Surface::Ptr& create_surface( const ubuntu::application::ui::SurfaceProperties& props, const ubuntu::application::ui::input::Listener::Ptr& listener) { (void) props; (void) listener; } const ubuntu::application::ui::Surface::Ptr& destroy_surface( const ubuntu::application::ui::SurfaceProperties& props) { (void) props; } EGLNativeDisplayType to_native_display_type() { return 0; } }; struct MockSessionService : public ubuntu::ui::SessionService { MockSessionService() { } const ubuntu::application::ui::Session::Ptr& start_a_new_session(const ubuntu::application::ui::SessionCredentials& cred) { (void) cred; static ubuntu::application::ui::Session::Ptr session(new MockSession()); return session; } }; struct MockSurface : public ubuntu::application::ui::Surface { MockSurface(const ubuntu::application::ui::input::Listener::Ptr& listener) : ubuntu::application::ui::Surface(listener) { } bool is_visible() const { return true; } void set_visible(bool visible) { (void) visible; } void set_alpha(float alpha) { (void) alpha; } float alpha() const { return 1.f; } void move_to(int x, int y) { (void) x; (void) y; } void move_by(int dx, int dy) { (void) dx; (void) dy; } // Bind to EGL/GL rendering API EGLNativeWindowType to_native_window_type() { return 0; } }; struct MockSurfaceFactory : public ubuntu::application::ui::SurfaceFactory { ubuntu::application::ui::Surface::Ptr create_surface( const ubuntu::application::ui::SurfaceProperties& props, const ubuntu::application::ui::input::Listener::Ptr& listener) { static ubuntu::application::ui::Surface::Ptr surface(new MockSurface(listener)); return surface; } }; struct MockSetup : public ubuntu::application::ui::Setup { ubuntu::application::ui::StageHint stage_hint() { return ubuntu::application::ui::main_stage; } ubuntu::application::ui::FormFactorHint form_factor_hint() { return ubuntu::application::ui::desktop_form_factor; } }; } // We need to inject some platform specific symbols here. namespace ubuntu { namespace application { namespace ui { const ubuntu::application::ui::SurfaceFactory::Ptr& ubuntu::application::ui::SurfaceFactory::instance() { static ubuntu::application::ui::SurfaceFactory::Ptr session(new MockSurfaceFactory()); return session; } void init(int argc, char** argv) { (void) argc; (void) argv; } const ubuntu::application::ui::Setup::Ptr& ubuntu::application::ui::Setup::instance() { static ubuntu::application::ui::Setup::Ptr session(new MockSetup()); return session; } } } namespace ui { const ubuntu::ui::SessionService::Ptr& ubuntu::ui::SessionService::instance() { static ubuntu::ui::SessionService::Ptr instance(new MockSessionService()); return instance; } } } platform-api-0.20+14.04.20140411/android/mock/CMakeLists.txt0000644000015301777760000000044612322054725023537 0ustar pbusernogroup00000000000000add_library( ubuntu_mock_platform SHARED mock.cpp # Pull in the default C API implementation on top of the C++ API ../default/default_ubuntu_application_ui.cpp ) install( TARGETS ubuntu_mock_platform RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib/static) platform-api-0.20+14.04.20140411/android/hybris/0000755000015301777760000000000012322055312021333 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/android/hybris/default_application_manager.h0000644000015301777760000002140512322054725027216 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef DEFAULT_APPLICATION_MANAGER_H_ #define DEFAULT_APPLICATION_MANAGER_H_ #include "application_manager.h" #include "default_application_manager_input_setup.h" #include "default_application_session.h" #include "event_loop.h" #include "lifecycle_helpers.h" #include #include #include #include #include #if ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR<=2 #include #else #include #endif #include namespace ubuntu { namespace detail { struct ApplicationManager : public android::BnApplicationManager, public android::IBinder::DeathRecipient { static const int default_shell_component_layer = 1000000; static const int default_dash_layer = default_shell_component_layer + 1; static const int default_indicator_layer = default_shell_component_layer + 2; static const int default_notifications_layer = default_shell_component_layer + 3; static const int default_greeter_layer = default_shell_component_layer + 4; static const int default_launcher_layer = default_shell_component_layer + 5; static const int default_osk_layer = default_shell_component_layer + 6; static const int default_shutdown_dialog_layer = default_shell_component_layer + 7; static const int focused_application_base_layer = 100; static const int wallpaper_layer = 0; static const int non_focused_application_layer = -1; struct ShellInputSetup : public android::RefBase { struct DisplayInfo { DisplayInfo(); android::DisplayInfo info; }; template struct Window : public android::RefBase { static int looper_callback(int receiveFd, int events, void* ctxt); Window(ShellInputSetup* parent, int _x = x, int _y = y, int _w = w, int _h = h); android::sp input_window; ShellInputSetup* parent; android::sp server_channel; android::sp client_channel; android::InputConsumer input_consumer; android::PreallocatedInputEventFactory event_factory; }; ShellInputSetup(const android::sp& input_manager); bool shell_has_focus; DisplayInfo display_info; android::sp input_manager; android::sp shell_application; android::sp looper; ubuntu::application::EventLoop event_loop; android::KeyedVector > trap_windows; // TODO(tvoss): Get rid of hard coded values. Window<0, 0, 720, 1280> event_trap_window; // TODO(tvoss): This is really hacky, but we need to // synchronize/reflect state changes across multiple processes // here, i.e.: // * maliit-server, which takes care of hiding and showing the osk // * notify-osd, which takes care of hiding and showing notifications Window<0, 812, 720, 468> osk_window; Window<36, 18, 684, 216> notifications_window; }; class InputFilter : public android::InputFilter { public: InputFilter(ApplicationManager* manager); bool filter_event(const android::InputEvent* event); private: ApplicationManager* manager; bool handle_key_event(const android::KeyEvent* event); }; class LockingIterator : public android::RefBase { public: void advance() ; bool is_valid() const; void make_current(); const android::sp& operator*(); protected: friend class ApplicationManager; LockingIterator( ApplicationManager* manager, size_t index); virtual ~LockingIterator(); private: ApplicationManager* manager; size_t it; }; ApplicationManager(); void update_app_lists(); // From DeathRecipient void binderDied(const android::wp& who); void lock(); void unlock(); android::sp iterator(); void session_set_state(const android::sp& session, int32_t new_state); void start_a_new_session( int32_t session_type, int32_t stage_hint, const android::String8& app_name, const android::String8& desktop_file, const android::sp& session, int fd, uint32_t remote_pid); void register_a_surface( const android::String8& title, const android::sp& session, int32_t surface_role, int32_t token, int fd); void request_fullscreen(const android::sp& session); void register_an_observer(const android::sp& observer); void register_task_controller(const android::sp& controller); int get_session_pid(const android::sp& session); void request_update_for_session(const android::sp& session); void focus_running_session_with_id(int id); void unfocus_running_sessions(); int32_t query_snapshot_layer_for_session_with_id(int id); android::IApplicationManagerSession::SurfaceProperties query_surface_properties_for_session_id(int id); void switch_to_well_known_application(int32_t app); int32_t set_surface_trap(int32_t x, int32_t y, int32_t width, int32_t height); void unset_surface_trap(int32_t handle); void report_osk_visible(int32_t x, int32_t y, int32_t width, int32_t height); void report_osk_invisible(); void report_notification_visible(); void report_notification_invisible(); void switch_focused_application_locked(size_t index_of_next_focused_app); void switch_focus_to_next_application_locked(); void kill_focused_application_locked(); private: void update_input_setup_locked(); size_t session_id_to_index(int id); void notify_observers_about_session_requested(uint32_t app); void notify_observers_about_session_born(int id, int stage_hint, const android::String8& desktop_file); void notify_observers_about_session_unfocused(int id, int stage_hint, const android::String8& desktop_file); void notify_observers_about_session_focused(int id, int stage_hint, const android::String8& desktop_file); void notify_observers_about_keyboard_geometry_changed(int x, int y, int width, int height); void notify_observers_about_session_requested_fullscreen(int id, int stage_hint, const android::String8& desktop_file); void notify_observers_about_session_died(int id, int stage_hint, const android::String8& desktop_file); android::sp input_listener; android::sp input_filter; android::sp input_setup; android::sp shell_input_setup; bool is_osk_visible; bool are_notifications_visible; android::Condition state_cond; android::Mutex state_lock; android::Mutex guard; android::KeyedVector< android::sp, android::sp > apps; android::Vector< android::sp > apps_as_added; android::Mutex observer_guard; android::Vector< android::sp > app_manager_observers; android::sp app_manager_task_controller; size_t focused_application; size_t side_stage_application; size_t main_stage_application; }; } } #endif // DEFAULT_APPLICATION_MANAGER_H_ platform-api-0.20+14.04.20140411/android/hybris/application_manager.cpp0000644000015301777760000005764112322054725026060 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #include "application_manager.h" #include #include namespace android { IMPLEMENT_META_INTERFACE(ClipboardService, "UbuntuClipboardService"); IMPLEMENT_META_INTERFACE(AMTaskController, "UbuntuApplicationManagerTaskController"); IMPLEMENT_META_INTERFACE(ApplicationManagerObserver, "UbuntuApplicationManagerObserver"); IMPLEMENT_META_INTERFACE(ApplicationManagerSession, "UbuntuApplicationManagerSession"); IMPLEMENT_META_INTERFACE(ApplicationManager, "UbuntuApplicationManager"); IClipboardService::Content::Content() : data(NULL), data_size(0) { } IClipboardService::Content::Content( const String8& mime_type, void* _data, size_t size) : mime_type(mime_type), data(malloc(size)), data_size(size) { memcpy(this->data, _data, size); } IClipboardService::Content::~Content() { if (data != NULL && data_size != 0) free(data); } IClipboardService::Content::Content(const IClipboardService::Content& content) : mime_type(content.mime_type), data(malloc(content.data_size)), data_size(content.data_size) { memcpy(data, content.data, data_size); } IClipboardService::Content& IClipboardService::Content::operator=(const IClipboardService::Content& content) { mime_type = content.mime_type; data_size = content.data_size; data = realloc(data, data_size); memcpy(data, content.data, data_size); return *this; } status_t BnClipboardService::onTransact(uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch(code) { case SET_CLIPBOARD_CONTENT_COMMAND: { IClipboardService::Content content; String8 mime_type = data.readString8(); size_t data_size = data.readInt32(); void* p = malloc(data_size); data.read(p, data_size); set_content(Content(mime_type, p, data_size)); free(p); break; } case GET_CLIPBOARD_CONTENT_COMMAND: { IClipboardService::Content content; get_content(content); reply->writeString8(String8(content.mime_type)); reply->writeInt32(content.data_size); reply->write(content.data, content.data_size); } break; } return NO_ERROR; } BpClipboardService::BpClipboardService(const sp& impl) : BpInterface(impl) { } void BpClipboardService::set_content(const IClipboardService::Content& content) { Parcel in, out; in.writeString8(String8(content.mime_type)); in.writeInt32(content.data_size); in.write(content.data, content.data_size); remote()->transact( SET_CLIPBOARD_CONTENT_COMMAND, in, &out); } void BpClipboardService::get_content(IClipboardService::Content& content) { Parcel in, out; remote()->transact( GET_CLIPBOARD_CONTENT_COMMAND, in, &out); content.mime_type = out.readString8(); content.data_size = out.readInt32(); content.data = malloc(content.data_size); out.read(content.data, content.data_size); } BnApplicationManagerSession::BnApplicationManagerSession() { } BnApplicationManagerSession::~BnApplicationManagerSession() {} status_t BnApplicationManagerSession::onTransact(uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch(code) { case RAISE_APPLICATION_SURFACES_TO_LAYER_COMMAND: { int32_t layer; data.readInt32(&layer); raise_application_surfaces_to_layer(layer); } break; case RAISE_SURFACE_TO_LAYER_COMMAND: { int32_t token, layer; token = data.readInt32(); layer = data.readInt32(); raise_surface_to_layer(token, layer); } break; case QUERY_SURFACE_PROPERTIES_FOR_TOKEN_COMMAND: { int32_t token = data.readInt32(); IApplicationManagerSession::SurfaceProperties props = query_surface_properties_for_token(token); reply->writeInt32(props.layer); reply->writeInt32(props.left); reply->writeInt32(props.top); reply->writeInt32(props.right); reply->writeInt32(props.bottom); } break; case ON_APPLICATION_STARTED_NOTIFICATION: { on_application_resumed(); } break; case ON_APPLICATION_ABOUT_TO_STOP_NOTIFICATION: { on_application_about_to_stop(); } break; } return NO_ERROR; } BpApplicationManagerSession::BpApplicationManagerSession(const sp& impl) : BpInterface(impl) { } BpApplicationManagerSession::~BpApplicationManagerSession() { } void BpApplicationManagerSession::raise_surface_to_layer(int32_t token, int layer) { Parcel in, out; in.writeInt32(token); in.writeInt32(layer); remote()->transact( RAISE_SURFACE_TO_LAYER_COMMAND, in, &out); } void BpApplicationManagerSession::raise_application_surfaces_to_layer(int layer) { Parcel in, out; in.writeInt32(layer); remote()->transact( RAISE_APPLICATION_SURFACES_TO_LAYER_COMMAND, in, &out); } IApplicationManagerSession::SurfaceProperties BpApplicationManagerSession::query_surface_properties_for_token(int32_t token) { Parcel in, out; in.writeInt32(token); remote()->transact( QUERY_SURFACE_PROPERTIES_FOR_TOKEN_COMMAND, in, &out); IApplicationManagerSession::SurfaceProperties props; props.layer = out.readInt32(); props.left = out.readInt32(); props.top = out.readInt32(); props.right = out.readInt32(); props.bottom = out.readInt32(); return props; } void BpApplicationManagerSession::on_application_resumed() { Parcel in, out; remote()->transact( ON_APPLICATION_STARTED_NOTIFICATION, in, &out, android::IBinder::FLAG_ONEWAY); } void BpApplicationManagerSession::on_application_about_to_stop() { Parcel in, out; remote()->transact( ON_APPLICATION_ABOUT_TO_STOP_NOTIFICATION, in, &out, android::IBinder::FLAG_ONEWAY); } status_t BnAMTaskController::onTransact(uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch(code) { case CONTINUE_TASK_COMMAND: { uint32_t pid = data.readInt32(); continue_task(pid); break; } case SUSPEND_TASK_COMMAND: { int pid = data.readInt32(); suspend_task(pid); break; } } return NO_ERROR; } BpAMTaskController::BpAMTaskController(const sp& impl) : BpInterface(impl) { } void BpAMTaskController::continue_task(uint32_t pid) { Parcel in, out; in.writeInt32(pid); remote()->transact( CONTINUE_TASK_COMMAND, in, &out, android::IBinder::FLAG_ONEWAY); } void BpAMTaskController::suspend_task(uint32_t pid) { Parcel in, out; in.writeInt32(pid); remote()->transact( SUSPEND_TASK_COMMAND, in, &out, android::IBinder::FLAG_ONEWAY); } status_t BnApplicationManagerObserver::onTransact(uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch(code) { case ON_SESSION_REQUESTED_NOTIFICATION: { uint32_t app = data.readInt32(); on_session_requested(app); break; } case ON_SESSION_BORN_NOTIFICATION: { int id = data.readInt32(); int stage_hint = data.readInt32(); String8 desktop_file = data.readString8(); on_session_born(id, stage_hint, desktop_file); break; } case ON_SESSION_UNFOCUSED_NOTIFICATION: { int id = data.readInt32(); int stage_hint = data.readInt32(); String8 desktop_file = data.readString8(); on_session_unfocused(id, stage_hint, desktop_file); break; } case ON_SESSION_FOCUSED_NOTIFICATION: { int id = data.readInt32(); int stage_hint = data.readInt32(); String8 desktop_file = data.readString8(); on_session_focused(id, stage_hint, desktop_file); break; } case ON_KEYBOARD_GEOMETRY_CHANGED_NOTIFICATION: { int x = data.readInt32(); int y = data.readInt32(); int width = data.readInt32(); int height = data.readInt32(); on_keyboard_geometry_changed(x, y, width, height); break; } case ON_SESSION_REQUESTED_FULLSCREEN_NOTIFICATION: { int id = data.readInt32(); int stage_hint = data.readInt32(); String8 desktop_file = data.readString8(); on_session_requested_fullscreen(id, stage_hint, desktop_file); break; } case ON_SESSION_DIED_NOTIFICATION: { int id = data.readInt32(); int stage_hint = data.readInt32(); String8 desktop_file = data.readString8(); on_session_died(id, stage_hint, desktop_file); break; } } return NO_ERROR; } BpApplicationManagerObserver::BpApplicationManagerObserver(const sp& impl) : BpInterface(impl) { } void BpApplicationManagerObserver::on_session_requested( uint32_t app) { Parcel in, out; in.writeInt32(app); remote()->transact( ON_SESSION_REQUESTED_NOTIFICATION, in, &out, android::IBinder::FLAG_ONEWAY); } void BpApplicationManagerObserver::on_session_born(int id, int stage_hint, const String8& desktop_file_hint) { Parcel in, out; in.writeInt32(id); in.writeInt32(stage_hint); in.writeString8(desktop_file_hint); remote()->transact( ON_SESSION_BORN_NOTIFICATION, in, &out, android::IBinder::FLAG_ONEWAY); } void BpApplicationManagerObserver::on_session_unfocused(int id, int stage_hint, const String8& desktop_file_hint) { Parcel in, out; in.writeInt32(id); in.writeInt32(stage_hint); in.writeString8(desktop_file_hint); remote()->transact( ON_SESSION_UNFOCUSED_NOTIFICATION, in, &out, android::IBinder::FLAG_ONEWAY); } void BpApplicationManagerObserver::on_session_focused(int id, int stage_hint, const String8& desktop_file_hint) { Parcel in, out; in.writeInt32(id); in.writeInt32(stage_hint); in.writeString8(desktop_file_hint); remote()->transact( ON_SESSION_FOCUSED_NOTIFICATION, in, &out, android::IBinder::FLAG_ONEWAY); } void BpApplicationManagerObserver::on_keyboard_geometry_changed(int x, int y, int width, int height) { Parcel in, out; in.writeInt32(x); in.writeInt32(y); in.writeInt32(width); in.writeInt32(height); remote()->transact( ON_KEYBOARD_GEOMETRY_CHANGED_NOTIFICATION, in, &out, android::IBinder::FLAG_ONEWAY); } void BpApplicationManagerObserver::on_session_requested_fullscreen(int id, int stage_hint, const String8& desktop_file_hint) { Parcel in, out; in.writeInt32(id); in.writeInt32(stage_hint); in.writeString8(desktop_file_hint); remote()->transact( ON_SESSION_REQUESTED_FULLSCREEN_NOTIFICATION, in, &out, android::IBinder::FLAG_ONEWAY); } void BpApplicationManagerObserver::on_session_died(int id, int stage_hint, const String8& desktop_file_hint) { Parcel in, out; in.writeInt32(id); in.writeInt32(stage_hint); in.writeString8(desktop_file_hint); remote()->transact( ON_SESSION_DIED_NOTIFICATION, in, &out, android::IBinder::FLAG_ONEWAY); } BnApplicationManager::BnApplicationManager() { } BnApplicationManager::~BnApplicationManager() { } status_t BnApplicationManager::onTransact(uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch(code) { case START_A_NEW_SESSION_COMMAND: { int32_t session_type = data.readInt32(); int32_t stage_hint = data.readInt32(); String8 app_name = data.readString8(); String8 desktop_file = data.readString8(); sp binder = data.readStrongBinder(); sp session(new BpApplicationManagerSession(binder)); int fd = data.readFileDescriptor(); uint32_t remote_pid = data.readInt32(); start_a_new_session(session_type, stage_hint, app_name, desktop_file, session, fd, remote_pid); } break; case REGISTER_A_SURFACE_COMMAND: { String8 title = data.readString8(); sp binder = data.readStrongBinder(); sp session(new BpApplicationManagerSession(binder)); int32_t surface_role = data.readInt32(); int32_t surface_token = data.readInt32(); int fd = data.readFileDescriptor(); register_a_surface(title, session, surface_role, surface_token, fd); } break; case GET_SESSION_PID_COMMAND: { sp binder = data.readStrongBinder(); sp session(new BpApplicationManagerSession(binder)); int pid = get_session_pid(session); reply->writeInt32(pid); } break; case REQUEST_FULLSCREEN_COMMAND: { sp binder = data.readStrongBinder(); sp session(new BpApplicationManagerSession(binder)); request_fullscreen(session); } break; case REGISTER_AN_OBSERVER_COMMAND: { sp binder = data.readStrongBinder(); sp observer(new BpApplicationManagerObserver(binder)); register_an_observer(observer); break; } case REGISTER_TASK_CONTROLLER_COMMAND: { sp binder = data.readStrongBinder(); sp controller(new BpAMTaskController(binder)); register_task_controller(controller); break; } case REQUEST_UPDATE_FOR_SESSION_COMMAND: { sp binder = data.readStrongBinder(); sp session(new BpApplicationManagerSession(binder)); request_update_for_session(session); break; } case UNFOCUS_RUNNING_SESSIONS_COMMAND: { unfocus_running_sessions(); break; } case FOCUS_RUNNING_SESSION_WITH_ID_COMMAND: { int32_t id = data.readInt32(); focus_running_session_with_id(id); break; } case QUERY_SNAPSHOT_LAYER_FOR_SESSION_WITH_ID_COMMAND: { int32_t id = data.readInt32(); int32_t layer = query_snapshot_layer_for_session_with_id(id); reply->writeInt32(layer); break; } case QUERY_SURFACE_PROPERTIES_FOR_SESSION_ID_COMMAND: { int32_t id = data.readInt32(); IApplicationManagerSession::SurfaceProperties props = query_surface_properties_for_session_id(id); reply->writeInt32(props.layer); reply->writeInt32(props.left); reply->writeInt32(props.top); reply->writeInt32(props.right); reply->writeInt32(props.bottom); break; } case SWITCH_TO_WELL_KNOWN_APPLICATION_COMMAND: { int32_t app = data.readInt32(); switch_to_well_known_application(app); break; } case SET_SURFACE_TRAP_COMMAND: { int32_t x = data.readInt32(); int32_t y = data.readInt32(); int32_t width = data.readInt32(); int32_t height = data.readInt32(); int32_t handle = set_surface_trap(x, y, width, height); reply->writeInt32(handle); break; } case UNSET_SURFACE_TRAP_COMMAND: { int32_t handle = data.readInt32(); unset_surface_trap(handle); break; } case REPORT_OSK_VISIBLE_COMMAND: { int32_t x = data.readInt32(); int32_t y = data.readInt32(); int32_t width = data.readInt32(); int32_t height = data.readInt32(); report_osk_visible(x, y, width, height); break; } case REPORT_OSK_INVISIBLE_COMMAND: { report_osk_invisible(); break; } case REPORT_NOTIFICATION_VISIBLE_COMMAND: { report_notification_visible(); break; } case REPORT_NOTIFICATION_INVISIBLE_COMMAND: { report_notification_invisible(); break; } } return NO_ERROR; } BpApplicationManager::BpApplicationManager(const sp& impl) : BpInterface(impl) { } BpApplicationManager::~BpApplicationManager() { } void BpApplicationManager::start_a_new_session( int32_t session_type, int32_t stage_hint, const String8& app_name, const String8& desktop_file, const sp& session, int fd, uint32_t remote_pid) { //printf("%s \n", __PRETTY_FUNCTION__); Parcel in, out; in.pushAllowFds(true); in.writeInt32(session_type); in.writeInt32(stage_hint); in.writeString8(app_name); in.writeString8(desktop_file); in.writeStrongBinder(session->asBinder()); in.writeFileDescriptor(fd); in.writeInt32(remote_pid); remote()->transact(START_A_NEW_SESSION_COMMAND, in, &out); } void BpApplicationManager::register_a_surface( const String8& title, const sp& session, int32_t surface_role, int32_t token, int fd) { //printf("%s \n", __PRETTY_FUNCTION__); Parcel in, out; in.pushAllowFds(true); in.writeString8(title); in.writeStrongBinder(session->asBinder()); in.writeInt32(surface_role); in.writeInt32(token); in.writeFileDescriptor(fd); remote()->transact(REGISTER_A_SURFACE_COMMAND, in, &out); } int BpApplicationManager::get_session_pid( const sp& session) { Parcel in, out; in.writeStrongBinder(session->asBinder()); remote()->transact(GET_SESSION_PID_COMMAND, in, &out); int32_t pid = out.readInt32(); return pid; } void BpApplicationManager::request_fullscreen( const sp& session) { //printf("%s \n", __PRETTY_FUNCTION__); Parcel in, out; in.writeStrongBinder(session->asBinder()); remote()->transact(REQUEST_FULLSCREEN_COMMAND, in, &out); } void BpApplicationManager::register_task_controller(const sp& controller) { Parcel in, out; in.writeStrongBinder(controller->asBinder()); remote()->transact(REGISTER_TASK_CONTROLLER_COMMAND, in, &out); } void BpApplicationManager::register_an_observer(const sp& observer) { Parcel in, out; in.writeStrongBinder(observer->asBinder()); remote()->transact(REGISTER_AN_OBSERVER_COMMAND, in, &out); } void BpApplicationManager::request_update_for_session(const sp& session) { Parcel in, out; in.writeStrongBinder(session->asBinder()); remote()->transact(REQUEST_UPDATE_FOR_SESSION_COMMAND, in, &out); } void BpApplicationManager::unfocus_running_sessions() { Parcel in, out; remote()->transact(UNFOCUS_RUNNING_SESSIONS_COMMAND, in, &out); } void BpApplicationManager::focus_running_session_with_id(int id) { Parcel in, out; in.writeInt32(id); remote()->transact(FOCUS_RUNNING_SESSION_WITH_ID_COMMAND, in, &out); } int32_t BpApplicationManager::query_snapshot_layer_for_session_with_id(int id) { Parcel in, out; in.writeInt32(id); remote()->transact(QUERY_SNAPSHOT_LAYER_FOR_SESSION_WITH_ID_COMMAND, in, &out); int32_t layer = out.readInt32(); return layer; } IApplicationManagerSession::SurfaceProperties BpApplicationManager::query_surface_properties_for_session_id(int id) { Parcel in, out; in.writeInt32(id); remote()->transact(QUERY_SURFACE_PROPERTIES_FOR_SESSION_ID_COMMAND, in, &out); IApplicationManagerSession::SurfaceProperties props; props.layer = out.readInt32(); props.left = out.readInt32(); props.top = out.readInt32(); props.right = out.readInt32(); props.bottom = out.readInt32(); return props; } void BpApplicationManager::switch_to_well_known_application(int32_t app) { Parcel in, out; in.writeInt32(app); remote()->transact(SWITCH_TO_WELL_KNOWN_APPLICATION_COMMAND, in, &out); } int32_t BpApplicationManager::set_surface_trap(int32_t x, int32_t y, int32_t width, int32_t height) { Parcel in, out; in.writeInt32(x); in.writeInt32(y); in.writeInt32(width); in.writeInt32(height); remote()->transact(SET_SURFACE_TRAP_COMMAND, in, &out); int32_t handle = out.readInt32(); return handle; } void BpApplicationManager::unset_surface_trap(int32_t handle) { Parcel in, out; in.writeInt32(handle); remote()->transact(UNSET_SURFACE_TRAP_COMMAND, in, &out); } void BpApplicationManager::report_osk_visible(int32_t x, int32_t y, int32_t width, int32_t height) { Parcel in, out; in.writeInt32(x); in.writeInt32(y); in.writeInt32(width); in.writeInt32(height); remote()->transact(REPORT_OSK_VISIBLE_COMMAND, in, &out); } void BpApplicationManager::report_osk_invisible() { Parcel in, out; remote()->transact(REPORT_OSK_INVISIBLE_COMMAND, in, &out); } void BpApplicationManager::report_notification_visible() { Parcel in, out; remote()->transact(REPORT_NOTIFICATION_VISIBLE_COMMAND, in, &out); } void BpApplicationManager::report_notification_invisible() { Parcel in, out; remote()->transact(REPORT_NOTIFICATION_INVISIBLE_COMMAND, in, &out); } } platform-api-0.20+14.04.20140411/android/hybris/test_gps_api.cpp0000644000015301777760000001432412322054725024533 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by: Daniel d'Andrada */ #include #include #include #include #include #include class GPSTest { public: GPSTest(); ~GPSTest(); bool init_and_start(); bool stop(); void inject_time(); UbuntuGps ubuntu_gps; }; void gps_location_cb(UbuntuGpsLocation* location, void* context) { printf("gps_location_cb() called.\n"); } void gps_status_cb(uint16_t status, void* context) { switch(status) { case UBUNTU_GPS_STATUS_NONE: printf("status: None\n"); break; case UBUNTU_GPS_STATUS_SESSION_BEGIN: printf("status: Session Begin\n"); break; case UBUNTU_GPS_STATUS_SESSION_END: printf("status: Session End\n"); break; case UBUNTU_GPS_STATUS_ENGINE_ON: printf("status: Engine On\n"); break; case UBUNTU_GPS_STATUS_ENGINE_OFF: printf("status: Engine Off\n"); default: break; }; } void gps_sb_status_cb(UbuntuGpsSvStatus* sv_info, void* context) { printf("gps_sb_status_cb() called, listing %d space vehicles\n", sv_info->num_svs); } void gps_nmea_cb(int64_t timestamp, const char* nmea, int length, void* context) { char str[length+1]; memcpy(str, nmea, length); str[length] = 0; printf("gps_nmea_cb() - %s\n", str); } void gps_set_cabapilities_cb(uint32_t capabilities, void* context) { printf("gps_set_cabapilities_cb() -"); if (capabilities & UBUNTU_GPS_CAPABILITY_SCHEDULING) printf(" scheduling"); if (capabilities & UBUNTU_GPS_CAPABILITY_MSB) printf(" MSB"); if (capabilities & UBUNTU_GPS_CAPABILITY_MSA) printf(" MSA"); if (capabilities & UBUNTU_GPS_CAPABILITY_SINGLE_SHOT) printf(" 'single shot'"); if (capabilities & UBUNTU_GPS_CAPABILITY_ON_DEMAND_TIME) printf(" 'on demand time'"); printf("\n"); } void gps_request_utc_time_cb(void* context) { printf("gps_request_utc_time_cb() called.\n"); ((GPSTest*)context)->inject_time(); } void gps_xtra_download_request_cb(void* context) { printf("gps_xtra_download_request_cb() called.\n"); } void agps_status_cb(UbuntuAgpsStatus* status, void* context) { printf("agps status -"); if (status->type == UBUNTU_AGPS_TYPE_SUPL) printf(" SUPL"); else printf(" C2K"); switch (status->status) { case UBUNTU_GPS_REQUEST_AGPS_DATA_CONN: printf(", request AGPS data connection"); break; case UBUNTU_GPS_RELEASE_AGPS_DATA_CONN: printf(", release AGPS data connection"); break; case UBUNTU_GPS_AGPS_DATA_CONNECTED: printf(", request AGPS data connected"); break; case UBUNTU_GPS_AGPS_DATA_CONN_DONE: printf(", AGPS data connection done"); break; default: case UBUNTU_GPS_AGPS_DATA_CONN_FAILED: printf(", AGPS data connection failed"); break; } printf(" ipaddr=%u\n", status->ipaddr); } void gps_notify_cb(UbuntuGpsNiNotification *notification, void* context) { printf("gps_notify_cb() called.\n"); } void agps_ril_request_set_id_cb(uint32_t flags, void* context) { printf("agps_ril_request_set_id_cb() called.\n"); } void agps_ril_request_refloc_cb(uint32_t flags, void* context) { printf("agps_ril_request_refloc_cb() called.\n"); } GPSTest::GPSTest() : ubuntu_gps(NULL) { } GPSTest::~GPSTest() { if (ubuntu_gps) ubuntu_gps_delete(ubuntu_gps); } void GPSTest::inject_time() { // A real implementation would inject time from some NTP server. time_t t = time(0); int64_t time_millis = (int64_t)t * (int64_t)1000; ubuntu_gps_inject_time(ubuntu_gps, time_millis /*NTP time would go here*/, time_millis /*internal time when that NTP time was taken*/, 10 /* possible deviation, in milliseconds*/); } bool GPSTest::init_and_start() { UbuntuGpsParams gps_params; gps_params.location_cb = gps_location_cb; gps_params.status_cb = gps_status_cb; gps_params.sv_status_cb = gps_sb_status_cb; gps_params.nmea_cb = gps_nmea_cb; gps_params.set_capabilities_cb = gps_set_cabapilities_cb; gps_params.request_utc_time_cb = gps_request_utc_time_cb; gps_params.xtra_download_request_cb = gps_xtra_download_request_cb; gps_params.agps_status_cb = agps_status_cb; gps_params.gps_ni_notify_cb = gps_notify_cb; gps_params.request_setid_cb = agps_ril_request_set_id_cb; gps_params.request_refloc_cb = agps_ril_request_refloc_cb; gps_params.context = this; UbuntuGps ubuntu_gps = ubuntu_gps_new(&gps_params); if (!ubuntu_gps) { printf("GPS creation failed!\n"); return false; } bool ok = ubuntu_gps_start(ubuntu_gps); if (!ok) { printf("GPS start up failed!\n"); return false; } return true; } bool GPSTest::stop() { bool ok = ubuntu_gps_stop(ubuntu_gps); if (!ok) printf("failed when stopping GPS!\n"); return ok; } void wait_for_sigint() { sigset_t signals; sigemptyset(&signals); sigaddset(&signals, SIGINT); int sig; int result = sigwait(&signals, &sig); if (result != 0) printf("sigwait failed!\n"); } int main(int argc, char** argv) { int return_value = 0; GPSTest test; if (!test.init_and_start()) return 1; printf("GPS initialized and started. Now waiting for callbacks or SIGINT (to quit).\n"); wait_for_sigint(); printf("Exiting...\n"); if (!test.stop()) return 1; printf("GPS stopped.\n"); return 0; } platform-api-0.20+14.04.20140411/android/hybris/test.cpp0000644000015301777760000002256312322054725023035 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #include #include #include #include #include #include #include #include #include namespace { struct InputListener : public ubuntu::application::ui::input::Listener { void on_new_event(const Event& /*ev*/) { printf("%s \n", __PRETTY_FUNCTION__); } }; struct View { static const char* vertex_shader(); static const char* fragment_shader(); static GLuint load_shader(GLenum shaderType, const char* pSource); static GLuint create_program(const char* pVertexSource, const char* pFragmentSource); static const GLfloat* triangle() { static const GLfloat result[] = { -0.125f, -0.125f, 0.0f, 0.5f, 0.0f, 0.125f, 0.0f, 0.5f, 0.125f, -0.125f, 0.0f, 0.5f }; return result; } static const GLfloat* color_triangle() { static const GLfloat result[] = { 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f }; return result; } View(const ubuntu::application::ui::Surface::Ptr& surface); void render(); void step(); ubuntu::application::ui::Surface::Ptr surface; EGLDisplay egl_display; EGLSurface egl_surface; EGLConfig egl_config; EGLContext egl_context; GLfloat rotation_angle; GLuint gProgram; GLuint gvPositionHandle, gvColorHandle; GLuint rotation_uniform; GLint num_vertex; const GLfloat * vertex_data; const GLfloat * color_data; }; } int main(int argc, char** argv) { ubuntu::application::ui::init(argc, argv); ubuntu::application::ui::Setup::instance(); ::SessionCredentials sc; memset(&sc, 0, sizeof(sc)); snprintf(sc.application_name, sizeof(sc.application_name), "TestTestTest"); ubuntu::application::ui::SessionCredentials creds(&sc); ubuntu::application::ui::Session::Ptr session = ubuntu::ui::SessionService::instance()->start_a_new_session(creds); ubuntu::application::ui::PhysicalDisplayInfo::Ptr p = session->physical_display_info(ubuntu::application::ui::primary_physical_display); printf("Resolution: (%dx%d)\n", p->horizontal_resolution(), p->vertical_resolution()); ubuntu::application::ui::SurfaceProperties props = { "MainActorSurface", 500, 500, ubuntu::application::ui::main_actor_role }; ubuntu::application::ui::Surface::Ptr surface = session->create_surface( props, ubuntu::application::ui::input::Listener::Ptr(new InputListener())); surface->set_alpha(0.5f); View view(surface); int x = 0; while (true) { view.render(); view.step(); x++; surface->move_to(x % p->horizontal_resolution(), 0); } } namespace { const char* View::vertex_shader() { static const char shader[] = "attribute vec4 vPosition;\n" "attribute vec4 vColor;\n" "uniform float angle;\n" "varying vec4 colorinfo;\n" "void main() {\n" " mat3 rot_z = mat3( vec3( cos(angle), sin(angle), 0.0),\n" " vec3(-sin(angle), cos(angle), 0.0),\n" " vec3( 0.0, 0.0, 1.0));\n" " gl_Position = vec4(rot_z * vPosition.xyz, 1.0);\n" " colorinfo = vColor;\n" "}\n"; return shader; } const char* View::fragment_shader() { static const char shader[] = "precision mediump float;\n" "varying vec4 colorinfo;\n" "void main() {\n" " gl_FragColor = colorinfo;\n" "}\n"; return shader; } GLuint View::load_shader(GLenum shaderType, const char* pSource) { GLuint shader = glCreateShader(shaderType); if (shader) { glShaderSource(shader, 1, &pSource, NULL); glCompileShader(shader); GLint compiled = 0; glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled); if (!compiled) { GLint infoLen = 0; glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen); if (infoLen) { char* buf = (char*) malloc(infoLen); if (buf) { glGetShaderInfoLog(shader, infoLen, NULL, buf); fprintf(stderr, "Could not compile shader %d:\n%s\n", shaderType, buf); free(buf); } glDeleteShader(shader); shader = 0; } } } else { printf("Error, during shader creation: %i\n", glGetError()); } return shader; } GLuint View::create_program(const char* pVertexSource, const char* pFragmentSource) { GLuint vertexShader = load_shader(GL_VERTEX_SHADER, pVertexSource); if (!vertexShader) { printf("vertex shader not compiled\n"); return 0; } GLuint pixelShader = load_shader(GL_FRAGMENT_SHADER, pFragmentSource); if (!pixelShader) { printf("frag shader not compiled\n"); return 0; } GLuint program = glCreateProgram(); if (program) { glAttachShader(program, vertexShader); glAttachShader(program, pixelShader); glLinkProgram(program); GLint linkStatus = GL_FALSE; glGetProgramiv(program, GL_LINK_STATUS, &linkStatus); if (linkStatus != GL_TRUE) { GLint bufLength = 0; glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength); if (bufLength) { char* buf = (char*) malloc(bufLength); if (buf) { glGetProgramInfoLog(program, bufLength, NULL, buf); fprintf(stderr, "Could not link program:\n%s\n", buf); free(buf); } } glDeleteProgram(program); program = 0; } } return program; } View::View(const ubuntu::application::ui::Surface::Ptr& surface) : surface(surface), rotation_angle(0.f), num_vertex(3) { // assert(eglBindAPI(EGL_OPENGL_ES_API) == EGL_TRUE); egl_display = eglGetDisplay(EGL_DEFAULT_DISPLAY); assert(egl_display != EGL_NO_DISPLAY); EGLint major, minor; if (EGL_FALSE == eglInitialize(egl_display, &major, &minor)) { printf("egl error: problem initializing.\n"); exit(1); } EGLint attribs[] = { EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_NONE }; EGLint n; if (EGL_FALSE == eglChooseConfig( egl_display, attribs, &egl_config, 1, &n)) { printf("egl error: Cannot choose configuration.\n"); } EGLint context_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; egl_context = eglCreateContext( egl_display, egl_config, EGL_NO_CONTEXT, context_attribs); assert(EGL_NO_CONTEXT != eglContext); EGLNativeWindowType nativeWindow = surface->to_native_window_type(); egl_surface = eglCreateWindowSurface(egl_display, egl_config, nativeWindow, NULL); eglMakeCurrent( egl_display, egl_surface, egl_surface, egl_context); vertex_data = triangle(); color_data = color_triangle(); gProgram = create_program(vertex_shader(), fragment_shader()); if (!gProgram) { printf("error making program\n"); return; } gvPositionHandle = glGetAttribLocation(gProgram, "vPosition"); gvColorHandle = glGetAttribLocation(gProgram, "vColor"); rotation_uniform = glGetUniformLocation(gProgram, "angle"); return; } void View::render() { glUseProgram(gProgram); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); glUniform1fv(rotation_uniform, 1, &rotation_angle); glVertexAttribPointer( gvColorHandle, num_vertex, GL_FLOAT, GL_FALSE, sizeof(GLfloat)*4, color_data); glVertexAttribPointer( gvPositionHandle, num_vertex, GL_FLOAT, GL_FALSE, 0, vertex_data); glEnableVertexAttribArray(gvPositionHandle); glEnableVertexAttribArray(gvColorHandle); glDrawArrays(GL_TRIANGLE_STRIP, 0, num_vertex); glDisableVertexAttribArray(gvPositionHandle); glDisableVertexAttribArray(gvColorHandle); eglSwapBuffers(egl_display, egl_surface); } void View::step() { rotation_angle += 0.01; } } platform-api-0.20+14.04.20140411/android/hybris/default_application_manager.cpp0000644000015301777760000012236112322054725027554 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #undef LOG_TAG #define LOG_TAG "ubuntu::detail::ApplicationManager" #include "default_application_manager.h" #include "default_application_manager_input_setup.h" #include "default_application_session.h" #include "default_shell.h" #include #include #include #include #include #if ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR<=2 #include #else #include #endif #include #include #include #include #include #include #include #include #include namespace ubuntu { namespace detail { template const T& min(const T& lhs, const U& rhs) { return lhs < rhs ? lhs : rhs; } /* TODO: Currently we need to map local pids to the ones of the * container where Ubuntu is running as sessions need to be * referenced to observers in terms of the said namespace. */ pid_t pid_to_vpid(int pid) { ALOGI("%s(%d)", __PRETTY_FUNCTION__, pid); if (pid <= 0) return -1; char proc_name[128], buf[1024]; char *rpid; char key[] = "Vpid:"; sprintf(proc_name, "/proc/%d/status", pid); int fd; fd = open(proc_name, O_RDONLY); if (fd < 0) { ALOGI("%s(): Cannot find %s\n", __PRETTY_FUNCTION__, proc_name); return -1; } memset(buf, '\0', sizeof(buf)); read(fd, buf, sizeof(buf)); rpid = strstr(buf, key); close(fd); if (rpid == NULL) { ALOGI("%s(): Vpid not supported\n", __PRETTY_FUNCTION__); return pid; } return atoi(rpid+sizeof(key)); } bool is_session_allowed_to_run_in_background( const android::sp& session) { ALOGI("%s: %s", __PRETTY_FUNCTION__, session->desktop_file.string()); static const android::String8 phone_app_desktop_file("/usr/share/applications/phone-app.desktop"); static const android::String8 music_app_desktop_file("/usr/share/applications/music-app.desktop"); if (session->desktop_file == phone_app_desktop_file || session->desktop_file == music_app_desktop_file) { return true; } return false; } bool write_proc_file(pid_t pid, const char* filename, const char* value) { char proc_name[128]; sprintf(proc_name, "/proc/%d/%s", pid, filename); int file; if (access(proc_name, F_OK) == 0) { file = open(proc_name, O_WRONLY); write(file, value, sizeof(value)); close(file); return true; } else return false; } void update_oom_values(const android::sp& session) { if (session->session_type == ubuntu::application::ui::system_session_type) { if (!write_proc_file(session->pid, "oom_score_adj", "-940")) write_proc_file(session->pid, "oom_adj", "-16"); return; } if (session->running_state == ubuntu::application::ui::process_suspended) { if (!write_proc_file(session->pid, "oom_score_adj", "1000")) write_proc_file(session->pid, "oom_adj", "15"); } else { if (!write_proc_file(session->pid, "oom_score_adj", "0")) write_proc_file(session->pid, "oom_adj", "0"); } } template int ApplicationManager::ShellInputSetup::Window::looper_callback(int receiveFd, int events, void* ctxt) { // ALOGI("%s", __PRETTY_FUNCTION__); bool result = true; ApplicationManager::ShellInputSetup::Window* window = static_cast*>(ctxt); //window->input_consumer.receiveDispatchSignal(); uint32_t seq; android::InputEvent* ev; static const bool consume_batches = true; static const nsecs_t frame_time = -1; switch(window->input_consumer.consume(&window->event_factory, consume_batches, frame_time, &seq, &ev)) { case android::OK: result = true; //printf("We have a client side event for process %d. \n", getpid()); window->input_consumer.sendFinishedSignal(seq, result); break; case android::INVALID_OPERATION: result = true; break; case android::NO_MEMORY: result = true; break; } return result ? 1 : 0; } template ApplicationManager::ShellInputSetup::Window::Window( ApplicationManager::ShellInputSetup* parent, int _x, int _y, int _w, int _h) : parent(parent), input_consumer(client_channel) { auto window = new android::InputSetup::DummyApplicationWindow( parent->shell_application, _x, _y, _w, _h); android::InputChannel::openInputChannelPair( android::String8("DummyShellInputChannel"), server_channel, client_channel); window->input_channel = server_channel; input_window = window; parent->input_manager->getDispatcher()->registerInputChannel( window->input_channel, input_window, false); input_consumer = android::InputConsumer(client_channel); // input_consumer.initialize(); parent->looper->addFd(client_channel->getFd(), //client_channel->getReceivePipeFd(), 0, ALOOPER_EVENT_INPUT, looper_callback, this); } ApplicationManager::ShellInputSetup::DisplayInfo::DisplayInfo() { auto display = android::SurfaceComposerClient::getBuiltInDisplay( android::ISurfaceComposer::eDisplayIdMain); android::SurfaceComposerClient::getDisplayInfo( display, &info); } ApplicationManager::ShellInputSetup::ShellInputSetup(const android::sp& input_manager) : shell_has_focus(true), input_manager(input_manager), shell_application(new android::InputSetup::DummyApplication()), looper(new android::Looper(true)), event_loop(looper), event_trap_window(this, 0, 0, display_info.info.w, display_info.info.h), osk_window(this), notifications_window(this) { event_loop.run(); } ApplicationManager::InputFilter::InputFilter(ApplicationManager* manager) : manager(manager) { } bool ApplicationManager::InputFilter::filter_event(const android::InputEvent* event) { bool result = true; switch (event->getType()) { case AINPUT_EVENT_TYPE_KEY: result = handle_key_event(static_cast(event)); break; } return result; } bool ApplicationManager::InputFilter::handle_key_event(const android::KeyEvent* event) { bool result = true; return result; } ApplicationManager::LockingIterator::LockingIterator( ApplicationManager* manager, size_t index) : manager(manager), it(index) { } void ApplicationManager::LockingIterator::advance() { it += 1; } bool ApplicationManager::LockingIterator::is_valid() const { return it < manager->apps.size(); } void ApplicationManager::LockingIterator::make_current() { //printf("%s \n", __PRETTY_FUNCTION__); } const android::sp& ApplicationManager::LockingIterator::operator*() { return manager->apps.valueFor(manager->apps_as_added[it]); } ApplicationManager::LockingIterator::~LockingIterator() { manager->unlock(); } ApplicationManager::ApplicationManager() : input_filter(new InputFilter(this)), input_setup(new android::InputSetup(input_filter)), is_osk_visible(false), are_notifications_visible(false), app_manager_task_controller(NULL), focused_application(0), side_stage_application(0), main_stage_application(0) { shell_input_setup = new ShellInputSetup(input_setup->input_manager); input_setup->input_manager->getDispatcher()->setFocusedApplication( shell_input_setup->shell_application); android::Vector< android::sp > input_windows; input_windows.push(shell_input_setup->event_trap_window.input_window); input_setup->input_manager->getDispatcher()->setInputWindows( input_windows); input_setup->start(); } void ApplicationManager::update_app_lists() { int idx; for (idx = apps_as_added.size()-1; idx >= 0; idx--) { const android::sp& session = apps.valueFor(apps_as_added[idx]); if (session->session_type == ubuntu::application::ui::system_session_type) continue; if (session->stage_hint == ubuntu::application::ui::side_stage) { side_stage_application = idx; break; } } if (idx < 0) side_stage_application = 0; for (idx = apps_as_added.size()-1; idx >= 0; idx--) { const android::sp& session = apps.valueFor(apps_as_added[idx]); if (session->session_type == ubuntu::application::ui::system_session_type) continue; if (session->stage_hint == ubuntu::application::ui::main_stage) { main_stage_application = idx; break; } } if (idx < 0) main_stage_application = 0; } // From DeathRecipient void ApplicationManager::binderDied(const android::wp& who) { android::Mutex::Autolock al(guard); android::sp sp = who.promote(); ALOGI("%s():%d\n", __PRETTY_FUNCTION__, __LINE__); const android::sp& dead_session = apps.valueFor(sp); ALOGI("%s():%d -- remote_pid=%d desktop_file=%s\n", __PRETTY_FUNCTION__, __LINE__, dead_session->remote_pid, dead_session->desktop_file.string()); notify_observers_about_session_died(dead_session->remote_pid, dead_session->stage_hint, dead_session->desktop_file); ALOGI("%s():%d\n", __PRETTY_FUNCTION__, __LINE__); size_t i = 0; for(i = 0; i < apps_as_added.size(); i++) if (apps_as_added[i] == sp) break; ALOGI("%s():%d\n", __PRETTY_FUNCTION__, __LINE__); size_t next_focused_app = 0; next_focused_app = apps_as_added.removeAt(i); ALOGI("%s():%d\n", __PRETTY_FUNCTION__, __LINE__); next_focused_app = main_stage_application; update_app_lists(); ALOGI("%s():%d\n", __PRETTY_FUNCTION__, __LINE__); if (dead_session->stage_hint == ubuntu::application::ui::side_stage) next_focused_app = side_stage_application ? side_stage_application : next_focused_app; ALOGI("%s():%d\n", __PRETTY_FUNCTION__, __LINE__); if (dead_session->stage_hint == ubuntu::application::ui::main_stage) next_focused_app = main_stage_application; ALOGI("%s():%d\n", __PRETTY_FUNCTION__, __LINE__); if (i && i == focused_application && shell_input_setup->shell_has_focus == false) { switch_focused_application_locked(next_focused_app); } else if(focused_application > i) focused_application--; if (i == 0) { shell_input_setup->trap_windows.clear(); shell_input_setup->shell_has_focus = true; } ALOGI("%s():%d\n", __PRETTY_FUNCTION__, __LINE__); apps.removeItem(sp); ALOGI("%s():%d\n", __PRETTY_FUNCTION__, __LINE__); } void ApplicationManager::lock() { guard.lock(); } void ApplicationManager::unlock() { guard.unlock(); } android::sp ApplicationManager::iterator() { lock(); android::sp it( new ApplicationManager::LockingIterator(this, 0)); return it; } void ApplicationManager::session_set_state(const android::sp& as, int32_t new_state) { ALOGI("%s():%d running->running", __PRETTY_FUNCTION__, __LINE__); switch (new_state) { case ubuntu::application::ui::process_running: { if (as->running_state == ubuntu::application::ui::process_running) { ALOGI("%s():%d running->running", __PRETTY_FUNCTION__, __LINE__); /* FIXME: * Technically invalid, this transition currently is hit because * of focus being requested on the session before its delagate call */ } else if (as->running_state == ubuntu::application::ui::process_destroyed) { ALOGI("%s():%d destroyed->running", __PRETTY_FUNCTION__, __LINE__); /* TODO: * Resume application with a null archive handler */ } else if (as->running_state == ubuntu::application::ui::process_stopped) { ALOGI("%s():%d stopped->running", __PRETTY_FUNCTION__, __LINE__); /* TODO: * Support starting the new process and wait for the * session to be available to call its delegate */ return; } else { /* suspended->running * nothing to do, process image still in memory */ if (app_manager_task_controller != NULL) app_manager_task_controller->continue_task(as->remote_pid); else kill(as->pid, SIGCONT); } as->running_state = ubuntu::application::ui::process_running; as->on_application_resumed(); update_oom_values(as); } break; case ubuntu::application::ui::process_suspended: { ALOGI("%s() state->suspended", __PRETTY_FUNCTION__); /* TODO: create archive */ as->on_application_about_to_stop(); as->running_state = ubuntu::application::ui::process_suspended; android::sp deferred_kill(new ubuntu::application::ProcessKiller(as, app_manager_task_controller)); deferred_kill->run(); update_oom_values(as); } break; case ubuntu::application::ui::process_stopped: { ALOGI("%s() state->stopped", __PRETTY_FUNCTION__); /* TODO: * This transition occurs while SIGSTOP'd. Check we hold a valid archive * and then destroy the process image. No need to signal via delegates. */ as->running_state = ubuntu::application::ui::process_stopped; } break; case ubuntu::application::ui::process_destroyed: { ALOGI("%s() state->destroyed", __PRETTY_FUNCTION__); /* TODO: * Internal transition: Invalidate archive if any, destroy * process image. */ as->running_state = ubuntu::application::ui::process_destroyed; } break; } } void ApplicationManager::start_a_new_session( int32_t session_type, int32_t stage_hint, const android::String8& app_name, const android::String8& desktop_file, const android::sp& session, int fd, uint32_t remote_pid) { android::Mutex::Autolock al(guard); (void) session_type; pid_t pid = android::IPCThreadState::self()->getCallingPid(); pid_t rpid; if (!remote_pid) { ALOGI("%s() no remote_pid set from client, lookup in proc", __PRETTY_FUNCTION__); rpid = pid_to_vpid(pid); } else { ALOGI("%s() remote_pid=%d", __PRETTY_FUNCTION__, remote_pid); rpid = static_cast(remote_pid); } ALOGI("%s() starting new session pid=%d rpid=%d", __PRETTY_FUNCTION__, pid, rpid); android::sp app_session( new ubuntu::detail::ApplicationSession( pid, rpid, session, session_type, stage_hint, app_name, desktop_file)); apps.add(session->asBinder(), app_session); apps_as_added.push_back(session->asBinder()); session->asBinder()->linkToDeath( android::sp(this)); switch(session_type) { case ubuntu::application::ui::user_session_type: ALOGI("%s: Invoked for user_session_type \n", __PRETTY_FUNCTION__); break; case ubuntu::application::ui::system_session_type: ALOGI("%s: Invoked for system_session_type \n", __PRETTY_FUNCTION__); break; } notify_observers_about_session_born(app_session->remote_pid, app_session->stage_hint, app_session->desktop_file); ALOGI("%s():%d session", __PRETTY_FUNCTION__, __LINE__); } void ApplicationManager::register_a_surface( const android::String8& title, const android::sp& session, int32_t surface_role, int32_t token, int fd) { android::Mutex::Autolock al(guard); android::sp input_channel( new android::InputChannel( title, dup(fd))); android::sp surface( new ubuntu::detail::ApplicationSession::Surface( apps.valueFor(session->asBinder()).get(), input_channel, surface_role, token)); auto registered_session = apps.valueFor(session->asBinder()); ALOGI("Registering input channel as observer: %s", registered_session->session_type == ubuntu::application::ui::system_session_type ? "true" : "false"); input_setup->input_manager->getDispatcher()->registerInputChannel( surface->input_channel, surface->make_input_window_handle(), registered_session->session_type == ubuntu::application::ui::system_session_type); registered_session->register_surface(surface); if (registered_session->session_type == ubuntu::application::ui::system_session_type) { ALOGI("New surface for system session, adjusting layer now."); switch(surface_role) { case ubuntu::application::ui::dash_actor_role: registered_session->raise_surface_to_layer(token, default_dash_layer); break; case ubuntu::application::ui::indicator_actor_role: registered_session->raise_surface_to_layer(token, default_indicator_layer); break; case ubuntu::application::ui::notifications_actor_role: registered_session->raise_surface_to_layer(token, default_notifications_layer); break; case ubuntu::application::ui::greeter_actor_role: registered_session->raise_surface_to_layer(token, default_greeter_layer); break; case ubuntu::application::ui::launcher_actor_role: registered_session->raise_surface_to_layer(token, default_launcher_layer); break; case ubuntu::application::ui::on_screen_keyboard_actor_role: registered_session->raise_surface_to_layer(token, default_osk_layer); break; case ubuntu::application::ui::shutdown_dialog_actor_role: registered_session->raise_surface_to_layer(token, default_shutdown_dialog_layer); break; } } } void ApplicationManager::request_fullscreen(const android::sp& session) { ALOGI("%s", __PRETTY_FUNCTION__); android::Mutex::Autolock al(guard); const android::sp& as = apps.valueFor(session->asBinder()); notify_observers_about_session_requested_fullscreen( as->remote_pid, as->stage_hint, as->desktop_file); } int ApplicationManager::get_session_pid(const android::sp& session) { ALOGI("%s", __PRETTY_FUNCTION__); android::Mutex::Autolock al(guard); if (apps.indexOfKey(session->asBinder()) == android::NAME_NOT_FOUND) return 0; const android::sp& as = apps.valueFor(session->asBinder()); return as->remote_pid; } void ApplicationManager::request_update_for_session(const android::sp& session) { ALOGI("%s", __PRETTY_FUNCTION__); android::Mutex::Autolock al(guard); if (apps_as_added[focused_application] != session->asBinder()) return; const android::sp& as = apps.valueFor(apps_as_added[focused_application]); if (as->session_type == ubuntu::application::ui::system_session_type) { input_setup->input_manager->getDispatcher()->setFocusedApplication( shell_input_setup->shell_application); android::Vector< android::sp > input_windows; input_windows.push(shell_input_setup->event_trap_window.input_window); input_setup->input_manager->getDispatcher()->setInputWindows( input_windows); } else { input_setup->input_manager->getDispatcher()->setFocusedApplication( as->input_application_handle()); android::Vector< android::sp > input_windows; if (is_osk_visible) input_windows.push(shell_input_setup->osk_window.input_window); if (are_notifications_visible) input_windows.push(shell_input_setup->notifications_window.input_window); if (!shell_input_setup->trap_windows.isEmpty()) { int key = 0; for (size_t i = 0; i < shell_input_setup->trap_windows.size(); i++) { key = shell_input_setup->trap_windows.keyAt(i); input_windows.push(shell_input_setup->trap_windows.valueFor(key)); } } input_windows.appendVector(as->input_window_handles()); if (as->stage_hint == ubuntu::application::ui::side_stage) { const android::sp& main_session = apps.valueFor(apps_as_added[main_stage_application]); input_windows.appendVector(main_session->input_window_handles()); } input_setup->input_manager->getDispatcher()->setInputWindows( input_windows); } } void ApplicationManager::register_task_controller( const android::sp& controller) { ALOGI("%s() registering task controller", __PRETTY_FUNCTION__); //TODO: Register the task controller to use it instead of sigkilling android::Mutex::Autolock al(guard); if (app_manager_task_controller != NULL) return; ALOGI("%s() done registering task controller", __PRETTY_FUNCTION__); app_manager_task_controller = controller; } void ApplicationManager::register_an_observer( const android::sp& observer) { android::Mutex::Autolock al(observer_guard); app_manager_observers.push_back(observer); { android::Mutex::Autolock al(guard); for(unsigned int i = 0; i < apps_as_added.size(); i++) { const android::sp& session = apps.valueFor(apps_as_added[i]); observer->on_session_born(session->remote_pid, session->stage_hint, session->desktop_file); } if (focused_application < apps_as_added.size()) { const android::sp& session = apps.valueFor(apps_as_added[focused_application]); observer->on_session_focused(session->remote_pid, session->stage_hint, session->desktop_file); } } } void ApplicationManager::focus_running_session_with_id(int id) { android::Mutex::Autolock al(guard); size_t idx = session_id_to_index(id); if (idx < apps_as_added.size()) { switch_focused_application_locked(idx); } } void ApplicationManager::unfocus_running_sessions() { ALOGI("%s", __PRETTY_FUNCTION__); android::Mutex::Autolock al(guard); if (shell_input_setup->shell_has_focus) return; input_setup->input_manager->getDispatcher()->setFocusedApplication( shell_input_setup->shell_application); android::Vector< android::sp > input_windows; input_windows.push(shell_input_setup->event_trap_window.input_window); input_setup->input_manager->getDispatcher()->setInputWindows( input_windows); if (focused_application < apps.size()) { const android::sp& session = apps.valueFor(apps_as_added[focused_application]); if (session->session_type != ubuntu::application::ui::system_session_type) { notify_observers_about_session_unfocused(session->remote_pid, session->stage_hint, session->desktop_file); if (!is_session_allowed_to_run_in_background(session)) session_set_state(session, ubuntu::application::ui::process_suspended); } } shell_input_setup->shell_has_focus = true; } int32_t ApplicationManager::query_snapshot_layer_for_session_with_id(int id) { size_t idx = session_id_to_index(id); if (idx < apps_as_added.size()) { return apps.valueFor(apps_as_added[idx])->layer(); } return INT_MAX; } android::IApplicationManagerSession::SurfaceProperties ApplicationManager::query_surface_properties_for_session_id(int id) { android::Mutex::Autolock al(guard); size_t idx = session_id_to_index(id); android::IApplicationManagerSession::SurfaceProperties props; int status; if (idx < apps_as_added.size()) { const android::sp& session = apps.valueFor(apps_as_added[idx]); if (session->running_state == ubuntu::application::ui::process_suspended) { kill(session->pid, SIGCONT); props = session->query_properties(); kill(session->pid, SIGSTOP); } else { props = session->query_properties(); } return props; } return android::IApplicationManagerSession::SurfaceProperties(); } void ApplicationManager::switch_to_well_known_application(int32_t app) { notify_observers_about_session_requested(app); } int32_t ApplicationManager::set_surface_trap(int x, int y, int width, int height) { static int32_t key = 0; ApplicationManager::ShellInputSetup::Window<0, 0, 2048, 2048>* w = new ApplicationManager::ShellInputSetup::Window<0, 0, 2048, 2048>(shell_input_setup.get(), x, y, width, height); key++; shell_input_setup->trap_windows.add(key, w->input_window); update_input_setup_locked(); return key; } void ApplicationManager::unset_surface_trap(int32_t handle) { shell_input_setup->trap_windows.removeItem(handle); update_input_setup_locked(); } void ApplicationManager::report_osk_visible(int32_t x, int32_t y, int32_t width, int32_t height) { ALOGI("%s(x=%d, y=%d, width=%d, height=%d)", __PRETTY_FUNCTION__, x, y, width, height); shell_input_setup->osk_window.input_window->x = x; shell_input_setup->osk_window.input_window->y = y; shell_input_setup->osk_window.input_window->w = width; shell_input_setup->osk_window.input_window->h = height; android::Mutex::Autolock al(guard); is_osk_visible = true; update_input_setup_locked(); notify_observers_about_keyboard_geometry_changed(x, y, width, height); } void ApplicationManager::report_osk_invisible() { ALOGI("%s", __PRETTY_FUNCTION__); android::Mutex::Autolock al(guard); is_osk_visible = false; update_input_setup_locked(); notify_observers_about_keyboard_geometry_changed(0, 0, 0, 0); } void ApplicationManager::report_notification_visible() { ALOGI("%s", __PRETTY_FUNCTION__); android::Mutex::Autolock al(guard); are_notifications_visible = true; update_input_setup_locked(); } void ApplicationManager::report_notification_invisible() { ALOGI("%s", __PRETTY_FUNCTION__); android::Mutex::Autolock al(guard); are_notifications_visible = false; update_input_setup_locked(); } void ApplicationManager::update_input_setup_locked() { if (focused_application >= apps.size()) return; const android::sp& session = apps.valueFor(apps_as_added[focused_application]); if (shell_input_setup->shell_has_focus) { input_setup->input_manager->getDispatcher()->setFocusedApplication( shell_input_setup->shell_application); android::Vector< android::sp > input_windows; input_windows.push(shell_input_setup->event_trap_window.input_window); input_setup->input_manager->getDispatcher()->setInputWindows( input_windows); } else { ALOGI("Adjusting input setup to account for change in visibility of osk/notifications"); input_setup->input_manager->getDispatcher()->setFocusedApplication( session->input_application_handle()); android::Vector< android::sp > input_windows; if (is_osk_visible) input_windows.push(shell_input_setup->osk_window.input_window); if (are_notifications_visible) input_windows.push(shell_input_setup->notifications_window.input_window); if (!shell_input_setup->trap_windows.isEmpty()) { int key = 0; for (size_t i = 0; i < shell_input_setup->trap_windows.size(); i++) { key = shell_input_setup->trap_windows.keyAt(i); input_windows.push(shell_input_setup->trap_windows.valueFor(key)); } } android::sp sb = apps_as_added[focused_application]; if (sb->isBinderAlive()) input_windows.appendVector(session->input_window_handles()); if (session->stage_hint == ubuntu::application::ui::side_stage) { const android::sp& main_session = apps.valueFor(apps_as_added[main_stage_application]); android::sp msb = apps_as_added[focused_application]; if (msb->isBinderAlive()) { input_windows.appendVector(main_session->input_window_handles()); } } input_setup->input_manager->getDispatcher()->setInputWindows( input_windows); } } void ApplicationManager::switch_focused_application_locked(size_t index_of_next_focused_app) { static int focused_layer = 0; static const int focused_layer_increment = 10; if (apps.size() > 1 && focused_application < apps.size() && focused_application < apps_as_added.size() && focused_application != index_of_next_focused_app) { ALOGI("Lowering current application now for idx: %d \n", focused_application); const android::sp& session = apps.valueFor(apps_as_added[focused_application]); const android::sp& next_session = apps.valueFor(apps_as_added[index_of_next_focused_app]); if (next_session->session_type == ubuntu::application::ui::system_session_type) return; if (session->session_type != ubuntu::application::ui::system_session_type) { // Stop the session if (!is_session_allowed_to_run_in_background(session)) { if ((session->stage_hint == ubuntu::application::ui::main_stage && next_session->stage_hint != ubuntu::application::ui::side_stage) || (session->stage_hint == ubuntu::application::ui::side_stage && next_session->stage_hint != ubuntu::application::ui::main_stage)) { notify_observers_about_session_unfocused(session->remote_pid, session->stage_hint, session->desktop_file); session_set_state(session, ubuntu::application::ui::process_suspended); } else { if (session->stage_hint == ubuntu::application::ui::side_stage && next_session->stage_hint == ubuntu::application::ui::main_stage && main_stage_application < apps.size()) { const android::sp& main_session = apps.valueFor(apps_as_added[main_stage_application]); if (main_session->session_type != ubuntu::application::ui::system_session_type) session_set_state(main_session, ubuntu::application::ui::process_suspended); } } } } } focused_application = index_of_next_focused_app; is_osk_visible = false; notify_observers_about_keyboard_geometry_changed(0, 0, 0, 0); if (focused_application < apps.size()) { focused_layer += focused_layer_increment; const android::sp& session = apps.valueFor(apps_as_added[focused_application]); ALOGI("Raising application now for idx: %d (stage_hint: %d)\n", focused_application, session->stage_hint); if (session->session_type == ubuntu::application::ui::system_session_type) { ALOGI("\t system session - not raising it."); return; } // Continue the session if (!is_session_allowed_to_run_in_background(session)) session_set_state(session, ubuntu::application::ui::process_running); if (session->stage_hint == ubuntu::application::ui::side_stage) side_stage_application = focused_application; else main_stage_application = focused_application; session->raise_application_surfaces_to_layer(focused_layer); input_setup->input_manager->getDispatcher()->setFocusedApplication( session->input_application_handle()); android::Vector< android::sp > input_windows; if (are_notifications_visible) input_windows.push(shell_input_setup->notifications_window.input_window); if (!shell_input_setup->trap_windows.isEmpty()) { int key = 0; for (size_t i = 0; i < shell_input_setup->trap_windows.size(); i++) { key = shell_input_setup->trap_windows.keyAt(i); input_windows.push(shell_input_setup->trap_windows.valueFor(key)); } } input_windows.appendVector(session->input_window_handles()); if (session->stage_hint == ubuntu::application::ui::side_stage) { if (main_stage_application) { const android::sp& main_session = apps.valueFor(apps_as_added[main_stage_application]); session_set_state(main_session, ubuntu::application::ui::process_running); input_windows.appendVector(main_session->input_window_handles()); } } input_setup->input_manager->getDispatcher()->setInputWindows( input_windows); notify_observers_about_session_focused(session->remote_pid, session->stage_hint, session->desktop_file); shell_input_setup->shell_has_focus = false; } } void ApplicationManager::switch_focus_to_next_application_locked() { size_t new_idx = (focused_application + 1) % apps.size(); ALOGI("current: %d, next: %d \n", focused_application, new_idx); switch_focused_application_locked(new_idx); } void ApplicationManager::kill_focused_application_locked() { if (focused_application < apps.size()) { const android::sp& session = apps.valueFor(apps_as_added[focused_application]); kill(session->pid, SIGKILL); } } size_t ApplicationManager::session_id_to_index(int id) { size_t idx = 0; for(idx = 0; idx < apps_as_added.size(); idx++) { const android::sp& session = apps.valueFor(apps_as_added[idx]); if (session->remote_pid == id) break; } return idx; } void ApplicationManager::notify_observers_about_session_requested(uint32_t app) { android::Mutex::Autolock al(observer_guard); for(unsigned int i = 0; i < app_manager_observers.size(); i++) { app_manager_observers[i]->on_session_requested(app); } } void ApplicationManager::notify_observers_about_session_born(int id, int stage_hint, const android::String8& desktop_file) { android::Mutex::Autolock al(observer_guard); for(unsigned int i = 0; i < app_manager_observers.size(); i++) { app_manager_observers[i]->on_session_born(id, stage_hint, desktop_file); } } void ApplicationManager::notify_observers_about_session_unfocused(int id, int stage_hint, const android::String8& desktop_file) { android::Mutex::Autolock al(observer_guard); for(unsigned int i = 0; i < app_manager_observers.size(); i++) { app_manager_observers[i]->on_session_unfocused(id, stage_hint, desktop_file); } } void ApplicationManager::notify_observers_about_session_focused(int id, int stage_hint, const android::String8& desktop_file) { android::Mutex::Autolock al(observer_guard); for(unsigned int i = 0; i < app_manager_observers.size(); i++) { app_manager_observers[i]->on_session_focused(id, stage_hint, desktop_file); } } void ApplicationManager::notify_observers_about_keyboard_geometry_changed(int x, int y, int width, int height) { android::Mutex::Autolock al(observer_guard); for(unsigned int i = 0; i < app_manager_observers.size(); i++) { app_manager_observers[i]->on_keyboard_geometry_changed(x, y, width, height); } } void ApplicationManager::notify_observers_about_session_requested_fullscreen(int id, int stage_hint, const android::String8& desktop_file) { android::Mutex::Autolock al(observer_guard); for(unsigned int i = 0; i < app_manager_observers.size(); i++) { app_manager_observers[i]->on_session_requested_fullscreen(id, stage_hint, desktop_file); } } void ApplicationManager::notify_observers_about_session_died(int id, int stage_hint, const android::String8& desktop_file) { android::Mutex::Autolock al(observer_guard); for(unsigned int i = 0; i < app_manager_observers.size(); i++) { app_manager_observers[i]->on_session_died(id, stage_hint, desktop_file); } } struct ClipboardService : public android::BnClipboardService { void set_content(const android::IClipboardService::Content& content) { this->content = content; } void get_content(android::IClipboardService::Content& content) { content = this->content; } android::IClipboardService::Content content; }; } } int main(int argc, char** argv) { android::sp app_manager(new ubuntu::detail::ApplicationManager()); android::sp clipboard_service(new ubuntu::detail::ClipboardService()); // Register service android::sp service_manager = android::defaultServiceManager(); if (android::NO_ERROR != service_manager->addService( android::String16(android::IApplicationManager::exported_service_name()), app_manager)) { return EXIT_FAILURE; } if (android::NO_ERROR != service_manager->addService( android::String16(android::IClipboardService::exported_service_name()), clipboard_service)) { return EXIT_FAILURE; } android::ProcessState::self()->startThreadPool(); android::IPCThreadState::self()->joinThreadPool(); } platform-api-0.20+14.04.20140411/android/hybris/default_shell.h0000644000015301777760000000227212322054725024331 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef DEFAULT_SHELL_H_ #define DEFAULT_SHELL_H_ #include "shell.h" namespace ubuntu { namespace detail { class DefaultShell : public Shell { public: static android::sp instance(const android::sp& app_manager) { static android::sp shell(new DefaultShell(app_manager)); return shell; } protected: DefaultShell(const android::sp& app_manager) : Shell(app_manager) { } }; } } #endif // DEFAULT_SHELL_H_ platform-api-0.20+14.04.20140411/android/hybris/shell.h0000644000015301777760000000220612322054725022622 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef SHELL_H_ #define SHELL_H_ #include namespace ubuntu { namespace detail { class ApplicationManager; class Shell : public android::RefBase { public: static android::sp instance(); protected: Shell(const android::sp& app_manager) : app_manager(app_manager) { } virtual ~Shell() { } android::sp app_manager; }; } } #endif // SHELL_H_ platform-api-0.20+14.04.20140411/android/hybris/ubuntu_application_api_for_hybris.cpp0000644000015301777760000010721212322054725031035 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #include "application_manager.h" #include "event_loop.h" #include "input_consumer_thread.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR<=2 #include #else #include #endif #include #include #include #include namespace android { struct Clipboard : public ubuntu::application::ui::Clipboard { static sp access_clipboard_service() { static sp remote_instance; if (remote_instance == NULL) { sp service_manager = defaultServiceManager(); sp service = service_manager->getService( String16(IClipboardService::exported_service_name())); remote_instance = new BpClipboardService(service); } return remote_instance; } void set_content(const Clipboard::Content& content) { IClipboardService::Content c; c.mime_type = String8(content.mime_type); c.data_size = content.data_size; c.data = content.data; access_clipboard_service()->set_content(c); } Clipboard::Content get_content() { IClipboardService::Content content; access_clipboard_service()->get_content(content); Clipboard::Content result(content.mime_type.string(), content.data, content.data_size); memcpy(result.data, content.data, result.data_size); return result; } }; struct Setup : public ubuntu::application::ui::Setup { Setup() : stage(ubuntu::application::ui::main_stage), form_factor(ubuntu::application::ui::desktop_form_factor), desktop_file("/usr/share/applications/shotwell.desktop") { } static android::KeyedVector init_string_to_stage_hint_lut() { android::KeyedVector lut; lut.add(android::String8("main_stage"), ubuntu::application::ui::main_stage); lut.add(android::String8("side_stage"), ubuntu::application::ui::side_stage); lut.add(android::String8("share_stage"), ubuntu::application::ui::share_stage); return lut; } static ubuntu::application::ui::StageHint string_to_stage_hint(const android::String8& s) { static android::KeyedVector lut = init_string_to_stage_hint_lut(); return lut.valueFor(s); } static android::KeyedVector init_string_to_form_factor_hint_lut() { android::KeyedVector lut; lut.add(android::String8("desktop"), ubuntu::application::ui::desktop_form_factor); lut.add(android::String8("phone"), ubuntu::application::ui::phone_form_factor); lut.add(android::String8("tablet"), ubuntu::application::ui::tablet_form_factor); return lut; } static ubuntu::application::ui::FormFactorHint string_to_form_factor_hint(const android::String8& s) { static android::KeyedVector lut = init_string_to_form_factor_hint_lut(); return lut.valueFor(s); } ubuntu::application::ui::StageHint stage_hint() { return stage; } ubuntu::application::ui::FormFactorHint form_factor_hint() { return ubuntu::application::ui::desktop_form_factor; } const char* desktop_file_hint() { return desktop_file.string(); } ubuntu::application::ui::StageHint stage; ubuntu::application::ui::FormFactorHint form_factor; android::String8 desktop_file; }; static Setup::Ptr global_setup(new Setup()); struct PhysicalDisplayInfo : public ubuntu::application::ui::PhysicalDisplayInfo { explicit PhysicalDisplayInfo(size_t display_id) : display_id(SurfaceComposerClient::getBuiltInDisplay(display_id)) { } float horizontal_dpi() { DisplayInfo info; SurfaceComposerClient::getDisplayInfo(display_id, &info); return info.xdpi; } float vertical_dpi() { DisplayInfo info; SurfaceComposerClient::getDisplayInfo(display_id, &info); return info.ydpi; } int horizontal_resolution() { DisplayInfo info; SurfaceComposerClient::getDisplayInfo(display_id, &info); return info.w; } int vertical_resolution() { DisplayInfo info; SurfaceComposerClient::getDisplayInfo(display_id, &info); return info.h; } sp display_id; }; struct UbuntuSurface : public ubuntu::application::ui::Surface { struct Observer { virtual ~Observer() {} virtual void update() = 0; }; sp client; sp surface_control; sp surface; sp input_channel; InputConsumer input_consumer; sp looper; PreallocatedInputEventFactory event_factory; IApplicationManagerSession::SurfaceProperties properties; bool is_visible_flag; Observer* observer; static int looper_callback(int receiveFd, int events, void* ctxt) { uint32_t consumeSeq; bool result = true; UbuntuSurface* s = static_cast(ctxt); InputEvent* ev; android::status_t status; while((status = s->input_consumer.consume(&s->event_factory, true, -1, &consumeSeq, &ev)) != android::WOULD_BLOCK) { switch(status) { case OK: result = true; //printf("We have a client side event for process %d. \n", getpid()); s->translate_and_dispatch_event(ev); s->input_consumer.sendFinishedSignal(consumeSeq, result); break; case INVALID_OPERATION: result = true; break; case NO_MEMORY: result = true; break; } } return result ? 1 : 0; } UbuntuSurface(const sp& client, const sp& input_channel, const sp& looper, const ubuntu::application::ui::SurfaceProperties& props, const ubuntu::application::ui::input::Listener::Ptr& listener, Observer* observer = NULL) : ubuntu::application::ui::Surface(listener), client(client), input_channel(input_channel), input_consumer(input_channel), looper(looper), properties( {0, 0, 0, props.width-1, props.height-1}), is_visible_flag(false), observer(observer) { assert(client != NULL); surface_control = client->createSurface( String8(props.title), props.width, props.height, PIXEL_FORMAT_RGBA_8888, props.flags & ubuntu::application::ui::is_opaque_flag ? android::ISurfaceComposerClient::eOpaque : 0); assert(surface_control != NULL); surface = surface_control->getSurface(); assert(surface != NULL); // Setup input channel looper->addFd(input_channel->getFd(), 0, ALOOPER_EVENT_INPUT, looper_callback, this); } ~UbuntuSurface() { looper->removeFd(input_channel->getFd()); } void translate_and_dispatch_event(const android::InputEvent* ev) { Event e; switch(ev->getType()) { case AINPUT_EVENT_TYPE_KEY: { const android::KeyEvent* kev = static_cast(ev); e.type = KEY_EVENT_TYPE; e.device_id = ev->getDeviceId(); e.source_id = ev->getSource(); e.action = kev->getAction(); e.flags = kev->getFlags(); e.meta_state = kev->getMetaState(); e.details.key.key_code = kev->getKeyCode(); e.details.key.scan_code = kev->getScanCode(); e.details.key.repeat_count = kev->getRepeatCount(); e.details.key.down_time = kev->getDownTime(); e.details.key.event_time = kev->getEventTime(); e.details.key.is_system_key = kev->isSystemKey(); break; } case AINPUT_EVENT_TYPE_MOTION: const android::MotionEvent* mev = static_cast(ev); e.type = MOTION_EVENT_TYPE; e.device_id = ev->getDeviceId(); e.source_id = ev->getSource(); e.action = mev->getAction(); e.flags = mev->getFlags(); e.meta_state = mev->getMetaState(); e.details.motion.edge_flags = mev->getEdgeFlags(); e.details.motion.button_state = mev->getButtonState(); e.details.motion.x_offset = mev->getXOffset(); e.details.motion.y_offset = mev->getYOffset(); e.details.motion.x_precision = mev->getXPrecision(); e.details.motion.y_precision = mev->getYPrecision(); e.details.motion.down_time = mev->getDownTime(); e.details.motion.event_time = mev->getEventTime(); e.details.motion.pointer_count = mev->getPointerCount(); for(unsigned int i = 0; i < mev->getPointerCount(); i++) { e.details.motion.pointer_coordinates[i].id = mev->getPointerId(i); e.details.motion.pointer_coordinates[i].x = mev->getX(i); e.details.motion.pointer_coordinates[i].raw_x = mev->getRawX(i); e.details.motion.pointer_coordinates[i].y = mev->getY(i); e.details.motion.pointer_coordinates[i].raw_y = mev->getRawY(i); e.details.motion.pointer_coordinates[i].touch_major = mev->getTouchMajor(i); e.details.motion.pointer_coordinates[i].touch_minor = mev->getTouchMinor(i); e.details.motion.pointer_coordinates[i].size = mev->getSize(i); e.details.motion.pointer_coordinates[i].pressure = mev->getPressure(i); e.details.motion.pointer_coordinates[i].orientation = mev->getOrientation(i); } break; } registered_input_listener()->on_new_event(e); } void set_layer(int layer) { client->openGlobalTransaction(); surface_control->setLayer(layer); client->closeGlobalTransaction(); properties.layer = layer; } void set_visible(int id, bool visible) { sp service_manager = defaultServiceManager(); sp service = service_manager->getService( String16(IApplicationManager::exported_service_name())); BpApplicationManager app_manager(service); ALOGI("%s: %s", __PRETTY_FUNCTION__, visible ? "true" : "false"); if (visible) { client->openGlobalTransaction(); ALOGI("surface_control->show(INT_MAX): %d id=%d", surface_control->show(), id); client->closeGlobalTransaction(); if (id) app_manager.focus_running_session_with_id(id); } else { client->openGlobalTransaction(); ALOGI("surface_control->hide(): %d", surface_control->hide()); client->closeGlobalTransaction(); } } void set_alpha(float alpha) { client->openGlobalTransaction(); surface_control->setAlpha(alpha); client->closeGlobalTransaction(); if (observer) observer->update(); } void move_to(int x, int y) { client->openGlobalTransaction(); surface_control->setPosition(x, y); client->closeGlobalTransaction(); properties.left = x; properties.top = y; properties.right += x; properties.bottom += y; if (observer) observer->update(); } void resize(int w, int h) { client->openGlobalTransaction(); surface_control->setSize(w, h); client->closeGlobalTransaction(); properties.right = properties.left + w; properties.bottom = properties.top + h; if (observer) observer->update(); } int32_t get_id() { return -1; } EGLNativeWindowType to_native_window_type() { return surface.get(); } }; struct Session : public ubuntu::application::ui::Session, public UbuntuSurface::Observer { struct ApplicationManagerSession : public BnApplicationManagerSession { ApplicationManagerSession(Session* parent) : parent(parent), delegate() { } // From IApplicationManagerSession void raise_application_surfaces_to_layer(int layer) { ALOGI("%s: %d \n", __PRETTY_FUNCTION__, layer); parent->raise_application_surfaces_to_layer(layer); } void raise_surface_to_layer(int32_t token, int layer) { ALOGI("Enter %s (%d): %d, %d", __PRETTY_FUNCTION__, getpid(), token, layer); auto surface = parent->surfaces.valueFor(token); if (surface != NULL) { ALOGI("\tFound surface for token: %d", token); surface->set_layer(layer); } else { ALOGI("\tFound NO surface for token: %d", token); } ALOGI("Leave %s (%d): %d, %d", __PRETTY_FUNCTION__, getpid(), token, layer); } SurfaceProperties query_surface_properties_for_token(int32_t token) { ALOGI("%s: %d \n", __PRETTY_FUNCTION__, token); return parent->surfaces.valueFor(token)->properties; } void on_application_resumed() { if (delegate == NULL) return; delegate->on_application_resumed(); } void on_application_about_to_stop() { if (delegate == NULL) return; delegate->on_application_about_to_stop(); } void install_lifecycle_delegate(const ubuntu::application::LifecycleDelegate::Ptr& delegate) { this->delegate = delegate; } Session* parent; ubuntu::application::LifecycleDelegate::Ptr delegate; }; sp app_manager_session; sp client; sp looper; sp event_loop; Mutex surfaces_guard; KeyedVector< int32_t, android::sp > surfaces; Session(const ubuntu::application::ui::SessionCredentials& creds) : app_manager_session(new ApplicationManagerSession(this)), client(new android::SurfaceComposerClient()), looper(new Looper(true)), event_loop(new ubuntu::application::EventLoop(looper)) { assert(client); //============= This has to die ================= sp server_channel, client_channel; InputChannel::openInputChannelPair( String8("UbuntuApplicationUiSession"), server_channel, client_channel); //printf("Created input channels: \n"); //printf("\t %d, %d, %d \n", //server_channel->getFd()); //============= This has to die ================= sp service_manager = defaultServiceManager(); sp service = service_manager->getService( String16(IApplicationManager::exported_service_name())); BpApplicationManager app_manager(service); app_manager.start_a_new_session( creds.session_type(), ubuntu::application::ui::Setup::instance()->stage_hint(), String8(creds.application_name()), String8(ubuntu::application::ui::Setup::instance()->desktop_file_hint()), app_manager_session, server_channel->getFd(), creds.remote_pid()); android::ProcessState::self()->startThreadPool(); event_loop->run(__PRETTY_FUNCTION__, android::PRIORITY_URGENT_DISPLAY); } void install_lifecycle_delegate(const ubuntu::application::LifecycleDelegate::Ptr& delegate) { this->app_manager_session->install_lifecycle_delegate(delegate); } void update() { sp service_manager = defaultServiceManager(); sp service = service_manager->getService( String16(IApplicationManager::exported_service_name())); BpApplicationManager app_manager(service); app_manager.request_update_for_session(app_manager_session); } ubuntu::application::ui::Surface::Ptr create_surface( const ubuntu::application::ui::SurfaceProperties& props, const ubuntu::application::ui::input::Listener::Ptr& listener) { sp service_manager = defaultServiceManager(); sp service = service_manager->getService( String16(IApplicationManager::exported_service_name())); BpApplicationManager app_manager(service); sp server_channel, client_channel; InputChannel::openInputChannelPair( String8(props.title), server_channel, client_channel); UbuntuSurface* surface = new UbuntuSurface( client, client_channel, looper, props, listener, this); int32_t token; { Mutex::Autolock al(surfaces_guard); token = next_surface_token(); surfaces.add(token, sp(surface)); } app_manager.register_a_surface( String8(props.title), app_manager_session, props.role, token, server_channel->getFd()); return ubuntu::application::ui::Surface::Ptr(surface); } int get_session_pid() { sp service_manager = defaultServiceManager(); sp service = service_manager->getService( String16(IApplicationManager::exported_service_name())); BpApplicationManager app_manager(service); int pid = app_manager.get_session_pid( app_manager_session ); return pid; } void toggle_fullscreen_for_surface(const ubuntu::application::ui::Surface::Ptr& /*surface*/) { sp service_manager = defaultServiceManager(); sp service = service_manager->getService( String16(IApplicationManager::exported_service_name())); BpApplicationManager app_manager(service); app_manager.request_fullscreen( app_manager_session ); } void destroy_surface( const ubuntu::application::ui::Surface::Ptr& surf) { (void) surf; } void raise_application_surfaces_to_layer(int layer) { Mutex::Autolock al(surfaces_guard); ALOGI("%s: %d\n", __PRETTY_FUNCTION__, layer); for(size_t i = 0; i < surfaces.size(); i++) { surfaces.valueAt(i)->set_layer(layer+i); ALOGI("\tLayer: %d\n", layer+i); } } int32_t next_surface_token() { static int32_t t = 0; t++; return t; } }; struct SessionProperties : public ubuntu::ui::SessionProperties { SessionProperties(int id, int stage_hint, const android::String8& desktop_file) : id(id), stage_hint(stage_hint), desktop_file(desktop_file) { } int application_instance_id() const { return id; } int application_stage_hint() const { return stage_hint; } const char* value_for_key(const char* key) const { return "lalelu"; } virtual const char* desktop_file_hint() const { return desktop_file.string(); } int id; int stage_hint; android::String8 desktop_file; }; struct AMTaskController : public android::BnAMTaskController { void continue_task(uint32_t pid) { if (controller == NULL) return; controller->continue_task(static_cast(pid)); } void suspend_task(uint32_t pid) { if (controller == NULL) return; controller->suspend_task(static_cast(pid)); } void install_task_controller(const ubuntu::ui::TaskController::Ptr& controller) { printf("%s()\n", __PRETTY_FUNCTION__); this->controller = controller; sp service_manager = defaultServiceManager(); sp service = service_manager->getService( String16(IApplicationManager::exported_service_name())); BpApplicationManager app_manager(service); app_manager.register_task_controller(android::sp(this)); } ubuntu::ui::TaskController::Ptr controller; }; struct ApplicationManagerObserver : public android::BnApplicationManagerObserver { void on_session_requested(uint32_t app) { if (observer == NULL) return; observer->on_session_requested(static_cast(app)); } void on_session_born(int id, int stage_hint, const String8& desktop_file) { if (observer == NULL) return; observer->on_session_born(ubuntu::ui::SessionProperties::Ptr(new SessionProperties(id, stage_hint, desktop_file))); } virtual void on_session_unfocused(int id, int stage_hint, const String8& desktop_file) { if (observer == NULL) return; observer->on_session_unfocused(ubuntu::ui::SessionProperties::Ptr(new SessionProperties(id, stage_hint, desktop_file))); } virtual void on_session_focused(int id, int stage_hint, const String8& desktop_file) { if (observer == NULL) return; observer->on_session_focused(ubuntu::ui::SessionProperties::Ptr(new SessionProperties(id, stage_hint, desktop_file))); } virtual void on_session_requested_fullscreen(int id, int stage_hint, const String8& desktop_file) { if (observer == NULL) return; observer->on_session_requested_fullscreen(ubuntu::ui::SessionProperties::Ptr(new SessionProperties(id, stage_hint, desktop_file))); } virtual void on_keyboard_geometry_changed(int x, int y, int width, int height) { if (observer == NULL) return; observer->on_keyboard_geometry_changed(x, y, width, height); } virtual void on_session_died(int id, int stage_hint, const String8& desktop_file) { if (observer == NULL) return; observer->on_session_died(ubuntu::ui::SessionProperties::Ptr(new SessionProperties(id, stage_hint, desktop_file))); } void install_session_lifecycle_observer(const ubuntu::ui::SessionLifeCycleObserver::Ptr& observer) { this->observer = observer; sp service_manager = defaultServiceManager(); sp service = service_manager->getService( String16(IApplicationManager::exported_service_name())); BpApplicationManager app_manager(service); app_manager.register_an_observer(android::sp(this)); } ubuntu::ui::SessionLifeCycleObserver::Ptr observer; }; struct SessionService : public ubuntu::ui::SessionService { struct SessionSnapshot : public ubuntu::ui::SessionSnapshot { const void* snapshot_pixels; unsigned int snapshot_x; unsigned int snapshot_y; unsigned int surface_width; unsigned int surface_height; unsigned int snapshot_width; unsigned int snapshot_height; unsigned int snapshot_stride; SessionSnapshot( const void* pixels, unsigned int x, unsigned int y, unsigned int sf_width, unsigned int sf_height, unsigned int width, unsigned height, unsigned int stride) : snapshot_pixels(pixels), snapshot_x(x), snapshot_y(y), surface_width(sf_width), surface_height(sf_height), snapshot_width(width), snapshot_height(height), snapshot_stride(stride) { } const void* pixel_data() { return snapshot_pixels; } unsigned int x() { return snapshot_x; } unsigned int y() { return snapshot_y; } unsigned int source_width() { return surface_width; } unsigned int source_height() { return surface_height; } unsigned int width() { return snapshot_width; } unsigned int height() { return snapshot_height; } unsigned int stride() { return snapshot_stride; } }; static sp access_application_manager() { static sp remote_instance; if (remote_instance == NULL) { sp service_manager = defaultServiceManager(); sp service = service_manager->getService( String16(IApplicationManager::exported_service_name())); remote_instance = new BpApplicationManager(service); } return remote_instance; } SessionService() : observer(new ApplicationManagerObserver()), controller(new AMTaskController()) { android::ProcessState::self()->startThreadPool(); } const ubuntu::application::ui::Session::Ptr& start_a_new_session(const ubuntu::application::ui::SessionCredentials& cred) { (void) cred; static ubuntu::application::ui::Session::Ptr session(new Session(cred)); return session; } void install_session_lifecycle_observer(const ubuntu::ui::SessionLifeCycleObserver::Ptr& lifecycle_observer) { this->observer->install_session_lifecycle_observer(lifecycle_observer); } void install_task_controller(const ubuntu::ui::TaskController::Ptr& controller) { printf("%s()\n", __PRETTY_FUNCTION__); this->controller->install_task_controller(controller); } void unfocus_running_sessions() { ALOGI("%s", __PRETTY_FUNCTION__); access_application_manager()->unfocus_running_sessions(); } void focus_running_session_with_id(int id) { access_application_manager()->focus_running_session_with_id(id); } ubuntu::ui::SessionSnapshot::Ptr snapshot_running_session_with_id(int id) { static android::DisplayInfo info; const void* pixels; int32_t layer_min = id > 0 ? access_application_manager()->query_snapshot_layer_for_session_with_id(id) : 0; int32_t layer_max = id > 0 ? access_application_manager()->query_snapshot_layer_for_session_with_id(id) : id; android::IApplicationManagerSession::SurfaceProperties props = access_application_manager()->query_surface_properties_for_session_id(id); static android::ScreenshotClient screenshot_client; android::sp display( android::SurfaceComposerClient::getBuiltInDisplay( android::ISurfaceComposer::eDisplayIdMain)); android::SurfaceComposerClient::getDisplayInfo( display, &info); screenshot_client.update(display, info.w / 2, info.h / 2, layer_min, layer_max); ALOGI("screenshot: (%d, %d, %d, %d)\n", props.left, props.top, props.right, props.bottom); if (props.left == 0 && props.top == 0 && props.right == 0 && props.bottom == 0) pixels = NULL; else pixels = screenshot_client.getPixels(); SessionSnapshot::Ptr ss( new SessionSnapshot( pixels, (props.left+1) / 2, (props.top+1) / 2, (props.right-props.left+1) / 2, (props.bottom-props.top+1) / 2, screenshot_client.getWidth(), screenshot_client.getHeight(), screenshot_client.getStride())); return ss; } void trigger_switch_to_well_known_application(ubuntu::ui::WellKnownApplication app) { access_application_manager()->switch_to_well_known_application(app); } int32_t set_surface_trap(int32_t x, int32_t y, int32_t width, int32_t height) { ALOGI("%s", __PRETTY_FUNCTION__); return access_application_manager()->set_surface_trap(x, y, width, height); } void unset_surface_trap(int32_t handle) { ALOGI("%s(%d)", __PRETTY_FUNCTION__, handle); access_application_manager()->unset_surface_trap(handle); } void report_osk_visible(int32_t x, int32_t y, int32_t width, int32_t height) { ALOGI("%s", __PRETTY_FUNCTION__); access_application_manager()->report_osk_visible(x, y, width, height); } void report_osk_invisible() { ALOGI("%s", __PRETTY_FUNCTION__); access_application_manager()->report_osk_invisible(); } void report_notification_visible() { ALOGI("%s", __PRETTY_FUNCTION__); access_application_manager()->report_notification_visible(); } void report_notification_invisible() { ALOGI("%s", __PRETTY_FUNCTION__); access_application_manager()->report_notification_invisible(); } android::sp observer; android::sp controller; }; } #include #include #include // We need to inject some platform specific symbols here. namespace ubuntu { namespace application { namespace ui { void print_help_and_exit() { printf("Usage: executable " "[--form_factor_hint={desktop, phone, tablet}] " "[--stage_hint={main_stage, side_stage, share_stage}] " "[--desktop_file_hint=absolute_path_to_desktop_file]\n"); exit(EXIT_SUCCESS); } void init(int argc, char** argv) { static const int uninteresting_flag_value = 0; static struct option long_options[] = { {"form_factor_hint", required_argument, NULL, uninteresting_flag_value}, {"stage_hint", required_argument, NULL, uninteresting_flag_value}, {"desktop_file_hint", required_argument, NULL, uninteresting_flag_value}, {"help", no_argument, NULL, uninteresting_flag_value}, {0, 0, 0, 0} }; static const int form_factor_hint_index = 0; static const int stage_hint_index = 1; static const int desktop_file_hint_index = 2; static const int help_index = 3; android::Setup* setup = new android::Setup(); while(true) { int option_index = 0; int c = getopt_long(argc, argv, "", long_options, &option_index); if (c == -1) break; switch (c) { case 0: // If this option set a flag, do nothing else now. if (long_options[option_index].flag != 0) break; if (option_index == help_index) print_help_and_exit(); if (optarg) { switch(option_index) { case form_factor_hint_index: setup->form_factor = android::Setup::string_to_form_factor_hint(android::String8(optarg)); break; case stage_hint_index: setup->stage = android::Setup::string_to_stage_hint(android::String8(optarg)); break; case desktop_file_hint_index: setup->desktop_file = android::String8(optarg); break; } } break; case '?': break; } } android::global_setup = setup; } const ubuntu::application::ui::Setup::Ptr& ubuntu::application::ui::Setup::instance() { return android::global_setup; } ubuntu::application::ui::PhysicalDisplayInfo::Ptr ubuntu::application::ui::Session::physical_display_info( ubuntu::application::ui::PhysicalDisplayIdentifier id) { ubuntu::application::ui::PhysicalDisplayInfo::Ptr display( new android::PhysicalDisplayInfo(static_cast(id))); return display; } ubuntu::application::ui::Clipboard::Ptr ubuntu::application::ui::Session::clipboard() { static ubuntu::application::ui::Clipboard::Ptr instance(new android::Clipboard()); return instance; } } } namespace ui { const ubuntu::ui::SessionService::Ptr& ubuntu::ui::SessionService::instance() { static ubuntu::ui::SessionService::Ptr instance(new android::SessionService()); return instance; } const char* SessionProperties::key_application_stage_hint() { static const char* key = "application_stage_hint"; return key; } const char* SessionProperties::key_application_instance_id() { static const char* key = "application_instance_id"; return key; } const char* SessionProperties::key_application_name() { static const char* key = "application_name"; return key; } const char* SessionProperties::key_desktop_file_hint() { static const char* key = "desktop_file_hint"; return key; } } } platform-api-0.20+14.04.20140411/android/hybris/default_application_manager_test.cpp0000644000015301777760000001073012322054725030607 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #include "application_manager.h" #include #include #include #include #include #include namespace { struct ApplicationManagerSession : public android::BnApplicationManagerSession { ApplicationManagerSession() { } void on_application_resumed() { printf("%s \n", __PRETTY_FUNCTION__); } void on_application_about_to_stop() { printf("%s \n", __PRETTY_FUNCTION__); } void raise_application_surfaces_to_layer(int layer) { printf("%s \n", __PRETTY_FUNCTION__); printf("%d \n", layer); } void raise_surface_to_layer(int32_t token, int layer) { printf("%s: %d, %d \n", __PRETTY_FUNCTION__, token, layer); } SurfaceProperties query_surface_properties_for_token(int32_t token) { static const int layer = 100; SurfaceProperties props = { layer, 0, 0, 960, 1280 }; return props; } }; struct ApplicationManagerObserver : public android::BnApplicationManagerObserver { void on_session_requested(uint32_t app) { printf("%s: %d \n", __PRETTY_FUNCTION__, app); } void on_session_born(int id, int stage_hint, const android::String8& desktop_file) { printf("%s: %d, %d, %s \n", __PRETTY_FUNCTION__, id, stage_hint, desktop_file.string()); } void on_session_unfocused(int id, int stage_hint, const android::String8& desktop_file) { printf("%s: %d, %d, %s \n", __PRETTY_FUNCTION__, id, stage_hint, desktop_file.string()); } void on_session_focused(int id, int stage_hint, const android::String8& desktop_file) { printf("%s: %d, %d, %s \n", __PRETTY_FUNCTION__, id, stage_hint, desktop_file.string()); } void on_keyboard_geometry_changed(int x, int y, int width, int height) { printf("%s: %d, %d, %d, %d \n", __PRETTY_FUNCTION__, x, y, width, height); } void on_session_requested_fullscreen(int id, int stage_hint, const android::String8& desktop_file) { printf("%s: %d, %s \n", __PRETTY_FUNCTION__, id, desktop_file.string()); } void on_session_died(int id, int stage_hint, const android::String8& desktop_file) { printf("%s: %d, %d, %s \n", __PRETTY_FUNCTION__, id, stage_hint, desktop_file.string()); } }; } int main(int argc, char** argv) { android::ProcessState::self()->startThreadPool(); int test_fd = open("test.file", O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO); android::sp observer(new ApplicationManagerObserver()); android::sp session(new ApplicationManagerSession()); android::sp service_manager = android::defaultServiceManager(); android::sp service = service_manager->getService( android::String16(android::IApplicationManager::exported_service_name())); android::BpApplicationManager app_manager(service); app_manager.register_an_observer(observer); static const int32_t session_type = 0; static const int32_t stage_hint = 0; app_manager.start_a_new_session( session_type, stage_hint, android::String8("default_application_manager_test"), android::String8("default_application_manager_test"), session, test_fd, 0); for(;;) {} } platform-api-0.20+14.04.20140411/android/hybris/ubuntu_application_gps_for_hybris.cpp0000644000015301777760000002750212322054725031060 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Daniel d'Andrada */ #include #include // android stuff #include #include #define WAKE_LOCK_NAME "U_HARDWARE_GPS" struct UHardwareGps_ { UHardwareGps_(UHardwareGpsParams* params); ~UHardwareGps_(); bool init(); bool start(); bool stop(); void inject_time(int64_t time, int64_t timeReference, int uncertainty); void inject_location(double latitude, double longitude, float accuracy); void delete_aiding_data(uint16_t flags); bool set_position_mode(uint32_t mode, uint32_t recurrence, uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time); void inject_xtra_data(char* data, int length); const GpsInterface* gps_interface; const GpsXtraInterface* gps_xtra_interface; const AGpsInterface* agps_interface; const GpsNiInterface* gps_ni_interface; const GpsDebugInterface* gps_debug_interface; const AGpsRilInterface* agps_ril_interface; UHardwareGpsLocationCallback location_cb; UHardwareGpsStatusCallback status_cb; UHardwareGpsSvStatusCallback sv_status_cb; UHardwareGpsNmeaCallback nmea_cb; UHardwareGpsSetCapabilities set_capabilities_cb; UHardwareGpsRequestUtcTime request_utc_time_cb; UHardwareGpsXtraDownloadRequest xtra_download_request_cb; UHardwareGpsAGpsStatusCallback agps_status_cb; UHardwareGpsNiNotifyCallback gps_ni_notify_cb; UHardwareGpsAGpsRilRequestSetId request_setid_cb; UHardwareGpsAGpsRilRequestRefLoc request_refloc_cb; void* context; }; namespace { UHardwareGps hybris_gps_instance = NULL; } static void location_callback(GpsLocation* location) { if (!hybris_gps_instance) return; hybris_gps_instance->location_cb( reinterpret_cast(location), hybris_gps_instance->context); } static void status_callback(GpsStatus* status) { if (!hybris_gps_instance) return; hybris_gps_instance->status_cb(status->status, hybris_gps_instance->context); } static void sv_status_callback(GpsSvStatus* sv_status) { if (!hybris_gps_instance) return; hybris_gps_instance->sv_status_cb( reinterpret_cast(sv_status), hybris_gps_instance->context); } static void nmea_callback(GpsUtcTime timestamp, const char* nmea, int length) { if (!hybris_gps_instance) return; hybris_gps_instance->nmea_cb(timestamp, nmea, length, hybris_gps_instance->context); } static void set_capabilities_callback(uint32_t capabilities) { if (!hybris_gps_instance) return; hybris_gps_instance->set_capabilities_cb(capabilities, hybris_gps_instance->context); } static void acquire_wakelock_callback() { acquire_wake_lock(PARTIAL_WAKE_LOCK, WAKE_LOCK_NAME); } static void release_wakelock_callback() { release_wake_lock(WAKE_LOCK_NAME); } static void request_utc_time_callback() { if (!hybris_gps_instance) return; hybris_gps_instance->request_utc_time_cb(hybris_gps_instance->context); } typedef struct { void (*func)(void *); void *arg; } FuncAndArg; static void * thread_start_wrapper(void* arg) { FuncAndArg *func_and_arg = reinterpret_cast(arg); func_and_arg->func(func_and_arg->arg); delete func_and_arg; return NULL; } static pthread_t create_thread_callback(const char* name, void (*start)(void *), void* arg) { pthread_t thread; FuncAndArg *func_and_arg = new FuncAndArg; func_and_arg->func = start; func_and_arg->arg = arg; pthread_create(&thread, NULL, thread_start_wrapper, func_and_arg); return thread; } GpsCallbacks gps_callbacks = { sizeof(GpsCallbacks), location_callback, status_callback, sv_status_callback, nmea_callback, set_capabilities_callback, acquire_wakelock_callback, release_wakelock_callback, create_thread_callback, request_utc_time_callback, }; static void xtra_download_request_callback() { if (hybris_gps_instance) hybris_gps_instance->xtra_download_request_cb(hybris_gps_instance->context); } GpsXtraCallbacks gps_xtra_callbacks = { xtra_download_request_callback, create_thread_callback, }; static void agps_status_cb(AGpsStatus* agps_status) { if (!hybris_gps_instance) return; /* uint32_t ipaddr; // ipaddr field was not included in original AGpsStatus if (agps_status->size >= sizeof(AGpsStatus)) ipaddr = agps_status->ipaddr; else ipaddr = 0xFFFFFFFF; */ hybris_gps_instance->agps_status_cb( reinterpret_cast(agps_status), hybris_gps_instance->context); } AGpsCallbacks agps_callbacks = { agps_status_cb, create_thread_callback, }; static void gps_ni_notify_cb(GpsNiNotification *notification) { if (hybris_gps_instance) hybris_gps_instance->gps_ni_notify_cb( reinterpret_cast(notification), hybris_gps_instance->context); } GpsNiCallbacks gps_ni_callbacks = { gps_ni_notify_cb, create_thread_callback, }; static void agps_request_set_id(uint32_t flags) { if (hybris_gps_instance) hybris_gps_instance->request_setid_cb(flags, hybris_gps_instance->context); } static void agps_request_ref_location(uint32_t flags) { if (hybris_gps_instance) hybris_gps_instance->request_refloc_cb(flags, hybris_gps_instance->context); } AGpsRilCallbacks agps_ril_callbacks = { agps_request_set_id, agps_request_ref_location, create_thread_callback, }; UHardwareGps_::UHardwareGps_(UHardwareGpsParams* params) : gps_interface(NULL), gps_xtra_interface(NULL), agps_interface(NULL), gps_ni_interface(NULL), gps_debug_interface(NULL), agps_ril_interface(NULL), location_cb(params->location_cb), status_cb(params->status_cb), sv_status_cb(params->sv_status_cb), nmea_cb(params->nmea_cb), set_capabilities_cb(params->set_capabilities_cb), request_utc_time_cb(params->request_utc_time_cb), xtra_download_request_cb(params->xtra_download_request_cb), agps_status_cb(params->agps_status_cb), gps_ni_notify_cb(params->gps_ni_notify_cb), request_setid_cb(params->request_setid_cb), request_refloc_cb(params->request_refloc_cb), context(params->context) { int err; hw_module_t* module; err = hw_get_module(GPS_HARDWARE_MODULE_ID, (hw_module_t const**)&module); if (err == 0) { hw_device_t* device; err = module->methods->open(module, GPS_HARDWARE_MODULE_ID, &device); if (err == 0) { gps_device_t* gps_device = (gps_device_t *)device; gps_interface = gps_device->get_gps_interface(gps_device); } } if (gps_interface) { gps_xtra_interface = (const GpsXtraInterface*)gps_interface->get_extension(GPS_XTRA_INTERFACE); agps_interface = (const AGpsInterface*)gps_interface->get_extension(AGPS_INTERFACE); gps_ni_interface = (const GpsNiInterface*)gps_interface->get_extension(GPS_NI_INTERFACE); gps_debug_interface = (const GpsDebugInterface*)gps_interface->get_extension(GPS_DEBUG_INTERFACE); agps_ril_interface = (const AGpsRilInterface*)gps_interface->get_extension(AGPS_RIL_INTERFACE); } } UHardwareGps_::~UHardwareGps_() { if (gps_interface) gps_interface->cleanup(); } bool UHardwareGps_::init() { // fail if the main interface fails to initialize if (!gps_interface || gps_interface->init(&gps_callbacks) != 0) return false; // if XTRA initialization fails we will disable it by gps_Xtra_interface to null, // but continue to allow the rest of the GPS interface to work. if (gps_xtra_interface && gps_xtra_interface->init(&gps_xtra_callbacks) != 0) gps_xtra_interface = NULL; if (agps_interface) agps_interface->init(&agps_callbacks); if (gps_ni_interface) gps_ni_interface->init(&gps_ni_callbacks); if (agps_ril_interface) agps_ril_interface->init(&agps_ril_callbacks); return true; } bool UHardwareGps_::start() { if (gps_interface) return (gps_interface->start() == 0); else return false; } bool UHardwareGps_::stop() { if (gps_interface) return (gps_interface->stop() == 0); else return false; } void UHardwareGps_::inject_time(int64_t time, int64_t time_reference, int uncertainty) { if (gps_interface) gps_interface->inject_time(time, time_reference, uncertainty); } void UHardwareGps_::inject_location(double latitude, double longitude, float accuracy) { if (gps_interface) gps_interface->inject_location(latitude, longitude, accuracy); } void UHardwareGps_::delete_aiding_data(uint16_t flags) { if (gps_interface) gps_interface->delete_aiding_data(flags); } bool UHardwareGps_::set_position_mode(uint32_t mode, uint32_t recurrence, uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time) { if (gps_interface) return (gps_interface->set_position_mode(mode, recurrence, min_interval, preferred_accuracy, preferred_time) == 0); else return false; } void UHardwareGps_::inject_xtra_data(char* data, int length) { if (gps_xtra_interface) gps_xtra_interface->inject_xtra_data(data, length); } ///////////////////////////////////////////////////////////////////// // Implementation of the C API UHardwareGps u_hardware_gps_new(UHardwareGpsParams* params) { if (hybris_gps_instance != NULL) return NULL; UHardwareGps u_hardware_gps = new UHardwareGps_(params); hybris_gps_instance = u_hardware_gps; if (!u_hardware_gps->init()) { delete u_hardware_gps; u_hardware_gps = NULL; } return u_hardware_gps; } void u_hardware_gps_delete(UHardwareGps handle) { delete handle; if (handle == hybris_gps_instance) hybris_gps_instance = NULL; } bool u_hardware_gps_start(UHardwareGps self) { return self->start(); } bool u_hardware_gps_stop(UHardwareGps self) { return self->stop(); } void u_hardware_gps_inject_time(UHardwareGps self, int64_t time, int64_t time_reference, int uncertainty) { self->inject_time(time, time_reference, uncertainty); } void u_hardware_gps_inject_location(UHardwareGps self, double latitude, double longitude, float accuracy) { self->inject_location(latitude, longitude, accuracy); } void u_hardware_gps_delete_aiding_data(UHardwareGps self, uint16_t flags) { self->delete_aiding_data(flags); } bool u_hardware_gps_set_position_mode(UHardwareGps self, uint32_t mode, uint32_t recurrence, uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time) { return self->set_position_mode(mode, recurrence, min_interval, preferred_accuracy, preferred_time); } void u_hardware_gps_inject_xtra_data(UHardwareGps self, char* data, int length) { self->inject_xtra_data(data, length); } platform-api-0.20+14.04.20140411/android/hybris/default_application_session.h0000644000015301777760000001766512322054725027304 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef DEFAULT_APPLICATION_SESSION_H_ #define DEFAULT_APPLICATION_SESSION_H_ #include "application_manager.h" #include "private/application/ui/session_credentials.h" #include "private/application/ui/surface_role.h" #include "private/application/ui/stage_hint.h" #include #include #include namespace ubuntu { namespace detail { struct ApplicationSession : public android::RefBase { struct Surface : public android::RefBase { Surface(ApplicationSession* parent, const android::sp& input_channel, int32_t surface_role, int32_t token) : parent(parent), input_channel(input_channel), role(static_cast(surface_role)), token(token) { } android::IApplicationManagerSession::SurfaceProperties query_properties() { android::IApplicationManagerSession::SurfaceProperties props = parent->remote_session->query_surface_properties_for_token(token); return props; } android::sp make_input_window_handle() { return android::sp(new InputWindowHandle(parent, android::sp(this))); } ApplicationSession* parent; android::sp input_channel; ubuntu::application::ui::SurfaceRole role; int32_t token; }; ApplicationSession( pid_t pid, pid_t remote_pid, android::sp remote_session, int32_t session_type, int32_t stage_hint, const android::String8& app_name, const android::String8& desktop_file) : running_state(ubuntu::application::ui::process_destroyed), pid(pid), remote_pid(remote_pid), app_layer(0), remote_session(remote_session), session_type(static_cast(session_type)), stage_hint(stage_hint), app_name(app_name), desktop_file(desktop_file) { } struct InputApplicationHandle : public android::InputApplicationHandle { InputApplicationHandle(ApplicationSession* parent) : parent(parent) { updateInfo(); } bool updateInfo() { if (mInfo == NULL) { mInfo = new android::InputApplicationInfo(); mInfo->name = parent->app_name; mInfo->dispatchingTimeout = INT_MAX; } return true; } ApplicationSession* parent; }; struct InputWindowHandle : public android::InputWindowHandle { InputWindowHandle(ApplicationSession* parent, const android::sp& surface) : android::InputWindowHandle( android::sp( new InputApplicationHandle(parent))), parent(parent), surface(surface) { updateInfo(); } bool updateInfo() { if (mInfo == NULL) { mInfo = new android::InputWindowInfo(); } android::IApplicationManagerSession::SurfaceProperties props; if (parent->running_state == ubuntu::application::ui::process_suspended) { kill(parent->pid, SIGCONT); props = surface->query_properties(); kill(parent->pid, SIGSTOP); } else props = surface->query_properties(); ALOGI("%s: touchable_region = (%d, %d, %d, %d)", __PRETTY_FUNCTION__, props.left, props.top, props.right, props.bottom); SkRegion touchable_region; touchable_region.setRect(props.left, props.top, props.right+1, props.bottom+1); mInfo->name = parent->app_name; mInfo->layoutParamsFlags = android::InputWindowInfo::FLAG_NOT_TOUCH_MODAL; mInfo->layoutParamsType = android::InputWindowInfo::TYPE_APPLICATION; mInfo->touchableRegion = touchable_region; mInfo->frameLeft = props.left; mInfo->frameTop = props.top; mInfo->frameRight = props.right+1; mInfo->frameBottom = props.bottom+1; mInfo->scaleFactor = 1.f; mInfo->visible = true; mInfo->canReceiveKeys = true; mInfo->hasFocus = true; mInfo->hasWallpaper = false; mInfo->paused = false; mInfo->layer = props.layer; mInfo->dispatchingTimeout = INT_MAX; mInfo->ownerPid = 0; mInfo->ownerUid = 0; mInfo->inputFeatures = 0; mInfo->inputChannel = surface->input_channel; return true; } ApplicationSession* parent; android::sp surface; }; android::Vector< android::sp > input_window_handles() { android::Vector< android::sp > v; //for(size_t i = 0; i < registered_surfaces.size(); i++) for(int i = registered_surfaces.size()-1; i >= 0; i--) { v.push_back(registered_surfaces.valueAt(i)->make_input_window_handle()); } return v; } android::sp input_application_handle() { return android::sp(new InputApplicationHandle(this)); } int32_t layer() const { return app_layer; } android::IApplicationManagerSession::SurfaceProperties query_properties() const { if (!registered_surfaces.size()) return android::IApplicationManagerSession::SurfaceProperties(); android::IApplicationManagerSession::SurfaceProperties props = registered_surfaces.valueAt(registered_surfaces.size()-1)->query_properties(); return props; } void raise_application_surfaces_to_layer(int layer) { app_layer = layer; remote_session->raise_application_surfaces_to_layer(layer); } void raise_surface_to_layer(int32_t token, int layer) { remote_session->raise_surface_to_layer(token, layer); } void register_surface(const android::sp& surface) { registered_surfaces.add(surface->token, surface); } void on_application_resumed() { remote_session->on_application_resumed(); } void on_application_about_to_stop() { remote_session->on_application_about_to_stop(); } int32_t running_state; pid_t pid; pid_t remote_pid; int32_t app_layer; android::sp remote_session; ubuntu::application::ui::SessionType session_type; int32_t stage_hint; android::String8 app_name; android::String8 desktop_file; android::KeyedVector> registered_surfaces; }; } } #endif // DEFAULT_APPLICATION_SESSION_H_ platform-api-0.20+14.04.20140411/android/hybris/test_trap.cpp0000644000015301777760000000237212322054725024057 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #include #include #include #include int main(int argc, char** argv) { if (argc < 2) { printf("Usage %s set/unset handle", argv[0]); return 1; } if (strcmp("set", argv[1]) == 0) { int32_t handle = ubuntu_ui_set_surface_trap(atoi(argv[2]), atoi(argv[3]), atoi(argv[4]), atoi(argv[5])); printf("surface trap set: %u\n", handle); } else if (strcmp("unset", argv[1]) == 0) { ubuntu_ui_unset_surface_trap(atoi(argv[2])); } return 0; } platform-api-0.20+14.04.20140411/android/hybris/lifecycle_helpers.h0000644000015301777760000000376612322054725025210 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza */ #ifndef LIFECYCLE_HELPERS_H_ #define LIFECYCLE_HELPERS_H_ #include #include #include namespace ubuntu { namespace application { struct ProcessKiller : public android::Thread { ProcessKiller(const android::sp& as, const android::sp& controller) : as(as), task_controller(controller) { } bool threadLoop() { android::Mutex::Autolock _l(state_lock); state_cond.waitRelative(state_lock, seconds_to_nanoseconds(3)); // wait for timer if (as->running_state == ubuntu::application::ui::process_suspended) { ALOGI("%s() Suspending process", __PRETTY_FUNCTION__); if (task_controller == NULL) kill(as->pid, SIGSTOP); // delegate timer elapsed else task_controller->suspend_task(as->remote_pid); } return false; } android::sp as; android::sp task_controller; android::Mutex state_lock; android::Condition state_cond; android::sp looper; }; } } #endif // LIFECYCLE_HELPERS_H_ platform-api-0.20+14.04.20140411/android/hybris/input_consumer_thread.h0000644000015301777760000000502712322054725026120 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef INPUT_CONSUMER_THREAD_H_ #define INPUT_CONSUMER_THREAD_H_ #if ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR<=2 #include #else #include #endif #include namespace android { struct InputConsumerThread : public android::Thread { InputConsumerThread(android::InputConsumer& input_consumer) : input_consumer(input_consumer), looper(android::Looper::prepare(ALOOPER_PREPARE_ALLOW_NON_CALLBACKS)) { looper->addFd(input_consumer.getChannel()->getFd(), input_consumer.getChannel()->getFd(), ALOOPER_EVENT_INPUT, NULL, NULL); } bool threadLoop() { while (true) { switch(looper->pollOnce(5 * 1000)) { case ALOOPER_POLL_TIMEOUT: case ALOOPER_POLL_ERROR: continue; break; } // printf("%s \n", __PRETTY_FUNCTION__); InputEvent* event = NULL; uint32_t consumeSeq; bool result = true; switch(input_consumer.consume(&event_factory, true, -1, &consumeSeq, &event)) { case OK: //TODO:Dispatch to input listener result = true; //printf("Yeah, we have an event client-side.\n"); input_consumer.sendFinishedSignal(consumeSeq, result); break; case INVALID_OPERATION: result = true; break; case NO_MEMORY: result = true; break; } } return true; } android::InputConsumer input_consumer; android::sp looper; android::PreallocatedInputEventFactory event_factory; }; } #endif // INPUT_CONSUMER_THREAD_H_ platform-api-0.20+14.04.20140411/android/hybris/test_osk_visibility.cpp0000644000015301777760000000211612322054725026150 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #include #include #include int main(int argc, char** argv) { if (argc < 2) { printf("Usage: %s {show|hide}", argv[0]); return 1; } if (strcmp("show", argv[1]) == 0) ubuntu_ui_report_osk_visible(0, 0, 0, 0); else if (strcmp("hide", argv[1]) == 0) ubuntu_ui_report_osk_invisible(); return 0; } platform-api-0.20+14.04.20140411/android/hybris/test_sensors_c_api.cpp0000644000015301777760000000561212322054725025740 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza */ #include #include #include #include #include #include void on_new_accelerometer_event(UASAccelerometerEvent* event, void* context) { printf("%s \n", __PRETTY_FUNCTION__); printf("\ttime: %llu\n", uas_accelerometer_event_get_timestamp(event)); printf("\tx: %f\n", uas_accelerometer_event_get_acceleration_x(event)); printf("\ty: %f\n", uas_accelerometer_event_get_acceleration_y(event)); printf("\tz: %f\n", uas_accelerometer_event_get_acceleration_z(event)); } void on_new_proximity_event(UASProximityEvent* event, void* context) { printf("%s \n", __PRETTY_FUNCTION__); printf("\ttime: %llu\n", uas_proximity_event_get_timestamp(event)); switch (uas_proximity_event_get_distance(event)) { case U_PROXIMITY_NEAR: { printf("\tdistance: NEAR\n"); break; } case U_PROXIMITY_FAR: { printf("\tdistance: FAR\n"); break; } } } void on_new_light_event(UASLightEvent* event, void* context) { printf("%s \n", __PRETTY_FUNCTION__); printf("\ttime: %llu\n", uas_light_event_get_timestamp(event)); printf("\tlight: %f\n", uas_light_event_get_light(event)); } int main(int argc, char** argv) { UASensorsAccelerometer* accelerometer = ua_sensors_accelerometer_new(); UASensorsProximity* proximity = ua_sensors_proximity_new(); UASensorsLight* ambientlight = ua_sensors_light_new(); ua_sensors_accelerometer_set_reading_cb(accelerometer, on_new_accelerometer_event, NULL); ua_sensors_proximity_set_reading_cb(proximity, on_new_proximity_event, NULL); ua_sensors_light_set_reading_cb(ambientlight, on_new_light_event, NULL); ua_sensors_accelerometer_enable(accelerometer); ua_sensors_proximity_enable(proximity); ua_sensors_light_enable(ambientlight); while(true) { } } platform-api-0.20+14.04.20140411/android/hybris/event_loop.h0000644000015301777760000000303612322054725023667 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef EVENT_LOOP_H_ #define EVENT_LOOP_H_ #include #include namespace ubuntu { namespace application { struct EventLoop : public android::Thread { EventLoop(const android::sp& looper) : looper(looper) { } bool threadLoop() { static const int five_seconds_in_milliseconds = 5*1000; bool result = true; while(true) { switch(looper->pollOnce(five_seconds_in_milliseconds)) { case ALOOPER_POLL_CALLBACK: case ALOOPER_POLL_TIMEOUT: result = true; break; case ALOOPER_POLL_ERROR: result = false; break; } } return result; } android::sp looper; }; } } #endif // EVENT_LOOP_H_ platform-api-0.20+14.04.20140411/android/hybris/ubuntu_application_sensors_for_hybris.cpp0000644000015301777760000002202112322054725031752 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #include "event_loop.h" #include #include #include #include #include #include #include #include #include #include namespace ubuntu { namespace application { namespace sensors { namespace hybris { typedef android::KeyedVector< ubuntu::application::sensors::SensorType, uint32_t> ForwardSensorTypeLut; typedef android::KeyedVector< uint32_t, ubuntu::application::sensors::SensorType> BackwardSensorTypeLut; static ForwardSensorTypeLut init_forward_sensor_type_lut() { static ForwardSensorTypeLut lut; lut.add(sensor_type_accelerometer, ASENSOR_TYPE_ACCELEROMETER); lut.add(sensor_type_magnetic_field, ASENSOR_TYPE_MAGNETIC_FIELD); lut.add(sensor_type_gyroscope, ASENSOR_TYPE_GYROSCOPE); lut.add(sensor_type_light, ASENSOR_TYPE_LIGHT); lut.add(sensor_type_proximity, ASENSOR_TYPE_PROXIMITY); lut.add(sensor_type_orientation, SENSOR_TYPE_ORIENTATION); lut.add(sensor_type_linear_acceleration, SENSOR_TYPE_LINEAR_ACCELERATION); lut.add(sensor_type_rotation_vector, SENSOR_TYPE_ROTATION_VECTOR); return lut; } static BackwardSensorTypeLut init_backward_sensor_type_lut() { static BackwardSensorTypeLut lut; lut.add(ASENSOR_TYPE_ACCELEROMETER, sensor_type_accelerometer); lut.add(ASENSOR_TYPE_MAGNETIC_FIELD, sensor_type_magnetic_field); lut.add(ASENSOR_TYPE_GYROSCOPE, sensor_type_gyroscope); lut.add(ASENSOR_TYPE_LIGHT, sensor_type_light); lut.add(ASENSOR_TYPE_PROXIMITY, sensor_type_proximity); lut.add(SENSOR_TYPE_ORIENTATION, sensor_type_orientation); lut.add(SENSOR_TYPE_LINEAR_ACCELERATION, sensor_type_linear_acceleration); lut.add(SENSOR_TYPE_ROTATION_VECTOR, sensor_type_rotation_vector); return lut; } static const ForwardSensorTypeLut forward_sensor_type_lut = init_forward_sensor_type_lut(); static const BackwardSensorTypeLut backward_sensor_type_lut = init_backward_sensor_type_lut(); struct Sensor : public ubuntu::application::sensors::Sensor { typedef ubuntu::platform::shared_ptr Ptr; Sensor( const android::Sensor* sensor, const android::sp& queue) : sensor(sensor), sensor_event_queue(queue) { }; int32_t id() { return sensor->getHandle(); } const char* name() { return sensor->getName().string(); } const char* vendor() { return sensor->getVendor().string(); } void register_listener(const SensorListener::Ptr& listener) { listeners.push_back(listener); } // Deprecated! const SensorListener::Ptr& registered_listener() { return *(listeners.begin()); } const android::List& registered_listeners() const { return listeners; } int enable() { return sensor_event_queue->enableSensor(sensor); } int disable() { return sensor_event_queue->disableSensor(sensor); } SensorType type() { return backward_sensor_type_lut.valueFor(sensor->getType()); } float min_value() { return sensor->getMinValue(); } float max_value() { return sensor->getMaxValue(); } float resolution() { return sensor->getResolution(); } int32_t min_delay() { return sensor->getMinDelay(); } float power_consumption() { return sensor->getPowerUsage(); } const android::Sensor* sensor; ubuntu::application::sensors::SensorListener::Ptr listener; android::List listeners; android::sp sensor_event_queue; }; void print_vector(const ASensorVector& vec) { printf("Status: %d \n", vec.status); printf("\t\t %f, %f, %f \n", vec.v[0], vec.v[1], vec.v[2]); printf("\t\t %f, %f, %f \n", vec.x, vec.y, vec.z); printf("\t\t %f, %f, %f \n", vec.azimuth, vec.pitch, vec.roll); } struct SensorService : public ubuntu::application::sensors::SensorService { static int looper_callback(int receiveFd, int events, void* ctxt) { static const int success_and_continue = 1; static const int error_and_abort = 0; SensorService* thiz = static_cast(ctxt); if (!thiz) return error_and_abort; if (thiz->sensor_event_queue->getFd() != receiveFd) return success_and_continue; static ASensorEvent event; if (1 != thiz->sensor_event_queue->read(&event, 1)) return error_and_abort; Sensor::Ptr sensor = thiz->sensor_registry.valueFor(event.sensor); if (sensor == NULL) return success_and_continue; static ubuntu::application::sensors::SensorReading::Ptr reading( new ubuntu::application::sensors::SensorReading()); reading->timestamp = event.timestamp; switch (event.type) { case ASENSOR_TYPE_ACCELEROMETER: memcpy( reading->acceleration.v, event.acceleration.v, sizeof(reading->acceleration.v)); break; case ASENSOR_TYPE_MAGNETIC_FIELD: memcpy( reading->magnetic.v, event.magnetic.v, sizeof(reading->magnetic.v)); break; case ASENSOR_TYPE_GYROSCOPE: memcpy( reading->acceleration.v, event.acceleration.v, sizeof(reading->acceleration.v)); break; case ASENSOR_TYPE_LIGHT: reading->light = event.light; break; case ASENSOR_TYPE_PROXIMITY: reading->distance = event.distance; break; case SENSOR_TYPE_ORIENTATION: reading->vector.v[0] = event.vector.azimuth; reading->vector.v[1] = event.vector.pitch; reading->vector.v[2] = event.vector.roll; break; case SENSOR_TYPE_LINEAR_ACCELERATION: memcpy( reading->acceleration.v, event.acceleration.v, sizeof(reading->acceleration.v)); break; case SENSOR_TYPE_ROTATION_VECTOR: reading->vector.v[0] = event.data[0]; reading->vector.v[1] = event.data[1]; reading->vector.v[2] = event.data[2]; break; } // Call all of the registered listeners android::List::const_iterator it = sensor->registered_listeners().begin(); while (it != sensor->registered_listeners().end()) { (*it)->on_new_reading(reading); ++it; } return success_and_continue; } SensorService() : sensor_event_queue(android::SensorManager::getInstance().createEventQueue()), looper(new android::Looper(false)), event_loop(new ubuntu::application::EventLoop(looper)) { looper->addFd( sensor_event_queue->getFd(), 0, ALOOPER_EVENT_INPUT, looper_callback, this); event_loop->run(); } android::sp sensor_event_queue; android::sp looper; android::sp event_loop; android::KeyedVector sensor_registry; }; ubuntu::platform::shared_ptr instance; } ubuntu::application::sensors::Sensor::Ptr ubuntu::application::sensors::SensorService::sensor_for_type( ubuntu::application::sensors::SensorType type) { const android::Sensor* sensor = android::SensorManager::getInstance().getDefaultSensor( hybris::forward_sensor_type_lut.valueFor(type)); if (sensor == NULL) return Sensor::Ptr(); if (hybris::instance == NULL) hybris::instance = new hybris::SensorService(); hybris::Sensor::Ptr p( new hybris::Sensor( sensor, hybris::instance->sensor_event_queue)); if (sensor) hybris::instance->sensor_registry.add(p->id(), p); return Sensor::Ptr(p.get()); } } } } platform-api-0.20+14.04.20140411/android/hybris/test_c_api.cpp0000644000015301777760000002205112322054725024160 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #include #include #include #include #include #include #include #include #include #include #include struct View { static const char* vertex_shader(); static const char* fragment_shader(); static GLuint load_shader(GLenum shaderType, const char* pSource); static GLuint create_program(const char* pVertexSource, const char* pFragmentSource); static const GLfloat* triangle() { static const GLfloat result[] = { -0.125f, -0.125f, 0.0f, 0.5f, 0.0f, 0.125f, 0.0f, 0.5f, 0.125f, -0.125f, 0.0f, 0.5f }; return result; } static const GLfloat* color_triangle() { static const GLfloat result[] = { 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f }; return result; } View(UAUiWindow* surface); void render(); void step(); UAUiWindow* surface; EGLDisplay egl_display; EGLSurface egl_surface; EGLConfig egl_config; EGLContext egl_context; GLfloat rotation_angle; GLuint gProgram; GLuint gvPositionHandle, gvColorHandle; GLuint rotation_uniform; GLint num_vertex; const GLfloat * vertex_data; const GLfloat * color_data; }; void on_new_event(void* ctx, const Event* ev) { } int main(int argc, char** argv) { UApplicationOptions* options = u_application_options_new_from_cmd_line(argc, argv); UApplicationDescription* desc = u_application_description_new(); UApplicationId* id = u_application_id_new_from_stringn("UbuntuApplicationCAPI", 21); u_application_description_set_application_id(desc, id); UApplicationInstance* instance = u_application_instance_new_from_description_with_options(desc, options); UAUiSessionProperties* props = ua_ui_session_properties_new(); ua_ui_session_properties_set_type(props, U_USER_SESSION); UAUiSession* ua_ui_session_new_with_properties(props); UAUiDisplay* display = ua_ui_display_new_with_index(0); printf("Display resolution: (x,y) = (%d,%d)\n", ua_ui_display_query_horizontal_res(display), ua_ui_display_query_vertical_res(display)); UAUiWindowProperties* wprops = ua_ui_window_properties_new_for_normal_window(); ua_ui_window_properties_set_titlen(wprops, "Window 1", 8); ua_ui_window_properties_set_role(wprops, U_MAIN_ROLE); ua_ui_window_properties_set_input_cb_and_ctx(wprops, on_new_event, NULL); UAUiWindow* surface = ua_ui_window_new_for_application_with_properties(instance, wprops); View view(surface); while(true) { view.render(); view.step(); } } const char* View::vertex_shader() { static const char shader[] = "attribute vec4 vPosition;\n" "attribute vec4 vColor;\n" "uniform float angle;\n" "varying vec4 colorinfo;\n" "void main() {\n" " mat3 rot_z = mat3( vec3( cos(angle), sin(angle), 0.0),\n" " vec3(-sin(angle), cos(angle), 0.0),\n" " vec3( 0.0, 0.0, 1.0));\n" " gl_Position = vec4(rot_z * vPosition.xyz, 1.0);\n" " colorinfo = vColor;\n" "}\n"; return shader; } const char* View::fragment_shader() { static const char shader[] = "precision mediump float;\n" "varying vec4 colorinfo;\n" "void main() {\n" " gl_FragColor = colorinfo;\n" "}\n"; return shader; } GLuint View::load_shader(GLenum shaderType, const char* pSource) { GLuint shader = glCreateShader(shaderType); if (shader) { glShaderSource(shader, 1, &pSource, NULL); glCompileShader(shader); GLint compiled = 0; glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled); if (!compiled) { GLint infoLen = 0; glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen); if (infoLen) { char* buf = (char*) malloc(infoLen); if (buf) { glGetShaderInfoLog(shader, infoLen, NULL, buf); fprintf(stderr, "Could not compile shader %d:\n%s\n", shaderType, buf); free(buf); } glDeleteShader(shader); shader = 0; } } } else { printf("Error, during shader creation: %i\n", glGetError()); } return shader; } GLuint View::create_program(const char* pVertexSource, const char* pFragmentSource) { GLuint vertexShader = load_shader(GL_VERTEX_SHADER, pVertexSource); if (!vertexShader) { printf("vertex shader not compiled\n"); return 0; } GLuint pixelShader = load_shader(GL_FRAGMENT_SHADER, pFragmentSource); if (!pixelShader) { printf("frag shader not compiled\n"); return 0; } GLuint program = glCreateProgram(); if (program) { glAttachShader(program, vertexShader); glAttachShader(program, pixelShader); glLinkProgram(program); GLint linkStatus = GL_FALSE; glGetProgramiv(program, GL_LINK_STATUS, &linkStatus); if (linkStatus != GL_TRUE) { GLint bufLength = 0; glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength); if (bufLength) { char* buf = (char*) malloc(bufLength); if (buf) { glGetProgramInfoLog(program, bufLength, NULL, buf); fprintf(stderr, "Could not link program:\n%s\n", buf); free(buf); } } glDeleteProgram(program); program = 0; } } return program; } View::View(UAUiWindow* surface) : surface(surface), rotation_angle(0.f), num_vertex(3) { // assert(eglBindAPI(EGL_OPENGL_ES_API) == EGL_TRUE); egl_display = eglGetDisplay(EGL_DEFAULT_DISPLAY); assert(egl_display != EGL_NO_DISPLAY); EGLint major, minor; if (EGL_FALSE == eglInitialize(egl_display, &major, &minor)) { printf("egl error: problem initializing.\n"); exit(1); } EGLint attribs[] = { EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_NONE }; EGLint n; if (EGL_FALSE == eglChooseConfig( egl_display, attribs, &egl_config, 1, &n)) { printf("egl error: Cannot choose configuration.\n"); } EGLint context_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; egl_context = eglCreateContext( egl_display, egl_config, EGL_NO_CONTEXT, context_attribs); assert(EGL_NO_CONTEXT != egl_context); EGLNativeWindowType nativeWindow = ua_ui_window_get_native_type(surface); egl_surface = eglCreateWindowSurface(egl_display, egl_config, nativeWindow, NULL); eglMakeCurrent( egl_display, egl_surface, egl_surface, egl_context); vertex_data = triangle(); color_data = color_triangle(); gProgram = create_program(vertex_shader(), fragment_shader()); if (!gProgram) { printf("error making program\n"); return; } gvPositionHandle = glGetAttribLocation(gProgram, "vPosition"); gvColorHandle = glGetAttribLocation(gProgram, "vColor"); rotation_uniform = glGetUniformLocation(gProgram, "angle"); return; } void View::render() { glUseProgram(gProgram); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); glUniform1fv(rotation_uniform, 1, &rotation_angle); glVertexAttribPointer( gvColorHandle, num_vertex, GL_FLOAT, GL_FALSE, sizeof(GLfloat)*4, color_data); glVertexAttribPointer( gvPositionHandle, num_vertex, GL_FLOAT, GL_FALSE, 0, vertex_data); glEnableVertexAttribArray(gvPositionHandle); glEnableVertexAttribArray(gvColorHandle); glDrawArrays(GL_TRIANGLE_STRIP, 0, num_vertex); glDisableVertexAttribArray(gvPositionHandle); glDisableVertexAttribArray(gvColorHandle); eglSwapBuffers(egl_display, egl_surface); } void View::step() { rotation_angle += 0.01; } platform-api-0.20+14.04.20140411/android/hybris/test_session_c_api.cpp0000644000015301777760000001362112322054725025726 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #include #include #include #include #include #include typedef union { struct Components { uint8_t r; uint8_t g; uint8_t b; uint8_t a; } components; uint32_t value; } Pixel; struct Config { Config() : take_screencast_flag(0), take_screenshot_flag(0) { } int take_screencast_flag; int take_screenshot_flag; }; void on_snapshot_completed(const void* pixel_data, unsigned int width, unsigned int height, unsigned int x, unsigned int y, unsigned int source_width, unsigned int source_height, unsigned int stride, void* context) { static unsigned int counter = 0; printf("%s: (%p, %d, %d, %d) \n", __PRETTY_FUNCTION__, pixel_data, width, height, stride); static const char snapshot_pattern[] = "./snapshot_%I_%M_%S.ppm"; static const char frame_pattern[] = "./frame_%I_%M_%S.raw"; char fn[256]; int take_screenshot = 1; int take_screencast = 0; if (context != NULL) { Config* config = (Config*) context; take_screenshot = config->take_screenshot_flag; take_screencast = config->take_screencast_flag; } time_t curtime; struct tm *loctime; curtime = time (NULL); loctime = localtime (&curtime); static const char screenshot_file_mode[] = "w+"; static const char screencast_file_mode[] = "wb+"; FILE* f = NULL; if (take_screenshot) { strftime(fn, 256, snapshot_pattern, loctime); f = fopen(fn, screenshot_file_mode); } else if (take_screencast) { strftime(fn, 256, frame_pattern, loctime); f = fopen(fn, screencast_file_mode); } if (!f) { printf("Problem opening file: %s \n", fn); return; } if (take_screenshot) { const unsigned int* p = static_cast(pixel_data); fprintf(f, "P3\n%d %d\n%d\n\n", width, height, 255); for(unsigned int i = 0; i < height; i++) { for(unsigned int j = 0; j < width; j++) { Pixel pixel; pixel.value = *p; ++p; fprintf( f, "%d %d %d\t", pixel.components.r, pixel.components.g, pixel.components.b); } } } else if (take_screencast) { fwrite(pixel_data, sizeof(unsigned int), width*height, f); ubuntu_ui_session_snapshot_running_session_with_id( -1, on_snapshot_completed, context); } } void on_session_born(ubuntu_ui_session_properties props, void*) { printf("%s:\n\t Id: %d \n\t Desktop file hint: %s \n", __PRETTY_FUNCTION__, ubuntu_ui_session_properties_get_application_instance_id(props), ubuntu_ui_session_properties_get_desktop_file_hint(props)); ubuntu_ui_session_snapshot_running_session_with_id( ubuntu_ui_session_properties_get_application_instance_id(props), on_snapshot_completed, NULL); } void on_session_focused(ubuntu_ui_session_properties props, void*) { printf("%s:\n\t Id: %d \n\t Desktop file hint: %s \n", __PRETTY_FUNCTION__, ubuntu_ui_session_properties_get_application_instance_id(props), ubuntu_ui_session_properties_get_desktop_file_hint(props)); } void on_session_died(ubuntu_ui_session_properties props, void*) { printf("%s:\n\t Id: %d \n\t Desktop file hint: %s \n", __PRETTY_FUNCTION__, ubuntu_ui_session_properties_get_application_instance_id(props), ubuntu_ui_session_properties_get_desktop_file_hint(props)); } Config parse_cmd_line(int argc, char** argv) { Config config; static struct option long_options[] = { {"take-screencast", no_argument, &config.take_screencast_flag, 1}, {"take-screenshot", no_argument, &config.take_screenshot_flag, 1} }; while (true) { int option_index = 0; int c = getopt_long( argc, argv, "", long_options, &option_index); if (c == -1) break; switch (c) { case 0: // No need to do anything here: Flag is set automatically. break; default: break; } } return config; } int main(int argc, char** argv) { static const int complete_session_id = -1; Config config = parse_cmd_line(argc, argv); if (config.take_screenshot_flag || config.take_screencast_flag) { ubuntu_ui_session_snapshot_running_session_with_id( complete_session_id, on_snapshot_completed, &config); return 0; } ubuntu_ui_session_lifecycle_observer observer; memset(&observer, 0, sizeof(observer)); observer.on_session_born = on_session_born; observer.on_session_focused = on_session_focused; observer.on_session_died = on_session_died; ubuntu_ui_session_install_session_lifecycle_observer(&observer); while(true) { } return 0; } platform-api-0.20+14.04.20140411/android/hybris/Android.mk0000644000015301777760000001320312322054725023252 0ustar pbusernogroup00000000000000LOCAL_PATH := $(call my-dir) ANDROID_VERSION_MAJOR := $(word 1, $(subst ., , $(PLATFORM_VERSION))) ANDROID_VERSION_MINOR := $(word 2, $(subst ., , $(PLATFORM_VERSION))) ANDROID_VERSION_PATCH := $(word 3, $(subst ., , $(PLATFORM_VERSION))) HAS_LIBINPUTSERVICE := $(shell test $(ANDROID_VERSION_MAJOR) -eq 4 -a $(ANDROID_VERSION_MINOR) -gt 2 && echo true) include $(CLEAR_VARS) LOCAL_CFLAGS += \ -DANDROID_VERSION_MAJOR=$(ANDROID_VERSION_MAJOR) \ -DANDROID_VERSION_MINOR=$(ANDROID_VERSION_MINOR) \ -DANDROID_VERSION_PATCH=$(ANDROID_VERSION_PATCH) UPAPI_PATH := $(LOCAL_PATH)/../../ LOCAL_CFLAGS += -std=gnu++0x LOCAL_C_INCLUDES := \ $(UPAPI_PATH)/include \ $(UPAPI_PATH)/android/include LOCAL_SRC_FILES := \ ubuntu_application_api_for_hybris.cpp \ ubuntu_application_gps_for_hybris.cpp \ ubuntu_application_sensors_for_hybris.cpp \ ../default/default_ubuntu_application_sensor.cpp \ ../default/default_ubuntu_application_ui.cpp \ ../default/default_ubuntu_application.cpp \ ../default/default_ubuntu_ui.cpp \ application_manager.cpp LOCAL_MODULE := libubuntu_application_api LOCAL_MODULE_TAGS := optional LOCAL_SHARED_LIBRARIES := \ libandroidfw \ libbinder \ libinput \ liblog \ libutils \ libgui \ libEGL \ libGLESv2 \ libhardware \ libhardware_legacy include $(BUILD_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_CFLAGS += -std=gnu++0x LOCAL_C_INCLUDES := \ $(UPAPI_PATH)/include \ $(UPAPI_PATH)/android/include LOCAL_SRC_FILES:= \ test.cpp \ LOCAL_MODULE:= direct_ubuntu_application_api_for_hybris_test LOCAL_MODULE_TAGS := optional LOCAL_SHARED_LIBRARIES := \ libandroidfw \ libutils \ libEGL \ libGLESv2 \ libubuntu_application_api include $(BUILD_EXECUTABLE) include $(CLEAR_VARS) LOCAL_CFLAGS += -std=gnu++0x LOCAL_C_INCLUDES := \ $(UPAPI_PATH)/include \ $(UPAPI_PATH)/android/include LOCAL_SRC_FILES:= \ test_c_api.cpp \ LOCAL_MODULE:= direct_ubuntu_application_c_api_for_hybris_test LOCAL_MODULE_TAGS := optional LOCAL_SHARED_LIBRARIES := \ libandroidfw \ libutils \ libEGL \ libGLESv2 \ libubuntu_application_api include $(BUILD_EXECUTABLE) include $(CLEAR_VARS) LOCAL_CFLAGS += -std=gnu++0x LOCAL_C_INCLUDES := \ $(UPAPI_PATH)/include \ $(UPAPI_PATH)/android/include LOCAL_SRC_FILES:= \ test_session_c_api.cpp \ LOCAL_MODULE:= direct_ubuntu_application_session_c_api_for_hybris_test LOCAL_MODULE_TAGS := optional LOCAL_SHARED_LIBRARIES := \ libandroidfw \ libutils \ libEGL \ libGLESv2 \ libubuntu_application_api include $(BUILD_EXECUTABLE) include $(CLEAR_VARS) LOCAL_CFLAGS += -std=gnu++0x LOCAL_C_INCLUDES := \ $(UPAPI_PATH)/include \ $(UPAPI_PATH)/android/include LOCAL_SRC_FILES:= \ test_trap.cpp \ LOCAL_MODULE:= direct_set_trap LOCAL_MODULE_TAGS := optional LOCAL_SHARED_LIBRARIES := \ libandroidfw \ libutils \ libEGL \ libGLESv2 \ libubuntu_application_api include $(BUILD_EXECUTABLE) include $(CLEAR_VARS) LOCAL_CFLAGS += -std=gnu++0x LOCAL_C_INCLUDES := \ $(UPAPI_PATH)/include \ $(UPAPI_PATH)/android/include LOCAL_SRC_FILES:= \ test_osk_visibility.cpp \ LOCAL_MODULE:= direct_osk_visibility LOCAL_MODULE_TAGS := optional LOCAL_SHARED_LIBRARIES := \ libandroidfw \ libutils \ libEGL \ libGLESv2 \ libubuntu_application_api include $(BUILD_EXECUTABLE) include $(CLEAR_VARS) LOCAL_CFLAGS += -std=gnu++0x LOCAL_C_INCLUDES := \ $(UPAPI_PATH)/include \ $(UPAPI_PATH)/android/include LOCAL_SRC_FILES:= \ test_sensors_c_api.cpp \ LOCAL_MODULE:= direct_ubuntu_application_sensors_c_api_for_hybris_test LOCAL_MODULE_TAGS := optional LOCAL_SHARED_LIBRARIES := \ libandroidfw \ libutils \ libEGL \ libGLESv2 \ libubuntu_application_api include $(BUILD_EXECUTABLE) include $(CLEAR_VARS) LOCAL_CFLAGS += -std=gnu++0x LOCAL_C_INCLUDES := \ $(UPAPI_PATH)/include \ $(UPAPI_PATH)/android/include LOCAL_SRC_FILES:= \ test_sensors.cpp \ LOCAL_MODULE:= direct_ubuntu_application_sensors_for_hybris_test LOCAL_MODULE_TAGS := optional LOCAL_SHARED_LIBRARIES := \ libandroidfw \ libutils \ libEGL \ libGLESv2 \ libubuntu_application_api include $(BUILD_EXECUTABLE) include $(CLEAR_VARS) LOCAL_CFLAGS += \ -DANDROID_VERSION_MAJOR=$(ANDROID_VERSION_MAJOR) \ -DANDROID_VERSION_MINOR=$(ANDROID_VERSION_MINOR) \ -DANDROID_VERSION_PATCH=$(ANDROID_VERSION_PATCH) LOCAL_CFLAGS += -std=gnu++0x LOCAL_C_INCLUDES := \ external/skia/include/core \ frameworks/base/services \ $(UPAPI_PATH)/include \ $(UPAPI_PATH)/android/include LOCAL_SRC_FILES:= \ application_manager.cpp \ default_application_manager.cpp \ LOCAL_MODULE:= ubuntuappmanager LOCAL_MODULE_TAGS := optional LOCAL_SHARED_LIBRARIES := \ libbinder \ libinput \ liblog \ libgui \ libskia \ libandroidfw \ libutils \ libEGL \ libGLESv2 \ libubuntu_application_api ifeq ($(HAS_LIBINPUTSERVICE),true) LOCAL_SHARED_LIBRARIES += libinputservice endif include $(BUILD_EXECUTABLE) include $(CLEAR_VARS) LOCAL_CFLAGS += -std=gnu++0x LOCAL_C_INCLUDES := \ $(UPAPI_PATH)/include \ $(UPAPI_PATH)/android/include LOCAL_SRC_FILES:= \ application_manager.cpp \ default_application_manager_test.cpp \ LOCAL_MODULE:= ubuntuappmanager_test LOCAL_MODULE_TAGS := optional LOCAL_SHARED_LIBRARIES := \ libbinder \ libandroidfw \ libutils \ libEGL \ libGLESv2 \ libubuntu_application_api include $(BUILD_EXECUTABLE) include $(CLEAR_VARS) LOCAL_CFLAGS += -std=gnu++0x LOCAL_C_INCLUDES := \ $(UPAPI_PATH)/include \ $(UPAPI_PATH)/android/include LOCAL_SRC_FILES:= \ test_gps_api.cpp \ LOCAL_MODULE:= direct_ubuntu_application_gps_c_api_for_hybris_test LOCAL_MODULE_TAGS := optional LOCAL_SHARED_LIBRARIES := \ libui \ libutils \ libEGL \ libGLESv2 \ libhardware \ libhardware_legacy \ libubuntu_application_api #include $(BUILD_EXECUTABLE) platform-api-0.20+14.04.20140411/android/hybris/session_service.h0000644000015301777760000000162512322054725024722 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef HYBRIS_SESSION_SERVICE_H_ #define HYBRIS_SESSION_SERVICE_H_ #include namespace android { class ISessionService : public IInterface } #endif // HYBRIS_SESSION_SERVICE_H_ platform-api-0.20+14.04.20140411/android/hybris/test_sensors.cpp0000644000015301777760000001027512322054725024606 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #include #include #include #include #include #include namespace uas = ubuntu::application::sensors; struct SensorListener : public uas::SensorListener { SensorListener(uas::SensorType sensor_type) : sensor_type(sensor_type) { } void on_new_reading(const uas::SensorReading::Ptr& reading) { on_new_reading(sensor_type, reading); } void on_new_reading( uas::SensorType sensor_type, const uas::SensorReading::Ptr& reading) { switch (sensor_type) { case uas::sensor_type_accelerometer: printf("New reading for accelerometer: [%f, %f, %f] \n", reading->acceleration[0], reading->acceleration[1], reading->acceleration[2]); break; case uas::sensor_type_magnetic_field: printf("New reading for magnetic field: [%f, %f, %f] \n", reading->magnetic[0], reading->magnetic[1], reading->magnetic[2]); break; case uas::sensor_type_gyroscope: printf("New reading for gyro: [%f, %f, %f] \n", reading->vector[0], reading->vector[1], reading->vector[2]); break; case uas::sensor_type_light: printf("New reading for light sensor: [%f] \n", reading->light); break; case uas::sensor_type_proximity: printf("New reading for proximity sensor: [%f] \n", reading->distance); break; case uas::sensor_type_orientation: printf("New reading for orientation sensor: [%f, %f, %f] \n", reading->vector[0], reading->vector[1], reading->vector[2]); break; case uas::sensor_type_linear_acceleration: printf("New reading for linear acceleration: [%f, %f, %f] \n", reading->vector[0], reading->vector[1], reading->vector[2]); break; case uas::sensor_type_rotation_vector: printf("New reading for rotation vector: [%f, %f, %f] \n", reading->vector[0], reading->vector[1], reading->vector[2]); break; } } uas::SensorType sensor_type; }; int main(int argc, char** argv) { ubuntu::application::sensors::Sensor::Ptr sensors[ubuntu::application::sensors::undefined_sensor_type]; for(int i = ubuntu::application::sensors::first_defined_sensor_type; i < ubuntu::application::sensors::undefined_sensor_type; i++) { sensors[i] = uas::SensorService::sensor_for_type( static_cast(i)); if (sensors[i] == NULL) continue; printf("Sensor: %s by %s (power consumption: %f)\n", sensors[i]->name(), sensors[i]->vendor(), sensors[i]->power_consumption()); sensors[i]->register_listener( uas::SensorListener::Ptr( new SensorListener( static_cast(i)))); sensors[i]->enable(); } while (true) { sleep(1); } } platform-api-0.20+14.04.20140411/android/hybris/default_application_manager_input_setup.h0000644000015301777760000003245012322054725031657 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef DEFAULT_APPLICATION_MANAGER_INPUT_SETUP_H_ #define DEFAULT_APPLICATION_MANAGER_INPUT_SETUP_H_ #include #include #include #include #include #include #include #include #include #define REPORT_FUNCTION_CALL()// printf("%s \n", __PRETTY_FUNCTION__); namespace android { class DefaultPointerControllerPolicy : public android::PointerControllerPolicyInterface { public: static const size_t bitmap_width = 64; static const size_t bitmap_height = 64; DefaultPointerControllerPolicy() { bitmap.setConfig( SkBitmap::kARGB_8888_Config, bitmap_width, bitmap_height); bitmap.allocPixels(); // Icon for spot touches bitmap.eraseARGB(125, 0, 255, 0); spotTouchIcon = android::SpriteIcon( bitmap, bitmap_width/2, bitmap_height/2); // Icon for anchor touches bitmap.eraseARGB(125, 0, 0, 255); spotAnchorIcon = android::SpriteIcon( bitmap, bitmap_width/2, bitmap_height/2); // Icon for hovering touches bitmap.eraseARGB(125, 255, 0, 0); spotHoverIcon = android::SpriteIcon( bitmap, bitmap_width/2, bitmap_height/2); } void loadPointerResources(android::PointerResources* outResources) { outResources->spotHover = spotHoverIcon.copy(); outResources->spotTouch = spotTouchIcon.copy(); outResources->spotAnchor = spotAnchorIcon.copy(); } android::SpriteIcon spotHoverIcon; android::SpriteIcon spotTouchIcon; android::SpriteIcon spotAnchorIcon; SkBitmap bitmap; }; class DefaultInputReaderPolicyInterface : public android::InputReaderPolicyInterface { public: static const int32_t internal_display_id = android::ISurfaceComposer::eDisplayIdMain; static const int32_t external_display_id = android::ISurfaceComposer::eDisplayIdHdmi; DefaultInputReaderPolicyInterface(const android::sp& looper) : looper(looper), default_layer_for_touch_point_visualization(INT_MAX) { default_configuration.showTouches = false; auto display = android::SurfaceComposerClient::getBuiltInDisplay( android::ISurfaceComposer::eDisplayIdMain); android::DisplayInfo info; android::SurfaceComposerClient::getDisplayInfo( display, &info); android::DisplayViewport viewport; viewport.setNonDisplayViewport(info.w, info.h); viewport.displayId = android::ISurfaceComposer::eDisplayIdMain; default_configuration.setDisplayInfo( false, /* external */ viewport); } void getReaderConfiguration(android::InputReaderConfiguration* outConfig) { *outConfig = default_configuration; } android::sp obtainPointerController(int32_t deviceId) { (void) deviceId; android::sp sprite_controller( new android::SpriteController( looper, default_layer_for_touch_point_visualization)); android::sp pointer_controller( new android::PointerController( android::sp(new DefaultPointerControllerPolicy()), looper, sprite_controller)); pointer_controller->setPresentation( android::PointerControllerInterface::PRESENTATION_SPOT); int32_t w, h, o; auto display = android::SurfaceComposerClient::getBuiltInDisplay( android::ISurfaceComposer::eDisplayIdMain); android::DisplayInfo info; android::SurfaceComposerClient::getDisplayInfo( display, &info); pointer_controller->setDisplayViewport(info.w, info.h, info.orientation); return pointer_controller; } virtual void notifyInputDevicesChanged(const Vector& inputDevices) { mInputDevices = inputDevices; } virtual sp getKeyboardLayoutOverlay(const String8& inputDeviceDescriptor) { return NULL; } virtual String8 getDeviceAlias(const InputDeviceIdentifier& identifier) { return String8::empty(); } private: android::sp looper; int default_layer_for_touch_point_visualization; android::InputReaderConfiguration default_configuration; Vector mInputDevices; }; class InputFilter : public android::RefBase { public: virtual bool filter_event(const android::InputEvent* event) = 0; protected: InputFilter() {} virtual ~InputFilter() {} InputFilter(const InputFilter&) = delete; InputFilter& operator=(const InputFilter&) = delete; }; class DefaultInputDispatcherPolicy : public InputDispatcherPolicyInterface { public: DefaultInputDispatcherPolicy(const android::sp& input_filter) : input_filter(input_filter) { } ~DefaultInputDispatcherPolicy() { } void notifyConfigurationChanged(nsecs_t when) { REPORT_FUNCTION_CALL(); (void) when; } nsecs_t notifyANR(const sp& inputApplicationHandle, #if ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR<4 const sp& inputWindowHandle) #else const sp& inputWindowHandle, const android::String8& reason) #endif { REPORT_FUNCTION_CALL(); (void) inputApplicationHandle; (void) inputWindowHandle; #if ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR>=4 (void) reason; #endif return 0; } void notifyInputChannelBroken(const sp& inputWindowHandle) { REPORT_FUNCTION_CALL(); (void) inputWindowHandle; } void getDispatcherConfiguration(InputDispatcherConfiguration* outConfig) { REPORT_FUNCTION_CALL(); static InputDispatcherConfiguration config; //config.maxEventsPerSecond = INT_MAX; *outConfig = config; } bool isKeyRepeatEnabled() { REPORT_FUNCTION_CALL(); return true; } bool filterInputEvent(const InputEvent* event, uint32_t policyFlags) { REPORT_FUNCTION_CALL(); (void) event; (void) policyFlags; return input_filter->filter_event(event); } void interceptKeyBeforeQueueing(const KeyEvent* event, uint32_t& policyFlags) { REPORT_FUNCTION_CALL(); (void) event; policyFlags |= POLICY_FLAG_PASS_TO_USER; } void interceptMotionBeforeQueueing(nsecs_t when, uint32_t& policyFlags) { REPORT_FUNCTION_CALL(); (void) when; (void) policyFlags; policyFlags |= POLICY_FLAG_PASS_TO_USER; } nsecs_t interceptKeyBeforeDispatching( const sp& inputWindowHandle, const KeyEvent* keyEvent, uint32_t policyFlags) { REPORT_FUNCTION_CALL(); (void) inputWindowHandle; (void) keyEvent; (void) policyFlags; return 0; } bool dispatchUnhandledKey( const sp& inputWindowHandle, const KeyEvent* keyEvent, uint32_t policyFlags, KeyEvent* outFallbackKeyEvent) { REPORT_FUNCTION_CALL(); (void) inputWindowHandle; (void) keyEvent; (void) policyFlags; (void) outFallbackKeyEvent; return false; } virtual void notifySwitch( nsecs_t when, uint32_t switchCode, uint32_t switchValue, uint32_t policyFlags) { REPORT_FUNCTION_CALL(); (void) when; (void) switchCode; (void) switchValue; (void) policyFlags; } void pokeUserActivity(nsecs_t eventTime, int32_t eventType) { REPORT_FUNCTION_CALL(); (void) eventTime; (void) eventType; } bool checkInjectEventsPermissionNonReentrant( int32_t injectorPid, int32_t injectorUid) { REPORT_FUNCTION_CALL(); (void) injectorPid; (void) injectorUid; return true; } android::sp input_filter; }; class LooperThread : public android::Thread { public: static const int default_poll_timeout_ms = 500; LooperThread(const android::sp& looper) : looper(looper) { } private: bool threadLoop() { if (ALOOPER_POLL_ERROR == looper->pollAll(default_poll_timeout_ms)) return false; return true; } android::sp looper; }; struct InputSetup : public android::RefBase { struct DummyApplication : public android::InputApplicationHandle { bool updateInfo() { ALOGI("%s", __PRETTY_FUNCTION__); if (mInfo == NULL) { mInfo = new android::InputApplicationInfo(); mInfo->name = "Shell"; mInfo->dispatchingTimeout = INT_MAX; } return true; } }; struct DummyApplicationWindow : public android::InputWindowHandle { DummyApplicationWindow( const android::sp& app_handle, int x = 0, int y = 0, int w = 720, int h = 1280) : android::InputWindowHandle(app_handle), x(x), y(y), w(w), h(h) { } bool updateInfo() { ALOGI("%s", __PRETTY_FUNCTION__); if (mInfo == NULL) { mInfo = new android::InputWindowInfo(); SkRegion touchable_region; touchable_region.setRect(x, y, x+w, y+h); mInfo->name = "ShellInputWindow"; mInfo->layoutParamsFlags = android::InputWindowInfo::FLAG_NOT_TOUCH_MODAL | android::InputWindowInfo::FLAG_SPLIT_TOUCH; mInfo->layoutParamsType = android::InputWindowInfo::TYPE_APPLICATION; mInfo->touchableRegion = touchable_region; mInfo->frameLeft = x; mInfo->frameTop = y; mInfo->frameRight = x + w; mInfo->frameBottom = y + h; mInfo->scaleFactor = 1.f; mInfo->visible = true; mInfo->canReceiveKeys = true; mInfo->hasFocus = true; mInfo->hasWallpaper = false; mInfo->paused = false; mInfo->layer = 0; mInfo->dispatchingTimeout = INT_MAX; mInfo->ownerPid = 0; mInfo->ownerUid = 0; mInfo->inputFeatures = 0; mInfo->inputChannel = input_channel; } return true; } android::sp input_channel; int x; int y; int w; int h; }; InputSetup(const android::sp& input_filter) : looper(new android::Looper(false)), looper_thread(new LooperThread(looper)), event_hub(new android::EventHub()), input_reader_policy(new DefaultInputReaderPolicyInterface(looper)), input_dispatcher_policy(new DefaultInputDispatcherPolicy(input_filter)), input_manager(new InputManager(event_hub, input_reader_policy, input_dispatcher_policy)) { input_manager->getDispatcher()->setInputFilterEnabled(true); } void start() { input_manager->start(); looper_thread->run(__PRETTY_FUNCTION__, android::PRIORITY_URGENT_DISPLAY); } void stop() { input_manager->stop(); looper_thread->requestExitAndWait(); } ~InputSetup() { stop(); } android::sp looper; android::sp looper_thread; android::sp event_hub; android::sp input_reader_policy; android::sp input_dispatcher_policy; android::sp input_manager; android::Condition wait_condition; android::Mutex wait_guard; }; } #endif // DEFAULT_APPLICATION_MANAGER_INPUT_SETUP_H_ platform-api-0.20+14.04.20140411/android/hybris/application_manager.h0000644000015301777760000003204112322054725025510 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef HYBRIS_APPLICATION_MANAGER_H_ #define HYBRIS_APPLICATION_MANAGER_H_ #include #include namespace android { class IClipboardService : public IInterface { public: DECLARE_META_INTERFACE(ClipboardService); static const char* exported_service_name() { return "UbuntuClipboardService"; } struct Content { Content(); Content(const String8& mime_type, void* data, size_t data_size); ~Content(); Content(const Content& rhs); Content& operator=(const Content& rhs); String8 mime_type; void* data; size_t data_size; }; virtual void set_content(const Content& content) = 0; virtual void get_content(Content& content) = 0; protected: enum { SET_CLIPBOARD_CONTENT_COMMAND = IBinder::FIRST_CALL_TRANSACTION, GET_CLIPBOARD_CONTENT_COMMAND }; }; class BnClipboardService : public BnInterface { public: status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); }; class BpClipboardService : public BpInterface { public: BpClipboardService(const sp& impl); void set_content(const IClipboardService::Content& content); void get_content(IClipboardService::Content& content); }; class IApplicationManagerSession : public IInterface { public: DECLARE_META_INTERFACE(ApplicationManagerSession); struct SurfaceProperties { int32_t layer; int32_t left; int32_t top; int32_t right; int32_t bottom; }; virtual void raise_application_surfaces_to_layer(int layer) = 0; virtual void raise_surface_to_layer(int32_t token, int layer) = 0; virtual SurfaceProperties query_surface_properties_for_token(int32_t token) = 0; virtual void on_application_resumed() = 0; virtual void on_application_about_to_stop() = 0; protected: enum { RAISE_APPLICATION_SURFACES_TO_LAYER_COMMAND = IBinder::FIRST_CALL_TRANSACTION, RAISE_SURFACE_TO_LAYER_COMMAND, QUERY_SURFACE_PROPERTIES_FOR_TOKEN_COMMAND, ON_APPLICATION_STARTED_NOTIFICATION, ON_APPLICATION_ABOUT_TO_STOP_NOTIFICATION, }; }; class BnApplicationManagerSession : public BnInterface { public: BnApplicationManagerSession(); virtual ~BnApplicationManagerSession(); virtual status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); }; class BpApplicationManagerSession : public BpInterface { public: BpApplicationManagerSession(const sp& impl); ~BpApplicationManagerSession(); void raise_application_surfaces_to_layer(int layer); void raise_surface_to_layer(int32_t token, int layer); IApplicationManagerSession::SurfaceProperties query_surface_properties_for_token(int32_t token); void on_application_resumed(); void on_application_about_to_stop(); }; class IAMTaskController : public IInterface { public: DECLARE_META_INTERFACE(AMTaskController); virtual void continue_task(uint32_t pid) = 0; virtual void suspend_task(uint32_t pid) = 0; protected: enum { CONTINUE_TASK_COMMAND = IBinder::FIRST_CALL_TRANSACTION, SUSPEND_TASK_COMMAND }; IAMTaskController(const IAMTaskController&) = delete; IAMTaskController& operator=(const IAMTaskController&) = delete; }; class BnAMTaskController : public BnInterface { public: status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); }; class BpAMTaskController : public BpInterface { public: BpAMTaskController(const sp& impl); void continue_task(uint32_t pid); void suspend_task(uint32_t pid); }; class IApplicationManagerObserver : public IInterface { public: DECLARE_META_INTERFACE(ApplicationManagerObserver); virtual void on_session_requested(uint32_t app) = 0; virtual void on_session_born(int id, int stage_hint, const String8& desktop_file) = 0; virtual void on_session_unfocused(int id, int stage_hint, const String8& desktop_file) = 0; virtual void on_session_focused(int id, int stage_hint, const String8& desktop_file) = 0; virtual void on_session_requested_fullscreen(int id, int stage_hint, const String8& desktop_file) = 0; virtual void on_keyboard_geometry_changed(int x, int y, int width, int height) = 0; virtual void on_session_died(int id, int stage_hint, const String8& desktop_file) = 0; protected: enum { ON_SESSION_REQUESTED_NOTIFICATION = IBinder::FIRST_CALL_TRANSACTION, ON_SESSION_BORN_NOTIFICATION, ON_SESSION_UNFOCUSED_NOTIFICATION, ON_SESSION_FOCUSED_NOTIFICATION, ON_KEYBOARD_GEOMETRY_CHANGED_NOTIFICATION, ON_SESSION_REQUESTED_FULLSCREEN_NOTIFICATION, ON_SESSION_DIED_NOTIFICATION }; IApplicationManagerObserver(const IApplicationManagerObserver&) = delete; IApplicationManagerObserver& operator=(const IApplicationManagerObserver&) = delete; }; class BnApplicationManagerObserver : public BnInterface { public: status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); }; class BpApplicationManagerObserver : public BpInterface { public: BpApplicationManagerObserver(const sp& impl); void on_session_requested(uint32_t app); void on_session_born(int id, int stage_hint, const String8& desktop_file); void on_session_unfocused(int id, int stage_hint, const String8& desktop_file); void on_session_focused(int id, int stage_hint, const String8& desktop_file); void on_session_requested_fullscreen(int id, int stage_hint, const String8& desktop_file); void on_keyboard_geometry_changed(int x, int y, int width, int height); void on_session_died(int id, int stage_hint, const String8& desktop_file); }; class IApplicationManager : public IInterface { public: DECLARE_META_INTERFACE(ApplicationManager); static const char* exported_service_name() { return "UbuntuApplicationManager"; } virtual void start_a_new_session(int32_t session_type, int32_t stage_hint, const String8& app_name, const String8& desktop_file, const sp& session, int fd, uint32_t remote_pid) = 0; virtual void register_a_surface(const String8& title, const sp& session, int32_t surface_role, int32_t token, int fd) = 0; virtual int get_session_pid(const sp& session) = 0; virtual void request_fullscreen(const sp& session) = 0; virtual void request_update_for_session(const sp& session) = 0; virtual void register_an_observer(const sp& observer) = 0; virtual void register_task_controller(const sp& controller) = 0; virtual void unfocus_running_sessions() = 0; virtual void focus_running_session_with_id(int id) = 0; virtual int32_t query_snapshot_layer_for_session_with_id(int id) = 0; virtual IApplicationManagerSession::SurfaceProperties query_surface_properties_for_session_id(int id) = 0; virtual void switch_to_well_known_application(int32_t app) = 0; virtual int32_t set_surface_trap(int32_t x, int32_t y, int32_t width, int32_t height) = 0; virtual void unset_surface_trap(int32_t handle) = 0; virtual void report_osk_visible(int32_t x, int32_t y, int32_t width, int32_t height) = 0; virtual void report_osk_invisible() = 0; virtual void report_notification_visible() = 0; virtual void report_notification_invisible() = 0; protected: enum { START_A_NEW_SESSION_COMMAND = IBinder::FIRST_CALL_TRANSACTION, REGISTER_A_SURFACE_COMMAND, GET_SESSION_PID_COMMAND, REQUEST_FULLSCREEN_COMMAND, REGISTER_AN_OBSERVER_COMMAND, REGISTER_TASK_CONTROLLER_COMMAND, REQUEST_UPDATE_FOR_SESSION_COMMAND, UNFOCUS_RUNNING_SESSIONS_COMMAND, FOCUS_RUNNING_SESSION_WITH_ID_COMMAND, QUERY_SNAPSHOT_LAYER_FOR_SESSION_WITH_ID_COMMAND, QUERY_SURFACE_PROPERTIES_FOR_SESSION_ID_COMMAND, SWITCH_TO_WELL_KNOWN_APPLICATION_COMMAND, SET_SURFACE_TRAP_COMMAND, UNSET_SURFACE_TRAP_COMMAND, REPORT_OSK_VISIBLE_COMMAND, REPORT_OSK_INVISIBLE_COMMAND, REPORT_NOTIFICATION_VISIBLE_COMMAND, REPORT_NOTIFICATION_INVISIBLE_COMMAND }; }; class BnApplicationManager : public BnInterface { public: BnApplicationManager(); virtual ~BnApplicationManager(); virtual status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); }; class BpApplicationManager : public BpInterface { public: BpApplicationManager(const sp& impl); ~BpApplicationManager(); void start_a_new_session(int32_t session_type, int32_t stage_hint, const String8& app_name, const String8& desktop_file, const sp& session, int fd, uint32_t remote_pid); void register_a_surface(const String8& title, const android::sp& session, int32_t surface_role, int32_t token, int fd); int get_session_pid(const android::sp& session); void request_fullscreen(const android::sp& session); void request_update_for_session(const sp& session); void register_an_observer(const sp& observer); void register_task_controller(const sp& controller); void unfocus_running_sessions(); void focus_running_session_with_id(int id); int32_t query_snapshot_layer_for_session_with_id(int id); IApplicationManagerSession::SurfaceProperties query_surface_properties_for_session_id(int id); void switch_to_well_known_application(int32_t app); int32_t set_surface_trap(int32_t x, int32_t y, int32_t width, int32_t height); void unset_surface_trap(int handle); void report_osk_visible(int32_t x, int32_t y, int32_t width, int32_t height); void report_osk_invisible(); void report_notification_visible(); void report_notification_invisible(); }; } #endif // HYBRIS_APPLICATION_MANAGER_H_ platform-api-0.20+14.04.20140411/android/default/0000755000015301777760000000000012322055312021457 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/android/default/default_ubuntu_ui.cpp0000644000015301777760000001725712322054725025731 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #include #include #include #include #include namespace { struct TaskController : public ubuntu::ui::TaskController { TaskController(ubuntu_ui_task_controller* controller) : controller(controller) { } void continue_task(int pid) { if (!controller) return; if (!controller->continue_task) return; controller->continue_task(pid, controller->context); } void suspend_task(int pid) { if (!controller) return; if (!controller->suspend_task) return; controller->suspend_task(pid, controller->context); } ubuntu_ui_task_controller* controller; }; struct SessionLifeCycleObserver : public ubuntu::ui::SessionLifeCycleObserver { SessionLifeCycleObserver(ubuntu_ui_session_lifecycle_observer* observer) : observer(observer) { } void on_session_requested(ubuntu::ui::WellKnownApplication app) { if (!observer) return; if (!observer->on_session_requested) return; observer->on_session_requested(static_cast(app), observer->context); } void on_session_born(const ubuntu::ui::SessionProperties::Ptr& props) { if (!observer) return; if (!observer->on_session_born) return; observer->on_session_born(&props, observer->context); } void on_session_unfocused(const ubuntu::ui::SessionProperties::Ptr& props) { if (!observer) return; if (!observer->on_session_unfocused) return; observer->on_session_unfocused(&props, observer->context); } void on_session_focused(const ubuntu::ui::SessionProperties::Ptr& props) { if (!observer) return; if (!observer->on_session_focused) return; observer->on_session_focused(&props, observer->context); } void on_keyboard_geometry_changed(int x, int y, int width, int height) { if (!observer) return; if (!observer->on_keyboard_geometry_changed) return; observer->on_keyboard_geometry_changed(x, y, width, height, observer->context); } void on_session_requested_fullscreen(const ubuntu::ui::SessionProperties::Ptr& props) { if (!observer) return; if(!observer->on_session_requested_fullscreen) return; observer->on_session_requested_fullscreen(&props, observer->context); } void on_session_died(const ubuntu::ui::SessionProperties::Ptr& props) { if (!observer) return; if (!observer->on_session_died) return; observer->on_session_died(&props, observer->context); } ubuntu_ui_session_lifecycle_observer* observer; }; } const char* ubuntu_ui_session_properties_get_value_for_key(ubuntu_ui_session_properties props, const char* key) { if (!props) return NULL; if (!key) return NULL; const ubuntu::ui::SessionProperties::Ptr* p = static_cast(props); return (*p)->value_for_key(key); } int ubuntu_ui_session_properties_get_application_stage_hint(ubuntu_ui_session_properties props) { if (!props) return -1; const ubuntu::ui::SessionProperties::Ptr* p = static_cast(props); return (*p)->application_stage_hint(); } int ubuntu_ui_session_properties_get_application_instance_id(ubuntu_ui_session_properties props) { if (!props) return -1; const ubuntu::ui::SessionProperties::Ptr* p = static_cast(props); return (*p)->application_instance_id(); } const char* ubuntu_ui_session_properties_get_desktop_file_hint(ubuntu_ui_session_properties props) { if (!props) return NULL; const ubuntu::ui::SessionProperties::Ptr* p = static_cast(props); return (*p)->desktop_file_hint(); } bool ubuntu_ui_session_preview_provider_update_session_preview_texture(ubuntu_ui_session_preview_provider pp, int id, GLuint texture, unsigned int* width, unsigned int* height) { if (!pp) return false; const ubuntu::ui::SessionPreviewProvider::Ptr* spp = static_cast(pp); return (*spp)->get_or_update_session_preview(texture, *width, *height); } void ubuntu_ui_session_install_session_lifecycle_observer(ubuntu_ui_session_lifecycle_observer* observer) { ubuntu::ui::SessionLifeCycleObserver::Ptr p(new SessionLifeCycleObserver(observer)); ubuntu::ui::SessionService::instance()->install_session_lifecycle_observer(p); } void ubuntu_ui_session_unfocus_running_sessions() { ubuntu::ui::SessionService::instance()->unfocus_running_sessions(); } void ubuntu_ui_session_focus_running_session_with_id(int id) { ubuntu::ui::SessionService::instance()->focus_running_session_with_id(id); } void ubuntu_ui_session_snapshot_running_session_with_id(int id, ubuntu_ui_session_service_snapshot_cb cb, void* context) { ubuntu::ui::SessionSnapshot::Ptr ss = ubuntu::ui::SessionService::instance()->snapshot_running_session_with_id(id); if (cb) { ALOGI("screenshot buffer (%d, %d) geometry (%d, %d, %d, %d)\n", ss->width(), ss->height(), ss->x(), ss->y(), ss->source_width(), ss->source_height()); cb(ss->pixel_data(), ss->width(), ss->height(), ss->x(), ss->y(), ss->source_width(), ss->source_height(), ss->stride(), context); } } void ubuntu_ui_session_trigger_switch_to_well_known_application(ubuntu_ui_well_known_application app) { ubuntu::ui::SessionService::instance()->trigger_switch_to_well_known_application( static_cast(app)); } int32_t ubuntu_ui_set_surface_trap(int32_t x, int32_t y, int32_t width, int32_t height) { return ubuntu::ui::SessionService::instance()->set_surface_trap(x, y, width, height); } void ubuntu_ui_unset_surface_trap(int32_t handle) { ubuntu::ui::SessionService::instance()->unset_surface_trap(handle); } void ubuntu_ui_report_osk_visible(int x, int y, int width, int height) { ubuntu::ui::SessionService::instance()->report_osk_visible(x, y, width, height); } void ubuntu_ui_report_osk_invisible() { ubuntu::ui::SessionService::instance()->report_osk_invisible(); } void ubuntu_ui_report_notification_visible() { ubuntu::ui::SessionService::instance()->report_notification_visible(); } void ubuntu_ui_report_notification_invisible() { ubuntu::ui::SessionService::instance()->report_notification_invisible(); } void ubuntu_ui_install_task_controller(ubuntu_ui_task_controller *controller) { printf("installing task controller"); ubuntu::ui::TaskController::Ptr p(new TaskController(controller)); ubuntu::ui::SessionService::instance()->install_task_controller(p); } platform-api-0.20+14.04.20140411/android/default/default_ubuntu_application_ui.cpp0000644000015301777760000002667112322054725030314 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß * Ricardo Mendoza */ // Private #include #include #include #include #include #include #include // Public C apis #include #include #include #include #include #include #include #include // ver2.0 Private #include #include #include #include #include namespace { ubuntu::application::ui::Session::Ptr session; struct CallbackEventListener : public ubuntu::application::ui::input::Listener { CallbackEventListener(input_event_cb cb, void* context) : cb(cb), context(context) { } void on_new_event(const ::Event& e) { if (cb) cb(context, &e); } input_event_cb cb; void* context; }; template struct Holder { Holder(const T&value = T()) : value(value) { } T value; }; template Holder* make_holder(const T& value) { return new Holder(value); } } /* * Clipboard */ void ua_ui_set_clipboard_content(void* data, size_t size) { static const char mime_type[ubuntu::application::ui::Clipboard::Content::MAX_MIME_TYPE_SIZE] = "none/none"; ubuntu::application::ui::Clipboard::Content content(mime_type, data, size); ubuntu::application::ui::Session::clipboard()->set_content(content); } void ua_ui_get_clipboard_content(void** data, size_t* size) { ubuntu::application::ui::Clipboard::Content content(ubuntu::application::ui::Session::clipboard()->get_content()); *data = content.data; *size = content.data_size; } /* * Display */ UAUiDisplay* ua_ui_display_new_with_index( size_t index) { return make_holder( ubuntu::application::ui::Session::physical_display_info( static_cast(index))); } void ua_ui_display_destroy( UAUiDisplay* display) { auto s = static_cast*>(display); delete s; } uint32_t ua_ui_display_query_horizontal_res( UAUiDisplay* display) { auto s = static_cast*>(display); return s->value->horizontal_resolution(); } uint32_t ua_ui_display_query_vertical_res( UAUiDisplay* display) { auto s = static_cast*>(display); return s->value->vertical_resolution(); } EGLNativeDisplayType ua_ui_display_get_native_type( UAUiDisplay* display) { // Always EGL_DEFAULT_DISPLAY with android EGL. return EGL_DEFAULT_DISPLAY; } /* * Window Properties */ UAUiWindowProperties* ua_ui_window_properties_new_for_normal_window() { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); ubuntu::application::ui::WindowProperties::Ptr p( new ubuntu::application::ui::WindowProperties() ); return make_holder(p); } void ua_ui_window_properties_destroy( UAUiWindowProperties *properties) { auto p = static_cast*>(properties); if (p) delete p; } void ua_ui_window_properties_set_titlen( UAUiWindowProperties *properties, const char *title, size_t size) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto p = static_cast*>(properties); p->value->set_titlen(title, size); } const char* ua_ui_window_properties_get_title( UAUiWindowProperties *properties) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto p = static_cast*>(properties); return p->value->get_title(); } void ua_ui_window_properties_set_role( UAUiWindowProperties *properties, UAUiWindowRole role) { ALOGI("%s():%d %p %d", __PRETTY_FUNCTION__, __LINE__, properties, role); auto p = static_cast*>(properties); p->value->set_role(role); } UAUiWindowRole ua_ui_window_properties_get_role( UAUiWindowProperties *properties) { auto p = static_cast*>(properties); return p->value->get_role(); } void ua_ui_window_properties_set_input_cb_and_ctx( UAUiWindowProperties *properties, UAUiWindowInputEventCb cb, void *ctx) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto p = static_cast*>(properties); p->value->set_input_event_cb_and_ctx(cb, ctx); } void ua_ui_window_properties_set_dimensions( UAUiWindowProperties *properties, uint32_t width, uint32_t height) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); (void) width; (void) height; } /* * Session */ UAUiSessionProperties* ua_ui_session_properties_new() { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); ubuntu::application::ui::SessionProperties::Ptr props( new ubuntu::application::ui::SessionProperties() ); return make_holder(props); } void ua_ui_session_properties_set_type( UAUiSessionProperties* properties, UAUiSessionType type) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto p = static_cast*>(properties); if (p) p->value->set_type(static_cast(type)); } void ua_ui_session_properties_set_remote_pid( UAUiSessionProperties *properties, uint32_t pid) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto p = static_cast*>(properties); p->value->set_remote_pid(pid); } UAUiSession* ua_ui_session_new_with_properties( UAUiSessionProperties *properties) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); if (session != NULL) return session.get(); auto p = static_cast*>(properties); SessionCredentials creds = { static_cast(p->value->get_type()), APPLICATION_SUPPORTS_OVERLAYED_MENUBAR, "QtUbuntu", p->value->get_remote_pid(), NULL }; ubuntu::application::ui::SessionCredentials sc(&creds); session = ubuntu::ui::SessionService::instance()->start_a_new_session(sc); return session.get(); } /* * Window (Surface) */ UAUiWindow* ua_ui_window_new_for_application_with_properties( UApplicationInstance *instance, UAUiWindowProperties *properties) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); if (session == NULL) return NULL; auto p = static_cast*>(properties); ubuntu::application::ui::SurfaceProperties props = { "test", 0, 0, static_cast(p->value->get_role()), 0, //FIXME: Set flags true }; ubuntu::application::ui::Surface::Ptr surface = session->create_surface( props, ubuntu::application::ui::input::Listener::Ptr( new CallbackEventListener(p->value->get_input_cb(), p->value->get_ctx()))); auto inst = static_cast*>(instance); auto desc = static_cast*>(inst->value->get_description()); auto dele = static_cast*>(desc->value->get_lifecycle_delegate()); session->install_lifecycle_delegate(dele->value); return make_holder(surface); } void ua_ui_window_destroy( UAUiWindow *window) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); //auto p = static_cast*>(window); auto p = static_cast*>(window); if (p) delete p; } UAUiWindowId ua_ui_window_get_id( UAUiWindow *window) { //auto p = static_cast*>(window); auto p = static_cast*>(window); return p->value->get_id(); } UStatus ua_ui_window_move( UAUiWindow *window, uint32_t new_x, uint32_t new_y) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto p = static_cast*>(window); p->value->move_to(new_x, new_y); return U_STATUS_SUCCESS; } UStatus ua_ui_window_resize( UAUiWindow *window, uint32_t new_width, uint32_t new_height) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); //auto p = static_cast*>(window); auto p = static_cast*>(window); p->value->resize(new_width, new_height); return U_STATUS_SUCCESS; } UStatus ua_ui_window_hide( UAUiWindow *window) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); //auto p = static_cast*>(window); auto p = static_cast*>(window); p->value->set_visible(session->get_session_pid(), false); return U_STATUS_SUCCESS; } UStatus ua_ui_window_show( UAUiWindow *window) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto p = static_cast*>(window); p->value->set_visible(session->get_session_pid(), true); return U_STATUS_SUCCESS; } void ua_ui_window_request_fullscreen( UAUiWindow *window) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); if (session == NULL) return; auto p = static_cast*>(window); session->toggle_fullscreen_for_surface(p->value); } EGLNativeWindowType ua_ui_window_get_native_type( UAUiWindow *window) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto p = static_cast*>(window); return p->value->to_native_window_type(); } platform-api-0.20+14.04.20140411/android/default/default_ubuntu_application.cpp0000644000015301777760000002347212322054725027613 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß * Ricardo Mendoza */ // Private #include #include #include // Public C apis #include #include #include #include // ver2.0 Private #include #include #include // C APIs namespace { struct IUApplicationLifecycleDelegate : public ubuntu::application::LifecycleDelegate { IUApplicationLifecycleDelegate(void *context) : application_resumed_cb(NULL), application_about_to_stop_cb(NULL), context(context), refcount(1) { } void on_application_resumed() { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); if (!application_resumed_cb) return; application_resumed_cb(NULL, this->context); } void on_application_about_to_stop() { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); if (!application_about_to_stop_cb) return; application_about_to_stop_cb(NULL, this->context); } u_on_application_resumed application_resumed_cb; u_on_application_about_to_stop application_about_to_stop_cb; void *context; unsigned refcount; }; template struct Holder { Holder(const T&value = T()) : value(value) { } T value; }; template Holder* make_holder(const T& value) { return new Holder(value); } } /* * Application Lifecycle */ UApplicationLifecycleDelegate* u_application_lifecycle_delegate_new() { ALOGI("%s()", __PRETTY_FUNCTION__); ubuntu::application::LifecycleDelegate::Ptr p(new IUApplicationLifecycleDelegate(NULL)); return make_holder(p); } void u_application_lifecycle_delegate_destroy(UApplicationLifecycleDelegate *delegate) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast*>(delegate); if (s->value->refcount) return; delete s; } void u_application_lifecycle_delegate_ref(UApplicationLifecycleDelegate *delegate) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast*>(delegate); s->value->refcount++; } void u_application_lifecycle_delegate_unref(UApplicationLifecycleDelegate *delegate) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast*>(delegate); if (s->value->refcount) s->value->refcount--; } void u_application_lifecycle_delegate_set_application_resumed_cb( UApplicationLifecycleDelegate *delegate, u_on_application_resumed cb) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast*>(delegate); s->value->application_resumed_cb = cb; } u_on_application_resumed u_application_lifecycle_delegate_get_application_resumed_cb( UApplicationLifecycleDelegate *delegate) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast*>(delegate); return s->value->application_resumed_cb; } void u_application_lifecycle_delegate_set_application_about_to_stop_cb( UApplicationLifecycleDelegate *delegate, u_on_application_about_to_stop cb) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast*>(delegate); s->value->application_about_to_stop_cb = cb; } u_on_application_about_to_stop u_application_lifecycle_delegate_get_application_about_to_stop_cb( UApplicationLifecycleDelegate *delegate) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast*>(delegate); return s->value->application_about_to_stop_cb; } void u_application_lifecycle_delegate_set_context( UApplicationLifecycleDelegate *delegate, void *context) { ALOGI("%s():%d context=%p", __PRETTY_FUNCTION__, __LINE__, context); auto s = static_cast*>(delegate); if (s->value->context == NULL) s->value->context = context; } void* u_application_lifecycle_delegate_get_context( UApplicationLifecycleDelegate *delegate, void *context) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast*>(delegate); return s->value->context; } /* * Application Options */ UApplicationOptions* u_application_options_new_from_cmd_line( int argc, char** argv) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); ubuntu::application::ui::init(argc, argv); return ubuntu::application::ui::Setup::instance().get(); } UAUiFormFactor u_application_options_get_form_factor( UApplicationOptions *options) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto setup = static_cast(options); return static_cast(setup->form_factor_hint()); } UAUiStage u_application_options_get_stage( UApplicationOptions *options) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto setup = static_cast(options); return static_cast(setup->stage_hint()); } /* * Application Id */ UApplicationId* u_application_id_new_from_stringn( const char *string, size_t size) { ubuntu::application::Id::Ptr id( new ubuntu::application::Id(string, size) ); return make_holder(id); } void u_application_id_destroy(UApplicationId *id) { auto p = static_cast*>(id); if (p) delete p; } int u_application_id_compare( UApplicationId *lhs, UApplicationId *rhs) { auto ilhs = static_cast*>(lhs); auto irhs = static_cast*>(rhs); if (ilhs->value->size != irhs->value->size) return 1; for (size_t i = 0; i < ilhs->value->size; i++) { if ((char) ilhs->value->string[i] == (char) irhs->value->string[i]) continue; return 1; } return 0; } /* * Description */ UApplicationDescription* u_application_description_new() { ubuntu::application::Description::Ptr desc( new ubuntu::application::Description() ); return make_holder(desc); } void u_application_description_destroy( UApplicationDescription *desc) { auto p = static_cast*>(desc); if (p) delete p; } void u_application_description_set_application_id( UApplicationDescription *desc, UApplicationId *id) { if (id == NULL) return; auto p = static_cast*>(desc); p->value->set_application_id(id); } UApplicationId* u_application_description_get_application_id( UApplicationDescription *desc) { auto p = static_cast*>(desc); return p->value->get_application_id(); } void u_application_description_set_application_lifecycle_delegate( UApplicationDescription *desc, UApplicationLifecycleDelegate *delegate) { if (delegate == NULL) return; ALOGI("%s():%d -- delegate=%p", __PRETTY_FUNCTION__, __LINE__, delegate); auto p = static_cast*>(desc); p->value->set_lifecycle_delegate(delegate); } UApplicationLifecycleDelegate* u_application_description_get_application_lifecycle_delegate( UApplicationDescription *desc) { auto p = static_cast*>(desc); return p->value->get_lifecycle_delegate(); } /* * Instance */ UApplicationInstance* u_application_instance_new_from_description_with_options( UApplicationDescription *desc, UApplicationOptions *options) { if (desc == NULL || options == NULL) return NULL; ubuntu::application::Instance::Ptr instance( new ubuntu::application::Instance(desc, options) ); return make_holder(instance); } void u_application_instance_ref( UApplicationInstance *instance) { auto p = static_cast*>(instance); p->value->ref(); } void u_application_instance_unref( UApplicationInstance *instance) { auto p = static_cast*>(instance); p->value->unref(); } void u_application_instance_destroy( UApplicationInstance *instance) { auto p = static_cast*>(instance); if (p->value->get_refcount() == 0) delete p; } void u_application_instance_run( UApplicationInstance *instance) { auto p = static_cast*>(instance); if (p) p->value->run(); } platform-api-0.20+14.04.20140411/android/default/default_ubuntu_application_sensor.cpp0000644000015301777760000003345412322054725031205 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß * Ricardo Mendoza */ #include #include #include #include #include #include #include #include #include #include #include namespace { template struct Holder { Holder(const T&value = T()) : value(value) { } T value; }; template Holder* make_holder(const T& value) { return new Holder(value); } enum sensor_value_t { MIN_DELAY, MIN_VALUE, MAX_VALUE, RESOLUTION }; template struct SensorListener : public ubuntu::application::sensors::SensorListener { SensorListener() : on_accelerometer_event(NULL), on_proximity_event(NULL), on_light_event(NULL) { } void on_new_reading(const ubuntu::application::sensors::SensorReading::Ptr& reading) { switch(sensor_type) { case ubuntu::application::sensors::sensor_type_accelerometer: { if (!on_accelerometer_event) return; ubuntu::application::sensors::AccelerometerEvent::Ptr ev( new ubuntu::application::sensors::AccelerometerEvent( reading->timestamp, reading->acceleration[0], reading->acceleration[1], reading->acceleration[2]) ); on_accelerometer_event( make_holder(ev), this->context ); break; } case ubuntu::application::sensors::sensor_type_proximity: { if (!on_proximity_event) return; ubuntu::application::sensors::ProximityEvent::Ptr ev( new ubuntu::application::sensors::ProximityEvent( static_cast(reading->timestamp), reading->distance) ); on_proximity_event( make_holder(ev), this->context ); break; } case ubuntu::application::sensors::sensor_type_light: { if (!on_light_event) return; ubuntu::application::sensors::LightEvent::Ptr ev( new ubuntu::application::sensors::LightEvent( reading->timestamp, reading->light) ); on_light_event( make_holder(ev), this->context ); break; } } } on_accelerometer_event_cb on_accelerometer_event; on_proximity_event_cb on_proximity_event; on_light_event_cb on_light_event; void *context; }; ubuntu::application::sensors::Sensor::Ptr accelerometer; ubuntu::application::sensors::Sensor::Ptr proximity; ubuntu::application::sensors::Sensor::Ptr light; ubuntu::application::sensors::SensorListener::Ptr accelerometer_listener; ubuntu::application::sensors::SensorListener::Ptr proximity_listener; ubuntu::application::sensors::SensorListener::Ptr light_listener; } static int32_t toHz(int32_t microseconds) { return 1 / (microseconds / 1e6); } /* * Proximity Sensor */ UASensorsProximity* ua_sensors_proximity_new() { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); proximity = ubuntu::application::sensors::SensorService::sensor_for_type( ubuntu::application::sensors::sensor_type_proximity); return proximity.get(); } UStatus ua_sensors_proximity_enable( UASensorsProximity* sensor) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); if (sensor == NULL) return U_STATUS_ERROR; auto s = static_cast(sensor); int ret = s->enable(); if (ret < 0) return U_STATUS_ERROR; return U_STATUS_SUCCESS; } UStatus ua_sensors_proximity_disable( UASensorsProximity* sensor) { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); if (sensor == NULL) return U_STATUS_ERROR; auto s = static_cast(sensor); s->disable(); return U_STATUS_SUCCESS; } uint32_t ua_sensors_proximity_get_min_delay( UASensorsProximity* sensor) { if (sensor == NULL) return -1; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); return toHz(s->min_delay()); } float ua_sensors_proximity_get_min_value( UASensorsProximity* sensor) { if (sensor == NULL) return -1; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); return s->min_value(); } float ua_sensors_proximity_get_max_value( UASensorsProximity* sensor) { if (sensor == NULL) return -1; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); return s->max_value(); } float ua_sensors_proximity_get_resolution( UASensorsProximity* sensor) { if (sensor == NULL) return -1; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); return s->resolution(); } void ua_sensors_proximity_set_reading_cb( UASensorsProximity* sensor, on_proximity_event_cb cb, void *ctx) { if (sensor == NULL) return; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); SensorListener* sl = new SensorListener(); sl->on_proximity_event = cb; sl->context = ctx; proximity_listener = sl; s->register_listener(proximity_listener); } uint64_t uas_proximity_event_get_timestamp( UASProximityEvent* event) { auto ev = static_cast*>(event); return ev->value->get_timestamp(); } UASProximityDistance uas_proximity_event_get_distance( UASProximityEvent* event) { auto ev = static_cast*>(event); if (ev->value->get_distance() == proximity->max_value()) return U_PROXIMITY_FAR; return U_PROXIMITY_NEAR; } /* * Ambient Light Sensor */ UASensorsLight* ua_sensors_light_new() { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); light = ubuntu::application::sensors::SensorService::sensor_for_type( ubuntu::application::sensors::sensor_type_light); return light.get(); } UStatus ua_sensors_light_enable( UASensorsLight* sensor) { if (sensor == NULL) return U_STATUS_ERROR; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); s->enable(); return U_STATUS_SUCCESS; } UStatus ua_sensors_light_disable( UASensorsLight* sensor) { if (sensor == NULL) return U_STATUS_ERROR; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); s->disable(); return U_STATUS_SUCCESS; } uint32_t ua_sensors_light_get_min_delay( UASensorsLight* sensor) { if (sensor == NULL) return -1; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); return toHz(s->min_delay()); } float ua_sensors_light_get_min_value( UASensorsLight* sensor) { if (sensor == NULL) return -1; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); return s->min_value(); } float ua_sensors_light_get_max_value( UASensorsLight* sensor) { if (sensor == NULL) return -1; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); return s->max_value(); } float ua_sensors_light_get_resolution( UASensorsLight* sensor) { if (sensor == NULL) return -1; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); return s->resolution(); } void ua_sensors_light_set_reading_cb( UASensorsLight* sensor, on_light_event_cb cb, void *ctx) { if (sensor == NULL) return; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); SensorListener* sl = new SensorListener(); sl->on_light_event = cb; sl->context = ctx; light_listener = sl; s->register_listener(light_listener); } uint64_t uas_light_event_get_timestamp( UASLightEvent* event) { auto ev = static_cast*>(event); return ev->value->get_timestamp(); } float uas_light_event_get_light( UASLightEvent* event) { auto ev = static_cast*>(event); return ev->value->get_light(); } /* * Acceleration Sensor */ UASensorsAccelerometer* ua_sensors_accelerometer_new() { ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); accelerometer = ubuntu::application::sensors::SensorService::sensor_for_type( ubuntu::application::sensors::sensor_type_accelerometer); return accelerometer.get(); } UStatus ua_sensors_accelerometer_enable( UASensorsAccelerometer* sensor) { if (sensor == NULL) return U_STATUS_ERROR; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); s->enable(); return U_STATUS_SUCCESS; } UStatus ua_sensors_accelerometer_disable( UASensorsAccelerometer* sensor) { if (sensor == NULL) return U_STATUS_ERROR; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); s->disable(); return U_STATUS_SUCCESS; } uint32_t ua_sensors_accelerometer_get_min_delay( UASensorsAccelerometer* sensor) { if (sensor == NULL) return -1; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); return toHz(s->min_delay()); } float ua_sensors_accelerometer_get_min_value( UASensorsAccelerometer* sensor) { if (sensor == NULL) return -1; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); return s->min_value(); } float ua_sensors_accelerometer_get_max_value( UASensorsAccelerometer* sensor) { if (sensor == NULL) return -1; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); return s->max_value(); } float ua_sensors_accelerometer_get_resolution( UASensorsAccelerometer* sensor) { if (sensor == NULL) return -1; ALOGI("%s():%d", __PRETTY_FUNCTION__, __LINE__); auto s = static_cast(sensor); return s->resolution(); } void ua_sensors_accelerometer_set_reading_cb( UASensorsAccelerometer* sensor, on_accelerometer_event_cb cb, void *ctx) { if (sensor == NULL) return; auto s = static_cast(sensor); SensorListener* sl = new SensorListener(); sl->on_accelerometer_event = cb; sl->context = ctx; accelerometer_listener = sl; s->register_listener(accelerometer_listener); } uint64_t uas_accelerometer_event_get_timestamp( UASAccelerometerEvent* event) { auto ev = static_cast*>(event); return ev->value->get_timestamp(); } float uas_accelerometer_event_get_acceleration_x( UASAccelerometerEvent* event) { auto ev = static_cast*>(event); return ev->value->get_x(); } float uas_accelerometer_event_get_acceleration_y( UASAccelerometerEvent* event) { auto ev = static_cast*>(event); return ev->value->get_y(); } float uas_accelerometer_event_get_acceleration_z( UASAccelerometerEvent* event) { auto ev = static_cast*>(event); return ev->value->get_z(); } platform-api-0.20+14.04.20140411/android/include/0000755000015301777760000000000012322055312021456 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/android/include/private/0000755000015301777760000000000012322055312023130 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/android/include/private/application/0000755000015301777760000000000012322055312025433 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/android/include/private/application/application.h0000644000015301777760000000517712322054725030130 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza */ #ifndef UBUNTU_APPLICATION_APPLICATION_H_ #define UBUNTU_APPLICATION_APPLICATION_H_ #include namespace ubuntu { namespace application { class Instance : public ubuntu::platform::ReferenceCountedBase { public: Instance(UApplicationDescription *description, UApplicationOptions *options) : description(description), options(options) {} typedef ubuntu::platform::shared_ptr Ptr; void run() { return; } void ref() { refcount++; } void unref() { if (refcount) refcount--; } unsigned int get_refcount() { return this->refcount; } UApplicationDescription* get_description() { return this->description; } private: UApplicationDescription *description; UApplicationOptions *options; unsigned int refcount; protected: virtual ~Instance() {} Instance(const Instance&) = delete; Instance& operator=(const Instance&) = delete; }; class Description : public ubuntu::platform::ReferenceCountedBase { public: Description() : refcount(1) {} typedef ubuntu::platform::shared_ptr Ptr; void set_lifecycle_delegate(UApplicationLifecycleDelegate *delegate) { this->lifecycle_delegate = delegate; } void set_application_id(UApplicationId *id) { this->application_id = id; } UApplicationId* get_application_id() { return this->application_id; } UApplicationLifecycleDelegate* get_lifecycle_delegate() { return this->lifecycle_delegate; } unsigned int refcount; private: UApplicationId *application_id; UApplicationLifecycleDelegate *lifecycle_delegate; protected: virtual ~Description() {} Description(const Description&) = delete; Description& operator=(const Description&) = delete; }; } } #endif /* UBUNTU_APPLICATION_UI_WINDOW_INTERNAL_H_ */ platform-api-0.20+14.04.20140411/android/include/private/application/sensors/0000755000015301777760000000000012322055312027127 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/android/include/private/application/sensors/events.h0000644000015301777760000000563212322054725030621 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza */ #ifndef UBUNTU_APPLICATION_SENSORS_EVENTS_H_ #define UBUNTU_APPLICATION_SENSORS_EVENTS_H #include #include namespace ubuntu { namespace application { namespace sensors { class AccelerometerEvent : public platform::ReferenceCountedBase { public: AccelerometerEvent(uint64_t timestamp, float x, float y, float z) : timestamp(timestamp), x(x), y(y), z(z) {} typedef ubuntu::platform::shared_ptr Ptr; uint64_t get_timestamp() { return this->timestamp; } float get_x() { return this->x; } float get_y() { return this->y; } float get_z() { return this->z; } private: uint64_t timestamp; float x; float y; float z; protected: virtual ~AccelerometerEvent() {} AccelerometerEvent(const AccelerometerEvent&) = delete; AccelerometerEvent& operator=(const AccelerometerEvent&) = delete; }; class ProximityEvent : public platform::ReferenceCountedBase { public: ProximityEvent(uint64_t timestamp, float distance) : timestamp(timestamp), distance(distance) {} typedef ubuntu::platform::shared_ptr Ptr; uint64_t get_timestamp() { return this->timestamp; } float get_distance() { return this->distance; } private: uint64_t timestamp; float distance; protected: virtual ~ProximityEvent() {} ProximityEvent(const ProximityEvent&) = delete; ProximityEvent& operator=(const ProximityEvent&) = delete; }; class LightEvent : public platform::ReferenceCountedBase { public: LightEvent(uint64_t timestamp, float light) : timestamp(timestamp), light(light) {} typedef ubuntu::platform::shared_ptr Ptr; uint64_t get_timestamp() { return this->timestamp; } float get_light() { return this->light; } private: uint64_t timestamp; float light; protected: virtual ~LightEvent() {} LightEvent(const LightEvent&) = delete; LightEvent& operator=(const LightEvent&) = delete; }; } } } #endif /* UBUNTU_APPLICATION_SENSORS_EVENTS_H_ */ platform-api-0.20+14.04.20140411/android/include/private/application/sensors/sensor_type.h0000644000015301777760000000334712322054725031670 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_SENSORS_SENSOR_TYPE_H_ #define UBUNTU_APPLICATION_SENSORS_SENSOR_TYPE_H_ namespace ubuntu { namespace application { namespace sensors { /** Models a special type of a sensor */ enum SensorType { first_defined_sensor_type = 0, sensor_type_accelerometer = first_defined_sensor_type, ///< An accelerometer sensor_type_magnetic_field, ///< A magnetic field sensor, i.e., a compass sensor_type_gyroscope, ///< A gyroscope sensor_type_light, ///< An ambient light sensor sensor_type_proximity, ///< A proximity sensor, used to blank the screen when making a call sensor_type_orientation, ///< Virtual sensor, reports sensor fusion results regarding a device's orientation sensor_type_linear_acceleration, ///< Virtual sensor, reports sensor fusion results regarding a device's linear acceleration sensor_type_rotation_vector, ///< Virtual sensor, reports sensor fusion results regarding a device's rotation vector undefined_sensor_type }; } } } #endif // UBUNTU_APPLICATION_SENSORS_SENSOR_TYPE_H_ platform-api-0.20+14.04.20140411/android/include/private/application/sensors/sensor_listener.h0000644000015301777760000000313712322054725032531 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_SENSORS_SENSOR_LISTENER_H_ #define UBUNTU_APPLICATION_SENSORS_SENSOR_LISTENER_H_ #include "private/platform/shared_ptr.h" #include "private/application/sensors/sensor_reading.h" namespace ubuntu { namespace application { namespace sensors { /** Extension point to allow for observing a sensor's readings. */ class SensorListener : public ubuntu::platform::ReferenceCountedBase { public: typedef ubuntu::platform::shared_ptr Ptr; /** Invoked whenever a new reading is available from the sensor. * \param [in] reading The new reading. */ virtual void on_new_reading(const SensorReading::Ptr& reading) = 0; protected: SensorListener() {} virtual ~SensorListener() {} SensorListener(const SensorListener&) = delete; SensorListener& operator=(const SensorListener&) = delete; }; } } } #endif // UBUNTU_APPLICATION_SENSORS_SENSOR_LISTENER_H_ platform-api-0.20+14.04.20140411/android/include/private/application/sensors/sensor_reading.h0000644000015301777760000000452112322054725032313 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_SENSORS_SENSOR_READING_H_ #define UBUNTU_APPLICATION_SENSORS_SENSOR_READING_H_ #include #include #include namespace ubuntu { namespace application { namespace sensors { /** A vector of static size. */ template struct Vector { NumericType v[size]; /** Accesses the element at index index. */ NumericType& operator[](size_t index) { return v[index]; } /** Accesses the element at index index. */ const NumericType& operator[](size_t index) const { return v[index]; } }; /** A timestamped reading from a sensor. */ struct SensorReading : public ubuntu::platform::ReferenceCountedBase { typedef ubuntu::platform::shared_ptr Ptr; SensorReading() : timestamp(-1) { } int64_t timestamp; ///< The timestamp of the reading in [ns], CLOCK_MONOTONIC. /** A union of different possible sensor readings. */ union { Vector<3> vector; ///< Arbitrary vector, orientation and linear acceleration readings are reported here. Vector<3> acceleration; ///< Acceleration vector containing acceleration readings for the three axis. Vector<3> magnetic; ///< Readings from magnetometer, in three dimensions. float temperature; ///< Ambient temperature. float distance; ///< Discrete distance, everything > 5 is considered far, everything < 5 is considered near. float light; ///< Ambient light conditions. float pressure; ///< Ambient pressure. }; }; } } } #endif // UBUNTU_APPLICATION_SENSORS_SENSOR_READING_H_ platform-api-0.20+14.04.20140411/android/include/private/application/sensors/sensor_service.h0000644000015301777760000000272512322054725032346 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_SENSORS_SENSOR_SERVICE_H_ #define UBUNTU_APPLICATION_SENSORS_SENSOR_SERVICE_H_ #include "private/platform/shared_ptr.h" #include "private/application/sensors/sensor.h" namespace ubuntu { namespace application { namespace sensors { /** Local stub that allows for instantiating sensor instances given a type. */ class SensorService : public ubuntu::platform::ReferenceCountedBase { public: /** Returns a sensor instance for the provided type or NULL. */ static Sensor::Ptr sensor_for_type(SensorType type); protected: SensorService() {} virtual ~SensorService() {} SensorService(const SensorService&) = delete; SensorService& operator=(const SensorService&) = delete; }; } } } #endif // UBUNTU_APPLICATION_SENSORS_SENSOR_SERVICE_H_ platform-api-0.20+14.04.20140411/android/include/private/application/sensors/sensor.h0000644000015301777760000000532212322054725030622 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_SENSORS_SENSOR_H_ #define UBUNTU_APPLICATION_SENSORS_SENSOR_H_ #include "private/platform/shared_ptr.h" #include "private/application/sensors/sensor_listener.h" #include "private/application/sensors/sensor_type.h" #include namespace ubuntu { namespace application { namespace sensors { /** A data acquisition device that samples a device's environment. */ class Sensor : public ubuntu::platform::ReferenceCountedBase { public: typedef ubuntu::platform::shared_ptr Ptr; /** Accesses the name of the sensor. Returned pointer is owned by the implementation. */ virtual const char* name() = 0; /** Accesses the vendor of the sensor. Returned pointer is owned by the implementation. */ virtual const char* vendor() = 0; /** Accesses the numeric id of the sensor. Should be as stable as possible. */ virtual int32_t id() = 0; /** Registers the provided listener with the sensor and integrates it with the reporting of sensor readings. */ virtual void register_listener(const SensorListener::Ptr& listener) = 0; /** Enables the sensor and starts the data acquisition. */ virtual int enable() = 0; /** Disables the sensor and stops the data acquisition. */ virtual int disable() = 0; virtual SensorType type() = 0; /** Returns the minimum numeric value of a sensor reading. */ virtual float min_value() = 0; /** Returns the maximum numeric value of a sensor reading. */ virtual float max_value() = 0; /** Returns the numerical resolution of a sensor reading. */ virtual float resolution() = 0; /** Returns an estimate of the sensor's power consumption, normalized to [0,1]. */ virtual float power_consumption() = 0; /** Returns the minimum delay between two consecutive sensor readings. */ virtual int32_t min_delay() = 0; protected: Sensor() {} virtual ~Sensor() {} Sensor(const Sensor&) = delete; Sensor& operator=(const Sensor&) = delete; }; } } } #endif // UBUNTU_APPLICATION_SENSORS_SENSOR_H_ platform-api-0.20+14.04.20140411/android/include/private/application/session.h0000644000015301777760000000440712322054725027303 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_SESSION_H_ #define UBUNTU_APPLICATION_SESSION_H_ #include #include namespace ubuntu { namespace application { /** * Represents a session with the service providers abstracted by Ubuntu platform API. */ class Session : public ubuntu::platform::ReferenceCountedBase { public: typedef ubuntu::platform::shared_ptr Ptr; protected: Session() {} virtual ~Session() {} Session(const Session&) = delete; Session& operator=(const Session&) = delete; }; /** * Represents a session lifecycle delegate. */ class LifecycleDelegate : public ubuntu::platform::ReferenceCountedBase { public: typedef ubuntu::platform::shared_ptr Ptr; virtual void on_application_resumed() = 0; virtual void on_application_about_to_stop() = 0; protected: LifecycleDelegate() {} virtual ~LifecycleDelegate() {} LifecycleDelegate(const LifecycleDelegate&) = delete; LifecycleDelegate& operator=(const LifecycleDelegate&) = delete; }; class Id : public ubuntu::platform::ReferenceCountedBase { public: typedef ubuntu::platform::shared_ptr Ptr; Id(const char *string, size_t size) { this->size = size; this->string = (char*) malloc(sizeof (char) * (size+1)); memcpy(this->string, string, (size+1)); } ~Id() { free(this->string); } char *string; size_t size; protected: Id() {} Id(const Id&) = delete; Id& operator=(const Id&) = delete; }; } } #endif // UBUNTU_APPLICATION_SESSION_H_ platform-api-0.20+14.04.20140411/android/include/private/application/ui/0000755000015301777760000000000012322055312026050 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/android/include/private/application/ui/surface_role.h0000644000015301777760000000340112322054725030677 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_UI_SURFACE_ROLE_H_ #define UBUNTU_APPLICATION_UI_SURFACE_ROLE_H_ #include "private/application/ui/ubuntu_application_ui.h" namespace ubuntu { namespace application { namespace ui { /** * Describes the role of a surface. * \attention Reserved roles require special privileges. */ enum SurfaceRole { main_actor_role = MAIN_ACTOR_ROLE, ///< An application's main surface dash_actor_role = DASH_ACTOR_ROLE, ///< Reserved for the shell's dash indicator_actor_role = INDICATOR_ACTOR_ROLE, ///< Reserved for the shell's indicators notifications_actor_role = NOTIFICATIONS_ACTOR_ROLE, ///< Reserved for the shell's notifications greeter_actor_role = GREETER_ACTOR_ROLE, ///< Reserved for the greeter launcher_actor_role = LAUNCHER_ACTOR_ROLE, ///< Reserved for the launcher on_screen_keyboard_actor_role = ON_SCREEN_KEYBOARD_ACTOR_ROLE, ///< Reserved for the onscreen-keyboard shutdown_dialog_actor_role = SHUTDOWN_DIALOG_ACTOR_ROLE ///< Reserved for the shutdown dialog }; } } } #endif // UBUNTU_APPLICATION_UI_SURFACE_ROLE_H_ platform-api-0.20+14.04.20140411/android/include/private/application/ui/surface.h0000644000015301777760000000432012322054725027657 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_UI_SURFACE_H_ #define UBUNTU_APPLICATION_UI_SURFACE_H_ #include "private/platform/shared_ptr.h" #include "private/application/ui/session.h" #include "private/application/ui/input/listener.h" #include namespace ubuntu { namespace application { namespace ui { /** * A surface is a rectangular region on screen. */ class Surface : public ubuntu::platform::ReferenceCountedBase { public: typedef ubuntu::platform::shared_ptr Ptr; // Default surface API /** Toggles the visibility of the surface. */ virtual void set_visible(int id, bool visible) = 0; /** Adjusts the alpha channel of a surface. */ virtual void set_alpha(float alpha) = 0; /** Moves the surface to the specified coordinates. */ virtual void move_to(int x, int y) = 0; /** Resizes the surface to the specified width and height. */ virtual void resize(int w, int h) = 0; /** Returns the ID of the associated surface. */ virtual int32_t get_id() = 0; /** Binds to EGL/GL rendering API. */ virtual EGLNativeWindowType to_native_window_type() = 0; protected: Surface(const input::Listener::Ptr& input_listener) : input_listener(input_listener) {} virtual ~Surface() {} Surface(const Surface&) = delete; Surface& operator=(const Surface&) = delete; const input::Listener::Ptr& registered_input_listener() const { return input_listener; } private: input::Listener::Ptr input_listener; }; } } } #endif // UBUNTU_APPLICATION_UI_SURFACE_H_ platform-api-0.20+14.04.20140411/android/include/private/application/ui/surface_properties.h0000644000015301777760000000355412322054725032143 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_UI_SURFACE_PROPERTIES_H_ #define UBUNTU_APPLICATION_UI_SURFACE_PROPERTIES_H_ #include "private/application/ui/surface_role.h" #include "private/application/ui/ubuntu_application_ui.h" namespace ubuntu { namespace application { namespace ui { /** * \enum SurfaceFlags * Flags that can be specified for a surface * \attention Requires privileged access to the ui service provider */ enum SurfaceFlags { is_opaque_flag = IS_OPAQUE_FLAG ///< Specifies that a surface is opaque }; /** * \struct SurfaceProperties surface_properties.h * Bundles the properties for surface creation. */ struct SurfaceProperties { enum { max_surface_title_length = 512 ///< Maximum length of the surface title }; const char title[max_surface_title_length]; ///< Surface title int width; ///< Requested width int height; ///< Requested height SurfaceRole role; ///< Requested role \sa ubuntu::application::ui::SurfaceRole uint32_t flags; ///< Requested flags \sa ubuntu::application::ui::SurfaceFlags bool is_opaque; ///< Signals that the surface should be opaque }; } } } #endif // UBUNTU_APPLICATION_UI_SURFACE_PROPERTIES_H_ platform-api-0.20+14.04.20140411/android/include/private/application/ui/physical_display_info.h0000644000015301777760000000442012322054725032604 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_UI_PHYSICAL_DISPLAY_INFO_H_ #define UBUNTU_APPLICATION_UI_PHYSICAL_DISPLAY_INFO_H_ #include "private/platform/shared_ptr.h" namespace ubuntu { namespace application { namespace ui { /** * Marks physical displays connected to the system */ enum PhysicalDisplayIdentifier { first_physical_display = 0, second_physical_display = 1, third_physical_display = 2, fourth_physical_display = 3, fifth_physical_display = 4, sixth_physical_display = 5, seventh_physical_display = 6, eigth_physical_display = 7, ninth_physical_display = 8, tenth_physical_display = 9, primary_physical_display = first_physical_display }; /** * Models information about a physical display. */ class PhysicalDisplayInfo : public ubuntu::platform::ReferenceCountedBase { public: typedef ubuntu::platform::shared_ptr Ptr; /** Access to the horizontal dpi of the physical display. */ virtual float horizontal_dpi() = 0; /** Access to the vertical dpi of the physical display. */ virtual float vertical_dpi() = 0; /** Access to the horizontal resolution of the physical display. */ virtual int horizontal_resolution() = 0; /** Access to the vertical resolution of the physical display. */ virtual int vertical_resolution() = 0; protected: PhysicalDisplayInfo() {} virtual ~PhysicalDisplayInfo() {} PhysicalDisplayInfo(const PhysicalDisplayInfo&) = delete; PhysicalDisplayInfo& operator=(const PhysicalDisplayInfo&) = delete; }; } } } #endif // UBUNTU_APPLICATION_UI_PHYSICAL_DISPLAY_INFO_H_ platform-api-0.20+14.04.20140411/android/include/private/application/ui/stage_hint.h0000644000015301777760000000233512322054725030360 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_UI_STAGE_HINT_H_ #define UBUNTU_APPLICATION_UI_STAGE_HINT_H_ #include "private/application/ui/ubuntu_application_ui.h" namespace ubuntu { namespace application { namespace ui { enum StageHint { main_stage = MAIN_STAGE_HINT, integration_stage = INTEGRATION_STAGE_HINT, share_stage = SHARE_STAGE_HINT, content_picking_stage = CONTENT_PICKING_STAGE_HINT, side_stage = SIDE_STAGE_HINT, configuration_stage = CONFIGURATION_STAGE_HINT }; } } } #endif // UBUNTU_APPLICATION_UI_STAGE_HINT_H_ platform-api-0.20+14.04.20140411/android/include/private/application/ui/session.h0000644000015301777760000000564012322054725027720 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_UI_SESSION_INTERNAL_H_ #define UBUNTU_APPLICATION_UI_SESSION_INTERNAL_H_ #include #include #include #include #include #include #include #include namespace ubuntu { namespace application { namespace ui { /** * Represents a session with the service providers abstracted by * Ubuntu platform API and allows for accessing ui-specific * functionality. */ class Session : public ubuntu::application::Session { public: typedef ubuntu::platform::shared_ptr Ptr; /** Provides access to the system-wide clipboard. */ static Clipboard::Ptr clipboard(); /** Provides system-wide access to the physical displays known to the system. * \sa PhysicalDisplayIdentifier * \sa PhysicalDisplayInfo */ static PhysicalDisplayInfo::Ptr physical_display_info(PhysicalDisplayIdentifier id); virtual void install_lifecycle_delegate(const ubuntu::application::LifecycleDelegate::Ptr& delegate) = 0; /** Requests a surface from the system. * \param [in] props Requested properties for the surface * \param [in] listener Event receiver for input events * \return Pointer to the surface instance or NULL. */ virtual Surface::Ptr create_surface( const SurfaceProperties& props, const ubuntu::application::ui::input::Listener::Ptr& listener) = 0; /** Requests the PID for the running session. */ virtual int get_session_pid() = 0; /** Destroys the surface and renders it unusable. */ virtual void destroy_surface(const Surface::Ptr& surface) = 0; /** Requests the surface to be shown in fullscreen. * \param [in] surface The surface to transition to fullscreen. */ virtual void toggle_fullscreen_for_surface(const Surface::Ptr& surface) = 0; protected: Session() {} virtual ~Session() {} Session(const Session&) = delete; Session& operator=(const Session&) = delete; }; } } } #endif // UBUNTU_APPLICATION_UI_SESSION_INTERNAL_H_ platform-api-0.20+14.04.20140411/android/include/private/application/ui/surface_factory.h0000644000015301777760000000300112322054725031401 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_UI_SURFACE_FACTORY_H_ #define UBUNTU_APPLICATION_UI_SURFACE_FACTORY_H_ #include "private/platform/shared_ptr.h" namespace ubuntu { namespace application { namespace ui { class SurfaceProperties; class SurfaceFactory : public ubuntu::platform::ReferenceCountedBase { public: typedef ubuntu::platform::shared_ptr Ptr; static const Ptr& instance(); virtual Surface::Ptr create_surface( const ubuntu::application::ui::SurfaceProperties& props, const ubuntu::application::ui::input::Listener::Ptr& listener) = 0; protected: SurfaceFactory() {} virtual ~SurfaceFactory() {} SurfaceFactory(const SurfaceFactory&) = delete; SurfaceFactory& operator=(const SurfaceFactory&) = delete; }; } } } #endif // UBUNTU_APPLICATION_UI_SURFACE_FACTORY_H_ platform-api-0.20+14.04.20140411/android/include/private/application/ui/form_factor_hint.h0000644000015301777760000000267612322054725031566 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_UI_FORM_FACTOR_HINT_H_ #define UBUNTU_APPLICATION_UI_FORM_FACTOR_HINT_H_ #include "private/application/ui/ubuntu_application_ui.h" namespace ubuntu { namespace application { namespace ui { /** Provides applications with a hint about the form factor it is running on. */ enum FormFactorHint { desktop_form_factor = DESKTOP_FORM_FACTOR_HINT, ///< An ordinary desktop or laptop form factor. phone_form_factor = PHONE_FORM_FACTOR_HINT, ///< A phone form factor. tablet_form_factor = TABLET_FORM_FACTOR_HINT ///< A tablet form factor. }; /** Bitfield as multiple form factor hints can be applied in a converged scenario. */ typedef unsigned int FormFactorHintFlags; } } } #endif // UBUNTU_APPLICATION_UI_FORM_FACTOR_HINT_H_ platform-api-0.20+14.04.20140411/android/include/private/application/ui/clipboard.h0000644000015301777760000000506612322054725030176 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef PRIVATE_APPLICATION_UI_CLIPBOARD_H_ #define PRIVATE_APPLICATION_UI_CLIPBOARD_H_ #include "private/platform/shared_ptr.h" namespace ubuntu { namespace application { namespace ui { /** Models a system-wide clipboard. * \deprecated This is a temporary solution and is likely to be removed or subject to significant changes in upcoming revisions. */ class Clipboard : public ubuntu::platform::ReferenceCountedBase { public: typedef ubuntu::platform::shared_ptr Ptr; struct Content { static const int MAX_MIME_TYPE_SIZE=32; Content() : data(NULL), data_size(0) { } Content(const char* mime, void* _data, size_t size) : data(malloc(size)), data_size(size) { memcpy(mime_type, mime, MAX_MIME_TYPE_SIZE); memcpy(data, _data, size); } Content(const Content& rhs) : data(malloc(rhs.data_size)), data_size(rhs.data_size) { memcpy(mime_type, rhs.mime_type, MAX_MIME_TYPE_SIZE); memcpy(data, rhs.data, data_size); } Content& operator=(const Content& rhs) { memcpy(mime_type, rhs.mime_type, MAX_MIME_TYPE_SIZE); data = realloc(data, rhs.data_size); memcpy(data, rhs.data, data_size); data_size = rhs.data_size; return *this; } char mime_type[MAX_MIME_TYPE_SIZE]; void* data; size_t data_size; }; virtual void set_content(const Content& content) = 0; virtual Content get_content() = 0; protected: Clipboard() {} virtual ~Clipboard() {} Clipboard(const Clipboard&) = delete; Clipboard& operator=(const Clipboard&) = delete; }; } } } #endif // PRIVATE_APPLICATION_UI_CLIPBOARD_H_ platform-api-0.20+14.04.20140411/android/include/private/application/ui/session_credentials.h0000644000015301777760000000431212322054725032270 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_UI_SESSION_CREDENTIALS_H_ #define UBUNTU_APPLICATION_UI_SESSION_CREDENTIALS_H_ #include "ubuntu_application_ui.h" #include namespace ubuntu { namespace application { namespace ui { /** * Specifies the session type. * \attention System sessions require special privileged to be registered with the service providers. */ enum SessionType { user_session_type = USER_SESSION_TYPE, system_session_type = SYSTEM_SESSION_TYPE }; enum RunningState { process_stopped = PROCESS_STOPPED, process_running = PROCESS_RUNNING, process_suspended = PROCESS_SUSPENDED, process_destroyed = PROCESS_DESTROYED }; /** * Specifies whether the application tolerates a menubar when in fullscreen mode. */ enum MenuBarSupport { application_supports_overlayed_menubar = APPLICATION_SUPPORTS_OVERLAYED_MENUBAR, application_does_not_support_overlayed_menubar = APPLICATION_DOES_NOT_SUPPORT_OVERLAYED_MENUBAR }; /** * Bundles information about an application instance. */ class SessionCredentials { public: SessionCredentials(::SessionCredentials* parent) : parent(parent) { } SessionType session_type() const { return static_cast(parent->session_type); } const char* application_name() const { return parent->application_name; } uint32_t remote_pid() const { return parent->remote_pid; } private: ::SessionCredentials* parent; }; } } } #endif // UBUNTU_APPLICATION_UI_SESSION_CREDENTIALS_H_ platform-api-0.20+14.04.20140411/android/include/private/application/ui/setup.h0000644000015301777760000000350712322054725027375 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_UI_SETUP_H_ #define UBUNTU_APPLICATION_UI_SETUP_H_ #include "private/application/ui/stage_hint.h" #include "private/application/ui/form_factor_hint.h" #include "private/platform/shared_ptr.h" namespace ubuntu { namespace application { namespace ui { /** Provides access to the setup of the application instance as specified by command line/desktop file. */ class Setup : public ubuntu::platform::ReferenceCountedBase { public: typedef ubuntu::platform::shared_ptr Ptr; static const Ptr& instance(); /** Provides access the stage the stage hint that the application should live in. */ virtual StageHint stage_hint() = 0; /** Provides access to the form factors that the application instance is currently running on. */ virtual FormFactorHint form_factor_hint() = 0; /** Provides access to the desktop file that describes the current application instance. */ virtual const char* desktop_file_hint() = 0; protected: Setup() {} virtual ~Setup() {} Setup(const Setup&) = delete; Setup& operator=(const Setup&) = delete; }; } } } #endif // UBUNTU_APPLICATION_UI_SETUP_H_ platform-api-0.20+14.04.20140411/android/include/private/application/ui/window_internal.h0000644000015301777760000000542212322054725031436 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza */ #ifndef UBUNTU_APPLICATION_UI_WINDOW_INTERNAL_H_ #define UBUNTU_APPLICATION_UI_WINDOW_INTERNAL_H_ #include namespace ubuntu { namespace application { namespace ui { class WindowProperties : public ubuntu::platform::ReferenceCountedBase { public: WindowProperties() {} ~WindowProperties() { free(this->title); } typedef ubuntu::platform::shared_ptr Ptr; void set_titlen(const char* title, size_t size) { this->title = (char *) malloc(sizeof (char) * (size+1)); memcpy(this->title, title, size+1); } char *get_title() { return this->title; } void set_role(UAUiWindowRole role) { this->role = role; } UAUiWindowRole get_role() { return this->role; } void set_input_event_cb_and_ctx(UAUiWindowInputEventCb cb, void* ctx) { this->cb = cb; this->ctx = ctx; } UAUiWindowInputEventCb get_input_cb() { return this->cb; } void* get_ctx() { return this->ctx; } private: char *title; UAUiWindowRole role; UAUiWindowInputEventCb cb; void* ctx; protected: WindowProperties(const WindowProperties&) = delete; WindowProperties& operator=(const WindowProperties&) = delete; }; class SessionProperties : public ubuntu::platform::ReferenceCountedBase { public: SessionProperties() : pid(0) {} typedef ubuntu::platform::shared_ptr Ptr; void set_type(SessionType type) { this->type = type; } SessionType get_type() { return this->type; } void set_remote_pid(uint32_t pid) { this->pid = pid; } uint32_t get_remote_pid() { return this->pid; } private: SessionType type; uint32_t pid; protected: virtual ~SessionProperties() {} SessionProperties(const SessionProperties&) = delete; SessionProperties& operator=(const SessionProperties&) = delete; }; } } } #endif /* UBUNTU_APPLICATION_UI_WINDOW_INTERNAL_H_ */ platform-api-0.20+14.04.20140411/android/include/private/application/ui/ubuntu_application_ui.h0000644000015301777760000002752012322054725032640 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_UI_H_ #define UBUNTU_APPLICATION_UI_H_ #include "ubuntu/application/ui/input/event.h" #include #ifdef __cplusplus extern "C" { #endif /** \defgroup require_session_functions Functions that require an active session registered with the application manager/service providers. * \defgroup ui_access Functions that provide access to UI-specific functionality. */ /** * Specifies the session type. * \ingroup ui_access * \attention System sessions require special privileges to be registered with the service providers. */ typedef enum { USER_SESSION_TYPE = 0, /**< An ordinary app. */ SYSTEM_SESSION_TYPE = 1 /**< A system session that requires elevated privileges.*/ } SessionType; /** Models the running state of a process. */ typedef enum { PROCESS_STOPPED = 0, /**< Process is Stopped (Not in memory, valid-state stored). */ PROCESS_RUNNING = 1, /**< Process is running normally. */ PROCESS_SUSPENDED = 2, /**< Process is Suspended (SIGSTOP). */ PROCESS_DESTROYED = 3, /**< Process is Destroyed or Stateless (Not in memory, invalid state). */ } RunningState; /** * Specifies whether the application tolerates a menubar when in fullscreen mode. * \ingroup ui_access */ typedef enum { APPLICATION_SUPPORTS_OVERLAYED_MENUBAR = 0, /**< App allows for an overlayed menubar in fullscreen mode. */ APPLICATION_DOES_NOT_SUPPORT_OVERLAYED_MENUBAR = 1 /**< App does not allow an overlayer menubar in fullscreen mode, i.e., a user pinning the menubar results in the app being maximized. */ } MenuBarSupport; /** * Describes the different stages an application can run in. * \ingroup ui_access */ typedef enum { MAIN_STAGE_HINT = 0, /**< Default stage, normal operation mode. */ INTEGRATION_STAGE_HINT = 1, /**< Integration stage for reusing parts of an app's views. */ SHARE_STAGE_HINT = 2, /**< Share stage for sharing data between apps. */ CONTENT_PICKING_STAGE_HINT = 3, /**< Placeholder, not used yet. */ SIDE_STAGE_HINT = 4, /**< Side stage for displaying apps alongside other apps running in the main stage. */ CONFIGURATION_STAGE_HINT = 5 /**< Placeholder, not used yet. */ } StageHint; /** * Provides applications with a hint about the form factor it is running on. * \ingroup ui_access */ typedef enum { DESKTOP_FORM_FACTOR_HINT = 0, /**< An ordinary desktop or laptop form factor. */ PHONE_FORM_FACTOR_HINT = 1, /**< A phone form factor. */ TABLET_FORM_FACTOR_HINT = 2 /**< A tablet form factor. */ } FormFactorHint; /** * Describes the role of a surface. * \ingroup ui_access * \attention Reserved roles require special privileges. */ typedef enum { MAIN_ACTOR_ROLE = 1, /**< An application's main surface */ DASH_ACTOR_ROLE = 0, /**< Reserved for the shell's dash */ INDICATOR_ACTOR_ROLE = 2, /**< Reserved for the shell's indicators */ NOTIFICATIONS_ACTOR_ROLE = 3, /**< Reserved for the shell's notifications */ GREETER_ACTOR_ROLE = 4, /**< Reserved for the greeter */ LAUNCHER_ACTOR_ROLE = 5, /**< Reserved for the launcher */ ON_SCREEN_KEYBOARD_ACTOR_ROLE = 6, /**< Reserved for the onscreen-keyboard */ SHUTDOWN_DIALOG_ACTOR_ROLE = 7 /**< Reserved for the shutdown dialog */ } SurfaceRole; /** * Flags that can be specified for a surface * \ingroup ui_access * \attention Requires privileged access to the ui service provider */ typedef enum { IS_OPAQUE_FLAG = 1 } SurfaceFlags; enum { MAX_APPLICATION_NAME_LENGTH = 512 }; typedef void (*on_application_resumed)(void* ctx); typedef void (*on_application_suspended)(void* ctx); typedef void (*on_application_focused)(void* ctx); typedef void (*on_application_unfocused)(void* ctx); /** * Bundles information about an application instance. * \ingroup ui_access */ typedef struct { /** Specifies the session type */ SessionType session_type; /** Per-application instance menu-bar support */ MenuBarSupport menu_bar_support; /** The name of the application */ char application_name[MAX_APPLICATION_NAME_LENGTH]; uint32_t remote_pid; void* context; } SessionCredentials; typedef void (*input_event_cb)(void* ctx, const Event* ev); typedef void* ubuntu_application_ui_physical_display_info; typedef void* ubuntu_application_ui_session; typedef void* ubuntu_application_ui_surface; typedef const void* u_application_archive; typedef const void* u_application_options; typedef void (*application_started_cb)(u_application_archive archive, u_application_options options, void* context); typedef void (*application_about_to_stop_cb)(u_application_archive archive, void* context); typedef struct { application_started_cb on_application_resumed; application_about_to_stop_cb on_application_about_to_stop; void *context; } ubuntu_application_ui_lifecycle_delegates; /** Initializes the Ubuntu Platform API. Has to be called before any other function is called. * \ingroup ui_access * \param argc [in] Argument count. * \param argv [in, out] Array of string arguments. */ void ubuntu_application_ui_init( int argc, char**argv); /** * Returns the stage this application instance is running in. * \ingroup ui_access */ StageHint ubuntu_application_ui_setup_get_stage_hint(); /** * Returns the form factor this application instance is running on. * \ingroup ui_access */ FormFactorHint ubuntu_application_ui_setup_get_form_factor_hint(); /** * Opens up a new session with the service providers. * \ingroup ui_access * \param creds [in] Credentials describing the instance's setup. */ void ubuntu_application_ui_start_a_new_session(SessionCredentials* creds); /** * Installs the application lifecycle delegates * \ingroup ui_access * \attention Needs an existing session. * \ingroup require_session_functions */ void ubuntu_application_ui_install_lifecycle_delegates(ubuntu_application_ui_lifecycle_delegates* delegates); /** * Sets the clipboard content. * \ingroup ui_access * \attention Needs an existing session. * \ingroup require_session_functions */ void ubuntu_application_ui_set_clipboard_content( void* data, size_t size); /** * Reads the clipboard content. * \ingroup ui_access * \attention Needs an existing session. * \ingroup require_session_functions */ void ubuntu_application_ui_get_clipboard_content( void** data, size_t* size); /** * Queries information about a physical display with index index. * \ingroup ui_access * \attention Needs an existing session. * \ingroup require_session_functions */ void ubuntu_application_ui_create_display_info( ubuntu_application_ui_physical_display_info* info, size_t index); /** * Destroy information about a physical display. * \ingroup ui_access */ void ubuntu_application_ui_destroy_display_info( ubuntu_application_ui_physical_display_info info); /** * Queries the horizontal resolution in [px] of a physical display. * \ingroup ui_access */ int32_t ubuntu_application_ui_query_horizontal_resolution( ubuntu_application_ui_physical_display_info info); /** * Queries the vertical resolution in [px] of a physical display. * \ingroup ui_access */ int32_t ubuntu_application_ui_query_vertical_resolution( ubuntu_application_ui_physical_display_info info); /** * Queries the horizontal dpi of a physical display. * \ingroup ui_access */ float ubuntu_application_ui_query_horizontal_dpi( ubuntu_application_ui_physical_display_info info); /** * Queries the vertical dpi of a physical display. * \ingroup ui_access */ float ubuntu_application_ui_query_vertical_dpi( ubuntu_application_ui_physical_display_info info); /** * Creates a new surface and registers it for this application instance. * \attention Needs an existing session. * \ingroup require_session_functions * \ingroup ui_access * \param out_surface [out] The resulting surface is placed here. * \param title [in] The title of the surface. * \param width [in] Requested width, will be clamped to available geometry. * \param height [in] Requested height, will be clamped to available geometry. * \param role [in] Role of the surface. * \param cb [in] Callback to be invoked for input events. * \param ctx [in] Context for the input event callback. */ void ubuntu_application_ui_create_surface( ubuntu_application_ui_surface* out_surface, const char* title, int width, int height, SurfaceRole role, uint32_t flags, input_event_cb cb, void* ctx); /** * Requests to switch to fullscreen for the specified surface. * \ingroup ui_access */ void ubuntu_application_ui_request_fullscreen_for_surface( ubuntu_application_ui_surface surface); /** * Destroys the specified surface. * \ingroup ui_access */ void ubuntu_application_ui_destroy_surface( ubuntu_application_ui_surface surface); /** * Translates a surface to an EGLNativeWindowType. * \ingroup ui_access */ EGLNativeWindowType ubuntu_application_ui_surface_to_native_window_type( ubuntu_application_ui_surface surface); /** * Forces the specified surface to be shown on screen. * \ingroup ui_access */ void ubuntu_application_ui_show_surface( ubuntu_application_ui_surface surface); /** * Forces the specified surface to be hidden. * \ingroup ui_access */ void ubuntu_application_ui_hide_surface( ubuntu_application_ui_surface surface); /** * Moves the specified surface. * \ingroup ui_access * \param surface [in] The surface to be moved. * \param x [in] The new x coordinate. * \param y [in] The new y coordinate. */ void ubuntu_application_ui_move_surface_to( ubuntu_application_ui_surface surface, int x, int y); /** * Resizes the specified surface. * \ingroup ui_access * \param surface [in] The surface to be moved. * \param w [in] The new width of the surface. * \param h [in] The new height of the surface. */ void ubuntu_application_ui_resize_surface_to( ubuntu_application_ui_surface surface, int w, int h); /** \example test_c_api.cpp */ /** \example test_multiple_surfaces_event_delivery.cpp */ #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_UI_H_ */ platform-api-0.20+14.04.20140411/android/include/private/application/ui/input/0000755000015301777760000000000012322055312027207 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/android/include/private/application/ui/input/listener.h0000644000015301777760000000276412322054725031225 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_UI_INPUT_LISTENER_H_ #define UBUNTU_APPLICATION_UI_INPUT_LISTENER_H_ #include "private/application/ui/input/event.h" #include "private/platform/shared_ptr.h" namespace ubuntu { namespace application { namespace ui { namespace input { /** Models a listener for classic input event originating from input devices like mice or touchpads. */ class Listener : public ubuntu::platform::ReferenceCountedBase { public: typedef ubuntu::platform::shared_ptr Ptr; /** Invoked whenever a new event is available. */ virtual void on_new_event(const Event& event) = 0; protected: Listener() {} virtual ~Listener() {} Listener(const Listener&) = delete; Listener& operator=(const Listener&) = delete; }; } } } } #endif // UBUNTU_APPLICATION_UI_INPUT_LISTENER_H_ platform-api-0.20+14.04.20140411/android/include/private/application/ui/input/event.h0000644000015301777760000001115712322054725030515 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_UI_INPUT_EVENT_H_ #define UBUNTU_APPLICATION_UI_INPUT_EVENT_H_ #include #include #ifdef __cplusplus extern "C" { #endif /** Maximum number of pointers reported within one input event. */ #define UBUNTU_APPLICATION_UI_INPUT_EVENT_MAX_POINTER_COUNT (16) /** Reference timebase, nanoseconds as measured by CLOCK_MONOTONIC. */ typedef int64_t nsecs_t; /** Describes the different event types. */ typedef enum { KEY_EVENT_TYPE, ///< Event originates from a keyboard. MOTION_EVENT_TYPE, ///< Event originates from something moving, e.g., a wheel, a mouse, a finger on a touchpad. HW_SWITCH_EVENT_TYPE ///< Event originates from an additional button attached to the device's HW, e.g., power button. } EventType; /** Models an input event. */ typedef struct { EventType type; ///< Type of the event. int32_t device_id; ///< Device that this event originated from. int32_t source_id; ///< Source that this event originated from. int32_t action; ///< Action signalled by this event. int32_t flags; ///< Flags associated with this event. int32_t meta_state; ///< State of the meta modifiers (ALT, CTRL, SHIFT). /** Information specific to key/motion event types. */ union { /** Information describing an event originating from a HW switch. */ struct HardwareSwitchEvent { nsecs_t event_time; ///< Timestamp when the event happened. uint32_t policy_flags; ///< Policy flags. int32_t switch_code; ///< The scan code of the switch. int32_t switch_value; ///< The value reported by the switch. } hw_switch; /** Information describing an event originating from a keyboard key. */ struct KeyEvent { int32_t key_code; int32_t scan_code; int32_t repeat_count; nsecs_t down_time; nsecs_t event_time; int is_system_key; ///< \deprecated Do not use. } key; /** Information describing an event originating from a * "moving" device, e.g., a mouse, a mouse-wheel, a finger * on a touchpad. */ struct MotionEvent { int32_t edge_flags; ///< Set for touches intersecting a touchscreen's edges, requires HW support. int32_t button_state; ///< State of buttons of the device float x_offset; ///< Movement in x direction since down event float y_offset; ///< Movement in y direction since down event float x_precision; ///< Sampling precision in x direction float y_precision; ///< Sampling precision in y direction nsecs_t down_time; ///< Timestamp that marks the down event nsecs_t event_time; ///< Timestamp that marks when this event happened size_t pointer_count; ///< Number of pointers reported in this event struct PointerCoordinate { int id; ///< Unique id of the pointer float x, raw_x; ///< Processed and raw x coordinates float y, raw_y; ///< Processed and raw y coordinates float touch_major; ///< Touch major coordinate float touch_minor; ///< Touch minor coordinate float size; ///< Size of the pointer/touch float pressure; ///< Pressure of the touch float orientation; ///< Orientation } pointer_coordinates[UBUNTU_APPLICATION_UI_INPUT_EVENT_MAX_POINTER_COUNT]; ///< Pointer information, valid from [0,pointer_count). } motion; } details; } Event; #ifdef __cplusplus } #endif #endif // UBUNTU_APPLICATION_UI_INPUT_EVENT_H_ platform-api-0.20+14.04.20140411/android/include/private/application/ui/init.h0000644000015301777760000000204612322054725027175 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_UI_INIT_H_ #define UBUNTU_APPLICATION_UI_INIT_H_ namespace ubuntu { namespace application { namespace ui { /** Initializes internals with the given command line arguments. * \attention Has to be called before any other function is called. */ void init(int argc, char** argv); } } } #endif // UBUNTU_APPLICATION_UI_INIT_H_ platform-api-0.20+14.04.20140411/android/include/private/application/ui/session_delegates.h0000644000015301777760000000254012322054725031731 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza */ #ifndef UBUNTU_APPLICATION_UI_SESSION_DELEGATES_H_ #define UBUNTU_APPLICATION_UI_SESSION_DELEGATES_H_ #include namespace ubuntu { namespace application { class LifecycleDelegate : public platform::ReferenceCountedBase { public: typedef platform::shared_ptr Ptr; virtual void on_application_resumed() = 0; virtual void on_application_about_to_stop() = 0; protected: LifecycleDelegate() {} virtual ~LifecycleDelegate() {} LifecycleDelegate(const LifecycleDelegate&) = delete; LifecycleDelegate& operator=(const LifecycleDelegate&) = delete; }; } } #endif // UBUNTU_APPLICATION_UI_SESSION_DELEGATES_H_ platform-api-0.20+14.04.20140411/android/include/private/application/session_delegates.h0000644000015301777760000000261212322054725031314 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza */ #ifndef UBUNTU_APPLICATION_UI_SESSION_DELEGATES_H_ #define UBUNTU_APPLICATION_UI_SESSION_DELEGATES_H_ #include #include namespace ubuntu { namespace application { class LifecycleDelegate : public platform::ReferenceCountedBase { public: typedef platform::shared_ptr Ptr; virtual void on_application_resumed() = 0; virtual void on_application_about_to_stop() = 0; protected: LifecycleDelegate() {} virtual ~LifecycleDelegate() {} LifecycleDelegate(const LifecycleDelegate&) = delete; LifecycleDelegate& operator=(const LifecycleDelegate&) = delete; }; } } #endif // UBUNTU_APPLICATION_UI_SESSION_DELEGATES_H_ platform-api-0.20+14.04.20140411/android/include/private/platform/0000755000015301777760000000000012322055312024754 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/android/include/private/platform/shared_ptr.h0000644000015301777760000000251312322054725027270 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_PLATFORM_SHARED_PTR_H_ #define UBUNTU_PLATFORM_SHARED_PTR_H_ #ifdef ANDROID #include #include #else #include #endif #include "empty_base.h" namespace ubuntu { namespace platform { #ifdef ANDROID typedef android::RefBase ReferenceCountedBase; template struct shared_ptr : public android::sp { shared_ptr() : android::sp() { } template shared_ptr(Y* p) : android::sp(p) { } }; #else typedef ubuntu::platform::EmptyBase ReferenceCountedBase; using std::shared_ptr; #endif } } #endif // UBUNTU_PLATFORM_SHARED_PTR_H_ platform-api-0.20+14.04.20140411/android/include/private/platform/empty_base.h0000644000015301777760000000203312322054725027262 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_PLATFORM_EMPTY_BASE_H_ #define UBUNTU_PLATFORM_EMPTY_BASE_H_ namespace ubuntu { namespace platform { class EmptyBase { public: virtual ~EmptyBase() {} protected: EmptyBase() {} EmptyBase(const EmptyBase&) = delete; EmptyBase& operator=(const EmptyBase&) = delete; }; } } #endif // UBUNTU_PLATFORM_EMPTY_BASE_H_ platform-api-0.20+14.04.20140411/android/include/private/ui/0000755000015301777760000000000012322055312023545 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/android/include/private/ui/session_snapshot.h0000644000015301777760000000276012322054725027334 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_UI_SESSION_SNAPSHOT_H_ #define UBUNTU_UI_SESSION_SNAPSHOT_H_ namespace ubuntu { namespace ui { class SessionSnapshot : public ubuntu::platform::ReferenceCountedBase { public: typedef ubuntu::platform::shared_ptr Ptr; virtual const void * pixel_data() = 0; virtual unsigned int x() = 0; virtual unsigned int y() = 0; virtual unsigned int source_width() = 0; virtual unsigned int source_height() = 0; virtual unsigned int width() = 0; virtual unsigned int height() = 0; virtual unsigned int stride() = 0; protected: SessionSnapshot() {} virtual ~SessionSnapshot() {} SessionSnapshot(const SessionSnapshot&) = delete; SessionSnapshot& operator=(const SessionSnapshot&) = delete; }; } } #endif // UBUNTU_UI_SESSION_SNAPSHOT_H_ platform-api-0.20+14.04.20140411/android/include/private/ui/well_known_applications.h0000644000015301777760000000233312322054725030653 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_UI_WELL_KNOWN_APPLICATIONS_H_ #define UBUNTU_UI_WELL_KNOWN_APPLICATIONS_H_ #include namespace ubuntu { namespace ui { enum WellKnownApplication { unknown_app = UNKNOWN_APP, gallery_app = CAMERA_APP, camera_app = GALLERY_APP, browser_app = BROWSER_APP, share_app = SHARE_APP, phone_app = PHONE_APP, dialer_app = DIALER_APP, messaging_app = MESSAGING_APP, addressbook_app = ADDRESSBOOK_APP }; } } #endif // UBUNTU_UI_WELL_KNOWN_APPLICATIONS_H_ platform-api-0.20+14.04.20140411/android/include/private/ui/session_enumerator.h0000644000015301777760000000764212322054725027662 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_UI_SESSION_ENUMERATOR_H_ #define UBUNTU_UI_SESSION_ENUMERATOR_H_ #include "private/platform/shared_ptr.h" #include "private/ui/well_known_applications.h" #include namespace ubuntu { namespace ui { class SessionProperties : public platform::ReferenceCountedBase { public: static const char* key_application_instance_id(); static const char* key_application_stage_hint(); static const char* key_application_name(); static const char* key_desktop_file_hint(); typedef platform::shared_ptr Ptr; virtual const char* value_for_key(const char* key) const = 0; virtual int application_stage_hint() const { return atoi(value_for_key(SessionProperties::key_application_stage_hint())); } virtual int application_instance_id() const { return atoi(value_for_key(SessionProperties::key_application_instance_id())); } const char* application_name() const { return value_for_key(SessionProperties::key_application_name()); } virtual const char* desktop_file_hint() const { return value_for_key(SessionProperties::key_desktop_file_hint()); } protected: SessionProperties() {} virtual ~SessionProperties() {} SessionProperties(const SessionProperties&) = delete; SessionProperties& operator=(const SessionProperties&) = delete; }; class TaskController : public platform::ReferenceCountedBase { public: typedef platform::shared_ptr Ptr; virtual void continue_task(int pid) = 0; virtual void suspend_task(int pid) = 0; protected: TaskController() {} virtual ~TaskController() {} TaskController(const TaskController&) = delete; TaskController& operator=(const TaskController&) = delete; }; class SessionLifeCycleObserver : public platform::ReferenceCountedBase { public: typedef platform::shared_ptr Ptr; virtual void on_session_requested(WellKnownApplication app) = 0; virtual void on_session_born(const SessionProperties::Ptr& props) = 0; virtual void on_session_unfocused(const SessionProperties::Ptr& props) = 0; virtual void on_session_focused(const SessionProperties::Ptr& props) = 0; virtual void on_keyboard_geometry_changed(int x, int y, int width, int height) = 0; virtual void on_session_requested_fullscreen(const SessionProperties::Ptr& props) = 0; virtual void on_session_died(const SessionProperties::Ptr& props) = 0; protected: SessionLifeCycleObserver() {} virtual ~SessionLifeCycleObserver() {} SessionLifeCycleObserver(const SessionLifeCycleObserver&) = delete; SessionLifeCycleObserver& operator=(const SessionLifeCycleObserver&) = delete; }; class SessionPreviewProvider : public platform::ReferenceCountedBase { public: typedef platform::shared_ptr Ptr; virtual bool get_or_update_session_preview(GLuint texture, unsigned int& width, unsigned int& height) = 0; protected: SessionPreviewProvider() {} virtual ~SessionPreviewProvider() {} SessionPreviewProvider(const SessionPreviewProvider&) = delete; SessionPreviewProvider& operator=(const SessionPreviewProvider&) = delete; }; } } #endif // UBUNTU_UI_SESSION_ENUMERATOR_H_ platform-api-0.20+14.04.20140411/android/include/private/ui/session_service.h0000644000015301777760000000474512322054725027142 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_UI_SESSION_SERVICE_H_ #define UBUNTU_UI_SESSION_SERVICE_H_ #include "private/application/ui/session.h" #include "private/platform/shared_ptr.h" #include "private/ui/session_enumerator.h" #include "private/ui/session_snapshot.h" #include "private/ui/well_known_applications.h" namespace ubuntu { namespace application { namespace ui { class Session; class SessionCredentials; } } namespace ui { class SessionService : public platform::ReferenceCountedBase { public: typedef platform::shared_ptr Ptr; static const Ptr& instance(); virtual ~SessionService() {} virtual const ubuntu::application::ui::Session::Ptr& start_a_new_session(const ubuntu::application::ui::SessionCredentials& cred) = 0; virtual void trigger_switch_to_well_known_application(WellKnownApplication app) = 0; virtual void install_session_lifecycle_observer(const SessionLifeCycleObserver::Ptr& observer) = 0; virtual void install_task_controller(const TaskController::Ptr& controller) = 0; virtual void unfocus_running_sessions() = 0; virtual void focus_running_session_with_id(int id) = 0; virtual ubuntu::ui::SessionSnapshot::Ptr snapshot_running_session_with_id(int id) = 0; virtual int32_t set_surface_trap(int32_t x, int32_t y, int32_t width, int32_t height) = 0; virtual void unset_surface_trap(int32_t handle) = 0; virtual void report_osk_visible(int x, int y, int width, int height) = 0; virtual void report_osk_invisible() = 0; virtual void report_notification_visible() = 0; virtual void report_notification_invisible() = 0; protected: SessionService() {} SessionService(const SessionService&) = delete; SessionService& operator=(const SessionService&) = delete; }; } } #endif // UBUNTU_UI_SESSION_SERVICE_H_ platform-api-0.20+14.04.20140411/tests/0000755000015301777760000000000012322055312017555 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/tests/test_ubuntu_application_sensors.cpp0000644000015301777760000002461212322054725027015 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Martin Pitt */ #include #include #include #include #include #include #include "gtest/gtest.h" #include #include #include #include #include #include using namespace std; typedef chrono::time_point time_point_system_ns; /******************************************* * * Tests with simulated sensor backend * *******************************************/ struct event { uint64_t timestamp; float x, y, z; UASProximityDistance distance; void* context; }; queue events; class SimBackendTest : public testing::Test { protected: virtual void SetUp() { snprintf(data_file, sizeof(data_file), "%s", "/tmp/sensor_test.XXXXXX"); data_fd = mkstemp(data_file); if (data_fd < 0) { perror("mkstemp"); abort(); } setenv("UBUNTU_PLATFORM_API_SENSOR_TEST", data_file, 1); setenv("UBUNTU_PLATFORM_API_BACKEND", "libubuntu_application_api_test.so.1", 1); // ensure the queue is clear while (events.size() > 0) events.pop(); } virtual void TearDown() { unlink(data_file); } void set_data(const char* data) { write(data_fd, data, strlen(data)); fsync(data_fd); } char data_file[100]; int data_fd; }; // without any data, there are no sensors defined TESTP_F(SimBackendTest, NoData, { EXPECT_EQ(NULL, ua_sensors_accelerometer_new()); EXPECT_EQ(NULL, ua_sensors_proximity_new()); EXPECT_EQ(NULL, ua_sensors_light_new()); }) TESTP_F(SimBackendTest, CreateProximity, { set_data("create proximity"); EXPECT_EQ(NULL, ua_sensors_accelerometer_new()); EXPECT_EQ(NULL, ua_sensors_light_new()); UASensorsProximity *s = ua_sensors_proximity_new(); EXPECT_TRUE(s != NULL); }) TESTP_F(SimBackendTest, CreateAccelerometer, { set_data("create accel 0.5 1000 0.1"); EXPECT_EQ(NULL, ua_sensors_proximity_new()); EXPECT_EQ(NULL, ua_sensors_light_new()); UASensorsAccelerometer *s = ua_sensors_accelerometer_new(); EXPECT_TRUE(s != NULL); EXPECT_FLOAT_EQ(0.5, ua_sensors_accelerometer_get_min_value(s)); EXPECT_FLOAT_EQ(1000.0, ua_sensors_accelerometer_get_max_value(s)); EXPECT_FLOAT_EQ(0.1, ua_sensors_accelerometer_get_resolution(s)); }) TESTP_F(SimBackendTest, CreateLight, { set_data("create light 0 10 0.5"); EXPECT_EQ(NULL, ua_sensors_proximity_new()); EXPECT_EQ(NULL, ua_sensors_accelerometer_new()); UASensorsLight *s = ua_sensors_light_new(); EXPECT_TRUE(s != NULL); EXPECT_FLOAT_EQ(0.0, ua_sensors_light_get_min_value(s)); EXPECT_FLOAT_EQ(10.0, ua_sensors_light_get_max_value(s)); EXPECT_FLOAT_EQ(0.5, ua_sensors_light_get_resolution(s)); }) TESTP_F(SimBackendTest, ProximityEvents, { set_data("create proximity\n" " # some comment\n" " \n" "50 proximity near\n" "100 proximity far\n" "80 proximity unknown\n" ); UASensorsProximity *s = ua_sensors_proximity_new(); EXPECT_TRUE(s != NULL); ua_sensors_proximity_enable(s); auto start_time = chrono::system_clock::now(); ua_sensors_proximity_set_reading_cb(s, [](UASProximityEvent* ev, void* ctx) { events.push({uas_proximity_event_get_timestamp(ev), .0, .0, .0, uas_proximity_event_get_distance(ev), ctx}); }, NULL); usleep(350000); EXPECT_EQ(3, events.size()); auto e = events.front(); events.pop(); EXPECT_EQ(e.distance, U_PROXIMITY_NEAR); EXPECT_EQ(NULL, e.context); auto event_time = time_point_system_ns(std::chrono::nanoseconds(e.timestamp)); auto delay = chrono::duration_cast(event_time - start_time).count(); EXPECT_GE(delay, 30); EXPECT_LE(delay, 70); e = events.front(); events.pop(); EXPECT_EQ(e.distance, U_PROXIMITY_FAR); event_time = time_point_system_ns(std::chrono::nanoseconds(e.timestamp)); delay = chrono::duration_cast(event_time - start_time).count(); EXPECT_GE(delay, 130); EXPECT_LE(delay, 170); e = events.front(); events.pop(); EXPECT_EQ(e.distance, (UASProximityDistance) 0); event_time = time_point_system_ns(std::chrono::nanoseconds(e.timestamp)); delay = chrono::duration_cast(event_time - start_time).count(); EXPECT_GE(delay, 210); EXPECT_LE(delay, 250); }) TESTP_F(SimBackendTest, LightEvents, { set_data(" create light 0 10 1\n" "1 light 5\n" "100 light 8\n" ); UASensorsLight *s = ua_sensors_light_new(); EXPECT_TRUE(s != NULL); ua_sensors_light_enable(s); auto start_time = chrono::system_clock::now(); ua_sensors_light_set_reading_cb(s, [](UASLightEvent* ev, void* ctx) { events.push({uas_light_event_get_timestamp(ev), uas_light_event_get_light(ev), .0, .0, (UASProximityDistance) 0, ctx}); }, NULL); usleep(130000); EXPECT_EQ(2, events.size()); auto e = events.front(); events.pop(); EXPECT_FLOAT_EQ(e.x, 5); EXPECT_EQ(NULL, e.context); auto event_time = time_point_system_ns(std::chrono::nanoseconds(e.timestamp)); auto delay = chrono::duration_cast(event_time - start_time).count(); EXPECT_LE(delay, 10); e = events.front(); events.pop(); EXPECT_FLOAT_EQ(e.x, 8); event_time = time_point_system_ns(std::chrono::nanoseconds(e.timestamp)); delay = chrono::duration_cast(event_time - start_time).count(); EXPECT_GE(delay, 91); EXPECT_LE(delay, 111); }) TESTP_F(SimBackendTest, AccelEvents, { // cover the case of > 1 s, to ensure that we correctly do mod arithmetic set_data("create accel -1000 1000 0.1\n" "1100 accel 5.5 -8.5 9.9\n" ); UASensorsAccelerometer *s = ua_sensors_accelerometer_new(); EXPECT_TRUE(s != NULL); ua_sensors_accelerometer_enable(s); auto start_time = chrono::system_clock::now(); ua_sensors_accelerometer_set_reading_cb(s, [](UASAccelerometerEvent* ev, void* ctx) { events.push({uas_accelerometer_event_get_timestamp(ev), uas_accelerometer_event_get_acceleration_x(ev), uas_accelerometer_event_get_acceleration_y(ev), uas_accelerometer_event_get_acceleration_z(ev), (UASProximityDistance) 0, ctx}); }, NULL); usleep(1200000); EXPECT_EQ(1, events.size()); auto e = events.front(); events.pop(); EXPECT_FLOAT_EQ(e.x, 5.5); EXPECT_FLOAT_EQ(e.y, -8.5); EXPECT_FLOAT_EQ(e.z, 9.9); EXPECT_EQ(NULL, e.context); auto event_time = time_point_system_ns(std::chrono::nanoseconds(e.timestamp)); auto delay = chrono::duration_cast(event_time - start_time).count(); EXPECT_GE(delay, 1050); EXPECT_LE(delay, 1150); }) /******************************************* * * Tests with default backend * *******************************************/ class DefaultBackendTest : public testing::Test { virtual void SetUp() { unsetenv("UBUNTU_PLATFORM_API_BACKEND"); } }; TESTP_F(DefaultBackendTest, CreateProximity, { // this can succeed or fail depending on whether the hardware we run this // on actually exists; but it should never crash UASensorsProximity *s = ua_sensors_proximity_new(); if (s != NULL) { cerr << "proximity sensor present on this hardware\n"; // calling its functions should not crash; we can't assert much about // their actual values, though ua_sensors_proximity_enable(s); EXPECT_LE(ua_sensors_proximity_get_min_value(s), ua_sensors_proximity_get_max_value(s)); ua_sensors_proximity_get_resolution(s); ua_sensors_proximity_disable(s); } else { cerr << "no proximity sensor on this hardware\n"; } }) TESTP_F(DefaultBackendTest, CreateAccelerometer, { // this can succeed or fail depending on whether the hardware we run this // on actually exists; but it should never crash UASensorsAccelerometer *s = ua_sensors_accelerometer_new(); if (s != NULL) { cerr << "accelerometer sensor present on this hardware\n"; // calling its functions should not crash; we can't assert much about // their actual values, though ua_sensors_accelerometer_enable(s); EXPECT_LE(ua_sensors_accelerometer_get_min_value(s), ua_sensors_accelerometer_get_max_value(s)); ua_sensors_accelerometer_get_resolution(s); ua_sensors_accelerometer_disable(s); } else { cerr << "no accelerometer sensor on this hardware\n"; } }) TESTP_F(DefaultBackendTest, CreateLight, { // this can succeed or fail depending on whether the hardware we run this // on actually exists; but it should never crash UASensorsLight *s = ua_sensors_light_new(); if (s != NULL) { cerr << "light sensor present on this hardware\n"; // calling its functions should not crash; we can't assert much about // their actual values, though ua_sensors_light_enable(s); EXPECT_LE(ua_sensors_light_get_min_value(s), ua_sensors_light_get_max_value(s)); ua_sensors_light_get_resolution(s); ua_sensors_light_disable(s); } else { cerr << "no light sensor on this hardware\n"; } }) platform-api-0.20+14.04.20140411/tests/CMakeLists.txt0000644000015301777760000000134112322054725022323 0ustar pbusernogroup00000000000000find_package(PkgConfig REQUIRED) pkg_check_modules(PROCESS_CPP process-cpp REQUIRED) include_directories(${GTEST_ROOT}/src) include_directories(${PROCESS_CPP_INCLUDE_DIRS}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11") add_executable( test_ubuntu_application_sensors test_ubuntu_application_sensors.cpp ) target_link_libraries( test_ubuntu_application_sensors ubuntu_application_api gtest gtest_main ${PROCESS_CPP_LIBRARIES} ) # we need to call the tests with pointing to the locally built test platform # library add_test( test_ubuntu_application_sensors env LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/src/ubuntu/testbackend ${CMAKE_CURRENT_BINARY_DIR}/test_ubuntu_application_sensors ) platform-api-0.20+14.04.20140411/data/0000755000015301777760000000000012322055312017324 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/data/ubuntu-platform-api.pc.in0000644000015301777760000000060712322054725024202 0ustar pbusernogroup00000000000000prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} libdir=${prefix}/@LIB_INSTALL_DIR@ includedir=${exec_prefix}/include Name: @CMAKE_PROJECT_NAME@ Description: Ubuntu's platform abstraction layer. Version: @UBUNTU_PLATFORM_API_VERSION_MAJOR@.@UBUNTU_PLATFORM_API_VERSION_MINOR@.@UBUNTU_PLATFORM_API_VERSION_PATCH@ Libs: -L${libdir} -lubuntu_application_api Cflags: -I${includedir}/ubuntu platform-api-0.20+14.04.20140411/data/CMakeLists.txt0000644000015301777760000000031312322054725022070 0ustar pbusernogroup00000000000000configure_file( ubuntu-platform-api.pc.in ubuntu-platform-api.pc @ONLY ) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/ubuntu-platform-api.pc DESTINATION lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig )platform-api-0.20+14.04.20140411/doc/0000755000015301777760000000000012322055312017160 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/doc/mainpage.md0000644000015301777760000000246612322054725021302 0ustar pbusernogroup00000000000000Ubuntu Platform API {#mainpage} =================== The Ubuntu platform API Implements access to the Ubuntu platform and is the primary carrier across form-factor boundaries. It serves as a low-level access layer to the underlying system and its capabilities. Intended Audience ----------------- The intended audience of this API and its documentation are integrators and developers who either cannot or do not want to rely on the more convenient QML or HTML5/JS SDKs. Source Tree Layout ------------------ The overall source tree is split up into roughly two parts: * include/ * ubuntu/ * application/ * ui/ * sensors/ * ui/ * android/ where include contains all of the public types, functions and interfaces offered by the Ubuntu platform API. The android subfolder contains the android-specific implementation of the Ubuntu platform API, together with a default implementation of the C API on top of the generic C++ API. For developers, only the include/ folder and its subdirectories are of interest. Within the include/ folder, only the ubuntu/application/ subfolder is meant for public consumption. Please note that all the interfaces defined in ubuntu/ui are considered private at this point and are likely to see significant changes or might completely go away without prior notice.platform-api-0.20+14.04.20140411/doc/Doxyfile.in0000644000015301777760000023452412322054725021314 0ustar pbusernogroup00000000000000# Doxyfile 1.8.3.1 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. # # All text after a hash (#) is considered a comment and will be ignored. # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" "). #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or sequence of words) that should # identify the project. Note that if you do not use Doxywizard you need # to put quotes around the project name if it contains spaces. PROJECT_NAME = "Ubuntu Platform API" # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = @UBUNTU_PLATFORM_API_VERSION_MAJOR@.@UBUNTU_PLATFORM_API_VERSION_MINOR@.@UBUNTU_PLATFORM_API_VERSION_PATCH@ # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer # a quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = "A library helping with tight integration into the Ubuntu platform" # With the PROJECT_LOGO tag one can specify an logo or icon that is # included in the documentation. The maximum height of the logo should not # exceed 55 pixels and the maximum width should not exceed 200 pixels. # Doxygen will copy the logo to the output directory. PROJECT_LOGO = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. Note that you specify absolute paths here, but also # relative paths, which will be relative from the directory where doxygen is # started. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful if your file system # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 4 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # This tag can be used to specify a number of word-keyword mappings (TCL only). # A mapping has the form "name=value". For example adding # "class=itcl::class" will allow you to use the command class in the # itcl::class meaning. TCL_SUBST = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = YES # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given # extension. Doxygen has a built-in mapping, but you can override or extend it # using this tag. The format is ext=language, where ext is a file extension, # and language is one of the parsers supported by doxygen: IDL, Java, # Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, # C++. For instance to make doxygen treat .inc files as Fortran files (default # is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note # that for custom extensions you also need to set FILE_PATTERNS otherwise the # files are not read by doxygen. EXTENSION_MAPPING = # If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all # comments according to the Markdown format, which allows for more readable # documentation. See http://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you # can mix doxygen, HTML, and XML commands with Markdown formatting. # Disable only in case of backward compatibilities issues. MARKDOWN_SUPPORT = YES # When enabled doxygen tries to link words that correspond to documented classes, # or namespaces to their corresponding documentation. Such a link can be # prevented in individual cases by by putting a % sign in front of the word or # globally by setting AUTOLINK_SUPPORT to NO. AUTOLINK_SUPPORT = YES # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also makes the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate # getter and setter methods for a property. Setting this option to YES (the # default) will make doxygen replace the get and set methods by a property in # the documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and # unions are shown inside the group in which they are included (e.g. using # @ingroup) instead of on a separate page (for HTML and Man pages) or # section (for LaTeX and RTF). INLINE_GROUPED_CLASSES = NO # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and # unions with only public data fields will be shown inline in the documentation # of the scope in which they are defined (i.e. file, namespace, or group # documentation), provided this scope is documented. If set to NO (the default), # structs, classes, and unions are shown on a separate page (for HTML and Man # pages) or section (for LaTeX and RTF). INLINE_SIMPLE_STRUCTS = NO # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to # determine which symbols to keep in memory and which to flush to disk. # When the cache is full, less often used symbols will be written to disk. # For small to medium size projects (<1000 input files) the default value is # probably good enough. For larger projects a too small cache size can cause # doxygen to be busy swapping symbols to and from disk most of the time # causing a significant performance penalty. # If the system has enough physical memory increasing the cache will improve the # performance by keeping more symbols in memory. Note that the value works on # a logarithmic scale so increasing the size by one will roughly double the # memory usage. The cache size is given by this formula: # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols. SYMBOL_CACHE_SIZE = 0 # Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be # set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given # their name and scope. Since this can be an expensive process and often the # same symbol appear multiple times in the code, doxygen keeps a cache of # pre-resolved symbols. If the cache is too small doxygen will become slower. # If the cache is too large, memory is wasted. The cache size is given by this # formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols. LOOKUP_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_PACKAGE tag is set to YES all members with package or internal # scope will be included in the documentation. EXTRACT_PACKAGE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = NO # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespaces are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen # will list include files with double quotes in the documentation # rather than with sharp brackets. FORCE_LOCAL_INCLUDES = NO # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen # will sort the (brief and detailed) documentation of class members so that # constructors and destructors are listed first. If set to NO (the default) # the constructors will appear in the respective orders defined by # SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. # This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO # and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to # do proper type resolution of all parameters of a function it will reject a # match between the prototype and the implementation of a member function even # if there is only one candidate or it is obvious which candidate to choose # by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen # will still accept a match between prototype and implementation in such cases. STRICT_PROTO_MATCHING = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if section-label ... \endif # and \cond section-label ... \endcond blocks. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or macro consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and macros in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated # output files in an output format independent way. To create the layout file # that represents doxygen's defaults, run doxygen with the -l option. # You can optionally specify a file name after the option, if omitted # DoxygenLayout.xml will be used as the name of the layout file. LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files # containing the references data. This must be a list of .bib files. The # .bib extension is automatically appended if omitted. Using this command # requires the bibtex tool to be installed. See also # http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style # of the bibliography can be controlled using LATEX_BIB_STYLE. To use this # feature you need bibtex and perl available in the search path. Do not use # file names with spaces, bibtex cannot handle them. CITE_BIB_FILES = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # The WARN_NO_PARAMDOC option can be enabled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = @CMAKE_CURRENT_SOURCE_DIR@ @CMAKE_CURRENT_SOURCE_DIR@/../include # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh # *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py # *.f90 *.f *.for *.vhd *.vhdl FILE_PATTERNS = # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should be # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. # Note that relative paths are relative to the directory from which doxygen is # run. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/../src # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = YES # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. # If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. # Doxygen will compare the file name with each pattern and apply the # filter if there is a match. # The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty or if # non of the patterns match the file name, INPUT_FILTER is applied. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file # pattern. A pattern will override the setting for FILTER_PATTERN (if any) # and it is also possible to disable source filtering for a specific pattern # using *.ext= (so without naming a filter). This option only has effect when # FILTER_SOURCE_FILES is enabled. FILTER_SOURCE_PATTERNS = # If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that # is part of the input, its contents will be placed on the main page (index.html). # This can be useful if you have a project on for instance GitHub and want reuse # the introduction page also for the doxygen output. USE_MDFILE_AS_MAINPAGE = @CMAKE_CURRENT_SOURCE_DIR@/mainpage.md #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C, C++ and Fortran comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = YES # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = YES # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. # Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. Note that when using a custom header you are responsible # for the proper inclusion of any scripts and style sheets that doxygen # needs, which is dependent on the configuration options used. # It is advised to generate a default header using "doxygen -w html # header.html footer.html stylesheet.css YourConfigFile" and then modify # that header. Note that the header is subject to change so you typically # have to redo this when upgrading to a newer version of doxygen or when # changing the value of configuration settings such as GENERATE_TREEVIEW! HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If left blank doxygen will # generate a default style sheet. Note that it is recommended to use # HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this # tag will in the future become obsolete. HTML_STYLESHEET = # The HTML_EXTRA_STYLESHEET tag can be used to specify an additional # user-defined cascading style sheet that is included after the standard # style sheets created by doxygen. Using this option one can overrule # certain style aspects. This is preferred over using HTML_STYLESHEET # since it does not replace the standard style sheet and is therefor more # robust against future updates. Doxygen will copy the style sheet file to # the output directory. HTML_EXTRA_STYLESHEET = # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note # that these files will be copied to the base HTML output directory. Use the # $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these # files. In the HTML_STYLESHEET file, use the file name only. Also note that # the files will be copied as-is; there are no commands or markers available. HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. # Doxygen will adjust the colors in the style sheet and background images # according to this color. Hue is specified as an angle on a colorwheel, # see http://en.wikipedia.org/wiki/Hue for more information. # For instance the value 0 represents red, 60 is yellow, 120 is green, # 180 is cyan, 240 is blue, 300 purple, and 360 is red again. # The allowed range is 0 to 359. HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of # the colors in the HTML output. For a value of 0 the output will use # grayscales only. A value of 255 will produce the most vivid colors. HTML_COLORSTYLE_SAT = 100 # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to # the luminance component of the colors in the HTML output. Values below # 100 gradually make the output lighter, whereas values above 100 make # the output darker. The value divided by 100 is the actual gamma applied, # so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, # and 100 does not change the gamma. HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting # this to NO can help when comparing the output of multiple runs. HTML_TIMESTAMP = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. HTML_DYNAMIC_SECTIONS = YES # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of # entries shown in the various tree structured indices initially; the user # can expand and collapse entries dynamically later on. Doxygen will expand # the tree to such a level that at most the specified number of entries are # visible (unless a fully collapsed tree already exceeds this amount). # So setting the number of entries 1 will produce a full collapsed tree by # default. 0 is a special value representing an infinite number of entries # and will result in a full expanded tree by default. HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely # identify the documentation publisher. This should be a reverse domain-name # style string, e.g. com.mycompany.MyDocSet.documentation. DOCSET_PUBLISHER_ID = org.doxygen.Publisher # The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated # that can be used as input for Qt's qhelpgenerator to generate a # Qt Compressed Help (.qch) of the generated HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to # add. For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see # # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's # filter section matches. # # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files # will be generated, which together with the HTML files, form an Eclipse help # plugin. To install this plugin and make it available under the help contents # menu in Eclipse, the contents of the directory containing the HTML and XML # files needs to be copied into the plugins directory of eclipse. The name of # the directory within the plugins directory should be the same as # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before # the help appears. GENERATE_ECLIPSEHELP = NO # A unique identifier for the eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have # this name. ECLIPSE_DOC_ID = org.doxygen.Project # The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) # at top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. Since the tabs have the same information as the # navigation tree you can set this option to NO if you already set # GENERATE_TREEVIEW to YES. DISABLE_INDEX = YES # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to YES, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. # Since the tree basically has the same information as the tab index you # could consider to set DISABLE_INDEX to NO when enabling this option. GENERATE_TREEVIEW = YES # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values # (range [0,1..20]) that doxygen will group on one line in the generated HTML # documentation. Note that a value of 0 will completely suppress the enum # values from appearing in the overview section. ENUM_VALUES_PER_LINE = 1 # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open # links to external symbols imported via tag files in a separate window. EXT_LINKS_IN_WINDOW = NO # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # Use the FORMULA_TRANPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are # not supported properly for IE 6.0, but are supported on all modern browsers. # Note that when changing this option you need to delete any form_*.png files # in the HTML output before the changes have effect. FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax # (see http://www.mathjax.org) which uses client side Javascript for the # rendering instead of using prerendered bitmaps. Use this if you do not # have LaTeX installed or if you want to formulas look prettier in the HTML # output. When enabled you may also need to install MathJax separately and # configure the path to it using the MATHJAX_RELPATH option. USE_MATHJAX = NO # When MathJax is enabled you can set the default output format to be used for # thA MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and # SVG. The default value is HTML-CSS, which is slower, but has the best # compatibility. MATHJAX_FORMAT = HTML-CSS # When MathJax is enabled you need to specify the location relative to the # HTML output directory using the MATHJAX_RELPATH option. The destination # directory should contain the MathJax.js script. For instance, if the mathjax # directory is located at the same level as the HTML output directory, then # MATHJAX_RELPATH should be ../mathjax. The default value points to # the MathJax Content Delivery Network so you can quickly see the result without # installing MathJax. # However, it is strongly recommended to install a local # copy of MathJax from http://www.mathjax.org before deployment. MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest # The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension # names that should be enabled during MathJax rendering. MATHJAX_EXTENSIONS = # When the SEARCHENGINE tag is enabled doxygen will generate a search box # for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using # HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets # (GENERATE_DOCSET) there is already a search function so this one should # typically be disabled. For large projects the javascript based search engine # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be # implemented using a web server instead of a web client using Javascript. # There are two flavours of web server based search depending on the # EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for # searching and an index file used by the script. When EXTERNAL_SEARCH is # enabled the indexing and searching needs to be provided by external tools. # See the manual for details. SERVER_BASED_SEARCH = NO # When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP # script for searching. Instead the search results are written to an XML file # which needs to be processed by an external indexer. Doxygen will invoke an # external search engine pointed to by the SEARCHENGINE_URL option to obtain # the search results. Doxygen ships with an example indexer (doxyindexer) and # search engine (doxysearch.cgi) which are based on the open source search engine # library Xapian. See the manual for configuration details. EXTERNAL_SEARCH = NO # The SEARCHENGINE_URL should point to a search engine hosted by a web server # which will returned the search results when EXTERNAL_SEARCH is enabled. # Doxygen ships with an example search engine (doxysearch) which is based on # the open source search engine library Xapian. See the manual for configuration # details. SEARCHENGINE_URL = # When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed # search data is written to a file for indexing by an external tool. With the # SEARCHDATA_FILE tag the name of this file can be specified. SEARCHDATA_FILE = searchdata.xml # When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the # EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is # useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple # projects and redirect the results back to the right project. EXTERNAL_SEARCH_ID = # The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen # projects other than the one defined by this configuration file, but that are # all added to the same external search index. Each project needs to have a # unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id # of to a relative location where the documentation can be found. # The format is: EXTRA_SEARCH_MAPPINGS = id1=loc1 id2=loc2 ... EXTRA_SEARCH_MAPPINGS = #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. # Note that when enabling USE_PDFLATEX this option is only used for # generating bitmaps for formulas in the HTML output, but not in the # Makefile that is written to the output directory. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4 # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for # the generated latex document. The footer should contain everything after # the last chapter. If it is left blank doxygen will generate a # standard footer. Notice: only use this tag if you know what you are doing! LATEX_FOOTER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO # If LATEX_SOURCE_CODE is set to YES then doxygen will include # source code with syntax highlighting in the LaTeX output. # Note that which sources are shown also depends on other settings # such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See # http://en.wikipedia.org/wiki/BibTeX for more info. LATEX_BIB_STYLE = plain #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load style sheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = YES # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. # This is useful # if you want to understand what is going on. # On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # pointed to by INCLUDE_PATH will be searched when a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition that # overrules the definition found in the source code. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all references to function-like macros # that are alone on a line, have an all uppercase name, and do not end with a # semicolon, because these will confuse the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. For each # tag file the location of the external documentation should be added. The # format of a tag file without this location is as follows: # # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths # or URLs. Note that each tag file must have a unique name (where the name does # NOT include the path). If a tag file is not located in the directory in which # doxygen is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option also works with HAVE_DOT disabled, but it is recommended to # install and use dot, since it yields more powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = NO # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = YES # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is # allowed to run in parallel. When set to 0 (the default) doxygen will # base this on the number of processors available in the system. You can set it # explicitly to a value larger than 0 to get control over the balance # between CPU load and processing speed. DOT_NUM_THREADS = 0 # By default doxygen will use the Helvetica font for all dot files that # doxygen generates. When you want a differently looking font you can specify # the font name using DOT_FONTNAME. You need to make sure dot is able to find # the font, which can be done by putting it in a standard location or by setting # the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the # directory containing the font. DOT_FONTNAME = Helvetica # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the Helvetica font. # If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to # set the path where dot can find it. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = YES # If the UML_LOOK tag is enabled, the fields and methods are shown inside # the class node. If there are many fields or methods and many nodes the # graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS # threshold limits the number of items for each type to make the size more # managable. Set this to 0 for no limit. Note that the threshold may be # exceeded by 50% before the limit is enforced. UML_LIMIT_NUM_FIELDS = 10 # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = YES # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will generate a graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are svg, png, jpg, or gif. # If left blank png will be used. If you choose svg you need to set # HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible in IE 9+ (other browsers do not have this requirement). DOT_IMAGE_FORMAT = png # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to # enable generation of interactive SVG images that allow zooming and panning. # Note that this requires a modern browser other than Internet Explorer. # Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you # need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible. Older versions of IE do not have SVG support. INTERACTIVE_SVG = YES # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The MSCFILE_DIRS tag can be used to specify one or more directories that # contain msc files that are included in the documentation (see the # \mscfile command). MSCFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = YES # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = YES # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES platform-api-0.20+14.04.20140411/doc/CMakeLists.txt0000644000015301777760000000217612322054725021735 0ustar pbusernogroup00000000000000# Copyright © 2013 Canonical Ltd. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Authored by: Thomas Voss find_package(Doxygen) if(DOXYGEN_FOUND) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) add_custom_target(doc ALL ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Generating API documentation with Doxygen" VERBATIM) install( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/doc/ubuntu-platform-api) endif(DOXYGEN_FOUND)platform-api-0.20+14.04.20140411/doc/Doxyfile0000644000015301777760000022520012322054725020676 0ustar pbusernogroup00000000000000# Doxyfile 1.8.1.2 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. # # All text after a hash (#) is considered a comment and will be ignored. # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" "). #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or sequence of words) that should # identify the project. Note that if you do not use Doxywizard you need # to put quotes around the project name if it contains spaces. PROJECT_NAME = "Ubuntu Platform API" # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer # a quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = # With the PROJECT_LOGO tag one can specify an logo or icon that is # included in the documentation. The maximum height of the logo should not # exceed 55 pixels and the maximum width should not exceed 200 pixels. # Doxygen will copy the logo to the output directory. PROJECT_LOGO = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful if your file system # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = YES # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 4 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # This tag can be used to specify a number of word-keyword mappings (TCL only). # A mapping has the form "name=value". For example adding # "class=itcl::class" will allow you to use the command class in the # itcl::class meaning. TCL_SUBST = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this # tag. The format is ext=language, where ext is a file extension, and language # is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, # C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make # doxygen treat .inc files as Fortran files (default is PHP), and .f files as C # (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions # you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. EXTENSION_MAPPING = # If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all # comments according to the Markdown format, which allows for more readable # documentation. See http://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you # can mix doxygen, HTML, and XML commands with Markdown formatting. # Disable only in case of backward compatibilities issues. MARKDOWN_SUPPORT = YES # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also makes the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and # unions are shown inside the group in which they are included (e.g. using # @ingroup) instead of on a separate page (for HTML and Man pages) or # section (for LaTeX and RTF). INLINE_GROUPED_CLASSES = NO # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and # unions with only public data fields will be shown inline in the documentation # of the scope in which they are defined (i.e. file, namespace, or group # documentation), provided this scope is documented. If set to NO (the default), # structs, classes, and unions are shown on a separate page (for HTML and Man # pages) or section (for LaTeX and RTF). INLINE_SIMPLE_STRUCTS = YES # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to # determine which symbols to keep in memory and which to flush to disk. # When the cache is full, less often used symbols will be written to disk. # For small to medium size projects (<1000 input files) the default value is # probably good enough. For larger projects a too small cache size can cause # doxygen to be busy swapping symbols to and from disk most of the time # causing a significant performance penalty. # If the system has enough physical memory increasing the cache will improve the # performance by keeping more symbols in memory. Note that the value works on # a logarithmic scale so increasing the size by one will roughly double the # memory usage. The cache size is given by this formula: # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols. SYMBOL_CACHE_SIZE = 0 # Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be # set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given # their name and scope. Since this can be an expensive process and often the # same symbol appear multiple times in the code, doxygen keeps a cache of # pre-resolved symbols. If the cache is too small doxygen will become slower. # If the cache is too large, memory is wasted. The cache size is given by this # formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols. LOOKUP_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_PACKAGE tag is set to YES all members with package or internal scope will be included in the documentation. EXTRACT_PACKAGE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespaces are hidden. EXTRACT_ANON_NSPACES = YES # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen # will list include files with double quotes in the documentation # rather than with sharp brackets. FORCE_LOCAL_INCLUDES = NO # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen # will sort the (brief and detailed) documentation of class members so that # constructors and destructors are listed first. If set to NO (the default) # the constructors will appear in the respective orders defined by # SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. # This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO # and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to # do proper type resolution of all parameters of a function it will reject a # match between the prototype and the implementation of a member function even # if there is only one candidate or it is obvious which candidate to choose # by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen # will still accept a match between prototype and implementation in such cases. STRICT_PROTO_MATCHING = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or macro consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and macros in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated # output files in an output format independent way. To create the layout file # that represents doxygen's defaults, run doxygen with the -l option. # You can optionally specify a file name after the option, if omitted # DoxygenLayout.xml will be used as the name of the layout file. LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files # containing the references data. This must be a list of .bib files. The # .bib extension is automatically appended if omitted. Using this command # requires the bibtex tool to be installed. See also # http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style # of the bibliography can be controlled using LATEX_BIB_STYLE. To use this # feature you need bibtex and perl available in the search path. CITE_BIB_FILES = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # The WARN_NO_PARAMDOC option can be enabled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = ../include/ mainpage.md # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh # *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py # *.f90 *.f *.for *.vhd *.vhdl FILE_PATTERNS = # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should be # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. # Note that relative paths are relative to the directory from which doxygen is # run. EXCLUDE = ../include/ubuntu/ui # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = ubuntu::platform::* # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = ../src/android/tests # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. # If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. # Doxygen will compare the file name with each pattern and apply the # filter if there is a match. # The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty or if # non of the patterns match the file name, INPUT_FILTER is applied. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file # pattern. A pattern will override the setting for FILTER_PATTERN (if any) # and it is also possible to disable source filtering for a specific pattern # using *.ext= (so without naming a filter). This option only has effect when # FILTER_SOURCE_FILES is enabled. FILTER_SOURCE_PATTERNS = #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C, C++ and Fortran comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. # Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. Note that when using a custom header you are responsible # for the proper inclusion of any scripts and style sheets that doxygen # needs, which is dependent on the configuration options used. # It is advised to generate a default header using "doxygen -w html # header.html footer.html stylesheet.css YourConfigFile" and then modify # that header. Note that the header is subject to change so you typically # have to redo this when upgrading to a newer version of doxygen or when # changing the value of configuration settings such as GENERATE_TREEVIEW! HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # style sheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note # that these files will be copied to the base HTML output directory. Use the # $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these # files. In the HTML_STYLESHEET file, use the file name only. Also note that # the files will be copied as-is; there are no commands or markers available. HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. # Doxygen will adjust the colors in the style sheet and background images # according to this color. Hue is specified as an angle on a colorwheel, # see http://en.wikipedia.org/wiki/Hue for more information. # For instance the value 0 represents red, 60 is yellow, 120 is green, # 180 is cyan, 240 is blue, 300 purple, and 360 is red again. # The allowed range is 0 to 359. HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of # the colors in the HTML output. For a value of 0 the output will use # grayscales only. A value of 255 will produce the most vivid colors. HTML_COLORSTYLE_SAT = 100 # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to # the luminance component of the colors in the HTML output. Values below # 100 gradually make the output lighter, whereas values above 100 make # the output darker. The value divided by 100 is the actual gamma applied, # so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, # and 100 does not change the gamma. HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting # this to NO can help when comparing the output of multiple runs. HTML_TIMESTAMP = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. HTML_DYNAMIC_SECTIONS = NO # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of # entries shown in the various tree structured indices initially; the user # can expand and collapse entries dynamically later on. Doxygen will expand # the tree to such a level that at most the specified number of entries are # visible (unless a fully collapsed tree already exceeds this amount). # So setting the number of entries 1 will produce a full collapsed tree by # default. 0 is a special value representing an infinite number of entries # and will result in a full expanded tree by default. HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify # the documentation publisher. This should be a reverse domain-name style # string, e.g. com.mycompany.MyDocSet.documentation. DOCSET_PUBLISHER_ID = org.doxygen.Publisher # The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated # that can be used as input for Qt's qhelpgenerator to generate a # Qt Compressed Help (.qch) of the generated HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to # add. For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see # # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's # filter section matches. # # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files # will be generated, which together with the HTML files, form an Eclipse help # plugin. To install this plugin and make it available under the help contents # menu in Eclipse, the contents of the directory containing the HTML and XML # files needs to be copied into the plugins directory of eclipse. The name of # the directory within the plugins directory should be the same as # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before # the help appears. GENERATE_ECLIPSEHELP = NO # A unique identifier for the eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have # this name. ECLIPSE_DOC_ID = org.doxygen.Project # The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) # at top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. Since the tabs have the same information as the # navigation tree you can set this option to NO if you already set # GENERATE_TREEVIEW to YES. DISABLE_INDEX = NO # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to YES, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. # Since the tree basically has the same information as the tab index you # could consider to set DISABLE_INDEX to NO when enabling this option. GENERATE_TREEVIEW = NO # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values # (range [0,1..20]) that doxygen will group on one line in the generated HTML # documentation. Note that a value of 0 will completely suppress the enum # values from appearing in the overview section. ENUM_VALUES_PER_LINE = 4 # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open # links to external symbols imported via tag files in a separate window. EXT_LINKS_IN_WINDOW = NO # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # Use the FORMULA_TRANPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are # not supported properly for IE 6.0, but are supported on all modern browsers. # Note that when changing this option you need to delete any form_*.png files # in the HTML output before the changes have effect. FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax # (see http://www.mathjax.org) which uses client side Javascript for the # rendering instead of using prerendered bitmaps. Use this if you do not # have LaTeX installed or if you want to formulas look prettier in the HTML # output. When enabled you may also need to install MathJax separately and # configure the path to it using the MATHJAX_RELPATH option. USE_MATHJAX = NO # When MathJax is enabled you need to specify the location relative to the # HTML output directory using the MATHJAX_RELPATH option. The destination # directory should contain the MathJax.js script. For instance, if the mathjax # directory is located at the same level as the HTML output directory, then # MATHJAX_RELPATH should be ../mathjax. The default value points to # the MathJax Content Delivery Network so you can quickly see the result without # installing MathJax. # However, it is strongly recommended to install a local # copy of MathJax from http://www.mathjax.org before deployment. MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest # The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension # names that should be enabled during MathJax rendering. MATHJAX_EXTENSIONS = # When the SEARCHENGINE tag is enabled doxygen will generate a search box # for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using # HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets # (GENERATE_DOCSET) there is already a search function so this one should # typically be disabled. For large projects the javascript based search engine # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be # implemented using a PHP enabled web server instead of at the web client # using Javascript. Doxygen will generate the search PHP script and index # file to put on the web server. The advantage of the server # based approach is that it scales better to large projects and allows # full text search. The disadvantages are that it is more difficult to setup # and does not have live searching capabilities. SERVER_BASED_SEARCH = NO #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = YES # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. # Note that when enabling USE_PDFLATEX this option is only used for # generating bitmaps for formulas in the HTML output, but not in the # Makefile that is written to the output directory. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4 # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for # the generated latex document. The footer should contain everything after # the last chapter. If it is left blank doxygen will generate a # standard footer. Notice: only use this tag if you know what you are doing! LATEX_FOOTER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO # If LATEX_SOURCE_CODE is set to YES then doxygen will include # source code with syntax highlighting in the LaTeX output. # Note that which sources are shown also depends on other settings # such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See # http://en.wikipedia.org/wiki/BibTeX for more info. LATEX_BIB_STYLE = plain #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load style sheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. # This is useful # if you want to understand what is going on. # On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # pointed to by INCLUDE_PATH will be searched when a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition that # overrules the definition found in the source code. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all references to function-like macros # that are alone on a line, have an all uppercase name, and do not end with a # semicolon, because these will confuse the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. For each # tag file the location of the external documentation should be added. The # format of a tag file without this location is as follows: # # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths # or URLs. Note that each tag file must have a unique name (where the name does # NOT include the path). If a tag file is not located in the directory in which # doxygen is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option also works with HAVE_DOT disabled, but it is recommended to # install and use dot, since it yields more powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = NO # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = YES # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is # allowed to run in parallel. When set to 0 (the default) doxygen will # base this on the number of processors available in the system. You can set it # explicitly to a value larger than 0 to get control over the balance # between CPU load and processing speed. DOT_NUM_THREADS = 0 # By default doxygen will use the Helvetica font for all dot files that # doxygen generates. When you want a differently looking font you can specify # the font name using DOT_FONTNAME. You need to make sure dot is able to find # the font, which can be done by putting it in a standard location or by setting # the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the # directory containing the font. DOT_FONTNAME = Helvetica # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the Helvetica font. # If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to # set the path where dot can find it. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If the UML_LOOK tag is enabled, the fields and methods are shown inside # the class node. If there are many fields or methods and many nodes the # graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS # threshold limits the number of items for each type to make the size more # managable. Set this to 0 for no limit. Note that the threshold may be # exceeded by 50% before the limit is enforced. UML_LIMIT_NUM_FIELDS = 10 # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will generate a graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are svg, png, jpg, or gif. # If left blank png will be used. If you choose svg you need to set # HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible in IE 9+ (other browsers do not have this requirement). DOT_IMAGE_FORMAT = png # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to # enable generation of interactive SVG images that allow zooming and panning. # Note that this requires a modern browser other than Internet Explorer. # Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you # need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible. Older versions of IE do not have SVG support. INTERACTIVE_SVG = NO # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The MSCFILE_DIRS tag can be used to specify one or more directories that # contain msc files that are included in the documentation (see the # \mscfile command). MSCFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = YES # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES platform-api-0.20+14.04.20140411/CMakeLists.txt0000644000015301777760000000636512322054725021174 0ustar pbusernogroup00000000000000cmake_minimum_required(VERSION 2.6) project(ubuntu-platform-api) set(UBUNTU_PLATFORM_API_VERSION_MAJOR 1) set(UBUNTU_PLATFORM_API_VERSION_MINOR 0) set(UBUNTU_PLATFORM_API_VERSION_PATCH 0) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") if (CMAKE_BUILD_TYPE MATCHES [cC][oO][vV][eE][rR][aA][gG][eE]) set(CMAKE_GCOV gcov) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftest-coverage -fprofile-arcs" ) SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -ftest-coverage -fprofile-arcs" ) SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ftest-coverage -fprofile-arcs" ) endif (CMAKE_BUILD_TYPE MATCHES [cC][oO][vV][eE][rR][aA][gG][eE]) set(BIN_INSTALL_DIR bin) set(LIB_INSTALL_DIR lib/${CMAKE_LIBRARY_ARCHITECTURE}) set(INSTALL_TARGETS_DEFAULT_ARGS RUNTIME DESTINATION "${BIN_INSTALL_DIR}" LIBRARY DESTINATION "${LIB_INSTALL_DIR}" ARCHIVE DESTINATION "${LIB_INSTALL_DIR}") #### Detect if we have got gles2, and fall back to plain gl if not #### set(UBUNTU_PLATFORM_API_HAVE_GLES2 0) find_path( GLES2_INCLUDE_PATH GLES2/gl2.h ) if (GLES2_INCLUDE_PATH) message(STATUS "GLES2 found in ${GLES2_INCLUDE_PATH}") set(UBUNTU_PLATFORM_API_HAVE_GLES2 1) else (GLES2_INCLUDE_PATH) message(STATUS "GLES2 not found, falling back to plain GL") endif (GLES2_INCLUDE_PATH) #### Detect if we have got gles2, and fall back to plain gl if not #### #### Detect if we have EGL/egl.h, and bail out if not #### find_path( EGL_INCLUDE_PATH EGL/egl.h ) if (NOT EGL_INCLUDE_PATH) message(ERROR EGL not found) else (NOT EGL_INCLUDE_PATH) message(STATUS "EGL found in ${EGL_INCLUDE_PATH}") endif (NOT EGL_INCLUDE_PATH) #### Detect if we have EGL/egl.h, and bail out if not #### option( ENABLE_HYBRIS_IMPLEMENTATION "Enable hybris based platform API implementation" ON ) option( ENABLE_MIRSERVER_IMPLEMENTATION "Enable mirserver based platorm API implementation" OFF ) if(ENABLE_MIRSERVER_IMPLEMENTATION) find_package(PkgConfig) pkg_check_modules(MIRSERVER REQUIRED mirserver) endif(ENABLE_MIRSERVER_IMPLEMENTATION) option( ENABLE_MIRCLIENT_IMPLEMENTATION "Enable mirclient based platform API implementation" OFF ) if(ENABLE_MIRCLIENT_IMPLEMENTATION) find_package(PkgConfig) pkg_check_modules(MIRCLIENT REQUIRED mirclient) find_package(Protobuf REQUIRED) if(PROTOBUF_PROTOC_EXECUTABLE STREQUAL "PROTOBUF_PROTOC_EXECUTABLE-NOTFOUND") message(SEND_ERROR "protoc executable not found! Missing protobuf-compiler package?") endif() endif(ENABLE_MIRCLIENT_IMPLEMENTATION) if(ENABLE_MIRCLIENT_IMPLEMENTATION OR ENABLE_MIRSERVER_IMPLEMENTATION) pkg_check_modules(MIRCOMMON REQUIRED mircommon) endif() # Try to find hybris, and disable hybris from build if not found find_library(Hybris NAMES hybris-common ) if(NOT Hybris) message(STATUS "Notice: libhybris-common.so not found, disabling hybris support") set(ENABLE_HYBRIS_IMPLEMENTATION OFF) endif() include_directories(include) include_directories(android/include) add_subdirectory(data/) add_subdirectory(doc/) add_subdirectory(include/) add_subdirectory(src/) #### Enable tests include(CTest) set(GTEST_ROOT /usr/src/gtest) add_subdirectory(tests/) add_subdirectory(${GTEST_ROOT} ${CMAKE_CURRENT_BINARY_DIR}/gtest) platform-api-0.20+14.04.20140411/COPYING0000644000015301777760000010451312322054725017461 0ustar pbusernogroup00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . platform-api-0.20+14.04.20140411/src/0000755000015301777760000000000012322055312017202 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/src/ubuntu/0000755000015301777760000000000012322055312020524 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/src/ubuntu/application/0000755000015301777760000000000012322055312023027 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/src/ubuntu/application/location/0000755000015301777760000000000012322055312024637 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/src/ubuntu/application/location/heading_update.cpp0000644000015301777760000000270712322054725030321 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voss */ #include "ubuntu/application/location/heading_update.h" #include "heading_update_p.h" #include #include namespace cul = com::ubuntu::location; void ua_location_heading_update_ref( UALocationHeadingUpdate *update) { update->ref(); } void ua_location_heading_update_unref( UALocationHeadingUpdate *update) { update->unref(); } uint64_t ua_location_heading_update_get_timestamp( UALocationHeadingUpdate *update) { return std::chrono::duration_cast( update->update.when.time_since_epoch()).count(); } double ua_location_heading_update_get_heading_in_degree( UALocationHeadingUpdate *update) { return update->update.value.value.value(); } platform-api-0.20+14.04.20140411/src/ubuntu/application/location/position_update.cpp0000644000015301777760000000365112322054725030565 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voss */ #include "ubuntu/application/location/position_update.h" #include "position_update_p.h" #include #include namespace cul = com::ubuntu::location; void ua_location_position_update_ref( UALocationPositionUpdate *update) { update->ref(); } void ua_location_position_update_unref( UALocationPositionUpdate *update) { update->unref(); } uint64_t ua_location_position_update_get_timestamp( UALocationPositionUpdate *update) { return std::chrono::duration_cast( update->update.when.time_since_epoch()).count(); } double ua_location_position_update_get_latitude_in_degree( UALocationPositionUpdate *update) { return update->update.value.latitude().value.value(); } double ua_location_position_update_get_longitude_in_degree( UALocationPositionUpdate *update) { return update->update.value.longitude().value.value(); } bool ua_location_position_update_has_altitude( UALocationPositionUpdate *update) { return update->update.value.has_altitude(); } double ua_location_position_update_get_altitude_in_meter( UALocationPositionUpdate *update) { return update->update.value.altitude().value.value(); } platform-api-0.20+14.04.20140411/src/ubuntu/application/location/velocity_update_p.h0000644000015301777760000000236212322054725030541 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voss */ #ifndef VELOCITY_UPDATE_PRIVATE_H_ #define VELOCITY_UPDATE_PRIVATE_H_ #include "ubuntu/application/location/velocity_update.h" #include "ref_counted.h" #include #include namespace cul = com::ubuntu::location; struct UbuntuApplicationLocationVelocityUpdate : public detail::RefCounted { UbuntuApplicationLocationVelocityUpdate(const cul::Update& update) : update(update) { } const cul::Update& update; }; #endif // VELOCITY_UPDATE_PRIVATE_H_ platform-api-0.20+14.04.20140411/src/ubuntu/application/location/ref_counted.h0000644000015301777760000000234512322054725027320 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voss */ #ifndef REF_COUNTED_H_ #define REF_COUNTED_H_ #include namespace detail { class RefCounted { public: RefCounted(const RefCounted&) = delete; virtual ~RefCounted() = default; RefCounted& operator=(const RefCounted&) = delete; bool operator==(const RefCounted&) const = delete; void ref() { counter.fetch_add(1); } void unref() { if (0 == counter.fetch_sub(1)) { delete this; } } protected: RefCounted() : counter(1) { } private: std::atomic counter; }; } #endif // REF_COUNTED_H_ platform-api-0.20+14.04.20140411/src/ubuntu/application/location/session.cpp0000644000015301777760000001151012322054725027033 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voss */ #include "ubuntu/application/location/session.h" #include "session_p.h" #include "heading_update_p.h" #include "position_update_p.h" #include "velocity_update_p.h" void ua_location_service_session_ref( UALocationServiceSession *session) { auto s = static_cast(session); s->ref(); } void ua_location_service_session_unref( UALocationServiceSession *session) { auto s = static_cast(session); s->unref(); } void ua_location_service_session_set_position_updates_handler( UALocationServiceSession *session, UALocationServiceSessionPositionUpdatesHandler handler, void *context) { auto s = static_cast(session); s->session->install_position_updates_handler( [handler, context](const com::ubuntu::location::Update& new_position) { UbuntuApplicationLocationPositionUpdate pu{new_position}; handler(std::addressof(pu), context); }); } void ua_location_service_session_set_heading_updates_handler( UALocationServiceSession *session, UALocationServiceSessionHeadingUpdatesHandler handler, void *context) { auto s = static_cast(session); s->session->install_heading_updates_handler( [handler, context](const com::ubuntu::location::Update& new_heading) { UbuntuApplicationLocationHeadingUpdate hu{new_heading}; handler(std::addressof(hu), context); }); } void ua_location_service_session_set_velocity_updates_handler( UALocationServiceSession *session, UALocationServiceSessionVelocityUpdatesHandler handler, void *context) { auto s = static_cast(session); s->session->install_velocity_updates_handler( [handler, context](const com::ubuntu::location::Update& new_velocity) { UbuntuApplicationLocationVelocityUpdate vu{new_velocity}; handler(std::addressof(vu), context); }); } UStatus ua_location_service_session_start_position_updates( UALocationServiceSession *session) { auto s = static_cast(session); if (!s) return U_STATUS_ERROR; try { s->session->start_position_updates(); } catch(...) { return U_STATUS_ERROR; } return U_STATUS_SUCCESS; } void ua_location_service_session_stop_position_updates( UALocationServiceSession *session) { auto s = static_cast(session); if (!s) return; try { s->session->stop_position_updates(); } catch(...) { } } UStatus ua_location_service_session_start_heading_updates( UALocationServiceSession *session) { auto s = static_cast(session); if (!s) return U_STATUS_ERROR; try { s->session->start_heading_updates(); } catch(...) { return U_STATUS_ERROR; } return U_STATUS_SUCCESS; } void ua_location_service_session_stop_heading_updates( UALocationServiceSession *session) { auto s = static_cast(session); if (!s) return; try { s->session->stop_heading_updates(); } catch(...) { } } UStatus ua_location_service_session_start_velocity_updates( UALocationServiceSession *session) { auto s = static_cast(session); if (!s) return U_STATUS_ERROR; try { s->session->start_velocity_updates(); } catch(...) { return U_STATUS_ERROR; } return U_STATUS_SUCCESS; } void ua_location_service_session_stop_velocity_updates( UALocationServiceSession *session) { auto s = static_cast(session); if (!s) return; try { s->session->stop_velocity_updates(); } catch(...) { } } platform-api-0.20+14.04.20140411/src/ubuntu/application/location/position_update_p.h0000644000015301777760000000236212322054725030547 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voss */ #ifndef POSITION_UPDATE_PRIVATE_H_ #define POSITION_UPDATE_PRIVATE_H_ #include "ubuntu/application/location/position_update.h" #include "ref_counted.h" #include #include namespace cul = com::ubuntu::location; struct UbuntuApplicationLocationPositionUpdate : public detail::RefCounted { UbuntuApplicationLocationPositionUpdate(const cul::Update& update) : update(update) { } const cul::Update& update; }; #endif // POSITION_UPDATE_PRIVATE_H_ platform-api-0.20+14.04.20140411/src/ubuntu/application/location/CMakeLists.txt0000644000015301777760000000113412322054725027405 0ustar pbusernogroup00000000000000find_package(PkgConfig) find_package(Threads) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -fPIC") pkg_check_modules(DBUS_CPP REQUIRED dbus-cpp) pkg_check_modules(LOCATION_SERVICE REQUIRED ubuntu-location-service) include_directories( ${DBUS_CPP_INCLUDE_DIRS} ${LOCATION_SERVICE_INCLUDE_DIRS} ) add_library( ubuntu_application_location controller.cpp service.cpp session.cpp heading_update.cpp position_update.cpp velocity_update.cpp ) target_link_libraries( ubuntu_application_location ${LOCATION_SERVICE_LDFLAGS} ${DBUS_CPP_LDFLAGS} ${CMAKE_THREAD_LIBS_INIT} ) platform-api-0.20+14.04.20140411/src/ubuntu/application/location/heading_update_p.h0000644000015301777760000000235112322054725030300 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voss */ #ifndef HEADING_UPDATE_PRIVATE_H_ #define HEADING_UPDATE_PRIVATE_H_ #include "ubuntu/application/location/heading_update.h" #include "ref_counted.h" #include #include namespace cul = com::ubuntu::location; struct UbuntuApplicationLocationHeadingUpdate : public detail::RefCounted { UbuntuApplicationLocationHeadingUpdate(const cul::Update& update) : update(update) { } const cul::Update& update; }; #endif // HEADING_UPDATE_PRIVATE_H_ platform-api-0.20+14.04.20140411/src/ubuntu/application/location/controller.cpp0000644000015301777760000000410712322054725027537 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voss */ #include "ubuntu/application/location/controller.h" #include "controller_p.h" void ua_location_service_controller_ref( UALocationServiceController *controller) { controller->ref(); } void ua_location_service_controller_unref( UALocationServiceController *controller) { controller->unref(); } void ua_location_service_controller_set_status_changed_handler( UALocationServiceController *controller, UALocationServiceStatusChangedHandler handler, void *context) { (void) controller; (void) handler; (void) context; } UStatus ua_location_service_controller_query_status( UALocationServiceController *controller, UALocationServiceStatusFlags *out_flags) { (void) controller; (void) out_flags; return U_STATUS_SUCCESS; } UStatus ua_location_service_controller_enable_service( UALocationServiceController *controller) { (void) controller; return U_STATUS_SUCCESS; } UStatus ua_location_service_controller_disable_service( UALocationServiceController *controller) { (void) controller; return U_STATUS_SUCCESS; } UStatus ua_location_service_controller_enable_gps( UALocationServiceController *controller) { (void) controller; return U_STATUS_SUCCESS; } UStatus ua_location_service_controller_disable_gps( UALocationServiceController *controller) { (void) controller; return U_STATUS_SUCCESS; } platform-api-0.20+14.04.20140411/src/ubuntu/application/location/controller_p.h0000644000015301777760000000170412322054725027523 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voss */ #ifndef CONTROLLER_PRIVATE_H_ #define CONTROLLER_PRIVATE_H_ #include "ubuntu/application/location/controller.h" #include "ref_counted.h" struct UbuntuApplicationLocationServiceController : public detail::RefCounted { }; #endif // CONTROLLER_PRIVATE_H_ platform-api-0.20+14.04.20140411/src/ubuntu/application/location/velocity_update.cpp0000644000015301777760000000273612322054725030562 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voss */ #include "ubuntu/application/location/velocity_update.h" #include "velocity_update_p.h" #include #include namespace cul = com::ubuntu::location; void ua_location_velocity_update_ref( UALocationVelocityUpdate *update) { update->ref(); } void ua_location_velocity_update_unref( UALocationVelocityUpdate *update) { update->unref(); } uint64_t ua_location_velocity_update_get_timestamp( UALocationVelocityUpdate *update) { return std::chrono::duration_cast( update->update.when.time_since_epoch()).count(); } double ua_location_velocity_update_get_velocity_in_meters_per_second( UALocationVelocityUpdate *update) { return update->update.value.value.value(); } platform-api-0.20+14.04.20140411/src/ubuntu/application/location/session_p.h0000644000015301777760000000232112322054725027017 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voss */ #ifndef SESSION_PRIVATE_H_ #define SESSION_PRIVATE_H_ #include "ubuntu/application/location/session.h" #include "ref_counted.h" #include namespace culss = com::ubuntu::location::service::session; struct UbuntuApplicationLocationServiceSession : public detail::RefCounted { UbuntuApplicationLocationServiceSession(const culss::Interface::Ptr& session) : session(session) { } culss::Interface::Ptr session; }; #endif // SESSION_PRIVATE_H_ platform-api-0.20+14.04.20140411/src/ubuntu/application/location/service.cpp0000644000015301777760000000475312322054725027023 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voss */ #include "ubuntu/application/location/service.h" #include "controller_p.h" #include "session_p.h" #include #include #include namespace dbus = core::dbus; namespace cul = com::ubuntu::location; namespace culs = com::ubuntu::location::service; namespace { class Instance { public: static Instance& instance() { static Instance inst; return inst; } const culs::Interface::Ptr& get_service() const { return service; } private: Instance() : bus(std::make_shared(dbus::WellKnownBus::system)), executor(dbus::asio::make_executor(bus)), service(dbus::resolve_service_on_bus(bus)) { bus->install_executor(executor); worker = std::move(std::thread([&]() { bus->run(); })); } ~Instance() noexcept { if (worker.joinable()) worker.join(); } dbus::Bus::Ptr bus; dbus::Executor::Ptr executor; culs::Interface::Ptr service; std::thread worker; }; } UALocationServiceSession* ua_location_service_create_session_for_low_accuracy( UALocationServiceRequirementsFlags /*flags*/) { return new UbuntuApplicationLocationServiceSession{ Instance::instance().get_service()->create_session_for_criteria(cul::Criteria{})}; } UALocationServiceSession* ua_location_service_create_session_for_high_accuracy( UALocationServiceRequirementsFlags /*flags*/) { return new UbuntuApplicationLocationServiceSession{ Instance::instance().get_service()->create_session_for_criteria(cul::Criteria{})}; } UALocationServiceController* ua_location_service_create_controller() { return new UbuntuApplicationLocationServiceController{}; } platform-api-0.20+14.04.20140411/src/ubuntu/application/url_dispatcher/0000755000015301777760000000000012322055312026037 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/src/ubuntu/application/url_dispatcher/session.cpp0000644000015301777760000000301312322054725030232 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * */ #include "ubuntu/application/url_dispatcher/session.h" #include #include struct DispatchCallBackData { UAUrlDispatcherSessionDispatchHandler handler; void *user_context; }; static void dispatch_callback(const gchar *url, gboolean success, gpointer user_data) { DispatchCallBackData *data = (DispatchCallBackData*)user_data; if (data->handler) data->handler(success ? U_STATUS_SUCCESS : U_STATUS_ERROR, url, data->user_context); free(data); } void ua_url_dispatcher_session_open( UAUrlDispatcherSession *session, const char *url, UAUrlDispatcherSessionDispatchHandler handler, void *user_context) { DispatchCallBackData *data = (DispatchCallBackData*)malloc(sizeof(DispatchCallBackData)); data->handler = handler; data->user_context = user_context; url_dispatch_send(url, dispatch_callback, data); } platform-api-0.20+14.04.20140411/src/ubuntu/application/url_dispatcher/CMakeLists.txt0000644000015301777760000000057312322054725030613 0ustar pbusernogroup00000000000000find_package(PkgConfig) pkg_check_modules(LIBURL_DISPATCHER REQUIRED url-dispatcher-1) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -fPIC") include_directories(${LIBURL_DISPATCHER_INCLUDE_DIRS}) add_library( ubuntu_application_url_dispatcher service.cpp session.cpp ) target_link_libraries( ubuntu_application_url_dispatcher ${LIBURL_DISPATCHER_LDFLAGS} ) platform-api-0.20+14.04.20140411/src/ubuntu/application/url_dispatcher/session_p.h0000644000015301777760000000135312322054725030223 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * */ struct UbuntuApplicationUrlDispatcherSession { // We don't need anything for the moment }; platform-api-0.20+14.04.20140411/src/ubuntu/application/url_dispatcher/service.cpp0000644000015301777760000000164312322054725030216 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * */ #include "ubuntu/application/url_dispatcher/service.h" #include "session_p.h" #include UAUrlDispatcherSession* ua_url_dispatcher_session() { UAUrlDispatcherSession *session = (UAUrlDispatcherSession*)malloc(sizeof(UAUrlDispatcherSession)); return session; } platform-api-0.20+14.04.20140411/src/ubuntu/application/CMakeLists.txt0000644000015301777760000000007412322054725025577 0ustar pbusernogroup00000000000000add_subdirectory(location) add_subdirectory(url_dispatcher) platform-api-0.20+14.04.20140411/src/ubuntu/mircommon/0000755000015301777760000000000012322055312022524 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/src/ubuntu/mircommon/application_description_mir.cpp0000644000015301777760000000615712322054725031025 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Robert Carr */ #include "application_description_mir_priv.h" namespace uam = ubuntu::application::mir; uam::Description::Description() : application_id(nullptr), lifecycle_delegate(nullptr) { } UApplicationDescription* uam::Description::as_u_application_description() { return static_cast(this); } uam::Description* uam::Description::from_u_application_description(UApplicationDescription* description) { return static_cast(description); } UApplicationDescription* u_application_description_new() { auto description = new uam::Description(); return description->as_u_application_description(); } void u_application_description_destroy(UApplicationDescription *u_description) { auto description = uam::Description::from_u_application_description(u_description); delete description; } void u_application_description_set_application_id(UApplicationDescription *u_description, UApplicationId *id) { auto description = uam::Description::from_u_application_description(u_description); description->application_id = std::unique_ptr>(id, [](UApplicationId *p) { u_application_id_destroy(p); }); } UApplicationId* u_application_description_get_application_id(UApplicationDescription *u_description) { auto description = uam::Description::from_u_application_description(u_description); return description->application_id.get(); } void u_application_description_set_application_lifecycle_delegate(UApplicationDescription *u_description, UApplicationLifecycleDelegate *lifecycle_delegate) { auto description = uam::Description::from_u_application_description(u_description); // TODO: We don't take a ref as it is created with a floating ref but this should be made more explicit... description->lifecycle_delegate = std::unique_ptr>(lifecycle_delegate, [](UApplicationLifecycleDelegate *p) { u_application_lifecycle_delegate_unref(p); }); } UApplicationLifecycleDelegate* u_application_description_get_application_lifecycle_delegate(UApplicationDescription *u_description) { auto description = uam::Description::from_u_application_description(u_description); return description->lifecycle_delegate.get(); } platform-api-0.20+14.04.20140411/src/ubuntu/mircommon/lifecycle_delegate_mir_priv.h0000644000015301777760000000311512322054725030404 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Robert Carr */ #ifndef UBUNTU_APPLICATION_LIECYCLE_DELEGATE_MIR_PRIV_H_ #define UBUNTU_APPLICATION_LIECYCLE_DELEGATE_MIR_PRIV_H_ #include "mir_toolkit/common.h" #include namespace ubuntu { namespace application { namespace mir { class LifecycleDelegate { public: LifecycleDelegate(); ~LifecycleDelegate() = default; UApplicationLifecycleDelegate* as_u_lifecycle_delegate(); static LifecycleDelegate* from_u_lifecycle_delegate(UApplicationLifecycleDelegate *u_delegate); void ref(); void unref(); u_on_application_resumed resumed_cb; u_on_application_about_to_stop stop_cb; void *ctx; protected: LifecycleDelegate(LifecycleDelegate const&) = delete; LifecycleDelegate& operator=(LifecycleDelegate const&) = delete; private: unsigned int ref_count; }; } } } #endif // UBUNTU_APPLICATION_LIECYCLE_DELEGATE_MIR_PRIV_H_ platform-api-0.20+14.04.20140411/src/ubuntu/mircommon/application_id_mir_priv.h0000644000015301777760000000237412322054725027600 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Robert Carr */ #ifndef UBUNTU_APPLICATION_ID_MIR_PRIV_H_ #define UBUNTU_APPLICATION_ID_MIR_PRIV_H_ #include #include namespace ubuntu { namespace application { namespace mir { class Id { public: Id(const char *name, size_t size); ~Id() = default; UApplicationId* as_u_application_id(); static Id* from_u_application_id(UApplicationId* id); std::string const name; protected: Id(const Id&) = delete; Id& operator=(const Id&) = delete; }; } } } // namespace ubuntu #endif // UBUNTU_APPLICATION_ID_MIR_PRIV_H_ platform-api-0.20+14.04.20140411/src/ubuntu/mircommon/lifecycle_delegate_mir.cpp0000644000015301777760000000723412322054725027705 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Robert Carr */ #include "lifecycle_delegate_mir_priv.h" namespace uam = ubuntu::application::mir; uam::LifecycleDelegate::LifecycleDelegate() : resumed_cb(nullptr), stop_cb(nullptr), ctx(nullptr) { } UApplicationLifecycleDelegate* uam::LifecycleDelegate::as_u_lifecycle_delegate() { return static_cast(this); } uam::LifecycleDelegate* uam::LifecycleDelegate::from_u_lifecycle_delegate(UApplicationLifecycleDelegate *u_delegate) { return static_cast(u_delegate); } void uam::LifecycleDelegate::ref() { ref_count++; } void uam::LifecycleDelegate::unref() { ref_count--; if (ref_count == 0) delete this; } extern "C" { UApplicationLifecycleDelegate* u_application_lifecycle_delegate_new() { return (new uam::LifecycleDelegate)->as_u_lifecycle_delegate(); } void u_application_lifecycle_delegate_destroy(UApplicationLifecycleDelegate *u_delegate) { auto delegate = uam::LifecycleDelegate::from_u_lifecycle_delegate(u_delegate); // TODO: What are the intended semantics of this? delegate->unref(); } void u_application_lifecycle_delegate_ref(UApplicationLifecycleDelegate *u_delegate) { auto delegate = uam::LifecycleDelegate::from_u_lifecycle_delegate(u_delegate); delegate->ref(); } void u_application_lifecycle_delegate_unref(UApplicationLifecycleDelegate *u_delegate) { auto delegate = uam::LifecycleDelegate::from_u_lifecycle_delegate(u_delegate); delegate->unref(); } void u_application_lifecycle_delegate_set_application_resumed_cb(UApplicationLifecycleDelegate *u_delegate, u_on_application_resumed cb) { auto delegate = uam::LifecycleDelegate::from_u_lifecycle_delegate(u_delegate); delegate->resumed_cb = cb; } u_on_application_resumed u_application_lifecycle_delegate_get_application_resumed_cb(UApplicationLifecycleDelegate *u_delegate) { auto delegate = uam::LifecycleDelegate::from_u_lifecycle_delegate(u_delegate); return delegate->resumed_cb; } void u_application_lifecycle_delegate_set_application_about_to_stop_cb(UApplicationLifecycleDelegate *u_delegate, u_on_application_about_to_stop cb) { auto delegate = uam::LifecycleDelegate::from_u_lifecycle_delegate(u_delegate); delegate->stop_cb = cb; } u_on_application_about_to_stop u_application_lifecycle_delegate_get_application_about_to_stop_cb(UApplicationLifecycleDelegate *u_delegate) { auto delegate = uam::LifecycleDelegate::from_u_lifecycle_delegate(u_delegate); return delegate->stop_cb; } void u_application_lifecycle_delegate_set_context(UApplicationLifecycleDelegate *u_delegate, void *context) { auto delegate = uam::LifecycleDelegate::from_u_lifecycle_delegate(u_delegate); delegate->ctx = context; } void* u_application_lifecycle_delegate_get_context(UApplicationLifecycleDelegate *u_delegate, void *context) { auto delegate = uam::LifecycleDelegate::from_u_lifecycle_delegate(u_delegate); return delegate->ctx; } } platform-api-0.20+14.04.20140411/src/ubuntu/mircommon/application_options_mir_priv.h0000644000015301777760000000301712322054725030672 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Robert Carr */ #ifndef UBUNTU_APPLICATION_OPTIONS_MIR_PRIV_H_ #define UBUNTU_APPLICATION_OPTIONS_MIR_PRIV_H_ #include #include #include namespace ubuntu { namespace application { namespace mir { class Options { public: Options() = default; ~Options() = default; UApplicationOptions* as_u_application_options(); static Options* from_u_application_options(UApplicationOptions* u_options); UApplicationOperationMode operation_mode = U_APPLICATION_FOREGROUND_APP; UAUiFormFactor form_factor = U_DESKTOP; UAUiStage stage = U_MAIN_STAGE; std::string desktop_file; protected: Options(Options const&) = delete; Options& operator=(Options const&) = delete; }; } } } // namespace ubuntu #endif // UBUNTU_APPLICATION_OPTIONS_MIR_PRIV_H_ platform-api-0.20+14.04.20140411/src/ubuntu/mircommon/session_mir.cpp0000644000015301777760000000272012322054725025572 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Robert Carr */ #include // TODO: Not sure what this should do for mir. ApplicationInstance maps to the mir // concept of a session and this doesn't really seem to be used extern "C" { UAUiSession* ua_ui_session_new_with_properties(UAUiSessionProperties *properties) { return nullptr; } UAUiSessionProperties* ua_ui_session_properties_new() { return nullptr; } void ua_ui_session_properties_set_type(UAUiSessionProperties* properties, UAUiSessionType type) { (void) properties; (void) type; } void ua_ui_session_properties_set_remote_pid(UAUiSessionProperties* properties, uint32_t pid) { (void) properties; (void) pid; } } platform-api-0.20+14.04.20140411/src/ubuntu/mircommon/application_options_mir.cpp0000644000015301777760000001427712322054725030177 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Robert Carr */ #include "application_options_mir_priv.h" #include #include #include #include #include #include #include #include #include namespace uam = ubuntu::application::mir; UApplicationOptions* uam::Options::as_u_application_options() { return static_cast(this); } uam::Options* uam::Options::from_u_application_options(UApplicationOptions* options) { return static_cast(options); } namespace { UAUiStage string_to_stage(std::string const& s) { if (s == "main_stage" || s == "MainStage") return U_MAIN_STAGE; else if (s == "side_stage" || s == "SideStage") return U_SIDE_STAGE; else if (s == "share_stage" || s == "ShareStage") return U_SHARE_STAGE; } UAUiFormFactor string_to_form_factor(std::string const& s) { if (s == "desktop") return U_DESKTOP; else if (s == "phone") return U_PHONE; else if (s == "tablet") return U_TABLET; } void print_help_and_exit() { printf("Usage: executable " "[--form_factor_hint={desktop, phone, tablet}] " "[--stage_hint={main_stage, side_stage, share_stage}] " "[--desktop_file_hint=absolute_path_to_desktop_file]\n"); exit(EXIT_SUCCESS); } } extern "C" { UApplicationOptions* u_application_options_new_from_cmd_line(int argc, char** argv) { static const int uninteresting_flag_value = 0; static struct option long_options[] = { {"form_factor_hint", required_argument, NULL, uninteresting_flag_value}, {"stage_hint", required_argument, NULL, uninteresting_flag_value}, {"desktop_file_hint", required_argument, NULL, uninteresting_flag_value}, {"help", no_argument, NULL, uninteresting_flag_value}, {0, 0, 0, 0} }; static const int form_factor_hint_index = 0; static const int stage_hint_index = 1; static const int desktop_file_hint_index = 2; static const int help_index = 3; auto app_options = new uam::Options; // Construct legacy desktop file path std::string desktop_file_name; if (getenv("APP_ID")) { desktop_file_name = getenv("APP_ID"); desktop_file_name.append(".desktop"); } // Click desktop path std::string local_path; if (getenv("APP_DESKTOP_FILE_PATH")) local_path = getenv("APP_DESKTOP_FILE_PATH");; // Check StageHint std::string line, stage_hint; std::string stage_key("X-Ubuntu-StageHint"); std::ifstream infile; std::string search_paths[2] = {"/usr/share/applications/", local_path}; search_paths[0].append(desktop_file_name); for (std::string path : search_paths) { if (path.empty()) continue; infile.open(path); if (!infile) continue; std::getline(infile, line); while (std::getline(infile, line)) { if (infile.eof()) break; // Check for non key-value line if (line.find("=") == std::string::npos) continue; std::string lhs = line.substr(0,line.find("=")); std::string rhs = line.substr(line.find("=")); // Fetch Stage if (lhs.compare(stage_key) == 0) { stage_hint = rhs.substr(1); break; } } } if (!stage_hint.empty()) app_options->stage = string_to_stage(stage_hint); while(true) { int option_index = 0; int c = getopt_long(argc, argv, "", long_options, &option_index); if (c == -1) break; switch (c) { case 0: // If this option set a flag, do nothing else now. if (long_options[option_index].flag != 0) break; if (option_index == help_index) print_help_and_exit(); if (optarg) { switch(option_index) { case form_factor_hint_index: app_options->form_factor = string_to_form_factor(std::string(optarg)); break; case stage_hint_index: // Override if set app_options->stage = string_to_stage(std::string(optarg)); break; case desktop_file_hint_index: app_options->desktop_file = std::string(optarg); break; } } break; case '?': break; } } return app_options->as_u_application_options(); } void u_application_options_destroy(UApplicationOptions* u_options) { auto options = uam::Options::from_u_application_options(u_options); delete options; } UApplicationOperationMode u_application_options_get_operation_mode(UApplicationOptions *u_options) { auto options = uam::Options::from_u_application_options(u_options); return options->operation_mode; } UAUiFormFactor u_application_options_get_form_factor(UApplicationOptions* u_options) { auto options = uam::Options::from_u_application_options(u_options); return options->form_factor; } UAUiStage u_application_options_get_stage(UApplicationOptions* u_options) { auto options = uam::Options::from_u_application_options(u_options); return options->stage; } } platform-api-0.20+14.04.20140411/src/ubuntu/mircommon/application_id_mir.cpp0000644000015301777760000000305512322054725027070 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Robert Carr */ #include "application_id_mir_priv.h" namespace uam = ubuntu::application::mir; uam::Id::Id(const char *name, size_t size) : name(name, size) { } UApplicationId* uam::Id::as_u_application_id() { return static_cast(this); } uam::Id* uam::Id::from_u_application_id(UApplicationId *id) { return static_cast(id); } UApplicationId* u_application_id_new_from_stringn(const char *string, size_t size) { auto id = new uam::Id(string, size); return id->as_u_application_id(); } void u_application_id_destroy(UApplicationId *u_id) { auto id = uam::Id::from_u_application_id(u_id); delete id; } int u_application_id_compare(UApplicationId* u_lhs, UApplicationId* u_rhs) { auto lhs = uam::Id::from_u_application_id(u_lhs); auto rhs = uam::Id::from_u_application_id(u_rhs); return lhs->name.compare(rhs->name); } platform-api-0.20+14.04.20140411/src/ubuntu/mircommon/event_helpers_mir.cpp0000644000015301777760000001016412322054725026753 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Robert Carr */ #include "event_helpers_mir.h" namespace uaum = ubuntu::application::ui::mir; // TODO: This begs the question: Why does MirEvent exist? It's difficult to ensure this function is kept in sync // at the unit test level. bool uaum::event_to_ubuntu_event(MirEvent const* mir_event, Event& ubuntu_ev) { switch (mir_event->type) { case mir_event_type_key: ubuntu_ev.type = KEY_EVENT_TYPE; ubuntu_ev.device_id = mir_event->key.device_id; ubuntu_ev.source_id = mir_event->key.source_id; ubuntu_ev.action = mir_event->key.action; ubuntu_ev.flags = mir_event->key.flags; ubuntu_ev.meta_state = mir_event->key.modifiers; ubuntu_ev.details.key.key_code = mir_event->key.key_code; ubuntu_ev.details.key.scan_code = mir_event->key.scan_code; ubuntu_ev.details.key.repeat_count = mir_event->key.repeat_count; ubuntu_ev.details.key.down_time = mir_event->key.down_time; ubuntu_ev.details.key.event_time = mir_event->key.event_time; ubuntu_ev.details.key.is_system_key = mir_event->key.is_system_key; return true; case mir_event_type_motion: ubuntu_ev.type = MOTION_EVENT_TYPE; ubuntu_ev.device_id = mir_event->motion.device_id; ubuntu_ev.source_id = mir_event->motion.source_id; ubuntu_ev.action = mir_event->motion.action; ubuntu_ev.flags = mir_event->motion.flags; ubuntu_ev.meta_state = mir_event->motion.modifiers; ubuntu_ev.details.motion.edge_flags = mir_event->motion.edge_flags; ubuntu_ev.details.motion.button_state = mir_event->motion.button_state; ubuntu_ev.details.motion.x_offset = mir_event->motion.x_offset; ubuntu_ev.details.motion.y_offset = mir_event->motion.y_offset; ubuntu_ev.details.motion.x_precision = mir_event->motion.x_precision; ubuntu_ev.details.motion.y_precision = mir_event->motion.y_precision; ubuntu_ev.details.motion.down_time = mir_event->motion.down_time; ubuntu_ev.details.motion.event_time = mir_event->motion.event_time; ubuntu_ev.details.motion.pointer_count = mir_event->motion.pointer_count; for (int i = 0; i < mir_event->motion.pointer_count; i++) { ubuntu_ev.details.motion.pointer_coordinates[i].id = mir_event->motion.pointer_coordinates[i].id; ubuntu_ev.details.motion.pointer_coordinates[i].x = mir_event->motion.pointer_coordinates[i].x; ubuntu_ev.details.motion.pointer_coordinates[i].raw_x = mir_event->motion.pointer_coordinates[i].raw_x; ubuntu_ev.details.motion.pointer_coordinates[i].y = mir_event->motion.pointer_coordinates[i].y; ubuntu_ev.details.motion.pointer_coordinates[i].raw_y = mir_event->motion.pointer_coordinates[i].raw_y; ubuntu_ev.details.motion.pointer_coordinates[i].touch_major = mir_event->motion.pointer_coordinates[i].touch_major; ubuntu_ev.details.motion.pointer_coordinates[i].touch_minor = mir_event->motion.pointer_coordinates[i].touch_minor; ubuntu_ev.details.motion.pointer_coordinates[i].size = mir_event->motion.pointer_coordinates[i].size; ubuntu_ev.details.motion.pointer_coordinates[i].pressure = mir_event->motion.pointer_coordinates[i].pressure; ubuntu_ev.details.motion.pointer_coordinates[i].orientation = mir_event->motion.pointer_coordinates[i].orientation; } return true; default: return false; } } platform-api-0.20+14.04.20140411/src/ubuntu/mircommon/application_description_mir_priv.h0000644000015301777760000000316412322054725031525 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Robert Carr */ #ifndef UBUNTU_APPLICATION_DESCRIPTION_MIR_PRIV_H_ #define UBUNTU_APPLICATION_DESCRIPTION_MIR_PRIV_H_ #include #include #include namespace ubuntu { namespace application { namespace mir { class Description { public: Description(); ~Description() = default; UApplicationDescription* as_u_application_description(); static Description* from_u_application_description(UApplicationDescription* u_description); // TODO Do we really own these? std::unique_ptr> application_id; std::unique_ptr> lifecycle_delegate; protected: Description(Description const&) = delete; Description& operator=(Description const&) = delete; }; } } } // namespace ubuntu #endif // UBUNTU_APPLICATION_DESCRIPTION_MIR_PRIV_H_ platform-api-0.20+14.04.20140411/src/ubuntu/mircommon/CMakeLists.txt0000644000015301777760000000134412322054725025275 0ustar pbusernogroup00000000000000set(SOURCES event_helpers_mir.cpp application_id_mir.cpp application_options_mir.cpp application_description_mir.cpp session_mir.cpp lifecycle_delegate_mir.cpp ) if(ENABLE_HYBRIS_IMPLEMENTATION) list(APPEND SOURCES ../hybris/ubuntu_application_sensors_hybris.cpp ) list(APPEND LINK_LIBRARIES ${Hybris} ) else() list(APPEND SOURCES ubuntu_application_sensors_desktop.cpp ) endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC --std=c++11") include_directories( ${MIRCOMMON_INCLUDE_DIRS} ) add_library( ubuntu_application_api_mircommon STATIC ${SOURCES} ) target_link_libraries( ubuntu_application_api_mircommon ${UBUNTU_APPLICATION_API_LINK_LIBRARIES} ${LINK_LIBRARIES} ) platform-api-0.20+14.04.20140411/src/ubuntu/mircommon/ubuntu_application_sensors_desktop.cpp0000644000015301777760000000746012322054725032460 0ustar pbusernogroup00000000000000/* * Copyright (C) 2012 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voss * Ricardo Mendoza */ #include #include #include #include // Ubuntu Application Sensors. Null desktop implementation // Acceleration Sensor UASensorsAccelerometer* ua_sensors_accelerometer_new() { return NULL; } UStatus ua_sensors_accelerometer_enable(UASensorsAccelerometer*) { return (UStatus) 0; } UStatus ua_sensors_accelerometer_disable(UASensorsAccelerometer*) { return (UStatus) 0; } uint32_t ua_sensors_accelerometer_get_min_delay(UASensorsAccelerometer*) { return 0; } float ua_sensors_accelerometer_get_min_value(UASensorsAccelerometer*) { return 0.0; } float ua_sensors_accelerometer_get_max_value(UASensorsAccelerometer*) { return 0.0; } float ua_sensors_accelerometer_get_resolution(UASensorsAccelerometer*) { return 0.0; } void ua_sensors_accelerometer_set_reading_cb(UASensorsAccelerometer*, on_accelerometer_event_cb, void*) { } // Acceleration Sensor Event uint64_t uas_accelerometer_event_get_timestamp(UASAccelerometerEvent*) { return 0; } float uas_accelerometer_event_get_acceleration_x(UASAccelerometerEvent*) { return 0.0; } float uas_accelerometer_event_get_acceleration_y(UASAccelerometerEvent*) { return 0.0; } float uas_accelerometer_event_get_acceleration_z(UASAccelerometerEvent*) { return 0.0; } // Proximity Sensor UASensorsProximity* ua_sensors_proximity_new() { return NULL; } UStatus ua_sensors_proximity_enable(UASensorsProximity*) { return (UStatus) 0; } UStatus ua_sensors_proximity_disable(UASensorsProximity*) { return (UStatus) 0; } uint32_t ua_sensors_proximity_get_min_delay(UASensorsProximity*) { return 0; } float ua_sensors_proximity_get_min_value(UASensorsProximity*) { return 0.0; } float ua_sensors_proximity_get_max_value(UASensorsProximity*) { return 0.0; } float ua_sensors_proximity_get_resolution(UASensorsProximity*) { return 0.0; } void ua_sensors_proximity_set_reading_cb(UASensorsProximity*, on_proximity_event_cb, void*) { } // Proximity Sensor Event uint64_t uas_proximity_event_get_timestamp(UASProximityEvent*) { return 0; } UASProximityDistance uas_proximity_event_get_distance(UASProximityEvent*) { return (UASProximityDistance) 0; } // Ambient Light Sensor UASensorsLight* ua_sensors_light_new() { return NULL; } UStatus ua_sensors_light_enable(UASensorsLight*) { return (UStatus) 0; } UStatus ua_sensors_light_disable(UASensorsLight*) { return (UStatus) 0; } uint32_t ua_sensors_light_get_min_delay(UASensorsLight*) { return 0; } float ua_sensors_light_get_min_value(UASensorsLight*) { return 0.0; } float ua_sensors_light_get_max_value(UASensorsLight*) { return 0.0; } float ua_sensors_light_get_resolution(UASensorsLight*) { return 0.0; } void ua_sensors_light_set_reading_cb(UASensorsLight*, on_light_event_cb, void*) { } // Ambient Light Sensor Event uint64_t uas_light_event_get_timestamp(UASLightEvent*) { return 0; } float uas_light_event_get_light(UASLightEvent*) { return 0.0; } platform-api-0.20+14.04.20140411/src/ubuntu/mircommon/event_helpers_mir.h0000644000015301777760000000206312322054725026417 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Robert Carr */ #ifndef UBUNTU_EVENT_HELPERS_MIR_COMMON_H_ #define UBUNTU_EVENT_HELPERS_MIR_COMMON_H_ #include #include namespace ubuntu { namespace application { namespace ui { namespace mir { bool event_to_ubuntu_event(MirEvent const* mir_event, Event& ubuntu_ev); } } } } #endif // UBUNTU_EVENT_HELPERS_MIR_COMMON_H_ platform-api-0.20+14.04.20140411/src/ubuntu/hybris/0000755000015301777760000000000012322055312022024 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/src/ubuntu/hybris/bridge.h0000644000015301777760000002133012322054725023437 0ustar pbusernogroup00000000000000/* * Copyright (C) 2012 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voss * Ricardo Mendoza */ #ifndef BRIDGE_H_ #define BRIDGE_H_ #include #include #include #include #include #define HIDDEN_SYMBOL __attribute__ ((visibility ("hidden"))) #ifdef __cplusplus extern "C" { #endif extern void *android_dlopen(const char *filename, int flag); extern void *android_dlsym(void *handle, const char *symbol); #ifdef __cplusplus } #endif namespace internal { /* By default we load the backend from /system/lib/libubuntu_application_api.so * Programs can select a different backend with $UBUNTU_PLATFORM_API_BACKEND, * which either needs to be a full path or just the file name (then it will be * looked up in the usual library search path, see dlopen(3)). */ struct HIDDEN_SYMBOL ToApplication { static const char* path() { static const char* cache = NULL; if (cache == NULL) { cache = secure_getenv("UBUNTU_PLATFORM_API_BACKEND"); if (cache == NULL) cache = "/system/lib/libubuntu_application_api.so"; } return cache; } }; template class HIDDEN_SYMBOL Bridge { public: static Bridge& instance() { static Bridge bridge; return bridge; } void* resolve_symbol(const char* symbol) const { return dlsym_fn(lib_handle, symbol); } protected: Bridge() : lib_handle(android_dlopen(Scope::path(), RTLD_LAZY)) { const char* path = Scope::path(); /* use Android dl functions for Android libs in /system/, glibc dl * functions for others */ if (strncmp(path, "/system/", 8) == 0) { lib_handle = android_dlopen(path, RTLD_LAZY); dlsym_fn = android_dlsym; } else { lib_handle = dlopen(path, RTLD_LAZY); dlsym_fn = dlsym; } } ~Bridge() { // TODO android_dlclose(libcamera_handle); } void* lib_handle; void* (*dlsym_fn) (void*, const char*); }; } #ifdef __cplusplus extern "C" { #endif /**********************************************************/ /*********** Implementation starts here *******************/ /**********************************************************/ #define DLSYM(fptr, sym) if (*(fptr) == NULL) { *((void**)fptr) = (void *) internal::Bridge<>::instance().resolve_symbol(sym); } // this allows DLSYM to return NULL (happens if the backend is not available), // and returns NULL in that case; return_type must be a pointer! #define IMPLEMENT_CTOR0(return_type, symbol) \ return_type symbol() \ { \ static return_type (*f)() = NULL; \ DLSYM(&f, #symbol); \ return f ? f() : NULL;} #define IMPLEMENT_FUNCTION0(return_type, symbol) \ return_type symbol() \ { \ static return_type (*f)() = NULL; \ DLSYM(&f, #symbol); \ return f();} #define IMPLEMENT_VOID_FUNCTION0(symbol) \ void symbol() \ { \ static void (*f)() = NULL; \ DLSYM(&f, #symbol); \ f();} #define IMPLEMENT_FUNCTION1(return_type, symbol, arg1) \ return_type symbol(arg1 _1) \ { \ static return_type (*f)(arg1) = NULL; \ DLSYM(&f, #symbol); \ return f(_1); } // pcs attribute (calling convention) is only defined on ARM, avoid warning on // other platforms #ifdef __arm__ #define __SF_FN_ATTR __attribute__((pcs("aapcs"))) #else #define __SF_FN_ATTR #endif #define IMPLEMENT_SF_FUNCTION1(return_type, symbol, arg1) \ return_type symbol(arg1 _1) \ { \ static return_type (*f)(arg1) __SF_FN_ATTR = NULL; \ DLSYM(&f, #symbol); \ return f(_1); } #define IMPLEMENT_VOID_FUNCTION1(symbol, arg1) \ void symbol(arg1 _1) \ { \ static void (*f)(arg1) = NULL; \ DLSYM(&f, #symbol); \ f(_1); } #define IMPLEMENT_FUNCTION2(return_type, symbol, arg1, arg2) \ return_type symbol(arg1 _1, arg2 _2) \ { \ static return_type (*f)(arg1, arg2) = NULL; \ DLSYM(&f, #symbol); \ return f(_1, _2); } #define IMPLEMENT_VOID_FUNCTION2(symbol, arg1, arg2) \ void symbol(arg1 _1, arg2 _2) \ { \ static void (*f)(arg1, arg2) = NULL; \ DLSYM(&f, #symbol); \ f(_1, _2); } #define IMPLEMENT_FUNCTION3(return_type, symbol, arg1, arg2, arg3) \ return_type symbol(arg1 _1, arg2 _2, arg3 _3) \ { \ static return_type (*f)(arg1, arg2, arg3) = NULL; \ DLSYM(&f, #symbol); \ return f(_1, _2, _3); } #define IMPLEMENT_VOID_FUNCTION3(symbol, arg1, arg2, arg3) \ void symbol(arg1 _1, arg2 _2, arg3 _3) \ { \ static void (*f)(arg1, arg2, arg3) = NULL; \ DLSYM(&f, #symbol); \ f(_1, _2, _3); } #define IMPLEMENT_VOID_FUNCTION4(symbol, arg1, arg2, arg3, arg4) \ void symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4) \ { \ static void (*f)(arg1, arg2, arg3, arg4) = NULL; \ DLSYM(&f, #symbol); \ f(_1, _2, _3, _4); } #define IMPLEMENT_FUNCTION4(return_type, symbol, arg1, arg2, arg3, arg4) \ return_type symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4) \ { \ static return_type (*f)(arg1, arg2, arg3, arg4) = NULL; \ DLSYM(&f, #symbol); \ return f(_1, _2, _3, _4); } #define IMPLEMENT_FUNCTION6(return_type, symbol, arg1, arg2, arg3, arg4, arg5, arg6) \ return_type symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4, arg5 _5, arg6 _6) \ { \ static return_type (*f)(arg1, arg2, arg3, arg4, arg5, arg6) = NULL; \ DLSYM(&f, #symbol); \ return f(_1, _2, _3, _4, _5, _6); } #define IMPLEMENT_VOID_FUNCTION7(symbol, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ void symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4, arg5 _5, arg6 _6, arg7 _7) \ { \ static void (*f)(arg1, arg2, arg3, arg4, arg5, arg6, arg7) = NULL; \ DLSYM(&f, #symbol); \ f(_1, _2, _3, _4, _5, _6, _7); } #define IMPLEMENT_VOID_FUNCTION8(symbol, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \ void symbol(arg1 _1, arg2 _2, arg3 _3, arg4 _4, arg5 _5, arg6 _6, arg7 _7, arg8 _8) \ { \ static void (*f)(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) = NULL; \ DLSYM(&f, #symbol); \ f(_1, _2, _3, _4, _5, _6, _7, _8); } #ifdef __cplusplus } #endif #endif // BRIDGE_H_ platform-api-0.20+14.04.20140411/src/ubuntu/hybris/tests/0000755000015301777760000000000012322055312023166 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/src/ubuntu/hybris/tests/test_multiple_surfaces_event_delivery.cpp0000644000015301777760000002335312322054725033600 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #include #include #include #include #include #include #include #include #include #include #include struct View { static const char* vertex_shader(); static const char* fragment_shader(); static GLuint load_shader(GLenum shaderType, const char* pSource); static GLuint create_program(const char* pVertexSource, const char* pFragmentSource); static const GLfloat* triangle() { static const GLfloat result[] = { -0.125f, -0.125f, 0.0f, 0.5f, 0.0f, 0.125f, 0.0f, 0.5f, 0.125f, -0.125f, 0.0f, 0.5f }; return result; } static const GLfloat* color_triangle() { static const GLfloat result[] = { 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f }; return result; } View(UAUiWindow* surface); void render(); void step(); UAUiWindow* surface; EGLDisplay egl_display; EGLSurface egl_surface; EGLConfig egl_config; EGLContext egl_context; GLfloat rotation_angle; GLuint gProgram; GLuint gvPositionHandle, gvColorHandle; GLuint rotation_uniform; GLint num_vertex; const GLfloat * vertex_data; const GLfloat * color_data; }; void on_new_event(void* ctx, const Event* ev) { int* surface = (int*) ctx; printf("%s for surface: %d \n", __PRETTY_FUNCTION__, *surface); } int main(int argc, char** argv) { UApplicationOptions* options = u_application_options_new_from_cmd_line(argc, argv); UApplicationDescription* desc = u_application_description_new(); UApplicationId* id = u_application_id_new_from_stringn("UbuntuApplicationCAPI", 21); u_application_description_set_application_id(desc, id); UApplicationInstance* instance = u_application_instance_new_from_description_with_options(desc, options); UAUiSessionProperties* props = ua_ui_session_properties_new(); ua_ui_session_properties_set_type(props, U_USER_SESSION); UAUiSession* ua_ui_session_new_with_properties(props); UAUiDisplay* display = ua_ui_display_new_with_index(0); printf("Display resolution: (x,y) = (%d,%d)\n", ua_ui_display_query_horizontal_res(display), ua_ui_display_query_vertical_res(display)); int i = 1, j = 2; UAUiWindowProperties* wprops1 = ua_ui_window_properties_new_for_normal_window(); ua_ui_window_properties_set_titlen(wprops1, "Window 1", 8); ua_ui_window_properties_set_role(wprops1, U_MAIN_ROLE); ua_ui_window_properties_set_input_cb_and_ctx(wprops1, on_new_event, &i); UAUiWindow* surface1 = ua_ui_window_new_for_application_with_properties(instance, wprops1); UAUiWindowProperties* wprops2 = ua_ui_window_properties_new_for_normal_window(); ua_ui_window_properties_set_titlen(wprops2, "Window 2", 8); ua_ui_window_properties_set_role(wprops2, U_MAIN_ROLE); ua_ui_window_properties_set_input_cb_and_ctx(wprops2, on_new_event, &j); UAUiWindow* surface2 = ua_ui_window_new_for_application_with_properties(instance, wprops2); View view1(surface1); View view2(surface2); while(true) { view1.render(); view2.render(); view1.step(); view2.step(); } } const char* View::vertex_shader() { static const char shader[] = "attribute vec4 vPosition;\n" "attribute vec4 vColor;\n" "uniform float angle;\n" "varying vec4 colorinfo;\n" "void main() {\n" " mat3 rot_z = mat3( vec3( cos(angle), sin(angle), 0.0),\n" " vec3(-sin(angle), cos(angle), 0.0),\n" " vec3( 0.0, 0.0, 1.0));\n" " gl_Position = vec4(rot_z * vPosition.xyz, 1.0);\n" " colorinfo = vColor;\n" "}\n"; return shader; } const char* View::fragment_shader() { static const char shader[] = "precision mediump float;\n" "varying vec4 colorinfo;\n" "void main() {\n" " gl_FragColor = colorinfo;\n" "}\n"; return shader; } GLuint View::load_shader(GLenum shaderType, const char* pSource) { GLuint shader = glCreateShader(shaderType); if (shader) { glShaderSource(shader, 1, &pSource, NULL); glCompileShader(shader); GLint compiled = 0; glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled); if (!compiled) { GLint infoLen = 0; glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen); if (infoLen) { char* buf = (char*) malloc(infoLen); if (buf) { glGetShaderInfoLog(shader, infoLen, NULL, buf); fprintf(stderr, "Could not compile shader %d:\n%s\n", shaderType, buf); free(buf); } glDeleteShader(shader); shader = 0; } } } else { printf("Error, during shader creation: %i\n", glGetError()); } return shader; } GLuint View::create_program(const char* pVertexSource, const char* pFragmentSource) { GLuint vertexShader = load_shader(GL_VERTEX_SHADER, pVertexSource); if (!vertexShader) { printf("vertex shader not compiled\n"); return 0; } GLuint pixelShader = load_shader(GL_FRAGMENT_SHADER, pFragmentSource); if (!pixelShader) { printf("frag shader not compiled\n"); return 0; } GLuint program = glCreateProgram(); if (program) { glAttachShader(program, vertexShader); glAttachShader(program, pixelShader); glLinkProgram(program); GLint linkStatus = GL_FALSE; glGetProgramiv(program, GL_LINK_STATUS, &linkStatus); if (linkStatus != GL_TRUE) { GLint bufLength = 0; glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength); if (bufLength) { char* buf = (char*) malloc(bufLength); if (buf) { glGetProgramInfoLog(program, bufLength, NULL, buf); fprintf(stderr, "Could not link program:\n%s\n", buf); free(buf); } } glDeleteProgram(program); program = 0; } } return program; } View::View(UAUiWindow* surface) : surface(surface), rotation_angle(0.f), num_vertex(3) { // assert(eglBindAPI(EGL_OPENGL_ES_API) == EGL_TRUE); egl_display = eglGetDisplay(EGL_DEFAULT_DISPLAY); assert(egl_display != EGL_NO_DISPLAY); EGLint major, minor; if (EGL_FALSE == eglInitialize(egl_display, &major, &minor)) { printf("egl error: problem initializing.\n"); exit(1); } EGLint attribs[] = { EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_NONE }; EGLint n; if (EGL_FALSE == eglChooseConfig( egl_display, attribs, &egl_config, 1, &n)) { printf("egl error: Cannot choose configuration.\n"); } EGLint context_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; egl_context = eglCreateContext( egl_display, egl_config, EGL_NO_CONTEXT, context_attribs); assert(EGL_NO_CONTEXT != egl_context); EGLNativeWindowType nativeWindow = ua_ui_window_get_native_type(surface); egl_surface = eglCreateWindowSurface(egl_display, egl_config, nativeWindow, NULL); eglMakeCurrent( egl_display, egl_surface, egl_surface, egl_context); vertex_data = triangle(); color_data = color_triangle(); gProgram = create_program(vertex_shader(), fragment_shader()); if (!gProgram) { printf("error making program\n"); return; } gvPositionHandle = glGetAttribLocation(gProgram, "vPosition"); gvColorHandle = glGetAttribLocation(gProgram, "vColor"); rotation_uniform = glGetUniformLocation(gProgram, "angle"); return; } void View::render() { eglMakeCurrent( egl_display, egl_surface, egl_surface, egl_context); glUseProgram(gProgram); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); glUniform1fv(rotation_uniform, 1, &rotation_angle); glVertexAttribPointer( gvColorHandle, num_vertex, GL_FLOAT, GL_FALSE, sizeof(GLfloat)*4, color_data); glVertexAttribPointer( gvPositionHandle, num_vertex, GL_FLOAT, GL_FALSE, 0, vertex_data); glEnableVertexAttribArray(gvPositionHandle); glEnableVertexAttribArray(gvColorHandle); glDrawArrays(GL_TRIANGLE_STRIP, 0, num_vertex); glDisableVertexAttribArray(gvPositionHandle); glDisableVertexAttribArray(gvColorHandle); eglSwapBuffers(egl_display, egl_surface); } void View::step() { rotation_angle += 0.01; } platform-api-0.20+14.04.20140411/src/ubuntu/hybris/tests/test_gps_api.cpp0000644000015301777760000001455712322054725026376 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by: Daniel d'Andrada */ #include #include #include #include #include #include namespace ubuntu { class GPSTest { public: GPSTest(); ~GPSTest(); bool init_and_start(); bool stop(); void inject_time(); UHardwareGps u_hardware_gps; }; void gps_location_cb(UHardwareGpsLocation* location, void* context) { printf("gps_location_cb() called.\n"); } void gps_status_cb(uint16_t status, void* context) { switch(status) { case U_HARDWARE_GPS_STATUS_NONE: printf("status: None\n"); break; case U_HARDWARE_GPS_STATUS_SESSION_BEGIN: printf("status: Session Begin\n"); break; case U_HARDWARE_GPS_STATUS_SESSION_END: printf("status: Session End\n"); break; case U_HARDWARE_GPS_STATUS_ENGINE_ON: printf("status: Engine On\n"); break; case U_HARDWARE_GPS_STATUS_ENGINE_OFF: printf("status: Engine Off\n"); default: break; }; } void gps_sb_status_cb(UHardwareGpsSvStatus* sv_info, void* context) { printf("gps_sb_status_cb() called, listing %d space vehicles\n", sv_info->num_svs); } void gps_nmea_cb(int64_t timestamp, const char* nmea, int length, void* context) { char str[length+1]; memcpy(str, nmea, length); str[length] = 0; printf("gps_nmea_cb() - %s\n", str); } void gps_set_cabapilities_cb(uint32_t capabilities, void* context) { printf("gps_set_cabapilities_cb() -"); if (capabilities & U_HARDWARE_GPS_CAPABILITY_SCHEDULING) printf(" scheduling"); if (capabilities & U_HARDWARE_GPS_CAPABILITY_MSB) printf(" MSB"); if (capabilities & U_HARDWARE_GPS_CAPABILITY_MSA) printf(" MSA"); if (capabilities & U_HARDWARE_GPS_CAPABILITY_SINGLE_SHOT) printf(" 'single shot'"); if (capabilities & U_HARDWARE_GPS_CAPABILITY_ON_DEMAND_TIME) printf(" 'on demand time'"); printf("\n"); } void gps_request_utc_time_cb(void* context) { printf("gps_request_utc_time_cb() called.\n"); ((GPSTest*)context)->inject_time(); } void gps_xtra_download_request_cb(void* context) { printf("gps_xtra_download_request_cb() called.\n"); } void agps_status_cb(UHardwareGpsAGpsStatus* status, void* context) { printf("agps status -"); if (status->type == U_HARDWARE_GPS_AGPS_TYPE_SUPL) printf(" SUPL"); else printf(" C2K"); switch (status->status) { case U_HARDWARE_GPS_REQUEST_AGPS_DATA_CONN: printf(", request AGPS data connection"); break; case U_HARDWARE_GPS_RELEASE_AGPS_DATA_CONN: printf(", release AGPS data connection"); break; case U_HARDWARE_GPS_AGPS_DATA_CONNECTED: printf(", request AGPS data connected"); break; case U_HARDWARE_GPS_AGPS_DATA_CONN_DONE: printf(", AGPS data connection done"); break; default: case U_HARDWARE_GPS_AGPS_DATA_CONN_FAILED: printf(", AGPS data connection failed"); break; } printf(" ipaddr=%u\n", status->ipaddr); } void gps_notify_cb(UHardwareGpsNiNotification *notification, void* context) { printf("gps_notify_cb() called.\n"); } void agps_ril_request_set_id_cb(uint32_t flags, void* context) { printf("agps_ril_request_set_id_cb() called.\n"); } void agps_ril_request_refloc_cb(uint32_t flags, void* context) { printf("agps_ril_request_refloc_cb() called.\n"); } GPSTest::GPSTest() : u_hardware_gps(NULL) { } GPSTest::~GPSTest() { if (u_hardware_gps) u_hardware_gps_delete(u_hardware_gps); } void GPSTest::inject_time() { // A real implementation would inject time from some NTP server. time_t t = time(0); int64_t time_millis = (int64_t)t * (int64_t)1000; u_hardware_gps_inject_time(u_hardware_gps, time_millis /*NTP time would go here*/, time_millis /*internal time when that NTP time was taken*/, 10 /* possible deviation, in milliseconds*/); } bool GPSTest::init_and_start() { UHardwareGpsParams gps_params; gps_params.location_cb = gps_location_cb; gps_params.status_cb = gps_status_cb; gps_params.sv_status_cb = gps_sb_status_cb; gps_params.nmea_cb = gps_nmea_cb; gps_params.set_capabilities_cb = gps_set_cabapilities_cb; gps_params.request_utc_time_cb = gps_request_utc_time_cb; gps_params.xtra_download_request_cb = gps_xtra_download_request_cb; gps_params.agps_status_cb = agps_status_cb; gps_params.gps_ni_notify_cb = gps_notify_cb; gps_params.request_setid_cb = agps_ril_request_set_id_cb; gps_params.request_refloc_cb = agps_ril_request_refloc_cb; gps_params.context = this; UHardwareGps u_hardware_gps = u_hardware_gps_new(&gps_params); if (!u_hardware_gps) { printf("GPS creation failed!\n"); return false; } bool ok = u_hardware_gps_start(u_hardware_gps); if (!ok) { printf("GPS start up failed!\n"); return false; } return true; } bool GPSTest::stop() { bool ok = u_hardware_gps_stop(u_hardware_gps); if (!ok) printf("failed when stopping GPS!\n"); return ok; } } void wait_for_sigint() { sigset_t signals; sigemptyset(&signals); sigaddset(&signals, SIGINT); int sig; int result = sigwait(&signals, &sig); if (result != 0) printf("sigwait failed!\n"); } int main(int argc, char** argv) { int return_value = 0; ubuntu::GPSTest test; if (!test.init_and_start()) return 1; printf("GPS initialized and started. Now waiting for callbacks or SIGINT (to quit).\n"); wait_for_sigint(); printf("Exiting...\n"); if (!test.stop()) return 1; printf("GPS stopped.\n"); return 0; } platform-api-0.20+14.04.20140411/src/ubuntu/hybris/tests/test_sensors_api.cpp0000644000015301777760000000572212322054725027273 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza */ #include #include #include #define __STDC_FORMAT_MACROS #include #include #include #include void on_new_accelerometer_event(UASAccelerometerEvent* event, void* context) { printf("%s \n", __PRETTY_FUNCTION__); printf("\ttime: %" PRIu64 "\n", uas_accelerometer_event_get_timestamp(event)); printf("\tx: %f\n", uas_accelerometer_event_get_acceleration_x(event)); printf("\ty: %f\n", uas_accelerometer_event_get_acceleration_y(event)); printf("\tz: %f\n", uas_accelerometer_event_get_acceleration_z(event)); } void on_new_proximity_event(UASProximityEvent* event, void* context) { printf("%s \n", __PRETTY_FUNCTION__); printf("\ttime: %" PRIu64 "\n", uas_proximity_event_get_timestamp(event)); switch (uas_proximity_event_get_distance(event)) { case U_PROXIMITY_NEAR: { printf("\tdistance: NEAR\n"); break; } case U_PROXIMITY_FAR: { printf("\tdistance: FAR\n"); break; } } } void on_new_light_event(UASLightEvent* event, void* context) { printf("%s \n", __PRETTY_FUNCTION__); printf("\ttime: %" PRIu64 "\n", uas_light_event_get_timestamp(event)); printf("\tlight: %f\n", uas_light_event_get_light(event)); } int main(int argc, char** argv) { UASensorsAccelerometer* accelerometer = ua_sensors_accelerometer_new(); UASensorsProximity* proximity = ua_sensors_proximity_new(); UASensorsLight* ambientlight = ua_sensors_light_new(); ua_sensors_accelerometer_set_reading_cb(accelerometer, on_new_accelerometer_event, NULL); ua_sensors_proximity_set_reading_cb(proximity, on_new_proximity_event, NULL); ua_sensors_light_set_reading_cb(ambientlight, on_new_light_event, NULL); ua_sensors_accelerometer_enable(accelerometer); ua_sensors_proximity_enable(proximity); ua_sensors_light_enable(ambientlight); while(true) { } } platform-api-0.20+14.04.20140411/src/ubuntu/hybris/tests/test_c_api.cpp0000644000015301777760000002205112322054725026013 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #include #include #include #include #include #include #include #include #include #include #include struct View { static const char* vertex_shader(); static const char* fragment_shader(); static GLuint load_shader(GLenum shaderType, const char* pSource); static GLuint create_program(const char* pVertexSource, const char* pFragmentSource); static const GLfloat* triangle() { static const GLfloat result[] = { -0.125f, -0.125f, 0.0f, 0.5f, 0.0f, 0.125f, 0.0f, 0.5f, 0.125f, -0.125f, 0.0f, 0.5f }; return result; } static const GLfloat* color_triangle() { static const GLfloat result[] = { 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f }; return result; } View(UAUiWindow* surface); void render(); void step(); UAUiWindow* surface; EGLDisplay egl_display; EGLSurface egl_surface; EGLConfig egl_config; EGLContext egl_context; GLfloat rotation_angle; GLuint gProgram; GLuint gvPositionHandle, gvColorHandle; GLuint rotation_uniform; GLint num_vertex; const GLfloat * vertex_data; const GLfloat * color_data; }; void on_new_event(void* ctx, const Event* ev) { } int main(int argc, char** argv) { UApplicationOptions* options = u_application_options_new_from_cmd_line(argc, argv); UApplicationDescription* desc = u_application_description_new(); UApplicationId* id = u_application_id_new_from_stringn("UbuntuApplicationCAPI", 21); u_application_description_set_application_id(desc, id); UApplicationInstance* instance = u_application_instance_new_from_description_with_options(desc, options); UAUiSessionProperties* props = ua_ui_session_properties_new(); ua_ui_session_properties_set_type(props, U_USER_SESSION); UAUiSession* ua_ui_session_new_with_properties(props); UAUiDisplay* display = ua_ui_display_new_with_index(0); printf("Display resolution: (x,y) = (%d,%d)\n", ua_ui_display_query_horizontal_res(display), ua_ui_display_query_vertical_res(display)); UAUiWindowProperties* wprops = ua_ui_window_properties_new_for_normal_window(); ua_ui_window_properties_set_titlen(wprops, "Window 1", 8); ua_ui_window_properties_set_role(wprops, U_MAIN_ROLE); ua_ui_window_properties_set_input_cb_and_ctx(wprops, on_new_event, NULL); UAUiWindow* surface = ua_ui_window_new_for_application_with_properties(instance, wprops); View view(surface); while(true) { view.render(); view.step(); } } const char* View::vertex_shader() { static const char shader[] = "attribute vec4 vPosition;\n" "attribute vec4 vColor;\n" "uniform float angle;\n" "varying vec4 colorinfo;\n" "void main() {\n" " mat3 rot_z = mat3( vec3( cos(angle), sin(angle), 0.0),\n" " vec3(-sin(angle), cos(angle), 0.0),\n" " vec3( 0.0, 0.0, 1.0));\n" " gl_Position = vec4(rot_z * vPosition.xyz, 1.0);\n" " colorinfo = vColor;\n" "}\n"; return shader; } const char* View::fragment_shader() { static const char shader[] = "precision mediump float;\n" "varying vec4 colorinfo;\n" "void main() {\n" " gl_FragColor = colorinfo;\n" "}\n"; return shader; } GLuint View::load_shader(GLenum shaderType, const char* pSource) { GLuint shader = glCreateShader(shaderType); if (shader) { glShaderSource(shader, 1, &pSource, NULL); glCompileShader(shader); GLint compiled = 0; glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled); if (!compiled) { GLint infoLen = 0; glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen); if (infoLen) { char* buf = (char*) malloc(infoLen); if (buf) { glGetShaderInfoLog(shader, infoLen, NULL, buf); fprintf(stderr, "Could not compile shader %d:\n%s\n", shaderType, buf); free(buf); } glDeleteShader(shader); shader = 0; } } } else { printf("Error, during shader creation: %i\n", glGetError()); } return shader; } GLuint View::create_program(const char* pVertexSource, const char* pFragmentSource) { GLuint vertexShader = load_shader(GL_VERTEX_SHADER, pVertexSource); if (!vertexShader) { printf("vertex shader not compiled\n"); return 0; } GLuint pixelShader = load_shader(GL_FRAGMENT_SHADER, pFragmentSource); if (!pixelShader) { printf("frag shader not compiled\n"); return 0; } GLuint program = glCreateProgram(); if (program) { glAttachShader(program, vertexShader); glAttachShader(program, pixelShader); glLinkProgram(program); GLint linkStatus = GL_FALSE; glGetProgramiv(program, GL_LINK_STATUS, &linkStatus); if (linkStatus != GL_TRUE) { GLint bufLength = 0; glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength); if (bufLength) { char* buf = (char*) malloc(bufLength); if (buf) { glGetProgramInfoLog(program, bufLength, NULL, buf); fprintf(stderr, "Could not link program:\n%s\n", buf); free(buf); } } glDeleteProgram(program); program = 0; } } return program; } View::View(UAUiWindow* surface) : surface(surface), rotation_angle(0.f), num_vertex(3) { // assert(eglBindAPI(EGL_OPENGL_ES_API) == EGL_TRUE); egl_display = eglGetDisplay(EGL_DEFAULT_DISPLAY); assert(egl_display != EGL_NO_DISPLAY); EGLint major, minor; if (EGL_FALSE == eglInitialize(egl_display, &major, &minor)) { printf("egl error: problem initializing.\n"); exit(1); } EGLint attribs[] = { EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_NONE }; EGLint n; if (EGL_FALSE == eglChooseConfig( egl_display, attribs, &egl_config, 1, &n)) { printf("egl error: Cannot choose configuration.\n"); } EGLint context_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; egl_context = eglCreateContext( egl_display, egl_config, EGL_NO_CONTEXT, context_attribs); assert(EGL_NO_CONTEXT != egl_context); EGLNativeWindowType nativeWindow = ua_ui_window_get_native_type(surface); egl_surface = eglCreateWindowSurface(egl_display, egl_config, nativeWindow, NULL); eglMakeCurrent( egl_display, egl_surface, egl_surface, egl_context); vertex_data = triangle(); color_data = color_triangle(); gProgram = create_program(vertex_shader(), fragment_shader()); if (!gProgram) { printf("error making program\n"); return; } gvPositionHandle = glGetAttribLocation(gProgram, "vPosition"); gvColorHandle = glGetAttribLocation(gProgram, "vColor"); rotation_uniform = glGetUniformLocation(gProgram, "angle"); return; } void View::render() { glUseProgram(gProgram); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); glUniform1fv(rotation_uniform, 1, &rotation_angle); glVertexAttribPointer( gvColorHandle, num_vertex, GL_FLOAT, GL_FALSE, sizeof(GLfloat)*4, color_data); glVertexAttribPointer( gvPositionHandle, num_vertex, GL_FLOAT, GL_FALSE, 0, vertex_data); glEnableVertexAttribArray(gvPositionHandle); glEnableVertexAttribArray(gvColorHandle); glDrawArrays(GL_TRIANGLE_STRIP, 0, num_vertex); glDisableVertexAttribArray(gvPositionHandle); glDisableVertexAttribArray(gvColorHandle); eglSwapBuffers(egl_display, egl_surface); } void View::step() { rotation_angle += 0.01; } platform-api-0.20+14.04.20140411/src/ubuntu/hybris/tests/test_session_c_api.cpp0000644000015301777760000001362112322054725027561 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #include #include #include #include #include #include typedef union { struct Components { uint8_t r; uint8_t g; uint8_t b; uint8_t a; } components; uint32_t value; } Pixel; struct Config { Config() : take_screencast_flag(0), take_screenshot_flag(0) { } int take_screencast_flag; int take_screenshot_flag; }; void on_snapshot_completed(const void* pixel_data, unsigned int width, unsigned int height, unsigned int x, unsigned int y, unsigned int source_width, unsigned int source_height, unsigned int stride, void* context) { static unsigned int counter = 0; printf("%s: (%p, %d, %d, %d) \n", __PRETTY_FUNCTION__, pixel_data, width, height, stride); static const char snapshot_pattern[] = "./snapshot_%I_%M_%S.ppm"; static const char frame_pattern[] = "./frame_%I_%M_%S.raw"; char fn[256]; int take_screenshot = 1; int take_screencast = 0; if (context != NULL) { Config* config = (Config*) context; take_screenshot = config->take_screenshot_flag; take_screencast = config->take_screencast_flag; } time_t curtime; struct tm *loctime; curtime = time (NULL); loctime = localtime (&curtime); static const char screenshot_file_mode[] = "w+"; static const char screencast_file_mode[] = "wb+"; FILE* f = NULL; if (take_screenshot) { strftime(fn, 256, snapshot_pattern, loctime); f = fopen(fn, screenshot_file_mode); } else if (take_screencast) { strftime(fn, 256, frame_pattern, loctime); f = fopen(fn, screencast_file_mode); } if (!f) { printf("Problem opening file: %s \n", fn); return; } if (take_screenshot) { const unsigned int* p = static_cast(pixel_data); fprintf(f, "P3\n%d %d\n%d\n\n", width, height, 255); for(unsigned int i = 0; i < height; i++) { for(unsigned int j = 0; j < width; j++) { Pixel pixel; pixel.value = *p; ++p; fprintf( f, "%d %d %d\t", pixel.components.r, pixel.components.g, pixel.components.b); } } } else if (take_screencast) { fwrite(pixel_data, sizeof(unsigned int), width*height, f); ubuntu_ui_session_snapshot_running_session_with_id( -1, on_snapshot_completed, context); } } void on_session_born(ubuntu_ui_session_properties props, void*) { printf("%s:\n\t Id: %d \n\t Desktop file hint: %s \n", __PRETTY_FUNCTION__, ubuntu_ui_session_properties_get_application_instance_id(props), ubuntu_ui_session_properties_get_desktop_file_hint(props)); ubuntu_ui_session_snapshot_running_session_with_id( ubuntu_ui_session_properties_get_application_instance_id(props), on_snapshot_completed, NULL); } void on_session_focused(ubuntu_ui_session_properties props, void*) { printf("%s:\n\t Id: %d \n\t Desktop file hint: %s \n", __PRETTY_FUNCTION__, ubuntu_ui_session_properties_get_application_instance_id(props), ubuntu_ui_session_properties_get_desktop_file_hint(props)); } void on_session_died(ubuntu_ui_session_properties props, void*) { printf("%s:\n\t Id: %d \n\t Desktop file hint: %s \n", __PRETTY_FUNCTION__, ubuntu_ui_session_properties_get_application_instance_id(props), ubuntu_ui_session_properties_get_desktop_file_hint(props)); } Config parse_cmd_line(int argc, char** argv) { Config config; static struct option long_options[] = { {"take-screencast", no_argument, &config.take_screencast_flag, 1}, {"take-screenshot", no_argument, &config.take_screenshot_flag, 1} }; while (true) { int option_index = 0; int c = getopt_long( argc, argv, "", long_options, &option_index); if (c == -1) break; switch (c) { case 0: // No need to do anything here: Flag is set automatically. break; default: break; } } return config; } int main(int argc, char** argv) { static const int complete_session_id = -1; Config config = parse_cmd_line(argc, argv); if (config.take_screenshot_flag || config.take_screencast_flag) { ubuntu_ui_session_snapshot_running_session_with_id( complete_session_id, on_snapshot_completed, &config); return 0; } ubuntu_ui_session_lifecycle_observer observer; memset(&observer, 0, sizeof(observer)); observer.on_session_born = on_session_born; observer.on_session_focused = on_session_focused; observer.on_session_died = on_session_died; ubuntu_ui_session_install_session_lifecycle_observer(&observer); while(true) { } return 0; } platform-api-0.20+14.04.20140411/src/ubuntu/hybris/tests/CMakeLists.txt0000644000015301777760000000226212322054725025737 0ustar pbusernogroup00000000000000set(SOURCES ubuntu_application_api_hybris.cpp) add_executable(test_android_ubuntu_app_api test_c_api.cpp) target_link_libraries(test_android_ubuntu_app_api ubuntu_application_api EGL GLESv2) add_executable(test_android_gps_api test_gps_api.cpp) target_link_libraries(test_android_gps_api ubuntu_platform_hardware_api) add_executable(test_android_ubuntu_app_api_multiple_surfaces test_multiple_surfaces_event_delivery.cpp) target_link_libraries(test_android_ubuntu_app_api_multiple_surfaces ubuntu_application_api EGL GLESv2) add_executable(test_android_sensors_api test_sensors_api.cpp) target_link_libraries(test_android_sensors_api ubuntu_application_api) add_executable(test_android_ubuntu_session_api test_session_c_api.cpp) target_link_libraries(test_android_ubuntu_session_api ubuntu_application_api) add_executable(test_ubuntu_app_api_location_service test_location_api.cpp) target_link_libraries(test_ubuntu_app_api_location_service ubuntu_application_api) install(TARGETS test_android_ubuntu_app_api test_android_gps_api test_android_ubuntu_app_api_multiple_surfaces test_android_sensors_api test_android_ubuntu_session_api test_ubuntu_app_api_location_service DESTINATION bin ) platform-api-0.20+14.04.20140411/src/ubuntu/hybris/tests/test_location_api.cpp0000644000015301777760000000636412322054725027412 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #include #include #include #include #include #include #include #define __STDC_FORMAT_MACROS #include namespace { void on_position_updated(UALocationPositionUpdate* update, void*) { printf("%s@%" PRIu64 ": (%f, %f, %f) \n", __PRETTY_FUNCTION__, ua_location_position_update_get_timestamp(update), ua_location_position_update_get_latitude_in_degree(update), ua_location_position_update_get_longitude_in_degree(update), ua_location_position_update_has_altitude(update) ? ua_location_position_update_get_altitude_in_meter(update) : 0); } void on_heading_updated(UALocationHeadingUpdate* update, void*) { printf("%s@%" PRIu64 ": %f \n", __PRETTY_FUNCTION__, ua_location_heading_update_get_timestamp(update), ua_location_heading_update_get_heading_in_degree(update)); } void on_velocity_updated(UALocationVelocityUpdate* update, void*) { printf("%s@%" PRIu64 ": %f \n", __PRETTY_FUNCTION__, ua_location_velocity_update_get_timestamp(update), ua_location_velocity_update_get_velocity_in_meters_per_second(update)); } void wait_for_sigint() { sigset_t signals; sigemptyset(&signals); sigaddset(&signals, SIGINT); int sig; int result = sigwait(&signals, &sig); if (result != 0) printf("sigwait failed!\n"); } } int main(int argc, char** argv) { UALocationServiceSession* session = ua_location_service_create_session_for_high_accuracy(0); ua_location_service_session_set_position_updates_handler( session, on_position_updated, NULL); ua_location_service_session_set_heading_updates_handler( session, on_heading_updated, NULL); ua_location_service_session_set_velocity_updates_handler( session, on_velocity_updated, NULL); ua_location_service_session_start_position_updates(session); ua_location_service_session_start_heading_updates(session); ua_location_service_session_start_velocity_updates(session); wait_for_sigint(); ua_location_service_session_stop_position_updates(session); ua_location_service_session_stop_heading_updates(session); ua_location_service_session_stop_velocity_updates(session); ua_location_service_session_unref(session); return 0; } platform-api-0.20+14.04.20140411/src/ubuntu/hybris/ubuntu_application_sensors_hybris.cpp0000644000015301777760000000753612322054725031613 0ustar pbusernogroup00000000000000/* * Copyright (C) 2012 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voss * Ricardo Mendoza */ #include #include #include #include "bridge.h" // Ubuntu Application Sensors // Acceleration Sensor IMPLEMENT_CTOR0(UASensorsAccelerometer*, ua_sensors_accelerometer_new); IMPLEMENT_FUNCTION1(UStatus, ua_sensors_accelerometer_enable, UASensorsAccelerometer*); IMPLEMENT_FUNCTION1(UStatus, ua_sensors_accelerometer_disable, UASensorsAccelerometer*); IMPLEMENT_FUNCTION1(uint32_t, ua_sensors_accelerometer_get_min_delay, UASensorsAccelerometer*); IMPLEMENT_SF_FUNCTION1(float, ua_sensors_accelerometer_get_min_value, UASensorsAccelerometer*); IMPLEMENT_SF_FUNCTION1(float, ua_sensors_accelerometer_get_max_value, UASensorsAccelerometer*); IMPLEMENT_SF_FUNCTION1(float, ua_sensors_accelerometer_get_resolution, UASensorsAccelerometer*); IMPLEMENT_VOID_FUNCTION3(ua_sensors_accelerometer_set_reading_cb, UASensorsAccelerometer*, on_accelerometer_event_cb, void*); // Acceleration Sensor Event IMPLEMENT_FUNCTION1(uint64_t, uas_accelerometer_event_get_timestamp, UASAccelerometerEvent*); IMPLEMENT_SF_FUNCTION1(float, uas_accelerometer_event_get_acceleration_x, UASAccelerometerEvent*); IMPLEMENT_SF_FUNCTION1(float, uas_accelerometer_event_get_acceleration_y, UASAccelerometerEvent*); IMPLEMENT_SF_FUNCTION1(float, uas_accelerometer_event_get_acceleration_z, UASAccelerometerEvent*); // Proximity Sensor IMPLEMENT_CTOR0(UASensorsProximity*, ua_sensors_proximity_new); IMPLEMENT_FUNCTION1(UStatus, ua_sensors_proximity_enable, UASensorsProximity*); IMPLEMENT_FUNCTION1(UStatus, ua_sensors_proximity_disable, UASensorsProximity*); IMPLEMENT_FUNCTION1(uint32_t, ua_sensors_proximity_get_min_delay, UASensorsProximity*); IMPLEMENT_SF_FUNCTION1(float, ua_sensors_proximity_get_min_value, UASensorsProximity*); IMPLEMENT_SF_FUNCTION1(float, ua_sensors_proximity_get_max_value, UASensorsProximity*); IMPLEMENT_SF_FUNCTION1(float, ua_sensors_proximity_get_resolution, UASensorsProximity*); IMPLEMENT_VOID_FUNCTION3(ua_sensors_proximity_set_reading_cb, UASensorsProximity*, on_proximity_event_cb, void*); // Proximity Sensor Event IMPLEMENT_FUNCTION1(uint64_t, uas_proximity_event_get_timestamp, UASProximityEvent*); IMPLEMENT_FUNCTION1(UASProximityDistance, uas_proximity_event_get_distance, UASProximityEvent*); // Ambient Light Sensor IMPLEMENT_CTOR0(UASensorsLight*, ua_sensors_light_new); IMPLEMENT_FUNCTION1(UStatus, ua_sensors_light_enable, UASensorsLight*); IMPLEMENT_FUNCTION1(UStatus, ua_sensors_light_disable, UASensorsLight*); IMPLEMENT_FUNCTION1(uint32_t, ua_sensors_light_get_min_delay, UASensorsLight*); IMPLEMENT_SF_FUNCTION1(float, ua_sensors_light_get_min_value, UASensorsLight*); IMPLEMENT_SF_FUNCTION1(float, ua_sensors_light_get_max_value, UASensorsLight*); IMPLEMENT_SF_FUNCTION1(float, ua_sensors_light_get_resolution, UASensorsLight*); IMPLEMENT_VOID_FUNCTION3(ua_sensors_light_set_reading_cb, UASensorsLight*, on_light_event_cb, void*); // Ambient Light Sensor Event IMPLEMENT_FUNCTION1(uint64_t, uas_light_event_get_timestamp, UASLightEvent*); IMPLEMENT_SF_FUNCTION1(float, uas_light_event_get_light, UASLightEvent*); platform-api-0.20+14.04.20140411/src/ubuntu/hybris/ubuntu_application_api_hybris.cpp0000644000015301777760000001612612322054725030663 0ustar pbusernogroup00000000000000/* * Copyright (C) 2012 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voss * Ricardo Mendoza */ #include #include // C APIs #include #include #include #include #include #include #include "bridge.h" #ifdef __cplusplus extern "C" { #endif // Session helpers IMPLEMENT_FUNCTION0(UAUiSessionProperties*, ua_ui_session_properties_new); IMPLEMENT_VOID_FUNCTION2(ua_ui_session_properties_set_type, UAUiSessionProperties*, UAUiSessionType); IMPLEMENT_VOID_FUNCTION2(ua_ui_session_properties_set_remote_pid, UAUiSessionProperties*, uint32_t); IMPLEMENT_FUNCTION1(UAUiSession*, ua_ui_session_new_with_properties, UAUiSessionProperties*); // Lifecycle helpers IMPLEMENT_FUNCTION0(UApplicationLifecycleDelegate*, u_application_lifecycle_delegate_new); IMPLEMENT_VOID_FUNCTION2(u_application_lifecycle_delegate_set_context, UApplicationLifecycleDelegate*, void*); IMPLEMENT_VOID_FUNCTION1(u_application_lifecycle_delegate_ref, UApplicationLifecycleDelegate*); IMPLEMENT_VOID_FUNCTION1(u_application_lifecycle_delegate_unref, UApplicationLifecycleDelegate*); IMPLEMENT_VOID_FUNCTION2(u_application_lifecycle_delegate_set_application_resumed_cb, UApplicationLifecycleDelegate*, u_on_application_resumed); IMPLEMENT_VOID_FUNCTION2(u_application_lifecycle_delegate_set_application_about_to_stop_cb, UApplicationLifecycleDelegate*, u_on_application_about_to_stop); // Application Helpers // UApplicationId IMPLEMENT_FUNCTION2(UApplicationId*, u_application_id_new_from_stringn, const char*, size_t); IMPLEMENT_VOID_FUNCTION1(u_application_id_destroy, UApplicationId*); IMPLEMENT_FUNCTION2(int, u_application_id_compare, UApplicationId*, UApplicationId*); // UApplicationDescription IMPLEMENT_FUNCTION0(UApplicationDescription*, u_application_description_new); IMPLEMENT_VOID_FUNCTION1(u_application_description_destroy, UApplicationDescription*); IMPLEMENT_VOID_FUNCTION2(u_application_description_set_application_id, UApplicationDescription*, UApplicationId*); IMPLEMENT_VOID_FUNCTION2(u_application_description_set_application_lifecycle_delegate, UApplicationDescription*, UApplicationLifecycleDelegate*); // UApplicationOptions IMPLEMENT_FUNCTION2(UApplicationOptions*, u_application_options_new_from_cmd_line, int, char**); IMPLEMENT_VOID_FUNCTION1(u_application_options_destroy, UApplicationOptions*); IMPLEMENT_FUNCTION1(UAUiFormFactor, u_application_options_get_form_factor, UApplicationOptions*); IMPLEMENT_FUNCTION1(UAUiStage, u_application_options_get_stage, UApplicationOptions*); // UApplicationInstance IMPLEMENT_FUNCTION2(UApplicationInstance*, u_application_instance_new_from_description_with_options, UApplicationDescription*, UApplicationOptions*); // Application Ui Helpers // Clipboard IMPLEMENT_VOID_FUNCTION2(ua_ui_set_clipboard_content, void*, size_t); IMPLEMENT_VOID_FUNCTION2(ua_ui_get_clipboard_content, void**, size_t*); // UAUiDisplay IMPLEMENT_FUNCTION1(UAUiDisplay*, ua_ui_display_new_with_index, size_t); IMPLEMENT_VOID_FUNCTION1(ua_ui_display_destroy, UAUiDisplay*); IMPLEMENT_FUNCTION1(uint32_t, ua_ui_display_query_horizontal_res, UAUiDisplay*); IMPLEMENT_FUNCTION1(uint32_t, ua_ui_display_query_vertical_res, UAUiDisplay*); IMPLEMENT_FUNCTION1(EGLNativeDisplayType, ua_ui_display_get_native_type, UAUiDisplay*); // UAUiWindowProperties IMPLEMENT_FUNCTION0(UAUiWindowProperties*, ua_ui_window_properties_new_for_normal_window); IMPLEMENT_VOID_FUNCTION1(ua_ui_window_properties_destroy, UAUiWindowProperties*); IMPLEMENT_VOID_FUNCTION3(ua_ui_window_properties_set_titlen, UAUiWindowProperties*, const char*, size_t); IMPLEMENT_FUNCTION1(const char*, ua_ui_window_properties_get_title, UAUiWindowProperties*); IMPLEMENT_VOID_FUNCTION2(ua_ui_window_properties_set_role, UAUiWindowProperties*, UAUiWindowRole); IMPLEMENT_VOID_FUNCTION3(ua_ui_window_properties_set_input_cb_and_ctx, UAUiWindowProperties*, UAUiWindowInputEventCb, void*); IMPLEMENT_VOID_FUNCTION3(ua_ui_window_properties_set_dimensions, UAUiWindowProperties*, uint32_t, uint32_t); // UAUiWindow IMPLEMENT_FUNCTION2(UAUiWindow*, ua_ui_window_new_for_application_with_properties, UApplicationInstance*, UAUiWindowProperties*); IMPLEMENT_VOID_FUNCTION1(ua_ui_window_destroy, UAUiWindow*); IMPLEMENT_FUNCTION3(UStatus, ua_ui_window_move, UAUiWindow*, uint32_t, uint32_t); IMPLEMENT_FUNCTION3(UStatus, ua_ui_window_resize, UAUiWindow*, uint32_t, uint32_t); IMPLEMENT_FUNCTION1(UStatus, ua_ui_window_hide, UAUiWindow*); IMPLEMENT_FUNCTION1(UStatus, ua_ui_window_show, UAUiWindow*); IMPLEMENT_VOID_FUNCTION1(ua_ui_window_request_fullscreen, UAUiWindow*); IMPLEMENT_FUNCTION1(EGLNativeWindowType, ua_ui_window_get_native_type, UAUiWindow*); /* -------------------------------------------------------------------------- * * * * * * * * * * * * * * * * Deprecated API * * * * * * * * * * * * * * * * * * -------------------------------------------------------------------------- * */ // Session service IMPLEMENT_FUNCTION1(int, ubuntu_ui_session_properties_get_application_instance_id, ubuntu_ui_session_properties); IMPLEMENT_FUNCTION1(int, ubuntu_ui_session_properties_get_application_stage_hint, ubuntu_ui_session_properties); IMPLEMENT_FUNCTION1(const char*, ubuntu_ui_session_properties_get_desktop_file_hint, ubuntu_ui_session_properties); IMPLEMENT_VOID_FUNCTION1(ubuntu_ui_session_install_session_lifecycle_observer, ubuntu_ui_session_lifecycle_observer*); IMPLEMENT_VOID_FUNCTION0(ubuntu_ui_session_unfocus_running_sessions); IMPLEMENT_VOID_FUNCTION1(ubuntu_ui_session_focus_running_session_with_id, int); IMPLEMENT_VOID_FUNCTION3(ubuntu_ui_session_snapshot_running_session_with_id, int, ubuntu_ui_session_service_snapshot_cb, void*); IMPLEMENT_VOID_FUNCTION1(ubuntu_ui_session_trigger_switch_to_well_known_application, ubuntu_ui_well_known_application); IMPLEMENT_FUNCTION4(int32_t, ubuntu_ui_set_surface_trap, int, int, int, int); IMPLEMENT_VOID_FUNCTION1(ubuntu_ui_unset_surface_trap, int); IMPLEMENT_VOID_FUNCTION4(ubuntu_ui_report_osk_visible, int, int, int, int); IMPLEMENT_VOID_FUNCTION0(ubuntu_ui_report_osk_invisible); IMPLEMENT_VOID_FUNCTION0(ubuntu_ui_report_notification_visible); IMPLEMENT_VOID_FUNCTION0(ubuntu_ui_report_notification_invisible); IMPLEMENT_VOID_FUNCTION1(ubuntu_ui_install_task_controller, ubuntu_ui_task_controller*); #ifdef __cplusplus } #endif platform-api-0.20+14.04.20140411/src/ubuntu/hybris/CMakeLists.txt0000644000015301777760000000230612322054725024574 0ustar pbusernogroup00000000000000set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11") add_library( ubuntu_application_api SHARED ubuntu_application_api_hybris.cpp ubuntu_application_sensors_hybris.cpp ) add_library( ubuntu_platform_hardware_api SHARED ubuntu_platform_hardware_api.cpp ) include_directories( ${CMAKE_BINARY_DIR}/include ) target_link_libraries( ubuntu_application_api "-Wl,--whole-archive" ${UBUNTU_APPLICATION_API_LINK_LIBRARIES} "-Wl,--no-whole-archive" ${Hybris} ) target_link_libraries( ubuntu_platform_hardware_api dl ${Hybris} ) set_target_properties( ubuntu_application_api PROPERTIES VERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR}.${UBUNTU_PLATFORM_API_VERSION_MINOR}.${UBUNTU_PLATFORM_API_VERSION_PATCH} SOVERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR} ) set_target_properties( ubuntu_platform_hardware_api PROPERTIES VERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR}.${UBUNTU_PLATFORM_API_VERSION_MINOR}.${UBUNTU_PLATFORM_API_VERSION_PATCH} SOVERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR} ) install( TARGETS ubuntu_application_api ${INSTALL_TARGETS_DEFAULT_ARGS} ) install( TARGETS ubuntu_platform_hardware_api ${INSTALL_TARGETS_DEFAULT_ARGS} ) add_subdirectory(tests/) platform-api-0.20+14.04.20140411/src/ubuntu/hybris/ubuntu_platform_hardware_api.cpp0000644000015301777760000000315312322054725030475 0ustar pbusernogroup00000000000000/* * Copyright (C) 2012 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voss * Ricardo Mendoza */ // C APIs #include #include "bridge.h" // Hardware - GPS IMPLEMENT_FUNCTION1( UHardwareGps, u_hardware_gps_new, UHardwareGpsParams*); IMPLEMENT_VOID_FUNCTION1( u_hardware_gps_delete, UHardwareGps); IMPLEMENT_FUNCTION1( bool, u_hardware_gps_start, UHardwareGps); IMPLEMENT_FUNCTION1( bool, u_hardware_gps_stop, UHardwareGps); IMPLEMENT_VOID_FUNCTION4( u_hardware_gps_inject_time, UHardwareGps, int64_t, int64_t, int); IMPLEMENT_VOID_FUNCTION4( u_hardware_gps_inject_location, UHardwareGps, double, double, float); IMPLEMENT_VOID_FUNCTION2( u_hardware_gps_delete_aiding_data, UHardwareGps, uint16_t); IMPLEMENT_FUNCTION6( bool, u_hardware_gps_set_position_mode, UHardwareGps, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t); IMPLEMENT_VOID_FUNCTION3( u_hardware_gps_inject_xtra_data, UHardwareGps, char*, int); platform-api-0.20+14.04.20140411/src/ubuntu/mirclient/0000755000015301777760000000000012322055312022512 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/src/ubuntu/mirclient/window_properties_mirclient_priv.h0000644000015301777760000000410512322054725031563 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Robert Carr */ #ifndef UBUNTU_APPLICATION_UI_WINDOW_PROPERTIES_MIRCLIENT_PRIV_H_ #define UBUNTU_APPLICATION_UI_WINDOW_PROPERTIES_MIRCLIENT_PRIV_H_ #include #include #include #include #include namespace ubuntu { namespace application { namespace mir { namespace client { class WindowProperties { public: WindowProperties(); ~WindowProperties() = default; UAUiWindowProperties* as_u_window_properties(); static WindowProperties* from_u_window_properties(UAUiWindowProperties* u_properties); void set_title(char const* title, size_t length); void set_input_cb_and_ctx(UAUiWindowInputEventCb cb, void* ctx); void set_dimensions(uint32_t width, uint32_t height); void set_role(UAUiWindowRole role); MirSurfaceParameters const& surface_parameters() const; MirSurfaceType surface_type() const; UAUiWindowInputEventCb input_cb() const; void* input_context() const; protected: WindowProperties(WindowProperties const&) = delete; WindowProperties& operator=(WindowProperties const&) = delete; private: MirSurfaceParameters parameters; MirSurfaceType type; std::string title; UAUiWindowInputEventCb cb; void *input_ctx; }; } } } } #endif // UBUNTU_APPLICATION_UI_WINDOW_PROPERTIES_MIRCLIENT_PRIV_H_ platform-api-0.20+14.04.20140411/src/ubuntu/mirclient/ubuntu_application_api_mirclient.cpp0000644000015301777760000002632712322054725032043 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Robert Carr */ #include "application_instance_mirclient_priv.h" #include "window_properties_mirclient_priv.h" #include "window_mirclient_priv.h" #include "mircommon/lifecycle_delegate_mir_priv.h" #include "mircommon/application_id_mir_priv.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace uam = ubuntu::application::mir; namespace uamc = uam::client; namespace { // Display info static MirDisplayInfo* u_display_mir_display(UAUiDisplay *display) { return static_cast(display); } static UAUiDisplay* mir_display_u_display(MirDisplayInfo *display) { return static_cast(display); } static void dispatch_callback(MirConnection* conn, MirLifecycleState state, void* context) { auto delegate = static_cast(context); void* c_ctx = u_application_lifecycle_delegate_get_context(delegate->as_u_lifecycle_delegate(), nullptr); switch (state) { case mir_lifecycle_state_will_suspend: { if (delegate->stop_cb) delegate->stop_cb(nullptr, c_ctx); break; } case mir_lifecycle_state_resumed: { if (delegate->resumed_cb) delegate->resumed_cb(nullptr, c_ctx); break; } default: break; } } }; extern "C" { // TODO: Eliminate global instance by adding Instance to some functions (i.e. display queries) // TODO: We can't take ownership of description and options until we get rid of the global instance // so we leak them. UApplicationInstance* u_application_instance_new_from_description_with_options(UApplicationDescription* description, UApplicationOptions* options) { auto instance = global_mir_instance(); auto id = uam::Id::from_u_application_id(u_application_description_get_application_id(description)); auto connect_succeeded = instance->connect(id->name); if (!connect_succeeded) return nullptr; auto delegate = u_application_description_get_application_lifecycle_delegate(description); mir_connection_set_lifecycle_event_callback(instance->connection(), &dispatch_callback, delegate); return instance->as_u_application_instance(); } void u_application_instance_ref(UApplicationInstance *u_instance) { auto instance = uamc::Instance::from_u_application_instance(u_instance); instance->ref(); } void u_application_instance_unref(UApplicationInstance *u_instance) { auto instance = uamc::Instance::from_u_application_instance(u_instance); instance->unref(); } void u_application_instance_destroy(UApplicationInstance *u_instance) { // TODO: What are the proper semantics here. u_application_instance_unref(u_instance); } void u_application_instance_run(UApplicationInstance *instance) { // TODO: What is this supposed to do? Seems to be no-op on hybris. (void) instance; } namespace { void got_rpc_reply_callback(uamc::Instance* instance) { { std::unique_lock rpc_lock(instance->rpc_mutex); instance->rpc_waiting_reply = false; } instance->rpc_condition_variable.notify_all(); } } // anonymous namespace void ua_ui_set_clipboard_content(void* content, size_t content_size) { // TODO: We will need a MirConnection. // Add a non-blocking version? uamc::Instance* instance = global_mir_instance(); std::unique_lock clipboard_lock(instance->clipboard_api_mutex); std::unique_lock rpc_lock(instance->rpc_mutex); auto const rpc_channel = mir::client::the_rpc_channel(instance->connection()); std::string contentString(reinterpret_cast(content), content_size); unity::protobuf::UnityService::Stub unityService(rpc_channel.get(), google::protobuf::Service::STUB_DOESNT_OWN_CHANNEL); instance->rpc_clip.set_content(contentString); instance->rpc_waiting_reply = true; unityService.copy( nullptr, /* rpc_controller */ &instance->rpc_clip, /* request */ &instance->rpc_void, google::protobuf::NewCallback(&got_rpc_reply_callback, instance)); // Wait until we get a reply from the server instance->rpc_condition_variable.wait(rpc_lock, [&]{return !instance->rpc_waiting_reply;}); } void ua_ui_get_clipboard_content(void** out_content, size_t* out_content_size) { // TODO: see get_clipboard_comment. uamc::Instance* instance = global_mir_instance(); std::unique_lock clipboard_lock(instance->clipboard_api_mutex); std::unique_lock rpc_lock(instance->rpc_mutex); *out_content = NULL; *out_content_size = 0; auto const rpc_channel = mir::client::the_rpc_channel(instance->connection()); unity::protobuf::UnityService::Stub unityService(rpc_channel.get(), google::protobuf::Service::STUB_DOESNT_OWN_CHANNEL); unityService.paste( nullptr, /* rpc_controller */ &instance->rpc_void, /* request */ &instance->rpc_clip, /* response */ google::protobuf::NewCallback(&got_rpc_reply_callback, instance)); // Wait until we get a reply from the server instance->rpc_condition_variable.wait(rpc_lock, [&]{return !instance->rpc_waiting_reply;}); instance->clip = instance->rpc_clip.content(); if (!instance->clip.empty()) { *out_content_size = instance->clip.size(); // argh! *out_content = const_cast(static_cast(instance->clip.data())); } } // // TODO : We need to expose the EGLNativeDisplay somehow // // TODO : This function should take an application instance so we can eliminate the global mir instance. // TODO : Perhaps this should be noop for Mir as there is no need to construct // a display object, the connection already has everything we need, as it receives // the display info at connect time. UAUiDisplay* ua_ui_display_new_with_index(size_t index) { // TODO: What are the semantics of index. How should we use it? (void) index; auto instance = global_mir_instance(); auto display = new MirDisplayInfo; mir_connection_get_display_info(instance->connection(), display); return mir_display_u_display(display); } void ua_ui_display_destroy(UAUiDisplay* display) { auto mir_display = u_display_mir_display(display); delete mir_display; } uint32_t ua_ui_display_query_horizontal_res(UAUiDisplay* display) { auto mir_display = u_display_mir_display(display); // TODO: Line up return types from mirclient return static_cast(mir_display->width); } uint32_t ua_ui_display_query_vertical_res(UAUiDisplay* display) { auto mir_display = u_display_mir_display(display); // TODO: Line up return types from mirclient return static_cast(mir_display->height); } EGLNativeDisplayType ua_ui_display_get_native_type(UAUiDisplay* display) { auto instance = global_mir_instance(); // TODO: Careful with this cast return reinterpret_cast(mir_connection_get_egl_native_display(instance->connection())); } UAUiWindowProperties* ua_ui_window_properties_new_for_normal_window() { return (new uamc::WindowProperties)->as_u_window_properties(); } void ua_ui_window_properties_destroy(UAUiWindowProperties* u_properties) { auto properties = uamc::WindowProperties::from_u_window_properties(u_properties); delete properties; } void ua_ui_window_properties_set_titlen(UAUiWindowProperties* u_properties, const char* title, size_t title_length) { auto properties = uamc::WindowProperties::from_u_window_properties(u_properties); properties->set_title(title, title_length); } const char* ua_ui_window_properties_get_title(UAUiWindowProperties* u_properties) { auto properties = uamc::WindowProperties::from_u_window_properties(u_properties); return properties->surface_parameters().name; } void ua_ui_window_properties_set_role(UAUiWindowProperties* u_properties, UAUiWindowRole role) { auto properties = uamc::WindowProperties::from_u_window_properties(u_properties); properties->set_role(role); } void ua_ui_window_properties_set_input_cb_and_ctx(UAUiWindowProperties* u_properties, UAUiWindowInputEventCb cb, void* ctx) { auto properties = uamc::WindowProperties::from_u_window_properties(u_properties); properties->set_input_cb_and_ctx(cb, ctx); } void ua_ui_window_properties_set_dimensions(UAUiWindowProperties *u_properties, uint32_t width, uint32_t height) { auto properties = uamc::WindowProperties::from_u_window_properties(u_properties); properties->set_dimensions(width, height); } UAUiWindow* ua_ui_window_new_for_application_with_properties(UApplicationInstance* u_instance, UAUiWindowProperties* u_properties) { auto instance = uamc::Instance::from_u_application_instance(u_instance); auto properties = uamc::WindowProperties::from_u_window_properties(u_properties); auto window = new uamc::Window(*instance, properties); return window->as_u_window(); } void ua_ui_window_destroy(UAUiWindow* u_window) { auto window = uamc::Window::from_u_window(u_window); delete window; } UStatus ua_ui_window_move(UAUiWindow* u_window, uint32_t x, uint32_t y) { // TODO: Implement. Assuming this should exist on mirclient? (void) u_window; (void) x; (void) y; return (UStatus) 0; } UStatus ua_ui_window_resize(UAUiWindow* u_window, uint32_t width, uint32_t height) { // TODO: Implement (void) u_window; (void) width; (void) height; return (UStatus) 0; } UStatus ua_ui_window_hide(UAUiWindow* u_window) { auto window = uamc::Window::from_u_window(u_window); window->set_state(U_MINIMIZED_STATE); return (UStatus) 0; } UStatus ua_ui_window_show(UAUiWindow* u_window) { auto window = uamc::Window::from_u_window(u_window); window->set_state(U_MAXIMIZED_STATE); return (UStatus) 0; } void ua_ui_window_request_fullscreen(UAUiWindow* u_window) { auto window = uamc::Window::from_u_window(u_window); window->set_state(U_FULLSCREEN_STATE); } EGLNativeWindowType ua_ui_window_get_native_type(UAUiWindow* u_window) { auto window = uamc::Window::from_u_window(u_window); return window->get_native_type(); } // TODO: Sensors } platform-api-0.20+14.04.20140411/src/ubuntu/mirclient/window_mirclient.cpp0000644000015301777760000001014512322054725026603 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Robert Carr */ #include "window_mirclient_priv.h" #include "application_instance_mirclient_priv.h" #include "window_properties_mirclient_priv.h" #include "window_mirclient_priv.h" #include "mircommon/event_helpers_mir.h" namespace uamc = ubuntu::application::mir::client; namespace uaum = ubuntu::application::ui::mir; namespace ubuntu { namespace application { namespace mir { namespace client { struct InputContext { UAUiWindowInputEventCb cb; void *ctx; }; static void ua_ui_window_mir_handle_event(MirSurface* surface, MirEvent const* mir_ev, void* ctx) { // TODO: Perhaps this indicates that mirclient library should not pass a surface argument here. (void) surface; Event ubuntu_ev; auto translated_event = uaum::event_to_ubuntu_event(mir_ev, ubuntu_ev); // Mir sends some events such as focus gained/lost which the platform API does not represent as input events. if (translated_event) { auto mir_ctx = static_cast(ctx); mir_ctx->cb(mir_ctx->ctx, &ubuntu_ev); } } } } } } namespace { static MirPixelFormat mir_choose_default_pixel_format(MirConnection *connection) { MirDisplayInfo info; mir_connection_get_display_info(connection, &info); return info.supported_pixel_format[0]; } static MirSurface* create_surface_with_parameters(MirConnection *connection, MirSurfaceParameters parameters) { } } uamc::Window::Window(uamc::Instance& instance, uamc::WindowProperties* properties) : instance(instance) { window_properties = WindowPropertiesPtr(properties, [](uamc::WindowProperties *p) { ua_ui_window_properties_destroy(p->as_u_window_properties()); }); MirSurfaceParameters parameters = properties->surface_parameters(); auto connection = instance.connection(); parameters.pixel_format = mir_choose_default_pixel_format(connection); auto mir_surface = mir_connection_create_surface_sync(connection, ¶meters); // TODO: create_surface_sync is unsafe as there is a race between setting the event handler and receiving surfaces input_ctx = InputContextPtr(new uamc::InputContext{properties->input_cb(), properties->input_context()}, [](InputContext *c) { delete c; }); if (properties->surface_type()) { // TODO: Should I bother checking the result? mir_surface_set_type(mir_surface, properties->surface_type()); } MirEventDelegate delegate = { uamc::ua_ui_window_mir_handle_event, input_ctx.get() }; mir_surface_set_event_handler(mir_surface, &delegate); surface = SurfacePtr(mir_surface, [](MirSurface *s) { mir_surface_release_sync(s); }); } UAUiWindow* uamc::Window::as_u_window() { return static_cast(this); } uamc::Window* uamc::Window::from_u_window(UAUiWindow *u_window) { return static_cast(u_window); } EGLNativeWindowType uamc::Window::get_native_type() { return reinterpret_cast(mir_surface_get_egl_native_window(surface.get())); } UApplicationUiWindowState uamc::Window::state() const { return static_cast(mir_surface_get_state(surface.get())); } void uamc::Window::set_state(const UApplicationUiWindowState state) { mir_surface_set_state(surface.get(), static_cast(state)); } platform-api-0.20+14.04.20140411/src/ubuntu/mirclient/application_instance_mirclient.cpp0000644000015301777760000000355112322054725031466 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Robert Carr */ #include "application_instance_mirclient_priv.h" namespace uamc = ubuntu::application::mir::client; uamc::Instance::Instance() : con(nullptr), ref_count(1), rpc_waiting_reply(false) { } UApplicationInstance* uamc::Instance::as_u_application_instance() { return static_cast(this); } uamc::Instance* uamc::Instance::from_u_application_instance(UApplicationInstance* u_instance) { return static_cast(u_instance); } void uamc::Instance::ref() { ref_count++; } void uamc::Instance::unref() { ref_count--; if (ref_count == 0) delete this; } MirConnection* uamc::Instance::connection() const { return con.get(); } bool uamc::Instance::connect(std::string const& application_name) { auto mir_connection = mir_connect_sync(NULL, application_name.c_str()); // mir_connect_sync() always returns a connection object, even in case // of a failed connection. We need to release this object in all cases. con = ConnectionPtr(mir_connection, [](MirConnection *c) { mir_connection_release(c); }); return mir_connection_is_valid(mir_connection); } platform-api-0.20+14.04.20140411/src/ubuntu/mirclient/unityrpc.proto0000644000015301777760000000043112322054725025461 0ustar pbusernogroup00000000000000option cc_generic_services = true; package unity.protobuf; message Clip { required bytes content = 1; optional string error = 127; } message Void { optional string error = 127; } service UnityService { rpc copy(Clip) returns (Void); rpc paste(Void) returns (Clip); } platform-api-0.20+14.04.20140411/src/ubuntu/mirclient/application_instance_mirclient_priv.h0000644000015301777760000000515712322054725032177 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Robert Carr */ #ifndef UBUNTU_APPLICATION_INSTANCE_MIRCLIENT_PRIV_H_ #define UBUNTU_APPLICATION_INSTANCE_MIRCLIENT_PRIV_H_ #include #include #include #include #include #include #include namespace ubuntu { namespace application { namespace mir { namespace client { class Instance { public: Instance(); ~Instance() = default; UApplicationInstance* as_u_application_instance(); static Instance* from_u_application_instance(UApplicationInstance* u_instance); void ref(); void unref(); MirConnection* connection() const; bool connect(std::string const& application_name); // Variables used for direct protobuf manipulation. Needed for calling unity8 functions // through the mir_socket. unity::protobuf::Clip rpc_clip; unity::protobuf::Void rpc_void; std::condition_variable rpc_condition_variable; std::mutex rpc_mutex; bool rpc_waiting_reply; // ensure one clipboard operation (copy or paste) at a time. std::mutex clipboard_api_mutex; std::string clip; protected: Instance(Instance const&) = delete; Instance& operator=(Instance const&) = delete; private: typedef std::unique_ptr> ConnectionPtr; ConnectionPtr con; int ref_count; }; } } } } // namespace ubuntu namespace uamc = ubuntu::application::mir::client; namespace { // We use a global instance as some platform-api functions, i.e. display_new_with_index // do not supply dependencies, but a MirConnection is required for all queries. static uamc::Instance* global_mir_instance() { // Obviously ref counting is whacky here... static uamc::Instance instance; instance.ref(); // We leak a reference, this object can't be destroyed return &instance; } } #endif // UBUNTU_APPLICATION_INSTANCE_MIRCLIENT_PRIV_H_ platform-api-0.20+14.04.20140411/src/ubuntu/mirclient/CMakeLists.txt0000644000015301777760000000172112322054725025262 0ustar pbusernogroup00000000000000protobuf_generate_cpp( GENERATED_PROTOBUF_SRCS GENERATED_PROTOBUF_HDRS unityrpc.proto ) set(SOURCES ubuntu_application_api_mirclient.cpp application_instance_mirclient.cpp window_properties_mirclient.cpp window_mirclient.cpp ${GENERATED_PROTOBUF_SRCS} ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -fPIC") add_library( ubuntu_application_api_mirclient SHARED ${SOURCES} ) include_directories( ${CMAKE_BINARY_DIR}/include ${MIRCLIENT_INCLUDE_DIRS} ${PROTOBUF_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR} ) target_link_libraries( ubuntu_application_api_mirclient ${MIRCLIENT_LDFLAGS} ${MIRCLIENT_LIBRARIES} -Wl,--whole-archive ubuntu_application_api_mircommon ${UBUNTU_APPLICATION_API_LINK_LIBRARIES} -Wl,--no-whole-archive ${PROTOBUF_LIBRARIES} ) set_target_properties( ubuntu_application_api_mirclient PROPERTIES VERSION 1.0 SOVERSION 1 ) install(TARGETS ubuntu_application_api_mirclient ${INSTALL_TARGETS_DEFAULT_ARGS}) platform-api-0.20+14.04.20140411/src/ubuntu/mirclient/window_properties_mirclient.cpp0000644000015301777760000000464012322054725031062 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Robert Carr */ #include "window_properties_mirclient_priv.h" namespace uamc = ubuntu::application::mir::client; uamc::WindowProperties::WindowProperties() : parameters(), type(mir_surface_type_normal), cb(nullptr), input_ctx(nullptr) { parameters.name = nullptr; parameters.width = 0; parameters.height = 0; parameters.buffer_usage = mir_buffer_usage_hardware; parameters.output_id = mir_display_output_id_invalid; } UAUiWindowProperties* uamc::WindowProperties::as_u_window_properties() { return static_cast(this); } uamc::WindowProperties* uamc::WindowProperties::from_u_window_properties(UAUiWindowProperties* u_properties) { return static_cast(u_properties); } void uamc::WindowProperties::set_title(char const* window_title, size_t length) { title = std::string(window_title, length); parameters.name = title.c_str(); } void uamc::WindowProperties::set_input_cb_and_ctx(UAUiWindowInputEventCb callback, void* ctx) { cb = callback; input_ctx = ctx; } void uamc::WindowProperties::set_dimensions(uint32_t width, uint32_t height) { parameters.width = width; parameters.height = height; } void uamc::WindowProperties::set_role(UAUiWindowRole role) { if (role == U_ON_SCREEN_KEYBOARD_ROLE) { type = mir_surface_type_inputmethod; } //TODO implement other surface roles } MirSurfaceParameters const& uamc::WindowProperties::surface_parameters() const { return parameters; } MirSurfaceType uamc::WindowProperties::surface_type() const { return type; } UAUiWindowInputEventCb uamc::WindowProperties::input_cb() const { return cb; } void* uamc::WindowProperties::input_context() const { return input_ctx; } platform-api-0.20+14.04.20140411/src/ubuntu/mirclient/window_mirclient_priv.h0000644000015301777760000000412012322054725027304 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Robert Carr */ #ifndef UBUNTU_APPLICATION_UI_WINDOW_MIRCLIENT_PRIV_H_ #define UBUNTU_APPLICATION_UI_WINDOW_MIRCLIENT_PRIV_H_ #include #include #include #include #include #include #include #include namespace ubuntu { namespace application { namespace mir { namespace client { class Instance; class WindowProperties; struct InputContext; class Window { public: Window(Instance& instance, WindowProperties* window); ~Window() = default; UAUiWindow* as_u_window(); static Window* from_u_window(UAUiWindow* u_window); EGLNativeWindowType get_native_type(); UApplicationUiWindowState state() const; void set_state(const UApplicationUiWindowState); protected: Window(Window const&) = delete; Window& operator=(Window const&) = delete; private: Instance& instance; typedef std::unique_ptr> WindowPropertiesPtr; typedef std::unique_ptr> SurfacePtr; typedef std::unique_ptr> InputContextPtr; WindowPropertiesPtr window_properties; InputContextPtr input_ctx; SurfacePtr surface; }; } } } } #endif // UBUNTU_APPLICATION_UI_WINDOW_MIRCLIENT_PRIV_H_ platform-api-0.20+14.04.20140411/src/ubuntu/mirserver/0000755000015301777760000000000012322055312022542 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/src/ubuntu/mirserver/ubuntu_application_api_mirserver_priv.h0000644000015301777760000000270512322054725032622 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Robert Carr */ #ifndef UBUNTU_APPLICATION_API_MIRSERVER_PRIV_H_ #define UBUNTU_APPLICATION_API_MIRSERVER_PRIV_H_ #include namespace mir { class DefaultServerConfiguration; } // We need to provide the platform API with Mir server objects as dependency. The analog // on the client side is of course the named socket for connection to Mir. This should be // invoked from the run_mir handler prior to creation of a UApplicationInstance or usage of // any ua_ui functions. extern "C" { UBUNTU_DLL_PUBLIC void ua_ui_mirserver_init(mir::DefaultServerConfiguration& config); // Release platform-api ownership of Mir server objects to allow for clean shutdown. UBUNTU_DLL_PUBLIC void ua_ui_mirserver_finish(); } #endif // UBUNTU_APPLICATION_API_MIRSERVER_PRIV_H_ platform-api-0.20+14.04.20140411/src/ubuntu/mirserver/application_instance_mirserver_priv.h0000644000015301777760000000512512322054745032254 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Robert Carr */ #ifndef UBUNTU_APPLICATION_INSTANCE_MIRSERVER_PRIV_H_ #define UBUNTU_APPLICATION_INSTANCE_MIRSERVER_PRIV_H_ #include #include #include namespace mir { namespace scene { class Surface; class SurfaceCoordinator; } namespace shell { class PlacementStrategy; class SessionListener; class SurfaceCreationParameters; } } namespace ubuntu { namespace application { namespace mir { class Description; class Options; namespace server { class Instance { public: Instance(std::shared_ptr< ::mir::scene::SurfaceCoordinator> const& surface_coordinator, std::shared_ptr< ::mir::shell::PlacementStrategy> const& placement_strategy, std::shared_ptr< ::mir::shell::SessionListener> const& session_listener, ubuntu::application::mir::Description* description, ubuntu::application::mir::Options *options); ~Instance() = default; UApplicationInstance* as_u_application_instance(); static Instance* from_u_application_instance(UApplicationInstance* u_instance); void ref(); void unref(); std::shared_ptr< ::mir::scene::Surface> create_surface( ::mir::shell::SurfaceCreationParameters const& parameters); protected: Instance(Instance const&) = delete; Instance& operator=(Instance const&) = delete; private: typedef std::unique_ptr> DescriptionPtr; typedef std::unique_ptr> OptionsPtr; OptionsPtr options; DescriptionPtr description; std::shared_ptr< ::mir::scene::SurfaceCoordinator> const surface_coordinator; std::shared_ptr< ::mir::shell::PlacementStrategy> const placement_strategy; std::shared_ptr< ::mir::shell::SessionListener> const session_listener; int ref_count; }; } } } } // namespace ubuntu #endif // UBUNTU_APPLICATION_INSTANCE_MIRSERVER_PRIV_H_ platform-api-0.20+14.04.20140411/src/ubuntu/mirserver/window_mirserver.cpp0000644000015301777760000000516512322054735026672 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Robert Carr */ #include "mircommon/event_helpers_mir.h" #include "window_mirserver_priv.h" #include "application_instance_mirserver_priv.h" #include "window_properties_mirserver_priv.h" #include #include #include #include #include namespace uams = ubuntu::application::mir::server; namespace uaum = ubuntu::application::ui::mir; namespace mf = mir::frontend; namespace mg = mir::graphics; namespace msh = mir::shell; namespace mircv = mir::input::receiver; namespace { static void ua_ui_window_handle_event(UAUiWindowInputEventCb cb, void* ctx, MirEvent* mir_event) { Event ubuntu_ev; auto translated_event = uaum::event_to_ubuntu_event(mir_event, ubuntu_ev); if (translated_event) cb(ctx, &ubuntu_ev); } } uams::Window::Window(uams::Instance& instance, uams::WindowProperties* properties, std::shared_ptr const& input_platform, std::shared_ptr const& internal_client) : window_properties(properties), surface(instance.create_surface(properties->surface_parameters())), internal_client(internal_client) { input_thread = input_platform->create_input_thread(surface->client_input_fd(), std::bind(ua_ui_window_handle_event, properties->input_cb(), properties->input_context(), std::placeholders::_1)); input_thread->start(); } uams::Window::~Window() { input_thread->stop(); input_thread->join(); } UAUiWindow* uams::Window::as_u_window() { return static_cast(this); } uams::Window* uams::Window::from_u_window(UAUiWindow *u_window) { return static_cast(u_window); } EGLNativeWindowType uams::Window::get_native_type() { auto mir_surface = mf::as_internal_surface(surface); return internal_client->egl_native_window(mir_surface); } platform-api-0.20+14.04.20140411/src/ubuntu/mirserver/ubuntu_application_api_mirserver.cpp0000644000015301777760000002463712322054745032127 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Robert Carr */ #include "ubuntu_application_api_mirserver_priv.h" #include "application_instance_mirserver_priv.h" #include "window_properties_mirserver_priv.h" #include "window_mirserver_priv.h" #include "mircommon/application_id_mir_priv.h" #include "mircommon/application_description_mir_priv.h" #include "mircommon/application_options_mir_priv.h" #include "mircommon/mir/geometry/rectangles.h" // C APIs #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace uam = ubuntu::application::mir; namespace uams = ubuntu::application::mir::server; namespace { struct MirServerContext { std::shared_ptr display; std::shared_ptr buffer_allocator; std::shared_ptr surface_coordinator; std::shared_ptr placement_strategy; std::shared_ptr session_listener; std::shared_ptr input_platform; std::shared_ptr egl_client; }; MirServerContext * global_mirserver_context() { static MirServerContext context; return &context; } } extern "C" { void ua_ui_mirserver_init(mir::DefaultServerConfiguration& config) { auto context = global_mirserver_context(); context->display = config.the_display(); context->buffer_allocator = config.the_buffer_allocator(); context->surface_coordinator = config.the_surface_coordinator(); context->placement_strategy = config.the_shell_placement_strategy(); context->session_listener = config.the_shell_session_listener(); context->input_platform = mir::input::receiver::InputPlatform::create(); context->egl_client = config.the_graphics_platform()->create_internal_client(); } void ua_ui_mirserver_finish() { auto context = global_mirserver_context(); context->display.reset(); context->surface_coordinator.reset(); context->placement_strategy.reset(); context->session_listener.reset(); context->input_platform.reset(); context->egl_client.reset(); } UApplicationInstance* u_application_instance_new_from_description_with_options(UApplicationDescription* u_description, UApplicationOptions* u_options) { auto surface_coordinator = global_mirserver_context()->surface_coordinator; assert(surface_coordinator); auto placement_strategy = global_mirserver_context()->placement_strategy; assert(placement_strategy); auto session_listener = global_mirserver_context()->session_listener; assert(session_listener); auto description = uam::Description::from_u_application_description(u_description); auto options = uam::Options::from_u_application_options(u_options); auto instance = new uams::Instance(surface_coordinator, placement_strategy, session_listener, description, options); return instance->as_u_application_instance(); } void u_application_instance_ref(UApplicationInstance *u_instance) { auto instance = uams::Instance::from_u_application_instance(u_instance); instance->ref(); } void u_application_instance_unref(UApplicationInstance *u_instance) { auto instance = uams::Instance::from_u_application_instance(u_instance); instance->unref(); } void u_application_instance_destroy(UApplicationInstance *instance) { // TODO: What are the proper semantics here. u_application_instance_unref(instance); } void u_application_instance_run(UApplicationInstance *instance) { // TODO: What is this supposed to do? Seems to be no-op on hybris. (void) instance; } void ua_ui_set_clipboard_content(void* content, size_t content_size) { // TODO: Implement. Probably need more arguments? (void) content; (void) content_size; } void ua_ui_get_clipboard_content(void** out_content, size_t* out_content_size) { // TODO: Implement *out_content = NULL; *out_content_size = 0; } UAUiDisplay* ua_ui_display_new_with_index(size_t index) { // TODO: Make use of index. This is kind of strangely done... return reinterpret_cast(index); } void ua_ui_display_destroy(UAUiDisplay* display) { // TODO: Implement. Or is this a noop for mirserver? (void) display; } uint32_t ua_ui_display_query_horizontal_res(UAUiDisplay* display) { (void) display; // TODO: Multiple displays auto mir_display = global_mirserver_context()->display; assert(mir_display); /* TODO: Get proper configuration */ mir::geometry::Rectangles view_area; mir_display->for_each_display_buffer([&view_area](mir::graphics::DisplayBuffer const& db) { view_area.add(db.view_area()); }); mir::geometry::Size const display_size{view_area.bounding_rectangle().size}; return display_size.width.as_uint32_t(); } uint32_t ua_ui_display_query_vertical_res(UAUiDisplay* display) { (void) display; // TODO: Multiple displays auto mir_display = global_mirserver_context()->display; assert(mir_display); /* TODO: Get proper configuration */ mir::geometry::Rectangles view_area; mir_display->for_each_display_buffer([&view_area](mir::graphics::DisplayBuffer const& db) { view_area.add(db.view_area()); }); mir::geometry::Size const display_size{view_area.bounding_rectangle().size}; return display_size.height.as_uint32_t(); } EGLNativeDisplayType ua_ui_display_get_native_type(UAUiDisplay* display) { auto internal_client = global_mirserver_context()->egl_client; assert(internal_client); return internal_client->egl_native_display(); } namespace { static MirPixelFormat choose_pixel_format(std::shared_ptr const& allocator) { auto formats = allocator->supported_pixel_formats(); return formats[0]; } } UAUiWindowProperties* ua_ui_window_properties_new_for_normal_window() { auto properties = new uams::WindowProperties(); return properties->as_u_window_properties(); } void ua_ui_window_properties_destroy(UAUiWindowProperties* u_properties) { auto properties = uams::WindowProperties::from_u_window_properties(u_properties); delete properties; } void ua_ui_window_properties_set_titlen(UAUiWindowProperties* u_properties, const char* title, size_t title_length) { auto properties = uams::WindowProperties::from_u_window_properties(u_properties); properties->set_title(title, title_length); } const char* ua_ui_window_properties_get_title(UAUiWindowProperties* u_properties) { auto properties = uams::WindowProperties::from_u_window_properties(u_properties); return properties->surface_parameters().name.c_str(); } void ua_ui_window_properties_set_role(UAUiWindowProperties* properties, UAUiWindowRole role) { // TODO: Implement. Or is this a noop for us? (void) properties; (void) role; } void ua_ui_window_properties_set_input_cb_and_ctx(UAUiWindowProperties* u_properties, UAUiWindowInputEventCb cb, void* ctx) { auto properties = uams::WindowProperties::from_u_window_properties(u_properties); properties->set_input_cb_and_ctx(cb, ctx); } void ua_ui_window_properties_set_dimensions(UAUiWindowProperties *u_properties, uint32_t width, uint32_t height) { auto properties = uams::WindowProperties::from_u_window_properties(u_properties); properties->set_dimensions(width, height); } UAUiWindow* ua_ui_window_new_for_application_with_properties(UApplicationInstance* u_instance, UAUiWindowProperties* u_properties) { auto input_platform = global_mirserver_context()->input_platform; assert(input_platform); auto internal_client = global_mirserver_context()->egl_client; assert(internal_client); auto instance = uams::Instance::from_u_application_instance(u_instance); auto properties = uams::WindowProperties::from_u_window_properties(u_properties); // A bit of a wart. properties->set_pixel_format(choose_pixel_format(global_mirserver_context()->buffer_allocator)); auto window = new uams::Window(*instance, properties, input_platform, internal_client); return window->as_u_window(); } void ua_ui_window_destroy(UAUiWindow* u_window) { auto window = uams::Window::from_u_window(u_window); delete window; } UStatus ua_ui_window_move(UAUiWindow* window, uint32_t x, uint32_t y) { // TODO: Implement. But should this exist? (void) window; (void) x; (void) y; return (UStatus) 0; } UStatus ua_ui_window_resize(UAUiWindow* window, uint32_t width, uint32_t height) { // TODO: Implement (void) window; (void) width; (void) height; return (UStatus) 0; } UStatus ua_ui_window_hide(UAUiWindow* window) { // TODO: Implement (void) window; return (UStatus) 0; } UStatus ua_ui_window_show(UAUiWindow* window) { // TODO: Implement (void) window; return (UStatus) 0; } void ua_ui_window_request_fullscreen(UAUiWindow* window) { // TODO: Implement (void) window; } EGLNativeWindowType ua_ui_window_get_native_type(UAUiWindow* u_window) { auto window = uams::Window::from_u_window(u_window); return window->get_native_type(); } // TODO: Sensors } platform-api-0.20+14.04.20140411/src/ubuntu/mirserver/window_properties_mirserver.cpp0000644000015301777760000000411112322054725031133 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Robert Carr */ #include "window_properties_mirserver_priv.h" #include namespace uams = ubuntu::application::mir::server; namespace msh = mir::shell; uams::WindowProperties::WindowProperties() : parameters(msh::a_surface()), cb(nullptr), input_ctx(nullptr) { } UAUiWindowProperties* uams::WindowProperties::as_u_window_properties() { return static_cast(this); } uams::WindowProperties* uams::WindowProperties::from_u_window_properties(UAUiWindowProperties* u_properties) { return static_cast(u_properties); } void uams::WindowProperties::set_title(char const* title, size_t length) { parameters = parameters.of_name(std::string(title, length)); } void uams::WindowProperties::set_input_cb_and_ctx(UAUiWindowInputEventCb callback, void* ctx) { cb = callback; input_ctx = ctx; } void uams::WindowProperties::set_dimensions(uint32_t width, uint32_t height) { parameters = parameters.of_size(width, height); } void uams::WindowProperties::set_pixel_format(MirPixelFormat const& format) { parameters = parameters.of_pixel_format(format); } msh::SurfaceCreationParameters const& uams::WindowProperties::surface_parameters() const { return parameters; } UAUiWindowInputEventCb uams::WindowProperties::input_cb() const { return cb; } void* uams::WindowProperties::input_context() const { return input_ctx; } platform-api-0.20+14.04.20140411/src/ubuntu/mirserver/window_mirserver_priv.h0000644000015301777760000000410612322054735027371 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Robert Carr */ #ifndef UBUNTU_APPLICATION_UI_WINDOW_MIRSERVER_PRIV_H_ #define UBUNTU_APPLICATION_UI_WINDOW_MIRSERVER_PRIV_H_ #include #include #include #include #include #include namespace mir { namespace scene { class Surface; } namespace input { namespace receiver { class InputReceiverThread; class InputPlatform; } } namespace graphics { class InternalClient; } } namespace ubuntu { namespace application { namespace mir { namespace server { class Instance; class WindowProperties; class Window { public: Window(Instance& instance, WindowProperties* properties, std::shared_ptr< ::mir::input::receiver::InputPlatform> const& platform, std::shared_ptr< ::mir::graphics::InternalClient> const& internal_client); ~Window(); UAUiWindow* as_u_window(); static Window* from_u_window(UAUiWindow* u_window); EGLNativeWindowType get_native_type(); protected: Window(Window const&) = delete; Window& operator=(Window const&) = delete; private: std::unique_ptr window_properties; std::shared_ptr< ::mir::scene::Surface> surface; std::shared_ptr< ::mir::input::receiver::InputReceiverThread> input_thread; std::shared_ptr< ::mir::graphics::InternalClient> internal_client; }; } } } } #endif // UBUNTU_APPLICATION_UI_WINDOW_MIRSERVER_PRIV_H_ platform-api-0.20+14.04.20140411/src/ubuntu/mirserver/application_instance_mirserver.cpp0000644000015301777760000001046312322054745031550 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Robert Carr */ #include "application_instance_mirserver_priv.h" #include "mircommon/application_description_mir_priv.h" #include "mircommon/application_options_mir_priv.h" #include "mircommon/application_id_mir_priv.h" #include #include #include #include #include #include namespace uam = ubuntu::application::mir; namespace uams = uam::server; namespace mf = mir::frontend; namespace ms = mir::scene; namespace msh = mir::shell; namespace { /* A Mir in-process client does not have an associated Session by default. However it is * useful for the shell to be able to position and identify its own surface, so need to * create a mock implementation of Session for that respective Surface. */ class InProcessClientSession : public msh::Session { public: virtual void force_requests_to_complete() override {} virtual pid_t process_id() const override { return 0; } virtual void take_snapshot(msh::SnapshotCallback const&) override {} virtual std::shared_ptr default_surface() const override { return surface; } virtual void set_lifecycle_state(MirLifecycleState) override {} virtual mf::SurfaceId create_surface(msh::SurfaceCreationParameters const& ) override {} virtual void destroy_surface(mf::SurfaceId) override {} virtual std::shared_ptr get_surface(mf::SurfaceId) const override { return surface; } virtual std::string name() const override { return "Shell"; } virtual void hide() override {} virtual void show() override {} virtual void send_display_config(mir::graphics::DisplayConfiguration const&) override {} virtual int configure_surface(mf::SurfaceId, MirSurfaceAttrib, int) override { return 0; } private: std::shared_ptr const surface; }; InProcessClientSession& global_session() { static InProcessClientSession session; return session; } } uams::Instance::Instance(std::shared_ptr const &surface_coordinator, std::shared_ptr const &placement_strategy, std::shared_ptr const &session_listener, uam::Description* description_, uam::Options *options_) : surface_coordinator(surface_coordinator), placement_strategy(placement_strategy), session_listener(session_listener), ref_count(1) { description = DescriptionPtr(description_, [] (uam::Description* p) { delete p; }); options = OptionsPtr(options_, [] (uam::Options* p) { delete p; }); } UApplicationInstance* uams::Instance::as_u_application_instance() { return static_cast(this); } uams::Instance* uams::Instance::from_u_application_instance(UApplicationInstance *u_instance) { return static_cast(u_instance); } void uams::Instance::ref() { ref_count++; } void uams::Instance::unref() { ref_count--; if (ref_count == 0) delete this; } std::shared_ptr uams::Instance::create_surface(msh::SurfaceCreationParameters const& parameters) { auto placed_params = placement_strategy->place(global_session(), parameters); auto surface = surface_coordinator->add_surface(placed_params, nullptr); // Need to call the SessionListener ourselves, else shell not notified of this surface creation session_listener->surface_created(global_session(), surface); return surface; } platform-api-0.20+14.04.20140411/src/ubuntu/mirserver/CMakeLists.txt0000644000015301777760000000156412322054725025317 0ustar pbusernogroup00000000000000set(SOURCES ubuntu_application_api_mirserver.cpp application_instance_mirserver.cpp window_properties_mirserver.cpp window_mirserver.cpp ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -fPIC") add_library( ubuntu_application_api_mirserver SHARED ${SOURCES} ) include_directories( ${CMAKE_BINARY_DIR}/include ${MIRSERVER_INCLUDE_DIRS} ) target_link_libraries( ubuntu_application_api_mirserver ${MIRSERVER_LDFLAGS} ${MIRSERVER_LIBRARIES} -Wl,--whole-archive ubuntu_application_api_mircommon ${UBUNTU_APPLICATION_API_LINK_LIBRARIES} -Wl,--no-whole-archive ) set_target_properties( ubuntu_application_api_mirserver PROPERTIES VERSION 1.0 SOVERSION 1 ) install(TARGETS ubuntu_application_api_mirserver ${INSTALL_TARGETS_DEFAULT_ARGS}) install(FILES ubuntu_application_api_mirserver_priv.h DESTINATION include/ubuntu/application) platform-api-0.20+14.04.20140411/src/ubuntu/mirserver/window_properties_mirserver_priv.h0000644000015301777760000000365712322054725031656 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Robert Carr */ #ifndef UBUNTU_APPLICATION_UI_WINDOW_PROPERTIES_MIRSERVER_PRIV_H_ #define UBUNTU_APPLICATION_UI_WINDOW_PROPERTIES_MIRSERVER_PRIV_H_ #include #include #include namespace ubuntu { namespace application { namespace mir { namespace server { class WindowProperties { public: WindowProperties(); ~WindowProperties() = default; UAUiWindowProperties* as_u_window_properties(); static WindowProperties* from_u_window_properties(UAUiWindowProperties* u_properties); void set_title(char const* title, size_t length); void set_input_cb_and_ctx(UAUiWindowInputEventCb cb, void* ctx); void set_dimensions(uint32_t width, uint32_t height); void set_pixel_format( MirPixelFormat const& format); ::mir::shell::SurfaceCreationParameters const& surface_parameters() const; UAUiWindowInputEventCb input_cb() const; void* input_context() const; protected: WindowProperties(WindowProperties const&) = delete; WindowProperties& operator=(WindowProperties const&) = delete; private: ::mir::shell::SurfaceCreationParameters parameters; UAUiWindowInputEventCb cb; void *input_ctx; }; } } } } #endif platform-api-0.20+14.04.20140411/src/ubuntu/CMakeLists.txt0000644000015301777760000000106412322054725023274 0ustar pbusernogroup00000000000000include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ) add_subdirectory(application) add_subdirectory(testbackend) set( UBUNTU_APPLICATION_API_LINK_LIBRARIES ubuntu_application_location ubuntu_application_url_dispatcher ) if(ENABLE_HYBRIS_IMPLEMENTATION) add_subdirectory(hybris/) endif() if(ENABLE_MIRSERVER_IMPLEMENTATION OR ENABLE_MIRCLIENT_IMPLEMENTATION) add_subdirectory(mircommon/) endif() if(ENABLE_MIRSERVER_IMPLEMENTATION) add_subdirectory(mirserver/) endif() if(ENABLE_MIRCLIENT_IMPLEMENTATION) add_subdirectory(mirclient/) endif() platform-api-0.20+14.04.20140411/src/ubuntu/testbackend/0000755000015301777760000000000012322055312023013 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/src/ubuntu/testbackend/ubuntu_application_sensors.cpp0000644000015301777760000003760212322054725031217 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Martin Pitt */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; // necessary for functions that return float // pcs attribute (calling convention) is only defined on ARM, avoid warning on // other platforms #ifdef __arm__ #define __SF_FN_ATTR __attribute__((pcs("aapcs"))) #else #define __SF_FN_ATTR #endif /*************************************** * * test sensor implementation * ***************************************/ // this is only internal API, so we make everything public struct TestSensor { TestSensor(ubuntu_sensor_type _type, float _min_value, float _max_value, float _resolution) : type(_type), enabled(false), resolution(_resolution), min_delay(0), min_value(_min_value), max_value(_max_value), on_event_cb(NULL), event_cb_context(NULL), x(_min_value), y(_min_value), z(_min_value), distance((UASProximityDistance) 0), // LP#1256969 timestamp(0) {} ubuntu_sensor_type type; bool enabled; float resolution; uint32_t min_delay; float min_value, max_value; void (*on_event_cb)(void*, void*); void* event_cb_context; /* current value; note that we do not track separate Event objects/pointers * at all, and just always deliver the current value */ float x, y, z; UASProximityDistance distance; uint64_t timestamp; }; /* Singleton which reads the sensor data file and maintains the TestSensor * instances */ class SensorController { public: // Ensure that controller is initialized, and return singleton static SensorController& instance() { static SensorController _inst; return _inst; } // Return TestSensor of given type, or NULL if it doesn't exist TestSensor* get(ubuntu_sensor_type type) { try { return sensors.at(type).get(); } catch (const out_of_range&) { return NULL; } } private: SensorController(); bool next_command(); bool process_create_command(); void process_event_command(); void setup_timer(unsigned delay_ms); static void on_timer(union sigval sval); static ubuntu_sensor_type type_from_name(const string& type) { if (type == "light") return ubuntu_sensor_type_light; if (type == "proximity") return ubuntu_sensor_type_proximity; if (type == "accel") return ubuntu_sensor_type_accelerometer; cerr << "TestSensor ERROR: unknown sensor type " << type << endl; abort(); } map> sensors; ifstream data; // current command/event string current_command; TestSensor* event_sensor; float event_x, event_y, event_z; UASProximityDistance event_distance; }; SensorController::SensorController() { const char* path = getenv("UBUNTU_PLATFORM_API_SENSOR_TEST"); if (path == NULL) { cerr << "TestSensor ERROR: Need $UBUNTU_PLATFORM_API_SENSOR_TEST to point to a data file\n"; abort(); } //cout << "SensorController ctor: opening " << path << endl; data.open(path); if (!data.is_open()) { cerr << "TestSensor ERROR: Failed to open data file " << path << ": " << strerror(errno) << endl; abort(); } // process all "create" commands while (next_command()) { if (!process_create_command()) break; } // start event processing if (!data.eof()) process_event_command(); } bool SensorController::next_command() { while (getline(data, current_command)) { // trim leading and trailing space current_command.erase(0, current_command.find_first_not_of(" \t")); current_command.erase(current_command.find_last_not_of(" \t") + 1); // ignore empty or comment lines if (current_command.size() == 0 || current_command[0] == '#') continue; return true; } return false; } bool SensorController::process_create_command() { stringstream ss(current_command, ios_base::in); string token; // we only process "create" commands here; if we have something else, stop ss >> token; if (token != "create") return false; ss >> token; ubuntu_sensor_type type = type_from_name(token); if (get(type) != NULL) { cerr << "TestSensor ERROR: duplicate creation of sensor type " << token << endl; abort(); } float min = 0, max = 0, resolution = 0; if (type != ubuntu_sensor_type_proximity) { // read min, max, resolution ss >> min >> max >> resolution; if (max <= min) { cerr << "TestSensor ERROR: max_value must be >= min_value in " << current_command << endl; abort(); } if (resolution <= 0) { cerr << "TestSensor ERROR: resolution must be > 0 in " << current_command << endl; abort(); } } //cout << "SensorController::process_create_command: type " << type << " min " << min << " max " << max << " res " << resolution << endl; sensors[type] = make_shared(type, min, max, resolution); return true; } void SensorController::process_event_command() { stringstream ss(current_command, ios_base::in); int delay; //cout << "TestSensor: processing event " << current_command << endl; // parse delay ss >> delay; if (delay <= 0) { cerr << "TestSensor ERROR: delay must be positive in command " << current_command << endl; abort(); } // parse sensor type string token; ss >> token; ubuntu_sensor_type type = type_from_name(token); event_sensor = get(type); if (event_sensor == NULL) { cerr << "TestSensor ERROR: sensor does not exist, you need to create it: " << token << endl; abort(); } switch (type) { case ubuntu_sensor_type_light: ss >> event_x; //cout << "got event: sensor type " << type << " (light), delay " // << delay << " ms, value " << event_x << endl; break; case ubuntu_sensor_type_accelerometer: ss >> event_x >> event_y >> event_z; //cout << "got event: sensor type " << type << " (accel), delay " // << delay << " ms, value " << event_x << "/" << event_y << "/" << event_z << endl; break; case ubuntu_sensor_type_proximity: ss >> token; if (token == "unknown") event_distance = (UASProximityDistance) 0; // LP#1256969 else if (token == "near") event_distance = U_PROXIMITY_NEAR; else if (token == "far") event_distance = U_PROXIMITY_FAR; else { cerr << "TestSensor ERROR: unknown proximity value " << token << endl; abort(); } //cout << "got event: sensor type " << type << " (proximity), delay " // << delay << " ms, value " << int(event_distance) << endl; break; default: cerr << "TestSensor ERROR: unhandled sensor type " << token << endl; abort(); } // wake up after given delay for committing the change and processing the // next event setup_timer(unsigned(delay)); } void SensorController::setup_timer(unsigned delay_ms) { static timer_t timerid; // we keep a pointer to that until on_timer struct sigevent sev; struct itimerspec its { {0, 0}, // interval {time_t(delay_ms / 1000), long((delay_ms % 1000) * 1000000L) % 1000000000L } }; sev.sigev_notify = SIGEV_THREAD; sev.sigev_notify_function = SensorController::on_timer; sev.sigev_notify_attributes = NULL; sev.sigev_value.sival_ptr = &timerid; if (timer_create(CLOCK_MONOTONIC, &sev, &timerid) < 0) { perror("TestSensor ERROR: Failed to create timer"); abort(); } if (timer_settime(timerid, 0, &its, NULL) < 0) { perror("TestSensor ERROR: Failed to set up timer"); abort(); }; } void SensorController::on_timer(union sigval sval) { timer_t* timerid = static_cast(sval.sival_ptr); //cout << "on_timer called\n"; timer_delete(*timerid); SensorController& sc = SensorController::instance(); // update sensor values, call callback if (sc.event_sensor && sc.event_sensor->enabled) { sc.event_sensor->x = sc.event_x; sc.event_sensor->y = sc.event_y; sc.event_sensor->z = sc.event_z; sc.event_sensor->distance = sc.event_distance; sc.event_sensor->timestamp = chrono::duration_cast( chrono::system_clock::now().time_since_epoch()).count(); if (sc.event_sensor->on_event_cb != NULL) { //cout << "TestSensor: calling sensor callback for type " << sc.event_sensor->type << endl; sc.event_sensor->on_event_cb(sc.event_sensor, sc.event_sensor->event_cb_context); } else { //cout << "TestSensor: sensor type " << sc.event_sensor->type << "has no callback\n"; } } else { //cout << "TestSensor: sensor type " << sc.event_sensor->type << "disabled, not processing event\n"; } // read/process next event if (sc.next_command()) sc.process_event_command(); else { //cout << "TestSensor: script ended, no further commands\n"; } } /*************************************** * * Acceleration API * ***************************************/ UASensorsAccelerometer* ua_sensors_accelerometer_new() { return SensorController::instance().get(ubuntu_sensor_type_accelerometer); } UStatus ua_sensors_accelerometer_enable(UASensorsAccelerometer* s) { static_cast(s)->enabled = true; return (UStatus) 0; } UStatus ua_sensors_accelerometer_disable(UASensorsAccelerometer* s) { static_cast(s)->enabled = false; return (UStatus) 0; } uint32_t ua_sensors_accelerometer_get_min_delay(UASensorsAccelerometer* s) { return static_cast(s)->min_delay; } float ua_sensors_accelerometer_get_min_value(UASensorsAccelerometer* s) __SF_FN_ATTR; float ua_sensors_accelerometer_get_min_value(UASensorsAccelerometer* s) { return static_cast(s)->min_value; } float ua_sensors_accelerometer_get_max_value(UASensorsAccelerometer* s) __SF_FN_ATTR; float ua_sensors_accelerometer_get_max_value(UASensorsAccelerometer* s) { return static_cast(s)->max_value; } float ua_sensors_accelerometer_get_resolution(UASensorsAccelerometer* s) __SF_FN_ATTR; float ua_sensors_accelerometer_get_resolution(UASensorsAccelerometer* s) { return static_cast(s)->resolution; } void ua_sensors_accelerometer_set_reading_cb(UASensorsAccelerometer* s, on_accelerometer_event_cb cb, void* ctx) { TestSensor* sensor = static_cast(s); sensor->on_event_cb = cb; sensor->event_cb_context = ctx; } uint64_t uas_accelerometer_event_get_timestamp(UASAccelerometerEvent* e) { return static_cast(e)->timestamp; } float uas_accelerometer_event_get_acceleration_x(UASAccelerometerEvent* e) __SF_FN_ATTR; float uas_accelerometer_event_get_acceleration_x(UASAccelerometerEvent* e) { return static_cast(e)->x; } float uas_accelerometer_event_get_acceleration_y(UASAccelerometerEvent* e) __SF_FN_ATTR; float uas_accelerometer_event_get_acceleration_y(UASAccelerometerEvent* e) { return static_cast(e)->y; } float uas_accelerometer_event_get_acceleration_z(UASAccelerometerEvent* e) __SF_FN_ATTR; float uas_accelerometer_event_get_acceleration_z(UASAccelerometerEvent* e) { return static_cast(e)->z; } /*************************************** * * Proximity API * ***************************************/ UASensorsProximity* ua_sensors_proximity_new() { return SensorController::instance().get(ubuntu_sensor_type_proximity); } UStatus ua_sensors_proximity_enable(UASensorsProximity* s) { static_cast(s)->enabled = true; return (UStatus) 0; } UStatus ua_sensors_proximity_disable(UASensorsProximity* s) { static_cast(s)->enabled = false; return (UStatus) 0; } uint32_t ua_sensors_proximity_get_min_delay(UASensorsProximity* s) { return static_cast(s)->min_delay; } // the next three function make no sense in the API, just return zero float ua_sensors_proximity_get_min_value(UASensorsProximity*) __SF_FN_ATTR; float ua_sensors_proximity_get_min_value(UASensorsProximity*) { return 0.0; } float ua_sensors_proximity_get_max_value(UASensorsProximity*) __SF_FN_ATTR; float ua_sensors_proximity_get_max_value(UASensorsProximity*) { return 0.0; } float ua_sensors_proximity_get_resolution(UASensorsProximity*) __SF_FN_ATTR; float ua_sensors_proximity_get_resolution(UASensorsProximity*) { return 0.0; } void ua_sensors_proximity_set_reading_cb(UASensorsProximity* s, on_proximity_event_cb cb, void* ctx) { TestSensor* sensor = static_cast(s); sensor->on_event_cb = cb; sensor->event_cb_context = ctx; } uint64_t uas_proximity_event_get_timestamp(UASProximityEvent* e) { return static_cast(e)->timestamp; } UASProximityDistance uas_proximity_event_get_distance(UASProximityEvent* e) { return static_cast(e)->distance; } /*************************************** * * Light API * ***************************************/ UASensorsLight* ua_sensors_light_new() { return SensorController::instance().get(ubuntu_sensor_type_light); } UStatus ua_sensors_light_enable(UASensorsLight* s) { static_cast(s)->enabled = true; return (UStatus) 0; } UStatus ua_sensors_light_disable(UASensorsLight* s) { static_cast(s)->enabled = false; return (UStatus) 0; } uint32_t ua_sensors_light_get_min_delay(UASensorsLight* s) { return static_cast(s)->min_delay; } float ua_sensors_light_get_min_value(UASensorsLight* s) __SF_FN_ATTR; float ua_sensors_light_get_min_value(UASensorsLight* s) { return static_cast(s)->min_value; } float ua_sensors_light_get_max_value(UASensorsLight* s) __SF_FN_ATTR; float ua_sensors_light_get_max_value(UASensorsLight* s) { return static_cast(s)->max_value; } float ua_sensors_light_get_resolution(UASensorsLight* s) __SF_FN_ATTR; float ua_sensors_light_get_resolution(UASensorsLight* s) { return static_cast(s)->resolution; } void ua_sensors_light_set_reading_cb(UASensorsLight* s, on_light_event_cb cb, void* ctx) { TestSensor* sensor = static_cast(s); sensor->on_event_cb = cb; sensor->event_cb_context = ctx; } uint64_t uas_light_event_get_timestamp(UASLightEvent* e) { return static_cast(e)->timestamp; } float uas_light_event_get_light(UASLightEvent* e) __SF_FN_ATTR; float uas_light_event_get_light(UASLightEvent* e) { return static_cast(e)->x; } platform-api-0.20+14.04.20140411/src/ubuntu/testbackend/README.md0000644000015301777760000000465012322054725024306 0ustar pbusernogroup00000000000000Testing applications with simulated sensor data =============================================== Purpose ------- platform-api's interface to sensor data is in the shared library `libubuntu_platform_hardware_api.so`. That is only a stub which dynamically (dlopen) loads a backend library which provides the actual implementation. By default this is `/system/lib/libubuntu_application_api.so` which reads sensor data from the Android side. For testing purposes this can be replaced with this `libubuntu_application_api_test.so.1` which simulates sensors and their data based on a simple text input file. Using the test sensors ---------------------- Run your application under test with the environment variable UBUNTU_PLATFORM_API_BACKEND=libubuntu_application_api_test.so.1 and make sure that ld.so(8) can find it. If you don't have the library installed in a standard system library path, it is recommended to set `LD_LIBRARY_PATH` to the directory that contains the library (usually when using the library right out of the build tree). Alternatively you can specify the full path in `$UBUNTU_PLATFORM_API_BACKEND`. The env variable `$UBUNTU_PLATFORM_API_SENSOR_TEST` needs to point to a file that describes the desired sensor behaviour. Data format ----------- The test sensors use a simple line based file format. The first part instantiates desired sensors with their parameters: create [accel|light] # but no arguments for proximity sensor: create proximity After that, it defines events; specifies time after previous event in ms: proximity [unknown|near|far] light accel Empty lines and comment lines (starting with #) are allowed. Example file: create light 0 10 1 create accel 0 1000 0.1 create proximity 200 proximity near 500 light 5 # simulate crash on the ground 500 accel 0.2 0.1 10 100 accel 0.2 0.2 1000 20 accel 0 0 0 10 proximity far 0 light 10 Complete example ---------------- * Build platform-api: mkdir obj; (cd obj; cmake .. && make) * Put above example file into /tmp/test.sensors * Run the sensor test with it: LD_LIBRARY_PATH=obj/src/ubuntu/testbackend \ UBUNTU_PLATFORM_API_BACKEND=libubuntu_application_api_test.so.1 \ UBUNTU_PLATFORM_API_SENSOR_TEST=/tmp/test.sensors \ obj/src/ubuntu/hybris/tests/test_android_sensors_api platform-api-0.20+14.04.20140411/src/ubuntu/testbackend/CMakeLists.txt0000644000015301777760000000114312322054725025561 0ustar pbusernogroup00000000000000set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11") add_library( ubuntu_application_api_test SHARED ubuntu_application_sensors.cpp ) set_target_properties( ubuntu_application_api_test PROPERTIES VERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR}.${UBUNTU_PLATFORM_API_VERSION_MINOR}.${UBUNTU_PLATFORM_API_VERSION_PATCH} SOVERSION ${UBUNTU_PLATFORM_API_VERSION_MAJOR} ) install( TARGETS ubuntu_application_api_test # this is not a development library to compile against, users should always # specify the SONAME; so don't build a *.so LIBRARY DESTINATION "${LIB_INSTALL_DIR}" NAMELINK_SKIP ) platform-api-0.20+14.04.20140411/src/CMakeLists.txt0000644000015301777760000000011712322054725021750 0ustar pbusernogroup00000000000000include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ) add_subdirectory(ubuntu) platform-api-0.20+14.04.20140411/include/0000755000015301777760000000000012322055312020036 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/include/ubuntu/0000755000015301777760000000000012322055312021360 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/include/ubuntu/application/0000755000015301777760000000000012322055312023663 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/include/ubuntu/application/operation_mode.h0000644000015301777760000000214412322054725027050 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza * Thomas Voß */ #ifndef UBUNTU_APPLICATION_OPERATION_MODE_H_ #define UBUNTU_APPLICATION_OPERATION_MODE_H_ /** * \brief Describes the different operational modes that an * application can run in. */ typedef enum { U_APPLICATION_FOREGROUND_APP, U_APPLICATION_BACKGROUND_SERVICE } UApplicationOperationMode; #endif /* UBUNTU_APPLICATION_OPERATION_MODE_H_ */ platform-api-0.20+14.04.20140411/include/ubuntu/application/instance.h0000644000015301777760000000615012322054725025651 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza * Thomas Voß */ #ifndef UBUNTU_APPLICATION_INSTANCE_H_ #define UBUNTU_APPLICATION_INSTANCE_H_ #include #include #include #ifdef __cplusplus extern "C" { #endif /** \defgroup application_support Functions and types to support application development. */ /** * \brief Opaque type describing an application instance. * \ingroup application_support * An application instance encapsulates the event loop of an app. */ typedef void UApplicationInstance; /** * \brief Creates a new application instance with a reference count of 1. * \ingroup application_support * \returns A new application instance or NULL in case of low-memory. * \param[in] desc A description object, must not be NULL. * \param[in] options An options object, must not be NULL. */ UBUNTU_DLL_PUBLIC UApplicationInstance* u_application_instance_new_from_description_with_options( UApplicationDescription *desc, UApplicationOptions *options); /** * \brief Increments the reference count of an application instance. * \ingroup application_support * \param[in] instance The instance to increment the reference count for. */ UBUNTU_DLL_PUBLIC void u_application_instance_ref( UApplicationInstance *instance); /** * \brief Decrements the reference count of an application instance and releases all resources held by the object if the reference count reaches 0. * \ingroup application_support * \param[in] instance The instance to decrement the reference count for. */ UBUNTU_DLL_PUBLIC void u_application_instance_unref( UApplicationInstance *instance); /** * \brief Destroys the application instance and releases all its resources. * \ingroup application_support * \param[in] instance The instance to be destroyed. */ UBUNTU_DLL_PUBLIC void u_application_instance_destroy( UApplicationInstance *instance); /** * \brief Executes the event loop of the application instance * \ingroup application_support * \param[in] instance The instance to be executed. */ UBUNTU_DLL_PUBLIC void u_application_instance_run( UApplicationInstance *instance); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_INSTANCE_H_ */ platform-api-0.20+14.04.20140411/include/ubuntu/application/location/0000755000015301777760000000000012322055312025473 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/include/ubuntu/application/location/velocity_update.h0000644000015301777760000000507512322054725031062 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_LOCATION_VELOCITY_UPDATE_H_ #define UBUNTU_APPLICATION_LOCATION_VELOCITY_UPDATE_H_ #include #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Opaque type encapsulating a velocity update. * \ingroup location_service */ typedef struct UbuntuApplicationLocationVelocityUpdate UALocationVelocityUpdate; /** * \brief Increments the reference count of the velocity update instance. * \ingroup location_service * \param[in] update The velocity update instance to increment the reference count for. */ UBUNTU_DLL_PUBLIC void ua_location_velocity_update_ref( UALocationVelocityUpdate *update); /** * \brief Decrements the reference count of the velocity update instance. * \ingroup location_service * \param[in] update The velocity update instance to decrement the reference count for. */ UBUNTU_DLL_PUBLIC void ua_location_velocity_update_unref( UALocationVelocityUpdate *update); /** * \brief Queries the timestamp of the velocity update. * \ingroup location_service * \returns The timestamp of the position update in [µs]. * \param[in] update The velocity update instance to be queried. */ UBUNTU_DLL_PUBLIC uint64_t ua_location_velocity_update_get_timestamp( UALocationVelocityUpdate *update); /** * \brief Queries the velocity contained in the position update. * \ingroup location_service * \returns The velocity in the position update in [m/s]. * \param[in] update The velocity update instance to be queried. */ UBUNTU_DLL_PUBLIC double ua_location_velocity_update_get_velocity_in_meters_per_second( UALocationVelocityUpdate *update); #ifdef __cplusplus } #endif #endif // UBUNTU_APPLICATION_LOCATION_VELOCITY_UPDATE_H_ platform-api-0.20+14.04.20140411/include/ubuntu/application/location/heading_update.h0000644000015301777760000000501012322054725030610 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_LOCATION_HEADING_UPDATE_H_ #define UBUNTU_APPLICATION_LOCATION_HEADING_UPDATE_H_ #include #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Opaque type encapsulating a heading update. * \ingroup location_service */ typedef struct UbuntuApplicationLocationHeadingUpdate UALocationHeadingUpdate; /** * \brief Increments the reference count of the heading update instance. * \ingroup location_service * \param[in] update The heading update instance to increment the reference count for. */ UBUNTU_DLL_PUBLIC void ua_location_heading_update_ref( UALocationHeadingUpdate *update); /** * \brief Decrements the reference count of the heading update instance. * \ingroup location_service * \param[in] update The heading update instance to decrement the reference count for. */ UBUNTU_DLL_PUBLIC void ua_location_heading_update_unref( UALocationHeadingUpdate *update); /** * \brief Queries the timestamp of the heading update. * \ingroup location_service * \returns The timestamp of the heading update in [µs]. * \param[in] update The heading update instance to be queried. */ UBUNTU_DLL_PUBLIC uint64_t ua_location_heading_update_get_timestamp( UALocationHeadingUpdate *update); /** * \brief Queries the new heading from the update. * \ingroup location_service * \returns The new heading from the update in [°]. * \param[in] update The heading update instance to be queried. */ UBUNTU_DLL_PUBLIC double ua_location_heading_update_get_heading_in_degree( UALocationHeadingUpdate *update); #ifdef __cplusplus } #endif #endif // UBUNTU_APPLICATION_LOCATION_HEADING_UPDATE_H_ platform-api-0.20+14.04.20140411/include/ubuntu/application/location/session.h0000644000015301777760000001444212322054725027343 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_LOCATION_SESSION_H_ #define UBUNTU_APPLICATION_LOCATION_SESSION_H_ #include #include #include #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Opaque type encapsulating a session with the location service. * \ingroup location_service */ typedef struct UbuntuApplicationLocationServiceSession UALocationServiceSession; /** * \brief Callback type that is invoked for position updates. * \ingroup location_service */ typedef void (*UALocationServiceSessionPositionUpdatesHandler)( UALocationPositionUpdate *position, void *context); /** * \brief Callback type that is invoked for heading updates. * \ingroup location_service */ typedef void (*UALocationServiceSessionHeadingUpdatesHandler)( UALocationHeadingUpdate *heading, void *context); /** * \brief Callback type that is invoked for velocity updates. * \ingroup location_service */ typedef void (*UALocationServiceSessionVelocityUpdatesHandler)( UALocationVelocityUpdate *heading, void *context); /** * \brief Increments the reference count of the session instance. * \ingroup location_service * \param[in] session The session instance to increment the reference count for. */ UBUNTU_DLL_PUBLIC void ua_location_service_session_ref( UALocationServiceSession *session); /** * \brief Decrements the reference count of the session instance. * \ingroup location_service * \param[in] session The session instance to decrement the reference count for. */ UBUNTU_DLL_PUBLIC void ua_location_service_session_unref( UALocationServiceSession *session); /** * \brief Installs an app-specific position update handler for the session. * \ingroup location_service * \param[in] session The session instance to install the handler for. * \param[in] handler The position update handler. */ UBUNTU_DLL_PUBLIC void ua_location_service_session_set_position_updates_handler( UALocationServiceSession *session, UALocationServiceSessionPositionUpdatesHandler handler, void *context); /** * \brief Installs an app-specific heading update handler for the session. * \ingroup location_service * \param[in] session The session instance to install the handler for. * \param[in] handler The heading update handler. */ UBUNTU_DLL_PUBLIC void ua_location_service_session_set_heading_updates_handler( UALocationServiceSession *session, UALocationServiceSessionHeadingUpdatesHandler handler, void *context); /** * \brief Installs an app-specific velocity update handler for the session. * \ingroup location_service * \param[in] session The session instance to install the handler for. * \param[in] handler The velocity update handler. */ UBUNTU_DLL_PUBLIC void ua_location_service_session_set_velocity_updates_handler( UALocationServiceSession *session, UALocationServiceSessionVelocityUpdatesHandler handler, void *context); /** * \brief Starts position updates for the supplied session. * \ingroup location_service * \returns U_STATUS_SUCCESS if the updates were successfully started on the service side, else U_STATUS_ERROR. * \param[in] session The session instance to start position updates for. */ UBUNTU_DLL_PUBLIC UStatus ua_location_service_session_start_position_updates( UALocationServiceSession *session); /** * \brief Stops position updates for the supplied session. * \ingroup location_service * \param[in] session The session instance to stop position updates for. */ UBUNTU_DLL_PUBLIC void ua_location_service_session_stop_position_updates( UALocationServiceSession *session); /** * \brief Starts heading updates for the supplied session. * \ingroup location_service * \returns U_STATUS_SUCCESS if the updates were successfully started on the service side, else U_STATUS_ERROR. * \param[in] session The session instance to start heading updates for. */ UBUNTU_DLL_PUBLIC UStatus ua_location_service_session_start_heading_updates( UALocationServiceSession *session); /** * \brief Stops heading updates for the supplied session. * \ingroup location_service * \param[in] session The session instance to stop heading updates for. */ UBUNTU_DLL_PUBLIC void ua_location_service_session_stop_heading_updates( UALocationServiceSession *session); /** * \brief Starts velocity updates for the supplied session. * \ingroup location_service * \returns U_STATUS_SUCCESS if the updates were successfully started on the service side, else U_STATUS_ERROR. * \param[in] session The session instance to start velocity updates for. */ UBUNTU_DLL_PUBLIC UStatus ua_location_service_session_start_velocity_updates( UALocationServiceSession *session); /** * \brief Stops velocity updates for the supplied session. * \ingroup location_service * \param[in] session The session instance to stop velocity updates for. */ UBUNTU_DLL_PUBLIC void ua_location_service_session_stop_velocity_updates( UALocationServiceSession *session); #ifdef __cplusplus } #endif #endif // UBUNTU_APPLICATION_LOCATION_SESSION_H_ platform-api-0.20+14.04.20140411/include/ubuntu/application/location/service.h0000644000015301777760000001033512322054725027315 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_LOCATION_SERVICE_H_ #define UBUNTU_APPLICATION_LOCATION_SERVICE_H_ #include #include #include #ifdef __cplusplus extern "C" { #endif /** * \defgroup location_service Functions and types to provide location services to applications. * * Applications in Ubuntu do not access positioning hardware * directly but instead rely on a system-wide location service to * be provided with position, heading and velocity updates. An * application that wants to receive position, heading or * velocity updates needs to start a session with the location * service and specify its requirements with the help * UALocationServiceRequirementsFlags. After the session has been * created, position, heading and velocity updates need to be * started by the application for its session. The actual updates * are delivered via callbacks. Please note that the location * service caches updates as good as possible. That is, if an * application is only interested in a single position fix, and a * reasonable fix is already known to the service, the * information is immediately delivered to the application when * the respecitve updates are started. * */ /** * \brief Application-specific requirements. * \ingroup location_service */ typedef enum { UA_LOCATION_SERVICE_REQUIRE_ALTITUDE = 1 << 0, /**< The application requires altitude updates. */ UA_LOCATION_SERVICE_REQUIRE_HEADING = 1 << 1, /**< The application requires heading updates. */ UA_LOCATION_SERVICE_REQUIRE_VELOCITY = 1 << 2 /**< The application requires velocity updates. */ } UbuntuApplicationLocationServiceRequirement; typedef UbuntuApplicationLocationServiceRequirement UALocationServiceRequirement; /** * \brief Bitfield type for summarizing an application's requirements. * \ingroup location_service */ typedef unsigned int UALocationServiceRequirementsFlags; /** * \brief Creates a new session with the location service for low positional accuracy requirements. * \ingroup location_service * \returns A new session or NULL if the requirements cannot be * satisfied or if the app lacks permissions to access the * location service. * \param[in] Bitfield describing the application's requirements. */ UBUNTU_DLL_PUBLIC UALocationServiceSession* ua_location_service_create_session_for_low_accuracy( UALocationServiceRequirementsFlags flags); /** * \brief Creates a new session with the location service for high positional accuracy requirements. * \ingroup location_service * \returns A new session or NULL if the requirements cannot be * satisfied or if the app lacks permissions to access the * location service. * \param[in] Bitfield describing the application's requirements. */ UBUNTU_DLL_PUBLIC UALocationServiceSession* ua_location_service_create_session_for_high_accuracy( UALocationServiceRequirementsFlags flags); /** * \brief Creates a new controller for the location service. * \ingroup location_service * \returns A controller or NULL if the calling process does not * have sufficient privileges. */ UBUNTU_DLL_PUBLIC UALocationServiceController* ua_location_service_create_controller(); #ifdef __cplusplus } #endif #endif // UBUNTU_APPLICATION_LOCATION_SERVICE_H_ platform-api-0.20+14.04.20140411/include/ubuntu/application/location/position_update.h0000644000015301777760000000722612322054725031070 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_LOCATION_POSITION_UPDATE_H_ #define UBUNTU_APPLICATION_LOCATION_POSITION_UPDATE_H_ #include #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Opaque type encapsulating a location update. * \ingroup location_service */ typedef struct UbuntuApplicationLocationPositionUpdate UALocationPositionUpdate; /** * \brief Increments the reference count of the position update instance. * \ingroup location_service * \param[in] update The position update instance to increment the reference count for. */ UBUNTU_DLL_PUBLIC void ua_location_position_update_ref( UALocationPositionUpdate *update); /** * \brief Decrements the reference count of the position update instance. * \ingroup location_service * \param[in] update The position update instance to decrement the reference count for. */ UBUNTU_DLL_PUBLIC void ua_location_position_update_unref( UALocationPositionUpdate *update); /** * \brief Queries the timestamp of the position update. * \ingroup location_service * \returns The timestamp of the position update in [µs]. * \param[in] update The position update instance to be queried. */ UBUNTU_DLL_PUBLIC uint64_t ua_location_position_update_get_timestamp( UALocationPositionUpdate *update); /** * \brief Queries the latitude contained in the position update. * \ingroup location_service * \returns The latitude of the position update in [°]. * \param[in] update The position update instance to be queried. */ UBUNTU_DLL_PUBLIC double ua_location_position_update_get_latitude_in_degree( UALocationPositionUpdate *update); /** * \brief Queries the longitude contained in the position update. * \ingroup location_service * \returns The longitude of the position update in [°]. * \param[in] update The position update instance to be queried. */ UBUNTU_DLL_PUBLIC double ua_location_position_update_get_longitude_in_degree( UALocationPositionUpdate *update); /** * \brief Checks if the position update contains an altitude. * \ingroup location_service * \returns TRUE if the update contains an altitude, else FALSE. * \param[in] update The position update instance to be queried. */ UBUNTU_DLL_PUBLIC bool ua_location_position_update_has_altitude( UALocationPositionUpdate *update); /** * \brief Queries the altitude contained in the position update. * \ingroup location_service * \returns The altitude of the position update in [m]. * \param[in] update The position update instance to be queried. */ UBUNTU_DLL_PUBLIC double ua_location_position_update_get_altitude_in_meter( UALocationPositionUpdate *update); #ifdef __cplusplus } #endif #endif // UBUNTU_APPLICATION_LOCATION_POSITION_UPDATE_H_ platform-api-0.20+14.04.20140411/include/ubuntu/application/location/CMakeLists.txt0000644000015301777760000000037512322054725030247 0ustar pbusernogroup00000000000000set( UBUNTU_APPLICATION_LOCATION_HEADERS controller.h heading_update.h position_update.h service.h session.h velocity_update.h ) install( FILES ${UBUNTU_APPLICATION_LOCATION_HEADERS} DESTINATION include/ubuntu/application/location ) platform-api-0.20+14.04.20140411/include/ubuntu/application/location/controller.h0000644000015301777760000001144712322054725030045 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_LOCATION_SERVICE_CONTROLLER_H_ #define UBUNTU_APPLICATION_LOCATION_SERVICE_CONTROLLER_H_ #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Location service status. * \ingroup location_service */ typedef enum { UA_LOCATION_SERVICE_ENABLED = 1 << 0, /**< The service is enabled. */ UA_LOCATION_SERVICE_DISABLED = 1 << 1, /**< The service is disabled. */ UA_LOCATION_SERVICE_GPS_ENABLED = 1 << 2, /**< GPS providers are enabled. */ UA_LOCATION_SERVICE_GPS_DISABLED = 1 << 3, /**< GPS providers are disabled. */ } UbuntuApplicationLocationServiceStatus; typedef UbuntuApplicationLocationServiceStatus UALocationServiceStatus; typedef unsigned int UALocationServiceStatusFlags; /** * \brief Callback type that is invoked when the location service status changes. * \ingroup location_service */ typedef void (*UALocationServiceStatusChangedHandler)( UALocationServiceStatusFlags flags, void *context); /** * \brief Opaque type encapsulating a controller the location service. * \ingroup location_service */ typedef struct UbuntuApplicationLocationServiceController UALocationServiceController; /** * \brief Increments the reference count of the controller instance. * \ingroup location_service * \param[in] controller The controller instance to increment the reference count for. */ UBUNTU_DLL_PUBLIC void ua_location_service_controller_ref( UALocationServiceController *controller); /** * \brief Decrements the reference count of the controller instance. * \ingroup location_service * \param[in] controller The controller instance to decrement the reference count for. */ UBUNTU_DLL_PUBLIC void ua_location_service_controller_unref( UALocationServiceController *controller); /** * \brief Sets the status changed handler of the controller instance. * \ingroup location_service * \param[in] controller The controller instance. * \param[in] handler The status changed handler to invoke. * \param[in] context The context pointer to pass in the status changed handler */ UBUNTU_DLL_PUBLIC void ua_location_service_controller_set_status_changed_handler( UALocationServiceController *controller, UALocationServiceStatusChangedHandler handler, void *context); /** * \brief Query the status of the location service. * \ingroup location_service * \param[in] controller The controller instance. * \param[out] flags Flags indicating the service status. */ UBUNTU_DLL_PUBLIC UStatus ua_location_service_controller_query_status( UALocationServiceController *controller, UALocationServiceStatusFlags *out_flags); /** * \brief Enables the location service. * \ingroup location_service * \param[in] controller The controller instance. */ UBUNTU_DLL_PUBLIC UStatus ua_location_service_controller_enable_service( UALocationServiceController *controller); /** * \brief Disables the location service completely. * \ingroup location_service * \param[in] controller The controller instance. */ UBUNTU_DLL_PUBLIC UStatus ua_location_service_controller_disable_service( UALocationServiceController *controller); /** * \brief Enables all gps providers known to the location service. * \ingroup location_service * \param[in] controller The controller instance. */ UBUNTU_DLL_PUBLIC UStatus ua_location_service_controller_enable_gps( UALocationServiceController *controller); /** * \brief Disables all gps providers known to the location service. * \ingroup location_service * \param[in] controller The controller instance. */ UBUNTU_DLL_PUBLIC UStatus ua_location_service_controller_disable_gps( UALocationServiceController *controller); #ifdef __cplusplus } #endif #endif // UBUNTU_APPLICATION_LOCATION_SERVICE_CONTROLLER_H_ platform-api-0.20+14.04.20140411/include/ubuntu/application/description.h0000644000015301777760000000675512322054725026403 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza * Thomas Voß */ #ifndef UBUNTU_APPLICATION_DESCRIPTION_H_ #define UBUNTU_APPLICATION_DESCRIPTION_H_ #include #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Encapsulates properties of an application instance. * \ingroup application_support */ typedef void UApplicationDescription; /** * \brief Creates a new instance of application description. * \ingroup application_support * \returns A new application description instance or NULL if not enough memory is available. */ UBUNTU_DLL_PUBLIC UApplicationDescription* u_application_description_new(); /** * \brief Destroys an instance of application description and releases all resources. * \ingroup application_support * \param[in] desc The instance to be destroyed. */ UBUNTU_DLL_PUBLIC void u_application_description_destroy( UApplicationDescription *desc); /** * \brief Sets the application id contained in the description instance. * \ingroup application_support * \param[in] desc The application description instance, must not be NULL. * \param[in] id The new application id, must not be NULL. */ UBUNTU_DLL_PUBLIC void u_application_description_set_application_id( UApplicationDescription *desc, UApplicationId *id); /** * \brief Queries the application id contained in the description instance. * \ingroup application_support * \returns The app id contained in the instance. * \param[in] desc The application description instance, must not be NULL. */ UBUNTU_DLL_PUBLIC UApplicationId* u_application_description_get_application_id( UApplicationDescription *desc); /** * \brief Sets the application lifecycle delegate * \ingroup application_support * \param[in] desc The application description instance, must not be NULL. * \param[in] lifecycle_delegate The new lifecycle delegate, must not be NULL. */ UBUNTU_DLL_PUBLIC void u_application_description_set_application_lifecycle_delegate( UApplicationDescription *desc, UApplicationLifecycleDelegate *lifecycle_delegate); /** * \brief Queries the application lifecycle delegate * \ingroup application_support * \returns The application lifecycle delegate contained in the description instance. * \param[in] desc The application description instance, must not be NULL. */ UBUNTU_DLL_PUBLIC UApplicationLifecycleDelegate* u_application_description_get_application_lifecycle_delegate( UApplicationDescription *desc); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_DESCRIPTION_H_ */ platform-api-0.20+14.04.20140411/include/ubuntu/application/sensors/0000755000015301777760000000000012322055312025357 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/include/ubuntu/application/sensors/event/0000755000015301777760000000000012322055312026500 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/include/ubuntu/application/sensors/event/accelerometer.h0000644000015301777760000000470412322054725031477 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza */ #ifndef UBUNTU_APPLICATION_SENSORS_ACCELEROMETER_EVENT_H_ #define UBUNTU_APPLICATION_SENSORS_ACCELEROMETER_EVENT_H_ #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Opaque type describing an accelerometer reading. * \ingroup sensor_access */ typedef void UASAccelerometerEvent; /** * \brief Query the timestamp of the sensor reading. * \ingroup sensor_access * \returns The timestamp of the sensor reading in [µs], timebase: monotonic clock. * \param[in] event The reading to be queried. */ UBUNTU_DLL_PUBLIC uint64_t uas_accelerometer_event_get_timestamp( UASAccelerometerEvent* event); /** * \brief Query the acceleration in x-axis direction. * \ingroup sensor_access * \returns The acceleration in x-axis direction. * \param[in] event The reading to be queried. */ UBUNTU_DLL_PUBLIC float uas_accelerometer_event_get_acceleration_x( UASAccelerometerEvent* event); /** * \brief Query the acceleration in y-axis direction. * \ingroup sensor_access * \returns The acceleration in y-axis direction. * \param[in] event The reading to be queried. */ UBUNTU_DLL_PUBLIC float uas_accelerometer_event_get_acceleration_y( UASAccelerometerEvent* event); /** * \brief Query the acceleration in z-axis direction. * \ingroup sensor_access * \returns The acceleration in z-axis direction. * \param[in] event The reading to be queried. */ UBUNTU_DLL_PUBLIC float uas_accelerometer_event_get_acceleration_z( UASAccelerometerEvent* event); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_SENSORS_ACCELEROMETER_EVENT_H_ */ platform-api-0.20+14.04.20140411/include/ubuntu/application/sensors/event/proximity.h0000644000015301777760000000446312322054725030733 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza */ #ifndef UBUNTU_APPLICATION_SENSORS_PROXIMITY_EVENT_H_ #define UBUNTU_APPLICATION_SENSORS_PROXIMITY_EVENT_H_ #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Useful constants when inspecting readings from the proximity sensor. * \ingroup sensor_access */ typedef enum { U_PROXIMITY_NEAR = 1, /**< The reading indicates that something is near the sensor/device. */ U_PROXIMITY_FAR = 2 /**< The reading indicates that something is far away from the sensor/device. */ } UbuntuApplicationSensorsProximityDistance; typedef UbuntuApplicationSensorsProximityDistance UASProximityDistance; /** * \brief Opaque type describing an accelerometer reading. * \ingroup sensor_access */ typedef void UASProximityEvent; /** * \brief Query the timestamp of the sensor reading. * \ingroup sensor_access * \returns The timestamp of the sensor reading in [µs], timebase: monotonic clock. * \param[in] event The reading to be queried. */ UBUNTU_DLL_PUBLIC uint64_t uas_proximity_event_get_timestamp( UASProximityEvent* event); /** * \brief Query the discrete distance as reported by the proximity sensor. * \ingroup sensor_access * \returns The discrete distance as reported by the proximity sensor. * \param[in] event The reading to be queried. */ UBUNTU_DLL_PUBLIC UASProximityDistance uas_proximity_event_get_distance( UASProximityEvent* event); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_SENSORS_PROXIMITY_EVENT_H_ */ platform-api-0.20+14.04.20140411/include/ubuntu/application/sensors/event/CMakeLists.txt0000644000015301777760000000032212322054725031244 0ustar pbusernogroup00000000000000set( UBUNTU_APPLICATION_SENSORS_EVENT_HEADERS accelerometer.h light.h proximity.h ) install( FILES ${UBUNTU_APPLICATION_SENSORS_EVENT_HEADERS} DESTINATION include/ubuntu/application/sensors/event )platform-api-0.20+14.04.20140411/include/ubuntu/application/sensors/event/light.h0000644000015301777760000000336512322054725027776 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza */ #ifndef UBUNTU_APPLICATION_SENSORS_LIGHT_EVENT_H_ #define UBUNTU_APPLICATION_SENSORS_LIGHT_EVENT_H_ #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Opaque type describing an ambient light sensor reading. * \ingroup sensor_access */ typedef void UASLightEvent; /** * \brief Query the timestamp of the sensor reading. * \ingroup sensor_access * \returns The timestamp of the sensor reading in [µs], timebase: monotonic clock. * \param[in] event The reading to be queried. */ UBUNTU_DLL_PUBLIC uint64_t uas_light_event_get_timestamp( UASLightEvent* event); /** * \brief Query the value measured by the ambient light sensor. * \ingroup sensor_access * \returns The ambient light level. * \param[in] event The reading to be queried. */ UBUNTU_DLL_PUBLIC float uas_light_event_get_light( UASLightEvent* event); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_SENSORS_LIGHT_EVENT_H_ */ platform-api-0.20+14.04.20140411/include/ubuntu/application/sensors/accelerometer.h0000644000015301777760000001046512322054725030357 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza */ #ifndef UBUNTU_APPLICATION_SENSORS_ACCELEROMETER_H_ #define UBUNTU_APPLICATION_SENSORS_ACCELEROMETER_H_ #include #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Opaque type that models the accelerometer. * \ingroup sensor_access */ typedef void UASensorsAccelerometer; /** * \brief Callback type used by applications to subscribe to accelerometer events. * \ingroup sensor_access */ typedef void (*on_accelerometer_event_cb)(UASAccelerometerEvent* event, void* context); /** * \brief Create a new object for accessing the accelerometer. * \ingroup sensor_access * \returns A new instance or NULL in case of errors. */ UBUNTU_DLL_PUBLIC UASensorsAccelerometer* ua_sensors_accelerometer_new(); /** * \brief Enables the supplied accelerometer. * \ingroup sensor_access * \returns U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured. * \param[in] sensor The sensor instance to be enabled. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_accelerometer_enable( UASensorsAccelerometer* sensor); /** * \brief Disables the supplied accelerometer. * \ingroup sensor_access * \returns U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured. * \param[in] sensor The sensor instance to be disabled. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_accelerometer_disable( UASensorsAccelerometer* sensor); /** * \brief Queries the minimum delay between two readings for the supplied sensor. * \ingroup sensor_access * \returns The minimum delay between two readings in [ms]. * \param[in] sensor The sensor instance to be queried. */ UBUNTU_DLL_PUBLIC uint32_t ua_sensors_accelerometer_get_min_delay( UASensorsAccelerometer* sensor); /** * \brief Queries the minimum value that can be reported by the sensor. * \ingroup sensor_access * \returns The minimum value that can be reported by the sensor. * \param[in] sensor The sensor instance to be queried. */ UBUNTU_DLL_PUBLIC float ua_sensors_accelerometer_get_min_value( UASensorsAccelerometer* sensor); /** * \brief Queries the maximum value that can be reported by the sensor. * \ingroup sensor_access * \returns The maximum value that can be reported by the sensor. * \param[in] sensor The sensor instance to be queried. */ UBUNTU_DLL_PUBLIC float ua_sensors_accelerometer_get_max_value( UASensorsAccelerometer* sensor); /** * \brief Queries the numeric resolution supported by the sensor * \ingroup sensor_access * \returns The numeric resolution supported by the sensor. * \param[in] sensor The sensor instance to be queried. */ UBUNTU_DLL_PUBLIC float ua_sensors_accelerometer_get_resolution( UASensorsAccelerometer* sensor); /** * \brief Set the callback to be invoked whenever a new sensor reading is available. * \ingroup sensor_access * \param[in] sensor The sensor instance to associate the callback with. * \param[in] cb The callback to be invoked. * \param[in] ctx The context supplied to the callback invocation. */ UBUNTU_DLL_PUBLIC void ua_sensors_accelerometer_set_reading_cb( UASensorsAccelerometer* sensor, on_accelerometer_event_cb cb, void *ctx); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_SENSORS_ACCELEROMETER_H_ */ platform-api-0.20+14.04.20140411/include/ubuntu/application/sensors/ubuntu_application_sensors.h0000644000015301777760000001256112322054725033225 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_SENSORS_C_API_H_ #define UBUNTU_APPLICATION_SENSORS_C_API_H_ #include #include #ifdef __cplusplus extern "C" { #endif /** \defgroup sensor_access Functions and types to access sensor devices. */ /** A timestamped accelerometer reading * \ingroup sensor_access */ typedef struct { int64_t timestamp; float acceleration_x; float acceleration_y; float acceleration_z; } ubuntu_sensor_accelerometer_reading; /** A timestamped proximity sensor reading * \ingroup sensor_access */ typedef struct { int64_t timestamp; float distance; } ubuntu_sensor_proximity_reading; /** A timestamped ambient light sensor reading * \ingroup sensor_access */ typedef struct { int64_t timestamp; float light; } ubuntu_sensor_ambient_light_reading; /** Describes the sensor types known to the system * \ingroup sensor_access */ enum ubuntu_sensor_type { first_defined_sensor_type = 0, ubuntu_sensor_type_accelerometer = first_defined_sensor_type, ubuntu_sensor_type_magnetic_field, ubuntu_sensor_type_gyroscope, ubuntu_sensor_type_light, ubuntu_sensor_type_proximity, ubuntu_sensor_type_orientation, ubuntu_sensor_type_linear_acceleration, ubuntu_sensor_type_rotation_vector, undefined_sensor_type }; /** Callback that is invoked for new accelerometer readings. * \ingroup sensor_access * \param reading [in] The new reading. * \param context [in] The callback context. */ typedef void (*on_new_accelerometer_reading)(ubuntu_sensor_accelerometer_reading* reading, void* context); /** Callback that is invoked for new proximity sensor readings. * \ingroup sensor_access * \param reading [in] The new reading. * \param context [in] The callback context. */ typedef void (*on_new_proximity_reading)(ubuntu_sensor_proximity_reading* reading, void* context); /** Callback that is invoked for new ambient light sensor readings. * \ingroup sensor_access * \param reading [in] The new reading. * \param context [in] The callback context. */ typedef void (*on_new_ambient_light_reading)(ubuntu_sensor_ambient_light_reading* reading, void* context); /** Models a sensor observer. * \ingroup sensor_access */ typedef struct { /** Invoked for new readings from an accelerometer. */ on_new_accelerometer_reading on_new_accelerometer_reading_cb; /** Invoked for new readings from a proximity sensor. */ on_new_proximity_reading on_new_proximity_reading_cb; /** Invoked for new readings from an ambient light sensor. */ on_new_ambient_light_reading on_new_ambient_light_reading_cb; /** Callback context. */ void* context; } ubuntu_sensor_observer; UBUNTU_DLL_PUBLIC void ubuntu_sensor_initialize_observer(ubuntu_sensor_observer* observer); /** Installs the supplied observer. * \ingroup sensor_access */ UBUNTU_DLL_PUBLIC void ubuntu_sensor_install_observer(ubuntu_sensor_observer* observer); /** Uninstalls the supplied observer. * \ingroup sensor_access */ UBUNTU_DLL_PUBLIC void ubuntu_sensor_uninstall_observer(ubuntu_sensor_observer* observer); /** Enables the specified sensor type and starts data acquisition. * \ingroup sensor_access */ UBUNTU_DLL_PUBLIC void ubuntu_sensor_enable_sensor(ubuntu_sensor_type sensor_type); /** Disables the specified sensor type and starts data acquisition. * \ingroup sensor_access */ UBUNTU_DLL_PUBLIC void ubuntu_sensor_disable_sensor(ubuntu_sensor_type sensor_type); /** Returns the minimum sensor sampling delay in Hz. * \ingroup sensor_access */ UBUNTU_DLL_PUBLIC int32_t ubuntu_sensor_get_sensor_min_delay(ubuntu_sensor_type sensor_type); /** Returns the minimum valid value for the sensor_type. * \ingroup sensor_access */ UBUNTU_DLL_PUBLIC float ubuntu_sensor_get_sensor_min_value(ubuntu_sensor_type sensor_type); /** Returns the maximum valid value for the sensor_type. * \ingroup sensor_access */ UBUNTU_DLL_PUBLIC float ubuntu_sensor_get_sensor_max_value(ubuntu_sensor_type sensor_type); /** Returns the resolution of valid values for the sensor_type. * \ingroup sensor_access */ UBUNTU_DLL_PUBLIC float ubuntu_sensor_get_sensor_resolution(ubuntu_sensor_type sensor_type); /** \example test_sensors_api.cpp */ #ifdef __cplusplus } #endif #endif // UBUNTU_APPLICATION_SENSORS_C_API_H_ platform-api-0.20+14.04.20140411/include/ubuntu/application/sensors/proximity.h0000644000015301777760000001034012322054725027601 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza */ #ifndef UBUNTU_APPLICATION_SENSORS_PROXIMITY_H_ #define UBUNTU_APPLICATION_SENSORS_PROXIMITY_H_ #include #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Opaque type that models the proximity sensor. * \ingroup sensor_access */ typedef void UASensorsProximity; /** * \brief Callback type used by applications to subscribe to proximity sensor events. * \ingroup sensor_access */ typedef void (*on_proximity_event_cb)(UASProximityEvent* event, void* context); /** * \brief Create a new object for accessing the proximity sensor. * \ingroup sensor_access * \returns A new instance or NULL in case of errors. */ UBUNTU_DLL_PUBLIC UASensorsProximity* ua_sensors_proximity_new(); /** * \brief Enables the supplied proximity sensor. * \ingroup sensor_access * \returns U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured. * \param[in] sensor The sensor instance to be enabled. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_proximity_enable( UASensorsProximity* sensor); /** * \brief Disables the supplied proximity sensor. * \ingroup sensor_access * \returns U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured. * \param[in] sensor The sensor instance to be disabled. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_proximity_disable( UASensorsProximity* sensor); /** * \brief Queries the minimum delay between two readings for the supplied sensor. * \ingroup sensor_access * \returns The minimum delay between two readings in [ms]. * \param[in] sensor The sensor instance to be queried. */ UBUNTU_DLL_PUBLIC uint32_t ua_sensors_proximity_get_min_delay( UASensorsProximity* sensor); /** * \brief Queries the minimum value that can be reported by the sensor. * \ingroup sensor_access * \returns The minimum value that can be reported by the sensor. * \param[in] sensor The sensor instance to be queried. */ UBUNTU_DLL_PUBLIC float ua_sensors_proximity_get_min_value( UASensorsProximity* sensor); /** * \brief Queries the maximum value that can be reported by the sensor. * \ingroup sensor_access * \returns The maximum value that can be reported by the sensor. * \param[in] sensor The sensor instance to be queried. */ UBUNTU_DLL_PUBLIC float ua_sensors_proximity_get_max_value( UASensorsProximity* sensor); /** * \brief Queries the numeric resolution supported by the sensor * \ingroup sensor_access * \returns The numeric resolution supported by the sensor. * \param[in] sensor The sensor instance to be queried. */ UBUNTU_DLL_PUBLIC float ua_sensors_proximity_get_resolution( UASensorsProximity* sensor); /** * \brief Set the callback to be invoked whenever a new sensor reading is available. * \ingroup sensor_access * \param[in] sensor The sensor instance to associate the callback with. * \param[in] cb The callback to be invoked. * \param[in] ctx The context supplied to the callback invocation. */ UBUNTU_DLL_PUBLIC void ua_sensors_proximity_set_reading_cb( UASensorsProximity* sensor, on_proximity_event_cb cb, void *ctx); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_SENSORS_PROXIMITY_H_ */ platform-api-0.20+14.04.20140411/include/ubuntu/application/sensors/CMakeLists.txt0000644000015301777760000000037012322054725030126 0ustar pbusernogroup00000000000000set( UBUNTU_APPLICATION_SENSORS_HEADERS accelerometer.h light.h proximity.h ubuntu_application_sensors.h ) install( FILES ${UBUNTU_APPLICATION_SENSORS_HEADERS} DESTINATION include/ubuntu/application/sensors ) add_subdirectory(event)platform-api-0.20+14.04.20140411/include/ubuntu/application/sensors/light.h0000644000015301777760000001022012322054725026641 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza */ #ifndef UBUNTU_APPLICATION_SENSORS_LIGHT_H_ #define UBUNTU_APPLICATION_SENSORS_LIGHT_H_ #include #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Opaque type that models the ambient light sensor. * \ingroup sensor_access */ typedef void UASensorsLight; /** * \brief Callback type used by applications to subscribe to ambient light sensor events. * \ingroup sensor_access */ typedef void (*on_light_event_cb)(UASLightEvent* event, void* context); /** * \brief Create a new object for accessing the ambient light sensor. * \ingroup sensor_access * \returns A new instance or NULL in case of errors. */ UBUNTU_DLL_PUBLIC UASensorsLight* ua_sensors_light_new(); /** * \brief Enables the supplied ambient light sensor. * \ingroup sensor_access * \returns U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured. * \param[in] sensor The sensor instance to be enabled. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_light_enable( UASensorsLight* sensor); /** * \brief Disables the supplied ambient light sensor. * \ingroup sensor_access * \returns U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured. * \param[in] sensor The sensor instance to be disabled. */ UBUNTU_DLL_PUBLIC UStatus ua_sensors_light_disable( UASensorsLight* sensor); /** * \brief Queries the minimum delay between two readings for the supplied sensor. * \ingroup sensor_access * \returns The minimum delay between two readings in [ms]. * \param[in] sensor The sensor instance to be queried. */ UBUNTU_DLL_PUBLIC uint32_t ua_sensors_light_get_min_delay( UASensorsLight* sensor); /** * \brief Queries the minimum value that can be reported by the sensor. * \ingroup sensor_access * \returns The minimum value that can be reported by the sensor. * \param[in] sensor The sensor instance to be queried. */ UBUNTU_DLL_PUBLIC float ua_sensors_light_get_min_value( UASensorsLight* sensor); /** * \brief Queries the maximum value that can be reported by the sensor. * \ingroup sensor_access * \returns The maximum value that can be reported by the sensor. * \param[in] sensor The sensor instance to be queried. */ UBUNTU_DLL_PUBLIC float ua_sensors_light_get_max_value( UASensorsLight* sensor); /** * \brief Queries the numeric resolution supported by the sensor * \ingroup sensor_access * \returns The numeric resolution supported by the sensor. * \param[in] sensor The sensor instance to be queried. */ UBUNTU_DLL_PUBLIC float ua_sensors_light_get_resolution( UASensorsLight* sensor); /** * \brief Set the callback to be invoked whenever a new sensor reading is available. * \ingroup sensor_access * \param[in] sensor The sensor instance to associate the callback with. * \param[in] cb The callback to be invoked. * \param[in] ctx The context supplied to the callback invocation. */ UBUNTU_DLL_PUBLIC void ua_sensors_light_set_reading_cb( UASensorsLight* sensor, on_light_event_cb cb, void *ctx); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_SENSORS_LIGHT_H_ */ platform-api-0.20+14.04.20140411/include/ubuntu/application/url_dispatcher/0000755000015301777760000000000012322055312026673 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/include/ubuntu/application/url_dispatcher/session.h0000644000015301777760000000425312322054725030542 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * */ #ifndef UBUNTU_APPLICATION_URL_DISPATCHER_SESSION_H_ #define UBUNTU_APPLICATION_URL_DISPATCHER_SESSION_H_ #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Opaque type encapsulating a session with the url dispatcher service. * \ingroup url_dispatcher */ typedef struct UbuntuApplicationUrlDispatcherSession UAUrlDispatcherSession; /** * \brief Callback type that is invoked for open results. * \ingroup url_dispatcher * \param[out] status U_STATUS_SUCCESS if the dispatching was successful. * \param[out] url The url passed to the ua_url_dispatcher_session_dispatch call. * \param[out] context The url context passed to the ua_url_dispatcher_session_dispatch call. */ typedef void (*UAUrlDispatcherSessionDispatchHandler)( UStatus status, const char *url, void *context); /** * \brief Tells the url dispatcher to open the given url. * \ingroup url_dispatcher * \param[in] session The session instance. * \param[in] url The url to open. * \param[in] handler The url dispatcher open handler. * \param[in] context Your context, will be returned to you as is in the handler callback. */ UBUNTU_DLL_PUBLIC void ua_url_dispatcher_session_open( UAUrlDispatcherSession *session, const char *url, UAUrlDispatcherSessionDispatchHandler handler, void *context); #ifdef __cplusplus } #endif #endif // UBUNTU_APPLICATION_URL_DISPATCHER_SESSION_H_ platform-api-0.20+14.04.20140411/include/ubuntu/application/url_dispatcher/service.h0000644000015301777760000000303012322054725030507 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * */ #ifndef UBUNTU_APPLICATION_URL_DISPATCHER_SERVICE_H_ #define UBUNTU_APPLICATION_URL_DISPATCHER_SERVICE_H_ #include "ubuntu/application/url_dispatcher/session.h" #include #ifdef __cplusplus extern "C" { #endif /** * \defgroup url_dispatcher Functions and types to provide launching files/applications. * * Applications in Ubuntu can not launch other applications directly. * They have to use the url_dispatcher service to open other applications * or to open applications that handle a given url. */ /** * \brief Creates a new session with the url dispatcher service. * \returns A new session or NULL if the app lacks permissions to access the url dispatcher. */ UBUNTU_DLL_PUBLIC UAUrlDispatcherSession* ua_url_dispatcher_session(); #ifdef __cplusplus } #endif #endif // UBUNTU_APPLICATION_URL_DISPATCHER_SERVICE_H_ platform-api-0.20+14.04.20140411/include/ubuntu/application/url_dispatcher/CMakeLists.txt0000644000015301777760000000030512322054725031440 0ustar pbusernogroup00000000000000set( UBUNTU_APPLICATION_URL_DISPATCHER_HEADERS service.h session.h ) install( FILES ${UBUNTU_APPLICATION_URL_DISPATCHER_HEADERS} DESTINATION include/ubuntu/application/url_dispatcher ) platform-api-0.20+14.04.20140411/include/ubuntu/application/options.h0000644000015301777760000000431612322054725025542 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza * Thomas Voß */ #ifndef UBUNTU_APPLICATION_OPTIONS_H_ #define UBUNTU_APPLICATION_OPTIONS_H_ #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Encapsulates options as passed to the application. * \ingroup application_support */ typedef void UApplicationOptions; /** * \brief Parses options from the command line. * \ingroup application_support * \returns An options instance if parsing was successful, or 0 otheriwse. * \param[in] argc Number of arguments. * \param[in] argv Arguments. */ UBUNTU_DLL_PUBLIC UApplicationOptions* u_application_options_new_from_cmd_line( int argc, char** argv); /** * \brief Destroys the options object and releases all resources. * \ingroup application_support * \param[in] options The object to be destroyed. */ UBUNTU_DLL_PUBLIC void u_application_options_destroy( UApplicationOptions *options); /** * \brief Queries the operation mode from the supplied options object. * \ingroup application_support * \returns The operation mode as stored in the options object. * \param[in] options The options object to be queried. */ UBUNTU_DLL_PUBLIC UApplicationOperationMode u_application_options_get_operation_mode( UApplicationOptions *options); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_OPTIONS_H_ */ platform-api-0.20+14.04.20140411/include/ubuntu/application/archive.h0000644000015301777760000001344512322054725025473 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza * Thomas Voß */ #ifndef UBUNTU_APPLICATION_ARCHIVE_H_ #define UBUNTU_APPLICATION_ARCHIVE_H_ #include #include #include #include #ifdef __cplusplus extern "C" { #endif typedef struct UbuntuApplicationArchive_ UApplicationArchive; /** * \brief Creates a new archive, ownership is transferred to caller. * \ingroup application_support * \sa u_application_archive_destroy * \returns A new archive instance or NULL if not enough memory is available. */ UBUNTU_DLL_PUBLIC UApplicationArchive* u_application_archive_new(); /** * \brief Destroys the given archive instance and releases all resources held by the instance. * \ingroup application_support * \param[in] archive The instance to be destroyed. * \post All resources held by the instance are released. The result of any operation invoked on the destroyed instance are undefined. */ UBUNTU_DLL_PUBLIC void u_application_archive_destroy( UApplicationArchive *archive); /** * \brief Writes a signed 64-bit integer to the supplied archive * \ingroup application_support * \returns U_STATUS_SUCCESS if successful, and U_STATUS_ERROR in case of failures. * \param[in] archive The archive to write to. * \param[in] s The signed 64-bit integer to write to the archive. */ UBUNTU_DLL_PUBLIC UStatus u_application_archive_write( UApplicationArchive *archive, int64_t s); /** * \brief Writes a string of characters to the supplied archive * \ingroup application_support * \returns U_STATUS_SUCCESS if successful, and U_STATUS_ERROR in case of failures. * \param[in] archive The archive to write to. * \param[in] s The string to write. * \param[in] size The number of characters to write to the archive. */ UBUNTU_DLL_PUBLIC UStatus u_application_archive_write_stringn( UApplicationArchive *archive, const char *s, size_t size); /** * \brief Writes a string of wide characters to the supplied archive * \ingroup application_support * \returns U_STATUS_SUCCESS if successful, and U_STATUS_ERROR in case of failures. * \param[in] archive The archive to write to. * \param[in] s The string to write. * \param[in] size The number of characters to write to the archive. */ UBUNTU_DLL_PUBLIC UStatus u_application_archive_write_wstringn( UApplicationArchive *archive, const wchar_t *s, size_t size); /** * \brief Writes a blob of binary data to the supplied archive * \ingroup application_support * \returns U_STATUS_SUCCESS if successful, and U_STATUS_ERROR in case of failures. * \param[in] archive The archive to write to. * \param[in] data The binary blob to write. * \param[in] size The size of the blob. */ UBUNTU_DLL_PUBLIC UStatus u_application_archive_write_bytes( UApplicationArchive *archive, const intptr_t *data, size_t size); UBUNTU_DLL_PUBLIC UStatus u_application_archive_write_begin_blockn( UApplicationArchive* archive, const char *name, size_t size); UBUNTU_DLL_PUBLIC UStatus u_application_archive_write_end_blockn( UApplicationArchive* archive, const char *name, size_t size); /** * \brief Reads a signed 64-bit integer from the supplied archive * \ingroup application_support * \returns U_STATUS_SUCCESS if successful, and U_STATUS_ERROR in case of failures. * \param[in] archive The archive to read from. * \param[out] s Pointer to memory that receives the signed 64-bit integer. */ UBUNTU_DLL_PUBLIC UStatus u_application_archive_read( const UApplicationArchive *archive, int64_t *s); /** * \brief Reads a string of characters from the supplied archive * \ingroup application_support * \returns U_STATUS_SUCCESS if successful, and U_STATUS_ERROR in case of failures. * \param[in] archive The archive to read from. * \param[out] s Pointer to memory that receives the string. * \param[out] size Pointer to memory that receives the size of the string. */ UBUNTU_DLL_PUBLIC UStatus u_application_archive_read_stringn( const UApplicationArchive *archive, const char **s, size_t *size); /** * \brief Reads a string of wide characters from the supplied archive * \ingroup application_support * \returns U_STATUS_SUCCESS if successful, and U_STATUS_ERROR in case of failures. * \param[in] archive The archive to read from. * \param[out] s Pointer to memory that receives the wide string. * \param[out] size Pointer to memory that receives the size of the string. */ UBUNTU_DLL_PUBLIC UStatus u_application_archive_read_wstringn( UApplicationArchive *archive, const wchar_t *s, size_t size); /** * \brief Reads a blob of binary data from the supplied archive * \ingroup application_support * \returns U_STATUS_SUCCESS if successful, and U_STATUS_ERROR in case of failures. * \param[in] archive The archive to read from. * \param[out] data Pointer to memory that receives the binary data. * \param[out] size Pointer to memory that receives the size of the blob. */ UBUNTU_DLL_PUBLIC UStatus u_application_archive_read_bytes( UApplicationArchive *archive, const intptr_t *data, size_t size); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_ARCHIVE_H_ */ platform-api-0.20+14.04.20140411/include/ubuntu/application/ui/0000755000015301777760000000000012322055312024300 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/include/ubuntu/application/ui/form_factor.h0000644000015301777760000000176312322054725026770 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza * Thomas Voß */ #ifndef UBUNTU_APPLICATION_UI_FORM_FACTOR_H_ #define UBUNTU_APPLICATION_UI_FORM_FACTOR_H_ typedef enum { U_DESKTOP = 0, U_PHONE = 1, U_TABLET = 2 } UAUiFormFactor; #endif /* UBUNTU_APPLICATION_UI_FORM_FACTOR_H_ */ platform-api-0.20+14.04.20140411/include/ubuntu/application/ui/session.h0000644000015301777760000000324712322054725026151 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza * Thomas Voß */ #ifndef UBUNTU_APPLICATION_UI_SESSION_H_ #define UBUNTU_APPLICATION_UI_SESSION_H_ #include #include #ifdef __cplusplus extern "C" { #endif typedef void UAUiSession; typedef void UAUiSessionProperties; typedef enum { U_USER_SESSION = 0, U_SYSTEM_SESSION = 1 } UAUiSessionType; UBUNTU_DLL_PUBLIC UAUiSession* ua_ui_session_new_with_properties( UAUiSessionProperties *properties); UBUNTU_DLL_PUBLIC UAUiSessionProperties* ua_ui_session_properties_new(); UBUNTU_DLL_PUBLIC void ua_ui_session_properties_set_type( UAUiSessionProperties* properties, UAUiSessionType type); UBUNTU_DLL_PUBLIC void ua_ui_session_properties_set_remote_pid( UAUiSessionProperties* properties, uint32_t pid); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_UI_SESSION_H_ */ platform-api-0.20+14.04.20140411/include/ubuntu/application/ui/window.h0000644000015301777760000000422712322054725025774 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza * Thomas Voß */ #ifndef UBUNTU_APPLICATION_UI_WINDOW_H_ #define UBUNTU_APPLICATION_UI_WINDOW_H_ #include #include #include #include #include #ifdef __cplusplus extern "C" { #endif typedef void UAUiWindow; typedef int32_t UAUiWindowId; UBUNTU_DLL_PUBLIC UAUiWindow* ua_ui_window_new_for_application_with_properties( UApplicationInstance *instance, UAUiWindowProperties *properties); UBUNTU_DLL_PUBLIC void ua_ui_window_destroy( UAUiWindow *window); UBUNTU_DLL_PUBLIC UAUiWindowId ua_ui_window_get_id( UAUiWindow *window); UBUNTU_DLL_PUBLIC UStatus ua_ui_window_move( UAUiWindow *window, uint32_t new_x, uint32_t new_y); UBUNTU_DLL_PUBLIC UStatus ua_ui_window_resize( UAUiWindow *window, uint32_t new_width, uint32_t new_height); UBUNTU_DLL_PUBLIC UStatus ua_ui_window_hide( UAUiWindow *window); UBUNTU_DLL_PUBLIC UStatus ua_ui_window_show( UAUiWindow *window); UBUNTU_DLL_PUBLIC void ua_ui_window_request_fullscreen( UAUiWindow *window); UBUNTU_DLL_PUBLIC EGLNativeWindowType ua_ui_window_get_native_type( UAUiWindow *window); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_UI_WINDOW_H_ */ platform-api-0.20+14.04.20140411/include/ubuntu/application/ui/clipboard.h0000644000015301777760000000272312322054725026423 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza * Thomas Voß */ #ifndef UBUNTU_APPLICATION_UI_CLIPBOARD_H_ #define UBUNTU_APPLICATION_UI_CLIPBOARD_H_ #include #ifdef __cplusplus extern "C" { #endif UBUNTU_DLL_PUBLIC void ua_ui_set_clipboard_content( void* data, size_t size); /* Memory pointed by data is owned by Ubuntu Application API. Caller is expected to not attempt to modify or delete it. It's also not guaranteed to remain valid after any other call is made to the Ubuntu Application API. */ UBUNTU_DLL_PUBLIC void ua_ui_get_clipboard_content( void** data, size_t* size); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_UI_CLIPBOARD_H_ */ platform-api-0.20+14.04.20140411/include/ubuntu/application/ui/config.h.in0000644000015301777760000000174112322054725026335 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_UI_CONFIG_H_ #define UBUNTU_APPLICATION_UI_CONFIG_H_ #ifndef __ANDROID__ #define UBUNTU_PLATFORM_API_HAVE_GLES2 @UBUNTU_PLATFORM_API_HAVE_GLES2@ #else #define UBUNTU_PLATFORM_API_HAVE_GLES2 1 #endif // __ANDROID__ #endif // UBUNTU_APPLICATION_UI_CONFIG_H_ platform-api-0.20+14.04.20140411/include/ubuntu/application/ui/stage.h0000644000015301777760000000210612322054725025562 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza * Thomas Voß */ #ifndef UBUNTU_APPLICATION_UI_STAGE_H_ #define UBUNTU_APPLICATION_UI_STAGE_H_ typedef enum { U_MAIN_STAGE = 0, U_INTEGRATION_STAGE = 1, U_SHARE_STAGE = 2, U_CONTENT_PICKING_STAGE = 3, U_SIDE_STAGE = 4, U_CONFIGURATION_STAGE = 5 } UAUiStage; #endif /* UBUNTU_APPLICATION_UI_STAGE_H_ */ platform-api-0.20+14.04.20140411/include/ubuntu/application/ui/options.h0000644000015301777760000000253712322054725026162 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza * Thomas Voß */ #ifndef UBUNTU_APPLICATION_UI_OPTIONS_H_ #define UBUNTU_APPLICATION_UI_OPTIONS_H_ #include #include #include #include #ifdef __cplusplus extern "C" { #endif UBUNTU_DLL_PUBLIC UAUiFormFactor u_application_options_get_form_factor( UApplicationOptions* options); UBUNTU_DLL_PUBLIC UAUiStage u_application_options_get_stage( UApplicationOptions* options); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_UI_OPTIONS_H_ */ platform-api-0.20+14.04.20140411/include/ubuntu/application/ui/input/0000755000015301777760000000000012322055312025437 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/include/ubuntu/application/ui/input/event.h0000644000015301777760000001602012322054725026737 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_APPLICATION_UI_INPUT_EVENT_H_ #define UBUNTU_APPLICATION_UI_INPUT_EVENT_H_ #include #include #include #ifdef __cplusplus extern "C" { #endif // TODO: Perhaps we should update the struct to use these enum types. But then we need to move action/flags // in to the internal typed event structs. typedef enum { U_KEY_ACTION_DOWN = 0, U_KEY_ACTION_UP = 1, U_KEY_ACTION_MULTIPLE = 2 } UKeyAction; typedef enum { U_KEY_FLAG_WOKE_HERE = 0x1, U_KEY_FLAG_SOFT_KEYBOARD = 0x2, U_KEY_FLAG_KEEP_TOUCH_MODE = 0x4, U_KEY_FLAG_FROM_SYSTEM = 0x8, U_KEY_FLAG_EDITOR_ACTION = 0x10, U_KEY_FLAG_CANCELED = 0x20, U_KEY_FLAG_VIRTUAL_HARD_KEY = 0x40, U_KEY_FLAG_LONG_PRESS = 0x80, U_KEY_FLAG_CANCELED_LONG_PRESS = 0x100, U_KEY_FLAG_TRACKING = 0x200, U_KEY_FLAG_FALLBACK = 0x400 } UKeyFlag; typedef enum { U_KEY_MODIFIER_NONE = 0, U_KEY_MODIFIER_ALT = 0x02, U_KEY_MODIFIER_ALT_LEFT = 0x10, U_KEY_MODIFIER_ALT_RIGHT = 0x20, U_KEY_MODIFIER_SHIFT = 0x01, U_KEY_MODIFIER_SHIFT_LEFT = 0x40, U_KEY_MODIFIER_SHIFT_RIGHT = 0x80, U_KEY_MODIFIER_SYM = 0x04, U_KEY_MODIFIER_FUNCTION = 0x08, U_KEY_MODIFIER_CTRL = 0x1000, U_KEY_MODIFIER_CTRL_LEFT = 0x2000, U_KEY_MODIFIER_CTRL_RIGHT = 0x4000, U_KEY_MODIFIER_META = 0x10000, U_KEY_MODIFIER_META_LEFT = 0x20000, U_KEY_MODIFIER_META_RIGHT = 0x40000, U_KEY_MODIFIER_CAPS_LOCK = 0x100000, U_KEY_MODIFIER_NUM_LOCK = 0x200000, U_KEY_MODIFIER_SCROLL_LOCK = 0x400000 } UKeyModifierMask; #define U_MOTION_ACTION_POINTER_INDEX_SHIFT 8 #define U_MOTION_ACTION_MASK 0xff #define U_MOTION_ACTION_POINTER_INDEX_MASK 0xff00 typedef enum { U_MOTION_ACTION_DOWN = 0, U_MOTION_ACTION_UP = 1, U_MOTION_ACTION_MOVE = 2, U_MOTION_ACTION_CANCEL = 3, U_MOTION_ACTION_OUTSIDE = 4, U_MOTION_ACTION_POINTER_DOWN = 5, U_MOTION_ACTION_POINTER_UP = 6, U_MOTION_ACTION_HOVER_MOVE = 7, U_MOTION_ACTION_SCROLL = 8, U_MOTION_ACTION_HOVER_ENTER = 9, U_MOTION_ACTION_HOVER_EXIT = 10 } UMotionAction; typedef enum { U_MOTION_FLAG_WINDOW_IS_OBSCURED = 0x1 } UMotionFlag; typedef enum { U_MOTION_BUTTON_PRIMARY = 1 << 0, U_MOTION_BUTTON_SECONDARY = 1 << 1, U_MOTION_BUTTON_TERTIARY = 1 << 2, U_MOTION_BUTTON_BACK = 1 << 3, U_MOTION_BUTTON_FORWARD = 1 << 4 } UMotionButtonMask; /** Maximum number of pointers reported within one input event. */ #define UBUNTU_APPLICATION_UI_INPUT_EVENT_MAX_POINTER_COUNT (16) /** Reference timebase, nanoseconds as measured by CLOCK_MONOTONIC. */ typedef int64_t nsecs_t; /** Describes the different event types. */ typedef enum { KEY_EVENT_TYPE, ///< Event originates from a keyboard. MOTION_EVENT_TYPE, ///< Event originates from something moving, e.g., a wheel, a mouse, a finger on a touchpad. HW_SWITCH_EVENT_TYPE ///< Event originates from an additional button attached to the device's HW, e.g., power button. } EventType; /** Models an input event. */ typedef struct { EventType type; ///< Type of the event. int32_t device_id; ///< Device that this event originated from. int32_t source_id; ///< Source that this event originated from. int32_t action; ///< Action signalled by this event. int32_t flags; ///< Flags associated with this event. int32_t meta_state; ///< State of the meta modifiers (ALT, CTRL, SHIFT). /** Information specific to key/motion event types. */ union { /** Information describing an event originating from a HW switch. */ struct HardwareSwitchEvent { nsecs_t event_time; ///< Timestamp when the event happened. uint32_t policy_flags; ///< Policy flags. int32_t switch_code; ///< The scan code of the switch. int32_t switch_value; ///< The value reported by the switch. } hw_switch; /** Information describing an event originating from a keyboard key. */ struct KeyEvent { int32_t key_code; int32_t scan_code; int32_t repeat_count; nsecs_t down_time; nsecs_t event_time; int is_system_key; ///< \deprecated Do not use. } key; /** Information describing an event originating from a * "moving" device, e.g., a mouse, a mouse-wheel, a finger * on a touchpad. */ struct MotionEvent { int32_t edge_flags; ///< Set for touches intersecting a touchscreen's edges, requires HW support. int32_t button_state; ///< State of buttons of the device float x_offset; ///< Movement in x direction since down event float y_offset; ///< Movement in y direction since down event float x_precision; ///< Sampling precision in x direction float y_precision; ///< Sampling precision in y direction nsecs_t down_time; ///< Timestamp that marks the down event nsecs_t event_time; ///< Timestamp that marks when this event happened size_t pointer_count; ///< Number of pointers reported in this event struct PointerCoordinate { int id; ///< Unique id of the pointer float x, raw_x; ///< Processed and raw x coordinates float y, raw_y; ///< Processed and raw y coordinates float touch_major; ///< Touch major coordinate float touch_minor; ///< Touch minor coordinate float size; ///< Size of the pointer/touch float pressure; ///< Pressure of the touch float orientation; ///< Orientation } pointer_coordinates[UBUNTU_APPLICATION_UI_INPUT_EVENT_MAX_POINTER_COUNT]; ///< Pointer information, valid from [0,pointer_count). } motion; } details; } Event; #ifdef __cplusplus } #endif #endif // UBUNTU_APPLICATION_UI_INPUT_EVENT_H_ platform-api-0.20+14.04.20140411/include/ubuntu/application/ui/input/CMakeLists.txt0000644000015301777760000000024312322054725030205 0ustar pbusernogroup00000000000000set( UBUNTU_APPLICATION_UI_INPUT_HEADERS event.h ) install( FILES ${UBUNTU_APPLICATION_UI_INPUT_HEADERS} DESTINATION include/ubuntu/application/ui/input )platform-api-0.20+14.04.20140411/include/ubuntu/application/ui/CMakeLists.txt0000644000015301777760000000066612322054725027057 0ustar pbusernogroup00000000000000configure_file( config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY) set( UBUNTU_APPLICATION_UI_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/config.h clipboard.h display.h form_factor.h options.h session.h stage.h window.h window_parent.h window_properties.h window_state.h window_type.h ) install( FILES ${UBUNTU_APPLICATION_UI_HEADERS} DESTINATION include/ubuntu/application/ui ) add_subdirectory(input) platform-api-0.20+14.04.20140411/include/ubuntu/application/ui/window_properties.h0000644000015301777760000000504612322054725030250 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza * Thomas Voß */ #ifndef UBUNTU_APPLICATION_UI_WINDOW_PROPERTIES_H_ #define UBUNTU_APPLICATION_UI_WINDOW_PROPERTIES_H_ #include #include #ifdef __cplusplus extern "C" { #endif typedef enum { U_MAIN_ROLE = 1, U_DASH_ROLE, U_INDICATOR_ROLE, U_NOTIFICATIONS_ROLE, U_GREETER_ROLE, U_LAUNCHER_ROLE, U_ON_SCREEN_KEYBOARD_ROLE, U_SHUTDOWN_DIALOG_ROLE, } UAUiWindowRole; typedef void (*input_event_cb)(void* ctx, const Event* ev); typedef input_event_cb UAUiWindowInputEventCb; typedef void UAUiWindowProperties; UBUNTU_DLL_PUBLIC UAUiWindowProperties* ua_ui_window_properties_new_for_normal_window(); UBUNTU_DLL_PUBLIC void ua_ui_window_properties_destroy( UAUiWindowProperties *properties); UBUNTU_DLL_PUBLIC void ua_ui_window_properties_set_titlen( UAUiWindowProperties *properties, const char *title, size_t size); UBUNTU_DLL_PUBLIC const char* ua_ui_window_properties_get_title( UAUiWindowProperties *properties); UBUNTU_DLL_PUBLIC void ua_ui_window_properties_set_role( UAUiWindowProperties *properties, UAUiWindowRole role); UBUNTU_DLL_PUBLIC UAUiWindowRole ua_ui_window_properties_get_role( UAUiWindowProperties *properties); UBUNTU_DLL_PUBLIC void ua_ui_window_properties_set_input_cb_and_ctx( UAUiWindowProperties *properties, UAUiWindowInputEventCb cb, void *ctx); UBUNTU_DLL_PUBLIC void ua_ui_window_properties_set_dimensions( UAUiWindowProperties *properties, uint32_t width, uint32_t height); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_UI_WINDOW_PROPERTIES_H_ */ platform-api-0.20+14.04.20140411/include/ubuntu/application/ui/display.h0000644000015301777760000000305712322054725026132 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza * Thomas Voß */ #ifndef UBUNTU_APPLICATION_UI_DISPLAY_H_ #define UBUNTU_APPLICATION_UI_DISPLAY_H_ #include #include #ifdef __cplusplus extern "C" { #endif typedef void UAUiDisplay; UBUNTU_DLL_PUBLIC UAUiDisplay* ua_ui_display_new_with_index( size_t index); UBUNTU_DLL_PUBLIC void ua_ui_display_destroy( UAUiDisplay* display); UBUNTU_DLL_PUBLIC uint32_t ua_ui_display_query_horizontal_res( UAUiDisplay* display); UBUNTU_DLL_PUBLIC uint32_t ua_ui_display_query_vertical_res( UAUiDisplay* display); UBUNTU_DLL_PUBLIC EGLNativeDisplayType ua_ui_display_get_native_type( UAUiDisplay* display); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_UI_DISPLAY_H_ */ platform-api-0.20+14.04.20140411/include/ubuntu/application/ui/window_parent.h0000644000015301777760000000421512322054725027342 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza * Thomas Voß */ #ifndef UBUNTU_APPLICATION_UI_WINDOW_PARENT_H_ #define UBUNTU_APPLICATION_UI_WINDOW_PARENT_H_ #include #ifdef __cplusplus extern "C" { #endif typedef enum { U_WINDOW_PARENT_WINDOW, U_WINDOW_PARENT_APPLICATION, U_WINDOW_PARENT_SESSION, U_WINDOW_PARENT_SYSTEM } UApplicationUiWindowParentType; typedef struct UApplicationUiWindowParent; UBUNTU_DLL_PUBLIC UApplicationUiWindowParent* u_application_ui_window_parent_new_with_window( UApplicationUiWindow *window); UBUNTU_DLL_PUBLIC UApplicationUiWindowParent* u_application_ui_window_parent_new_with_application( UApplicationInstance *instance); UBUNTU_DLL_PUBLIC UApplicationUiWindowParent* u_application_ui_window_parent_new_for_session(); UBUNTU_DLL_PUBLIC UApplicationUiWindowParent* u_application_ui_window_parent_new_for_system(); UBUNTU_DLL_PUBLIC void u_application_ui_window_parent_destroy( UApplicationUiWindowParent *parent); UBUNTU_DLL_PUBLIC UApplicationUiWindowParentType u_application_ui_window_parent_get_type( UApplicationUiWindowParent *parent); UBUNTU_DLL_PUBLIC UApplicationUiWindow* u_application_ui_window_parent_get_parent_window( UApplicationUiWindowParent *parent); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_UI_WINDOW_PARENT_H_ */ platform-api-0.20+14.04.20140411/include/ubuntu/application/ui/window_state.h0000644000015301777760000000177412322054725027200 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Gerry Boland */ #ifndef UBUNTU_APPLICATION_UI_WINDOW_STATE_H_ #define UBUNTU_APPLICATION_UI_WINDOW_STATE_H_ typedef enum { U_UNKNOWN_STATE, U_RESTORED_STATE, U_MINIMIZED_STATE, U_MAXIMIZED_STATE, U_VERTMAXIMIZED_STATE, U_FULLSCREEN_STATE } UApplicationUiWindowState; #endif /* UBUNTU_APPLICATION_UI_WINDOW_STATE_H_ */ platform-api-0.20+14.04.20140411/include/ubuntu/application/ui/window_type.h0000644000015301777760000000212012322054725027023 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza * Thomas Voß */ #ifndef UBUNTU_APPLICATION_UI_WINDOW_TYPE_H_ #define UBUNTU_APPLICATION_UI_WINDOW_TYPE_H_ typedef enum { U_NORMAL_WINDOW, U_UTILITY_WINDOW, U_DIALOG_WINDOW, U_OVERLAY_WINDOW, U_FREESTYLE_WINDOW, U_POPOVER_WINDOW, U_INPUTMETHOD_WINDOW } UApplicationUiWindowType; #endif /* UBUNTU_APPLICATION_UI_WINDOW_TYPE_H_ */ platform-api-0.20+14.04.20140411/include/ubuntu/application/lifecycle_delegate.h0000644000015301777760000001361412322054725027641 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza * Thomas Voß */ #ifndef UBUNTU_APPLICATION_LIFECYCLE_DELEGATE_H_ #define UBUNTU_APPLICATION_LIFECYCLE_DELEGATE_H_ #include #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief Prototype for the callback that is invoked whenever the app has been resumed. * \ingroup application_support * \param[in] options Application instance options * \param[in] context The callback context as specified by the application */ typedef void (*u_on_application_resumed)(const UApplicationOptions *options, void *context); /** * \brief Prototype for the callback that is invoked whenever the app is about to be stopped. * Applications can serialize their state to the supplied archive. * \ingroup application_support */ typedef void (*u_on_application_about_to_stop)(UApplicationArchive *archive, void *context); /** * \brief Opaque type encapsulating all app-specific callback functions. * \ingroup application_support */ typedef void UApplicationLifecycleDelegate; /** * \brief Creates a new instance of the lifecycle delegate with an initial refernce count of 1. * \ingroup application_support * \returns A new instance of the lifecycle delegate or NULL if no memory is available. */ UBUNTU_DLL_PUBLIC UApplicationLifecycleDelegate* u_application_lifecycle_delegate_new(); /** * \brief Destroys an instance of the lifecycle delegate and releases all of its resources. * \ingroup application_support * \param[in] delegate The instance to be destroyed. */ UBUNTU_DLL_PUBLIC void u_application_lifecycle_delegate_destroy( UApplicationLifecycleDelegate *delegate); /** * \brief Increments the reference count of the supplied lifecycle delegate. * \ingroup application_support * \param[in] delegate The lifecycle delegate to increment the reference count for. */ UBUNTU_DLL_PUBLIC void u_application_lifecycle_delegate_ref( UApplicationLifecycleDelegate *delegate); /** * \brief Decrements the reference count of the supplied lifecycle delegate and destroys it if the count reaches 0. * \ingroup application_support * \param[in] delegate The lifecycle delegate to decrement the reference count for. */ UBUNTU_DLL_PUBLIC void u_application_lifecycle_delegate_unref( UApplicationLifecycleDelegate *delegate); /** * \brief Sets the resumed cb for the supplied delegate. * \ingroup application_support * \param[in] delegate The lifecycle delegate to adjust the cb for. * \param[in] cb The new callback to be invoked whenever the app resumes. */ UBUNTU_DLL_PUBLIC void u_application_lifecycle_delegate_set_application_resumed_cb( UApplicationLifecycleDelegate *delegate, u_on_application_resumed cb); /** * \brief Queries the resumed cb from the supplied delegate. * \ingroup application_support * \returns The callback to be invoked whenever the app resumes. * \param[in] delegate The lifecycle delegate to query the callback from. */ UBUNTU_DLL_PUBLIC u_on_application_resumed u_application_lifecycle_delegate_get_application_resumed_cb( UApplicationLifecycleDelegate *delegate); /** * \brief Sets the about-to-stop cb for the supplied delegate. * \ingroup application_support * \param[in] delegate The lifecycle delegate to adjust the cb for. * \param[in] cb The new callback to be invoked whenever the app is about to be stopped.. */ UBUNTU_DLL_PUBLIC void u_application_lifecycle_delegate_set_application_about_to_stop_cb( UApplicationLifecycleDelegate *delegate, u_on_application_about_to_stop cb); /** * \brief Queries the about-to-be-stopped cb from the supplied delegate. * \ingroup application_support * \returns The callback to be invoked whenever the app is about to be stopped. * \param[in] delegate The lifecycle delegate to query the callback from. */ UBUNTU_DLL_PUBLIC u_on_application_about_to_stop u_application_lifecycle_delegate_get_application_about_to_stop_cb( UApplicationLifecycleDelegate *delegate); /** * \brief Sets the cb context for the supplied delegate. * \ingroup application_support * \param[in] delegate The lifecycle delegate to adjust the context for. * \param[in] context The new cb context. */ UBUNTU_DLL_PUBLIC void u_application_lifecycle_delegate_set_context( UApplicationLifecycleDelegate *delegate, void *context); /** * \brief Queries the cb context from the supplied delegate. * \ingroup application_support * \returns The context that is passed to callbacks of this delegate. * \param[in] delegate The lifecycle delegate to query the context from. * \param[in] context Unused. */ UBUNTU_DLL_PUBLIC void* u_application_lifecycle_delegate_get_context( UApplicationLifecycleDelegate *delegate, void *context); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_LIFECYCLE_DELEGATE_H_ */ platform-api-0.20+14.04.20140411/include/ubuntu/application/CMakeLists.txt0000644000015301777760000000052112322054725026430 0ustar pbusernogroup00000000000000set( UBUNTU_APPLICATION_HEADERS archive.h description.h id.h instance.h lifecycle_delegate.h operation_mode.h options.h ) install( FILES ${UBUNTU_APPLICATION_HEADERS} DESTINATION include/ubuntu/application ) add_subdirectory(location) add_subdirectory(sensors) add_subdirectory(ui) add_subdirectory(url_dispatcher) platform-api-0.20+14.04.20140411/include/ubuntu/application/id.h0000644000015301777760000000415612322054725024445 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Ricardo Mendoza * Thomas Voß */ #ifndef UBUNTU_APPLICATION_ID_H_ #define UBUNTU_APPLICATION_ID_H_ #include #include #ifdef __cplusplus extern "C" { #endif /** * \brief An opaque type describing an application ID. * \ingroup application_support */ typedef void UApplicationId; /** * \brief Creates a new application ID from an existing string. * \ingroup application_support * \param[in] string The string containing the application ID. * \param[in] size The size of the string. */ UBUNTU_DLL_PUBLIC UApplicationId* u_application_id_new_from_stringn( const char *string, size_t size); /** * \brief Destroy the supplied application ID instance. * \ingroup application_support * \param[in] id The instance to be destroyed. */ UBUNTU_DLL_PUBLIC void u_application_id_destroy(UApplicationId *id); /** * \brief Compares two application ID instances. * \ingroup application_support * \returns -1 iff lhs < rhs, 0 iff lhs == rhs, 1 iff lhs > rhs. * \param[in] lhs The left-hand-side id to be compared. * \param[in] rhs The right-hand-side id to be compared. */ UBUNTU_DLL_PUBLIC int u_application_id_compare( UApplicationId *lhs, UApplicationId *rhs); #ifdef __cplusplus } #endif #endif /* UBUNTU_APPLICATION_ID_H_ */ platform-api-0.20+14.04.20140411/include/ubuntu/status.h0000644000015301777760000000210112322054725023055 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß * Ricardo Mendoza . * * Authored by: Thomas Voß */ #ifndef UBUNTU_VISIBILITY_H_ #define UBUNTU_VISIBILITY_H_ #if __GNUC__ >= 4 #define UBUNTU_DLL_PUBLIC __attribute__ ((visibility ("default"))) #else #define UBUNTU_DLL_PUBLIC #endif #endif /* UBUNTU_VISIBILITY_H_ */ platform-api-0.20+14.04.20140411/include/ubuntu/ui/0000755000015301777760000000000012322055312021775 5ustar pbusernogroup00000000000000platform-api-0.20+14.04.20140411/include/ubuntu/ui/ubuntu_ui_session_service.h0000644000015301777760000001127412322054725027464 0ustar pbusernogroup00000000000000/* * Copyright © 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß */ #ifndef UBUNTU_UI_SESSION_SERVICE_C_API_H_ #define UBUNTU_UI_SESSION_SERVICE_C_API_H_ #include #include #ifdef __cplusplus extern "C" { #endif typedef enum { UNKNOWN_APP = -1, CAMERA_APP = 0, GALLERY_APP = 1, BROWSER_APP = 2, SHARE_APP = 3, PHONE_APP = 4, DIALER_APP = 5, MESSAGING_APP = 6, ADDRESSBOOK_APP = 7 } ubuntu_ui_well_known_application; typedef const void* ubuntu_ui_session_properties; typedef const void* ubuntu_ui_session_preview_provider; typedef void (*ubuntu_ui_session_service_snapshot_cb)(const void* pixels, unsigned int width, unsigned int height, unsigned int x, unsigned int y, unsigned int source_width, unsigned int source_height, unsigned int stride, void* context); typedef void (*session_requested_cb)(ubuntu_ui_well_known_application app, void* context); typedef void (*session_born_cb)(ubuntu_ui_session_properties props, void* context); typedef void (*session_unfocused_cb)(ubuntu_ui_session_properties props, void* context); typedef void (*session_focused_cb)(ubuntu_ui_session_properties props, void* context); typedef void (*keyboard_geometry_changed_cb)(int x, int y, int width, int height, void* context); typedef void (*session_requested_fullscreen_cb)(ubuntu_ui_session_properties props, void* context); typedef void (*session_died_cb)(ubuntu_ui_session_properties props, void * context); typedef struct { session_requested_cb on_session_requested; session_born_cb on_session_born; session_unfocused_cb on_session_unfocused; session_focused_cb on_session_focused; keyboard_geometry_changed_cb on_keyboard_geometry_changed; session_requested_fullscreen_cb on_session_requested_fullscreen; session_died_cb on_session_died; void* context; } ubuntu_ui_session_lifecycle_observer; typedef void (*continue_task_cb)(int pid, void* context); typedef void (*suspend_task_cb)(int pid, void* context); typedef struct { continue_task_cb continue_task; suspend_task_cb suspend_task; void *context; } ubuntu_ui_task_controller; UBUNTU_DLL_PUBLIC void ubuntu_ui_install_task_controller( ubuntu_ui_task_controller *controller); UBUNTU_DLL_PUBLIC const char* ubuntu_ui_session_properties_get_value_for_key( ubuntu_ui_session_properties props, const char* key); UBUNTU_DLL_PUBLIC int ubuntu_ui_session_properties_get_application_stage_hint( ubuntu_ui_session_properties props); UBUNTU_DLL_PUBLIC int ubuntu_ui_session_properties_get_application_instance_id( ubuntu_ui_session_properties props); UBUNTU_DLL_PUBLIC const char* ubuntu_ui_session_properties_get_desktop_file_hint( ubuntu_ui_session_properties props); UBUNTU_DLL_PUBLIC void ubuntu_ui_session_install_session_lifecycle_observer( ubuntu_ui_session_lifecycle_observer* observer); UBUNTU_DLL_PUBLIC void ubuntu_ui_session_unfocus_running_sessions(); UBUNTU_DLL_PUBLIC void ubuntu_ui_session_focus_running_session_with_id(int id); UBUNTU_DLL_PUBLIC void ubuntu_ui_session_snapshot_running_session_with_id(int id, ubuntu_ui_session_service_snapshot_cb cb, void* context); UBUNTU_DLL_PUBLIC void ubuntu_ui_session_trigger_switch_to_well_known_application(ubuntu_ui_well_known_application app); UBUNTU_DLL_PUBLIC int32_t ubuntu_ui_set_surface_trap(int x, int y, int width, int height); UBUNTU_DLL_PUBLIC void ubuntu_ui_unset_surface_trap(int32_t handle); UBUNTU_DLL_PUBLIC void ubuntu_ui_report_osk_visible(int x, int y, int width, int height); UBUNTU_DLL_PUBLIC void ubuntu_ui_report_osk_invisible(); UBUNTU_DLL_PUBLIC void ubuntu_ui_report_notification_visible(); UBUNTU_DLL_PUBLIC void ubuntu_ui_report_notification_invisible(); #ifdef __cplusplus } #endif #endif // UBUNTU_UI_SESSION_SERVICE_C_API_H_ platform-api-0.20+14.04.20140411/include/ubuntu/ui/CMakeLists.txt0000644000015301777760000000011612322054725024542 0ustar pbusernogroup00000000000000install( FILES ubuntu_ui_session_service.h DESTINATION include/ubuntu/ui )platform-api-0.20+14.04.20140411/include/ubuntu/unit.h0000644000015301777760000000204512322054725022520 0ustar pbusernogroup00000000000000/* * Copyright © 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Thomas Voß * Ricardo Mendoza . * * Authored by: Daniel d'Andrada * Authored by: Thomas Voß */ #ifndef UBUNTU_HARDWARE_GPS_H_ #define UBUNTU_HARDWARE_GPS_H_ #include #include #include #ifdef __cplusplus extern "C" { #endif /** \defgroup gps_access Functions and types for accessing GPS H/W. */ /** * Maximum number of SVs for u_hardware_gps_sv_status_callback(). * \ingroup gps_access */ #define U_HARDWARE_GPS_MAX_SVS 32 /** * The status of the GPS hardware. * \ingroup gps_access */ enum { /** GPS status unknown. */ U_HARDWARE_GPS_STATUS_NONE = 0, /** GPS has begun navigating. */ U_HARDWARE_GPS_STATUS_SESSION_BEGIN = 1, /** GPS has stopped navigating. */ U_HARDWARE_GPS_STATUS_SESSION_END = 2, /** GPS has powered on but is not navigating. */ U_HARDWARE_GPS_STATUS_ENGINE_ON = 3, /** GPS is powered off. */ U_HARDWARE_GPS_STATUS_ENGINE_OFF = 4 }; /** * Flags for the gps_set_capabilities callback. * \ingroup gps_access * GPS HAL schedules fixes for U_HARDWARE_GPS_POSITION_RECURRENCE_PERIODIC mode. * If this is not set, then the framework will use 1000ms for min_interval * and will start and call start() and stop() to schedule the GPS. */ #define U_HARDWARE_GPS_CAPABILITY_SCHEDULING 0x0000001 /** GPS supports MS-Based AGPS mode */ #define U_HARDWARE_GPS_CAPABILITY_MSB 0x0000002 /** GPS supports MS-Assisted AGPS mode */ #define U_HARDWARE_GPS_CAPABILITY_MSA 0x0000004 /** GPS supports single-shot fixes */ #define U_HARDWARE_GPS_CAPABILITY_SINGLE_SHOT 0x0000008 /** GPS supports on demand time injection */ #define U_HARDWARE_GPS_CAPABILITY_ON_DEMAND_TIME 0x0000010 /** * UHardwareGpsNiNotifyFlags constants * \ingroup gps_access */ typedef uint32_t UHardwareGpsNiNotifyFlags; /** NI requires notification */ #define U_HARDWARE_GPS_NI_NEED_NOTIFY 0x0001 /** NI requires verification */ #define U_HARDWARE_GPS_NI_NEED_VERIFY 0x0002 /** NI requires privacy override, no notification/minimal trace */ #define U_HARDWARE_GPS_NI_PRIVACY_OVERRIDE 0x0004 /** * GPS NI responses, used to define the response in * NI structures * \ingroup gps_access */ typedef int UHardwareGpsUserResponseType; enum { U_HARDWARE_GPS_NI_RESPONSE_ACCEPT = 1, U_HARDWARE_GPS_NI_RESPONSE_DENY = 2, U_HARDWARE_GPS_NI_RESPONSE_NORESP = 3 }; enum { U_HARDWARE_GPS_NI_TYPE_VOICE = 1, U_HARDWARE_GPS_NI_TYPE_UMTS_SUPL = 2, U_HARDWARE_GPS_NI_TYPE_UMTS_CTRL_PLANE = 3 }; /** * String length constants * \ingroup gps_access */ #define U_HARDWARE_GPS_NI_SHORT_STRING_MAXLEN 256 #define U_HARDWARE_GPS_NI_LONG_STRING_MAXLEN 2048 /** * NI data encoding scheme * \ingroup gps_access */ typedef int UHardwareGpsNiEncodingType; /** * Known encoding types for Ni responses * \ingroup gps_access */ enum { U_HARDWARE_GPS_ENC_NONE = 0, U_HARDWARE_GPS_ENC_SUPL_GSM_DEFAULT = 1, U_HARDWARE_GPS_ENC_SUPL_UTF8 = 2, U_HARDWARE_GPS_ENC_SUPL_UCS2 = 3, U_HARDWARE_GPS_ENC_UNKNOWN = -1 }; /** * Known AGPS types * \ingroup gps_access */ enum { U_HARDWARE_GPS_AGPS_TYPE_SUPL = 1, U_HARDWARE_GPS_AGPS_TYPE_C2K = 2 }; /** * Known positioning modes * \ingroup gps_access */ enum { /** Mode for running GPS standalone (no assistance). */ U_HARDWARE_GPS_POSITION_MODE_STANDALONE = 0, /** AGPS MS-Based mode. */ U_HARDWARE_GPS_POSITION_MODE_MS_BASED = 1, /** AGPS MS-Assisted mode. */ U_HARDWARE_GPS_POSITION_MODE_MS_ASSISTED = 2 }; /** * Known positioning modes * \ingroup gps_access */ enum { /** Receive GPS fixes on a recurring basis at a specified period. */ U_HARDWARE_GPS_POSITION_RECURRENCE_PERIODIC = 0, /** Request a single shot GPS fix. */ U_HARDWARE_GPS_POSITION_RECURRENCE_SINGLE = 1 }; enum { /** GPS requests data connection for AGPS. */ U_HARDWARE_GPS_REQUEST_AGPS_DATA_CONN = 1, /** GPS releases the AGPS data connection. */ U_HARDWARE_GPS_RELEASE_AGPS_DATA_CONN = 2, /** AGPS data connection initiated */ U_HARDWARE_GPS_AGPS_DATA_CONNECTED = 3, /** AGPS data connection completed */ U_HARDWARE_GPS_AGPS_DATA_CONN_DONE = 4, /** AGPS data connection failed */ U_HARDWARE_GPS_AGPS_DATA_CONN_FAILED = 5 }; /** UHardwareGpsLocation has valid latitude and longitude. */ #define U_HARDWARE_GPS_LOCATION_HAS_LAT_LONG 0x0001 /** UHardwareGpsLocation has valid altitude. */ #define U_HARDWARE_GPS_LOCATION_HAS_ALTITUDE 0x0002 /** UHardwareGpsLocation has valid speed. */ #define U_HARDWARE_GPS_LOCATION_HAS_SPEED 0x0004 /** UHardwareGpsLocation has valid bearing. */ #define U_HARDWARE_GPS_LOCATION_HAS_BEARING 0x0008 /** UHardwareGpsLocation has valid accuracy. */ #define U_HARDWARE_GPS_LOCATION_HAS_ACCURACY 0x0010 typedef struct UHardwareGps_* UHardwareGps; /** * Models a location as reported by the GPS HAL. * \ingroup gps_access */ typedef struct { /** set to sizeof(UHardwareGpsLocation) */ size_t size; /** Contains U_HARDWARE_GPS_LOCATION_* flags bits. */ uint16_t flags; /** Represents latitude in degrees. */ double latitude; /** Represents longitude in degrees. */ double longitude; /** Represents altitude in meters above the WGS 84 reference * ellipsoid. */ double altitude; /** Represents speed in meters per second. */ float speed; /** Represents heading in degrees. */ float bearing; /** Represents expected accuracy in meters. */ float accuracy; /** Timestamp for the location fix, in milliseconds since January 1, 1970 */ int64_t timestamp; } UHardwareGpsLocation; /** * Represents space vehicle (satellite) information. * \ingroup gps_access */ typedef struct { /** set to sizeof(UHardwareGpsSvInfo) */ size_t size; /** Pseudo-random number for the SV. */ int prn; /** Signal to noise ratio. */ float snr; /** Elevation of SV in degrees. */ float elevation; /** Azimuth of SV in degrees. */ float azimuth; } UHardwareGpsSvInfo; /** * Represents SV (Space Vehicle) status. * \ingroup gps_access */ typedef struct { /** set to sizeof(GpsSvStatus) */ size_t size; /** Number of SVs currently visible. */ int num_svs; /** Contains an array of SV information. */ UHardwareGpsSvInfo sv_list[U_HARDWARE_GPS_MAX_SVS]; /** Represents a bit mask indicating which SVs * have ephemeris data. */ uint32_t ephemeris_mask; /** Represents a bit mask indicating which SVs * have almanac data. */ uint32_t almanac_mask; /** * Represents a bit mask indicating which SVs * were used for computing the most recent position fix. */ uint32_t used_in_fix_mask; } UHardwareGpsSvStatus; /** * Represents the status of AGPS. * \ingroup gps_access */ typedef struct { /** set to sizeof(UHardwareGpsAGpsStatus) */ size_t size; uint16_t type; uint16_t status; uint32_t ipaddr; } UHardwareGpsAGpsStatus; /** * Represents an NI request * \ingroup gps_access */ typedef struct { /** set to sizeof(UHardwareGpsNiNotification) */ size_t size; /** * An ID generated by HAL to associate NI notifications and UI * responses */ int notification_id; /** * An NI type used to distinguish different categories of NI * events, such as U_HARDWARE_GPS_NI_TYPE_VOICE, U_HARDWARE_GPS_NI_TYPE_UMTS_SUPL, ... */ uint32_t ni_type; /** * Notification/verification options, combinations of UHardwareGpsNiNotifyFlags constants */ UHardwareGpsNiNotifyFlags notify_flags; /** * Timeout period to wait for user response. * Set to 0 for no time out limit. */ int timeout; /** * Default response when time out. */ UHardwareGpsUserResponseType default_response; /** * Requestor ID */ char requestor_id[U_HARDWARE_GPS_NI_SHORT_STRING_MAXLEN]; /** * Notification message. It can also be used to store client_id in some cases */ char text[U_HARDWARE_GPS_NI_LONG_STRING_MAXLEN]; /** * Client name decoding scheme */ UHardwareGpsNiEncodingType requestor_id_encoding; /** * Client name decoding scheme */ UHardwareGpsNiEncodingType text_encoding; /** * A pointer to extra data. Format: * key_1 = value_1 * key_2 = value_2 */ char extras[U_HARDWARE_GPS_NI_LONG_STRING_MAXLEN]; } UHardwareGpsNiNotification; typedef void (*UHardwareGpsLocationCallback)(UHardwareGpsLocation *location, void *context); typedef void (*UHardwareGpsStatusCallback)(uint16_t status, void *context); typedef void (*UHardwareGpsSvStatusCallback)(UHardwareGpsSvStatus *sv_info, void *context); typedef void (*UHardwareGpsNmeaCallback)(int64_t timestamp, const char *nmea, int length, void *context); typedef void (*UHardwareGpsSetCapabilities)(uint32_t capabilities, void *context); typedef void (*UHardwareGpsRequestUtcTime)(void *context); /** Callback to request the client to download XTRA data. * The client should download XTRA data and inject it by calling inject_xtra_data(). */ typedef void (*UHardwareGpsXtraDownloadRequest)(void *context); /** Callback with AGPS status information. */ typedef void (*UHardwareGpsAGpsStatusCallback)(UHardwareGpsAGpsStatus *status, void *context); /** Callback with NI notification. */ typedef void (*UHardwareGpsNiNotifyCallback)(UHardwareGpsNiNotification *notification, void *context); /* Callback for AGPS RIL (Radio Interface Library) set id */ typedef void (*UHardwareGpsAGpsRilRequestSetId)(uint32_t flags, void *context); typedef void (*UHardwareGpsAGpsRilRequestRefLoc)(uint32_t flags, void *context); typedef struct { UHardwareGpsLocationCallback location_cb; UHardwareGpsStatusCallback status_cb; UHardwareGpsSvStatusCallback sv_status_cb; UHardwareGpsNmeaCallback nmea_cb; UHardwareGpsSetCapabilities set_capabilities_cb; UHardwareGpsRequestUtcTime request_utc_time_cb; UHardwareGpsXtraDownloadRequest xtra_download_request_cb; UHardwareGpsAGpsStatusCallback agps_status_cb; UHardwareGpsNiNotifyCallback gps_ni_notify_cb; UHardwareGpsAGpsRilRequestSetId request_setid_cb; UHardwareGpsAGpsRilRequestRefLoc request_refloc_cb; void* context; } UHardwareGpsParams; /* You must create only one instance per process/application. */ UBUNTU_DLL_PUBLIC UHardwareGps u_hardware_gps_new(UHardwareGpsParams *params); UBUNTU_DLL_PUBLIC void u_hardware_gps_delete(UHardwareGps handle); UBUNTU_DLL_PUBLIC bool u_hardware_gps_start(UHardwareGps self); UBUNTU_DLL_PUBLIC bool u_hardware_gps_stop(UHardwareGps self); /* \param time NTP time, in milliseconds since Jan 1st 1970. \param time_reference time from the internal clock at the moment that NTP time was taken. \param uncertainty possible deviation in the time supplied (uncertainty) in milliseconds. */ UBUNTU_DLL_PUBLIC void u_hardware_gps_inject_time( UHardwareGps self, int64_t time, int64_t time_reference, int uncertainty); UBUNTU_DLL_PUBLIC void u_hardware_gps_inject_location( UHardwareGps self, double latitude, double longitude, float accuracy); UBUNTU_DLL_PUBLIC void u_hardware_gps_delete_aiding_data( UHardwareGps self, uint16_t flags); /* \param mode One of the U_HARDWARE_GPS_POSITION_MODE_* values \param recurrence One of the U_HARDWARE_GPS_POSITION_RECURRENCE_* values \param min_interval represents the time between fixes in milliseconds. \param preferred_accuracy The requested fix accuracy in meters. Can be zero. \param preferred_time The requested time to first fix in milliseconds. Can be zero. */ UBUNTU_DLL_PUBLIC bool u_hardware_gps_set_position_mode( UHardwareGps self, uint32_t mode, uint32_t recurrence, uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time); UBUNTU_DLL_PUBLIC void u_hardware_gps_inject_xtra_data( UHardwareGps self, char* data, int length); #ifdef __cplusplus } #endif #endif // UBUNTU_HARDWARE_GPS_H_ platform-api-0.20+14.04.20140411/include/ubuntu/hardware/CMakeLists.txt0000644000015301777760000000017512322054725025727 0ustar pbusernogroup00000000000000set( UBUNTU_HARDWARE_HEADERS gps.h ) install( FILES ${UBUNTU_HARDWARE_HEADERS} DESTINATION include/ubuntu/hardware )platform-api-0.20+14.04.20140411/include/CMakeLists.txt0000644000015301777760000000003112322054725022577 0ustar pbusernogroup00000000000000add_subdirectory(ubuntu) platform-api-0.20+14.04.20140411/TODO.txt0000644000015301777760000000046312322054725017733 0ustar pbusernogroup00000000000000TODO: ----- * Make sure the libraries are all self-contained at their own path, to avoid conflicts * Review headers to know which ones should not be exported by the package * Make sure the package is lintian free * Get the -headers package to be arch all, not used for now due restriction at Launchpad PPA platform-api-0.20+14.04.20140411/COPYING.LGPL0000644000015301777760000001674312322054725020225 0ustar pbusernogroup00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.