diff --git a/.gitignore b/.gitignore index 53f4cd6..f3b8ece 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ -build*/ +brickdm +*.o -*~ -*.sublime-workspace -.~lock* diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 25a8b35..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "cmake"] - path = cmake - url = git://github.com/dlech/vala-cmake-modules diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 647c5cc..0000000 --- a/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -language: bash -sudo: required -dist: bionic -env: -- OS=debian ARCH=amd64 DIST=buster -- OS=debian ARCH=i386 DIST=buster -- OS=debian ARCH=armhf DIST=buster QEMU_USER_STATIC=qemu-user-static -- OS=raspbian ARCH=armhf DIST=buster QEMU_USER_STATIC=qemu-user-static -- OS=debian ARCH=armel DIST=buster QEMU_USER_STATIC=qemu-user-static -cache: - directories: - - "$HOME/cache" -before_install: -- sudo apt-add-repository -y ppa:ev3dev/tools -- sudo apt-get update -- sudo apt-get install --yes debhelper pbuilder-ev3dev dh-systemd $QEMU_USER_STATIC -before_script: -- pbuilder-ev3dev base -- git checkout -B ev3dev-buster -script: -- pbuilder-ev3dev build diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index b80f388..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,237 +0,0 @@ -cmake_minimum_required (VERSION 3.10) -project ("brickman" LANGUAGES C VERSION 0.10.0) - -option (BRICKMAN_TEST "Build the desktop test version.") - -list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) - -set (DATADIR "${CMAKE_INSTALL_PREFIX}/share") - -set (EXEC_NAME "brickman") -set (RELEASE_NAME "Brick Manager") - -# Comment this out to enable C compiler warnings -add_definitions (-w) - -add_subdirectory (data) -set (XDG_DATA_DIRS data) - -configure_file (src/Version.vala.in Version.vala) - -if (BRICKMAN_TEST) - set (BRICKMAN_TEST_PACKAGES gtk+-3.0) - set (BRICKMAN_SOURCE_FILES - test/main.vala - test/ControlPanel.vala - test/FakeBluez5.vala - test/FakeConnman.vala - test/controller/FakeAboutController.vala - test/controller/FakeBatteryController.vala - test/controller/FakeBluetoothController.vala - test/controller/FakeDeviceBrowserController.vala - test/controller/FakeFileBrowserController.vala - test/controller/FakeNetworkController.vala - test/controller/FakeOpenRobertaController.vala - ) -else (BRICKMAN_TEST) - set (BRICKMAN_SOURCE_FILES - lib/bluez5/Adapter.vala - lib/bluez5/AgentManager.vala - lib/bluez5/Device.vala - lib/bluez5/Manager.vala - lib/connman/Manager.vala - lib/connman/Peer.vala - lib/connman/Service.vala - lib/connman/Technology.vala - src/controller/AboutController.vala - src/controller/BatteryController.vala - src/controller/BluetoothController.vala - src/controller/DeviceBrowserController.vala - src/controller/FileBrowserController.vala - src/controller/NetworkController.vala - src/controller/OpenRobertaController.vala - src/GlobalManager.vala - src/main.vala - ) -endif (BRICKMAN_TEST) - -set (BRICKMAN_COMMON_SOURCE_FILES - lib/bluez5/Error.vala - lib/bluez5/Uuid.vala - lib/dbus/Properties.vala - lib/systemd/Logind.vala - lib/systemd/Systemd.vala - lib/systemd/logind-interfaces.vala - lib/systemd/systemd-interfaces.vala - src/controller/IBrickManagerModule.vala - src/dbus/Bluez5Agent.vala - src/dbus/ConnmanAgent.vala - src/view/AboutWindow.vala - src/view/BatteryInfoWindow.vala - src/view/BatteryStatusBarItem.vala - src/view/BluetoothDeviceMenuItem.vala - src/view/BluetoothDeviceWindow.vala - src/view/BluetoothStatusBarItem.vala - src/view/BluetoothWindow.vala - src/view/BrickManagerWindow.vala - src/view/ConnmanAgentInputDialog.vala - src/view/DeviceBrowserWindow.vala - src/view/FileBrowserWindow.vala - src/view/HomeWindow.vala - src/view/MotorBrowserWindow.vala - src/view/MotorInfoWindow.vala - src/view/MotorValueDialog.vala - src/view/NetworkConnectionDnsWindow.vala - src/view/NetworkConnectionEnetWindow.vala - src/view/NetworkConnectionIpv4Window.vala - src/view/NetworkConnectionMenuItem.vala - src/view/NetworkConnectionWindow.vala - src/view/NetworkConnectionsWindow.vala - src/view/NetworkStatusBarItem.vala - src/view/NetworkStatusWindow.vala - src/view/OpenRobertaStatusBarItem.vala - src/view/OpenRobertaWindow.vala - src/view/PortBrowserWindow.vala - src/view/PortInfoWindow.vala - src/view/SelectFromListDialog.vala - src/view/SensorBrowserWindow.vala - src/view/SensorInfoWindow.vala - src/view/SensorValueDialog.vala - src/view/ShutdownDialog.vala - src/view/SignalBars.vala - src/view/TetheringInfoWindow.vala - src/view/TetheringWindow.vala - src/view/WifiMenuItem.vala - src/view/WifiNetworkStatusWindow.vala - src/view/WifiNetworkWindow.vala - src/view/WifiStatusBarItem.vala - src/view/WifiWindow.vala -) - -set (DEPS_MODULES - glib-2.0 - gobject-2.0 - gmodule-2.0 - gio-2.0 - gio-unix-2.0 - gudev-1.0 -) - -# see if we have a local copy of ev3devkit-0.5 that was exported by cmake -find_package (ev3devkit-0.5 QUIET) - -# if we have a local build of ev3devkit-0.5, use it, otherwise use pkg-config to find it -if (ev3devkit-0.5_FOUND) - set(EV3DEVKIT_INCLUDEDIR ${ev3devkit-0.5_INCLUDEDIR}) - set(EV3DEVKIT_SHARED_LIB ev3devkit-0.5-shared) - set(EV3DEVKIT_STATIC_LIB ev3devkit-0.5-static) - set(EV3DEVKIT_VAPIDIR_OPTION "--vapidir=${ev3devkit-0.5_VAPIDIR}") - set(EV3DEVKIT_GIRDIR_OPTION "--girdir=${ev3devkit-0.5_GIRDIR}") - set(EV3DEVKIT_INCLUDEDIR_OPTION "--includedir=${ev3devkit-0.5_GIRDIR}") - set(XDG_DATA_DIRS "${XDG_DATA_DIRS}:${ev3devkit-0.5_DATADIR}") -else (ev3devkit-0.5_FOUND) - list(APPEND DEPS_MODULES ev3devkit-0.5) -endif (ev3devkit-0.5_FOUND) - -# see if we have a local copy of grx-3.0 that was exported by cmake -find_package (grx-3.0 QUIET) - -# if we have a local build of grx-3.0, use it, otherwise use pkg-config to find it -if (grx-3.0_FOUND) - set(GRX3_INCLUDEDIR ${grx-3.0_INCLUDEDIR}) - set(GRX3_SHARED_LIB grx-3.0-shared) - set(GRX3_STATIC_LIB grx-3.0-static) - set(GRX3_VAPIDIR_OPTION "--vapidir=${grx-3.0_VAPIDIR}") - set(GRX3_GIRDIR_OPTION "--girdir=${grx-3.0_GIRDIR}") - set(GRX3_INCLUDEDIR_OPTION "--includedir=${grx-3.0_GIRDIR}") - set(GRX3_PLUGINDIR_ENV "GRX_PLUGIN_PATH=${grx-3.0_PLUGINDIR}") - set(GRX3_FONTCONFIG_PATH_ENV "FONTCONFIG_PATH=${grx-3.0_FONTCONFIG_PATH}") -else (grx-3.0_FOUND) - list(APPEND DEPS_MODULES grx-3.0) -endif (grx-3.0_FOUND) - -find_package(PkgConfig REQUIRED) -pkg_check_modules(DEPS REQUIRED ${DEPS_MODULES}) -add_definitions(${DEPS_CFLAGS}) -link_libraries(${DEPS_LIBRARIES}) -link_directories(${DEPS_LIBRARY_DIRS}) - -if (BRICKMAN_TEST) - pkg_check_modules(BRICKMAN_TEST_DEPS gtk+-3.0) - add_definitions(${BRICKMAN_TEST_DEPS_CFLAGS}) - link_libraries(${BRICKMAN_TEST_DEPS_LIBRARIES}) - link_directories(${BRICKMAN_TEST_DEPS_LIBRARY_DIRS}) -endif (BRICKMAN_TEST) - -link_libraries(m) - -if (CMAKE_CROSSCOMPILING) - # These need to be added manually for some reason. It is important that they - # come after other calls to link_libraries or you will get linker errors. - link_libraries(pcre resolv pthread) -endif(CMAKE_CROSSCOMPILING) - -find_package(Vala REQUIRED) -include(ValaVersion) -ensure_vala_version("0.24" MINIMUM) -include(ValaPrecompile) - -# if the binary directory is a subdirectory of the source directory, it causes -# the build to fail when including generated .vala files that are in the binary -# directory. The solution is to use the relative path. -string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" BRICKMAN_RELATIVE_BINARY_DIR - ${CMAKE_CURRENT_BINARY_DIR}) - -vala_precompile(VALA_C ${EXEC_NAME} - ${BRICKMAN_RELATIVE_BINARY_DIR}/Version.vala - ${BRICKMAN_SOURCE_FILES} - ${BRICKMAN_COMMON_SOURCE_FILES} -PACKAGES - ev3devkit-0.5 - glib-2.0 - gobject-2.0 - gmodule-2.0 - gio-2.0 - gio-unix-2.0 - grx-3.0 - gudev-1.0 - posix - linux - ${BRICKMAN_TEST_PACKAGES} -CUSTOM_VAPIS - bindings/*.vapi -OPTIONS - --target-glib=2.40 - --thread - ${EV3DEVKIT_VAPIDIR_OPTION} - ${GRX3_VAPIDIR_OPTION} -) - -add_executable(${EXEC_NAME} ${VALA_C}) -target_include_directories(${EXEC_NAME} PRIVATE ${EV3DEVKIT_INCLUDEDIR} ${GRX3_INCLUDEDIR}) -target_link_libraries(${EXEC_NAME} PRIVATE ${EV3DEVKIT_SHARED_LIB} ${GRX3_SHARED_LIB}) - -if (BRICKMAN_TEST) -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/test/glade/ControlPanel.glade - ${CMAKE_CURRENT_BINARY_DIR}/ControlPanel.glade COPYONLY ) -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/test/glade/ConnmanServiceIPv4Dialog.glade - ${CMAKE_CURRENT_BINARY_DIR}/ConnmanServiceIPv4Dialog.glade COPYONLY ) -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/test/glade/ConnmanAgentRequestInputDialog.glade - ${CMAKE_CURRENT_BINARY_DIR}/ConnmanAgentRequestInputDialog.glade COPYONLY ) -endif (BRICKMAN_TEST) - -add_dependencies(${EXEC_NAME} brickman_data) -install (TARGETS ${EXEC_NAME} RUNTIME DESTINATION sbin) - -add_custom_target(run - COMMAND - XDG_DATA_DIRS=${XDG_DATA_DIRS}:/usr/local/share:/usr/share - ${GRX3_PLUGINDIR_ENV} - ${GRX3_FONTCONFIG_PATH_ENV} - ./${EXEC_NAME} - DEPENDS ${EXEC_NAME} - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} -) diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/COPYING @@ -0,0 +1,674 @@ + 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 +. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9c3cad7 --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ + +CFLAGS = -Wall `pkg-config --cflags glib-2.0` `pkg-config --cflags dbus-glib-1` +LDLIBS = -lu8g -lm2tk -lglib-2.0 -ludev -lncurses -lupower-glib + +all: brickdm + +brickdm: brickdm_home.o brickdm_event.o brickdm_power.o + +clean: + rm -f *.o \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 240775b..0000000 --- a/README.md +++ /dev/null @@ -1,58 +0,0 @@ -brickman -======== - -The ev3dev Brick Manager. - -Issues ------- - -Please report issues or feature requests at https://github.com/ev3dev/ev3dev/issues - -Hacking -------- - -Get the code: - -* Clone of the brickman repo. - - git clone git://github.com/ev3dev/brickman - cd brickman - git submodule update --init --recursive - -To build for the EV3: - -* Install [Docker] (requires Linux/macOS 10.10.3+/Window 10 Pro) -* Install QEMU (Linux only) - - sudo apt-get install qemu-user-static - -* In the source code directory, run the Docker setup script - - ./docker/setup.sh $ARCH - - Where `$ARCH` is `armel` (or `armhf` if you are building for RPi - or BeagleBone). Output will be saved to a `build-$ARCH` directory. - -* Build the code by running... - - docker exec --tty brickman_armel make install - -* Copy the contents of `build-$ARCH/dist/` to the EV3 and run it. - -[Docker]: https://www.docker.com/ - -To build the desktop test (makes UI development much faster), in a regular terminal, -not in Docker: - -* Install build dependencies: - - sudo apt-add-repository ppa:ev3dev/tools - sudo apt-get update - sudo apt-get install devscripts equivs - sudo mk-build-deps --install debian/control - -* Then... - - cmake -P setup.cmake - make -C build - make -C build run diff --git a/bindings/GLib.vapi b/bindings/GLib.vapi deleted file mode 100644 index b9e6c04..0000000 --- a/bindings/GLib.vapi +++ /dev/null @@ -1,34 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO Mindstorms EV3/ev3dev - * - * Copyright 2015 David Lechner - * - * 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 2 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -/* GLib.vapi - additional binding for GLib */ - -[CCode (cprefix = "g_")] -namespace GLib { - /** - * Replacement for GLib.IOError.from_errno (int). - * - * There is a bug in the vala compiler that tries to assign the return value - * as GError* instead of int. This function returns and int like it should. - */ - [CCode (cheader_file = "gioerror.h")] - public int io_error_from_errno (int errno); -} \ No newline at end of file diff --git a/bindings/Posix.vapi b/bindings/Posix.vapi deleted file mode 100644 index a8e0207..0000000 --- a/bindings/Posix.vapi +++ /dev/null @@ -1,37 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO Mindstorms EV3/ev3dev - * - * Copyright 2014 David Lechner - * - * 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 2 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -/* Posix.vapi - More posix bindings */ - -namespace Posix { - [CCode (cname = "struct utsname", destroy_function = "", has_type_id = false)] - struct UTSName { - public string sysname; - public string nodename; - public string release; - public string version; - public string machine; - public string domainname; - } - - [CCode (cheader_filename = "sys/utsname.h")] - static int uname (ref UTSName buf); -} \ No newline at end of file diff --git a/brickdm.c b/brickdm.c new file mode 100644 index 0000000..301ba59 --- /dev/null +++ b/brickdm.c @@ -0,0 +1,229 @@ +/* + * brickdm -- Brick Display Manager for LEGO Mindstorms EV3/ev3dev + * + * Copyright (C) 2014 David Lechner + * + * 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 . + */ + +/* + * brickdm.c: + * + * This is the main program. Functions in this file include: + * + * - Grabbing a free console for displaying graphics + * - Handling console switching + * - Initalizing library data structures + * - Processing the main event loop + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "brickdm.h" + +GMainLoop *loop; +u8g_t u8g; +GSList *root_stack = NULL; +gboolean brickdm_needs_redraw = TRUE; +gboolean brickdm_show_statusbar = TRUE; +int vtnum; + +gboolean brickdm_sigterm_handler(gpointer user_data) +{ + g_main_loop_quit(loop); + return TRUE; +} + +gboolean brickdm_sighup_handler(gpointer user_data) +{ + int vtfd = GPOINTER_TO_INT(user_data); + struct vt_stat vtstat; + if (isendwin()) { + if (ioctl(vtfd, VT_GETSTATE, &vtstat) == 0) { + if (vtstat.v_active == vtnum) { + ioctl(vtfd, VT_RELDISP, VT_ACKACQ); + refresh(); + brickdm_needs_redraw = TRUE; + } + } + } else { + if (ioctl(vtfd, VT_RELDISP, 1) == 0) + endwin(); + } + return TRUE; +} + +gboolean timer_handler(gpointer user_data) +{ + if (!isendwin()) { + m2_CheckKey(); + brickdm_needs_redraw |= m2_HandleKey(); + if (brickdm_needs_redraw) + { + u8g_BeginDraw(&u8g); + m2_Draw(); + if (brickdm_show_statusbar) { + /* m2_draw can change colors on us */ + u8g_SetDefaultBackgroundColor(&u8g); + u8g_SetDefaultForegroundColor(&u8g); + brickdm_power_draw_battery_status(); + u8g_DrawLine(&u8g, 0, 15, u8g_GetWidth(&u8g), 15); + } + u8g_EndDraw(&u8g); + brickdm_needs_redraw = FALSE; + } + } + return TRUE; +} + +brickdm_root_info *brickdm_pop_root_stack(void) +{ + GSList *last_root = root_stack; + brickdm_root_info *info = NULL; + + if (last_root) { + info = last_root->data; + root_stack = g_slist_delete_link(root_stack, last_root); + } + return info; +} + +void brickdm_root_changed_callback(m2_rom_void_p new_root, + m2_rom_void_p old_root, uint8_t change_value) +{ + if (change_value != BRICKDM_MAX_USER_VALUE) { + brickdm_root_info *info = g_new(brickdm_root_info, 1); + info->element = old_root; + info->value = change_value; + root_stack = g_slist_prepend(root_stack, info); + } +} + +int main(void) +{ + int vtfd; + FILE *in, *out; + SCREEN *term; + char device[32]; + struct vt_stat vtstat; + int exit_value = 0; + struct vt_mode mode = { + .mode = VT_PROCESS, + .relsig = SIGHUP, + .acqsig = SIGHUP, + }; + + g_type_init(); + + vtfd = open("/dev/tty0", O_RDWR, 0); + if (vtfd < 0) { + perror("could not open /dev/tty0"); + exit (1); + } + if (ioctl(vtfd, VT_GETSTATE, &vtstat) < 0) { + perror("tty is not virtual console"); + exit (1); + } + if (ioctl(vtfd, VT_OPENQRY, &vtnum) < 0) { + perror("no free virtual consoles"); + exit (1); + } + sprintf(device, "/dev/tty%d", vtnum); + if (access(device, (W_OK|R_OK)) < 0) { + perror("insufficient permission on tty"); + exit (1); + } + + ioctl(vtfd, VT_ACTIVATE, vtnum); + ioctl(vtfd, VT_WAITACTIVE, vtnum); + + close (vtfd); + vtfd = open(device, O_RDWR, 0); + in = fdopen(vtfd, "r"); + out = fdopen(vtfd, "w"); + term = newterm("linux", in, out); + /* we are using ncurses for keyboard input only - see brickdm_event.c */ + + do + { + if (ioctl(vtfd, KDSETMODE, KD_GRAPHICS) < 0) + { + perror("Could not set virtual console to KD_GRAPHICS mode."); + exit_value = 1; + break; + } + + if (ioctl(vtfd, VT_SETMODE, &mode) < 0) + { + perror("Could not set virtual console to VT_PROCESS mode."); + exit_value = 1; + break; + } + + /* we are now free to directly access the framebuffer */ + + u8g_Init(&u8g, &u8g_dev_linux_fb); + m2_Init(&brickdm_home_root, brickdm_event_source, brickdm_event_handler, + m2_gh_u8g_bfs); + m2_SetRootChangeCallback(brickdm_root_changed_callback); + m2_SetU8g(&u8g, m2_u8g_box_icon); + m2_SetFont(0, u8g_font_7x13); + m2_SetFont(1, u8g_font_m2icon_9); + m2_SetU8gAdditionalTextXBorder(3); + + loop = g_main_loop_new (NULL, FALSE); + g_timeout_add(50, timer_handler, NULL); + // TODO: glib >= 2.36 can handle user signals + // This would be better as SIGUSR1 + g_unix_signal_add(SIGHUP, brickdm_sighup_handler, GINT_TO_POINTER(vtfd)); + g_unix_signal_add(SIGINT, brickdm_sigterm_handler, NULL); + g_unix_signal_add(SIGTERM, brickdm_sigterm_handler, NULL); + + brickdm_power_init(); + + g_main_loop_run(loop); + u8g_Stop(&u8g); + } while(0); + + /* tear down and cleanup */ + ioctl(vtfd, KDSETMODE, KD_TEXT); + mode.mode = VT_AUTO; + ioctl(vtfd, VT_SETMODE, &mode); + if (!isendwin()) { + endwin(); + ioctl(vtfd, VT_ACTIVATE, vtstat.v_active); + ioctl(vtfd, VT_WAITACTIVE, vtstat.v_active); + } + ioctl(vtfd, VT_DISALLOCATE, vtnum); + delscreen(term); + fclose(in); + fclose(out); + close(vtfd); + + return exit_value; +} diff --git a/brickdm.h b/brickdm.h new file mode 100644 index 0000000..847585d --- /dev/null +++ b/brickdm.h @@ -0,0 +1,59 @@ +/* + * brickdm -- Brick Display Manager for LEGO Mindstorms EV3/ev3dev + * + * Copyright (C) 2014 David Lechner + * + * 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 . + */ + +#ifndef __BRICKDM_H +#define __BRICKDM_H + +#include +#include + +/* m2tk format string for root ALIGN elemets */ +#define BRICKDM_ROOT_FMT "-1|1W64H56" +#define BRICKDM_MAX_USER_VALUE ((uint8_t)-1) + +struct _brickdm_root_info { + m2_rom_void_p element; + uint8_t value; +}; +typedef struct _brickdm_root_info brickdm_root_info; + +/* brickdm.c */ +extern u8g_t u8g; +extern gboolean brickdm_needs_redraw; +extern gboolean brickdm_show_statusbar; +extern brickdm_root_info *brickdm_pop_root_stack(void); + +/* brickdm_home.c */ +M2_EXTERN_ALIGN(brickdm_home_root); + +/* brickdm_power.c */ +M2_EXTERN_ALIGN(brickdm_battery_root); +M2_EXTERN_ALIGN(brickdm_shutdown_root); +extern void brickdm_power_init(void); +extern void brickdm_power_draw_battery_status(void); + +/* brickdm_event.c */ +extern uint8_t brickdm_event_source(m2_p ep, uint8_t msg); +extern uint8_t brickdm_event_handler(m2_p ep, uint8_t msg, uint8_t arg1, + uint8_t arg2); + +/* brickdm_graphcics.c */ +extern uint8_t brickdm_gh_bfs(m2_gfx_arg_p arg); + +#endif /* __BRICKDM_H */ \ No newline at end of file diff --git a/brickdm_event.c b/brickdm_event.c new file mode 100644 index 0000000..d11512d --- /dev/null +++ b/brickdm_event.c @@ -0,0 +1,174 @@ +/* + * brickdm -- Brick Display Manager for LEGO Mindstorms EV3/ev3dev + * + * Copyright (C) 2014 David Lechner + * + * brickdm_event_handler() copied from m2eh6bs.c + * m2tklib = Mini Interative Interface Toolkit Library + * Copyright (C) 2011 olikraus@gmail.com + * + * 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 . + */ + +/* + * brickdm_event.c: + * + * Implements an m2tk event source that gets keyboard input using the ncurses + * library. + */ + +#include +#include + +#include "brickdm.h" + +uint8_t brickdm_event_source(m2_p ep, uint8_t msg) +{ + switch(msg) + { + case M2_ES_MSG_GET_KEY: + switch (getch()) { + /* Actual keys on the EV3 */ + case KEY_DOWN: + return M2_KEY_EVENT(M2_KEY_DATA_DOWN); + case KEY_UP: + return M2_KEY_EVENT(M2_KEY_DATA_UP); + case KEY_LEFT: + return M2_KEY_EVENT(M2_KEY_PREV); + case KEY_RIGHT: + return M2_KEY_EVENT(M2_KEY_NEXT); + case '\n': + return M2_KEY_EVENT(M2_KEY_SELECT); + case KEY_BACKSPACE: + return M2_KEY_EVENT(M2_KEY_EXIT); + + /* Other keys incase a keyboard or keypad is plugged in */ + case KEY_BTAB: + case KEY_PREVIOUS: + return M2_KEY_EVENT(M2_KEY_PREV); + case KEY_NEXT: + return M2_KEY_EVENT(M2_KEY_NEXT); + case KEY_ENTER: + case KEY_COMMAND: + case KEY_OPEN: + return M2_KEY_EVENT(M2_KEY_SELECT); + case KEY_CANCEL: + case KEY_EXIT: + return M2_KEY_EVENT(M2_KEY_EXIT); + case KEY_HOME: + return M2_KEY_EVENT(M2_KEY_HOME); + case KEY_SHOME: + return M2_KEY_EVENT(M2_KEY_HOME2); + case KEY_F(1): + return M2_KEY_EVENT(M2_KEY_Q1); + case KEY_F(2): + return M2_KEY_EVENT(M2_KEY_Q2); + case KEY_F(3): + return M2_KEY_EVENT(M2_KEY_Q3); + case KEY_F(4): + return M2_KEY_EVENT(M2_KEY_Q4); + case KEY_F(5): + return M2_KEY_EVENT(M2_KEY_Q5); + case KEY_F(6): + return M2_KEY_EVENT(M2_KEY_Q6); + case '0': + return M2_KEY_EVENT(M2_KEY_0); + case '1': + return M2_KEY_EVENT(M2_KEY_1); + case '2': + return M2_KEY_EVENT(M2_KEY_2); + case '3': + return M2_KEY_EVENT(M2_KEY_3); + case '4': + return M2_KEY_EVENT(M2_KEY_4); + case '5': + return M2_KEY_EVENT(M2_KEY_5); + case '6': + return M2_KEY_EVENT(M2_KEY_6); + case '7': + return M2_KEY_EVENT(M2_KEY_7); + case '8': + return M2_KEY_EVENT(M2_KEY_8); + case '9': + return M2_KEY_EVENT(M2_KEY_9); + case '*': + return M2_KEY_EVENT(M2_KEY_STAR); + case '#': + return M2_KEY_EVENT(M2_KEY_HASH); + } + return M2_KEY_NONE; + case M2_ES_MSG_INIT: + cbreak(); + noecho(); + keypad(stdscr, TRUE); + nodelay(stdscr, TRUE); + break; + } + return 0; +} +#include +uint8_t brickdm_event_handler(m2_p ep, uint8_t msg, uint8_t arg1, uint8_t arg2) +{ + m2_nav_p nav = m2_get_nav(ep); + + switch(msg) { + case M2_EP_MSG_SELECT: + return m2_nav_user_down(nav, 1); + + case M2_EP_MSG_EXIT: + // if there is no valid parent, then go to the previous root + if (!m2_nav_user_up(nav)) { + brickdm_root_info *info = brickdm_pop_root_stack(); + if (info) { + m2_SetRootExtended(info->element, info->value, BRICKDM_MAX_USER_VALUE); + g_free(info); + } else { + // TODO: show shutdown dialog + } + } + return 1; + + case M2_EP_MSG_NEXT: + return m2_nav_user_next(nav); + + case M2_EP_MSG_PREV: + return m2_nav_user_prev(nav); + + case M2_EP_MSG_DATA_DOWN: + if ( m2_nav_data_down(nav) == 0 ) + return m2_nav_user_next(nav); + return 1; + + case M2_EP_MSG_DATA_UP: + if ( m2_nav_data_up(nav) == 0 ) + return m2_nav_user_prev(nav); + return 1; + } + + if (msg >= M2_KEY_Q1 && msg <= M2_KEY_LOOP_END) { + if (m2_nav_quick_key(nav, msg - M2_KEY_Q1 + 1) != 0) + { + if (m2_nav_is_data_entry(nav)) + return m2_nav_data_up(m2_get_nav(ep)); + return m2_nav_user_down(nav, 1); + } + } + + if (msg >= M2_EL_MSG_SPACE) { + m2_nav_prepare_fn_arg_current_element(nav); + m2_fn_arg_call(msg); // assign the char + return m2_nav_user_next(nav); // go to next position + } + return 0; +} diff --git a/brickdm_home.c b/brickdm_home.c new file mode 100644 index 0000000..295ce40 --- /dev/null +++ b/brickdm_home.c @@ -0,0 +1,46 @@ +/* + * brickdm -- Brick Display Manager for LEGO Mindstorms EV3/ev3dev + * + * Copyright (C) 2014 David Lechner + * + * based in part on GNOME Power Manager: + * Copyright (C) 2008-2011 Richard Hughes + * + * 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 . + */ + +/* + * brickdm_home.c: + * + * The home sceen for brickdm. + */ + +#include "brickdm.h" + +m2_xmenu_entry main_menu_data[] = { + { "Battery", &brickdm_battery_root, NULL }, + { "Shutdown", &brickdm_shutdown_root, NULL }, + { NULL, NULL } +}; + +uint8_t main_menu_first = 0; +uint8_t main_menu_cnt = 6; + +M2_X2LMENU(main_menu, "l7e20W42", &main_menu_first, &main_menu_cnt, + main_menu_data, '+', '-', '\0'); +M2_SPACE(main_menu_space, "W1h1"); +M2_VSB(main_menu_scroll, "l4w4r1", &main_menu_first, &main_menu_cnt); +M2_LIST(main_menu_list_data) = { &main_menu, &main_menu_space, &main_menu_scroll }; +M2_HLIST(main_menu_hlist, NULL, main_menu_list_data); +M2_ALIGN(brickdm_home_root, BRICKDM_ROOT_FMT, &main_menu_hlist); \ No newline at end of file diff --git a/brickdm_power.c b/brickdm_power.c new file mode 100644 index 0000000..837a447 --- /dev/null +++ b/brickdm_power.c @@ -0,0 +1,246 @@ +/* + * brickdm -- Brick Display Manager for LEGO Mindstorms EV3/ev3dev + * + * Copyright (C) 2014 David Lechner + * + * based in part on GNOME Power Manager: + * Copyright (C) 2008-2011 Richard Hughes + * + * 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 . + */ + +/* + * brickdm_power.c: + * + * Reads info from the battery and provide functions for displaying that info. + */ + +#include + +#include "brickdm.h" + +#define BRICKDM_POWER_EV3_BATTERY_PATH \ + "/org/freedesktop/UPower/devices/battery_legoev3_battery" +#define BATTERY_STRING_SIZE 10 +#define TECHNOLOGY_NAME_SIZE 30 +#define BATTERY_HIST_GRAPH_WIDTH 150 +#define BATTERY_HIST_GRAPH_HEIGHT 100 +#define BATTERY_HIST_GRAPH_FMT(width,height) "w"#width"h"#height + +gchar *current_device; +gchar battery_voltage[BATTERY_STRING_SIZE+1]; +gchar battery_voltage2[BATTERY_STRING_SIZE+1]; +gchar battery_current[BATTERY_STRING_SIZE+1]; +gchar battery_power[BATTERY_STRING_SIZE+1]; +gchar technology_name[TECHNOLOGY_NAME_SIZE+1]; +gdouble battery_hist_data[BATTERY_HIST_GRAPH_WIDTH]; + +/* battery history screen definitions */ + +void battery_hist_graph_callback(m2_el_fnarg_p fnarg); + +M2_LABEL(battery_hist_label, NULL, "History:"); +M2_SPACECB(battery_hist_graph, BATTERY_HIST_GRAPH_FMT(BATTERY_HIST_GRAPH_WIDTH, + BATTERY_HIST_GRAPH_HEIGHT), battery_hist_graph_callback); +M2_LIST(battery_hist_list_data) = { &battery_hist_label, &battery_hist_graph }; +M2_VLIST(battery_hist_vlist, NULL, battery_hist_list_data); +M2_ALIGN(brickdm_battery_hist_root, BRICKDM_ROOT_FMT, &battery_hist_vlist); + +/* battery screen definitions */ + +M2_LABEL(battery_stats_label, NULL, "Statistics:"); +M2_ALIGN(brickdm_battery_stats_root, BRICKDM_ROOT_FMT, &battery_stats_label); + +/* battery statictics screen definitions */ + +void battery_hist_button_callback(m2_el_fnarg_p fnarg); + +M2_LABEL(battery_label, NULL, "Battery Info:"); +M2_BOX(battery_label_underline, "h1W48"); +M2_LABEL(technology_label, NULL, "Type:"); +M2_LABELP(technology_value, NULL, technology_name); +M2_LABEL(voltage_label, NULL, "Voltage:"); +M2_LABELP(voltage_value, NULL, battery_voltage); +M2_LABEL(current_label, NULL, "Current:"); +M2_LABELP(current_value, NULL, battery_current); +M2_LABEL(power_label, NULL, "Power:"); +M2_LABELP(power_value, NULL, battery_power); +M2_SPACE(grid_space, "w2"); +M2_LIST(data_grid_list_data) = { + &technology_label, &grid_space, &technology_value, + &voltage_label, &grid_space, &voltage_value, + ¤t_label, &grid_space, ¤t_value, + &power_label, &grid_space, &power_value, +}; +M2_GRIDLIST(data_gird_list, "c3", data_grid_list_data); +M2_BUTTON(goto_hist_button, "f4", " Hist ", battery_hist_button_callback); +M2_ROOT(goto_stats_button, "f4", " Stats ", &brickdm_battery_stats_root); +M2_LIST(button_list_data) = { &goto_hist_button, &goto_stats_button }; +M2_HLIST(button_hlist, NULL, button_list_data); +M2_SPACE(list_space, "h5"); +M2_LIST(battery_list_data) = { &battery_label, &battery_label_underline, + &list_space, &data_gird_list, &list_space, &button_hlist }; +M2_VLIST(battery_vlist, NULL, battery_list_data); +M2_ALIGN(brickdm_battery_root, BRICKDM_ROOT_FMT, &battery_vlist); + +/* shutdown screen definitions */ + +void shutdown_button_callback(m2_el_fnarg_p fnarg); +void restart_button_callback(m2_el_fnarg_p fnarg); + +M2_BUTTON(shutdown_button, "f12W32", "Shutdown", shutdown_button_callback); +M2_BUTTON(restart_button, "f12W32", "Restart", restart_button_callback); +M2_LIST(shutdown_list_data) = { &shutdown_button, &list_space, &restart_button }; +M2_VLIST(shutdown_vlist, NULL, shutdown_list_data); +M2_ALIGN(brickdm_shutdown_root, BRICKDM_ROOT_FMT, &shutdown_vlist); + +void update_battery_hist_data(UpDevice *device) +{ + GPtrArray *array; + UpHistoryItem *item; + int i; + + g_debug("Getting history."); + array = up_device_get_history_sync(device, "rate", 3600, + BATTERY_HIST_GRAPH_WIDTH, NULL, NULL); + if(!array) { + g_debug("Failed to get history."); + // TODO: show error on screen + return; + } + for (i=0; ilen; i++) { + item = g_ptr_array_index(array, i); + battery_hist_data[i] = up_history_item_get_value (item); + g_debug("time: %d, state: %d, value: %.2f", up_history_item_get_time(item), + up_history_item_get_state (item), battery_hist_data[i]); + } + g_ptr_array_unref (array); + brickdm_needs_redraw = TRUE; +} + +void battery_hist_button_callback(m2_el_fnarg_p fnarg) +{ + UpDevice *device = up_device_new(); + up_device_set_object_path_sync(device, BRICKDM_POWER_EV3_BATTERY_PATH, NULL, NULL); + update_battery_hist_data(device); + g_object_unref(device); + m2_SetRoot(&brickdm_battery_hist_root); +} + +void battery_hist_graph_callback(m2_el_fnarg_p fnarg) +{ + int i; + g_debug("Drawing graph."); + for (i=0; ilen; i++) { + UpDevice *device = g_ptr_array_index (devices, i); + UpDeviceKind kind; + const char* object_path; + + g_signal_connect(client, "device-changed", + G_CALLBACK(brickdm_power_device_changed_cb), NULL); + g_object_get(device, "kind", &kind, NULL); + object_path = up_device_get_object_path(device); + g_debug("Found %s at %s.\n", up_device_kind_to_string(kind), object_path); + if (g_strcmp0(BRICKDM_POWER_EV3_BATTERY_PATH, object_path) == 0) + brickdm_power_update_status(device); + } +} + +void run_command(const char *command) +{ + g_spawn_command_line_sync(command, NULL, NULL, NULL, NULL); + // TODO: would be nice to check for errors +} + +void shutdown_button_callback(m2_el_fnarg_p fnarg) +{ + run_command("poweroff"); +} + +void restart_button_callback(m2_el_fnarg_p fnarg) +{ + run_command("reboot"); +} diff --git a/cmake b/cmake deleted file mode 160000 index 33bbae5..0000000 --- a/cmake +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 33bbae516111fa9a382ce1467ebc84f1dce26db4 diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt deleted file mode 100644 index e59d60b..0000000 --- a/data/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -set (files - openroberta-connected12x9 - openroberta-connected16x16 - openroberta-idle12x9 - openroberta-idle16x16 - splash -) - -set (destination_directory ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}) - -set (generated_files "") -foreach (file ${files}) - set (in_file ${CMAKE_CURRENT_SOURCE_DIR}/${file}.pbm) - set (out_file ${destination_directory}/${file}.png) - list (APPEND generated_files ${out_file}) - add_custom_command ( - OUTPUT - ${out_file} - COMMAND - mkdir -p ${destination_directory} - COMMAND - ${CMAKE_COMMAND} -Din_file="${in_file}" -Dout_file="${out_file}" -P ${CMAKE_CURRENT_SOURCE_DIR}/pnmtopng.cmake - WORKING_DIRECTORY - ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS - ${in_file}) -endforeach (file) - -add_custom_target (brickman_data - DEPENDS - ${generated_files}) - -install ( - DIRECTORY - ${destination_directory} - DESTINATION - share) \ No newline at end of file diff --git a/data/openroberta-connected12x9.pbm b/data/openroberta-connected12x9.pbm deleted file mode 100644 index a918695..0000000 --- a/data/openroberta-connected12x9.pbm +++ /dev/null @@ -1,5 +0,0 @@ -P1 -# CREATOR: GIMP PNM Filter Version 1.1 -12 9 -0000000001100110000000011011100111000100011000101000010000011001110011 -01100111001101010001100010001111111100 \ No newline at end of file diff --git a/data/openroberta-connected16x16.pbm b/data/openroberta-connected16x16.pbm deleted file mode 100644 index 248f335..0000000 --- a/data/openroberta-connected16x16.pbm +++ /dev/null @@ -1,7 +0,0 @@ -P1 -# CREATOR: GIMP PNM Filter Version 1.1 -16 16 -0000000000000000000000000001110000111000000000100100000000000001100111 -1001111000001000011000010001000001000000100100000100000010010011010011 -0010010011010011001000100001100001000001111001111000000000000000000000 -0000000000000000000000000000000000000000000000 \ No newline at end of file diff --git a/data/openroberta-idle12x9.pbm b/data/openroberta-idle12x9.pbm deleted file mode 100644 index be1cd76..0000000 --- a/data/openroberta-idle12x9.pbm +++ /dev/null @@ -1,5 +0,0 @@ -P1 -# CREATOR: GIMP PNM Filter Version 1.1 -12 9 -0000000000000110000001101011100111010100011000101000010000011100011000 -11101111011101010001100010001111111100 \ No newline at end of file diff --git a/data/openroberta-idle16x16.pbm b/data/openroberta-idle16x16.pbm deleted file mode 100644 index f35d8c5..0000000 --- a/data/openroberta-idle16x16.pbm +++ /dev/null @@ -1,7 +0,0 @@ -P1 -# CREATOR: GIMP PNM Filter Version 1.1 -16 16 -0000000000000000000000000000000000111000000111000100000000000010100111 -1001111001001000011000010001000001000000100100000100000010011000011000 -0110010111110111101000100001100001000001111001111000000000000000000000 -0000000000000000000000000000000000000000000000 \ No newline at end of file diff --git a/data/pnmtopng.cmake b/data/pnmtopng.cmake deleted file mode 100644 index 7cd4018..0000000 --- a/data/pnmtopng.cmake +++ /dev/null @@ -1,14 +0,0 @@ -# requires list of files set using -Din_file="file1" -Dout_file="file2" - -execute_process ( - COMMAND - pnmtopng - INPUT_FILE - ${in_file} - OUTPUT_FILE - ${out_file} - OUTPUT_VARIABLE - output - ERROR_VARIABLE - error) - diff --git a/data/splash.pbm b/data/splash.pbm deleted file mode 100644 index a11d4d2..0000000 --- a/data/splash.pbm +++ /dev/null @@ -1,329 +0,0 @@ -P1 -# CREATOR: GIMP PNM Filter Version 1.1 -178 128 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000011100000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000001100000000000000000 -0000000000000000000000000000000000000000000000000000000111000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000001110000000000000000000000000000000000000000000000000 -0000000000000000000000011100000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000011110000000000 -0000000000000000000000000000000000000000000000000000000000001110000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000001110000000000000000000000000000000000000000000 -0000000000000000000000000000111000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000111100000 -0000000000000000000000000000000000000000000000000000000000000000001110 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000011110000000000000000000000000000000000000 -0000000000000000000000000000000001111000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000111 -0000000000000000000000000000000000000000001100000000000000000000000000 -0111000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000011100000000000000000000000000000000 -0000000000111000000000000000000000000001110000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0011110000000000000000000000000000000000000000001110000000000000000000 -0000000111000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000111100000000000000000000000000 -0000000000000000010000000000000000000000000011110000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000011110000000000000000000000000000000000000000000000000000000000 -0000000000001110000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000111100000000000000000000 -0000000000000000000000000000000000000000000000000011100000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000011100000000000000000000000000000000000000000000000000000 -0000000000000000001110000000000110000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000111111111111000000 -0000000000001110000000000000000000000000000000000000000111100000000111 -1100000000000000001111000000000000000000000000000000000000000000000000 -0000100000000000001111111111111111110000000000011111111111100000000000 -0000000000000000000000011100000011111111000000000000000111111000000000 -0000000000000000000000000000000000000000111110000000000011111111111111 -1111100000000111111111111111111001100000000000111111100000000111000111 -1111111000000000000001111111110000000000000000000000000000000000000000 -0110011111111100000000001111100000000011111100001011111111111111111110 -0111000000001111111111000000111111111111111000000000110000111111111100 -0000000111110000000000000000000000000011111111111111000000000001111000 -0000000001110001111111100000000000100001110000001111111111100000001111 -1111111100000000000011101111110001110000000111111110000000001111111000 -0000001111111111111110000000000111000000000000011100011111100000000000 -0000000111000001111111000000000000111111111000000000000001111111111000 -0111100001111111111000000011111111110000000111111111000111100000000001 -1100000000000011110001111100000000000000000001110000111111000000000000 -0111111111100000000000000111111111000001111000111111111111000011111111 -1111100000011111110000001111000000000111000000000011111000111110000000 -0000000000000111000111110000000000000001111111111111100000000001111111 -1000000111101111111000111100011111110000110000000111111000000011110000 -0000011100000000111111000011111000000000000000000011110001111000000000 -0000000111100111111111110000000111111100000001111111111000001111000111 -1100000110000000011111100000001111000000000111000001111111100000111110 -0000000000000000001111000111100000000000000001110000011111111110000011 -1111100000000111111111000000111100011110001111110000000011110000000011 -1100000000011100111111111000000011110000000000000000000011110001111100 -0000000000000111000000001111111110000111110000000001111111100000001111 -0001111111111111100000001110000000001111000000000111111111111000000000 -1111000000000000000000000111000111111111111111110011110000000000011111 -1100011100000000000111111000000000111100011111111111111110000000000000 -0000111100000000111111111100000000000011110000000000000000000001110000 -1111111111111110000110000000000000001111000000000000000001111100000000 -0011110000111111110011111100000000000000000111000000001111110000000000 -0000000111000000000000000000000010000000111111111100000000000000000000 -0000001000000000000000000111100000000000011100000011110000001111100000 -0000000000001100000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000001110000000000000000001110000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000001000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000001111111111000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000010000000 -0011111111111111110000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000001000000000000000000000000011111100000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000010 -0000000000000000000000000000011000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000001001111111111100000000000000000110 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000100101000000011111111111111111011100000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000001001011110000000000000000000 -0101010000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000100101001111111111111111111001010110000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000001001010000000000000000 -0000100101001000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000001000101000000000000000000001001010010000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000010011010000000000 -0000000000100101000100000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000001001001000000000000000000001001100001000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000010010010000 -0000000000000000100110000010000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000010001010000000000000000000001011100000110000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000100010 -1000000000000000000000101010000011000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000010011010000000000000000000011010100000 -1000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -1001001111111111110000000001001010000010000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000100010000000000000011111111110011 -1000001000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000010001000000000000000000000001001100000110000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000100011111111111111111111111 -1111110000010000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000100001000001100000000000000000001100000100000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000001000110000100111111110 -0000000000100000110000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000001000011111110111000011000000000001000001000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000010000000000011010 -0011100000000000100000100000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000010000000001111001111101110000000001000010000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000100000000010 -0000111000001100000001100001000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000100000000001110011111000111000000010000010000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000001000000 -0000001011000110010000000001000001000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000001000000000000010100000111100000000010000 -1100000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000011 -1111111000001111111111100000000001000010000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000010000000001111111111111111111000000 -1000001000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0001100000000000000000000000000111111111100110000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000001111111111000000000000000000 -0000001000010000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000010000000111111111111111100000000010000100000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000010000100111000000000 -0001111111010000110000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000001100011110111111110111110000001111001000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000001100010001010 -0001011001111111111100100000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000011001111101111110100000101000011101000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000010000 -0000000000011111110111111010100000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000001100001111111110000000000000000111000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0011111000000000111111111111100001000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000100000000000000000000000000111 -1100000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000001000001000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000011 -0000000000000000000000000100000100000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000100000000000000000000000001000000 -0000000000000000010000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000010000011110000111100001110100001100001011100001110100000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000100001000010010000100100011 -0000010000110001001000100000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000010000100001000000010010000100000100001000010010001000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000100001000010001111100 -1000010000010000100001001000100000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000010000100001001000010010000100000100001000010001110000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000100001000010010 -0001001000010000010000100001000100000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000010000100001001000110010001100000100001000010001 -1110000011000000110000001100000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000011111000111 -1000011101000111010001111100100001001000010000110000001100000011000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000100001000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000111100000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000 \ No newline at end of file diff --git a/debian/brickman.service b/debian/brickman.service deleted file mode 100644 index 7e73314..0000000 --- a/debian/brickman.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=Brick Manager -Conflicts=getty@tty1.service -After=systemd-user-sessions.service getty@tty1.service - -[Service] -Type=simple -ExecStart=/usr/sbin/brickman -StandardInput=tty -TTYPath=/dev/tty1 -StandardOutput=journal -StandardError=journal - -[Install] -Alias=display-manager.service diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index d8feb2d..0000000 --- a/debian/changelog +++ /dev/null @@ -1,185 +0,0 @@ -brickman (0.10.0) testing; urgency=medium - - * Update for GRX 3.0.0 (fixes console switching) - * Use brickrun to launch programs and log stderr to file - * Remove long back press feature - - -- David Lechner Thu, 31 Aug 2017 15:57:10 -0500 - -brickman (0.9.0) testing; urgency=medium - - * Update for ev3devKit 0.5, GRX 3.0 and stretch - * Console switching and long back press are broken - - -- David Lechner Fri, 24 Mar 2017 12:53:41 -0500 - -brickman (0.8.1) stable; urgency=medium - - [ Denis Demidov ] - * Use /usr/bin/sudo instead of /sbin/runuser to launch processes from file - browser - - [ David Lechner ] - * Fix running programs with space in name - * Change ownership of /dev/tty when running files - * Make bluetooth "unavailible" when there are no adapters - - -- David Lechner Fri, 13 Jan 2017 20:15:22 -0600 - -brickman (0.8.0) stable; urgency=medium - - [ Stefan Sauer ] - * openroberta: focus on the previously selected 'connect' button - - [ David Lechner ] - * Remove libgrx-dev from build-dep - * update to ev3devKit 0.4 - * Change to directory of file before executing - * Extend wifi connect timeout to 5 minutes - * Close network info windows when service is removed - * Make connecting to network cancelable - - -- David Lechner Fri, 17 Jun 2016 15:30:53 -0500 - -brickman (0.7.2) stable; urgency=medium - - * Fix network name not changing on child windows in FakeNetworkController - * Fixup BlueZ5 agent dialogs for larger font size. - * Add controls for connection status to brickman test. - - -- David Lechner Tue, 29 Dec 2015 22:48:39 -0600 - -brickman (0.7.1) stable; urgency=medium - - * Change Wi-Fi window for larger font size - - -- David Lechner Sat, 26 Dec 2015 16:03:01 -0600 - -brickman (0.7.0) stable; urgency=medium - - * Use XDG_DATA_DIRS for data files. - * Add platform checks for EV3 specific stuff. - * Update for ev3dev kernel level 9. - * Make Battery window work on non-EV3 devices. - * Make About window work on non-EV3 devices. - * UI changes to handle bigger font. - * Add UI for OpenRoberta (thanks @ensonic). - * File browser is now limited to /home/robot - * Remove dependency on libgee (improves performance). - * USB menu is removed. - - -- David Lechner Tue, 15 Dec 2015 17:16:54 -0600 - -brickman (0.6.2) stable; urgency=medium - - [ David Lechner ] - * Change polling time to 500 ms for watch window. - - [ Stefan Sauer ] - * filebrowser: ensure that the tty is accesible to the user - * brickman.service: route stdout/err to journal for easier access - - [ David Lechner ] - * Now using ev3devKit as shared library. - - -- David Lechner Sat, 12 Sep 2015 00:30:26 -0500 - -brickman (0.6.1) stable; urgency=medium - - * Change LED names to match changes in kernel. - * Don't open a new VT when starting. - - -- David Lechner Wed, 20 May 2015 17:05:34 -0500 - -brickman (0.6.0) stable; urgency=medium - - * Update for ev3dev kernel ABI 3 and 4 changes. - * Show adapter in Bluetooth device name when there is more than one adapter present. - * Fix memory leak caused by reference cycles with network service objects. - * Add Motor browser. - - -- David Lechner Fri, 01 May 2015 12:09:21 -0500 - -brickman (0.5.1) testing; urgency=medium - - * Add entries to control panel for setting values displayed by bluetooth agent dialogs. - * Make Wi-Fi and Bluetooth status bar indicators invisible by default. - * Fix potential issue with tether netmask. - * Don't check for connected status when binding network status bar text. - * Hide network connection button when bluetooth device is not paired. - - -- David Lechner Tue, 31 Mar 2015 20:06:28 -0500 - -brickman (0.5.0) testing; urgency=medium - - * Added splash screen. - * Fixed race condition that sometimes caused Wi-Fi to show incorrect powered - state. - * Added UI for enabling tethering via USB or Bluetooth. - * Redesigned "Wireless and Networks" menu. Bluetooth and USB are moved under - this menu. There is also a new separate menu for Wi-Fi. - * Added Wi-Fi and Bluetooth status indicators in the status bar. - * Fixed user program sound output (beep only) not stopped when program is - killed. - * Fixed network connection display order issue. - - -- David Lechner Tue, 24 Feb 2015 14:54:16 -0600 - -brickman (0.4.0) testing; urgency=medium - - * Add File Browser. - - -- David Lechner Sun, 25 Jan 2015 19:36:25 -0600 - -brickman (0.3.0) testing; urgency=medium - - * Have Bluez5.Manager hang on to object instances that it creates - (ev3dev/ev3dev#201) - * Add Device Browser with support for browsing ports and sensors - (ev3dev/ev3dev#169) - * Rearrange About window to fit long kernel version strings - - -- David Lechner Tue, 06 Jan 2015 22:25:38 -0600 - -brickman (0.2.0) testing; urgency=medium - - * Add support for Bluetooth management. Can can now scan, pair and connect - devices. - * Properly handle connman restart/crash. brickman no longer restarts when - connman service restarts. - - -- David Lechner Thu, 13 Nov 2014 19:51:56 -0600 - -brickman (0.1.3) testing; urgency=medium - - [ WasabiFan ] - * Add IP address to status bar - - [ David Lechner ] - * fix Network status menu shrinking when technologies are removed - * Make brickman restart when connman restarts - * Fix build-depends due to libjpeg62 transitional packages being removed. - - -- David Lechner Mon, 03 Nov 2014 13:01:59 -0600 - -brickman (0.1.2) testing; urgency=medium - - * Use on screen keyboard for ip address entry - * put executable in sbin instead of bin - * fix nameserver not working after switching from dhcp to manual - * fix dbus property notification not working - - -- David Lechner Wed, 08 Oct 2014 22:55:29 -0500 - -brickman (0.1.1) testing; urgency=medium - - * fix systemd service not enabled after install - * add kernel version to about window - - -- David Lechner Mon, 06 Oct 2014 21:34:09 -0500 - -brickman (0.1.0) testing; urgency=low - - * Initial Release. - - -- David Lechner Sun, 05 Oct 2014 22:06:02 -0500 diff --git a/debian/compat b/debian/compat deleted file mode 100644 index ec63514..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/debian/control b/debian/control deleted file mode 100644 index 3986998..0000000 --- a/debian/control +++ /dev/null @@ -1,18 +0,0 @@ -Source: brickman -Section: embedded -Priority: standard -Maintainer: David Lechner -Build-Depends: debhelper (>= 9), dh-systemd, cmake, valac (>= 0.24), - libgirepository1.0-dev, libgudev-1.0-dev, - libev3devkit-dev, netpbm -Standards-Version: 3.9.8 -Homepage: https://www.ev3dev.org -Vcs-Git: https://github.com/ev3dev/brickman.git -Vcs-Browser: https://github.com/ev3dev/brickman - -Package: brickman -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, systemd, connman, bluez (>= 5) -Suggests: openrobertalab -Description: ev3dev Brick Manager - Provides a user interface for LEGO MINDSTORMS EV3 running ev3dev. diff --git a/debian/copyright b/debian/copyright deleted file mode 100644 index c23d00e..0000000 --- a/debian/copyright +++ /dev/null @@ -1,24 +0,0 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: brickman -Source: - -Files: * -Copyright: 2014 David Lechner -License: GPL-2.0+ - -License: GPL-2.0+ - This package 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 2 of the License, or - (at your option) any later version. - . - This package 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 - . - On Debian systems, the complete text of the GNU General - Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". \ No newline at end of file diff --git a/debian/gbp.conf b/debian/gbp.conf deleted file mode 100644 index 1ccead1..0000000 --- a/debian/gbp.conf +++ /dev/null @@ -1,3 +0,0 @@ -[DEFAULT] -debian-branch=ev3dev-buster -debian-tag=ev3dev-buster/%(version)s diff --git a/debian/rules b/debian/rules deleted file mode 100755 index 52619ce..0000000 --- a/debian/rules +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - -%: - dh $@ --with systemd - -override_dh_installinit: - # don't do anything diff --git a/debian/source/format b/debian/source/format deleted file mode 100644 index 89ae9db..0000000 --- a/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (native) diff --git a/debian/source/options b/debian/source/options deleted file mode 100644 index d5e47f9..0000000 --- a/debian/source/options +++ /dev/null @@ -1,4 +0,0 @@ -tar-ignore=.* -tar-ignore=build* -tar-ignore=doc/sphinx/_build -tar-ignore=doc/sphinx/_html_extra diff --git a/doc/navigation.fodg b/doc/navigation.fodg deleted file mode 100644 index 3405284..0000000 --- a/doc/navigation.fodg +++ /dev/null @@ -1,1490 +0,0 @@ - - - - David Lechner2015-02-08T22:12:08.2392762832015-02-08T23:05:21.873921595David LechnerPT51M21S28LibreOffice/4.2.7.2$Linux_X86_64 LibreOffice_project/420m0$Build-2 - - - 35214 - 27276 - 79278 - 41466 - - - view1 - false - false - true - true - false - false - false - false - true - 1500 - false - //////////////////////////////////////////8= - //////////////////////////////////////////8= - - false - true - P1000,1000 - true - 0 - 0 - true - true - true - 4 - 0 - 0 - 1 - 15508 - -13450 - 121121 - 60488 - 1270 - 1270 - 127 - 127 - 127 - 1 - 127 - 1 - false - 1500 - false - - - - - true - $(user)/config/standard.sob - 0 - $(user)/config/standard.soc - $(user)/config/standard.sod - 1270 - false - - - en - US - - - - - - $(user)/config/standard.sog - $(user)/config/standard.soh - false - false - true - true - false - false - true - false - false - false - $(user)/config/standard.soe - false - 7 - 4 - false - 0 - low-resolution - psc_1310 - pgH+/3BzY18xMzEwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQ1VQUzpwc2NfMTMxMAAAAAAAAAAAAAAAAAAAAAAAAAAWAAMAzAAAAAAAAAAIAFZUAAAkbQAASm9iRGF0YSAxCnByaW50ZXI9cHNjXzEzMTAKb3JpZW50YXRpb249UG9ydHJhaXQKY29waWVzPTEKY29sbGF0ZT1mYWxzZQptYXJnaW5kYWp1c3RtZW50PTAsMCwwLDAKY29sb3JkZXB0aD0yNApwc2xldmVsPTAKcGRmZGV2aWNlPTEKY29sb3JkZXZpY2U9MApQUERDb250ZXhEYXRhCkR1cGxleDpOb25lAElucHV0U2xvdDpBdXRvAFBhZ2VTaXplOkxldHRlcgAAEgBDT01QQVRfRFVQTEVYX01PREUKAERVUExFWF9PRkY= - false - 1 - 1 - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - iVBORw0KGgoAAAANSUhEUgAAAWQAAAEACAIAAAALHJs7AAAHiElEQVR4nO3dPbbjNhaFUQc1 - O4c9mR5CT6ZDz8/BS+Qlk/WBBCFK2jvyqmKReD8+uAQp3F///+u/fwD8zq9XDwB4D8IC3sB/ - /vzfS677eOchLIBkMyx+kmxrReM5556PLMd0++N5vuJrx7N/rf1ZYnRUc78u7mzlT/b590pl - AST/Ehb7897WjPr45+WYrtytlXl+zXj6tUrtU0Yy6+viXYzWklvHj94fqCyA5F/CYit1urlz - 2v541s+i++MpI5k1WrXDNxv9/3S/mijnUVkAyXBYHKs7rp7/9++++h3adaMqd5Xnn86Ua/EZ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iyARFgAibAAEmEBJMIC - SIQFkAgLIBEWQCIsgERYAImwABJhASTCAkiEBZAICyARFkAiLIBEWACJsAASYQEkwgJIhAWQ - CAsgERZAIiyARFgAibAAEmEBJH8D0uUwwOm/xDsAAAAASUVORK5CYII= - - - - - - - - - - - - - - - - - iVBORw0KGgoAAAANSUhEUgAAAWQAAAEACAIAAAALHJs7AAAFmklEQVR4nO3dMZabSBRAUQe9 - O4fezCzBm3Ho/U0gB+1Dg1+JAiHp3rCNBX088/gCifr49fu/bwD/8vHoAwCeg1jAE/jx/edD - 9vv5nYdYAMlqLG4lW7uisezccsuyTbd9PMs9PvZ4tve1fZYYPaq5vxdXdua/7PK/K5MFkHwR - i+3z3toZ9fPPyzZdebdWzvPnHE/fV5l9ypHM+r14FqOz5Nr2o+8PTBZA8kUs1qrTzT2nbR/P - +WfR7eMpRzLraM0O72z0/9PtaaK8jskCSIZjcd/ccfT5f/vdV3+HdtxRlXeV++/OlH3xGs7/ - 5IXJAkjujEW/kn/ONYUz787cd1SvtC+uYP+1xVEmCyCZEIv95+2rnQn3HM/o3+2fTPV5Cj4b - neW3ty9MFkByZyz6tzCOvgdR7nSceTfkVffFdWz/+y7/dG370c8EmSyAZDUWo/Xqf3rf9vv3 - 2I/qnOM5f188u0c91eLGZAEkYgFP4Arzo1gAycdj3wUBz8JkASQfV3gvBFyfyQJIxAJIxAJI - xAJIxAJIxGKC0RXG+mpmZz619Og98uzEAkjEYppZ3zQ989mKnr5FJxZAIhanmnU94pynYy2f - kL62r7JqfJliypWUvi9rqcwlFkAiFtOUs/3+6xFHrwh/372b/rf2HP/ohGKamEssgEQspjnz - PDbrXkk5S5/ze/UnlZff3UxxBLEAErF4Sq965rzOpMOSWACJWJxquVZbWc/tuNXV9r/O6Ipw - a+val09YWIHtscQCSMRigjPXHxvd4zl7GX21vh7n6L5MGccRCyARCyARCyARCyARCyARCyAR - CyCxijqQmCyAxCrqQGKyABKxABKxAJJ/xGL7GQTA+zBZAIlYAIlYAMlq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AWQiAWQ/InF - j+8/H3scwMWZLIDkfwkdfEF9x2nBAAAAAElFTkSuQmCC - - - - - - - - - - - - iVBORw0KGgoAAAANSUhEUgAAAWQAAAEACAIAAAALHJs7AAAITUlEQVR4nO3dTZqjNhQF0Axq - dxlmM1lCNpNh9pdB9cD90VJfISEkOGfowiDn53KNbd7Xv//9/QfA73zdvQBgD8ICNvDXn//c - ctzPdx7CAogUw+I7yUpXNI45d9wy2SZXX8/xiPeup36s+lmidVVjXxcrm/lv9vjflWYBRH4R - FvXzXumM+vl4sk0uebeWnOfnrCc/VtJ9kpWMel3sorVLlrZvfX+gWQCRX4RFKXVyY89p9fXM - P4vW15OsZNRqdYc3a/3/tN4mkv1oFkCkOSzO9Y6rz//1d1/5O7TrVpW8q+z/dCY5Fs8w/5sX - mgUQORkW+ZX8OdcUZn46c25VTzoWK+i/tthKswAiA8Ki/7y92pmwZz2tz82/mer7FHxq7fL1 - 7ROaBRA5GRb5rzCu/gwi+aRj5qchTz0W66j/+z3+tbR963eCNAsgUgyL1vTK/3pu+/4j5qua - s575x2J3d93V4ptmAUSEBWxghf4oLIDI173vgoBdaBZA5GuF90LA+jQLICIsgIiwACLCAogI - CyAiLAZonTCWTzObedfSq4/I7oQFEBEWw4z6penMeyu6+xY5YQFEhMVUo65HzLk71vEO6aVj - JVPjkxaTXEnJj2WWyljCAogIi2GSs33/9YirJ8Kf++wmf1bP+lsbijYxlrAAIsJimJnnsVGf - lSRn6TmvK79TefLadYorCAsgIiy29NQz5zpNhyNhAUSExVTHWW3JPLfrpqv176d1Ilxprn3y - DQsT2O4lLICIsBhg5vyx1iPOOUrr3vJ5nK3H0jKuIyyAiLAAIsICiAgLICIsgIiwACLCAoiY - og5ENAsgYoo6ENEsgIiwACLCAoj8Jizq9yBYU899omeuYeZ6oJ9mAUSExSV0BJ5HWACRYlgk - d4j8dm7y5efjPcc6t+bSc49KUzNLczST+Zq+NcuONAsg0hwW9ckO+TTK+h2fR030PHcH7eM2 - +X2l69NMe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zSgDNAoi8 - OizGTi2DZ3t1WAA5YQFEhAUQERZARFgAEWEBRIQFEFlubsjKrviFiF+dsAvNAoiYGwJENAsg - stzckPwu4fmzSuup77O0h3zL4zalVwTr0yyAyNJzQ+qO+0yOVWpDpUd6ZpTAk2gWQOThYVGf - Y/KtvxHk9/v8XJUmwl4eHhbAKIPnhlwhaQclM8/ermXwbJoFEJk6N6S0zedf69+kKD2r9PjY - X7X0r03XYF+aBRCZOjekZ5tjQ2l9Vr6S1mdpCryBZgFEhMVUOgj7EhZARFgAEWEBRIQFEBEW - QERYABFhAUQ2nhtS/63KnKP3H9evRdiFZgFENp4bUv/FJzCWZgFEps4Nab0DeP9Vif45JvVt - Wvdz3N7VCnahWQCRqXNDksdLf209D/fMMfnsCD3bwJNoFkBk0bDY6yxtbghvsGhYAKvZYG7I - TGNnlDz1nxLvpFkAkdvmhvTPVa9/HnFujknrZJDjSkrHKq0TdqFZAJGb54bkMzjOTevon1GS - 7EdT4A00CyAiLKbSQdiXsAAiwgKICAsgIiyAiLAAIsICiAgLILLl3JAVfmGxwhpgJs0CiGw8 - NwSYSbMAIsPmhuTzPpLZIqUj5vvJj9V/53F4A80CiAwOi3Pn5NJ9rnq2SY419s5d8GyaBRAZ - HBY7npPzTqF38GaaBRAxN8Q1C4hoFkBk2NyQRD4TtH+b5Fj1aSO+sQqfNAsgMmxuyHWzRa47 - Vj6jBNAsgMhyYbHmWX3NVUGr+tTeuuXCAliTsIBX6G/HwgKICAsgIiyAyI+w6LlGCryBZgFE - /geJYU113PMM4wAAAABJRU5ErkJggg== - - - - - - - - - - - - - - - - - - - - - - - - - iVBORw0KGgoAAAANSUhEUgAAAWQAAAEACAIAAAALHJs7AAAF1UlEQVR4nO3dMXqjVhhA0RTe - XcpsJkvIZlJmfyncMB/D832AEJLOKWNGPGfGl18Iw9e///39B8BPvp69AOA1iAW8gL/+/Ocp - +12+8xALINmMxXfJts5orDu33rJs043Xs97jc9cz3tf4KDG7qnO/L+7syr/Z9b8r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hYUKAu5lngVQ - pKhvyNHzFLUG1NA3BChS1Dck2Q+wMpUFEBEWQERYABFhAUSEBRARFkBEWAARYQFEhAUQKe0b - st3PN3M64SlUFkCkqG8IcC/rWQBFivqGtLcEZtM3BChyQ98Q4F76hgATFfUN2a/iuf236gMq - GbMAJioKi/aTEWA28yyAIkV9Q+btDUjoGwIUKe0bkuwNWJPKAogICyAiLICIsAAiwgKICAsg - IiyAiLAAIsICiNwQFsn3QXxnBFajsgAiy4XFfgVw9QWMs54FUKR7PYtvySre7S4h+5zb70d9 - AVfRNwQo8kNYJFVDQj8RWIe+IcBEy4WFHqgwmzELYKIpYTFSHRyNjwAjzLMAivwQFkezJI5m - Q7Tf1d4emEffEKDIBX1Djrbp7TaizwisTGUBRIQFEBEWQERYABFhAUSEBRARFkBEWAARYQFE - Fuob0v4uCXAvlQUQWS4sxtf7BPasZwEUWahvCDCPviFAkeX6hrSrGGCcviHARMuFhachMJsx - C2Ci5fqGADOYZwEUWa5viKchMIO+IUCRB/QNAVagsgAiwgKICAsgIiyAiLAAIsICiAgLICIs - gIiwACIL9Q3ZvrplZiesQGUBRBYKi6vW+wT2rGcBFHlA3xA1BYzTNwQoslzfEGA2fUOAiYQF - fBxjFsBED+gbYowDxplnARRZqG9IcizgHH1DgCIL9Q3JjwXUU1kAEWEBRIQFEBEWQERYABFh - AUSEBRARFkBEWACRhfqG+FYIrExlAUSWCwurdcIM1rMAiizdN2T7XvUFjNA3BCiibwh8HH1D - gImEBXwcYxbAREv3DTG6AVcxzwIoslDfkG/j+Qfs6RsCFFmob4g6AlamsgAiwgKICAsgIiyA - iLAAIsICiAgLICIsgIiwACLCAogICyAiLICIsAAi/wOpDgsjdQsIggAAAABJRU5ErkJggg== - - - - - - - - - - - iVBORw0KGgoAAAANSUhEUgAAAWQAAAEACAIAAAALHJs7AAAIlElEQVR4nO3dQbrkJBgFUAe9 - O4duxiW4GYfuz0E5KL809CUhBMI5w/eohOqnF5KQnx9///PnbwC/8uPpDgBrEB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QFEhAUQERZARFgAEWEBRIQF/7EWkzphAUSEBRARFkBEWCys9JZHUhcr - qeL5/VlviyAsgIiwWFJSTTNxnDvk1Tc9PdmNsAAiwgKICAsgIixe4tw+Y5ATFkBEWCzpuEri - 3E+SY6rKyYewACLCYmFJDc7WOp15vU92IyyAiLAAIsICiAgLICIsgIiwACLCAogICyAiLICI - sAAiwgKICAsgIiyAiLCYQl4toldNbbW5aSUsgIiweNgOu3K86bvsTFgAEWExqfo+o/mOpN9t - kuPkM536uZhfqepqibAAIsLiYUnt7Os7kubHSbR+1lxjZvlfR1gAEWExhbWehthJZE/CAogI - i4fdN4PotbNp/tRjhzUjOxMWQERYPKz1+j/fkbTXzqbHn1hhsSdhAUSExRRax+R8R9JeO5uW - 1n0kzDjeQVgAEWEBRIQFEBEWQERYABFhsbB1386wpnNFwgKICIsleQuD8YQFEBEWD6jfa6i/ - l/H9BkevnlyvuPndPq8Pmld/ZAbCAogIi6GSkbz1PdTWSt/1o7X2OWlZ6pvZxFqEBRARFg/o - VcPqozRijx+3zRTeTVgAEWHxgGQEbt0frJdk1tN3ZsQqhAUQERZD9dpx477jnPtJq9ZdNpmB - sAAiwuIBvXYJ7TUaJ5U7+1blvPIpniIsgIiwACLCAogICyAiLICIsAAiwgKICAvYzrnVt8IC - iAgL2MiVVbPCAogICyAiLIDIvzLc22ZwkJebAAAAAElFTkSuQmCC - - - - - - - - - iVBORw0KGgoAAAANSUhEUgAAAWQAAAEACAIAAAALHJs7AAAHlUlEQVR4nO3dO5rkthmGUQez - O4fajJbgzTj0/hxMUnooUi94QZOsc8JqNgFWz3z4eQN+/fd/f/4L4J/8+ukOAM8gLOAB/vj3 - f36k3c8zD2EBJKth8TvJ1q5oLHNuuWXZptvuz7LFn+3Pdlvbo8Ror849Lu5s5l92+e9KZQEk - fxMW2+Pe2oj6+XnZpitna2Wcn9Of3lapfUpPzjounmK0llzbfvT8QGUBJH8TFmup0507pm33 - Z/4out2f0pOzeqt2+Gaj/0+3q4myH5U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2p38/577Ru/35HRw/P1BZAMmFM2Udnzt7bT/H+1PmjD5rfOijUJlZ - e3u1ke33VvsRnfWdH/ndtdk9jo+Q23sobd2zdti2b4b6TyoLIDkhLI6f347uZ00/lx5dU2Pf - 3FA9s0dnG1vb8/GZx/q8WGu9OndGsivmEyv9HG3rzlcrlvZVGSoLIJk0u/dZRsfqK9pdVigz - nbUC2L7tr5grdF9P7tPWs2qK31yzAC40aUWy+U9q9LU55t8zP2tO0+v0Y3/WiHquZ9UUnrMA - Jhl+N2SZpv3OQrnSfvw5i/vvZ98no448lVCO/W7fc1fuwY3u4dM9a43jvVJZAMnwimRHttlX - fexz1tOK1/Vn9JN9PTnS/5nXLPb9Fa74Tkpb96wdrqayAJKpYfGdeQzvoLIAEmEBJMICSIQF - kAgLIBEWQCIsgMS6Icmz3i+czxoc30BlASTWDeEEx2uKmfOJfCfzWQCTvHDdkL6+xuhM4vuy - +ax1QzprcLC0b0bvTyoLIHnhuiFre1tbN2Sth1eswbHmrPPzp6/B4b7bHNYNAS702nVDjs/u - fW5/ek+u2P9ai3Ps+6u5G3Id1yyAC7123ZCiXFW5rt2l73zW4BuO8Q48ZwFM8sJ1Q4rto1jr - +VlrcCw/OesJiyeuwTG/z9/JuiHAJC9cN+TIug/XrSFyxZogva3y059ag+NI68yksgAS64YA - icoCSIQFkAgLIBEWQCIsgERYAImwABJhASTCAkiEBZAICyARFkAiLIBEWACJsAASYQEkwgJI - hAWQCAsgERZAIiyARFgAibAAEmEBJMICSIQFkAgLIBEWQCIsgERYAImwABJhASTCAkiEBZAI - CyARFkAiLIBEWACJsAASYQEkwgJIhAWQCAsgERZAIiyARFgAibAAEmEBJMICSIQFkAgLIBEW - QCIsgERYAImwABJhASTCAkiEBZAICyARFkAiLIBEWACJsAASYQEkwgJIhAWQCAsgERZAIiyA - RFgAibAAEmEBJMICSIQFkAgLIBEWQCIsgERYAImwABJhASTCAkiEBZAICyARFkAiLIBEWACJ - sAASYQEkwgJIhAWQCAsgERZAIiyARFgAibAAEmEBJMICSIQFkAgLIBEWQCIsgERYAImwABJh - ASTCAkiEBZAICyARFkAiLIBEWACJsAASYQEkwgJIhAWQCAsgERZAIiyARFgAibAAEmEBJMIC - SIQFkAgLIBEWQCIsgERYAImwABJhASTCAkiEBZAICyD5P/Tsj/rFEGFdAAAAAElFTkSuQmCC - - - - - - - - - - - iVBORw0KGgoAAAANSUhEUgAAAWQAAAEACAIAAAALHJs7AAAIXUlEQVR4nO3dO5bcOBIF0Da0 - uzZnM7OE2cyYvb82yuE5FKCHD0GQvNfMYpLIkuoh+EnEr///89+/AP7k190DAJ5BWMAD/Ofv - /91y3OOZh7AAIsWw+Emy0hWNc86dt0y2ydXHcz7iveOpH6s+S7SOau7nYmcr/2XP/69UFkDk - N2FRn/dKM+rx9WSbXHK2lszza8aTHyupfZKRzPpcPEVrLVnavvX8QGUBRH4TFqXUyc2d0+rj - WT+L1seTjGTWaNUOX9b6d1qvJpL9qCyASHNY9NUdV8//9bOv/AztulElZ5Xjd2eSY/EO65+8 - UFkAkc6wyK/kr7mmsPLuTN+o3nQsdjB+bbGVygKITAiL8Xl7t5lwZDyt782fTPU8BUettXx9 - +4TKAoh0hkX+LYyr70EkdzpW3g1567HYR/3f9/zT0vatzwSpLIBIMSxa0yv/ad/240fMR7Vm - POuPxdPdtarFD5UFEBEW8AA71I/CAoj8uvcsCHgKlQUQ+bXDuRCwP5UFEBEWQERYABFhAUSE - BRARFp9evfK531idu2rpj6u72D2dsAAiwuKGtQx38OXVt9Z31XsHYQFEhEWk7/z2vOWsc+C8 - S/u5bvp5ZdbcmM/A9d/PeVY//rS0h77rTd+sC8YJCyAiLP5g/Py2dT8l+bl069qc+Uye7K20 - /6QWq18RSHqj9I251OP+a1ey6oQFEBEWkTUzTOtcfcVxzxXKSuNHbN1DXssct/8mYQFEhEUk - WV975ZyTrwm+/nmB5Peww/x8Re+4dxMWQERY/OGeRX5noX5+O6t72P776XulVf2JjLq8Y96X - vzd0JiyAiLCY1s2sr/roM+tpxevG0/pK30iufpdq4khYABFhMY1ZiHcTFkBEWAARYQFEhAUQ - ERZARBd1IKKyACK6qAMRlQUQERaRuzpTWUOBuVqvUR7/7wkLICIsGiSrS193RM5UXn36vkUt - LICIsOhUWuFyvFdYacuzNT3Qkl5hyXhKn13v8nvlq4EJCyAiLKaZ2yusvkplcq4+d13vUg3V - VyOU3ts6ZhXHiNaOcMICiAiLyXb7rs2s8aycw3f7HfJDWAARYdFp5Cy6fn4+111n9eM9QfKj - uHKxhrAAIsKiQf2O9KweX+dj5X3Sjj+dO5661p5j9a7lnrPYk7AAIsIickUPq/FeYbO26dvD - rJ5jI09PqDhWEhZARFgAEWEBRIQFEBEWQERYcCFPTLyJsAAiwoJLzF1Ngx0ICyAiLLYwvprm - rJUy5x4rOS5PISyAiLC42dzVNPtWypx1rGSf6ovnEhZARFjcLF/BIZmTk2+yznr2obWm4OmE - BRARFltIrhHMmp9XPvugpngTYQFEhMXNkqceZl1rWHksq2m+j7AAIsLiZlev2dl31WN8fdDW - LdmfsAAiwgKICAsgIiyAiLAAIsICiAgLICIsgIiwACLCAogICyAiLICIsAAiwmKaZLWI647r - +51cTVgAEWExme6es/i97UZYABFhcYPxTqLnPeQ9R8/vGu+Qen5vvbPZeQ/sT1gAEWExWV41 - nN+VdxLt6zlaH3Nrh9TSJy29N//sx72xD2EBRITFZNf1DbvOymPpov5cwgKICAuajVQHfXdq - 2IGwACLCYqkrOoAmT0mMqD9JUdo+2U99e3YjLICIsJhmfSfR696VPPWQdFEdeXpCxbEbYQFE - hAUQERZARFgAEWEBRITFC8169tEzlBwJCyAiLF5oVk0BR8ICiAiLV0nW0Uy+S1L/9gffJCyA - iLB4laQiaF3vE34ICyAiLD5HBUEfYQFEhAUQERZARFi8yvE+iHsczCUsgIiweJW+1T1bX+eb - hAUQERZARFgAEWEBRIQFEBEWQERYABFhAUSEBRARFkBEWAARYQFEhAUQERa3aV1vItneGhZc - R1gAEWFxg3NnsK/VAt/81E8nLICIsFjqPKOW6oukz2jeeSzpgXqUbHPeMtmG5xIWQERYbKd0 - Pp+s3H2e2+tXB+r7ya+qtF6DUGs8kbAAIsLiBsn1iFmSObw+nlJn9tKVl9aj8xTCAogIixvk - 9xrWSOb/+nWNfJv66+xMWAARYbGd0vl/6zYjx2p9esITFl8gLICIsFgq7yradx2hdQ+z9tNa - Qag4nkhYABFhAUSEBRARFkBEWAARYYHnKYkICyAiLICIsAAiwuIl8hU3S+86v37musaXCQsg - IixepbRK+Hjfs3tX3GAHwgKICItXmds5FY6EBRARFvyBqxX8EBZARFh8Tv1qRelJDfUFwgKI - CIuXyFf37Nub+yYICyAiLD5HjUAfYQFEhAUQERZARFgAEWEBRIQFEBEWQERYwEe1rtgqLICI - sIBPy5/oFRZARFg8QH3F7fHveliPk4SwACLC4jFKPcfupSr5DmEBRITFYxxrilJ9cX6lr7dY - sh++RlgAEWHxEskdk6SPaeudFxXHdwgLICIsHmbNTL7P3Rb2ISyAiLDgN3Rj50xYABFh8RKl - Jy+Oc37y9GeyH75JWAARYfEAeR/TZP6ftU3rljydsAAiwgKICAsgIiyAiLAAIsLicn1rTBy3 - mfuU5MrxJPs5c4dlT8ICiAiLC42vMTF3jl05nnw/az4744QFEBEWN9htztxtPOxJWAARYfES - yXdJ9+Qbrk8hLICIsHiJ587G9bsw7ENYABFhcYPdZtEdxqO+2J+wACLC4kIj62LmPUpbV7Va - M56+tTzVFzsTFkBEWFxufM3LuXPsyvH07UdNsSdhAUSEBRARFkBEWAARYQFEhAUQERZARFgA - EWEBRIQFEBEWQERYABFhAUSaw6K+ijSw0spv6KosgEhDWFi/CHbT91fZd36gsgAiDWGhpoDd - tP5VjvwVqyyAiLAAIsICiPwLKpTDJLPYWwYAAAAASUVORK5CYII= - - - - - - - - - iVBORw0KGgoAAAANSUhEUgAAAWQAAAEACAYAAACEfgxsAAAABmJLR0QA/wD/AP+gvaeTAAAA - CXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3wIYBBIHIUhl5gAAAB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kAEUZAAUZAAFGQAF - GUBBBkBBBlCQAVCQARRkABRkAAUZAAUZQEEGQEEGUJABUJABFGQAFGQABRkABRkABRlAQQZA - QQZQkAFQkAFW8S+m9znb2HIuPQAAAABJRU5ErkJggg== - - - - - - - - - - - - - - - - - - - iVBORw0KGgoAAAANSUhEUgAAAWQAAAEACAYAAACEfgxsAAAABmJLR0QA/wD/AP+gvaeTAAAA - CXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3wIYBA8odfU0owAAABl0RVh0Q29tbWVudABD - cmVhdGVkIHdpdGggR0lNUFeBDhcAAAe2SURBVHja7d1LcuM2FAVQKeXlZZi9aA3Zi4banzNy - VYptFP7kA3jOsPUjZeniEg2Kz/fn9f0A4HJ/eQsAYvjyFgBn++fvf4c+3/vzOuV1Rjtut4YM - sEpD/hlhUiNQbiSqHblyr9M6Epc+73G7Vtn+0u0pbQy9+3HW+0Osxlv7OR31Ocu9frTPXer7 - oSEDRG/IpU0qNzIdb6+9/+gRaNQIH2X7W7dn1pzbWe8PMRtx6d/3mAetap+n98gt9/jemQIN - GSB6Qx41grWORKNeJ7f9URtb6fbXbvfs/dR87yH1+aw9Em793Bznjmc369ZGXPv8GjJA9IZ8 - 1kgTpamWzv20zhVdtR+1c2OzVolo0PdoyqWrHVL/t9T6uq0NOxoNGWCXhpxrPqvM4UZbJTJq - P2wPVxyRzVqX3Dt3PPrIXkMG0JDbRs7RTXL1hjV6+3ufr/VMRuuMNePfmmbrOuTaVUWjPve9 - n/PW59eQAe7SkFt/A+Lq1Qq1qyairbKwPVxh1G9G5NYzH3OitxmXPq51/3rPC9CQAYJ4umII - EMXoM1P9HjIAGjLAyjRkgCgN+fF4aMgAGjIAP76sCwXQkAEQyAACGQCBDCCQASjwteqGz74i - Qen9R21vtN9Jjvr3HPU6R1Yb9f09/A62hgygIUcauWuvcpsz+1pbmkTMxufv0sf7piEDaMiR - Gs6oa2xF3+9cI0ndr/WqwKnba7en9IoQVx9R1F47rXd/W9+f2j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Ux3l+1Pnn0p7z517fpj7avvXKS3su0fP1 - Oi8PC2CWj4ZF0h8s6ehR/2veo+y4n/pM2DdntvZGq/dGOf7c+tiz1o4nI1QZIz4aFkArYXG5 - uVfjV7u2f914rtizmmKEsAAiHw2LOz+7XnGU1VbZvm48rXseuZJC3UfDAmj18rAozUulM/bn - v849+vEKwsgR69cm7p+HR76pUR/D+J5L46TVy8MCmOUTYTG3R0a9+0beQ2RWV47rjlh6puOv - wNy+J/kdGcm/hHXOBK3mE2EBjBMWvMrI+QjnMuqEBRARFkBEWAARYQFEhAUQERZARFgAEWEB - RIQFEBEWC/GthB/upFyTsAAiwmIJ1lk48mqsSVgAEWHxMLPo2RW90RknLICIsFjau/u/qx32 - IiyAiLBYVN7/He4hLICIsNhMqdYobXPuu9G3TXKs0jbHLc9/1T1sF8ICiAiLjeXnNcZ/kxwr - OZ+S9/hgNcICiAiLTxjpyXbke7FfJiyAiLDYzLOf851f+DJhAUSExaJKdyWcu4ff8/2RkfGU - RpXc2cE6hAUQERZLG7+KUfrruSJIHjvrqsrI9jxFWAARYQFEhAUQERYPs97kmVdjTcICiAiL - JdTvUPgaNcWahAUQERYLMaOyMmEBRIQFEBEWQERYABFhAUSEBRARFkBEWAARYQFEhAUQERZA - ZEJY+K4kfIHKAogMhYVvScJ3qCyAiLAAIsICiAgLICIsgIiwACLCAogICyAiLICIsAAiwgKI - CAsgIiyAiLAAIsICiAgLICIsgIiwACLCAoj8FwBppCc5wdEUAAAAAElFTkSuQmCC - - - - - - - - - - - - - iVBORw0KGgoAAAANSUhEUgAAAWQAAAEACAIAAAALHJs7AAAH2klEQVR4nO3dQWKjNhiG4S7m - dl32Mj1CL9Pl3K+LzMIpQfPKgIPheZa2AnIcf/pBivXj359//wHwOz++uwPAexAW8Ab++vOf - bznv45WHsACS1bD4SLK1OxrLnFu2LG26cX+WZ/ze/ozPNR4lZnu17+vizF75zi7/rlQWQPJF - WIzHvbUR9fHx0qYrV2tlnH9Nf/q5Su1TerLX6+JdzNaSa+1nrw9UFkDyRVispU6375g27s/r - R9Fxf0pP9uqt2uHOZj+n42qiHEdlASTTYfFc3XH0+D+++upXaMf1qlxVbp+dKefiGl6/8kJl - ASRPhkW/k/+aewqvnJ15rldXOhdnsP3e4iyVBZDsEBbbx+2zjYRb+jP7s31lqvUUPJqt5cft - C5UFkDwZFv2/MI6egygzHa+cDbnquTiP8fu7fHat/eyaIJUFkKyGxWx69Wefa7/9jL1Xr+nP - 68/Fu/uub7X4oLIAEmEBb+AM9aOwAJIf33sVBLwLlQWQ/DjDtRBwfioLIBEWQCIsgERYAImw - ABJhcQv9GzGe20vNnNodCAsgERb8sn0vNfXFtQkLIBEW/IZ6gQ/CAkiEBb88t7P2WhuuR1gA - ibDgE7MhrBEWQCIs+EV1wJiwABJhcQv77ttmNuSehAWQCIsbsfsZWwgLIBEWQCIsgERYAImw - ABJhASTCAkjsog4kKgsgsYs6kKgsgERYAImwABJhASTCAkiEBZAICyD5FBZWcwKPHtdhqSyA - RFgAibAAEmEBJMICSIQFXFzZU64QFkAyERY9n57bHdMqD9jL4+dr/OnrnzuVBZCksBjvr/34 - +FrLcjRgXx+fsrUqfvZb8lQWQLJbWDym1NoVUWkDbPFYua/VDss25TOosgCS3cKipNRskgHn - obIAEmEBJMICSIQFXMryzuB4nYUVnMDOUliM8wk4p/Ha61kqCyCZCItSR+zVBthibeX08tlO - ZQEkwgIubq9aXlgAibAAEmEBJMICSIQFkHwKi+fWdQF3oLIAEmEBJMICSD6Fhf/aAB493sdU - WQDJF2FhTgRYXmeoLIBEWACJsAASYQEX5zs4gZea+HbvpeVO6LM7FMx+O+B47/W95nHGO1C/ - 5vhn6APvq38HZ/8bUFkAyURYjKuGtUfGx1m2n61WyuPdecbbo/sw3rGKa1h7Z2f3IvugsgCS - bw6Lfce342qKftdmrc3y2bXrxtmrzXKctaOpL66nv5uz777KAkg27Uj2XSPVvjs4jpV9Xrff - qVm2nK1TttzrgUJlASTTsyF9FD362zGMnGO+nYR9qSyA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W4dFkAnLL4wvkdQrqvH1+3Lc80ev59rrXo6ztpv77nfRj/j - 8sjj175WUZZ7WPe8tyIsgERYTOsj5yuN50pe3+d3nA25W6UwS1gAya3DYss4NjsqHr1KoryK - 14zk97yev4NbhwXQ3S4sZtdQlP96WB5tbcZ+PFe/1qtxf8r9iL1WWJRzvX42ZK/+dOMVGVd1 - u7AAnnOjsOjZP2655TjjuYAtZ9yrz4X+bPmp93WjsAC2EBa8sbuN7d9LWACJsAASYQEkwgJI - hAWQCAsgERZAIiyARFgAibAAEmEBJMICSIQFkAgLIBEWQCIsgERYAImwABJhAST/AeIQFbTf - HQ8kAAAAAElFTkSuQmCC - - - - - - - - - iVBORw0KGgoAAAANSUhEUgAAAWQAAAEACAIAAAALHJs7AAAHiklEQVR4nO3dPXLkuhmGUQez - O4fejJfgzTj0/hwoaRUFzMPfJlvnRLcoXAJdI738SKCJP//937//AfA3f949AOAZhAU8wL/+ - +Z+39Pt65yEsgGQYFl9JNnqiscy5ZcvSppuPZ9nje8cz72t+lVg7qmM/F3d25b/s8vdKZQEk - P4TF/Lo3uqK+Hi9tunK3Vq7z14yn91VqnzKSoz4XT7G2lhy1X3t/oLIAkh/CYpQ63bHXtPl4 - rr+KzsdTRnLUaNUOv9nav9N5NVHOo7IAktVhsa3uOPv6P7/76ndo542q3FXun50pffEZrl95 - obIAko1h0Z/kX/NM4crZmW2j+qS+uIP9zxbXUlkAyQFhsf+6fbcr4Z7xrP1/+8pU6yl4tbaW - n7cvVBZAsjEs+rcwzp6DKDMdV86GfGpf3Mf833f501H7tWuCVBZAMgyLtenVf7qt/f4e+6iu - Gc/1ffF073qrxReVBZAIC3iAO9SPwgJI/rz3Lgh4CpUFkPy5w70QcH8qCyARFkAiLIBEWACJ - sAASYfE2/f3g179f88o3ZXhbx1MICyARFm/W9y6z1pb3EhZAIiwer9/zr93bffSsZO0emWf3 - xTWEBZAIize75spZqo+y80g5flRfX8yS3IewABJh8WZXXjnNp7CHsAASYfGB+tpQ6IQ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WEBJMLiMZa7kHwp7yhfnqG0XNq2i8q2 - 3Vi4G2EBJMLiwcouLf1dZ/N3fO3fRWVUGfEUwgJIhMXj3e19n/PxrH2rK/chLIBEWDzG6G6/ - vyX0Pis1rtwLjqMICyARFrc2X/tw7P3/63mW1/ltu6gsx2OFxXMJCyARFje1dne1/S3P20Vl - 7Rm4J2EBJMICSIQFkAgLIBEWQPItLO72LQPgvV5nr1QWQPItLMyBAyMqCyARFkAiLIBEWACJ - sACSYVhYcwG/02hWVGUBJD+Ehbchwm82SgCVBZD88N0QNQX8ZqN3wassgERYAImwABJhASTC - AkiEBTzetvXWa+c9hQWQrAiLo/bUvJ71I/wG/Td8WyWisgCSFBajK7MrNvweKgsg2RUWo1pj - 1Ob1p6P156O7qWWbeaWzPM+y9z7m5TnVU/w2KgsgOSws+nONZU0xalPOP7K2Epkf93QGVBZA - IizSnLOaAoQFkOwKi/vcye95F/kdxg/3p7IAkhQWo5ULozmOUZty/Mvavka9z9uvHTP8ZioL - IFkRFuV6O2/Tq4xtfR3V+9qRwB2cvYugygJIbhcWruSw1jV/NbcLC+CehAWQCAsgERZAIiyA - 5FtYjN4uAfweowRQWQDJD2Ex/54F8NlGdxUqCyAZhoVnFsArlQWQCAsgERZAIiyARFgAibAA - EmEBJMICSIQFkAgLIBEWQCIsgERYAImwABJhASTCAkiEBZAICyARFkAiLIBEWACJsAASYQEk - wgJIhAWQCAsgERZAIiyARFgAibAAEmEBJMICSIQFkAgLIBEWQCIsgERYAImwABJhASTCAkiE - BZAICyARFkAiLIBEWACJsAASYQEk/wePQY9ltV4F+QAAAABJRU5ErkJggg== - - - - - - - - - - - iVBORw0KGgoAAAANSUhEUgAAAWQAAAEACAIAAAALHJs7AAAHuUlEQVR4nO3dQZarRABAUQd/ - dw7djEtwMw7dn4Oe5JwIPlJAKLh35EnzQ6UTHxVCp379/c+fvwH8n1/fHgAwB7GACfzx+19f - 2e/rOw+xAJLFWPyUbOmMxnvn3rcs23Tr43nf43fHs76v9aP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r0JW7md9y/efXt/0sQDOcatY9PMa47eUfZV30a5i+EyfP77/q6VV - Ttf/e+l+lmaIn43nym4VC+A4D41Fabm/vLyyMne72rNztfFs9dBYAFtNH4vvvuub5d3mXa3P - L858dspMZ/ZXy/SxAM4xTSzKOeeyzRXGszSqcmUH796P6ltfCeu3j7+iznxlHmeaWADfNVks - xj/FKMeWfvzZ61OVke2fZq9nZ99neWSPs5gsFsC3iAWQiAWQpFhs/a4+Zrd+5YJXwj34dm/g - EBtisX7VAHdSzup7JczOimTAITbHwjtVfnglPI2ZBZCIBZCIBZCIBZCIBZCIBZCIBZCIBZCI - BZCIBZCIBZCIBZCIBZD8C6bRRBYudbCHAAAAAElFTkSuQmCC - - - - - - - - - - - iVBORw0KGgoAAAANSUhEUgAAAWQAAAEACAIAAAALHJs7AAAGQ0lEQVR4nO3dMXqjVhhA0RTe - XcpsJkvIZlJmfyncaD6G5ws8EJLOKT1E4Bnn8gtk3te///39B8BPvp59AMBrEAt4AX/9+c9T - 9vv4zkMsgGQ1Ft8lW7uisezccsuyTTc+nuUen3s8432NzxJbj2ru98WdXfkvu/y5MlkAyW9i - MT7vrZ1RH79etunKu7Vynr/mePq+yuxTjmTW98Wr2DpLrm2/9f2ByQJIfhOLtep0c89p4+O5 - /iw6Pp5yJLOO1uzwybb+fzqeJsrrmCyAZHMs9s0dZ5//x++++ju0846qvKs8fnem7Iv3cP0n - L0wWQLIzFv1K/jXXFK68O7PvqN5pX9zB8WuLW5ksgGRCLI6ft+92JjxyPFv/2/7JVJ+n4NHW - WX68fWGyAJKdsei/hXH2PYhyp+PKuyHvui/uY/zvu/zTte23fibIZAEkq7HYWq/+p/u2P77H - flTXHM/1++LVPeupFt9MFkAiFvAC7jA/igWQfD33XRDwKkwWQPJ1h/dCwP2ZLIBELIBELIBE - LIBELIBELJ5m7rpkj695nydfeOLGOxELIBGLp/mEp2a+33f0ycQCSMTiBWxdk33tOWZb17Zc - e4XlE7rGr1Oevd6PZ21LziYWQCIWt1bub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aEL36c25xXH/mvy/GERZARFg0yatOXb3e - 93sQeaWslloVeU9mvi9GExZARFg0af+2Rd8r8HJ/Zl7zz3xfzCEsgIiwGOjeeDh6/H+qepVn - GbsTFkBEWAyXV7iaM/bOfDrT/rusQ1gAEWExVfu4vdoofW/VRsuRPEVYABFhMVz+LYzRO2jM - 3Mtj5vtiDmEBRIRFBy3VKEfUoZxZHTOvD9reovnIs4QFEBEWQERYABFhAUSEBRARFkBEWAAR - YQFEhAUQERZARFgAEWGxgRHVq2rbAmEBRITFNs6VMldgJvIewgKICIttnKtvn+cXVzOO48if - HHM+p7kDwgKICIsvUX5iUj6m9pxHZhzvISyAiLDYTMtInlfudp+CM2EBRITF18qfepznEeV9 - T8u/y7cSFkBEWHyJ8/2I8yu1Kyzy+QVvICyAiLDYQL7rV/mVe7t+WWfBh7AAIsICiAgLICIs - gIiwACLC4lL5OxTlWlVJPava5wj609If2gkLICIsfpBX0763ckF/nuoPLYQFEBEWP6itJVX+ - 3fZraf2ptU71828iLICIsIjkV+PHI8fVy9afpCfmF30JCyAiLH6x2h11/Vm/J99KWAARYXGp - PFKNqE/Z0qL+mFOMJiyAiLD4Qblu5fFOfnmNQL5Ph/609KfXeSgTFkBEWPwgH5H6fveh/Wr8 - nf2pPQ/3CAsgIiyAiLAAIsICiAgLICIsgIiwACLCAogICyAiLICIsAAiwgKICAsgIiyAiLAA - IsICiAgLICIstlTea+tYk7K8t3h+nvIxvIGwACLCYmPJqJ7szZH/1K5fbyYsgIiwACLCAogI - i40le3CVn4zk5wFhAUSExcZq9/K6WjFhHkFCWAARYQFEhAUQERYbq70HcXXnwr0MEsICiAiL - LSVjfnl+kZ+ntl2+lbAAIr+ERbmWAbCacbM/Mwsg8ktYuEYFPswsgIiwgJc6r7spX0kICyAi - LODV8vuSwgKICAsgIiyAiLAAIsICiAiLbkbsCTpzBzA1vikTFkBEWHSz756ga/Z2zV69mbAA - IsJiquNoebUmv1wjs3zk1ewmOUP5OwJJnc57x5g77EJYABFh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Ue6/xRw3vv - /4/9dOYnY415xAJIHheLbetWzHi/oJ/P/n2eM4KYsSbI9Z/UPMfjYgFs89BYbPsU4/UKuf8o - ZcttV91571nMXhOk/LxGIud7aCyAtcQCSMQCSMQCSMQCSMQCSMQCSMQCSMQCSMRio6XfE3nC - G4QzZqMov++7dp5UjiUWQCIWu9z3yjZj3RA+m1gAiVhM19cEef2u8cog29Yo2eOoeT3G83r3 - bTiTWACJWOxy1KjhqK/3JxHXf6rS3eU50d2JBZCIxS5nXs0+aW2Rpf9+fUKxtA3nEwsgEYvb - OPaKOvsqvbT/8uRl21Mbn5jMJhZAIhYTrV1HY2mt8Blri1xBeR4x3qb8LXEUsQASsdjoqDVB - XreZsUrI/u3Xfu/sbawbcj6xABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKx - ABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKx - ABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKx - ABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKx - ABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKx - ABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKxABKx - ABKxABKxABKxABKxAJJ/Ac/opHc2OgwOAAAAAElFTkSuQmCC - - - - - - - - - iVBORw0KGgoAAAANSUhEUgAAAWQAAAEACAIAAAALHJs7AAAJvUlEQVR4nO3dO5bruBUFUAc1 - O4eejIfgyTj0/BxUol58QB/8KIDcO6ol4YFQVffB5UfAz3//9+9/APydn28PADiDsIAD/Ouf - //nKcT/PPIQFECmGxW+Sla5oXHPu2jJpk6uP53rE746nfqz6LNE6qrmfi53d+Ze9/nelsgAi - fwiL+rxXmlE/X0/a5JKztWSev2c8+bGS2icZyazPxSlaa8lS+9bzA5UFEPlDWJRSJzd3TquP - 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QFEhAUQERZARFgAEWEBRIQFEBEW - QERYABFhAUSEBUvYbfR5hAUQERYPVN+dHPoICyAiLB6uVFPUq4/rz59m7b3KWYQFEBEWj5XU - FPnVjbwGUXc8lbAAIsLi4eqz/VXf/F9fyVVN8QzCAogIi8eqX4mYO9urHd5AWAARYfE616cn - RuqCpDd3Q55BWAARYfFA9ack8ldm9aameAZhAUSEBRARFkBEWAARYQFEhAUQERZARFjwQJ4Z - XUFYABFhMUHr9yySNSbq/cz6Zke+2sVZs/RZoz2FsAAiwmKCfIeOfEWpvlW55xqvWUq9lT5F - /eitK5KX+ld39BEWQERYTJDPWqWdOFr7GVevcT7btI6kPqvX5/+RqqFezakmxgkLICIsJph1 - BWFWP/WVu6/v5jN80v/ICPv+larhHsICiAiLB0qum/zqq19GrsskPcz9V8wiLICIsJigdBej - dd5O+pm7NnfrSHL1Zxxa+x/51Pf8xt5AWAARYTFBvi72rNdnzY2tI8nVZ/J1r7S2JCcsgIiw - YAkz+fMICyAiLICIsAAiwgKICAsgIiyAiLAAIsICiAgLICIsgIiwACLCAogICyAiLA6TrHDd - 16Zvx9O+ncTqr7MnYQFEhMWR8nUr8zaleT7ZJexT8nrfviF8l7AAIsLiSMla1butZ13atfSX - 6xf7ExZARFgcadY1i30qFDXF/oQFEBEWrzbrjglvICyAiLA40qxnK0eUnpjoO4qaZX/CAogI - i8OseHYzb9O3h+hnm+Rn9iQsgIiwACLCAogICyAiLICIsAAiwgKICAsgIiyAiLB4uOt3Lkqv - /Ko/SVlvudvaXMwlLICIsHi1pO5IWub9cC5hAUSEBRARFkBEWAARYQFEhMWLuEPBCGEBRITF - w9V3PL+u0F16VqLesv4uzyAsgIiweIX6PF96t3Utb9XEswkLICIsgIiwACL/By52JseCUm+1 - AAAAAElFTkSuQmCC - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - LEGEND: - - - - - ENTER - - - - BACK - - - - - - - - - - - - - - - - - - - - - - iVBORw0KGgoAAAANSUhEUgAAAWQAAAEACAYAAACEfgxsAAAK2UlEQVR4nO3dS5LjuBUFUA9q - eR56L16D9+Kh92c7uisjqpmNxocAeEGdM6sUSUGU6vIRgoAf//7PP//7NwAe9+PpBgDwO4EM - bPePv/9r6vH+f6e/5Xlmu7ZbIAOEqAby1xWmdAW6bnfVe+WqPU+v1vZft6+1J639re1prRju - vo5d54cMo5/TWZ+z2vOnfe5K/z9UyAAhioHcWknVrkzXx3u3H9Xbd9R7hU9p/2h7VvW57To/ - PKv0Pra+v9c8GNV7nLt3brX97/YUqJABQhQDedYVrHTc1Vrbn1qxtba/t92rX2faeWSN0uez - 9074ul+ra99xr7v51loR9x5fhQwQ4nYgz6qkn65UW/t+RvuKdhmtPFad/9nfqpPl+v+hdbRD - 6bul0ecdrbDTqJABQkwL5NFv7Z+ujL+kjRIZNfqt9ypp7WGu0T7k2v617XePzthFhQwQYlkg - r6okT6+wZrf/7vFGf8mYeofAHqU7x9FxyL2jimZ97muP373z76VCBggxLZBH54B4erRC76iJ - tFEW2sMTZs0ZURvP/KW3Aq893+h2rZX/aHtUyAAhqoF894oyut2s/Ve1a/UVunf7t7SHM836 - f10bRbGqzziFChkghEAGYsy+szrtTk0gA4T4cUrfCsDbqZABQvw4rY8F4K1UyAAhBDJACIEM - EEIgA4QQyAAhBDJL3J03edW80TXmeeZJAhkghEAm0qpKdNeseDBCIAOEEMhE6V2FeLW09vBu - AhkghEBmi9HViGvHqymtzVbbrrc9MINABgghkDmS0RK8kUAGCCGQWerad6wvFsoEMkAIgcxS - 1z7bWqV8/fvTc0iktYd3E8gAIQQyS7SON+7db5RRGZxAIAOEEMgAIQQyQAiBDBBCIAOEEMgA - IQQyQIgf5hYAyKBCBgjxwy+RADKokAFCCGSAEAIZIIRABgghkAFCCGSAEAIZIMS3QPbLPYA9 - rr8DUSEDhBDIACEEMkAIgQxQMGuun9bv5gQyQIjmQK5dKYzO+Gtf5895gvOM/r/trbBVyAAh - ugO5dKVQAQJv11rxjuagChkgxPJALl1RrleQWoVdenz0+Nf9as9bO35te4AaFTJAiO5AXl3x - rn68ta+79/it2wOUqJABQkwbZfGU3sqzt/0qW2AXFTJAiOMDeXXFnnZHALzX8YEM8BbLArk0 - 3vf6eGn72uiF3uP3utt+4H1W3zGrkAFCNAfy6JWhd79S5Xn3+E+1HzjfrjtfFTJACIEMULD7 - jlcgA4QQyAAhBDJAiG+BbBwtwDNUyAAhBDJACIEMEEIgA4QQyAAhpq0YUhudkTYb2qr2WFMP - GKVCBgjRPdtbbX7gT60EnR/gLhUyQIhpgXyt/Ep9qde/t+533b62osis9swyurLJrvMDPE+F - DBCiOZBLldb18dK/7/ax1ircWsXX255eveen9/lnnx992pBHhQwQojuQ00YRpFV4zg8wSoUM - EGLaOORVTlnF2fkB7lIhA4RYNsqidf+vv9cen10Jzh6fOzoKpXVc8e7zA+ynQgYIMW2Uxaz9 - S4/Xxjmvas/q483avvf8GH0BeVTIACEEMkAIgQwQQiADhBDIACEEMkAIgQwQQiADhBDIACEE - MkAIgQwQQiDzm7trHs5+vjSntZczCWSAEAKZP1AJwnMEMkAIgcwtrSuklLarrYDS26fd2567 - K8e0trPEnQi/EsgAIQQyf3C3Qi09XqtQa2a3Z7Qds9oDf0YgA4QQyPyp1tWsT1/tenZlfD3u - 6CrtfCaBDBBCIHPLp1V6rX3s1+2v9DHzZwQyQAiBzF+qjdMd7SOtHbdUiZYqy919trX2GH/M - CIEMEEIg85vRvtC7lV7v8462c3S72varzgufSSADhBDIACEEMkAIgQwQQiADhPgWyKfPTQBw - iutoHBUyQIhvgWz8JMAzVMgAIQQyQAiBDBBCIAOEEMgAIaqBbFwywBy1UWwqZIAQxUC25hfA - XLVcVSEDhCjOZaEyBuhTW9OxthajChkgxPZArlXguyv03e057Q7ktPbCr3atQj6LChkgxO1A - Hq2grvs9Pd5ZJQjvsevOd3ZuqZABQnQH8qwrT+nbxusVJ63P+fq8V9d2lLa7/r327et1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AIZIIRABgghkAFCCGSAEAIZIIRABgghkAFCCGSAEAIZIIRABgghkAFCCGSA - EAIZIIRABgghkAFCCGSAEAIZIIRABgghkAFCCGSAEAIZIIRABgghkAFCCGSAEAIZIMT/ALGZ - eDMJ1imSAAAAAElFTkSuQmCC - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docker/armel.dockerfile b/docker/armel.dockerfile deleted file mode 100644 index 22625f3..0000000 --- a/docker/armel.dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM ev3dev/debian-buster-armel-cross - -RUN sudo apt-get update && \ - DEBIAN_FRONTEND=noninteractive sudo apt-get install --yes --no-install-recommends \ - cmake \ - libev3devkit-dev \ - libgirepository1.0-dev \ - libgudev-1.0-dev \ - netpbm \ - valac diff --git a/docker/armhf.dockerfile b/docker/armhf.dockerfile deleted file mode 100644 index 3421486..0000000 --- a/docker/armhf.dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM ev3dev/debian-buster-armhf-cross - -RUN sudo apt-get update && \ - DEBIAN_FRONTEND=noninteractive sudo apt-get install --yes --no-install-recommends \ - cmake \ - libev3devkit-dev \ - libgirepository1.0-dev \ - libgudev-1.0-dev \ - netpbm \ - valac diff --git a/docker/setup.sh b/docker/setup.sh deleted file mode 100755 index e66ba56..0000000 --- a/docker/setup.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh - -set -e - -script_dir=$(dirname $(readlink -f "$0")) - -case $1 in - armel|armhf) - arch=$1 - ;; - *) - echo "Error: Must specify 'armel' or 'armhf'" - exit 1 - ;; -esac - -if ! which docker >/dev/null; then - echo "Error: Docker is not installed" - exit 1 -fi - -build_dir="build-$arch" -image_name="brickman-$arch" -container_name="brickman_$arch" - -mkdir -p $build_dir - -docker build \ - --tag $image_name \ - --no-cache \ - --file "$script_dir/$arch.dockerfile" \ - "$script_dir/" - -docker rm --force $container_name >/dev/null 2>&1 || true -docker run \ - --volume "$(readlink -f $build_dir):/build" \ - --volume "$(pwd):/src" \ - --workdir /build \ - --user $(id -u):$(id -g) \ - --name $container_name \ - --env "TERM=$TERM" \ - --env "DESTDIR=/build/dist" \ - --tty \ - --detach \ - $image_name tail - -docker exec --tty $container_name cmake /src -DCMAKE_BUILD_TYPE=Debug - -echo "Done. You can now compile by running 'docker exec --tty $container_name make'" diff --git a/lib/bluez5/Adapter.vala b/lib/bluez5/Adapter.vala deleted file mode 100644 index c17721f..0000000 --- a/lib/bluez5/Adapter.vala +++ /dev/null @@ -1,173 +0,0 @@ -/* - * bluez5 -- DBus bindings for BlueZ 5 - * - * Copyright (C) 2014-2015 David Lechner - * - * 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 throws IOError; 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 . - */ - -/* - * Adapter.vala: - */ - -namespace Bluez5 { - public class Adapter : Object { - static HashTable adapter_map; - - static construct { - adapter_map = new HashTable (str_hash, str_equal); - } - - org.bluez.Adapter1 dbus_proxy; - - public string address { owned get { return dbus_proxy.address; } } - - public string name { owned get { return dbus_proxy.name; } } - - public string alias { - owned get { return dbus_proxy.alias; } - set { dbus_proxy.alias = value; } - } - - public uint32 class { get { return dbus_proxy.class; } } - - public bool powered { - get { return dbus_proxy.powered; } - set { dbus_proxy.powered = value; } - } - - public bool discoverable { - get { return dbus_proxy.discoverable; } - set { dbus_proxy.discoverable = value; } - } - - public bool pairable { - get { return dbus_proxy.pairable; } - set { dbus_proxy.pairable = value; } - } - - public uint32 pairable_timeout { - get { return dbus_proxy.pairable_timeout; } - set { dbus_proxy.pairable_timeout = value; } - } - - public uint32 discoverable_timeout { - get { return dbus_proxy.discoverable_timeout; } - set { dbus_proxy.discoverable_timeout = value; } - } - - public bool discovering { get { return dbus_proxy.discovering; } } - - public string[] uuids { owned get { return dbus_proxy.uuids; } } - - public string modalias { owned get { return dbus_proxy.modalias; } } - - internal Adapter (DBusProxy proxy) { - dbus_proxy = (org.bluez.Adapter1)proxy; - adapter_map[proxy.g_object_path] = this; - proxy.g_properties_changed.connect ((changed, invalidated) => { - var iter = changed.iterator (); - string? name = null; - Variant? value = null; - while (iter.next ("{sv}", &name, &value)) { - switch (name) { - case "Address": - notify_property ("address"); - break; - case "Name": - notify_property ("name"); - break; - case "Alias": - notify_property ("alias"); - break; - case "Class": - notify_property ("class"); - break; - case "Powered": - notify_property ("powered"); - break; - case "Discoverable": - notify_property ("discoverable"); - break; - case "Pairable": - notify_property ("pairable"); - break; - case "PairableTimeout": - notify_property ("pairable-timeout"); - break; - case "DiscoverableTimeout": - notify_property ("discoverable-timeout"); - break; - case "Discovering": - notify_property ("discovering"); - break; - case "UUIDs": - notify_property ("uuids"); - break; - case "Modalias": - notify_property ("modalias"); - break; - default: - critical ("Unknown d-bus property: %s", name); - break; - } - } - }); - } - - ~Adapter () { - adapter_map.remove (((DBusProxy)dbus_proxy).g_object_path); - } - - internal static Adapter get_for_object_path (string path) { - return adapter_map[path]; - } - - public async void start_discovery () throws DBusError, IOError { - yield dbus_proxy.start_discovery (); - } - - public async void stop_discovery () throws DBusError, IOError { - yield dbus_proxy.stop_discovery (); - } - - public async void remove_device (Device device) throws DBusError, IOError { - var path = new ObjectPath (device.object_path); - yield dbus_proxy.remove_device (path); - } - } -} - -namespace org.bluez { - [DBus (name = "org.bluez.Adapter1")] - public interface Adapter1 : Object { - public abstract async void start_discovery () throws DBusError, IOError; - public abstract async void stop_discovery () throws DBusError, IOError; - public abstract async void remove_device (ObjectPath device) throws DBusError, IOError; - - public abstract string address { owned get; } - public abstract string name { owned get; } - public abstract string alias { owned get; set; } - public abstract uint32 class { get; } - public abstract bool powered { get; set; } - public abstract bool discoverable { get; set; } - public abstract bool pairable { get; set; } - public abstract uint32 pairable_timeout { get; set; } - public abstract uint32 discoverable_timeout { get; set; } - public abstract bool discovering { get; } - [DBus (name = "UUIDs")] - public abstract string[] uuids { owned get; } - public abstract string modalias { owned get; } - } -} diff --git a/lib/bluez5/AgentManager.vala b/lib/bluez5/AgentManager.vala deleted file mode 100644 index 18e2566..0000000 --- a/lib/bluez5/AgentManager.vala +++ /dev/null @@ -1,70 +0,0 @@ -/* - * bluez5 -- DBus bindings for BlueZ 5 - * - * Copyright (C) 2014 David Lechner - * - * 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 throws IOError; 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 . - */ - -/* - * AgentManager.vala: - */ - -namespace Bluez5 { - public class AgentManager : Object { - org.bluez.AgentManager1 dbus_proxy; - - internal AgentManager (DBusProxy proxy) { - dbus_proxy = (org.bluez.AgentManager1)proxy; - } - - public async void register_agent (ObjectPath path, AgentManagerCapability capability) throws DBusError, IOError, BlueZError - { - yield dbus_proxy.register_agent (path, capability); - } - - public async void unregister_agent (ObjectPath path) throws DBusError, IOError, BlueZError - { - yield dbus_proxy.unregister_agent (path); - } - - public async void request_default_agent (ObjectPath path) throws DBusError, IOError, BlueZError - { - yield dbus_proxy.request_default_agent (path); - } - } - - [DBus (use_string_marshalling = true)] - public enum AgentManagerCapability { - [DBus (value = "DisplayOnly")] - DISPLAY_ONLY, - [DBus (value = "DisplayYesNo")] - DISPLAY_YES_NO, - [DBus (value = "KeyboardOnly")] - KEYBOARD_ONLY, - [DBus (value = "NoInputNoOutput")] - NO_INPUT_NO_OUTPUT, - [DBus (value = "KeyboardDisplay")] - KEYBOARD_DISPLAY - } -} - -namespace org.bluez { - [DBus (name = "org.bluez.AgentManager1")] - public interface AgentManager1 : Object { - public abstract async void register_agent (ObjectPath agent, Bluez5.AgentManagerCapability capability) throws DBusError, IOError, Bluez5.BlueZError; - public abstract async void unregister_agent (ObjectPath agent) throws DBusError, IOError, Bluez5.BlueZError; - public abstract async void request_default_agent (ObjectPath agent) throws DBusError, IOError, Bluez5.BlueZError; - } -} diff --git a/lib/bluez5/Device.vala b/lib/bluez5/Device.vala deleted file mode 100644 index 98ec73b..0000000 --- a/lib/bluez5/Device.vala +++ /dev/null @@ -1,208 +0,0 @@ -/* - * bluez5 -- DBus bindings for BlueZ 5 - * - * Copyright (C) 2014-2015 David Lechner - * - * 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 throws IOError; 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 . - */ - -/* - * Device.vala: - */ - -namespace Bluez5 { - public class Device : Object { - static HashTable device_map; - - static construct { - device_map = new HashTable (str_hash, str_equal); - } - - internal org.bluez.Device1 dbus_proxy; - - public ObjectPath object_path { - owned get { - return new ObjectPath (((DBusProxy)dbus_proxy).g_object_path); - } - } - - public string address { owned get { return dbus_proxy.address; } } - - public string name { owned get { return dbus_proxy.name; } } - - public string icon { owned get { return dbus_proxy.icon; } } - - public uint32 class { get { return dbus_proxy.class; } } - - public uint16 appearance { get { return dbus_proxy.appearance; } } - - public string[] uuids { owned get { return dbus_proxy.uuids; } } - - public bool paired { get { return dbus_proxy.paired; } } - - public bool connected { get { return dbus_proxy.connected; } } - - public bool trusted { - get { return dbus_proxy.trusted; } - set { dbus_proxy.trusted = value; } - } - - public bool blocked { - get { return dbus_proxy.blocked; } - set { dbus_proxy.blocked = value; } - } - - public string alias { - owned get { return dbus_proxy.alias; } - set { dbus_proxy.alias = value; } - } - - public Adapter adapter { owned - get { - var path = dbus_proxy.adapter; - return Adapter.get_for_object_path (path); - } - } - - public bool legacy_pairing { get { return dbus_proxy.legacy_pairing; } } - - public string modalias { owned get { return dbus_proxy.modalias; } } - - public int rssi { get { return dbus_proxy.rssi; } } - - internal Device (DBusProxy proxy) { - dbus_proxy = (org.bluez.Device1)proxy; - device_map[proxy.g_object_path] = this; - proxy.g_properties_changed.connect ((changed, invalidated) => { - var iter = changed.iterator (); - string? name = null; - Variant? value = null; - while (iter.next ("{sv}", &name, &value)) { - switch (name) { - case "Address": - notify_property ("address"); - break; - case "Name": - notify_property ("name"); - break; - case "Icon": - notify_property ("icon"); - break; - case "Class": - notify_property ("class"); - break; - case "Appearance": - notify_property ("appearance"); - break; - case "UUIDs": - notify_property ("uuids"); - break; - case "Paired": - notify_property ("paired"); - break; - case "Connected": - notify_property ("connected"); - break; - case "Trusted": - notify_property ("trusted"); - break; - case "Blocked": - notify_property ("blocked"); - break; - case "Alias": - notify_property ("alias"); - break; - case "Adapter": - notify_property ("adapter"); - break; - case "LegacyPairing": - notify_property ("legacy-pairing"); - break; - case "Modalias": - notify_property ("modalias"); - break; - case "RSSI": - notify_property ("rssi"); - break; - default: - critical ("Unknown d-bus property: %s", name); - break; - } - } - }); - } - - ~Device () { - device_map.remove (((DBusProxy)dbus_proxy).g_object_path); - } - - internal static Device get_for_object_path (string path) { - return device_map[path]; - } - - public async void connect_device () throws DBusError, IOError { - yield dbus_proxy.connect (); - } - - public async void disconnect_device () throws DBusError, IOError { - yield dbus_proxy.disconnect (); - } - - public async void connect_profile (string uuid) throws DBusError, IOError { - yield dbus_proxy.connect_profile (uuid); - } - - public async void disconnect_profile (string uuid) throws DBusError, IOError { - yield dbus_proxy.disconnect_profile (uuid); - } - - public async void pair () throws DBusError, IOError { - yield dbus_proxy.pair (); - } - - public async void cancel_pairing () throws DBusError, IOError { - yield dbus_proxy.cancel_pairing (); - } - } -} - -namespace org.bluez { - [DBus (name = "org.bluez.Device1")] - public interface Device1 : Object { - public abstract async void connect () throws DBusError, IOError; - public abstract async void disconnect () throws DBusError, IOError; - public abstract async void connect_profile (string uuid) throws DBusError, IOError; - public abstract async void disconnect_profile (string uuid) throws DBusError, IOError; - public abstract async void pair () throws DBusError, IOError; - public abstract async void cancel_pairing () throws DBusError, IOError; - - public abstract string address { owned get; } - public abstract string name { owned get; } - public abstract string icon { owned get; } - public abstract uint32 class { get; } - public abstract uint16 appearance { get; } - [DBus (name = "UUIDs")] - public abstract string[] uuids { owned get; } - public abstract bool paired { get; } - public abstract bool connected { get; } - public abstract bool trusted { get; set; } - public abstract bool blocked { get; set; } - public abstract string alias { owned get; set; } - public abstract ObjectPath adapter { owned get; } - public abstract bool legacy_pairing { get; } - public abstract string modalias { owned get; } - [DBus (name = "RSSI")] - public abstract int16 rssi { get; } - } -} diff --git a/lib/bluez5/Error.vala b/lib/bluez5/Error.vala deleted file mode 100644 index d62810a..0000000 --- a/lib/bluez5/Error.vala +++ /dev/null @@ -1,33 +0,0 @@ -/* - * bluez5 -- DBus bindings for BlueZ 5 - * - * Copyright (C) 2014 David Lechner - * - * 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 throws IOError; 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 . - */ - -/* - * Error.vala: - */ - -namespace Bluez5 { - [DBus (name = "org.bluez.Error")] - public errordomain BlueZError { - INVALID_ARGUMENTS, - ALREADY_EXISTS, - DOES_NOT_EXIST, - REJECTED, - CANCELED - } -} \ No newline at end of file diff --git a/lib/bluez5/Manager.vala b/lib/bluez5/Manager.vala deleted file mode 100644 index 4e11f81..0000000 --- a/lib/bluez5/Manager.vala +++ /dev/null @@ -1,145 +0,0 @@ -/* - * bluez5 -- DBus bindings for BlueZ 5 - * - * Copyright (C) 2014-2015 David Lechner - * - * 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 throws IOError; 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 . - */ - -/* - * Manager.vala: - */ - -namespace Bluez5 { - public class Manager : Object { - public const string SERVICE_NAME = "org.bluez"; - - DBusObjectManagerClient client; - HashTable adapter_map; - HashTable device_map; - - delegate Type TypeFunc (); - - public AgentManager agent_manager { get; private set; } - - public signal void adapter_added (Adapter adapter); - public signal void adapter_removed (Adapter adapter); - - public signal void device_added (Device device); - public signal void device_removed (Device device); - - Manager () { - adapter_map = new HashTable (str_hash, str_equal); - device_map = new HashTable (str_hash, str_equal); - } - - public static async Manager new_async () throws Error { - var manager = new Manager (); - weak Manager weak_manager = manager; - manager.client = yield new DBusObjectManagerClient.for_bus ( - BusType.SYSTEM, DBusObjectManagerClientFlags.NONE, SERVICE_NAME, - "/", (manager, object_path, interface_name) => { - if (interface_name == null) - return typeof (DBusObjectProxy); - Type dev_type; - switch (interface_name) { - case "org.bluez.Adapter1": - dev_type = typeof (org.bluez.Adapter1); - break; - case "org.bluez.AgentManager1": - dev_type = typeof (org.bluez.AgentManager1); - break; - case "org.bluez.Device1": - dev_type = typeof (org.bluez.Device1); - break; - default: - return typeof (DBusProxy); - } - // quark stuff is workaround for bug 710817 - var q = Quark.from_string ("vala-dbus-proxy-type"); - return ((TypeFunc)dev_type.get_qdata (q)) (); - }); - manager.client.object_added.connect ((obj) => { - foreach (var iface in obj.get_interfaces ()) - weak_manager.on_interface_added (obj, iface); - }); - manager.client.object_removed.connect ((obj) => { - foreach (var iface in obj.get_interfaces ()) - weak_manager.on_interface_removed (obj, iface); - }); - manager.client.interface_added.connect ( - weak_manager.on_interface_added); - manager.client.interface_removed.connect ( - weak_manager.on_interface_removed); - foreach (var obj in manager.client.get_objects ()) { - foreach (var iface in obj.get_interfaces ()) { - manager.on_interface_added (obj, iface); - } - } - return manager; - } - - /** - * Return a list of all Adapter objects - */ - public List get_adapters () { - return adapter_map.get_values (); - } - - /** - * Return a list of all Device objects - */ - public List get_devices () { - return device_map.get_values (); - } - - void on_interface_added (DBusObject obj, DBusInterface iface) { - var path = obj.get_object_path (); - var adapter_proxy = iface as org.bluez.Adapter1; - if (adapter_proxy != null) { - var adapter = new Adapter ((DBusProxy)adapter_proxy); - adapter_map[path] = adapter; - adapter_added (adapter); - } - var agent_manager_proxy = iface as org.bluez.AgentManager1; - if (agent_manager_proxy != null) { - agent_manager = new AgentManager ((DBusProxy)agent_manager_proxy); - } - var device_proxy = iface as org.bluez.Device1; - if (device_proxy != null) { - var device = new Device ((DBusProxy)device_proxy); - device_map[path] = device; - device_added (device); - } - } - - void on_interface_removed (DBusObject obj, DBusInterface iface) { - var path = obj.get_object_path (); - var adapter = iface as org.bluez.Adapter1; - if (adapter != null) { - adapter_map.remove (path); - adapter_removed (Adapter.get_for_object_path (path)); - } - var agent_manager_proxy = iface as org.bluez.AgentManager1; - if (agent_manager_proxy != null) { - agent_manager = null; - } - var device = iface as org.bluez.Device1; - if (device != null) { - device_map.remove (path); - device_removed (Device.get_for_object_path (path)); - } - } - } -} diff --git a/lib/bluez5/Uuid.vala b/lib/bluez5/Uuid.vala deleted file mode 100644 index 7b3b73a..0000000 --- a/lib/bluez5/Uuid.vala +++ /dev/null @@ -1,914 +0,0 @@ -/* - * bluez5 -- DBus bindings for BlueZ 5 - * - * Copyright (C) 2015 David Lechner - * - * 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 throws IOError; 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 . - */ - -/* - * Uuid.vala: Bluetooth UUIDs and string conversion functions. - */ - -using GLib.Bus; - -namespace Bluez5.Uuid { - const string 16BIT_PREFIX = "0000"; - const string BASE = "-0000-1000-8000-00805f9b34fb"; - - /** - * Bluetooth Core Specification - */ - public const string SDP = 16BIT_PREFIX + "0001" + BASE; - - /** - * [NO USE BY PROFILES] - */ - public const string UDP = 16BIT_PREFIX + "0002" + BASE; - - /** - * RFCOMM with TS 07.10 - */ - public const string RFCOMM = 16BIT_PREFIX + "0003" + BASE; - - /** - * [NO USE BY PROFILES] - */ - public const string TCP = 16BIT_PREFIX + "0004" + BASE; - - /** - * Telephony Control Specification / TCS Binary [DEPRECATED] - */ - public const string TCS_BIN = 16BIT_PREFIX + "0005" + BASE; - - /** - * [NO USE BY PROFILES] - */ - public const string TCS_AT = 16BIT_PREFIX + "0006" + BASE; - - /** - * Attribute Protocol - */ - public const string ATT = 16BIT_PREFIX + "0007" + BASE; - - /** - * IrDA Interoperability - */ - public const string OBEX = 16BIT_PREFIX + "0008" + BASE; - - /** - * [NO USE BY PROFILES] - */ - public const string IP = 16BIT_PREFIX + "0009" + BASE; - - /** - * [NO USE BY PROFILES] - */ - public const string FTP = 16BIT_PREFIX + "000a" + BASE; - - /** - * [NO USE BY PROFILES] - */ - public const string HTTP = 16BIT_PREFIX + "000c" + BASE; - - /** - * [NO USE BY PROFILES] - */ - public const string WSP = 16BIT_PREFIX + "000e" + BASE; - - /** - * Bluetooth Network Encapsulation Protocol (BNEP) - */ - public const string BNEP = 16BIT_PREFIX + "000f" + BASE; - - /** - * Extended Service Discovery Profile (ESDP) [DEPRECATED] - */ - public const string UPNP = 16BIT_PREFIX + "0010" + BASE; - - /** - * Human Interface Device Profile (HID) - */ - public const string HIDP = 16BIT_PREFIX + "0011" + BASE; - - /** - * Hardcopy Cable Replacement Profile (HCRP) - */ - public const string HardcopyControlChannel = 16BIT_PREFIX + "0012" + BASE; - - /** - * See Hardcopy Cable Replacement Profile (HCRP) - */ - public const string HardcopyDataChannel = 16BIT_PREFIX + "0014" + BASE; - - /** - * Hardcopy Cable Replacement Profile (HCRP) - */ - public const string HardcopyNotification = 16BIT_PREFIX + "0016" + BASE; - - /** - * Audio/Video Control Transport Protocol (AVCTP) - */ - public const string AVCTP = 16BIT_PREFIX + "0017" + BASE; - - /** - * Audio/Video Distribution Transport Protocol (AVDTP) - */ - public const string AVDTP = 16BIT_PREFIX + "0019" + BASE; - - /** - * Common ISDN Access Profile (CIP) [DEPRECATED] - */ - public const string CMTP = 16BIT_PREFIX + "001B" + BASE; - - /** - * Multi-Channel Adaptation Protocol (MCAP) - */ - public const string MCAPControlChannel = 16BIT_PREFIX + "001e" + BASE; - - /** - * Multi-Channel Adaptation Protocol (MCAP) - */ - public const string MCAPDataChannel = 16BIT_PREFIX + "001f" + BASE; - - /** - * Bluetooth Core Specification - */ - public const string L2CAP = 16BIT_PREFIX + "0100" + BASE; - - /** - * Bluetooth Core Specification - * - * Service Class - */ - public const string ServiceDiscoveryServer = 16BIT_PREFIX + "1000" + BASE; - - /** - * Bluetooth Core Specification - * - * Service Class - */ - public const string BrowseGroupDescriptor = 16BIT_PREFIX + "1001" + BASE; - - /** - * Serial Port Profile (SPP) - * - * NOTE: The example SDP record in SPP v1.0 does not include a - * BluetoothProfileDescriptorList attribute, but some implementations - * may also use this Uuid for the Profile Identifier. - * - * Service Class/ Profile - */ - public const string SerialPort = 16BIT_PREFIX + "1101" + BASE; - - /** - * LAN Access Profile - * - * [DEPRECATED] - * - * NOTE: Used as both Service Class Identifier and Profile Identifier. - * - * Service Class/ Profile - */ - public const string LANAccessUsingPPP = 16BIT_PREFIX + "1102" + BASE; - - /** - * Dial-up Networking Profile (DUN) - * - * NOTE: Used as both Service Class Identifier and Profile Identifier. - * - * Service Class/ Profile - */ - public const string DialupNetworking = 16BIT_PREFIX + "1103" + BASE; - - /** - * Synchronization Profile (SYNC) - * - * NOTE: Used as both Service Class Identifier and Profile Identifier. - * - * Service Class/ Profile - */ - public const string IrMCSync = 16BIT_PREFIX + "1104" + BASE; - - /** - * Object Push Profile (OPP) - * - * NOTE: Used as both Service Class Identifier and Profile. - * - * Service Class/ Profile - */ - public const string OBEXObjectPush = 16BIT_PREFIX + "1105" + BASE; - - /** - * File Transfer Profile (FTP) - * - * NOTE: Used as both Service Class Identifier and Profile Identifier. - * - * Service Class/ Profile - */ - public const string OBEXFileTransfer = 16BIT_PREFIX + "1106" + BASE; - - /** - * Synchronization Profile (SYNC) - */ - public const string IrMCSyncCommand = 16BIT_PREFIX + "1107" + BASE; - - /** - * Headset Profile (HSP) - * - * NOTE: Used as both Service Class Identifier and Profile Identifier. - * - * Service Class/ Profile - */ - public const string Headset = 16BIT_PREFIX + "1108" + BASE; - - /** - * Cordless Telephony Profile (CTP) - * - * NOTE: Used as both Service Class Identifier and Profile Identifier. - * - * [DEPRECATED] - * - * Service Class/ Profile - */ - public const string CordlessTelephony = 16BIT_PREFIX + "1109" + BASE; - - /** - * Advanced Audio Distribution Profile (A2DP) - * - * Service Class - */ - public const string AudioSource = 16BIT_PREFIX + "110a" + BASE; - - /** - * Advanced Audio Distribution Profile (A2DP) - * - * Service Class - */ - public const string AudioSink = 16BIT_PREFIX + "110b" + BASE; - - /** - * Audio/Video Remote Control Profile (AVRCP) - * - * Service Class - */ - public const string AV_RemoteControlTarget = 16BIT_PREFIX + "110c" + BASE; - - /** - * Advanced Audio Distribution Profile (A2DP) - * - * Profile - */ - public const string AdvancedAudioDistribution = 16BIT_PREFIX + "110d" + BASE; - - /** - * Audio/Video Remote Control Profile (AVRCP) - * - * NOTE: Used as both Service Class Identifier and Profile Identifier. - * - * Service Class/ Profile - */ - public const string AV_RemoteControl = 16BIT_PREFIX + "110e" + BASE; - - /** - * Audio/Video Remote Control Profile (AVRCP) - * - * NOTE: The AVRCP specification v1.3 and later require that 0x110E also - * be included in the ServiceClassIDList before 0x110F for backwards - * compatibility. - * - * Service Class - */ - public const string AV_RemoteControlController = 16BIT_PREFIX + "110f" + BASE; - - /** - * Intercom Profile (ICP) - * - * NOTE: Used as both Service Class Identifier and Profile Identifier. - * - * [DEPRECATED] - * - * Service Class - */ - public const string Intercom = 16BIT_PREFIX + "1110" + BASE; - - /** - * Fax Profile (FAX) - * - * NOTE: Used as both Service Class Identifier and Profile Identifier. - * - * [DEPRECATED] - * - * Service Class - */ - public const string Fax = 16BIT_PREFIX + "1111" + BASE; - - /** - * Headset Profile (HSP) - * - * Service Class - */ - public const string Headset_Audio_Gateway = 16BIT_PREFIX + "1112" + BASE; - - /** - * Interoperability Requirements for Bluetooth technology as a WAP, - * Bluetooth SIG [DEPRECATED] - * - * Service Class - */ - public const string WAP = 16BIT_PREFIX + "1113" + BASE; - - /** - * Interoperability Requirements for Bluetooth technology as a WAP, - * Bluetooth SIG [DEPRECATED] - * - * Service Class - */ - public const string WAP_CLIENT = 16BIT_PREFIX + "1114" + BASE; - - /** - * Personal Area Networking Profile (PAN) - * - * NOTE: Used as both Service Class Identifier and Profile Identifier - * for PANU role. - * - * Service Class / Profile - */ - public const string PANU = 16BIT_PREFIX + "1115" + BASE; - - /** - * Personal Area Networking Profile (PAN) - * - * NOTE: Used as both Service Class Identifier and Profile Identifier - * for NAP role. - * - * Service Class / Profile - */ - public const string NAP = 16BIT_PREFIX + "1116" + BASE; - - /** - * Personal Area Networking Profile (PAN) - * - * NOTE: Used as both Service Class Identifier and Profile Identifier - * for GN role. - * - * Service Class / Profile - */ - public const string GN = 16BIT_PREFIX + "1117" + BASE; - - /** - * Basic Printing Profile (BPP) - * - * Service Class - */ - public const string DirectPrinting = 16BIT_PREFIX + "1118" + BASE; - - /** - * See Basic Printing Profile (BPP) - * - * Service Class - */ - public const string ReferencePrinting = 16BIT_PREFIX + "1119" + BASE; - - /** - * Basic Imaging Profile (BIP) - * - * Profile - */ - public const string BasicImagingProfile = 16BIT_PREFIX + "111a" + BASE; - - /** - * Basic Imaging Profile (BIP) - * - * Service Class - */ - public const string ImagingResponder = 16BIT_PREFIX + "111b" + BASE; - - /** - * Basic Imaging Profile (BIP) - * - * Service Class - */ - public const string ImagingAutomaticArchive = 16BIT_PREFIX + "111c" + BASE; - - /** - * Basic Imaging Profile (BIP) - * - * Service Class - */ - public const string ImagingReferencedObjects = 16BIT_PREFIX + "111d" + BASE; - - /** - * Hands-Free Profile (HFP) - * - * NOTE: Used as both Service Class Identifier and Profile Identifier. - * - * Service Class / Profile - */ - public const string Handsfree = 16BIT_PREFIX + "111e" + BASE; - - /** - * Hands-free Profile (HFP) - * - * Service Class - */ - public const string HandsfreeAudioGateway = 16BIT_PREFIX + "111f" + BASE; - - /** - * Basic Printing Profile (BPP) - * - * Service Class - */ - public const string DirectPrintingReferenceObjectsService = 16BIT_PREFIX + "1120" + BASE; - - /** - * Basic Printing Profile (BPP) - * - * Service Class - */ - public const string ReflectedUI = 16BIT_PREFIX + "1121" + BASE; - - /** - * Basic Printing Profile (BPP) - * - * Profile - */ - public const string BasicPrinting = 16BIT_PREFIX + "1122" + BASE; - - /** - * Basic Printing Profile (BPP) - * - * Service Class - */ - public const string PrintingStatus = 16BIT_PREFIX + "1123" + BASE; - - /** - * Human Interface Device (HID) - * - * NOTE: Used as both Service Class Identifier and Profile Identifier. - * - * Service Class / Profile - */ - public const string HumanInterfaceDeviceService = 16BIT_PREFIX + "1124" + BASE; - - /** - * Hardcopy Cable Replacement Profile (HCRP) - * - * Profile - */ - public const string HardcopyCableReplacement = 16BIT_PREFIX + "1125" + BASE; - - /** - * Hardcopy Cable Replacement Profile (HCRP) - * - * Service Class - */ - public const string HCR_Print = 16BIT_PREFIX + "1126" + BASE; - - /** - * Hardcopy Cable Replacement Profile (HCRP) - * - * Service Class - */ - public const string HCR_Scan = 16BIT_PREFIX + "1127" + BASE; - - /** - * Common ISDN Access Profile (CIP) - * - * NOTE: Used as both Service Class Identifier and Profile Identifier. - * - * [DEPRECATED] - * - * Service Class / Profile - */ - public const string Common_ISDN_Access = 16BIT_PREFIX + "1128" + BASE; - - /** - * SIM Access Profile (SAP) - * - * NOTE: Used as both Service Class Identifier and Profile Identifier. - * - * Service Class / Profile - */ - public const string SIM_Access = 16BIT_PREFIX + "112d" + BASE; - - /** - * Phonebook Access Profile (PBAP) - * - * Service Class - */ - public const string PhonebookAccessPCE = 16BIT_PREFIX + "112e" + BASE; - - /** - * Phonebook Access Profile (PBAP) - * - * Service Class - */ - public const string PhonebookAccessPSE = 16BIT_PREFIX + "112f" + BASE; - - /** - * Phonebook Access Profile (PBAP) - * - * Profile - */ - public const string PhonebookAccess = 16BIT_PREFIX + "1130" + BASE; - - /** - * Headset Profile (HSP) - * - * NOTE: See erratum #3507. - * 0x1108 and 0x1203 should also be included in the ServiceClassIDList - * before 0x1131 for backwards compatibility. - * - * Service Class - */ - public const string Headset_HS = 16BIT_PREFIX + "1131" + BASE; - - /** - * Message Access Profile (MAP) - * - * Service Class - */ - public const string MessageAccessServer = 16BIT_PREFIX + "1132" + BASE; - - /** - * Message Access Profile (MAP) - * - * Service Class - */ - public const string MessageNotificationServer = 16BIT_PREFIX + "1133" + BASE; - - /** - * Message Access Profile (MAP) - * - * Profile - */ - public const string MessageAccessProfile = 16BIT_PREFIX + "1134" + BASE; - - /** - * Global Navigation Satellite System Profile (GNSS) - * - * Profile - */ - public const string GNSS = 16BIT_PREFIX + "1135" + BASE; - - /** - * Global Navigation Satellite System Profile (GNSS) - * - * Service Class - */ - public const string GNSS_Server = 16BIT_PREFIX + "1136" + BASE; - - /** - * 3D Synchronization Profile (3DSP) - * Service Class - */ - public const string 3D_Display = 16BIT_PREFIX + "0137" + BASE; - - /** - * 3D Synchronization Profile (3DSP) - * - * Service Class - */ - public const string 3D_Glasses = 16BIT_PREFIX + "1138" + BASE; - - /** - * 3D Synchronization Profile (3DSP) - * - * Profile - */ - public const string 3D_Synchronization = 16BIT_PREFIX + "0139" + BASE; - - /** - * Multi-Profile Specification (MPS) - * - * Profile - */ - public const string MPS_Profile = 16BIT_PREFIX + "113a" + BASE; - - /** - * Multi-Profile Specification (MPS) - * - * Service Class - */ - public const string MPS_SC = 16BIT_PREFIX + "113b" + BASE; - - /** - * Calendar, Task, and Notes (CTN) Profile - * - * Service Class - */ - public const string CTN_Access = 16BIT_PREFIX + "113c" + BASE; - - /** - * Calendar Tasks and Notes (CTN) Profile - * - * Service Class - */ - public const string CTN_Notification = 16BIT_PREFIX + "113d" + BASE; - - /** - * Calendar Tasks and Notes (CTN) Profile - * - * Profile - */ - public const string CTN_Profile = 16BIT_PREFIX + "113e" + BASE; - - /** - * Device Identification (DID) - * - * NOTE: Used as both Service Class Identifier and Profile Identifier. - * - * Service Class / Profile - */ - public const string PnPInformation = 16BIT_PREFIX + "1200" + BASE; - - /** - * N/A - * - * Service Class - */ - public const string GenericNetworking = 16BIT_PREFIX + "1201" + BASE; - - /** - * N/A - * - * Service Class - */ - public const string GenericFileTransfer = 16BIT_PREFIX + "1202" + BASE; - - /** - * N/A - * - * Service Class - */ - public const string GenericAudio = 16BIT_PREFIX + "1203" + BASE; - - /** - * N/A - * - * Service Class - */ - public const string GenericTelephony = 16BIT_PREFIX + "1204" + BASE; - - /** - * Enhanced Service Discovery Profile (ESDP) [DEPRECATED] - * - * Service Class - */ - public const string UPNP_Service = 16BIT_PREFIX + "1205" + BASE; - - /** - * Enhanced Service Discovery Profile (ESDP) [DEPRECATED] - * - * Service Class - */ - public const string UPNP_IP_Service = 16BIT_PREFIX + "1206" + BASE; - - /** - * Enhanced Service Discovery Profile (ESDP) [DEPRECATED] - * - * Service Class - */ - public const string ESDP_UPNP_IP_PAN = 16BIT_PREFIX + "1300" + BASE; - - /** - * Enhanced Service Discovery Profile (ESDP) [DEPRECATED] - * - * Service Class - */ - public const string ESDP_UPNP_IP_LAP = 16BIT_PREFIX + "1301" + BASE; - - /** - * Enhanced Service Discovery Profile (ESDP) [DEPRECATED] - * - * Service Class - */ - public const string ESDP_UPNP_L2CAP = 16BIT_PREFIX + "1302" + BASE; - - /** - * Video Distribution Profile (VDP) - * - * Service Class - */ - public const string VideoSource = 16BIT_PREFIX + "1303" + BASE; - - /** - * Video Distribution Profile (VDP) - * - * Service Class - */ - public const string VideoSink = 16BIT_PREFIX + "1304" + BASE; - - /** - * Video Distribution Profile (VDP) - * - * Profile - */ - public const string VideoDistribution = 16BIT_PREFIX + "1305" + BASE; - - /** - * Health Device Profile - * - * Profile - */ - public const string HDP = 16BIT_PREFIX + "1400" + BASE; - - /** - * Health Device Profile (HDP) - * - * Service Class - */ - public const string HDP_Source = 16BIT_PREFIX + "1401" + BASE; - - /** - * Health Device Profile (HDP) - * - * Service Class - */ - public const string HDP_Sink = 16BIT_PREFIX + "1402" + BASE; - - /** - * Gets the 3 to 6 (or more) character profile name for a given Uuid. - */ - public string to_short_profile (string uuid) { - switch (uuid) { - case SDP: - return "SDP"; - case UDP: - return "UDP"; - case RFCOMM: - return "RFCOMM"; - case TCP: - return "TCP"; - case TCS_BIN: - case TCS_AT: - return "TCS"; - case ATT: - return "ATT"; - case OBEX: - return "OBEX"; - case IP: - return "IP"; - case FTP: - return "FTP"; - case HTTP: - return "HTTP"; - case WSP: - return "WSP"; - case BNEP: - return "BNEP"; - case UPNP: - return "UPNP"; - case HIDP: - return "HIDP"; - case HardcopyControlChannel: - case HardcopyDataChannel: - case HardcopyNotification: - return "HCRP"; - case AVCTP: - return "AVCTP"; - case AVDTP: - return "AVDTP"; - case CMTP: - return "CMTP"; - case MCAPControlChannel: - case MCAPDataChannel: - return "MCAP"; - case L2CAP: - return "L2CAP"; - case ServiceDiscoveryServer: - return "ServiceDiscoveryServer"; - case BrowseGroupDescriptor: - return "BrowseGroupDescriptor"; - case SerialPort: - return "SPP"; - case LANAccessUsingPPP: - return "LANAccessUsingPPP"; - case DialupNetworking: - return "DUN"; - case IrMCSync: - return "SYNC"; - case OBEXObjectPush: - return "OPP"; - case OBEXFileTransfer: - return "FTP"; - case IrMCSyncCommand: - return "SYNC"; - case Headset: - return "HSP"; - case CordlessTelephony: - return "CTP"; - case AudioSource: - case AudioSink: - return "A2DP"; - case AV_RemoteControlTarget: - return "AVRCP"; - case AdvancedAudioDistribution: - return "A2DP"; - case AV_RemoteControl: - case AV_RemoteControlController: - return "AVRCP"; - case Intercom: - return "ICP"; - case Fax: - return "FAX"; - case Headset_Audio_Gateway: - return "HSP"; - case WAP: - case WAP_CLIENT: - return "WAP"; - case PANU: - case NAP: - case GN: - return "PAN"; - case DirectPrinting: - case ReferencePrinting: - return "BPP"; - case BasicImagingProfile: - case ImagingResponder: - case ImagingAutomaticArchive: - case ImagingReferencedObjects: - return "BIP"; - case Handsfree: - case HandsfreeAudioGateway: - return "HFP"; - case DirectPrintingReferenceObjectsService: - case ReflectedUI: - case BasicPrinting: - case PrintingStatus: - return "BPP"; - case HumanInterfaceDeviceService: - return "HID"; - case HardcopyCableReplacement: - case HCR_Print: - case HCR_Scan: - return "HCRP"; - case Common_ISDN_Access: - return "CIP"; - case SIM_Access: - return "SAP"; - case PhonebookAccessPCE: - case PhonebookAccessPSE: - case PhonebookAccess: - return "PBAP"; - case Headset_HS: - return "HSP"; - case MessageAccessServer: - case MessageNotificationServer: - case MessageAccessProfile: - return "MAP"; - case GNSS: - case GNSS_Server: - return "GNSS"; - case 3D_Display: - case 3D_Glasses: - case 3D_Synchronization: - return "3DSP"; - case MPS_Profile: - case MPS_SC: - return "MPS"; - case CTN_Access: - case CTN_Notification: - case CTN_Profile: - return "CTN"; - case PnPInformation: - return "DID"; - case GenericNetworking: - return "GenericNetworking"; - case GenericFileTransfer: - return "GenericFileTransfer"; - case GenericAudio: - return "GenericAudio"; - case GenericTelephony: - return "GenericTelephony"; - case UPNP_Service: - case UPNP_IP_Service: - case ESDP_UPNP_IP_PAN: - case ESDP_UPNP_IP_LAP: - case ESDP_UPNP_L2CAP: - return "ESDP"; - case VideoSource: - case VideoSink: - case VideoDistribution: - return "VDP"; - case HDP: - case HDP_Source: - case HDP_Sink: - return "HDP"; - default: - return "Unknown"; - } - } -} diff --git a/lib/connman/Manager.vala b/lib/connman/Manager.vala deleted file mode 100644 index 7d0f9e1..0000000 --- a/lib/connman/Manager.vala +++ /dev/null @@ -1,325 +0,0 @@ -/* - * connman -- DBus bindings for ConnMan - * - * Copyright (C) 2014-2015 David Lechner - * - * 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 throws IOError; 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 . - */ - -/* - * Manager.vala: - */ - -namespace Connman { - public class Manager : Object { - public const string SERVICE_NAME = "net.connman"; - - HashTable technology_map; - HashTable service_map; - List sorted_service_list; - HashTable peer_map; - net.connman.Manager dbus_proxy; - weak Cancellable? on_services_changed_cancellable; - weak Cancellable? on_peers_changed_cancellable; - - public ManagerState state { - get { return dbus_proxy.state; } - } - - public bool offline_mode { - get { return dbus_proxy.offline_mode; } - set { - if (value == offline_mode) - return; - try { - dbus_proxy.set_property_sync ("OfflineMode", value); - } catch (Error err) { - critical ("%s", err.message); - } - } - } - - public signal void technology_added (Technology technology); - public signal void services_changed (List changed); - public signal void peers_changed (List changed); - - construct { - technology_map = new HashTable (str_hash, str_equal); - service_map = new HashTable (str_hash, str_equal); - sorted_service_list = new List (); - peer_map = new HashTable (str_hash, str_equal); - } - - public static async Manager new_async () throws DBusError, IOError { - var manager = new Manager (); - weak Manager weak_manager = manager; - manager.dbus_proxy = yield Bus.get_proxy (BusType.SYSTEM, SERVICE_NAME, - net.connman.Manager.OBJECT_PATH); - manager.dbus_proxy.property_changed.connect (weak_manager.on_property_changed); - var properties = yield manager.dbus_proxy.get_properties (); - properties.foreach ((k, v) => - ((DBusProxy)manager.dbus_proxy).set_cached_property (k, v)); - manager.dbus_proxy.technology_added.connect (weak_manager.on_technology_added); - manager.dbus_proxy.technology_removed.connect (weak_manager.on_technology_removed); - var technologies = yield manager.dbus_proxy.get_technologies (); - foreach (var tech in technologies) - yield manager.on_technology_added_async (tech.path); - manager.dbus_proxy.services_changed.connect (weak_manager.on_services_changed); - var services = yield manager.dbus_proxy.get_services (); - yield manager.on_services_changed_async (services); - manager.dbus_proxy.peers_changed.connect (weak_manager.on_peers_changed); - var peers = yield manager.dbus_proxy.get_peers (); - yield manager.on_peers_changed_async (peers); - return manager; - } - - public List get_technologies () { - return technology_map.get_values (); - } - - public Technology? get_technology (ObjectPath path) { - return technology_map[path]; - } - - public Technology? get_technology_by_type (string type) { - foreach (var technology in technology_map.get_values ()) { - if (technology.technology_type == type) - return technology; - } - return null; - } - - public List get_services () { - return sorted_service_list.copy (); - } - - public Service? get_service (ObjectPath path) { - return service_map[path]; - } - - public Service? get_service_by_name_and_type (string name, string type) { - foreach (var service in service_map.get_values ()) { - if (service.name == name && service.service_type == type) - return service; - } - return null; - } - - public List get_peers () { - return peer_map.get_values (); - } - - public async void register_agent (ObjectPath path) throws DBusError, IOError { - yield dbus_proxy.register_agent (path); - } - - public async void unregister_agent (ObjectPath path) throws DBusError, IOError { - yield dbus_proxy.unregister_agent (path); - } - - void on_technology_added (ObjectPath path, HashTable properties) { - if (technology_map.contains (path)) { - critical ("technology '%s' already exists.", path); - } - on_technology_added_async.begin (path); - } - - async void on_technology_added_async (ObjectPath path) { - try { - var tech = yield Technology.new_async (path); - technology_map[path] = tech; - technology_added (tech); - } catch (Error err) { - critical ("%s", err.message); - } - } - - void on_technology_removed (ObjectPath path) { - if (technology_map.contains (path)) { - technology_map[path].removed (); - technology_map.remove (path); - } - } - - void on_services_changed (net.connman.ManagerObject[] changed, ObjectPath[] removed) { - foreach (var path in removed) { - if (service_map.contains (path)) { - service_map[path].removed (); - service_map.remove (path); - } - } - on_services_changed_async.begin (changed); - } - - async void on_services_changed_async (net.connman.ManagerObject[] changed) { - // We have to make this method reentrant since it is async and - // services can change rapidly. If this method is called a 2nd time - // before the first has completed, we forget about the current list - // of signal objects and exit the method before emitting the - // services-changed signal. - if (on_services_changed_cancellable != null) { - on_services_changed_cancellable.cancel (); - } - var my_cancellable = new Cancellable (); - on_services_changed_cancellable = my_cancellable; - - // It is possible that the changed parameter comes from a DBus signal - // handler. Since this is an async method we need to make our own copy - // because the DBus signal handler will return and free the array if - // we yield. - var changed_copy = new net.connman.ManagerObject[changed.length]; - int i = 0; - foreach (var c in changed) { - changed_copy[i++] = c; - } - try { - var services = new List (); - foreach (var item in changed_copy) { - if (service_map.contains (item.path)) { - services.append (service_map[item.path]); - } else { - var service = yield Service.new_async (item.path); - if (my_cancellable.is_cancelled ()) { - return; - } - service_map[item.path] = service; - services.append (service); - } - } - sorted_service_list = services.copy (); - services_changed (services); - } catch (Error err) { - critical ("%s", err.message); - } - if (on_services_changed_cancellable == my_cancellable) { - on_services_changed_cancellable = null; - } - } - - void on_peers_changed (net.connman.ManagerObject[] changed, ObjectPath[] removed) { - foreach (var path in removed) { - if (peer_map.contains (path)) { - peer_map[path].removed (); - peer_map.remove (path); - } - } - on_peers_changed_async.begin (changed); - } - - async void on_peers_changed_async (net.connman.ManagerObject[] changed) { - // See notes in on_services_changed_async about reentrancy and ownership - // of ``changed`` parameter. - if (on_peers_changed_cancellable != null) - on_peers_changed_cancellable.cancel (); - var my_cancellable = new Cancellable (); - on_peers_changed_cancellable = my_cancellable; - - var changed_copy = new net.connman.ManagerObject[changed.length]; - int i = 0; - foreach (var c in changed) { - changed_copy[i++] = c; - } - try { - var peers = new List (); - foreach (var item in changed_copy) { - if (peer_map.contains (item.path)) { - peers.append (peer_map[item.path]); - } else { - var peer = yield Peer.new_async (item.path); - if (my_cancellable.is_cancelled ()) { - return; - } - peer_map[item.path] = peer; - peers.append (peer); - } - } - peers_changed (peers); - } catch (Error err) { - critical ("%s", err.message); - } - if (on_peers_changed_cancellable == my_cancellable) { - on_peers_changed_cancellable = null; - } - } - - void on_property_changed (string name, Variant? value) { - ((DBusProxy)dbus_proxy).set_cached_property (name, value); - switch (name) { - case "State": - notify_property ("state"); - break; - case "OfflineMode": - notify_property ("offline-mode"); - break; - default: - critical ("Unknown dbus property '%s'", name); - break; - } - } - } - - [DBus (use_string_marshalling = true)] - public enum ManagerState { - [DBus (value = "offline")] - OFFLINE, - [DBus (value = "idle")] - IDLE, - [DBus (value = "ready")] - READY, - [DBus (value = "online")] - ONLINE; - } -} - -namespace net.connman { - [DBus (name = "net.connman.Manager")] - public interface Manager : Object { - public const string OBJECT_PATH = "/"; - - public abstract async HashTable get_properties () throws DBusError, IOError; - public abstract async void set_property (string name, Variant? value) throws DBusError, IOError; - [DBus (name = "SetProperty")] - public abstract void set_property_sync (string name, Variant? value) throws DBusError, IOError; - public abstract async ManagerObject[] get_technologies () throws DBusError, IOError; - public abstract async ManagerObject[] get_services () throws DBusError, IOError; - public abstract async ManagerObject[] get_peers () throws DBusError, IOError; - // deprecated - //public abstract async ObjectPath ConnectProvider (HashTable provider throws DBusError, IOError; - //public abstract async void remove_provider (ObjectPath path) throws DBusError, IOError; - public abstract async void register_agent (ObjectPath object) throws DBusError, IOError; - public abstract async void unregister_agent (ObjectPath object) throws DBusError, IOError; - public abstract async void register_counter (ObjectPath path, uint accuracy, uint period) throws DBusError, IOError; - public abstract async void unregister_counter (ObjectPath path) throws DBusError, IOError; - public abstract async ObjectPath create_session (HashTable settings, ObjectPath notifier) throws DBusError, IOError; - public abstract async void destroy_session (ObjectPath session) throws DBusError, IOError; - public abstract async ObjectPath request_private_network (HashTable options, out HashTable fd) throws DBusError, IOError; - public abstract async void release_private_network (ObjectPath path) throws DBusError, IOError; - - public signal void technology_added (ObjectPath path, HashTable properties); - public signal void technology_removed (ObjectPath path); - public signal void services_changed (ManagerObject[] changed, ObjectPath[] removed); - public signal void peers_changed (ManagerObject[] changed, ObjectPath[] removed); - public signal void property_changed (string name, Variant? value); - - public abstract Connman.ManagerState state { get; } - public abstract bool offline_mode { get; } - // deprecated - //public abstract bool session_mode { get; } - } - - public struct ManagerObject { - ObjectPath path; - HashTable properties; - } -} diff --git a/lib/connman/Peer.vala b/lib/connman/Peer.vala deleted file mode 100644 index a2b45a1..0000000 --- a/lib/connman/Peer.vala +++ /dev/null @@ -1,125 +0,0 @@ -/* - * connman -- DBus bindings for ConnMan - * - * Copyright (C) 2014-2015 David Lechner - * - * 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 throws IOError; 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 . - */ - -/* - * Peer.vala: - */ - -namespace Connman { - public class Peer : Object { - const string IPV4_ADDRESS_KEY = "Address"; - const string IPV4_NETMASK_KEY = "Netmask"; - - internal net.connman.Peer dbus_proxy; - - public ObjectPath object_path { get; private set; } - - public PeerState state { get { return dbus_proxy.state; } } - public string name { owned get { return dbus_proxy.name; } } - public string? ipv4_address { - owned get { - if (dbus_proxy.ipv4[IPV4_ADDRESS_KEY] == null) - return null; - return dbus_proxy.ipv4[IPV4_ADDRESS_KEY].dup_string (); - } - } - public string? ipv4_netmask { - owned get { - if (dbus_proxy.ipv4[IPV4_NETMASK_KEY] == null) - return null; - return dbus_proxy.ipv4[IPV4_NETMASK_KEY].dup_string (); - } - } - - public signal void removed (); - - internal static async Peer new_async (ObjectPath path) throws DBusError, IOError { - var peer = new Peer(); - peer.dbus_proxy = yield Bus.get_proxy (BusType.SYSTEM, - Manager.SERVICE_NAME, path); - peer.object_path = path; - peer.dbus_proxy.property_changed.connect (peer.on_property_changed); - // we are calling the deprecated get_properties_sync method because - // of a possible race condition where a property_changed signal is - // sent before the signal handler is connected. - var properties = yield peer.dbus_proxy.get_properties (); - properties.foreach ((k, v) => peer.on_property_changed (k, v)); - return peer; - } - - public async void connect_peer() throws DBusError, IOError { - yield dbus_proxy.connect (); - } - - public async void disconnect_peer() throws DBusError, IOError { - yield dbus_proxy.disconnect (); - } - - void on_property_changed(string name, Variant? value) { - ((DBusProxy)dbus_proxy).set_cached_property (name, value); - switch (name) { - case "State": - notify_property ("state"); - break; - case "Name": - notify_property ("name"); - break; - case "IPv4": - notify_property ("ipv4"); - break; - default: - critical ("Unknown dbus property '%s'", name); - break; - } - } - } - - [DBus (use_string_marshalling = true)] - public enum PeerState { - [DBus (value = "idle")] - IDLE, - [DBus (value = "failure")] - FAILURE, - [DBus (value = "association")] - ASSOCIATION, - [DBus (value = "configuration")] - CONFIGURATION, - [DBus (value = "ready")] - READY, - [DBus (value = "disconnect")] - DISCONNECT; - } -} - -namespace net.connman { - [DBus (name = "net.connman.Peer")] - public interface Peer : Object { - // Docs say get_properties is deprecated, but it is needed to avoid race condition - public abstract async HashTable get_properties () throws DBusError, IOError; - public abstract async void connect () throws DBusError, IOError; - public abstract async void disconnect () throws DBusError, IOError; - - public signal void property_changed (string name, Variant? value); - - public abstract Connman.PeerState state { get; } - public abstract string name { owned get; } - [DBus (name = "IPv4")] - public abstract HashTable ipv4 { owned get; } - } -} diff --git a/lib/connman/Service.vala b/lib/connman/Service.vala deleted file mode 100644 index de8e94f..0000000 --- a/lib/connman/Service.vala +++ /dev/null @@ -1,731 +0,0 @@ -/* - * connman -- DBus bindings for ConnMan - * - * Copyright (C) 2014-2015 David Lechner - * - * 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 throws IOError; 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 . - */ - -/* - * Service.vala: - */ - -namespace Connman { - public class Service : Object { - const string IPV4_METHOD_KEY = "Method"; - const string IPV4_ADDRESS_KEY = "Address"; - const string IPV4_NETMASK_KEY = "Netmask"; - const string IPV4_GATEWAY_KEY = "Gateway"; - const string IPV6_METHOD_KEY = "Method"; - const string IPV6_ADDRESS_KEY = "Address"; - const string IPV6_PREFIX_LENGTH_KEY = "PrefixLength"; - const string IPV6_GATEWAY_KEY = "Gateway"; - const string IPV6_PRIVACY_KEY = "Privacy"; - const string PROXY_METHOD_KEY = "Method"; - const string PROXY_URL_KEY = "URL"; - const string PROXY_SERVERS_KEY = "Servers"; - const string PROXY_EXCLUDES_KEY = "Excludes"; - const string PROVIDER_HOST_KEY = "Host"; - const string PROVIDER_DOMAIN_KEY = "Domain"; - const string PROVIDER_NAME_KEY = "Name"; - const string PROVIDER_TYPE_KEY = "Type"; - const string ETHERNET_METHOD_KEY = "Method"; - const string ETHERNET_INTERFACE_KEY = "Interface"; - const string ETHERNET_ADDRESS_KEY = "Address"; - const string ETHERNET_MTU_KEY = "MTU"; - - internal net.connman.Service dbus_proxy; - - public ObjectPath object_path { get; private set; } - public ServiceState state { get { return dbus_proxy.state; } } - public string? error { owned get { return dbus_proxy.error; } } - public string? name { owned get { return dbus_proxy.name; } } - public string service_type { owned get { return dbus_proxy.type_; } } - public GenericArray security { - owned get { - var array = new GenericArray (); - foreach (var item in dbus_proxy.security) - array.add (item); - return (owned)array; - } - } - public uint8 strength { get { return dbus_proxy.strength; } } - public bool favorite { get { return dbus_proxy.favorite; } } - public bool immutable { get { return dbus_proxy.immutable; } } - public bool auto_connect { - get { return dbus_proxy.auto_connect; } - set { - if (value == auto_connect) - return; - try { - dbus_proxy.set_property_sync ("AutoConnect", value); - } catch (Error err) { - critical ("%s", err.message); - } - } - } - public bool roaming { get { return dbus_proxy.roaming; } } - public string[] nameservers { - owned get { return dbus_proxy.nameservers; } - } - public string[] nameservers_configuration { - owned get { return dbus_proxy.nameservers_configuration; } - set { - try { - dbus_proxy.set_property_sync ("Nameservers.Configuration", value); - } catch (Error err) { - critical("%s", err.message); - } - } - } - public string[] timeservers { - owned get { return dbus_proxy.timeservers; } - } - public string[] timeservers_configuration { - owned get { return dbus_proxy.timeservers_configuration; } - set { - try { - dbus_proxy.set_property_sync ("Timeservers.Configuration", value); - } catch (Error err) { - critical("%s", err.message); - } - } - } - public string[] domains { owned get { return dbus_proxy.domains; } } - public string[] domains_configuration { - owned get { return dbus_proxy.domains_configuration; } - set { - try { - dbus_proxy.set_property_sync ("Domains.Configuration", value); - } catch (Error err) { - critical("%s", err.message); - } - } - } - - public IPv4Info ipv4 { - owned get { - var config = dbus_proxy.ipv4; - var info = new IPv4Info (); - if (config[IPV4_METHOD_KEY] != null) { - try { - info.method = IPv4Method.from_string ( - config[IPV4_METHOD_KEY].get_string ()); - } catch (DBusError err) { - critical ("%s", err.message); - } - } - if (config[IPV4_ADDRESS_KEY] != null) - info.address = config[IPV4_ADDRESS_KEY].dup_string (); - if (config[IPV4_NETMASK_KEY] != null) - info.netmask = config[IPV4_NETMASK_KEY].dup_string (); - if (config[IPV4_GATEWAY_KEY] != null) - info.gateway = config[IPV4_GATEWAY_KEY].dup_string (); - return info; - } - } - - public IPv4Info ipv4_configuration { - owned get { - var config = dbus_proxy.ipv4_configuration; - var info = new IPv4Info (); - if (config[IPV4_METHOD_KEY] != null) { - try { - info.method = IPv4Method.from_string ( - config[IPV4_METHOD_KEY].get_string ()); - } catch (DBusError err) { - critical ("%s", err.message); - } - } - if (config[IPV4_ADDRESS_KEY] != null) - info.address = config[IPV4_ADDRESS_KEY].dup_string (); - if (config[IPV4_NETMASK_KEY] != null) - info.netmask = config[IPV4_NETMASK_KEY].dup_string (); - if (config[IPV4_GATEWAY_KEY] != null) - info.gateway = config[IPV4_GATEWAY_KEY].dup_string (); - return info; - } - set { - try { - var config = new HashTable (null, null); - if (value.method != null) - config[IPV4_METHOD_KEY] = new Variant.string (value.method.to_string ()); - if (value.address != null) - config[IPV4_ADDRESS_KEY] = new Variant.string (value.address); - if (value.netmask != null) - config[IPV4_NETMASK_KEY] = new Variant.string (value.netmask); - if (value.gateway != null) - config[IPV4_GATEWAY_KEY] = new Variant.string (value.gateway); - dbus_proxy.set_property_sync ("IPv4.Configuration", config); - } catch (Error err) { - critical("%s", err.message); - } - } - } - - public IPv6Info ipv6 { - owned get { - var config = dbus_proxy.ipv6; - var info = new IPv6Info (); - if (config[IPV6_METHOD_KEY] != null) { - try { - info.method = IPv6Method.from_string ( - config[IPV6_METHOD_KEY].get_string ()); - } catch (DBusError err) { - critical ("%s", err.message); - } - } - if (config[IPV6_ADDRESS_KEY] != null) - info.address = config[IPV6_ADDRESS_KEY].dup_string (); - if (config[IPV6_PREFIX_LENGTH_KEY] != null) - info.prefix_length = config[IPV6_PREFIX_LENGTH_KEY].dup_string (); - if (config[IPV6_GATEWAY_KEY] != null) - info.gateway = config[IPV6_GATEWAY_KEY].dup_string (); - if (config[IPV6_PRIVACY_KEY] != null) { - try { - info.privacy = IPv6Privacy.from_string ( - config[IPV6_PRIVACY_KEY].get_string ()); - } catch (DBusError err) { - critical ("%s", err.message); - } - } - return info; - } - } - - public IPv6Info ipv6_configuration { - owned get { - var config = dbus_proxy.ipv6_configuration; - var info = new IPv6Info (); - if (config[IPV6_METHOD_KEY] != null) { - try { - info.method = IPv6Method.from_string ( - config[IPV6_METHOD_KEY].get_string ()); - } catch (DBusError err) { - critical ("%s", err.message); - } - } - if (config[IPV6_ADDRESS_KEY] != null) - info.address = config[IPV6_ADDRESS_KEY].dup_string (); - if (config[IPV6_PREFIX_LENGTH_KEY] != null) - info.prefix_length = config[IPV6_PREFIX_LENGTH_KEY].dup_string (); - if (config[IPV6_GATEWAY_KEY] != null) - info.gateway = config[IPV6_GATEWAY_KEY].dup_string (); - if (config[IPV6_PRIVACY_KEY] != null) { - try { - info.privacy = IPv6Privacy.from_string ( - config[IPV6_PRIVACY_KEY].get_string ()); - } catch (DBusError err) { - critical ("%s", err.message); - } - } - return info; - } - set { - try { - var config = new HashTable (null, null); - if (value.method != null) - config[IPV6_METHOD_KEY] = new Variant.string (value.method.to_string ()); - if (value.address != null) - config[IPV6_ADDRESS_KEY] = new Variant.string (value.address); - if (value.prefix_length != null) - config[IPV6_PREFIX_LENGTH_KEY] = new Variant.string (value.prefix_length); - if (value.gateway != null) - config[IPV6_GATEWAY_KEY] = new Variant.string (value.gateway); - if (value.privacy != null) - config[IPV6_PRIVACY_KEY] = new Variant.string (value.privacy.to_string ()); - dbus_proxy.set_property_sync ("IPv6.Configuration", config); - } catch (Error err) { - critical("%s", err.message); - } - } - } - - public ProxyInfo proxy { - owned get { - var config = dbus_proxy.proxy; - var info = new ProxyInfo (); - if (config[PROXY_METHOD_KEY] != null) { - try { - info.method = ProxyMethod.from_string ( - config[PROXY_METHOD_KEY].get_string ()); - } catch (DBusError err) { - critical ("%s", err.message); - } - } - if (config[PROXY_URL_KEY] != null) - info.url = config[PROXY_URL_KEY].dup_string (); - if (config[PROXY_SERVERS_KEY] != null) - info.servers = config[PROXY_SERVERS_KEY].dup_strv (); - if (config[PROXY_EXCLUDES_KEY] != null) - info.excludes = config[PROXY_EXCLUDES_KEY].dup_strv (); - return info; - } - } - - public ProxyInfo proxy_configuration { - owned get { - var config = dbus_proxy.proxy_configuration; - var info = new ProxyInfo (); - if (config[PROXY_METHOD_KEY] != null) { - try { - info.method = ProxyMethod.from_string ( - config[PROXY_METHOD_KEY].get_string ()); - } catch (DBusError err) { - critical ("%s", err.message); - } - } - if (config[PROXY_URL_KEY] != null) - info.url = config[PROXY_URL_KEY].dup_string (); - if (config[PROXY_SERVERS_KEY] != null) - info.servers = config[PROXY_SERVERS_KEY].dup_strv (); - if (config[PROXY_EXCLUDES_KEY] != null) - info.excludes = config[PROXY_EXCLUDES_KEY].dup_strv (); - return info; - } - set { - try { - var config = new HashTable (null, null); - if (value.method != null) - config[PROXY_METHOD_KEY] = new Variant.string (value.method.to_string ()); - if (value.url != null) - config[PROXY_URL_KEY] = new Variant.string (value.url); - if (value.servers != null) - config[PROXY_SERVERS_KEY] = new Variant.strv (value.servers); - if (value.excludes != null) - config[PROXY_EXCLUDES_KEY] = new Variant.strv (value.excludes); - dbus_proxy.set_property_sync ("Proxy.Configuration", config); - } catch (Error err) { - critical("%s", err.message); - } - } - } - - public ProviderInfo provider { - owned get { - var config = dbus_proxy.provider; - var info = new ProviderInfo (); - if (config[PROVIDER_HOST_KEY] != null) - info.host = config[PROVIDER_HOST_KEY].dup_string (); - if (config[PROVIDER_DOMAIN_KEY] != null) - info.domain = config[PROVIDER_DOMAIN_KEY].dup_string (); - if (config[PROVIDER_NAME_KEY] != null) - info.name = config[PROVIDER_NAME_KEY].dup_string (); - if (config[PROVIDER_TYPE_KEY] != null) - info.type = config[PROVIDER_TYPE_KEY].dup_string (); - return info; - } - } - - public EthernetInfo ethernet { - owned get { - var config = dbus_proxy.ethernet; - var info = new EthernetInfo (); - if (config[ETHERNET_METHOD_KEY] != null) { - try { - info.method = EthernetMethod.from_string ( - config[ETHERNET_METHOD_KEY].get_string ()); - } catch (DBusError err) { - critical ("%s", err.message); - } - } - if (config[ETHERNET_INTERFACE_KEY] != null) - info.interface = config[ETHERNET_INTERFACE_KEY].dup_string (); - if (config[ETHERNET_ADDRESS_KEY] != null) - info.address = config[ETHERNET_ADDRESS_KEY].dup_string (); - if (config[ETHERNET_MTU_KEY] != null) - info.mtu = config[ETHERNET_MTU_KEY].get_uint16 (); - return info; - } - } - - public bool mdns { get { return dbus_proxy.mdns; } } - public bool mdns_configuration { - get { return dbus_proxy.mdns_configuration; } - set { - if (value == mdns_configuration) - return; - try { - dbus_proxy.set_property_sync ("mDNS.Configuration", value); - } catch (Error err) { - critical ("%s", err.message); - } - } - } - - public signal void removed (); - - internal static async Service new_async (ObjectPath path) throws DBusError, IOError { - var service = new Service (); - service.dbus_proxy = yield Bus.get_proxy (BusType.SYSTEM, - Manager.SERVICE_NAME, path); - service.object_path = path; - weak Service weak_service = service; - service.dbus_proxy.property_changed.connect (weak_service.on_property_changed); - // we are calling the deprecated get_properties_sync method because - // of a possible race condition where a property_changed signal is - // sent before the signal handler is connected. - var properties = yield service.dbus_proxy.get_properties (); - properties.foreach ((k, v) => service.on_property_changed (k, v)); - return service; - } - - public async void connect_service (bool long_timeout = false) throws DBusError, IOError { - if (long_timeout) - try { - yield ((DBusProxy)dbus_proxy).call ("Connect", null, - DBusCallFlags.NONE, 300000); - } catch (IOError ioerr) { - throw ioerr; - } catch (Error err) { - // This should only happen if we were using cancellable - // but we are not. Just catching it here to prevent compiler - // warning. - critical ("%s", err.message); - } - else - yield dbus_proxy.connect (); - } - - public async void disconnect_service () throws DBusError, IOError { - yield dbus_proxy.disconnect (); - } - - public async void remove() throws DBusError, IOError { - yield dbus_proxy.remove(); - } - - public async void move_before(Service service) throws DBusError, IOError { - yield dbus_proxy.move_before(service.object_path); - } - - public async void move_after(Service service) throws DBusError, IOError { - yield dbus_proxy.move_after(service.object_path); - } - - public async void reset_counters() throws DBusError, IOError { - yield dbus_proxy.reset_counters(); - } - - internal void on_property_changed (string name, Variant? value) { - ((DBusProxy)dbus_proxy).set_cached_property(name, value); - switch (name) { - case "State": - notify_property("state"); - break; - case "Error": - notify_property("error"); - break; - case "Name": - notify_property("name"); - break; - case "Type": - notify_property("service-type"); - break; - case "Security": - notify_property("security"); - break; - case "Strength": - notify_property("strength"); - break; - case "Favorite": - notify_property("favorite"); - break; - case "Immutable": - notify_property("immutable"); - break; - case "AutoConnect": - notify_property("auto-connect"); - break; - case "Roaming": - notify_property("roaming"); - break; - case "Nameservers": - notify_property("nameservers"); - break; - case "Nameservers.Configuration": - notify_property("nameservers-configuration"); - break; - case "Timeservers": - notify_property("timeservers"); - break; - case "Timeservers.Configuration": - notify_property("timeservers-configuration"); - break; - case "Domains": - notify_property("domains"); - break; - case "Domains.Configuration": - notify_property("domains-configuration"); - break; - case "IPv4": - notify_property ("ipv4"); - break; - case "IPv4.Configuration": - notify_property("ipv4-configuration"); - break; - case "IPv6": - notify_property ("ipv6"); - break; - case "IPv6.Configuration": - notify_property("ipv6-configuration"); - break; - case "Proxy": - notify_property ("proxy"); - break; - case "Proxy.Configuration": - notify_property("proxy-configuration"); - break; - case "Provider": - notify_property ("provider"); - break; - case "Ethernet": - notify_property ("ethernet"); - break; - case "mDNS": - notify_property ("mdns"); - break; - case "mDNS.Configuration": - notify_property ("mdns-configuration"); - break; - default: - critical ("Unknown dbus property '%s'", name); - break; - } - } - } - - [DBus (use_string_marshalling = true)] - public enum ServiceState { - [DBus (value = "idle")] - IDLE, - [DBus (value = "failure")] - FAILURE, - [DBus (value = "association")] - ASSOCIATION, - [DBus (value = "configuration")] - CONFIGURATION, - [DBus (value = "ready")] - READY, - [DBus (value = "disconnect")] - DISCONNECT, - [DBus (value = "online")] - ONLINE; - } - - [DBus (use_string_marshalling = true)] - public enum ServiceSecurity { - [DBus (value = "none")] - NONE, - [DBus (value = "wep")] - WEP, - [DBus (value = "psk")] - PSK, - [DBus (value = "ieee8021x")] - IEEE8021X, - [DBus (value = "wps")] - WPS; - } - - [DBus (use_string_marshalling = true)] - public enum IPv4Method { - [DBus (value = "dhcp")] - DHCP, - [DBus (value = "manual")] - MANUAL, - [DBus (value = "off")] - OFF; - - // hacks to expose methods created by DBus use_string_marshalling - [CCode (cname = "connman_ipv4_method_to_string (self)")] - extern const string to_string_hack; - [CCode (cname = "connman_ipv4_method_to_string_wrapper")] - public string to_string () { - return to_string_hack; - } - public static extern IPv4Method from_string (string method) throws DBusError; - } - - [DBus (use_string_marshalling = true)] - public enum IPv6Method { - [DBus (value = "dhcp")] - DHCP, - [DBus (value = "manual")] - MANUAL, - [DBus (value = "6to4")] - V6TOV4, - [DBus (value = "off")] - OFF; - - // hacks to expose methods created by DBus use_string_marshalling - [CCode (cname = "connman_ipv6_method_to_string (self)")] - extern const string to_string_hack; - [CCode (cname = "connman_ipv6_method_to_string_wrapper")] - public string to_string () { - return to_string_hack; - } - public static extern IPv6Method from_string (string method) throws DBusError; - } - - [DBus (use_string_marshalling = true)] - public enum IPv6Privacy { - [DBus (value = "disabled")] - DISABLED, - [DBus (value = "enabled")] - ENABLED, - [DBus (value = "preferred")] - PREFERRED; - - // hacks to expose methods created by DBus use_string_marshalling - [CCode (cname = "connman_ipv6_privacy_to_string (self)")] - extern const string to_string_hack; - [CCode (cname = "connman_ipv6_privacy_to_string_wrapper")] - public string to_string () { - return to_string_hack; - } - public static extern IPv6Privacy from_string (string method) throws DBusError; - } - - [DBus (use_string_marshalling = true)] - public enum ProxyMethod { - [DBus (value = "direct")] - DIRECT, - [DBus (value = "auto")] - AUTO, - [DBus (value = "manual")] - MANUAL; - - // hacks to expose methods created by DBus use_string_marshalling - [CCode (cname = "connman_proxy_method_to_string (self)")] - extern const string to_string_hack; - [CCode (cname = "connman_proxy_method_to_string_wrapper")] - public string to_string () { - return to_string_hack; - } - public static extern ProxyMethod from_string (string method) throws DBusError; - } - - [DBus (use_string_marshalling = true)] - public enum EthernetMethod { - [DBus (value = "auto")] - AUTO, - [DBus (value = "manual")] - MANUAL; - - // hacks to expose methods created by DBus use_string_marshalling - [CCode (cname = "connman_ethernet_method_to_string (self)")] - extern const string to_string_hack; - [CCode (cname = "connman_ethernet_method_to_string_wrapper")] - public string to_string () { - return to_string_hack; - } - public static extern EthernetMethod from_string (string method) throws DBusError; - } - - [Compact] - public class IPv4Info { - public IPv4Method? method; - public string? address; - public string? netmask; - public string? gateway; - } - - [Compact] - public class IPv6Info { - public IPv6Method? method; - public string? address; - public string? prefix_length; - public string? gateway; - public IPv6Privacy? privacy; - } - - [Compact] - public class ProxyInfo { - public ProxyMethod? method; - public string? url; - public string[]? servers; - public string[]? excludes; - } - - [Compact] - public class ProviderInfo { - public string? host; - public string? domain; - public string? name; - public string? type; - } - - [Compact] - public class EthernetInfo { - public EthernetMethod? method; - public string? interface; - public string? address; - public uint16? mtu; - } -} - -namespace net.connman { - [DBus (name = "net.connman.Service")] - public interface Service : Object { - // Docs say get_properties is deprecated, but it is needed to avoid race condition - public abstract async HashTable get_properties() throws DBusError, IOError; - public abstract async void set_property(string name, Variant? value) throws DBusError, IOError; - [DBus (name = "SetProperty")] - public abstract void set_property_sync(string name, Variant? value) throws DBusError, IOError; - public abstract async void clear_property(string name) throws DBusError, IOError; - public abstract async void connect() throws DBusError, IOError; - public abstract async void disconnect() throws DBusError, IOError; - public abstract async void remove() throws DBusError, IOError; - public abstract async void move_before(ObjectPath service) throws DBusError, IOError; - public abstract async void move_after(ObjectPath service) throws DBusError, IOError; - public abstract async void reset_counters() throws DBusError, IOError; - - public signal void property_changed(string name, Variant? value); - - public abstract Connman.ServiceState state { get; } - public abstract string? error { owned get; } - public abstract string? name { owned get; } - public abstract string type_ { owned get; } - public abstract Connman.ServiceSecurity[] security { owned get; } - public abstract uint8 strength { get; } - public abstract bool favorite { get; } - public abstract bool immutable { get; } - public abstract bool auto_connect { get; } - public abstract bool roaming { get; } - public abstract string[] nameservers { owned get; } - [DBus (name = "Nameservers.Configuration")] - public abstract string[] nameservers_configuration { owned get; } - public abstract string[] timeservers { owned get; } - [DBus (name = "Timeservers.Configuration")] - public abstract string[] timeservers_configuration { owned get; } - public abstract string[] domains { owned get; } - [DBus (name = "Domains.Configuration")] - public abstract string[] domains_configuration { owned get; } - [DBus (name = "IPv4")] - public abstract HashTable ipv4 { owned get; } - [DBus (name = "IPv4.Configuration")] - public abstract HashTable ipv4_configuration { owned get; } - [DBus (name = "IPv6")] - public abstract HashTable ipv6 { owned get; } - [DBus (name = "IPv6.Configuration")] - public abstract HashTable ipv6_configuration { owned get; } - public abstract HashTable proxy { owned get; } - [DBus (name = "Proxy.Configuration")] - public abstract HashTable proxy_configuration { owned get; } - public abstract HashTable provider { owned get; } - public abstract HashTable ethernet { owned get; } - public abstract bool mdns { owned get; } - public abstract bool mdns_configuration { owned get; } - } -} diff --git a/lib/connman/Technology.vala b/lib/connman/Technology.vala deleted file mode 100644 index b260bbd..0000000 --- a/lib/connman/Technology.vala +++ /dev/null @@ -1,156 +0,0 @@ -/* - * connman -- DBus bindings for ConnMan - * - * Copyright (C) 2014-2015 David Lechner - * - * 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 throws IOError; 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 . - */ - -/* - * Technology.vala: - */ - -namespace Connman { - public class Technology : Object { - internal net.connman.Technology dbus_proxy; - - public ObjectPath object_path { get; private set; } - - public bool powered { - get { return dbus_proxy.powered; } - set { - if (value == powered) - return; - try { - dbus_proxy.set_property_sync ("Powered", value); - } catch (Error err) { - critical ("%s", err.message); - } - } - } - public bool connected { get { return dbus_proxy.connected; } } - public string name { owned get { return dbus_proxy.name; } } - public string technology_type { owned get { return dbus_proxy.type_; } } - public bool tethering { - get { return dbus_proxy.tethering; } - set { - if (value == tethering) - return; - try { - dbus_proxy.set_property_sync ("Tethering", value); - } catch (Error err) { - critical ("%s", err.message); - } - } - } - public string tethering_identifier { - owned get { return dbus_proxy.tethering_identifier; } - set { - if (value == tethering_identifier) - return; - try { - dbus_proxy.set_property_sync ("TetheringIdentifier", value); - } catch (Error err) { - critical ("%s", err.message); - } - } - } - public string tethering_passphrase { - owned get { return dbus_proxy.tethering_passphrase; } - set { - if (value == tethering_passphrase) - return; - try { - dbus_proxy.set_property_sync ("TetheringPassphrase", value); - } catch (Error err) { - critical ("%s", err.message); - } - } - } - - public signal void removed (); - - internal static async Technology new_async (ObjectPath path) throws DBusError, IOError { - var technology = new Technology (); - technology.dbus_proxy = yield Bus.get_proxy (BusType.SYSTEM, - Manager.SERVICE_NAME, path); - technology.object_path = path; - technology.dbus_proxy.property_changed.connect (technology.on_property_changed); - // we are calling the deprecated get_properties_sync method because - // of a possible race condition where a property_changed signal is - // sent before the signal handler is connected. - var properties = yield technology.dbus_proxy.get_properties (); - properties.foreach ((k, v) => technology.on_property_changed (k, v)); - return technology; - } - - public async void scan() throws DBusError, IOError { - yield dbus_proxy.scan(); - } - - void on_property_changed(string name, Variant? value) { - ((DBusProxy)dbus_proxy).set_cached_property(name, value); - switch (name) { - case "Powered": - notify_property("powered"); - break; - case "Connected": - notify_property("connected"); - break; - case "Name": - notify_property("name"); - break; - case "Type": - notify_property("technology-type"); - break; - case "Tethering": - notify_property("tethering"); - break; - case "TetheringIdentifier": - notify_property("tethering-identifier"); - break; - case "TetheringPassphrase": - notify_property("tethering-passphrase"); - break; - default: - critical ("Unknown dbus property '%s'", name); - break; - } - } - } -} - -namespace net.connman { - [DBus (name = "net.connman.Technology")] - public interface Technology : Object { - // Docs say get_properties is deprecated, but it is needed to avoid race condition - public abstract async HashTable get_properties () throws DBusError, IOError; - [DBus (name = "GetProperties")] - public abstract HashTable get_properties_sync () throws DBusError, IOError; - public abstract async void set_property (string name, Variant? value) throws DBusError, IOError; - [DBus (name = "SetProperty")] - public abstract void set_property_sync (string name, Variant? value) throws DBusError, IOError; - public abstract async void scan () throws DBusError, IOError; - - public signal void property_changed (string name, Variant? value); - - public abstract bool powered { get; } - public abstract bool connected { get; } - public abstract string name { owned get; } - public abstract string type_ { owned get; } - public abstract bool tethering { get; } - public abstract string tethering_identifier { owned get; } - public abstract string tethering_passphrase { owned get; } - } -} diff --git a/lib/dbus/Properties.vala b/lib/dbus/Properties.vala deleted file mode 100644 index 6b0bee2..0000000 --- a/lib/dbus/Properties.vala +++ /dev/null @@ -1,29 +0,0 @@ -/* - * dbus -- vala bindings for d-bus standard interfaces - * - * Copyright (C) 2014 David Lechner - * - * 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 . - */ - -namespace org.freedesktop.DBus { - [DBus (name = "org.freedesktop.DBus.Properties")] - public interface Properties : DBusProxy { - public abstract async Variant? get (string interface_name, string property_name) throws DBusError, IOError; - public abstract async void set (string interface_name, string property_name, Variant? value) throws DBusError, IOError; - public abstract async HashTable get_all (string interface_name) throws DBusError, IOError; - - public abstract signal void properties_changed (string interface_name, HashTable changed_properties, string[] invalidated_properties); - } -} \ No newline at end of file diff --git a/lib/systemd/Logind.vala b/lib/systemd/Logind.vala deleted file mode 100644 index 49a47d2..0000000 --- a/lib/systemd/Logind.vala +++ /dev/null @@ -1,275 +0,0 @@ -/* - * systemd -- vala bindings for systemd d-bus - * - * Copyright (C) 2014-2015 David Lechner - * - * 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 . - */ - -namespace Systemd.Logind { - [DBus (use_string_marshalling = true)] - public enum SessionToKill { - [DBus (value = "leader")] - LEADER, - [DBus (value = "all")] - ALL; - } - - [DBus (use_string_marshalling = true)] - public enum CanResponse { - [DBus (value = "na")] - NOT_APPLICABLE, - [DBus (value = "yes")] - YES, - [DBus (value = "no")] - NO, - [DBus (value = "challenge")] - CHALLENGE; - } - - [DBus (use_string_marshalling = true)] - public enum InhibitMode { - [DBus (value = "block")] - BLOCK, - [DBus (value = "delay")] - DELAY; - } - - public class Manager : Object { - static HashTable object_map; - - static construct { - object_map = new HashTable (str_hash, str_equal); - } - - ObjectPath path; - org.freedesktop.login1.Manager manager; - org.freedesktop.DBus.Properties properties; - - public uint32 auto_vt_count { get { return manager.auto_vt_count; } } - public string[] kill_only_users { owned get { return manager.kill_only_users; } } - public string[] kill_exclude_users { owned get { return manager.kill_exclude_users; } } - public bool kill_user_processes { get { return manager.kill_user_processes; } } - public bool idle_hint { get { return manager.idle_hint; } } - public uint64 idle_since_hint { get { return manager.idle_since_hint; } } - public uint64 idle_since_hint_monotonic { get { return manager.idle_since_hint_monotonic; } } - public string block_inhibited { owned get { return manager.block_inhibited; } } - public string delay_inhibited { owned get { return manager.delay_inhibited; } } - public uint64 inhibit_delay_max_usec { get { return manager.inhibit_delay_max_usec; } } - public string handle_power_key { owned get { return manager.handle_power_key; } } - public string handle_suspend_key { owned get { return manager.handle_suspend_key; } } - public string handle_hibernate_key { owned get { return manager.handle_hibernate_key; } } - public string handle_lid_switch { owned get { return manager.handle_lid_switch; } } - public string idle_action { owned get { return manager.idle_action; } } - public uint64 idle_action_usec { get { return manager.idle_action_usec; } } - public bool preparing_for_shutdown { get { return manager.preparing_for_shutdown; } } - public bool preparing_for_sleep { get { return manager.preparing_for_sleep; } } - - public static async Manager get_system_manager () throws IOError { - return yield Manager.get_instance_for_path ( - (ObjectPath)org.freedesktop.login1.Manager.OBJECT_PATH); - } - - static async Manager get_instance_for_path (ObjectPath path) throws IOError { - if (object_map != null && object_map.contains (path)) { - return object_map[path]; - } - return yield new_async (path); - } - - static async Manager new_async (ObjectPath path) throws IOError { - var instance = new Manager (); - instance.path = path; - instance.manager = yield Bus.get_proxy (BusType.SYSTEM, - org.freedesktop.login1.SERVICE_NAME, path); - instance.properties = yield Bus.get_proxy (BusType.SYSTEM, - org.freedesktop.login1.SERVICE_NAME, path); - object_map[path] = instance; - weak Manager weak_instance = instance; - //instance.manager.session_new.connect ((id, path) => weak_instance.on_session_new.begin (id, path)); - //instance.manager.session_removed.connect ((id, path) => weak_instance.on_session_removed.begin (id, path)); - //instance.manager.user_new.connect ((id, path) => weak_instance.on_user_new.begin (id, path)); - //instance.manager.user_removed.connect ((id, path) => weak_instance.on_user_removed.begin (id, path)); - //instance.manager.seat_new.connect ((id, path) => weak_instance.on_seat_new.begin (id, path)); - //instance.manager.seat_removed.connect ((id, path) => weak_instance.on_seat_removed.begin (id, path)); - instance.manager.prepare_for_shutdown.connect ((before) => weak_instance.on_prepare_for_shutdown (before)); - instance.manager.prepare_for_sleep.connect ((before) => weak_instance.on_prepare_for_sleep (before)); - instance.properties.properties_changed.connect (weak_instance.on_properties_changed); - return instance; - } - - ~Manager () { - object_map.remove (path); - } - - //public async ObjectPath get_session (string id) throws IOError; - //public async ObjectPath get_session_by_pid (uint process_id) throws IOError; - //public async ObjectPath get_user (uint32 user_id) throws IOError; - //public async ObjectPath get_user_by_pid (uint pid) throws IOError; - //public async ObjectPath get_seat (string seat_id) throws IOError; - //public async SessionInfo[] list_sessions () throws IOError; - //public async UserInfo[] list_users () throws IOError; - //public async SeatInfo[] list_seats () throws IOError; - //public async SeatInfo[] list_inhibitors () throws IOError; - public async void activate_session (string session_id) throws DBusError, IOError { - yield manager.activate_session (session_id); - } - public async void activate_session_on_seat (string session_id, string seat_id) throws DBusError, IOError { - yield manager.activate_session_on_seat (session_id, seat_id); - } - public async void lock_session (string session_id) throws DBusError, IOError { - yield manager.lock_session (session_id); - } - public async void unlock_session (string session_id) throws DBusError, IOError { - yield manager.unlock_session (session_id); - } - public async void lock_sessions () throws DBusError, IOError { - yield manager.lock_sessions (); - } - public async void unlock_sessions () throws DBusError, IOError { - yield manager.unlock_sessions (); - } - public async void kill_session (string session_id, SessionToKill session, int32 @signal = Posix.Signal.TERM) throws DBusError, IOError { - yield manager.kill_session (session_id, session, @signal); - } - public async void kill_user (uint32 user_id, int32 @signal = Posix.Signal.TERM) throws DBusError, IOError { - yield manager.kill_user (user_id, @signal); - } - public async void terminate_session (string session_id) throws DBusError, IOError { - yield manager.terminate_session (session_id); - } - public async void terminate_user (uint32 user_id) throws DBusError, IOError { - yield manager.terminate_user (user_id); - } - public async void terminate_seat (string seat_id) throws DBusError, IOError { - yield manager.terminate_seat (seat_id); - } - public async void set_user_linger (uint32 user_id, bool enable, bool interactive = false) throws DBusError, IOError { - yield manager.set_user_linger (user_id, enable, interactive); - } - public async void attach_Device (string seat_id, string sysfs_path, bool interactive = false) throws DBusError, IOError { - yield manager.attach_Device (seat_id, sysfs_path, interactive); - } - public async void flush_devices (bool interactive = false) throws DBusError, IOError { - yield manager.flush_devices (interactive); - } - public async void power_off (bool interactive = false) throws DBusError, IOError { - yield manager.power_off (interactive); - } - public async void reboot (bool interactive = false) throws DBusError, IOError { - yield manager.reboot (interactive); - } - public async void suspend (bool interactive = false) throws DBusError, IOError { - yield manager.suspend (interactive); - } - public async void hibernate (bool interactive = false) throws DBusError, IOError { - yield manager.hibernate (interactive); - } - public async void hybrid_sleep (bool interactive = false) throws DBusError, IOError { - yield manager.hybrid_sleep (interactive); - } - public async CanResponse can_power_off () throws DBusError, IOError { - return yield manager.can_power_off (); - } - public async CanResponse can_reboot () throws DBusError, IOError { - return yield manager.can_reboot (); - } - public async CanResponse can_suspend () throws DBusError, IOError { - return yield manager.can_suspend (); - } - public async CanResponse can_hybrid_sleep () throws DBusError, IOError { - return yield manager.can_hybrid_sleep (); - } - // FIXME: this fails to build in stretch - // logind-interfaces.c: In function 'org_freedesktop_login1_manager_proxy_inhibit_async': - // logind-interfaces.c:3185:2: error: '_fd_list' undeclared (first use in this function) -#if 0 - public async UnixInputStream inhibit (string who, string what, string why, InhibitMode mode) throws DBusError, IOError { - return yield manager.inhibit (who, what, why, mode); - } -#endif -/* - public signal void session_new (string session_id, Session session); - async void on_session_new (string session_id, ObjectPath path) { - var session = yield Session.get_instance_for_path (path); - session_new (session_id, session); - } - public signal void session_removed (string session_id, Session session); - async void on_session_removed (string session_id, ObjectPath path) { - var session = yield Session.get_instance_for_path (path); - session_removed (session_id, session); - } - public signal void user_new (uint32 user_id, User user); - async void on_user_new (uint32 user_id, ObjectPath path) { - var user = yield User.get_instance_for_path (path); - user_new (user_id, user); - } - public signal void user_removed (uint32 user_id, User user); - async void on_user_removed (uint32 user_id, ObjectPath path) { - var user = yield User.get_instance_for_path (path); - user_removed (user_id, user); - } - public signal void seat_new (string seat_id, Seat seat); - async void on_seat_new (string seat_id, ObjectPath path) { - var seat = yield Seat.get_instance_for_path (path); - seat_new (seat_id, seat); - } - public signal void seat_removed (string seat_id, Seat seat); - async void on_seat_removed (string seat_id, ObjectPath path) { - var seat = yield Seat.get_instance_for_path (path); - seat_removed (seat_id, seat); - } -*/ - public signal void prepare_for_shutdown (bool before_shutdown); - void on_prepare_for_shutdown (bool before_shutdown) { - (before_shutdown); - } - public signal void prepare_for_sleep (bool before_shutdown); - void on_prepare_for_sleep (bool before_shutdown) { - (before_shutdown); - } - - void on_properties_changed (string iface, HashTable changed_properties, string[] invalidated_properties) - { - changed_properties.foreach ((k, v) => { - notify_dbus_property (k); - }); - foreach (var property in invalidated_properties) { - notify_dbus_property (property); - } - } - - void notify_dbus_property (string property) { - switch (property) { - // Most properties are constants - case "IdleHint": - notify_property ("idle-hint"); - break; - case "IdleSinceHint": - notify_property ("idle-since-hint"); - break; - case "IdleSinceHintMonotonic": - notify_property ("idle-since-hint-monotonic"); - break; - case "BlockInhibited": - notify_property ("block-inhibited"); - break; - case "DelayInhibited": - notify_property ("delay-inhibited"); - break; - } - } - } -} \ No newline at end of file diff --git a/lib/systemd/Systemd.vala b/lib/systemd/Systemd.vala deleted file mode 100644 index ffd9061..0000000 --- a/lib/systemd/Systemd.vala +++ /dev/null @@ -1,902 +0,0 @@ -/* - * systemd -- vala bindings for systemd d-bus - * - * Copyright (C) 2014-2015 David Lechner - * - * 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 . - */ - -namespace Systemd { - [DBus (use_string_marshalling = true)] - public enum UnitMode { - [DBus (value = "replace")] - REPLACE, - [DBus (value = "fail")] - FAIL, - [DBus (value = "isolate")] - ISOLATE, - [DBus (value = "ignore-dependencies")] - IGNORE_DEPENENCIES, - [DBus (value = "ignore-requirements")] - IGNORE_REQUIREMENTS; - - public static extern UnitMode from_string (string value) throws DBusError; - } - - [DBus (use_string_marshalling = true)] - public enum UnitActiveState { - [DBus (value = "active")] - ACTIVE, - [DBus (value = "reloading")] - RELOADING, - [DBus (value = "inactive")] - INACTIVE, - [DBus (value = "failed")] - FAILED, - [DBus (value = "activating")] - ACTIVATING, - [DBus (value = "deactivating")] - DEACTIVATING; - - public static extern UnitActiveState from_string (string value) throws DBusError; - } - - [DBus (use_string_marshalling = true)] - public enum UnitFileState { - [DBus (value = "enabled")] - ENABLED, - [DBus (value = "enabled-runtime")] - ENABLED_RUNTIME, - [DBus (value = "linked")] - LINKED, - [DBus (value = "linked-runtime")] - LINKED_RUNTIME, - [DBus (value = "masked")] - MASKED, - [DBus (value = "masked-runtime")] - MASKED_RUNTIME, - [DBus (value = "static")] - STATIC, - [DBus (value = "disabled")] - DISABLED, - [DBus (value = "invalid")] - INVALID; - - public static extern UnitFileState from_string (string value) throws DBusError; - } - - [DBus (use_string_marshalling = true)] - public enum JobResult { - [DBus (value = "done")] - DONE, - [DBus (value = "canceled")] - CANCELED, - [DBus (value = "timeout")] - TIMEOUT, - [DBus (value = "failed")] - FAILED, - [DBus (value = "dependency")] - DEPENDENCY, - [DBus (value = "skipped")] - SKIPPED; - - public static extern JobResult from_string (string value) throws DBusError; - } - - [DBus (use_string_marshalling = true)] - public enum Who { - [DBus (value = "main")] - MAIN, - [DBus (value = "control")] - CONTROL, - [DBus (value = "all")] - ALL; - - public static extern Who from_string (string value) throws DBusError; - } - - [DBus (use_string_marshalling = true)] - public enum UnitLinkChangeType { - [DBus (value = "symlink")] - SYMLINK, - [DBus (value = "unlink")] - UNLINK; - - public static extern UnitLinkChangeType from_string (string value) throws DBusError; - } - - public struct UnitFileInfo { - string name; - UnitFileState state; - } - - public struct UnitLinkChangeInfo { - UnitLinkChangeType change_type; - string symlink_name; - string destination_name; - } - - public class UnitInfo { - org.freedesktop.systemd1.Manager.UnitInfo info; - - public string id { get { return info.id; } } - public string description { get { return info.description; } } - public string load_state { get { return info.load_state; } } - public string active_state { get { return info.active_state; } } - public string sub_state { get { return info.sub_state; } } - public string following { get { return info.following; } } - public Unit unit { get; private set; } - public uint32 job_id { get { return info.job_id; } } - public string job_type { get { return info.job_type; } } - public Job job { get; private set; } - - public static async UnitInfo new_async (org.freedesktop.systemd1.Manager.UnitInfo info) throws IOError { - var instance = new UnitInfo (); - instance.info = info; - instance._unit = yield Unit.get_instance_for_path (info.unit_path); - instance._job = yield Job.get_instance_for_path (info.job_path); - return instance; - } - } - - public class JobInfo { - org.freedesktop.systemd1.Manager.JobInfo info; - - public uint32 id { get { return info.id; } } - public string name { get { return info.name; } } - public string type_ { get { return info.type; } } - public string state { get { return info.state; } } - public Job job { get; private set; } - public Unit unit { get; private set; } - - internal static async JobInfo new_async (org.freedesktop.systemd1.Manager.JobInfo info) throws IOError { - var instance = new JobInfo (); - instance.info = info; - instance._job = yield Job.get_instance_for_path (info.job_path); - instance._unit = yield Unit.get_instance_for_path (info.unit_path); - return instance; - } - } - - public class Manager : Object { - static HashTable object_map; - - static construct { - object_map = new HashTable (str_hash, str_equal); - } - - ObjectPath path; - org.freedesktop.systemd1.Manager manager; - org.freedesktop.DBus.Properties properties; - - public static async Manager get_system_manager () throws IOError { - return yield Manager.get_instance_for_path ( - new ObjectPath (org.freedesktop.systemd1.Manager.OBJECT_PATH)); - } - - static async Manager get_instance_for_path (ObjectPath path) throws IOError { - if (object_map != null && object_map.contains (path)) { - return object_map[path]; - } - return yield new_async (path); - } - - static async Manager new_async (ObjectPath path) throws IOError { - var instance = new Manager (); - instance.path = path; - instance.manager = yield Bus.get_proxy (BusType.SYSTEM, - org.freedesktop.systemd1.SERVICE_NAME, path); - instance.properties = yield Bus.get_proxy (BusType.SYSTEM, - org.freedesktop.systemd1.SERVICE_NAME, path); - object_map[path] = instance; - weak Manager weak_instance = instance; - instance.manager.unit_new.connect ((id, path) => weak_instance.on_unit_new.begin (id, path)); - instance.manager.unit_removed.connect ((id, path) => weak_instance.on_unit_removed.begin (id, path)); - instance.manager.job_new.connect ((id, path, unit) => weak_instance.on_job_new.begin (id, path, unit)); - instance.manager.job_removed.connect ((id, path, unit, result) => weak_instance.on_job_removed.begin (id, path, unit, result)); - instance.properties.properties_changed.connect (weak_instance.on_properties_changed); - return instance; - } - - ~Manager () { - object_map.remove (path); - } - - public string[] environment { owned get { return manager.environment; } } - - /** - * Get the unit object path for a unit name. - * @param name The unit name - * @return A Unit object. - * @throws IOError Unit has not been loaded yet or DBus error - */ - public async Unit get_unit (string name) throws DBusError, IOError { - var path = yield manager.get_unit (name); - return yield Unit.get_instance_for_path (path); - } - - public async Unit get_unit_by_pid (uint32 pid) throws DBusError, IOError { - var path = yield manager.get_unit_by_pid (pid); - return yield Unit.get_instance_for_path (path); - } - - public async Unit load_unit (string name) throws DBusError, IOError { - var path = yield manager.load_unit (name); - return yield Unit.get_instance_for_path (path); - } - - public async Job start_unit (string name, UnitMode mode = UnitMode.REPLACE) throws DBusError, IOError { - var path = yield manager.start_unit (name, mode); - return yield Job.get_instance_for_path (path); - } - - public async Job start_unit_replace (string old_unit, string new_unit, UnitMode mode = UnitMode.REPLACE) throws DBusError, IOError { - var path = yield manager.start_unit_replace (old_unit, new_unit, mode); - return yield Job.get_instance_for_path (path); - } - - public async Job stop_unit (string name, UnitMode mode = UnitMode.REPLACE) throws DBusError, IOError { - var path = yield manager.stop_unit (name, mode); - return yield Job.get_instance_for_path (path); - } - - public async Job reload_unit (string name, UnitMode mode = UnitMode.REPLACE) throws DBusError, IOError { - var path = yield manager.reload_unit (name, mode); - return yield Job.get_instance_for_path (path); - } - - public async Job restart_unit (string name, UnitMode mode = UnitMode.REPLACE) throws DBusError, IOError{ - var path = yield manager.restart_unit (name, mode); - return yield Job.get_instance_for_path (path); - } - - public async Job try_restart_unit (string name, UnitMode mode = UnitMode.REPLACE) throws DBusError, IOError{ - var path = yield manager.try_restart_unit (name, mode); - return yield Job.get_instance_for_path (path); - } - - public async Job reload_or_restart_unit (string name, UnitMode mode = UnitMode.REPLACE) throws DBusError, IOError{ - var path = yield manager.reload_or_restart_unit (name, mode); - return yield Job.get_instance_for_path (path); - } - - public async Job reload_or_try_restart_unit (string name, UnitMode mode = UnitMode.REPLACE) throws DBusError, IOError{ - var path = yield manager.reload_or_try_restart_unit (name, mode); - return yield Job.get_instance_for_path (path); - } - - public async void kill_unit (string name, Who who, int32 @signal = Posix.Signal.KILL) throws DBusError, IOError { - yield manager.kill_unit (name, who, @signal); - } - - public async Job get_job (uint32 id) throws DBusError, IOError { - var path = yield manager.get_job (id); - return yield Job.get_instance_for_path (path); - } - - public async void clear_jobs () throws DBusError, IOError { - yield manager.clear_jobs (); - } - - public async void reset_failed_unit (string name) throws DBusError, IOError { - yield manager.reset_failed_unit (name); - } - - public async UnitInfo[] list_units () throws DBusError, IOError { - var units = yield manager.list_units (); - var result = new UnitInfo[units.length]; - var i = 0; - foreach (var info in units) { - result[i++] = yield UnitInfo.new_async (info); - } - return result; - } - - public async JobInfo[] list_jobs () throws DBusError, IOError { - var jobs = yield manager.list_jobs (); - var result = new JobInfo[jobs.length]; - var i = 0; - foreach (var job in jobs) { - result[i++] = yield JobInfo.new_async (job); - } - return result; - } - - public async void subscribe () throws DBusError, IOError { - yield manager.subscribe (); - } - - public async void unsubscribe () throws DBusError, IOError { - yield manager.unsubscribe (); - } - - public async Unit create_snapshot (string name, bool cleanup = true) throws DBusError, IOError { - var path = yield manager.create_snapshot (name, cleanup); - return yield Unit.get_instance_for_path (path); - } - - public async void remove_snapshot (string name) throws DBusError, IOError { - yield manager.remove_snapshot (name); - } - - public async void reload () throws DBusError, IOError { - yield manager.reload (); - } - public async void reexecute () throws DBusError, IOError { - yield manager.reexecute (); - } - public async void exit () throws DBusError, IOError { - yield manager.exit (); - } - - public async void set_environment (string[] names) throws DBusError, IOError { - yield manager.set_environment (names); - } - public async void unset_environment (string[] names) throws DBusError, IOError { - yield manager.unset_environment (names); - } - - public async void unset_and_set_environment (string[] unset, string[] @set) throws DBusError, IOError { - yield manager.unset_and_set_environment (unset, @set); - } - - public async UnitFileInfo[] list_unit_files () throws DBusError, IOError { - var info = yield manager.list_unit_files (); - var result = new UnitFileInfo[info.length]; - for (int i = 0; i < info.length; i++) { - result[i].name = info[i].name; - try { - result[i].state = UnitFileState.from_string (info[i].state); - } catch (DBusError err) { - critical (err.message); - } - } - return result; - } - - public async UnitFileState get_unit_file_state (string file) throws DBusError, IOError { - return yield manager.get_unit_file_state (file); - } - - /** - * Enables one or more units in the system (by creating symlinks to them - * in /etc or /run). - * - * @param files List of unit files to enable (either just file names or - * full absolute paths if the unit files are residing outside the usual - * unit search paths). - * @param runtime Whether the unit shall be enabled for runtime only - * (true, /run), or persistently (false, /etc). - * @param force Whether symlinks pointing to other units shall be - * replaced if necessary. - * @param carries_install_info Signals whether the unit files contained - * any enablement information (i.e. an [Install]) section. - * @return The changes list. - */ - public async UnitLinkChangeInfo[] enable_unit_files (string[] files, bool runtime = false, bool force = false, out bool carries_install_info) throws DBusError, IOError { - var info = yield manager.enable_unit_files (files, runtime, force, out carries_install_info); - return marshal_unit_link_change_info (info); - } - - public async UnitLinkChangeInfo[] disable_unit_files (string[] files, bool runtime = false) throws DBusError, IOError { - var info = yield manager.disable_unit_files (files, runtime); - return marshal_unit_link_change_info (info); - } - - public async UnitLinkChangeInfo[] reenable_unit_files (string[] files, bool runtime = false, bool force = false, out bool carries_install_info) throws DBusError, IOError { - var info = yield manager.reenable_unit_files (files, runtime, force, out carries_install_info); - return marshal_unit_link_change_info (info); - } - - public async UnitLinkChangeInfo[] link_unit_files (string[] files, bool runtime = false) throws DBusError, IOError { - var info = yield manager.link_unit_files (files, runtime); - return marshal_unit_link_change_info (info); - } - - public async UnitLinkChangeInfo[] preset_unit_files (string[] files, bool runtime = false, bool force = false, out bool carries_install_info) throws DBusError, IOError { - var info = yield manager.preset_unit_files (files, runtime, force, out carries_install_info); - return marshal_unit_link_change_info (info); - } - - public async UnitLinkChangeInfo[] mask_unit_files (string[] files, bool runtime = false) throws DBusError, IOError { - var info = yield manager.mask_unit_files (files, runtime); - return marshal_unit_link_change_info (info); - } - - public async UnitLinkChangeInfo[] unmask_unit_files (string[] files, bool runtime = false) throws DBusError, IOError { - var info = yield manager.unmask_unit_files (files, runtime); - return marshal_unit_link_change_info (info); - } - - public async UnitLinkChangeInfo[] set_default_target (string[] files) throws DBusError, IOError { - var info = yield manager.set_default_target (files); - return marshal_unit_link_change_info (info); - } - - public async string get_default_target () throws DBusError, IOError { - return yield manager.get_default_target (); - } - -// public async void set_unit_properties (string name, bool runtime, UnitProperty[] properties) throws DBusError, IOError { -// yield manager.set_unit_properties (name, runtime, properties); -// } - -// public async Unit start_transiend_unit (string name, string mode, UnitProperty[] properties, UnitPropertyGroup[] aux) throws DBusError, IOError { -// var path = yield manager.start_transiend_unit (name, mode, properties, aux); -// return yield Unit.get_instance_from_path (path); -// } - - public signal void unit_new (string id); - async void on_unit_new (string id, ObjectPath path) { - unit_new (id); - } - - public signal void unit_removed (string id); - async void on_unit_removed (string id, ObjectPath path) { - unit_removed (id); - } - - public signal void job_new (uint32 id, Job job, string unit); - async void on_job_new (uint32 id, ObjectPath path, string unit) { - try { - var job = yield Job.get_instance_for_path (path); - job_new (id, job, unit); - } catch (IOError err) { - critical (err.message); - } - } - public signal void job_removed (uint32 id, string unit, JobResult result); - async void on_job_removed (uint32 id, ObjectPath path, string unit, JobResult result) { - job_removed (id, unit, result); - } - - UnitLinkChangeInfo[] marshal_unit_link_change_info (org.freedesktop.systemd1.Manager.UnitLinkChangeInfo[] info) { - var result = new UnitLinkChangeInfo[info.length]; - for (int i = 0; i < info.length; i++) { - try { - result[i].change_type = UnitLinkChangeType.from_string (info[i].change_type); - } catch (DBusError err) { - critical (err.message); - } - result[i].symlink_name = info[i].symlink_name; - result[i].destination_name = info[i].destination_name; - i++; - } - return result; - } - - void on_properties_changed (string iface, HashTable changed_properties, string[] invalidated_properties) - { - //foreach (var property in invalidated_properties) - // TODO: no properties in this class yet - } - } -/* - [Compact] - public class JobLink { - org.freedesktop.systemd1.Unit.JobLink job_link; - - public uint32 id { get { return id; } } - public Job job { get; private set; } - - public static async JobLink new_async (org.freedesktop.systemd1.Unit.JobLink job_link) throws DBusError, IOError { - var instance = new JobLink (); - instance.job_link = job_link; - instance._job = yield Job.get_instance_for_path (job_link.path); - return instance; - } - } -*/ - public class Unit : Object { - static HashTable object_map; - - static construct { - object_map = new HashTable (str_hash, str_equal); - } - - ObjectPath path; - org.freedesktop.systemd1.Unit unit; - org.freedesktop.DBus.Properties properties; - - public string id { owned get { return unit.id; } } - public string[] names { owned get { return unit.names; } } - public string following { owned get { return unit.following; } } - public string[] requires { owned get { return unit.requires; } } - public string[] requires_overridable { owned get { return unit.requires_overridable; } } - public string[] requisite { owned get { return unit.requisite; } } - public string[] requisite_overridable { owned get { return unit.requisite_overridable; } } - public string[] wants { owned get { return unit.wants; } } - public string[] required_by { owned get { return unit.required_by; } } - public string[] required_by_overridable { owned get { return unit.required_by_overridable; } } - public string[] wanted_by { owned get { return unit.wanted_by; } } - public string[] conflicts { owned get { return unit.conflicts; } } - public string[] conflicted_by { owned get { return unit.conflicted_by; } } - public string[] before { owned get { return unit.before; } } - public string[] after { owned get { return unit.after; } } - public string[] on_failure { owned get { return unit.on_failure; } } - public string description { owned get { return unit.description; } } - public string load_state { owned get { return unit.load_state; } } - public UnitActiveState active_state { get { return unit.active_state; } } - public string sub_state { owned get { return unit.sub_state; } } - public string fragment_path { owned get { return unit.fragment_path; } } - public UnitFileState unit_file_state { get { return unit.unit_file_state; } } - public uint64 inactive_exit_timestamp { get { return unit.inactive_exit_timestamp; } } - public uint64 active_enter_timestamp { get { return unit.active_enter_timestamp; } } - public uint64 active_exit_timestamp { get { return unit.active_exit_timestamp; } } - public uint64 inactive_enter_timestamp { get { return unit.inactive_enter_timestamp; } } - public bool can_start { get { return unit.can_start; } } - public bool can_stop { get { return unit.can_stop; } } - public bool can_reload { get { return unit.can_reload; } } - //public JobLink job { owned get { return new JobLink (unit.job); } } - public bool recursive_stop { get { return unit.recursive_stop; } } - public bool stop_when_unneeded { get { return unit.stop_when_unneeded; } } - public bool refuse_manual_start { get { return unit.refuse_manual_start; } } - public bool refuse_manual_stop { get { return unit.refuse_manual_stop; } } - public bool default_dependencies { get { return unit.default_dependencies; } } - public string default_control_group { owned get { return unit.default_control_group; } } - public string[] control_groups { owned get { return unit.control_groups; } } - public bool need_daemon_reload { get { return unit.need_daemon_reload; } } - public uint64 job_timeout_usec { get { return unit.job_timeout_usec; } } - - internal static async Unit get_instance_for_path (ObjectPath path) throws IOError { - if (object_map != null && object_map.contains (path)) { - return object_map[path]; - } - return yield new_async (path); - } - - static async Unit new_async (ObjectPath path) throws IOError { - var instance = new Unit (); - instance.path = path; - instance.unit = yield Bus.get_proxy (BusType.SYSTEM, - org.freedesktop.systemd1.SERVICE_NAME, path); - instance.properties = yield Bus.get_proxy (BusType.SYSTEM, - org.freedesktop.systemd1.SERVICE_NAME, path); - object_map[path] = instance; - instance.properties.properties_changed.connect (instance.on_properties_changed); - return instance; - } - - ~Unit () { - object_map.remove (path); - } - - public async Job start (UnitMode mode = UnitMode.REPLACE) throws DBusError, IOError { - var path = yield unit.start (mode); - return yield Job.get_instance_for_path (path); - } - public async Job stop (UnitMode mode = UnitMode.REPLACE) throws DBusError, IOError { - var path = yield unit.stop (mode); - return yield Job.get_instance_for_path (path); - } - public async Job reload (UnitMode mode = UnitMode.REPLACE) throws DBusError, IOError { - var path = yield unit.reload (mode); - return yield Job.get_instance_for_path (path); - } - public async Job restart (UnitMode mode = UnitMode.REPLACE) throws DBusError, IOError { - var path = yield unit.restart (mode); - return yield Job.get_instance_for_path (path); - } - public async Job try_restart (UnitMode mode = UnitMode.REPLACE) throws DBusError, IOError { - var path = yield unit.try_restart (mode); - return yield Job.get_instance_for_path (path); - } - public async Job reload_or_restart (UnitMode mode = UnitMode.REPLACE) throws DBusError, IOError { - var path = yield unit.reload_or_restart (mode); - return yield Job.get_instance_for_path (path); - } - public async Job reload_or_try_restart (UnitMode mode = UnitMode.REPLACE) throws DBusError, IOError { - var path = yield unit.reload_or_try_restart (mode); - return yield Job.get_instance_for_path (path); - } - - public async void reset_failed () throws DBusError, IOError { - yield unit.reset_failed (); - } - - void on_properties_changed (string iface, HashTable changed_properties, string[] invalidated_properties) - { - changed_properties.foreach ((k, v) => { - notify_dbus_property (k); - }); - foreach (var property in invalidated_properties) { - notify_dbus_property (property); - } - } - - void notify_dbus_property (string property) { - switch (property) { - case "Id": - notify_property ("id"); - break; - case "Names": - notify_property ("names"); - break; - case "Following": - notify_property ("following"); - break; - case "Requires": - notify_property ("requires"); - break; - case "RequiresOverridable": - notify_property ("requires-overridable"); - break; - case "Requisite": - notify_property ("requisite"); - break; - case "RequisiteOverridable": - notify_property ("requisite-overridable"); - break; - case "Wants": - notify_property ("wants"); - break; - case "BindsTo": - notify_property ("binds-to"); - break; - case "PartOf": - notify_property ("part-of"); - break; - case "RequiredBy": - notify_property ("required-by"); - break; - case "RequiredByOverridable": - notify_property ("required-by-overridable"); - break; - case "WantedBy": - notify_property ("wanted-by"); - break; - case "BoundBy": - notify_property ("bound-by"); - break; - case "ConsistsOf": - notify_property ("consists-of"); - break; - case "Conflicts": - notify_property ("conflicts"); - break; - case "ConflictedBy": - notify_property ("conflicted-by"); - break; - case "Before": - notify_property ("before"); - break; - case "After": - notify_property ("after"); - break; - case "OnFailure": - notify_property ("on-failure"); - break; - case "Triggers": - notify_property ("triggers"); - break; - case "TriggeredBy": - notify_property ("triggered-by"); - break; - case "PropagatesReloadTo": - notify_property ("propagates-reload-to"); - break; - case "ReloadPropagatedFrom": - notify_property ("reload-propagated-from"); - break; - case "RequiresMountsFor": - notify_property ("requires-mounts-for"); - break; - case "Description": - notify_property ("description"); - break; - case "SourcePath": - notify_property ("source-path"); - break; - case "DropInPaths": - notify_property ("drop-in-paths"); - break; - case "Documentation": - notify_property ("documentation"); - break; - case "LoadState": - notify_property ("load-state"); - break; - case "ActiveState": - notify_property ("active-state"); - break; - case "SubState": - notify_property ("sub-state"); - break; - case "FragmentPath": - notify_property ("fragment-path"); - break; - case "UnitFileState": - notify_property ("unit-file-state"); - break; - case "InactiveExitTimestamp": - notify_property ("inactive-exit-timestamp"); - break; - // case "InactiveExitTimestampMonotonic": - // notify_property ("inactive-exit-timestamp-monotonic"); - // break; - case "ActiveEnterTimestamp": - notify_property ("active-enter-timestamp"); - break; - // case "ActiveEnterTimestampMonotonic": - // notify_property ("active-enter-timestamp-monotonic"); - // break; - case "ActiveExitTimestamp": - notify_property ("active-exit-timestamp"); - break; - // case "ActiveExitTimestampMonotonic": - // notify_property ("active-exit-timestamp-monotonic"); - // break; - case "InactiveEnterTimestamp": - notify_property ("inactive-enter-timestamp"); - break; - // case "InactiveEnterTimestampMonotonic": - // notify_property ("inactive-enter-timestamp-monotonic"); - // break; - case "CanStart": - notify_property ("can-start"); - break; - case "CanStop": - notify_property ("can-stop"); - break; - case "CanReload": - notify_property ("can-reload"); - break; - case "CanIsolate": - notify_property ("can-isolate"); - break; - // case "Job": - // notify_property ("job"); - // break; - case "StopWhenUnneeded": - notify_property ("stop-when-unneeded"); - break; - case "RefuseManualStart": - notify_property ("refuse-manual-start"); - break; - case "RefuseManualStop": - notify_property ("refuse-manual-stop"); - break; - case "AllowIsolate": - notify_property ("allow-isolate"); - break; - case "DefaultDependencies": - notify_property ("default-dependencies"); - break; - case "OnFailureIsolate": - notify_property ("on-failure-isolate"); - break; - case "IgnoreOnIsolate": - notify_property ("ignore-on-isolate"); - break; - case "IgnoreOnSnapshot": - notify_property ("ignore-on-snapshot"); - break; - case "NeedDaemonReload": - notify_property ("need-daemon-reload"); - break; - case "JobTimeoutUSec": - notify_property ("job-timeout-usec"); - break; - // case "ConditionTimestamp": - // notify_property ("condition-timestamp"); - // break; - // case "ConditionTimestampMonotonic": - // notify_property ("condition-timestamp-monotonic"); - // break; - // case "ConditionResult": - // notify_property ("condition-result"); - // break; - // case "Conditions": - // notify_property ("conditions"); - // break; - // case "LoadError": - // notify_property ("load-error"); - // break; - // case "Transient": - // notify_property ("transient"); - // break; - } - } - } - -/* - [Compact] - public class UnitLink { - org.freedesktop.systemd1.Job.UnitLink unit_link; - - public uint32 id { get { return id; } } - public Unit unit { get; private set; } - - public static async UnitLink new_async (org.freedesktop.systemd1.Job.UnitLink unit_link) throws IOError { - var instance = new UnitLink (); - instance.unit_link = unit_link; - instance._unit = yield Unit.get_instance_for_path (unit_link.path); - return instance; - } - } -*/ - public class Job : Object { - static HashTable object_map; - - static construct { - object_map = new HashTable (str_hash, str_equal); - } - - ObjectPath path; - org.freedesktop.systemd1.Job job; - org.freedesktop.DBus.Properties properties; - - public uint32 id { get { return job.id; } } - public string state { owned get { return job.state; } } - public string job_type { owned get { return job.job_type; } } - //public UnitLink unit { owned get { return new UnitLink (job.unit); } } - - internal static async Job get_instance_for_path (ObjectPath path) throws IOError { - if (object_map != null && object_map.contains (path)) { - return object_map[path]; - } - return yield new_async (path); - } - - static async Job new_async (ObjectPath path) throws IOError { - var instance = new Job (); - instance.path = path; - instance.job = yield Bus.get_proxy (BusType.SYSTEM, - org.freedesktop.systemd1.SERVICE_NAME, path); - instance.properties = yield Bus.get_proxy (BusType.SYSTEM, - org.freedesktop.systemd1.SERVICE_NAME, path); - object_map[path] = instance; - instance.properties.properties_changed.connect (instance.on_properties_changed); - return instance; - } - - ~Job () { - object_map.remove (path); - } - - public async void cancel () throws DBusError, IOError { - yield job.cancel (); - } - - void on_properties_changed (string iface, HashTable changed_properties, string[] invalidated_properties) - { - changed_properties.foreach ((k, v) => { - notify_dbus_property (k); - }); - foreach (var property in invalidated_properties) { - notify_dbus_property (property); - } - } - - void notify_dbus_property (string property) { - switch (property) { - case "Id": - notify_property ("id"); - break; - // case "Unit": - // notify_property ("unit"); - // break; - case "JobType": - notify_property ("job-type"); - break; - case "State": - notify_property ("state"); - break; - } - } - } -} \ No newline at end of file diff --git a/lib/systemd/logind-interfaces.vala b/lib/systemd/logind-interfaces.vala deleted file mode 100644 index f01180c..0000000 --- a/lib/systemd/logind-interfaces.vala +++ /dev/null @@ -1,123 +0,0 @@ -/* - * systemd -- vala bindings for systemd d-bus - * - * Copyright (C) 2014 David Lechner - * - * 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 . - */ - -namespace org.freedesktop.login1 { - public const string SERVICE_NAME = "org.freedesktop.login1"; - - [DBus (name = "org.freedesktop.login1.Manager")] - public interface Manager : DBusProxy { - public const string OBJECT_PATH = "/org/freedesktop/login1"; - - public struct SessionInfo { - string id; - uint32 user_id; - string user_name; - string seat_id; - ObjectPath session; - } - - public struct UserInfo { - uint32 id; - string name; - ObjectPath user; - } - - public struct SeatInfo { - string id; - ObjectPath seat; - } - - public struct InhibitorInfo { - string what; - string who; - string why; - string mode; - uint32 user_id; - uint32 process_id; - } - - public abstract async ObjectPath get_session (string id) throws DBusError, IOError; - public abstract async ObjectPath get_session_by_pid (uint process_id) throws DBusError, IOError; - public abstract async ObjectPath get_user (uint32 user_id) throws DBusError, IOError; - public abstract async ObjectPath get_user_by_pid (uint pid) throws DBusError, IOError; - public abstract async ObjectPath get_seat (string seat_id) throws DBusError, IOError; - public abstract async SessionInfo[] list_sessions () throws DBusError, IOError; - public abstract async UserInfo[] list_users () throws DBusError, IOError; - public abstract async SeatInfo[] list_seats () throws DBusError, IOError; - public abstract async SeatInfo[] list_inhibitors () throws DBusError, IOError; - public abstract async void activate_session (string session_id) throws DBusError, IOError; - public abstract async void activate_session_on_seat (string session_id, string seat_id) throws DBusError, IOError; - public abstract async void lock_session (string session_id) throws DBusError, IOError; - public abstract async void unlock_session (string session_id) throws DBusError, IOError; - public abstract async void lock_sessions () throws DBusError, IOError; - public abstract async void unlock_sessions () throws DBusError, IOError; - public abstract async void kill_session (string session_id, Systemd.Logind.SessionToKill session, int32 @signal) throws DBusError, IOError; - public abstract async void kill_user (uint32 user_id, int32 @signal) throws DBusError, IOError; - public abstract async void terminate_session (string session_id) throws DBusError, IOError; - public abstract async void terminate_user (uint32 user_id) throws DBusError, IOError; - public abstract async void terminate_seat (string seat_id) throws DBusError, IOError; - public abstract async void set_user_linger (uint32 user_id, bool enable, bool interactive) throws DBusError, IOError; - public abstract async void attach_Device (string seat_id, string sysfs_path, bool interactive) throws DBusError, IOError; - public abstract async void flush_devices (bool interactive) throws DBusError, IOError; - public abstract async void power_off (bool interactive) throws DBusError, IOError; - public abstract async void reboot (bool interactive) throws DBusError, IOError; - public abstract async void suspend (bool interactive) throws DBusError, IOError; - public abstract async void hibernate (bool interactive) throws DBusError, IOError; - public abstract async void hybrid_sleep (bool interactive) throws DBusError, IOError; - public abstract async Systemd.Logind.CanResponse can_power_off () throws DBusError, IOError; - public abstract async Systemd.Logind.CanResponse can_reboot () throws DBusError, IOError; - public abstract async Systemd.Logind.CanResponse can_suspend () throws DBusError, IOError; - public abstract async Systemd.Logind.CanResponse can_hybrid_sleep () throws DBusError, IOError; - // FIXME: This does not build on stretch - // logind-interfaces.c: In function 'org_freedesktop_login1_manager_proxy_inhibit_async': - // logind-interfaces.c:3185:2: error: '_fd_list' undeclared (first use in this function) -#if 0 - public abstract async UnixInputStream inhibit (string who, string what, string why, Systemd.Logind.InhibitMode mode) throws DBusError, IOError; -#endif - - public abstract signal void session_new (string session_id, ObjectPath session); - public abstract signal void session_removed (string session_id, ObjectPath session); - public abstract signal void user_new (uint32 user_id, ObjectPath user); - public abstract signal void user_removed (uint32 user_id, ObjectPath user); - public abstract signal void seat_new (string seat_id, ObjectPath seat); - public abstract signal void seat_removed (string seat_id, ObjectPath seat); - public abstract signal void prepare_for_shutdown (bool before_shutdown); - public abstract signal void prepare_for_sleep (bool before_shutdown); - - [DBus (name = "NAutoVTs")] - public abstract uint32 auto_vt_count { get; } - public abstract string[] kill_only_users { owned get; } - public abstract string[] kill_exclude_users { owned get; } - public abstract bool kill_user_processes { get; } - public abstract bool idle_hint { get; } - public abstract uint64 idle_since_hint { get; } - public abstract uint64 idle_since_hint_monotonic { get; } - public abstract string block_inhibited { owned get; } - public abstract string delay_inhibited { owned get; } - public abstract uint64 inhibit_delay_max_usec { get; } - public abstract string handle_power_key { owned get; } - public abstract string handle_suspend_key { owned get; } - public abstract string handle_hibernate_key { owned get; } - public abstract string handle_lid_switch { owned get; } - public abstract string idle_action { owned get; } - public abstract uint64 idle_action_usec { get; } - public abstract bool preparing_for_shutdown { get; } - public abstract bool preparing_for_sleep { get; } - } -} diff --git a/lib/systemd/systemd-interfaces.vala b/lib/systemd/systemd-interfaces.vala deleted file mode 100644 index 5d904e3..0000000 --- a/lib/systemd/systemd-interfaces.vala +++ /dev/null @@ -1,257 +0,0 @@ -/* - * systemd -- vala bindings for systemd d-bus - * - * Copyright (C) 2014 David Lechner - * - * This file *was* part of systemd - * - * Copyright 2010 Lennart Poettering - * - * 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 . - */ - -namespace org.freedesktop.systemd1 { - public const string SERVICE_NAME = "org.freedesktop.systemd1"; - - [DBus (name = "org.freedesktop.systemd1.Manager")] - public interface Manager : DBusProxy { - public const string OBJECT_PATH = "/org/freedesktop/systemd1"; - - public struct UnitInfo { - string id; - string description; - string load_state; - string active_state; - string sub_state; - string following; - ObjectPath unit_path; - uint32 job_id; - string job_type; - ObjectPath job_path; - } - - public struct UnitFileInfo { - string name; - string state; - } - - public struct UnitLinkChangeInfo { - string change_type; - string symlink_name; - string destination_name; - } - - public struct UnitProperty { - string name; - Variant value; - } - - public struct UnitPropertyGroup { - string name; - UnitProperty[] properties; - } - - public struct JobInfo { - uint32 id; - string name; - string type; - string state; - ObjectPath job_path; - ObjectPath unit_path; - } - - public abstract string version { owned get; } - public abstract string features { owned get; } - public abstract string tainted { owned get; } - public abstract uint64 firmware_timestamp { get; } - public abstract uint64 firmware_timestamp_monotonic { get; } - public abstract uint64 loader_timestamp { get; } - public abstract uint64 loader_timestamp_monotonic { get; } - public abstract uint64 kernel_timestamp { get; } - public abstract uint64 kernel_timestamp_monotonic { get; } - [DBus (name = "InitRDTimestamp")] - public abstract uint64 init_rd_timestamp { get; } - [DBus (name = "InitRDTimestampMonotonic")] - public abstract uint64 init_rd_timestamp_monotonic { get; } - public abstract uint64 userspace_timestamp { get; } - public abstract uint64 userspace_timestamp_monotonic { get; } - public abstract uint64 finish_timestamp { get; } - public abstract uint64 finish_timestamp_monotonic { get; } - public abstract uint64 generators_start_timestamp { get; } - public abstract uint64 generators_start_timestamp_monotonic { get; } - public abstract uint64 generators_finish_timestamp { get; } - public abstract uint64 generators_finish_timestamp_monotonic { get; } - public abstract uint64 units_load_start_timestamp { get; } - public abstract uint64 units_load_start_timestamp_monotonic { get; } - public abstract uint64 units_load_finish_timestamp { get; } - public abstract uint64 units_load_finish_timestamp_monotonic { get; } - public abstract uint64 security_start_timestamp { get; } - public abstract uint64 security_start_timestamp_monotonic { get; } - public abstract uint64 security_finish_timestamp { get; } - public abstract uint64 security_finish_timestamp_monotonic { get; } - public abstract string log_level { owned get; } - public abstract string log_target { owned get; } - [DBus (name = "NNames")] - public abstract uint32 names_count { get; } - [DBus (name = "NJobs")] - public abstract uint32 jobs_count { get; } - [DBus (name = "NInstalledJobs")] - public abstract uint32 installed_jobs_count { get; } - [DBus (name = "NFailedJobs")] - public abstract uint32 failed_jobs_count { get; } - public abstract double progress { get; } - public abstract string[] environment { owned get; } - public abstract bool confirm_spawn { get; } - public abstract bool show_status { get; } - public abstract string[] unit_path { owned get; } - public abstract string default_standard_output { owned get; } - public abstract string default_standard_error { owned get; } - [DBus (name = "RuntimeWatchdogUSec")] - public abstract uint64 runtime_watchdog_usec { get; } - [DBus (name = "ShutdownWatchdogUSec")] - public abstract uint64 shutdown_watchdog_usec { get; } - public abstract string virtualization { owned get; } - public abstract string architecture { owned get; } - - public abstract async ObjectPath get_unit (string name) throws DBusError, IOError; - public abstract async ObjectPath get_unit_by_pid (uint32 pid) throws DBusError, IOError; - public abstract async ObjectPath load_unit (string name) throws DBusError, IOError; - public abstract async ObjectPath start_unit (string name, Systemd.UnitMode mode) throws DBusError, IOError; - public abstract async ObjectPath start_unit_replace (string old_unit, string new_unit, Systemd.UnitMode mode) throws DBusError, IOError; - public abstract async ObjectPath stop_unit (string name, Systemd.UnitMode mode) throws DBusError, IOError; - public abstract async ObjectPath reload_unit (string name, Systemd.UnitMode mode) throws DBusError, IOError; - public abstract async ObjectPath restart_unit (string name, Systemd.UnitMode mode) throws DBusError, IOError; - public abstract async ObjectPath try_restart_unit (string name, Systemd.UnitMode mode) throws DBusError, IOError; - public abstract async ObjectPath reload_or_restart_unit (string name, Systemd.UnitMode mode) throws DBusError, IOError; - public abstract async ObjectPath reload_or_try_restart_unit (string name, Systemd.UnitMode mode) throws DBusError, IOError; - public abstract async void kill_unit (string name, Systemd.Who who, int32 @signal) throws DBusError, IOError; - public abstract async void reset_failed_unit (string name) throws DBusError, IOError; - public abstract async ObjectPath get_job (uint32 id) throws DBusError, IOError; - public abstract async void cancel_job (uint32 id) throws DBusError, IOError; - public abstract async void clear_jobs () throws DBusError, IOError; - public abstract async void reset_failed () throws DBusError, IOError; - public abstract async UnitInfo[] list_units () throws DBusError, IOError; - public abstract async JobInfo[] list_jobs () throws DBusError, IOError; - public abstract async void subscribe () throws DBusError, IOError; - public abstract async void unsubscribe () throws DBusError, IOError; - public abstract async ObjectPath create_snapshot (string name, bool cleanup) throws DBusError, IOError; - public abstract async void remove_snapshot (string name) throws DBusError, IOError; - public abstract async void reload () throws DBusError, IOError; - public abstract async void reexecute () throws DBusError, IOError; - public abstract async void exit () throws DBusError, IOError; - public abstract async void reboot () throws DBusError, IOError; - public abstract async void power_off () throws DBusError, IOError; - public abstract async void halt () throws DBusError, IOError; - [DBus (name = "KExec")] - public abstract async void kexec () throws DBusError, IOError; - public abstract async void switch_root (string new_root, string init) throws DBusError, IOError; - public abstract async void set_environment (string[] names) throws DBusError, IOError; - public abstract async void unset_environment (string[] names) throws DBusError, IOError; - public abstract async void unset_and_set_environment (string[] unset, string[] @set) throws DBusError, IOError; - public abstract async UnitFileInfo[] list_unit_files () throws DBusError, IOError; - public abstract async Systemd.UnitFileState get_unit_file_state (string file) throws DBusError, IOError; - public abstract async UnitLinkChangeInfo[] enable_unit_files (string[] files, bool runtime, bool force, out bool carries_install_info) throws DBusError, IOError; - public abstract async UnitLinkChangeInfo[] disable_unit_files (string[] files, bool runtime) throws DBusError, IOError; - public abstract async UnitLinkChangeInfo[] reenable_unit_files (string[] files, bool runtime, bool force, out bool carries_install_info) throws DBusError, IOError; - public abstract async UnitLinkChangeInfo[] link_unit_files (string[] files, bool runtime) throws DBusError, IOError; - public abstract async UnitLinkChangeInfo[] preset_unit_files (string[] files, bool runtime, bool force, out bool carries_install_info) throws DBusError, IOError; - public abstract async UnitLinkChangeInfo[] mask_unit_files (string[] files, bool runtime) throws DBusError, IOError; - public abstract async UnitLinkChangeInfo[] unmask_unit_files (string[] files, bool runtime) throws DBusError, IOError; - public abstract async UnitLinkChangeInfo[] set_default_target (string[] files) throws DBusError, IOError; - public abstract async string get_default_target () throws DBusError, IOError; - public abstract async void set_unit_properties (string name, bool runtime, UnitProperty[] properties) throws DBusError, IOError; - public abstract async ObjectPath start_transiend_unit (string name, string mode, UnitProperty[] properties, UnitPropertyGroup[] aux) throws DBusError, IOError; - - public abstract signal void unit_new (string id, ObjectPath path); - public abstract signal void unit_removed (string id, ObjectPath path); - public abstract signal void job_new (uint32 id, ObjectPath path, string unit); - public abstract signal void job_removed (uint32 id, ObjectPath path, string unit, Systemd.JobResult res); - public abstract signal void startup_finished (uint64 firmware, uint64 loader, uint64 kernel, uint64 initrd, uint64 userspace, uint64 total); - public abstract signal void unit_files_changed (); - public abstract signal void reloading (bool active); - } - - [DBus (name = "org.freedesktop.systemd1.Unit")] - public interface Unit : DBusProxy { - public struct JobLink { - uint32 id; - ObjectPath path; - } - - public abstract string id { owned get; } - public abstract string[] names { owned get; } - public abstract string following { owned get; } - public abstract string[] requires { owned get; } - public abstract string[] requires_overridable { owned get; } - public abstract string[] requisite { owned get; } - public abstract string[] requisite_overridable { owned get; } - public abstract string[] wants { owned get; } - public abstract string[] required_by { owned get; } - public abstract string[] required_by_overridable { owned get; } - public abstract string[] wanted_by { owned get; } - public abstract string[] conflicts { owned get; } - public abstract string[] conflicted_by { owned get; } - public abstract string[] before { owned get; } - public abstract string[] after { owned get; } - public abstract string[] on_failure { owned get; } - public abstract string description { owned get; } - public abstract string load_state { owned get; } - public abstract Systemd.UnitActiveState active_state { owned get; } - public abstract string sub_state { owned get; } - public abstract string fragment_path { owned get; } - public abstract Systemd.UnitFileState unit_file_state { get; } - public abstract uint64 inactive_exit_timestamp { owned get; } - public abstract uint64 active_enter_timestamp { owned get; } - public abstract uint64 active_exit_timestamp { owned get; } - public abstract uint64 inactive_enter_timestamp { owned get; } - public abstract bool can_start { get; } - public abstract bool can_stop { get; } - public abstract bool can_reload { get; } - public abstract JobLink job { owned get; } - public abstract bool recursive_stop { get; } - public abstract bool stop_when_unneeded { get; } - public abstract bool refuse_manual_start { get; } - public abstract bool refuse_manual_stop { get; } - public abstract bool default_dependencies { get; } - public abstract string default_control_group { owned get; } - public abstract string[] control_groups { owned get; } - public abstract bool need_daemon_reload { get; } - public abstract uint64 job_timeout_usec { get; } - - public abstract async ObjectPath start (Systemd.UnitMode mode) throws DBusError, IOError; - public abstract async ObjectPath stop (Systemd.UnitMode mode) throws DBusError, IOError; - public abstract async ObjectPath reload (Systemd.UnitMode mode) throws DBusError, IOError; - public abstract async ObjectPath restart (Systemd.UnitMode mode) throws DBusError, IOError; - public abstract async ObjectPath try_restart (Systemd.UnitMode mode) throws DBusError, IOError; - public abstract async ObjectPath reload_or_restart (Systemd.UnitMode mode) throws DBusError, IOError; - public abstract async ObjectPath reload_or_try_restart (Systemd.UnitMode mode) throws DBusError, IOError; - - public abstract async void reset_failed () throws DBusError, IOError; - } - - [DBus (name = "org.freedesktop.systemd1.Job")] - public interface Job : DBusProxy { - public struct UnitLink { - string id; - ObjectPath path; - } - - public abstract uint32 id { get; } - public abstract string state { owned get; } - public abstract string job_type { owned get; } - public abstract UnitLink unit { owned get; } - - public abstract async void cancel () throws DBusError, IOError; - } -} diff --git a/release.sh b/release.sh deleted file mode 100755 index c7b2a07..0000000 --- a/release.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# -# Maintainer script for publishing releases. - -set -e - -source=$(dpkg-parsechangelog -S Source) -version=$(dpkg-parsechangelog -S Version) -distribution=$(dpkg-parsechangelog -S Distribution) -codename=$(debian-distro-info --codename --${distribution}) - -OS=debian DIST=${codename} ARCH=armhf pbuilder-ev3dev build -OS=debian DIST=${codename} ARCH=armel PBUILDER_OPTIONS="--binary-arch" pbuilder-ev3dev build -OS=raspbian DIST=${codename} ARCH=armhf pbuilder-ev3dev build - -debsign ~/pbuilder-ev3dev/debian/${codename}-armhf/${source}_${version}_armhf.changes -debsign ~/pbuilder-ev3dev/debian/${codename}-armel/${source}_${version}_armel.changes -debsign ~/pbuilder-ev3dev/raspbian/${codename}-armhf/${source}_${version}_armhf.changes - -dput ev3dev-debian ~/pbuilder-ev3dev/debian/${codename}-armhf/${source}_${version}_armhf.changes -dput ev3dev-debian ~/pbuilder-ev3dev/debian/${codename}-armel/${source}_${version}_armel.changes -dput ev3dev-raspbian ~/pbuilder-ev3dev/raspbian/${codename}-armhf/${source}_${version}_armhf.changes - -gbp buildpackage --git-tag-only diff --git a/setup.cmake b/setup.cmake deleted file mode 100644 index 905b32a..0000000 --- a/setup.cmake +++ /dev/null @@ -1,8 +0,0 @@ -# Create the build directory and initalize it - -file (MAKE_DIRECTORY build) - -execute_process ( - COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=string:Debug -DBRICKMAN_TEST=bool:Yes .. - WORKING_DIRECTORY build -) diff --git a/src/GlobalManager.vala b/src/GlobalManager.vala deleted file mode 100644 index 4c0c6a4..0000000 --- a/src/GlobalManager.vala +++ /dev/null @@ -1,118 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright 2015 David Lechner - * - * 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 2 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -/* FileBrowserController.vala - File Browser controller */ - -using Linux.Input; - -namespace BrickManager { - - /** - * Program-defined LED states. - * - * Brickman uses the LEDs on the EV3 to provide feedback to the user using - * these states. - */ - public enum LedState { - /** - * Indicates that brickman is running normally (ready for input). - */ - NORMAL, - - /** - * Indicates that brickman is busy and will not respond to input. - */ - BUSY, - - /** - * Indicates that user program is running. - */ - USER - } - - /** - * Object for hosting global instances of various managers used in brickman - */ - public class GlobalManager : Object { - bool have_ev3_leds = false; - Ev3devKit.Devices.Led ev3_left_green_led; - Ev3devKit.Devices.Led ev3_right_green_led; - Ev3devKit.Devices.Led ev3_left_red_led; - Ev3devKit.Devices.Led ev3_right_red_led; - - /** - * Gets the device manager for interacting with hardware devices. - */ - public Ev3devKit.Devices.DeviceManager device_manager { get; private set; } - - public GlobalManager () { - device_manager = new Ev3devKit.Devices.DeviceManager (); - if (Ev3devKit.Devices.Cpu.get_model ().has_prefix ("LEGO MINDSTORMS EV3")) { - try { - ev3_left_green_led = device_manager.get_led ( - Ev3devKit.Devices.Led.EV3_LEFT, "green"); - ev3_right_green_led = device_manager.get_led ( - Ev3devKit.Devices.Led.EV3_RIGHT, "green"); - ev3_left_red_led = device_manager.get_led ( - Ev3devKit.Devices.Led.EV3_LEFT, "red"); - ev3_right_red_led = device_manager.get_led ( - Ev3devKit.Devices.Led.EV3_RIGHT, "red"); - have_ev3_leds = true; - } catch (Error err) { - warning ("%s", err.message); - } - } - } - - public void set_leds (LedState state) { - if (!have_ev3_leds) - return; - try { - switch (state) { - case LedState.NORMAL: - ev3_left_green_led.set_trigger ("default-on"); - ev3_right_green_led.set_trigger ("default-on"); - ev3_left_red_led.set_trigger ("none"); - ev3_left_red_led.set_brightness (0); - ev3_right_red_led.set_trigger ("none"); - ev3_right_red_led.set_brightness (0); - break; - case LedState.BUSY: - ev3_left_green_led.set_trigger ("none"); - ev3_left_green_led.set_brightness (0); - ev3_right_green_led.set_trigger ("none"); - ev3_right_green_led.set_brightness (0); - ev3_left_red_led.set_trigger ("default-on"); - ev3_right_red_led.set_trigger ("default-on"); - break; - case LedState.USER: - ev3_left_green_led.set_trigger ("default-on"); - ev3_right_green_led.set_trigger ("default-on"); - ev3_left_red_led.set_trigger ("default-on"); - ev3_right_red_led.set_trigger ("default-on"); - break; - } - } catch (Error err) { - critical ("%s", err.message); - } - } - } -} diff --git a/src/Version.vala.in b/src/Version.vala.in deleted file mode 100644 index f98f9af..0000000 --- a/src/Version.vala.in +++ /dev/null @@ -1,29 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO Mindstorms EV3/ev3dev - * - * Copyright 2014-2015 David Lechner - * - * 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 2 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -/* Version.vala - Version info from CMakeLists.txt (automatically generated) */ - -namespace BrickManager { - const string EXEC_NAME = "@EXEC_NAME@"; - const string RELEASE_NAME = "@RELEASE_NAME@"; - const string VERSION = "@PROJECT_VERSION@"; - const string DATA_DIR = "@PROJECT_NAME@"; -} diff --git a/src/controller/AboutController.vala b/src/controller/AboutController.vala deleted file mode 100644 index afecb98..0000000 --- a/src/controller/AboutController.vala +++ /dev/null @@ -1,53 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright 2014-2015 David Lechner - * - * 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 2 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -/* AboutController.vala - Controller for about window */ - -using Ev3devKit.Devices; -using Ev3devKit.Ui; - -namespace BrickManager { - public class AboutController : Object, IBrickManagerModule { - AboutWindow about_window; - - public string display_name { get { return "About"; } } - - public void show_main_window () { - if (about_window == null) { - create_about_window (); - } - about_window.show (); - } - - void create_about_window () { - about_window = new AboutWindow (display_name); - var utsname = Posix.UTSName (); - if (Posix.uname (ref utsname) == 0) { - about_window.kernel_version = utsname.release; - } else { - warning ("Failed to get kernel version."); - } - about_window.model_name = Cpu.get_model (); - about_window.revision = Cpu.get_revision (); - about_window.serial_number = Cpu.get_serial_number (); - } - } -} diff --git a/src/controller/BatteryController.vala b/src/controller/BatteryController.vala deleted file mode 100644 index af3ecb6..0000000 --- a/src/controller/BatteryController.vala +++ /dev/null @@ -1,84 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright 2014-2015 David Lechner - * - * 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 2 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -/* BatteryController.vala - Controller for monitoring battery */ - -using Ev3devKit.Devices; -using Ev3devKit.Ui; - -namespace BrickManager { - public class BatteryController : Object, IBrickManagerModule { - BatteryInfoWindow battery_window; - internal BatteryStatusBarItem battery_status_bar_item; - PowerSupply? system_power_supply; - - public string display_name { get { return "Battery"; } } - - public void show_main_window () { - if (battery_window == null) { - create_battery_window (); - } - battery_window.show (); - } - - public BatteryController () { - battery_status_bar_item = new BatteryStatusBarItem (); - system_power_supply = global_manager.device_manager.get_system_power_supply (); - if (system_power_supply == null) { - battery_status_bar_item.visible = false; - warning ("Could not get system power supply."); - } else { - update_battery_info (); - Timeout.add_seconds (5, update_battery_info); - } - } - - void create_battery_window () { - battery_window = new BatteryInfoWindow (display_name); - if (system_power_supply == null) { - battery_window.available = false; - } else { - battery_window.technology = system_power_supply.technology.to_string (); - update_battery_info (); - } - } - - bool update_battery_info () { - if (system_power_supply == null) { - return false; - } - - var voltage = system_power_supply.voltage; - battery_status_bar_item.voltage = voltage; - - if (battery_window != null) { - battery_window.has_voltage = system_power_supply.has_voltage; - battery_window.voltage = voltage; - battery_window.has_current = system_power_supply.has_current; - battery_window.current = system_power_supply.current * 1000; - battery_window.has_power = system_power_supply.has_power; - battery_window.power = system_power_supply.power; - } - - return true; - } - } -} diff --git a/src/controller/BluetoothController.vala b/src/controller/BluetoothController.vala deleted file mode 100644 index 6a793f6..0000000 --- a/src/controller/BluetoothController.vala +++ /dev/null @@ -1,349 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright 2014-2015 David Lechner - * - * 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 2 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -/* BluetoothController.vala - Controller for Bluetooth (BlueZ) */ - -using Bluez5; -using Ev3devKit.Ui; - -namespace BrickManager { - public class BluetoothController : Object, IBrickManagerModule { - BluetoothWindow main_window; - internal BluetoothStatusBarItem status_bar_item; - Manager manager; - Bluez5Agent? agent; - ObjectPath agent_object_path; - string? built_in_adapter_address; - List adapter_list; - Adapter? selected_adapter; - Binding? selected_adapter_visible_binding; - Binding? selected_adapter_scanning_binding; - uint connection_count = 0; - - public string display_name { get { return "Bluetooth"; } } - - public bool connected { get { return connection_count > 0; } } - - public signal void show_network_requested (string mac_address); - - internal uint adapter_count { get; set; default = 0; } - - public void show_main_window () { - main_window.show (); - } - - public BluetoothController () { - adapter_list = new List (); - main_window = new BluetoothWindow (display_name) { - loading = true, - available = false - }; - main_window.scan_selected.connect (on_scan_selected); - main_window.closed.connect (() => { - if (selected_adapter != null && selected_adapter.discovering) - selected_adapter.stop_discovery.begin (); - }); - - status_bar_item = new BluetoothStatusBarItem (); - bind_property ("connected", status_bar_item, "connected"); - - /* Use udev to find the address of the built-in Bluetooth adapter */ - var udev_client = new GUdev.Client (null); - var udev_devices = udev_client.query_by_subsystem ("bluetooth"); - if (udev_devices != null) { - foreach (var udev_device in udev_devices) { - var parent = udev_device.get_parent (); - if (parent != null && parent.get_name () == "ttyS2") { - // FIXME: there is no such sysfs attr - var address = udev_device.get_sysfs_attr ("address"); - if (address != null) { - built_in_adapter_address = address.up (); - break; - } - } - } - } - - try { - agent = new Bluez5Agent (); - var bus = Bus.get_sync (BusType.SYSTEM); - agent_object_path = new ObjectPath ("/org/ev3dev/brickman/bluez5_agent"); - bus.register_object (agent_object_path, agent); - } catch (IOError err) { - critical ("%s", err.message); - } - - Bus.watch_name (BusType.SYSTEM, Manager.SERVICE_NAME, - BusNameWatcherFlags.AUTO_START, () => { - // Called when the bluez service is registered. - init_async.begin ((obj, res) => { - try { - init_async.end (res); - main_window.loading = false; - } catch (Error err) { - critical ("%s", err.message); - } - }); - }, () => { - // Called when the bluez service is disappears (shutdown or crashed). - main_window.loading = true; - var devices = manager.get_devices (); - foreach (var device in devices) { - var menu_item = main_window.find_menu_item (device); - main_window.remove_menu_item (menu_item); - } - set_selected_adapter (null); - manager = null; - }); - } - - public void bind_powered (Object obj, string property) { - obj.bind_property (property, main_window, "powered", - BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); - obj.bind_property (property, status_bar_item, "visible", - BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); - } - - async void init_async () throws Error { - manager = yield Manager.new_async (); - manager.adapter_added.connect (on_adapter_added); - manager.adapter_removed.connect (on_adapter_removed); - manager.device_added.connect (on_device_added); - manager.device_removed.connect (on_device_removed); - foreach (var adapter in manager.get_adapters ()) - on_adapter_added (adapter); - foreach (var device in manager.get_devices ()) - on_device_added (device); - try { - yield manager.agent_manager.register_agent (agent_object_path, - AgentManagerCapability.KEYBOARD_DISPLAY); - yield manager.agent_manager.request_default_agent (agent_object_path); - } catch (BlueZError err) { - critical ("%s", err.message); - } - } - - void set_selected_adapter (Adapter? new_adapter) { - if (selected_adapter != null) { - if (selected_adapter.discovering) - selected_adapter.stop_discovery.begin (); - selected_adapter_visible_binding.unbind (); - selected_adapter_visible_binding = null; - selected_adapter_scanning_binding.unbind (); - selected_adapter_scanning_binding = null; - } - selected_adapter = new_adapter; - if (selected_adapter != null) { - selected_adapter_visible_binding = selected_adapter.bind_property ( - "discoverable", main_window, "bt-visible", - BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); - selected_adapter_scanning_binding = selected_adapter.bind_property ( - "discovering", main_window, "scanning", BindingFlags.SYNC_CREATE); - } - main_window.available = selected_adapter != null; - } - - void on_scan_selected () { - if (selected_adapter == null) { - critical ("No adapter is selected."); - return; - } - - if (selected_adapter.discovering) { - selected_adapter.stop_discovery.begin ((obj, res) => { - try { - selected_adapter.stop_discovery.end (res); - } catch (Error err) { - critical ("%s", err.message); - } - }); - } else { - selected_adapter.start_discovery.begin ((obj, res) => { - try { - selected_adapter.start_discovery.end (res); - } catch (Error err) { - critical ("%s", err.message); - } - }); - } - } - - void on_adapter_added (Adapter adapter) { - adapter_list.append (adapter); - adapter_count++; - // make the new adapter the selected adapter unless it is the built-in adapter. - if (selected_adapter == null - || selected_adapter.address == built_in_adapter_address) - set_selected_adapter (adapter); - } - - void on_adapter_removed (Adapter adapter) { - // if the selected adapter is removed, replace it with the first adapter - // that is not the built-in adapter. - adapter_list.remove (adapter); - adapter.unref (); // List.remove () does not unref automatically - adapter_count--; - if (selected_adapter == adapter) { - set_selected_adapter (null); - foreach (var a in adapter_list) { - if (a.address != built_in_adapter_address) { - set_selected_adapter (a); - break; - } - } - // If the built-in adapter is the only adapter available, then use it. - if (selected_adapter == null && adapter_list != null) { - set_selected_adapter (adapter_list.data); - } - } - } - - void on_device_added (Device device) { - var menu_item = new BluetoothDeviceMenuItem (); - device.bind_property ("alias", menu_item, "name", - BindingFlags.SYNC_CREATE); - device.bind_property ("connected", menu_item, "connected", - BindingFlags.SYNC_CREATE); - device.adapter.bind_property ("alias", menu_item, "adapter", - BindingFlags.SYNC_CREATE); - bind_property ("adapter-count", menu_item, "show-adapter", - BindingFlags.SYNC_CREATE, transform_adapter_count_to_show_adapter); - menu_item.represented_object = device; - menu_item.button.pressed.connect (() => { - var device_window = new BluetoothDeviceWindow () { - loading = false - }; - weak BluetoothDeviceWindow weak_device_window = device_window; - device.bind_property ("alias", device_window, "title", - BindingFlags.SYNC_CREATE); - device.bind_property ("address", device_window, "address", - BindingFlags.SYNC_CREATE); - device.bind_property ("paired", device_window, "paired", - BindingFlags.SYNC_CREATE); - device.bind_property ("connected", device_window, "connected", - BindingFlags.SYNC_CREATE); - device.bind_property ("uuids", device_window, "has_network", - BindingFlags.SYNC_CREATE, transform_uuids_to_has_network); - device_window.connect_selected.connect (() => { - if (!device.paired) - pair_device.begin (device); - else if (device.connected) - disconnect_device.begin (device); - else - connect_device.begin (device); - }); - device_window.remove_selected.connect (() => - remove_device.begin (device)); - device_window.network_selected.connect (() => - show_network_requested (device.alias)); - var handler_id = manager.device_removed.connect (() => - weak_device_window.close ()); - device_window.weak_ref (() => - SignalHandler.disconnect (manager, handler_id)); - device_window.show (); - }); - main_window.add_menu_item (menu_item); - - // Bluez DBus API does not have a global "connected" property so we - // have to keep track of all of the connections ourselves in order - // to make the Bluetooth status bar icon work. - weak Device weak_device = device; - device.notify["connected"].connect (() => { - if (weak_device.connected) - connection_count++; - else - connection_count--; - notify_property ("connected"); - }); - if (device.connected) { - connection_count++; - notify_property ("connected"); - } - } - - void on_device_removed (Device device) { - var menu_item = main_window.find_menu_item (device); - main_window.remove_menu_item (menu_item); - - if (device.connected) { - connection_count--; - notify_property ("connected"); - } - } - - // TODO: some kind of "spinner" to indicate that we are busy would be - // nice for the next 4 methods - - async void remove_device (Device device) { - try { - yield device.adapter.remove_device (device); - } catch (Error err) { - var dialog = new MessageDialog ("Error", err.message); - dialog.show (); - } - } - - async void pair_device (Device device) { - try { - yield device.pair (); - device.trusted = true; - } catch (Error err) { - var dialog = new MessageDialog ("Error", err.message); - dialog.show (); - } - } - - async void disconnect_device (Device device) { - try { - yield device.disconnect_device (); - } catch (Error err) { - var dialog = new MessageDialog ("Error", err.message); - dialog.show (); - } - } - - async void connect_device (Device device) { - try { - yield device.connect_device (); - } catch (Error err) { - var dialog = new MessageDialog ("Error", err.message); - dialog.show (); - } - } - - bool transform_adapter_count_to_show_adapter (Binding binding, Value source, ref Value target) { - target = adapter_count > 1; - return true; - } - - bool transform_uuids_to_has_network (Binding binding, Value source, ref Value target) { - target = false; - var uuids = (string[])source; - foreach (var uuid in uuids) { - if (uuid == Bluez5.Uuid.NAP || uuid == Bluez5.Uuid.GN || uuid == Bluez5.Uuid.PANU) { - target = true; - break; - } - } - return true; - } - } -} \ No newline at end of file diff --git a/src/controller/DeviceBrowserController.vala b/src/controller/DeviceBrowserController.vala deleted file mode 100644 index 3907fbb..0000000 --- a/src/controller/DeviceBrowserController.vala +++ /dev/null @@ -1,451 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright 2015 David Lechner - * - * 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 2 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -/* DeviceBrowserController.vala - Controller for Browsing Devices (sensors, motors, etc.) */ - -using Ev3devKit.Devices; -using Ev3devKit.Ui; - -namespace BrickManager { - public class DeviceBrowserController : Object, IBrickManagerModule { - const int WATCH_MS = 500; - - DeviceManager manager; - DeviceBrowserWindow device_browser_window; - PortBrowserWindow? port_browser_window; - SensorBrowserWindow? sensor_browser_window; - MotorBrowserWindow? motor_browser_window; - - public string display_name { get { return "Device Browser"; } } - - public void show_main_window () { - if (device_browser_window == null) { - create_device_browser_window (); - } - device_browser_window.show (); - } - - void create_device_browser_window () { - manager = global_manager.device_manager; - device_browser_window = new DeviceBrowserWindow (display_name); - device_browser_window.ports_menu_item_selected.connect ( - on_ports_menu_item_selected); - device_browser_window.sensors_menu_item_selected.connect ( - on_sensors_menu_item_selected); - device_browser_window.motors_menu_item_selected.connect ( - on_motors_menu_item_selected); - } - - void on_ports_menu_item_selected () { - port_browser_window = new PortBrowserWindow (); - var port_added_handler_id = manager.port_added.connect (on_port_added); - manager.get_ports ().foreach (on_port_added); - // connect_after ensures that this signal handler is called after - // the others that are added in on_port_added (). This is important - // so that we don't set port_browser_window = null before all of - // the other signal handlers have run. - port_browser_window.closed.connect_after (() => { - manager.disconnect (port_added_handler_id); - port_browser_window = null; - }); - port_browser_window.show (); - } - - void on_port_added (Port port) { - var menu_item = new Ev3devKit.Ui.MenuItem.with_right_arrow (port.address); - var button_pressed_handler_id = menu_item.button.pressed.connect (() => { - var window = new PortInfoWindow (port.address, port.device_name, - port.driver_name); - port.bind_property ("mode", window, "mode", BindingFlags.SYNC_CREATE); - port.bind_property ("status", window, "status", BindingFlags.SYNC_CREATE); - port.bind_property ("status", window, "can-set-device", BindingFlags.SYNC_CREATE, - transform_port_status_to_can_set_device); - var set_device_button_pressed_handler_id = window.set_device_button_pressed.connect (() => { - // TODO: when we add support for more types of drivers here, we will - // need to add some logic here to lookup status. - var device_dialog = new SelectFromListDialog (manager.get_nxt_analog_sensor_driver_names ()); - var item_selected_handler_id = device_dialog.item_selected.connect ((item) => { - try { - port.set_device (item); - } catch (Error err) { - var error_dialog = new MessageDialog ("Error", err.message); - error_dialog.show (); - } - }); - var notify_connected_handler_id = port.notify["connected"].connect (() => { - device_dialog.close (); - }); - ulong dialog_closed_handler_id = 0; - dialog_closed_handler_id = device_dialog.closed.connect (() => { - device_dialog.disconnect (item_selected_handler_id); - port.disconnect (notify_connected_handler_id); - device_dialog.disconnect (dialog_closed_handler_id); - }); - device_dialog.show (); - }); - var set_mode_button_pressed_handler_id = window.set_mode_button_pressed.connect (() => { - var mode_dialog = new SelectFromListDialog (port.modes); - var item_selected_handler_id = mode_dialog.item_selected.connect ((item) => { - try { - port.set_mode (item); - } catch (Error err) { - var error_dialog = new MessageDialog ("Error", err.message); - error_dialog.show (); - } - }); - var notify_connected_handler_id = port.notify["connected"].connect (() => { - mode_dialog.close (); - }); - ulong dialog_closed_handler_id = 0; - dialog_closed_handler_id = mode_dialog.closed.connect (() => { - mode_dialog.disconnect (item_selected_handler_id); - port.disconnect (notify_connected_handler_id); - mode_dialog.disconnect (dialog_closed_handler_id); - }); - mode_dialog.show (); - }); - var notify_connected_handler_id = port.notify["connected"].connect (() => { - var dialog = new MessageDialog ("Port Removed", - "Port %s was disconnected.".printf (port.address)); - dialog.show (); - window.close (); - }); - ulong window_closed_handler_id = 0; - window_closed_handler_id = window.closed.connect (() => { - window.disconnect (set_device_button_pressed_handler_id); - window.disconnect (set_mode_button_pressed_handler_id); - port.disconnect (notify_connected_handler_id); - window.disconnect (window_closed_handler_id); - }); - window.show (); - }); - // TODO: figure out how to sort menu items - port_browser_window.menu.add_menu_item (menu_item); - ulong notify_connected_handler_id = 0; - ulong window_closed_handler_id = 0; - notify_connected_handler_id = port.notify["connected"].connect (() => { - port_browser_window.menu.remove_menu_item (menu_item); - menu_item.button.disconnect (button_pressed_handler_id); - port.disconnect (notify_connected_handler_id); - port_browser_window.disconnect (window_closed_handler_id); - }); - window_closed_handler_id = port_browser_window.closed.connect (() => { - menu_item.button.disconnect (button_pressed_handler_id); - port.disconnect (notify_connected_handler_id); - port_browser_window.disconnect (window_closed_handler_id); - }); - } - - bool transform_port_status_to_can_set_device (Binding binding, - Value source_value, ref Value target_value) - { - // Currently only support setting device for nxt-analog-sensor devices - target_value.set_boolean (source_value.get_string () == "nxt-analog"); - return true; - } - - - - void on_sensors_menu_item_selected () { - sensor_browser_window = new SensorBrowserWindow (); - var sensor_added_handler_id = manager.sensor_added.connect (on_sensor_added); - manager.get_sensors ().foreach (on_sensor_added); - // connect_after ensures that this signal handler is called after - // the others that are added in on_sensor_added (). This is important - // so that we don't set sensor_browser_window = null before all of - // the other signal handlers have run. - sensor_browser_window.closed.connect_after (() => { - manager.disconnect (sensor_added_handler_id); - sensor_browser_window = null; - }); - sensor_browser_window.show (); - } - - void on_sensor_added (Sensor sensor) { - var menu_item = new Ev3devKit.Ui.MenuItem.with_right_arrow ("%s at %s".printf (sensor.driver_name, - sensor.address)); - var button_pressed_handler_id = menu_item.button.pressed.connect (() => { - var window = new SensorInfoWindow (sensor.driver_name, sensor.device_name, - sensor.address, sensor.commands != null); - sensor.bind_property ("mode", window, "mode", BindingFlags.SYNC_CREATE); - var watch_values_handler_id = window.watch_values_selected.connect (() => { - // TODO: Do we want to support showing more than one value? - var value_dialog = new SensorValueDialog (); - var value_timeout_id = Timeout.add (WATCH_MS, () => { - try { - value_dialog.value_text = "%.*f".printf (sensor.decimals, - sensor.get_float_value (0)); - if (sensor.units != null) - value_dialog.value_text += " %s".printf (sensor.units); - } catch (Error err) { - value_dialog.close (); - var error_dialog = new MessageDialog ("Error", err.message); - error_dialog.show (); - // this Timeout is removed by the value_dialog.closed handler - // so we just fall through and return CONTINUE here instead - // of returning REMOVE. - } - return Source.CONTINUE; - }); - var notify_connected_handler_id = sensor.notify["connected"].connect (() => { - value_dialog.close (); - }); - ulong dialog_closed_handler_id = 0; - dialog_closed_handler_id = value_dialog.closed.connect (() => { - Source.remove (value_timeout_id); - sensor.disconnect (notify_connected_handler_id); - value_dialog.disconnect (dialog_closed_handler_id); - }); - value_dialog.show (); - }); - var set_mode_selected_handler_id = window.set_mode_selected.connect (() => { - var mode_dialog = new SelectFromListDialog (sensor.modes); - var item_selected_handler_id = mode_dialog.item_selected.connect ((item) => { - try { - sensor.set_mode (item); - } catch (Error err) { - var error_dialog = new MessageDialog ("Error", err.message); - error_dialog.show (); - } - }); - var notify_connected_handler_id = sensor.notify["connected"].connect (() => { - mode_dialog.close (); - }); - ulong dialog_closed_handler_id = 0; - dialog_closed_handler_id = mode_dialog.closed.connect (() => { - mode_dialog.disconnect (item_selected_handler_id); - sensor.disconnect (notify_connected_handler_id); - mode_dialog.disconnect (dialog_closed_handler_id); - }); - mode_dialog.show (); - }); - var send_command_selected_handler_id = window.send_command_selected.connect (() => { - var command_dialog = new SelectFromListDialog (sensor.commands); - var item_selected_handler_id = command_dialog.item_selected.connect ((item) => { - try { - sensor.send_command (item); - } catch (Error err) { - var error_dialog = new MessageDialog ("Error", err.message); - error_dialog.show (); - } - }); - var notify_connected_handler_id = sensor.notify["connected"].connect (() => { - command_dialog.close (); - }); - ulong dialog_closed_handler_id = 0; - dialog_closed_handler_id = command_dialog.closed.connect (() => { - command_dialog.disconnect (item_selected_handler_id); - sensor.disconnect (notify_connected_handler_id); - command_dialog.disconnect (dialog_closed_handler_id); - }); - command_dialog.show (); - }); - ulong notify_connected_handler_id = 0; - ulong window_closed_handler_id = 0; - notify_connected_handler_id = sensor.notify["connected"].connect (() => { - var dialog = new MessageDialog ("Sensor Removed", - "Sensor %s at %s was disconnected.".printf (sensor.driver_name, - sensor.address)); - dialog.show (); - window.close (); - }); - window_closed_handler_id = window.closed.connect (() => { - window.disconnect (watch_values_handler_id); - window.disconnect (set_mode_selected_handler_id); - window.disconnect (send_command_selected_handler_id); - sensor.disconnect (notify_connected_handler_id); - window.disconnect (window_closed_handler_id); - }); - window.show (); - }); - // TODO: figure out how to sort menu items - sensor_browser_window.menu.add_menu_item (menu_item); - ulong notify_connected_handler_id = 0; - ulong window_closed_handler_id = 0; - notify_connected_handler_id = sensor.notify["connected"].connect (() => { - sensor_browser_window.menu.remove_menu_item (menu_item); - menu_item.button.disconnect (button_pressed_handler_id); - sensor.disconnect (notify_connected_handler_id); - sensor_browser_window.disconnect (window_closed_handler_id); - }); - window_closed_handler_id = sensor_browser_window.closed.connect (() => { - menu_item.button.disconnect (button_pressed_handler_id); - sensor.disconnect (notify_connected_handler_id); - sensor_browser_window.disconnect (window_closed_handler_id); - }); - } - - void on_motors_menu_item_selected () { - motor_browser_window = new MotorBrowserWindow (); - var tacho_motor_added_handler_id = manager.tacho_motor_added.connect (on_tacho_motor_added); - manager.get_tacho_motors ().foreach (on_tacho_motor_added); - var dc_motor_added_handler_id = manager.dc_motor_added.connect (on_dc_motor_added); - manager.get_dc_motors ().foreach (on_dc_motor_added); - var servo_motor_added_handler_id = manager.servo_motor_added.connect (on_servo_motor_added); - manager.get_servo_motors ().foreach (on_servo_motor_added); - // connect_after ensures that this signal handler is called after - // the others that are added in on_tacho_motor_added(). This is important - // so that we don't set motor_browser_window = null before all of - // the other signal handlers have run. - motor_browser_window.closed.connect_after (() => { - manager.disconnect (tacho_motor_added_handler_id); - manager.disconnect (dc_motor_added_handler_id); - manager.disconnect (servo_motor_added_handler_id); - motor_browser_window = null; - }); - motor_browser_window.show (); - } - - void on_tacho_motor_added (TachoMotor motor) { - var menu_item = new Ev3devKit.Ui.MenuItem.with_right_arrow ("%s at %s".printf (motor.driver_name, - motor.address)); - var button_pressed_handler_id = menu_item.button.pressed.connect (() => { - var window = new MotorInfoWindow (motor.driver_name, "tacho-motor", - motor.device_name, motor.address, true); - var watch_values_handler_id = window.watch_values_selected.connect (() => { - // TODO: Do we want to also show speed? - var value_dialog = new MotorValueDialog (); - var value_timeout_id = Timeout.add (WATCH_MS, () => { - // TODO: Convert to degrees - value_dialog.value_text = "%d".printf (motor.position); - return Source.CONTINUE; - }); - var notify_connected_handler_id = motor.notify["connected"].connect (() => { - value_dialog.close (); - }); - ulong dialog_closed_handler_id = 0; - dialog_closed_handler_id = value_dialog.closed.connect (() => { - Source.remove (value_timeout_id); - motor.disconnect (notify_connected_handler_id); - value_dialog.disconnect (dialog_closed_handler_id); - }); - value_dialog.show (); - }); - ulong notify_connected_handler_id = 0; - ulong window_closed_handler_id = 0; - notify_connected_handler_id = motor.notify["connected"].connect (() => { - var dialog = new MessageDialog ("Motor Removed", - "Motor %s at %s was disconnected.".printf (motor.driver_name, - motor.address)); - dialog.show (); - window.close (); - }); - window_closed_handler_id = window.closed.connect (() => { - window.disconnect (watch_values_handler_id); - motor.disconnect (notify_connected_handler_id); - window.disconnect (window_closed_handler_id); - }); - window.show (); - }); - // TODO: figure out how to sort menu items - motor_browser_window.menu.add_menu_item (menu_item); - ulong notify_connected_handler_id = 0; - ulong window_closed_handler_id = 0; - notify_connected_handler_id = motor.notify["connected"].connect (() => { - motor_browser_window.menu.remove_menu_item (menu_item); - menu_item.button.disconnect (button_pressed_handler_id); - motor.disconnect (notify_connected_handler_id); - motor_browser_window.disconnect (window_closed_handler_id); - }); - window_closed_handler_id = motor_browser_window.closed.connect (() => { - menu_item.button.disconnect (button_pressed_handler_id); - motor.disconnect (notify_connected_handler_id); - motor_browser_window.disconnect (window_closed_handler_id); - }); - } - - void on_dc_motor_added (DcMotor motor) { - var menu_item = new Ev3devKit.Ui.MenuItem.with_right_arrow ("%s at %s".printf (motor.driver_name, - motor.address)); - var button_pressed_handler_id = menu_item.button.pressed.connect (() => { - var window = new MotorInfoWindow (motor.driver_name, "dc-motor", - motor.device_name, motor.address, false); - ulong notify_connected_handler_id = 0; - ulong window_closed_handler_id = 0; - notify_connected_handler_id = motor.notify["connected"].connect (() => { - var dialog = new MessageDialog ("Motor Removed", - "Motor %s at %s was disconnected.".printf (motor.driver_name, - motor.address)); - dialog.show (); - window.close (); - }); - window_closed_handler_id = window.closed.connect (() => { - motor.disconnect (notify_connected_handler_id); - window.disconnect (window_closed_handler_id); - }); - window.show (); - }); - // TODO: figure out how to sort menu items - motor_browser_window.menu.add_menu_item (menu_item); - ulong notify_connected_handler_id = 0; - ulong window_closed_handler_id = 0; - notify_connected_handler_id = motor.notify["connected"].connect (() => { - motor_browser_window.menu.remove_menu_item (menu_item); - menu_item.button.disconnect (button_pressed_handler_id); - motor.disconnect (notify_connected_handler_id); - motor_browser_window.disconnect (window_closed_handler_id); - }); - window_closed_handler_id = motor_browser_window.closed.connect (() => { - menu_item.button.disconnect (button_pressed_handler_id); - motor.disconnect (notify_connected_handler_id); - motor_browser_window.disconnect (window_closed_handler_id); - }); - } - - void on_servo_motor_added (ServoMotor motor) { - var menu_item = new Ev3devKit.Ui.MenuItem.with_right_arrow ("%s at %s".printf (motor.driver_name, - motor.address)); - var button_pressed_handler_id = menu_item.button.pressed.connect (() => { - var window = new MotorInfoWindow (motor.driver_name, "servo-motor", - motor.device_name, motor.address, false); - ulong notify_connected_handler_id = 0; - ulong window_closed_handler_id = 0; - notify_connected_handler_id = motor.notify["connected"].connect (() => { - var dialog = new MessageDialog ("Motor Removed", - "Motor %s at %s was disconnected.".printf (motor.driver_name, - motor.address)); - dialog.show (); - window.close (); - }); - window_closed_handler_id = window.closed.connect (() => { - motor.disconnect (notify_connected_handler_id); - window.disconnect (window_closed_handler_id); - }); - window.show (); - }); - // TODO: figure out how to sort menu items - motor_browser_window.menu.add_menu_item (menu_item); - ulong notify_connected_handler_id = 0; - ulong window_closed_handler_id = 0; - notify_connected_handler_id = motor.notify["connected"].connect (() => { - motor_browser_window.menu.remove_menu_item (menu_item); - menu_item.button.disconnect (button_pressed_handler_id); - motor.disconnect (notify_connected_handler_id); - motor_browser_window.disconnect (window_closed_handler_id); - }); - window_closed_handler_id = motor_browser_window.closed.connect (() => { - menu_item.button.disconnect (button_pressed_handler_id); - motor.disconnect (notify_connected_handler_id); - motor_browser_window.disconnect (window_closed_handler_id); - }); - } - } -} \ No newline at end of file diff --git a/src/controller/FileBrowserController.vala b/src/controller/FileBrowserController.vala deleted file mode 100644 index 5fe0094..0000000 --- a/src/controller/FileBrowserController.vala +++ /dev/null @@ -1,221 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright 2015 David Lechner - * - * 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 2 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -/* FileBrowserController.vala - File Browser controller */ - -using Ev3devKit; -using Ev3devKit.Ui; - -namespace BrickManager { - public class FileBrowserController : Object, IBrickManagerModule { - const string PARENT_DIRECTORY_TEXT = "../"; - const string INITIAL_DIRECTORY = "/home/robot"; - const string USER_NAME = "robot"; - const string file_attrs = FileAttribute.OWNER_USER - + "," + FileAttribute.STANDARD_IS_HIDDEN - + "," + FileAttribute.STANDARD_TYPE - + "," + FileAttribute.UNIX_UID - + "," + FileAttribute.UNIX_GID - + "," + FileAttribute.UNIX_MODE; - - FileBrowserWindow file_browser_window; - FileMonitor? monitor; - File initial_directory; - - public string display_name { get { return "File Browser"; } } - - public void show_main_window () { - if (file_browser_window == null) { - create_main_window (); - } - file_browser_window.show (); - } - - void create_main_window () { - file_browser_window = new FileBrowserWindow (display_name) { - sort_files_func = sort_files - }; - file_browser_window.file_selected.connect ((file) => { - try { - var file_info = file.query_info (file_attrs, - FileQueryInfoFlags.NOFOLLOW_SYMLINKS); - var mode = file_info.get_attribute_uint32 (FileAttribute.UNIX_MODE); - if (file_info.get_file_type () == FileType.DIRECTORY) { - // if the selected file is a directory, then we - // open that directory. - set_directory.begin (file, (obj, res) => { - try { - set_directory.end (res); - } catch (Error err) { - var dialog = new MessageDialog ("Error", err.message); - dialog.show (); - } - }); - } else if ((mode & Posix.S_IXUSR) == Posix.S_IXUSR) { - // If the selected file is executable then we run the - // file via brickrun as USER_NAME. brickrun takes - // care of switching consoles, stopping motors, etc. - try { - string[] args = { - "/usr/bin/sudo", - "--login", - "--non-interactive", - "--user", - USER_NAME, - "--", - "/usr/bin/brickrun", - "--directory", - file.get_parent().get_path (), - "--", - file.get_path () - }; - var subproc = new Subprocess.newv (args, SubprocessFlags.STDERR_PIPE); - try { - var err_log_filename = file.get_path () + ".err.log"; - var err_log = File.new_for_path (err_log_filename); - var err_log_out = err_log.replace (null, false, FileCreateFlags.REPLACE_DESTINATION); - err_log_out.splice_async.begin (subproc.get_stderr_pipe (), - OutputStreamSpliceFlags.CLOSE_TARGET, Priority.DEFAULT, null, (obj, res) => { - try { - var size = err_log_out.splice_async.end (res); - if (size == 0) { - // delete the file if there was nothing logged. - err_log.delete (); - } else { - // change the owner to match the executable, - // otherwise it is owned by root and can't be deleted - var uid = file_info.get_attribute_uint32 (FileAttribute.UNIX_UID); - var gid = file_info.get_attribute_uint32 (FileAttribute.UNIX_GID); - Posix.chown (err_log_filename, uid, gid); - } - } catch (Error err) { - warning ("Error writing log file: %s", err.message); - } - }); - } catch (Error err) { - warning ("Failed to create error log: %s", err.message); - } - } catch (SpawnError err) { - var dialog = new MessageDialog ("Error", err.message); - dialog.show (); - } - } else { - var dialog = new MessageDialog (file.get_basename (), - "This file is not a directory or an executable."); - dialog.show (); - } - } catch (Error err) { - var dialog = new MessageDialog ("Error", err.message); - dialog.show (); - } - }); - initial_directory = File.new_for_path (INITIAL_DIRECTORY); - file_browser_window.file_selected (initial_directory); - } - - async void set_directory (File directory) throws Error { - file_browser_window.loading = true; - file_browser_window.clear_files (); - if (monitor != null) - monitor.cancel (); - monitor = directory.monitor_directory (FileMonitorFlags.NONE); - monitor.changed.connect ((src, dest, event) => { - message ("src: %s, dest %s, event: %s", - src == null ? "" : src.get_basename(), - dest == null ? "" : dest.get_basename(), - event.to_string()); - switch (event) { - case FileMonitorEvent.CREATED: - case FileMonitorEvent.ATTRIBUTE_CHANGED: - try { - var file_info = src.query_info (file_attrs, - FileQueryInfoFlags.NOFOLLOW_SYMLINKS); - - // don't show hidden files - if (file_info.get_is_hidden ()) - break; - - var file_name = src.get_basename (); - var mode = file_info.get_attribute_uint32 (FileAttribute.UNIX_MODE); - if (file_info.get_file_type () == FileType.DIRECTORY) { - // add '/' to the end of directories - file_name += "/"; - } else if ((mode & Posix.S_IXUSR) == Posix.S_IXUSR) { - // add '*' to the end of executable files - file_name += "*"; - } - - file_browser_window.add_file (file_name, src); - } catch (Error err) { - // If file was deleted immediately after creation, no need - // to show error message. - if (err is IOError.NOT_FOUND) - break; - critical ("%s", err.message); - } - break; - case FileMonitorEvent.DELETED: - file_browser_window.remove_file (src); - break; - } - }); - file_browser_window.current_directory = directory.get_path (); - // Limit the browser to children of the initial directory. - // Browsing the entire file system as root is probably a bad idea. - if (!directory.equal (initial_directory)) { - var parent = directory.get_parent (); - if (parent != null) - file_browser_window.add_file (PARENT_DIRECTORY_TEXT, parent); - } - var enumerator = yield directory.enumerate_children_async ("", - FileQueryInfoFlags.NOFOLLOW_SYMLINKS); - FileInfo info; - // TODO: use next_files_async () instead? - while ((info = enumerator.next_file ()) != null) { - monitor.changed (enumerator.get_child (info), null, - FileMonitorEvent.CREATED); - } - file_browser_window.loading = false; - } - - static int sort_files (Ui.MenuItem a, Ui.MenuItem b) { - var a_text = a.label.text; - var b_text = b.label.text; - - // parent directory text goes first - if (a_text == PARENT_DIRECTORY_TEXT) - return -1; - if (b_text == PARENT_DIRECTORY_TEXT) - return 1; - - // then directories - var a_last_char = a_text[a_text.length -1]; - var b_last_char = b_text[b_text.length -1]; - if (a_last_char == '/' && b_last_char != '/') - return -1; - if (a_last_char != '/' && b_last_char == '/') - return 1; - - // then everything else - return strcmp (a_text, b_text); - } - } -} diff --git a/src/controller/IBrickManagerModule.vala b/src/controller/IBrickManagerModule.vala deleted file mode 100644 index c07dc9c..0000000 --- a/src/controller/IBrickManagerModule.vala +++ /dev/null @@ -1,31 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright 2014-2015 David Lechner - * - * 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 2 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -/* IBrickManagerModule.vala - Interface for controller objects that is used for displaying them on the main menu */ - -using Ev3devKit.Ui; - -namespace BrickManager { - public interface IBrickManagerModule : Object { - public abstract string display_name { get; } - public abstract void show_main_window (); - } -} \ No newline at end of file diff --git a/src/controller/NetworkController.vala b/src/controller/NetworkController.vala deleted file mode 100644 index 31d12cb..0000000 --- a/src/controller/NetworkController.vala +++ /dev/null @@ -1,935 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright 2014-2015 David Lechner - * - * 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 2 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -/* NetworkController.vala - Controller for network connections (ConnMan) */ - -using Connman; -using Ev3devKit.Ui; - -namespace BrickManager { - public class NetworkController : Object, IBrickManagerModule { - const string[] TETHERING_TECHNOLOGIES = { "bluetooth", "gadget" }; - const string NET_SUBSYSTEM = "net"; - const string TETHER_DEVICE_NAME = "tether"; - - HashTable technology_map; - HashTable service_map; - HashTable wifi_service_map; - NetworkStatusWindow status_window; - NetworkConnectionsWindow connections_window; - WifiWindow wifi_window; - TetheringWindow? tethering_window; - TetheringInfoWindow? tethering_info_window; - internal NetworkStatusBarItem network_status_bar_item; - internal WifiStatusBarItem wifi_status_bar_item; - Binding? status_bar_item_binding; - bool status_bar_item_binding_is_tether; - ConnmanAgent agent; - ObjectPath agent_object_path; - Manager? manager; - Technology? wifi_technology; - GUdev.Client udev_client; - BluetoothController bluetooth_controller; - - public class WifiController : Object, IBrickManagerModule { - weak WifiWindow wifi_window; - - public string display_name { get { return wifi_window.title; } } - - public WifiController (WifiWindow wifi_window) { - this.wifi_window = wifi_window; - } - - public void show_main_window () { - wifi_window.show (); - } - } - - public WifiController wifi_controller; - - public string display_name { get { return "Wireless and Networks"; } } - - public bool has_tether { get; set; } - public string tether_address { get; set; } - public string tether_netmask { get; set; } - public string tether_interface { get; set; } - public string tether_mac { get; set; } - - public NetworkController () { - technology_map = new HashTable (null, null); - service_map = new HashTable (null, null); - wifi_service_map = new HashTable (null, null); - status_window = new NetworkStatusWindow (display_name) { - loading = true - }; - connections_window = new NetworkConnectionsWindow () { - loading = true - }; - status_window.network_connections_selected.connect (() => - connections_window.show ()); - connections_window.connection_selected.connect ( - on_connections_window_connection_selected); - network_status_bar_item = new NetworkStatusBarItem (); - wifi_status_bar_item = new WifiStatusBarItem (); - - wifi_window = new WifiWindow () { - loading = true, - available = false - }; - wifi_window.connection_selected.connect (on_wifi_connection_selected); - wifi_controller = new WifiController (wifi_window); - - status_window.tethering_selected.connect (() => { - tethering_window = new TetheringWindow (); - foreach (var tech in manager.get_technologies ()) { - add_tethering_technology (tech); - } - tethering_window.tethering_info_selected.connect (() => { - tethering_info_window = new TetheringInfoWindow (); - bind_property ("has-tether", tethering_info_window, "available", - BindingFlags.SYNC_CREATE); - bind_property ("tether-address", tethering_info_window, "ipv4-address", - BindingFlags.SYNC_CREATE); - bind_property ("tether-netmask", tethering_info_window, "ipv4-netmask", - BindingFlags.SYNC_CREATE); - bind_property ("tether-interface", tethering_info_window, "enet-iface", - BindingFlags.SYNC_CREATE); - bind_property ("tether-mac", tethering_info_window, "enet-mac", - BindingFlags.SYNC_CREATE); - tethering_info_window.show (); - }); - tethering_window.closed.connect (() => tethering_window = null); - tethering_window.show (); - }); - - try { - agent = new ConnmanAgent (); - var bus = Bus.get_sync (BusType.SYSTEM); - agent_object_path = new ObjectPath ("/org/ev3dev/brickman/connman_agent"); - bus.register_object (agent_object_path, agent); - } catch (IOError err) { - critical ("%s", err.message); - } - - Bus.watch_name (BusType.SYSTEM, Manager.SERVICE_NAME, - BusNameWatcherFlags.AUTO_START, () => { - init_async.begin ((obj, res) => { - try { - init_async.end (res); - status_window.loading = false; - connections_window.loading = false; - wifi_window.loading = false; - } catch (Error err) { - critical ("%s", err.message); - } - }); - }, () => { - status_window.loading = true; - connections_window.loading = true; - wifi_window.loading = true; - var service_keys = service_map.get_keys (); - foreach (var key in service_keys) { - key.removed (); - } - var technology_keys = technology_map.get_keys (); - foreach (var key in technology_keys) { - key.removed (); - } - manager = null; - }); - - // ConnMan does not have a way to get tethering info via DBus, so - // we have to get it ourselves. ConnMan creates a bridge device - // named "tether", so we use udev to watch for it. - udev_client = new GUdev.Client ({ NET_SUBSYSTEM }); - udev_client.uevent.connect (on_udev_event); - var tether_device = udev_client.query_by_subsystem_and_name (NET_SUBSYSTEM, TETHER_DEVICE_NAME); - if (tether_device != null) - on_udev_event ("add", tether_device); - } - - public void show_main_window () { - status_window.show (); - } - - public void add_controller (IBrickManagerModule controller) { - status_window.add_technology_controller (controller); - if (controller is BluetoothController) { - bluetooth_controller = (BluetoothController)controller; - if (manager != null) { - var bt_tech = manager.get_technology_by_type ("bluetooth"); - if (bt_tech != null) - bind_bluetooth_technology (bt_tech); - } - bluetooth_controller.show_network_requested.connect ((name) => { - var service = manager.get_service_by_name_and_type (name, "bluetooth"); - if (service == null) { - critical ("Could not find ConnMan service '%s'", name); - return; - } - on_connections_window_connection_selected (service); - }); - } - } - - async void init_async () throws DBusError, IOError { - manager = yield Manager.new_async (); - manager.bind_property ("state", status_window, "state", - BindingFlags.SYNC_CREATE, transform_manager_state_to_string); - manager.bind_property ("offline-mode", status_window, "offline-mode", - BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); - agent.manager = manager; - yield manager.register_agent (agent_object_path); - manager.technology_added.connect (on_technology_added); - foreach (var technology in manager.get_technologies ()) - on_technology_added (technology); - manager.services_changed.connect (on_services_changed); - on_services_changed (manager.get_services ()); - } - - void on_technology_added (Technology technology) { - // gadget is not powered by default, but we want it to always be powered. - if (technology.technology_type == "gadget" && !technology.powered) { - technology.powered = true; - } - - if (technology.technology_type == "wifi") { - technology.bind_property ("powered", wifi_status_bar_item, - "visible", BindingFlags.SYNC_CREATE); - technology.bind_property ("connected", wifi_status_bar_item, - "connected", BindingFlags.SYNC_CREATE); - wifi_technology = technology; - technology.removed.connect (() => { - wifi_technology = null; - }); - } - - if (technology.technology_type == "bluetooth") - bind_bluetooth_technology (technology); - if (technology.technology_type == "wifi") - bind_wifi_technology (technology); - - add_tethering_technology (technology); - } - - void on_services_changed (List changed) { - unbind_status_bar (); - - foreach (var service in changed) { - NetworkConnectionMenuItem menu_item; - if (service_map.contains (service)) { - menu_item = service_map[service]; - connections_window.menu.remove_menu_item (menu_item); - } else { - var icon_file = service.service_type.replace ("gadget", "usb") + "12x12.png"; - icon_file = Path.build_filename (Ev3devKit.DATA_DIR, icon_file); - menu_item = new NetworkConnectionMenuItem (icon_file); - menu_item.represented_object = service; - service.bind_property ("state", menu_item, "connected", - BindingFlags.SYNC_CREATE, transform_service_state_to_connected_bool); - service.bind_property ("name", menu_item, "connection-name", - BindingFlags.SYNC_CREATE); - // menu_item has reference to service, so using weak ref - // to break reference cycle. - weak NetworkConnectionMenuItem weak_menu_item = menu_item; - weak Service weak_service = service; - service.removed.connect (() => { - connections_window.menu.remove_menu_item (weak_menu_item); - service_map.remove (weak_service); - }); - service_map[service] = menu_item; - } - connections_window.menu.add_menu_item (menu_item); - - if (service.service_type == "wifi") { - WifiMenuItem wifi_menu_item; - if (wifi_service_map.contains (service)) { - wifi_menu_item = wifi_service_map[service]; - wifi_window.remove_menu_item (wifi_menu_item); - } else { - wifi_menu_item = new WifiMenuItem (); - wifi_menu_item.represented_object = service; - service.bind_property ("state", wifi_menu_item, "connected", - BindingFlags.SYNC_CREATE, transform_service_state_to_connected_bool); - service.bind_property ("name", wifi_menu_item, "connection-name", - BindingFlags.SYNC_CREATE); - service.bind_property ("security", wifi_menu_item, "security", - BindingFlags.SYNC_CREATE, transform_service_security_array_to_enum); - service.bind_property ("strength", wifi_menu_item, "signal-strength", - BindingFlags.SYNC_CREATE); - // wifi_menu_item has reference to service, so using - // weak ref to break reference cycle - weak WifiMenuItem weak_wifi_menu_item = wifi_menu_item; - weak Service weak_service = service; - service.removed.connect (() => { - wifi_window.remove_menu_item (weak_wifi_menu_item); - wifi_service_map.remove (weak_service); - }); - wifi_service_map[service] = wifi_menu_item; - } - wifi_window.add_menu_item (wifi_menu_item); - } - - // Show the IP address of the primary service in the status bar - // The list is ordered, so the first one is the one we want - if (status_bar_item_binding == null) { - status_bar_item_binding = service.bind_property ( - "ipv4", network_status_bar_item, "text", - BindingFlags.SYNC_CREATE, transform_service_ipv4_to_address_string); - } - } - - // If there were no connected services, then we will display the - // tether bridge address in the status bar if there is one. - if (status_bar_item_binding == null && has_tether) { - bind_tether_address_to_status_bar (); - } - } - - void unbind_status_bar () { - if (status_bar_item_binding != null) { - status_bar_item_binding.unbind (); - status_bar_item_binding = null; - status_bar_item_binding_is_tether = false; - network_status_bar_item.text = ""; - } - } - - void bind_bluetooth_technology (Technology technology) { - if (bluetooth_controller == null) - return; - bluetooth_controller.bind_powered (technology, "powered"); - } - - void bind_wifi_technology (Technology technology) { - wifi_window.available = true; - technology.bind_property ("powered", wifi_window, "powered", - BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); - var handler_id = wifi_window.scan_selected.connect (() => { - wifi_window.scanning = true; - technology.scan.begin ((obj, res) => { - try { - technology.scan.end (res); - } catch (Error err) { - var dialog = new MessageDialog ("Error", err.message); - dialog.show (); - } - wifi_window.scanning = false; - }); - }); - technology.removed.connect (() => { - wifi_window.available = false; - wifi_window.disconnect (handler_id); - }); - } - - void bind_tether_address_to_status_bar () { - status_bar_item_binding = bind_property ("tether-address", - network_status_bar_item, "text", BindingFlags.SYNC_CREATE); - status_bar_item_binding_is_tether = true; - } - - void on_connections_window_connection_selected (Object user_data) { - var service = (Service)user_data; - var title = service.name ?? ""; - var connection_window = new NetworkConnectionWindow (title); - service.bind_property ("auto-connect", connection_window, "auto-connect", - BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); - service.bind_property ("state", connection_window, "state", - BindingFlags.SYNC_CREATE , transform_service_state_to_string); - service.bind_property ("state", connection_window, "is-connect-busy", - BindingFlags.SYNC_CREATE , transform_service_state_to_busy_bool); - service.bind_property ("state", connection_window, "is-connected", - BindingFlags.SYNC_CREATE , transform_service_state_to_connected_bool); - weak NetworkConnectionWindow weak_connection_window = connection_window; - connection_window.connect_requested.connect ((disconnect) => - on_properties_window_connect_requested.begin (weak_connection_window, service, disconnect)); - - connection_window.ipv4_button_pressed.connect (() => { - var ipv4_window = new NetworkConnectionIpv4Window (title); - service.bind_property ("ipv4", ipv4_window, "method", - BindingFlags.SYNC_CREATE, transform_service_ipv4_to_method_string); - service.bind_property ("ipv4", ipv4_window, "address", - BindingFlags.SYNC_CREATE, transform_service_ipv4_to_address_string); - service.bind_property ("ipv4", ipv4_window, "netmask", - BindingFlags.SYNC_CREATE, transform_service_ipv4_to_netmask_string); - service.bind_property ("ipv4", ipv4_window, "gateway", - BindingFlags.SYNC_CREATE, transform_service_ipv4_to_gateway_string); - service.bind_property ("ipv4-configuration", ipv4_window, "config-address", - BindingFlags.SYNC_CREATE, transform_service_ipv4_to_address_string); - service.bind_property ("ipv4-configuration", ipv4_window, "config-netmask", - BindingFlags.SYNC_CREATE, transform_service_ipv4_to_netmask_string); - service.bind_property ("ipv4-configuration", ipv4_window, "config-gateway", - BindingFlags.SYNC_CREATE, transform_service_ipv4_to_gateway_string); - ipv4_window.change_requested.connect ((method, address, netmask, gateway, addresses) => { - try { - service.ipv4_configuration = new IPv4Info () { - method = IPv4Method.from_string (method), - address = address, - netmask = netmask, - gateway = gateway - }; - service.nameservers_configuration = addresses; - } catch (DBusError err) { - critical ("Failed to convert method '%s' to IPv4Info", method); - } - }); - - weak Window weak_ipv4_window = ipv4_window; - var handler_id = service.removed.connect (() => { - weak_ipv4_window.close (); - }); - ipv4_window.closed.connect (() => { - service.disconnect (handler_id); - }); - - ipv4_window.show (); - }); - - connection_window.dns_button_pressed.connect (() => { - var dns_window = new NetworkConnectionDnsWindow (title); - service.bind_property ("nameservers", dns_window, "addresses", - BindingFlags.SYNC_CREATE); - dns_window.change_requested.connect ((addresses) => - service.nameservers_configuration = addresses); - - weak Window weak_dns_window = dns_window; - var handler_id = service.removed.connect (() => { - weak_dns_window.close (); - }); - dns_window.closed.connect (() => { - service.disconnect (handler_id); - }); - - dns_window.show (); - }); - - connection_window.enet_button_pressed.connect (() => { - var enet_window = new NetworkConnectionEnetWindow (title); - service.bind_property ("ethernet", enet_window, "method", - BindingFlags.SYNC_CREATE, transform_service_ethernet_to_method_string); - service.bind_property ("ethernet", enet_window, "interface", - BindingFlags.SYNC_CREATE, transform_service_ethernet_to_interface_string); - service.bind_property ("ethernet", enet_window, "address", - BindingFlags.SYNC_CREATE, transform_service_ethernet_to_address_string); - service.bind_property ("ethernet", enet_window, "mtu", - BindingFlags.SYNC_CREATE, transform_service_ethernet_to_mtu_int); - - weak Window weak_enet_window = enet_window; - var handler_id = service.removed.connect (() => { - weak_enet_window.close (); - }); - enet_window.closed.connect (() => { - service.disconnect (handler_id); - }); - - enet_window.show (); - }); - - var handler_id = service.removed.connect (() => { - weak_connection_window.close (); - var dialog = new MessageDialog ("Network", - "%s is no longer available.".printf (service.name)); - dialog.show (); - }); - connection_window.closed.connect (() => { - service.disconnect (handler_id); - }); - - connection_window.show (); - } - - void on_wifi_connection_selected (Object represented_object) { - var service = (Service)represented_object; - var info_window = new WifiNetworkWindow (service.name); - service.bind_property ("state", info_window, "status", - BindingFlags.SYNC_CREATE, transform_service_state_to_string); - service.bind_property ("state", info_window, "action", - BindingFlags.SYNC_CREATE, transform_service_state_to_wifi_action); - service.bind_property ("favorite", info_window, "can-forget", - BindingFlags.SYNC_CREATE); - - info_window.status_selected.connect (() => { - var wifi_network_status_window = new WifiNetworkStatusWindow (service.name); - service.bind_property ("state", wifi_network_status_window, "status", - BindingFlags.SYNC_CREATE, transform_service_state_to_string); - service.bind_property ("strength", wifi_network_status_window, "signal-strength", - BindingFlags.SYNC_CREATE); - service.bind_property ("security", wifi_network_status_window, "security", - BindingFlags.SYNC_CREATE, transform_service_security_array_to_string); - service.bind_property ("ipv4", wifi_network_status_window, "address", - BindingFlags.SYNC_CREATE, transform_service_ipv4_to_address_string); - - wifi_network_status_window.show (); - }); - info_window.action_selected.connect (() => handle_wifi_action (service)); - info_window.forget_selected.connect (() => { - service.remove.begin ((obj, res) => { - try { - service.remove.end (res); - } catch (Error err) { - var dialog = new MessageDialog ("Error", err.message); - dialog.show (); - } - }); - }); - info_window.network_connection_selected.connect (() => - on_connections_window_connection_selected (service)); - - weak Window weak_info_window = info_window; - var handler_id = service.removed.connect (() => { - var dialog = new MessageDialog ("Wi-Fi", - "%s is no longer available.".printf (service.name)); - dialog.show (); - weak_info_window.close (); - }); - info_window.closed.connect (() => { - service.disconnect (handler_id); - }); - - info_window.show (); - } - - void handle_wifi_action (Service service) { - switch (service.state) { - case ServiceState.IDLE: - service.connect_service.begin (true, (obj, res) => { - try { - service.connect_service.end (res); - } catch (Error err) { - var dialog = new MessageDialog ("Error", err.message); - dialog.show (); - } - }); - break; - case ServiceState.FAILURE: - service.remove.begin ((obj, res) => { - try { - service.remove.end (res); - } catch (Error err) { - var dialog = new MessageDialog ("Error", err.message); - dialog.show (); - } - }); - break; - case ServiceState.ASSOCIATION: - case ServiceState.CONFIGURATION: - case ServiceState.READY: - case ServiceState.DISCONNECT: - case ServiceState.ONLINE: - service.disconnect_service.begin ((obj, res) => { - try { - service.disconnect_service.end (res); - } catch (Error err) { - var dialog = new MessageDialog ("Error", err.message); - dialog.show (); - } - }); - break; - } - } - - async void on_properties_window_connect_requested ( - NetworkConnectionWindow connection_window, Service service, bool disconnect) - { - if (disconnect) { - try { - connection_window.is_connect_busy = true; - yield service.disconnect_service (); - } catch (Error err) { - var dialog = new MessageDialog ("Error", err.message); - dialog.show (); - connection_window.is_connect_busy = false; - } - } else { - try { - connection_window.is_connect_busy = true; - // Do long timeout for WiFi since we have to wait for password entry - yield service.connect_service (service.service_type == "wifi"); - } catch (Error err) { - var dialog = new MessageDialog ("Error", err.message); - dialog.show (); - connection_window.is_connect_busy = false; - } - } - } - - void add_tethering_technology (Technology technology) { - if (tethering_window == null) - return; - if (technology.technology_type in TETHERING_TECHNOLOGIES) { - var menu_item = tethering_window.add_menu_item (technology.name); - technology.bind_property ("tethering", menu_item.checkbox, "checked", - BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); - var handler_id = technology.removed.connect (() => - tethering_window.remove_menu_item (menu_item)); - tethering_window.closed.connect (() => - technology.disconnect (handler_id)); - } - } - - /** - * Handle add/remove of "tether" network bridge device. - * - * Some info (MAC address) is available via sysfs, but we have to use - * getifaddrs to get the IP address info. - */ - void on_udev_event (string action, GUdev.Device device) { - if (device.get_name () != TETHER_DEVICE_NAME) - return; - switch (action) { - case "add": - case "change": - Linux.Network.IfAddrs if_addrs; - unowned Linux.Network.IfAddrs current; - if (Linux.Network.getifaddrs (out if_addrs) == 0) { - current = if_addrs; - while (current != null) { - if (current.ifa_name == TETHER_DEVICE_NAME && current.ifa_addr != null) { - // Get the IPv4 address/netmask - if (current.ifa_addr.sa_family == Posix.AF_INET) { - has_tether = true; - // the first 2 bytes of sa_data are the port, so we are skipping them. - tether_address = "%d.%d.%d.%d".printf ( - current.ifa_addr.sa_data[2], - current.ifa_addr.sa_data[3], - current.ifa_addr.sa_data[4], - current.ifa_addr.sa_data[5]); - if (current.ifa_netmask != null && current.ifa_netmask.sa_family == Posix.AF_INET) { - tether_netmask = "%d.%d.%d.%d".printf ( - current.ifa_netmask.sa_data[2], - current.ifa_netmask.sa_data[3], - current.ifa_netmask.sa_data[4], - current.ifa_netmask.sa_data[5]); - } else { - tether_netmask = ""; - } - tether_interface = device.get_name (); - tether_mac = device.get_sysfs_attr ("address"); - if (status_bar_item_binding == null) { - bind_tether_address_to_status_bar (); - } - break; - } - } - current = current.ifa_next; - } - } else { - critical ("getifaddrs failed."); - } - break; - case "remove": - has_tether = false; - if (status_bar_item_binding_is_tether) - unbind_status_bar (); - break; - } - } - - bool transform_manager_state_to_string (Binding binding, - Value source_value, ref Value target_value) - { - switch (source_value.get_enum ()) { - case ManagerState.OFFLINE: - target_value.set_string ("Offline"); - break; - case ManagerState.IDLE: - target_value.set_string ("No connections"); - break; - case ManagerState.READY: - target_value.set_string ("Connected"); - break; - case ManagerState.ONLINE: - target_value.set_string ("Online"); - break; - default: - return false; - } - return true; - } - - bool transform_service_state_to_string (Binding binding, - Value source_value, ref Value target_value) - { - switch (source_value.get_enum ()) { - case ServiceState.IDLE: - target_value.set_string ("Disconnected"); - break; - case ServiceState.FAILURE: - target_value.set_string ("Failed"); - break; - case ServiceState.ASSOCIATION: - target_value.set_string ("Associating"); - break; - case ServiceState.CONFIGURATION: - target_value.set_string ("Configuring"); - break; - case ServiceState.READY: - target_value.set_string ("Connected"); - break; - case ServiceState.DISCONNECT: - target_value.set_string ("Disconnecting"); - break; - case ServiceState.ONLINE: - target_value.set_string ("Online"); - break; - default: - return false; - } - return true; - } - - bool transform_service_state_to_busy_bool (Binding binding, - Value source_value, ref Value target_value) - { - switch (source_value.get_enum ()) { - case ServiceState.IDLE: - case ServiceState.FAILURE: - case ServiceState.READY: - case ServiceState.ONLINE: - target_value.set_boolean (false); - break; - case ServiceState.ASSOCIATION: - case ServiceState.CONFIGURATION: - case ServiceState.DISCONNECT: - target_value.set_boolean (true); - break; - default: - return false; - } - return true; - } - - bool transform_service_state_to_connected_bool (Binding binding, - Value source_value, ref Value target_value) - { - switch (source_value.get_enum ()) { - case ServiceState.READY: - case ServiceState.ONLINE: - case ServiceState.DISCONNECT: - target_value.set_boolean (true); - break; - case ServiceState.IDLE: - case ServiceState.FAILURE: - case ServiceState.ASSOCIATION: - case ServiceState.CONFIGURATION: - target_value.set_boolean (false); - break; - default: - return false; - } - return true; - } - - bool transform_service_state_to_wifi_action (Binding binding, - Value source_value, ref Value target_value) - { - switch (source_value.get_enum ()) { - case ServiceState.IDLE: - target_value.set_string ("Connect"); - break; - case ServiceState.FAILURE: - target_value.set_string ("Reset"); - break; - case ServiceState.READY: - case ServiceState.ONLINE: - case ServiceState.DISCONNECT: - target_value.set_string ("Disconnect"); - break; - case ServiceState.ASSOCIATION: - case ServiceState.CONFIGURATION: - target_value.set_string ("Cancel"); - break; - default: - return false; - } - return true; - } - - bool transform_service_security_array_to_string (Binding binding, - Value source_value, ref Value target_value) - { - var array = (GenericArray)source_value.get_boxed (); - if (array.length == 0) { - target_value.set_string ("N/A"); - return true; - } - var builder = new StringBuilder (); - var error = false; - array.foreach ((item) => { - switch (item) { - case ServiceSecurity.NONE: - builder.append ("None"); - break; - case ServiceSecurity.WEP: - builder.append ("WEP"); - break; - case ServiceSecurity.PSK: - builder.append ("WPA/2 PSK"); - break; - case ServiceSecurity.IEEE8021X: - builder.append ("EAP"); - break; - case ServiceSecurity.WPS: - builder.append ("WPS"); - break; - default: - error = true; - return; - } - builder.append (", "); - }); - if (error) - return false; - builder.truncate (builder.len - 2); - target_value.set_string (builder.str); - return true; - } - - bool transform_service_security_array_to_enum (Binding binding, - Value source_value, ref Value target_value) - { - var array = (GenericArray)source_value.get_boxed (); - var has_none = false; - var has_secured = false; - var has_wps = false; - array.foreach ((item) => { - switch (item) { - case ServiceSecurity.NONE: - has_none = true; - break; - case ServiceSecurity.WEP: - case ServiceSecurity.PSK: - case ServiceSecurity.IEEE8021X: - has_secured = true; - break; - case ServiceSecurity.WPS: - has_wps = true; - break; - } - }); - // Not sure if it is possible to get more than one of these values - // true at the same time or not, but in case it is, the order matters - if (has_wps) - target_value.set_enum (WifiSecurity.WPS); - else if (has_secured) - target_value.set_enum (WifiSecurity.SECURED); - else if (has_none) - target_value.set_enum (WifiSecurity.OPEN); - else - return false; - return true; - } - - bool transform_service_ipv4_to_method_string (Binding binding, - Value source_value, ref Value target_value) - { - unowned IPv4Info info = (IPv4Info)source_value.get_pointer (); - if (info.method == null) { - target_value.set_string (""); - return true; - } - switch (info.method) { - case IPv4Method.DHCP: - target_value.set_string ("DHCP"); - break; - case IPv4Method.MANUAL: - target_value.set_string ("Manual"); - break; - case IPv4Method.OFF: - target_value.set_string ("Off"); - break; - default: - return false; - } - return true; - } - - bool transform_service_ipv4_to_address_string (Binding binding, - Value source_value, ref Value target_value) - { - unowned IPv4Info info = (IPv4Info)source_value.get_pointer (); - target_value.set_string (info.address ?? ""); - return true; - } - - bool transform_service_ipv4_to_netmask_string (Binding binding, - Value source_value, ref Value target_value) - { - unowned IPv4Info info = (IPv4Info)source_value.get_pointer (); - target_value.set_string (info.netmask ?? ""); - return true; - } - - bool transform_service_ipv4_to_gateway_string (Binding binding, - Value source_value, ref Value target_value) - { - unowned IPv4Info info = (IPv4Info)source_value.get_pointer (); - target_value.set_string (info.gateway ?? ""); - return true; - } - - bool transform_service_ethernet_to_method_string (Binding binding, - Value source_value, ref Value target_value) - { - unowned EthernetInfo info = (EthernetInfo)source_value.get_pointer (); - if (info.method == null) { - target_value.set_string (""); - return true; - } - switch (info.method) { - case EthernetMethod.AUTO: - target_value.set_string ("Automatic"); - break; - case EthernetMethod.MANUAL: - target_value.set_string ("Manual"); - break; - default: - return false; - } - return true; - } - - bool transform_service_ethernet_to_interface_string (Binding binding, - Value source_value, ref Value target_value) - { - unowned EthernetInfo info = (EthernetInfo)source_value.get_pointer (); - target_value.set_string (info.interface ?? ""); - return true; - } - - bool transform_service_ethernet_to_address_string (Binding binding, - Value source_value, ref Value target_value) - { - unowned EthernetInfo info = (EthernetInfo)source_value.get_pointer (); - target_value.set_string (info.address ?? ""); - return true; - } - - bool transform_service_ethernet_to_mtu_int (Binding binding, - Value source_value, ref Value target_value) - { - unowned EthernetInfo info = (EthernetInfo)source_value.get_pointer (); - target_value.set_int (info.mtu ?? 0); - return true; - } - } -} diff --git a/src/controller/OpenRobertaController.vala b/src/controller/OpenRobertaController.vala deleted file mode 100644 index 3d16de9..0000000 --- a/src/controller/OpenRobertaController.vala +++ /dev/null @@ -1,211 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright 2015 Stefan Sauer - * Copyright 2015 David Lechner - * - * 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 2 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -/* OpenRobertaController.vala - Controller for openroberta lab service */ - -using Ev3devKit; -using Ev3devKit.Ui; - -namespace BrickManager { - // TODO: move to lib/openroberta/Manager.vala - [DBus (name = "org.openroberta.lab")] - interface OpenRobertaLab : Object { - [DBus (name = "status")] - public signal void status (string message); - - [DBus (name = "connect")] - public abstract string connect (string address) throws DBusError, IOError; - [DBus (name = "disconnect")] - public abstract void disconnect () throws DBusError, IOError; - } - - public class OpenRobertaController : Object, IBrickManagerModule { - const string SERVICE_NAME = "org.openroberta.lab"; - const string CONFIG = "/etc/openroberta.conf"; - const int OPEN_ROBERTA_TTY_NUM = 2; - - OpenRobertaWindow open_roberta_window; - internal OpenRobertaStatusBarItem status_bar_item; - OpenRobertaLab service; - KeyFile config; - bool executing_user_code; - - public bool available { get; set; } - - public string display_name { get { return "Open Roberta Lab"; } } - - public OpenRobertaController () { - status_bar_item = new OpenRobertaStatusBarItem (); - config = new KeyFile (); - - bind_property ("available", status_bar_item, "visible", - BindingFlags.SYNC_CREATE); - - Bus.watch_name (BusType.SYSTEM, SERVICE_NAME, - BusNameWatcherFlags.NONE, () => { - connect_async.begin ((obj, res) => { - try { - connect_async.end (res); - if (open_roberta_window != null) { - open_roberta_window.loading = false; - } - available = true; - } catch (IOError err) { - warning ("%s", err.message); - } - }); - }, () => { - status_bar_item.connected = false; - if (open_roberta_window != null) { - open_roberta_window.connected = false; - } - available = false; - service = null; - // if the service dies (while running code), definitely - // switch back to brickman - // FIXME: This should only be called if the current tty is the OpenRoberta tty - // FIXME: need to figure out how console switching is going to work with GRX3 - // chvt (ConsoleApp.get_tty_num ()); - }); - } - - public void show_main_window () { - if (open_roberta_window == null) { - init_main_window (); - } - open_roberta_window.show (); - } - - void init_main_window () { - open_roberta_window = new OpenRobertaWindow (display_name) { - loading = !available - }; - - bind_property ("available", open_roberta_window, "available", - BindingFlags.SYNC_CREATE); - - try { - config.load_from_file (CONFIG, KeyFileFlags.KEEP_COMMENTS); - open_roberta_window.custom_server_address = - config.get_string ("Common", "CustomServer"); - open_roberta_window.selected_server = - config.get_string ("Common", "SelectedServer"); - } catch (FileError err) { - warning ("FileError: %s", err.message); - } catch (KeyFileError err) { - warning ("KeyFileError: %s", err.message); - } - - open_roberta_window.connect_selected.connect (on_server_connect); - open_roberta_window.disconnect_selected.connect (on_server_disconnect); - open_roberta_window.notify["custom-server-address"].connect ( - on_custom_server_changed); - } - - async void connect_async () throws IOError { - service = yield Bus.get_proxy (BusType.SYSTEM, SERVICE_NAME, - "/org/openroberta/Lab1"); - service.status.connect (on_status_changed); - //TODO: DBus service does not provide the initial state of "status". - //on_status_changed (service.status); - } - - void on_status_changed (string message) { - debug ("service status: '%s'", message); - // connected: we've started the communication with the server - // registered: we're online - // disconnected: the communication with the server is stopped or has - // been terminated - // executing: we're online and a program is running - string[] online = { "registered", "executing" }; - if (message in online) { - status_bar_item.connected = true; - open_roberta_window.connected = true; - if (message == "registered") { - if (executing_user_code) { - // FIXME: need to figure out how console switching is going to work with GRX3 - // var tty_num = ConsoleApp.get_tty_num (); - // debug ("program done, switching to tty%d", tty_num); - // executing_user_code = false; - // chvt (tty_num); - } else { - debug ("connection established, closing the dialog"); - OpenRobertaWindow.close_pairing_code_dialog (); - // remember selected server - config.set_string ("Common", "SelectedServer", - open_roberta_window.selected_server); - try { - config.save_to_file (CONFIG); - } catch (FileError err) { - warning ("FileError: %s", err.message); - } - } - } - if (message == "executing") { - debug ("program starts, switching to tty%d", OPEN_ROBERTA_TTY_NUM); - executing_user_code = true; - chvt (OPEN_ROBERTA_TTY_NUM); - } - } else { - status_bar_item.connected = false; - open_roberta_window.connected = false; - if (message == "disconnected") { - debug ("connection failed, closing the dialog"); - OpenRobertaWindow.close_pairing_code_dialog (); - } - } - } - - void on_custom_server_changed () { - config.set_string ("Common", "CustomServer", - open_roberta_window.custom_server_address); - try { - config.save_to_file (CONFIG); - } catch (FileError err) { - warning ("FileError: %s", err.message); - } - } - - void on_server_connect (string address) { - try { - open_roberta_window.selected_server = address; - var code = service.connect ("http://" + address); - OpenRobertaWindow.show_pairing_code_dialog (code); - } catch (Error err) { - warning ("%s", err.message); - } - } - - void on_server_disconnect () { - try { - service.disconnect (); - } catch (Error err) { - warning ("%s", err.message); - } - } - - void chvt (int num) { - // TODO: might be better to do this with ioctl - Posix.system ("/bin/chvt %d".printf (num)); - } - } -} diff --git a/src/dbus/Bluez5Agent.vala b/src/dbus/Bluez5Agent.vala deleted file mode 100644 index 239ea91..0000000 --- a/src/dbus/Bluez5Agent.vala +++ /dev/null @@ -1,288 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright 2014-2015 David Lechner - * - * 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 2 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -/* Bluez5Agent.vala - BlueZ 5 Agent implementation */ - -using Ev3devKit.Ui; -using Bluez5; - -namespace BrickManager { - [DBus (name = "org.bluez.Agent1")] - public class Bluez5Agent : Object { - MessageDialog? display_passkey_dialog; - - signal void canceled (); - - public Bluez5Agent () { - } - - public void release () throws DBusError, IOError { - //debug ("Released."); - } - - public async string request_pin_code (ObjectPath device_path) throws DBusError, IOError, BlueZError { - var result = ConfirmationDialogResult.CANCELED; - var device = Device.get_for_object_path (device_path); - var dialog = new Dialog (); - weak Dialog weak_dialog = dialog; - var canceled_handler_id = canceled.connect(() => { - dialog.close (); - }); - dialog.closed.connect (() => { - SignalHandler.disconnect (this, canceled_handler_id); - request_pin_code.callback (); - }); - var dialog_vbox = new Box.vertical () { - spacing = 3 - }; - dialog.add (dialog_vbox); - var title_label = new Label (device.alias) { - vertical_align = WidgetAlign.START, - padding = 3, - border_bottom = 1 - }; - dialog_vbox.add (title_label); - var message_label = new Label ("Enter PIN:"); - dialog_vbox.add (message_label); - // TODO: may need to allow alpha and symbol chars. - var text_entry = new TextEntry ("1234 ") { - valid_chars = TextEntry.NUMERIC + " ", - use_on_screen_keyboard = false, - horizontal_align = WidgetAlign.CENTER - }; - dialog_vbox.add (text_entry); - dialog_vbox.add (new Spacer ()); - var button_vbox = new Box.vertical (); - dialog_vbox.add (button_vbox); - var button_hbox = new Box.horizontal () { - horizontal_align = WidgetAlign.CENTER, - margin_top = -6, - margin_bottom = 3 - }; - button_vbox.add (button_hbox); - var reject_button = new Button.with_label ("Reject"); - reject_button.pressed.connect (() => { - result = ConfirmationDialogResult.REJECTED; - weak_dialog.close (); - }); - button_hbox.add (reject_button); - var accept_button = new Button.with_label ("Accept"); - accept_button.pressed.connect (() => { - result = ConfirmationDialogResult.ACCEPTED; - weak_dialog.close (); - }); - button_hbox.add (accept_button); - text_entry.next_focus_widget_down = accept_button; - dialog.show (); - yield; - if (result == ConfirmationDialogResult.REJECTED) - throw new BlueZError.REJECTED ("Rejected."); - if (result == ConfirmationDialogResult.CANCELED) - throw new BlueZError.CANCELED ("Canceled."); - return text_entry.text.replace (" ", ""); - } - - public void display_pin_code (ObjectPath device_path, string pincode) throws DBusError, IOError { - var device = Device.get_for_object_path (device_path); - var dialog = new MessageDialog (device.alias, - "PIN code is:\n%s".printf (pincode)); - weak Dialog weak_dialog = dialog; - var canceled_handler_id = canceled.connect(() => { - dialog.close (); - }); - ulong closed_handler_id = 0; - closed_handler_id = dialog.closed.connect (() => { - SignalHandler.disconnect (this, canceled_handler_id); - SignalHandler.disconnect (weak_dialog, closed_handler_id); - }); - dialog.show (); - } - - public async uint32 request_passkey (ObjectPath device_path) throws DBusError, IOError, BlueZError { - var result = ConfirmationDialogResult.CANCELED; - var device = Device.get_for_object_path (device_path); - var dialog = new Dialog (); - weak Dialog weak_dialog = dialog; - var canceled_handler_id = canceled.connect(() => { - dialog.close (); - }); - dialog.closed.connect (() => { - SignalHandler.disconnect (this, canceled_handler_id); - request_passkey.callback (); - }); - var dialog_vbox = new Box.vertical () { - spacing = 6 - }; - dialog.add (dialog_vbox); - var title_label = new Label (device.alias) { - vertical_align = WidgetAlign.START, - padding = 3, - border_bottom = 1 - }; - dialog_vbox.add (title_label); - var message_label = new Label ("Enter passkey"); - dialog_vbox.add (message_label); - var text_entry = new TextEntry ("000000") { - valid_chars = TextEntry.NUMERIC, - use_on_screen_keyboard = false, - horizontal_align = WidgetAlign.CENTER - }; - dialog_vbox.add (text_entry); - dialog_vbox.add (new Spacer ()); - var button_vbox = new Box.vertical (); - dialog_vbox.add (button_vbox); - var button_hbox = new Box.horizontal () { - horizontal_align = WidgetAlign.CENTER, - margin_top = -6, - margin_bottom = 3 - }; - button_vbox.add (button_hbox); - var reject_button = new Button.with_label ("Reject"); - reject_button.pressed.connect (() => { - result = ConfirmationDialogResult.REJECTED; - weak_dialog.close (); - }); - button_hbox.add (reject_button); - var accept_button = new Button.with_label ("Accept"); - accept_button.pressed.connect (() => { - result = ConfirmationDialogResult.ACCEPTED; - weak_dialog.close (); - }); - button_hbox.add (accept_button); - text_entry.next_focus_widget_down = accept_button; - dialog.show (); - yield; - if (result == ConfirmationDialogResult.REJECTED) - throw new BlueZError.REJECTED ("Rejected."); - if (result == ConfirmationDialogResult.CANCELED) - throw new BlueZError.CANCELED ("Canceled."); - return (uint32)int.parse (text_entry.text); - } - - public void display_passkey (ObjectPath device_path, uint32 passkey, uint16 entered) throws DBusError, IOError { - // TODO: Do we want/need to do something with the `entered` parameter? - var device = Device.get_for_object_path (device_path); - // This particular function can be called multiple times while the - // dialog is still displayed, so, if this happens, we remove the old - // dialog and display a new one. - if (display_passkey_dialog != null) - display_passkey_dialog.close (); - display_passkey_dialog = new MessageDialog (device.alias, - "Passkey is: \n%s".printf ("%06u".printf (passkey))); - weak Dialog weak_dialog = display_passkey_dialog; - var canceled_handler_id = canceled.connect(() => { - display_passkey_dialog.close (); - }); - ulong closed_handler_id = 0; - closed_handler_id = display_passkey_dialog.closed.connect (() => { - SignalHandler.disconnect (this, canceled_handler_id); - SignalHandler.disconnect (weak_dialog, closed_handler_id); - // have to call as function to prevent reference cycle. - dispose_display_passkey_dialog (); - }); - display_passkey_dialog.show (); - } - - void dispose_display_passkey_dialog () { - display_passkey_dialog = null; - } - - public async void request_confirmation (ObjectPath device_path, uint32 passkey) throws DBusError, IOError, BlueZError { - var device = Device.get_for_object_path (device_path); - yield display_confirmation_dialog (device.alias, - "Confirm passkey\n%s".printf ("%06u".printf (passkey))); - } - - public async void request_authorization (ObjectPath device_path) throws DBusError, IOError, BlueZError { - var device = Device.get_for_object_path (device_path); - yield display_confirmation_dialog (device.alias, - "Authorize\nthis device?"); - } - - public async void authorize_service (ObjectPath device_path, string uuid) throws DBusError, IOError, BlueZError { - var device = Device.get_for_object_path (device_path); - yield display_confirmation_dialog (device.alias, - "Authorize service\n%s?".printf (Bluez5.Uuid.to_short_profile (uuid))); - } - - async void display_confirmation_dialog (string title, string message) throws DBusError, IOError, BlueZError { - var result = ConfirmationDialogResult.CANCELED; - var dialog = new Dialog (); - weak Dialog weak_dialog = dialog; - var canceled_handler_id = canceled.connect(() => { - dialog.close (); - }); - dialog.closed.connect (() => { - SignalHandler.disconnect (this, canceled_handler_id); - display_confirmation_dialog.callback (); - }); - var dialog_vbox = new Box.vertical () { - spacing = 3 - }; - dialog.add (dialog_vbox); - var title_label = new Label (title) { - vertical_align = WidgetAlign.START, - padding = 3, - border_bottom = 1 - }; - dialog_vbox.add (title_label); - var message_label = new Label (message); - dialog_vbox.add (message_label); - dialog_vbox.add (new Spacer ()); - var button_vbox = new Box.vertical (); - dialog_vbox.add (button_vbox); - var button_hbox = new Box.horizontal () { - horizontal_align = WidgetAlign.CENTER, - margin = 3 - }; - button_vbox.add (button_hbox); - var reject_button = new Button.with_label ("Reject"); - reject_button.pressed.connect (() => { - result = ConfirmationDialogResult.REJECTED; - weak_dialog.close (); - }); - button_hbox.add (reject_button); - var accept_button = new Button.with_label ("Accept"); - accept_button.pressed.connect (() => { - result = ConfirmationDialogResult.ACCEPTED; - weak_dialog.close (); - }); - button_hbox.add (accept_button); - dialog.show (); - accept_button.focus (); - yield; - if (result == ConfirmationDialogResult.REJECTED) - throw new BlueZError.REJECTED ("Rejected."); - if (result == ConfirmationDialogResult.CANCELED) - throw new BlueZError.CANCELED ("Canceled."); - } - - public void cancel () throws DBusError, IOError { - canceled (); - } - - enum ConfirmationDialogResult { - ACCEPTED, - REJECTED, - CANCELED - } - } -} \ No newline at end of file diff --git a/src/dbus/ConnmanAgent.vala b/src/dbus/ConnmanAgent.vala deleted file mode 100644 index b53702d..0000000 --- a/src/dbus/ConnmanAgent.vala +++ /dev/null @@ -1,157 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright 2014-2015 David Lechner - * - * 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 2 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -/* ConnmanAgent.vala - ConnMan Agent implementation */ - -using Ev3devKit.Ui; -using Connman; - -namespace BrickManager { - [DBus (name = "net.connman.Agent")] - public class ConnmanAgent : Object { - const string NAME_KEY = "Name"; - const string SSID_KEY = "SSID"; - const string IDENTITY_KEY = "Identity"; - const string PASSPHRASE_KEY = "Passphrase"; - const string PREVIOUS_PASSPHRASE_KEY = "PreviousPassphrase"; - const string WPS_KEY = "WPS"; - const string USERNAME_KEY = "Username"; - const string PASSWORD_KEY = "Password"; - const string TYPE_KEY = "Type"; - const string REQUIREMENT_KEY = "Requirement"; - const string ALTERNATES_KEY = "Alternates"; - const string VALUE_KEY = "Value"; - - [DBus (visible = false)] - public Manager? manager { get; set; } - - signal void canceled (); - - public ConnmanAgent () { - } - - public async void release () throws DBusError, IOError { - //debug ("Released."); - } - - public async void report_error (ObjectPath service_path, string err) throws DBusError, IOError, ConnmanAgentError { - var dialog = new MessageDialog ("Error", err); - dialog.show (); - // TODO: get user feedback for retry - //throw new ConnmanAgentError.RETRY ("User requested retry."); - } - - public async void report_peer_error (ObjectPath peer_path, string err) throws DBusError, IOError, ConnmanAgentError { - var dialog = new MessageDialog ("Error", err); - dialog.show (); - // TODO: get user feedback for retry - //throw new ConnmanAgentError.RETRY ("User requested retry."); - } - - public async void request_browser (ObjectPath service_path, string url) throws DBusError, IOError, ConnmanAgentError { - throw new ConnmanAgentError.CANCELED ("Web browser not implemented."); - } - - public async HashTable request_input (ObjectPath service_path, HashTable fields) throws DBusError, IOError, ConnmanAgentError { - var service = manager.get_service (service_path); - var required_field_names = new SList (); - string? previous_passphrase = null; - fields.foreach ((k, v) => { - //debug ("%s %s", k, v.print (true)); - var requirement = v.lookup_value (REQUIREMENT_KEY, VariantType.STRING); - if (requirement != null && requirement.get_string () == "mandatory") { - required_field_names.prepend (k); - } - if (k == PREVIOUS_PASSPHRASE_KEY) { - var previous_passphrase_value = v.lookup_value (VALUE_KEY, VariantType.STRING); - if (previous_passphrase_value != null) { - previous_passphrase = previous_passphrase_value.dup_string (); - } - } - }); - var result = new HashTable (null, null); - required_field_names.reverse (); - foreach (var required_field_name in required_field_names) { - var dialog = new ConnmanAgentInputDialog ( - "Please enter %s for %s.".printf (field_to_string (required_field_name), - service.name), - previous_passphrase ?? ""); - bool dialog_canceled = true; - weak ConnmanAgentInputDialog weak_dialog = dialog; - dialog.responded.connect ((accepted) => { - dialog_canceled = !accepted; - result[required_field_name] = weak_dialog.text_value; - request_input.callback (); - }); - var handler_id = canceled.connect (() => { - dialog.responded (false); - dialog.close (); - var message_dialog = new MessageDialog ("Info", "Request was canceled."); - message_dialog.show (); - }); - dialog.show (); - yield; - SignalHandler.disconnect (this, handler_id); - if (dialog_canceled) { - throw new ConnmanAgentError.CANCELED ("Canceled by the user."); - } - } - return result; - } - - public async HashTable request_peer_authorization (ObjectPath peer_path, HashTable fields) throws DBusError, IOError, ConnmanAgentError { - //var peer = Peer.from_path_sync (peer_path); - throw new ConnmanAgentError.CANCELED ("Not implemented."); - } - - public async void cancel () throws DBusError, IOError { - canceled (); - } - - string field_to_string (string field) { - switch (field) { - case NAME_KEY: - case SSID_KEY: - return "SSID"; - case IDENTITY_KEY: - case USERNAME_KEY: - return "username"; - case PASSPHRASE_KEY: - return "passphrase"; - case WPS_KEY: - return "WPS PIN"; - case PASSWORD_KEY: - return "password"; - default: - critical ("Unexpected field '%s'", field); - return "???"; - } - } - } - - [DBus (name = "net.connman.Agent.Error")] - public errordomain ConnmanAgentError { - CANCELED, - LAUNCH_BROWSER, - REJECTED, - RETRY - } -} \ No newline at end of file diff --git a/src/main.vala b/src/main.vala deleted file mode 100644 index 736d78e..0000000 --- a/src/main.vala +++ /dev/null @@ -1,131 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright 2014-2015 David Lechner - * - * 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 2 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -/* main.vala - main function */ - -using Ev3devKit; -using Ev3devKit.Ui; -using Linux.VirtualTerminal; -using Posix; - -namespace BrickManager { - const string SPLASH_PNG = "splash.png"; - - // The global_manager is shared by all of the controller objects - GlobalManager global_manager; - - public static int main (string[] args) { - try { - var app = new ConsoleApp (); - - // Get something up on the screen ASAP. - var splash_path = Path.build_filename (DATA_DIR, SPLASH_PNG); - foreach (var dir in Environment.get_system_data_dirs ()) { - var new_path = Path.build_filename (dir, splash_path); - if (FileUtils.test (new_path, FileTest.EXISTS)) { - splash_path = new_path; - break; - } - } - if (!Grx.get_screen_context ().load_from_png (splash_path)) { - warning ("%s", "Could not load splash image."); - } - - var activate_id = app.activate.connect (() => { - app.hold (); - - global_manager = new GlobalManager (); - - Screen.get_active_screen ().status_bar.visible = true; - - var home_window = new HomeWindow (); - var file_browser_controller = new FileBrowserController (); - home_window.add_controller (file_browser_controller); - var device_browser_controller = new DeviceBrowserController (); - home_window.add_controller (device_browser_controller); - var network_controller = new NetworkController (); - home_window.add_controller (network_controller); - var bluetooth_controller = new BluetoothController (); - network_controller.add_controller (bluetooth_controller); - network_controller.add_controller (network_controller.wifi_controller); - var battery_controller = new BatteryController (); - home_window.add_controller (battery_controller); - var open_roberta_controller = new OpenRobertaController (); - home_window.add_controller (open_roberta_controller); - var about_controller = new AboutController (); - home_window.add_controller (about_controller); - - Screen.get_active_screen ().status_bar.add_left (network_controller.network_status_bar_item); - - Screen.get_active_screen ().status_bar.add_right (battery_controller.battery_status_bar_item); - Screen.get_active_screen ().status_bar.add_right (network_controller.wifi_status_bar_item); - Screen.get_active_screen ().status_bar.add_right (bluetooth_controller.status_bar_item); - Screen.get_active_screen ().status_bar.add_right (open_roberta_controller.status_bar_item); - - Systemd.Logind.Manager logind_manager = null; - Systemd.Logind.Manager.get_system_manager.begin ((obj, res) => { - try { - logind_manager = Systemd.Logind.Manager.get_system_manager.end (res); - home_window.shutdown_dialog.power_off_button_pressed.connect (() => { - logind_manager.power_off.begin (false, (obj, res) => { - try { - logind_manager.power_off.end (res); - global_manager.set_leds (LedState.BUSY); - app.quit (); - } catch (Error err) { - var dialog = new MessageDialog ("Error", err.message); - dialog.show (); - } - }); - }); - home_window.shutdown_dialog.reboot_button_pressed.connect (() => { - logind_manager.reboot.begin (false, (obj, res) => { - try { - logind_manager.reboot.end (res); - global_manager.set_leds (LedState.BUSY); - app.quit (); - } catch (Error err) { - var dialog = new MessageDialog ("Error", err.message); - dialog.show (); - } - }); - }); - } catch (IOError err) { - var dialog = new MessageDialog ("Error", err.message); - dialog.show (); - } - }); - home_window.show (); - global_manager.set_leds (LedState.NORMAL); - }); - - // FIXME: Need to hook into input events here to get long back press - - app.run (); - app.disconnect (activate_id); - - return 0; - } catch (GLib.Error err) { - critical ("%s", err.message); - Process.exit (err.code); - } - } -} diff --git a/src/view/AboutWindow.vala b/src/view/AboutWindow.vala deleted file mode 100644 index 7db9c73..0000000 --- a/src/view/AboutWindow.vala +++ /dev/null @@ -1,95 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2014-2015 David Lechner - * - * 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 . - */ - -/* - * AboutWindow.vala - displays information about this program and the EV3 itself - */ - -using Ev3devKit.Ui; - -namespace BrickManager { - public class AboutWindow : BrickManagerWindow { - Label kernel_label; - Label model_label; - Label revision_label; - Label serial_number_label; - - public string kernel_version { - get { return kernel_label.text; } - set { kernel_label.text = value; } - } - - public string model_name { - get { return model_label.text; } - set { model_label.text = value; } - } - - public string revision { - get { return revision_label.text; } - set { revision_label.text = value; } - } - - public string serial_number { - get { return serial_number_label.text; } - set { serial_number_label.text = value; } - } - - public AboutWindow (string display_name) { - title = display_name; - var scroll = new Scroll.vertical (); - content_vbox.add (scroll); - - var scroll_vbox = new Box.vertical (); - scroll.add (scroll_vbox); - - scroll_vbox.add (new Label ("%s v%s".printf (EXEC_NAME, VERSION))); - scroll_vbox.add (new Label ("The ev3dev Brick Manager")); - scroll_vbox.add (new Label ("(C) 2014-2015 ev3dev.org")); - scroll_vbox.add (new Label ("System Info") { - border_bottom = 1, - padding_bottom = 3, - margin_top = 6 - }); - - scroll_vbox.add (new Label ("Kernel:") { - margin_top = 6 - }); - kernel_label = new Label ("???"); - scroll_vbox.add (kernel_label); - - scroll_vbox.add (new Label ("Model:") { - margin_top = 6 - }); - model_label = new Label ("???"); - scroll_vbox.add (model_label); - - scroll_vbox.add (new Label ("Revision:") { - margin_top = 6 - }); - revision_label = new Label ("???"); - scroll_vbox.add (revision_label); - - scroll_vbox.add (new Label ("Serial Number:") { - margin_top = 6 - }); - serial_number_label = new Label ("???"); - scroll_vbox.add (serial_number_label); - } - } -} diff --git a/src/view/BatteryInfoWindow.vala b/src/view/BatteryInfoWindow.vala deleted file mode 100644 index ce99411..0000000 --- a/src/view/BatteryInfoWindow.vala +++ /dev/null @@ -1,143 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2014-2015 David Lechner - * - * 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 . - */ - -/* - * BatteryInfoWindow.vala - displays information about the battery - */ - -using Ev3devKit.Ui; - -namespace BrickManager { - public class BatteryInfoWindow : BrickManagerWindow { - const string UNKNOWN_VALUE = "???"; - - Grid info_grid; - Label tech_label; - Label tech_value_label; - Label voltage_label; - Label voltage_value_label; - Label current_label; - Label current_value_label; - Label power_label; - Label power_value_label; - - public string technology { - get { return tech_value_label.text; } - set { tech_value_label.text = value; } - } - - public bool has_voltage { - get { return voltage_label.visible; } - set { - voltage_label.visible = value; - voltage_value_label.visible = value; - } - } - - double _voltage; - public double voltage { - get { return _voltage; } - set { - _voltage = value; - voltage_value_label.text = "%.2fV".printf (value); - } - } - - public bool has_current { - get { return current_label.visible; } - set { - current_label.visible = value; - current_value_label.visible = value; - } - } - - double _current; - public double current { - get { return _current; } - set { - _current = value; - current_value_label.text = "%.0fmA".printf (value); - } - } - - public bool has_power { - get { return power_label.visible; } - set { - power_label.visible = value; - power_value_label.visible = value; - } - } - - double _power; - public double power { - get { return _power; } - set { - _power = value; - power_value_label.text = "%.2fW".printf (value); - } - } - - public BatteryInfoWindow (string display_name) { - title = display_name; - info_grid = new Grid (4, 2); - content_vbox.add (info_grid); - tech_label = new Label ("Type:") { - horizontal_align = WidgetAlign.END, - padding = 2 - }; - tech_value_label = new Label (UNKNOWN_VALUE) { - horizontal_align = WidgetAlign.START, - padding = 2 - }; - voltage_label = new Label ("Voltage:") { - horizontal_align = WidgetAlign.END, - padding = 2 - }; - voltage_value_label = new Label (UNKNOWN_VALUE) { - horizontal_align = WidgetAlign.START, - padding = 2 - }; - current_label = new Label ("Current:") { - horizontal_align = WidgetAlign.END, - padding = 2 - }; - current_value_label = new Label (UNKNOWN_VALUE) { - horizontal_align = WidgetAlign.START, - padding = 2 - }; - power_label = new Label ("Power:") { - horizontal_align = WidgetAlign.END, - padding = 2 - }; - power_value_label = new Label (UNKNOWN_VALUE) { - horizontal_align = WidgetAlign.START, - padding = 2 - }; - info_grid.add (tech_label); - info_grid.add (tech_value_label); - info_grid.add (voltage_label); - info_grid.add (voltage_value_label); - info_grid.add (current_label); - info_grid.add (current_value_label); - info_grid.add (power_label); - info_grid.add (power_value_label); - content_vbox.add (new Spacer ()); - } - } -} diff --git a/src/view/BatteryStatusBarItem.vala b/src/view/BatteryStatusBarItem.vala deleted file mode 100644 index e5c28be..0000000 --- a/src/view/BatteryStatusBarItem.vala +++ /dev/null @@ -1,82 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2014-2015 David Lechner - * - * 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 . - */ - -/* - * BatteryStatusBarItem.vala: - * - * Indicates battery status - */ - -using Ev3devKit.Ui; -using Grx; - -namespace BrickManager { - public class BatteryStatusBarItem : StatusBarItem { - const ushort END_WIDTH = 2; - const ushort END_OFFSET = 2; - const ushort PADDING = 1; - const ushort TOP = 3; - static Font font; - - static construct { - try { - font = Font.load ("fixed sans", 4); - } catch (GLib.Error err) { - critical ("%s", err.message); - } - } - - string _text = "???"; - TextOptions text_options; - - double _voltage; - public double voltage { - get { return _voltage; } - set { - if (_voltage == value) - return; - _voltage = value; - if (voltage >= 10) - _text = "%.1f".printf (value); - else - _text = "%.2f".printf (value); - redraw (); - } - } - - public BatteryStatusBarItem () { - text_options = new TextOptions (BatteryStatusBarItem.font, Color.NONE, Color.NONE); - } - - public override int draw (int x, StatusBar.Align align) { - var color = status_bar.screen.fg_color; - text_options.fg_color = color; - var main_width = text_options.font.get_text_width (_text) + PADDING * 2 + 2; - var total_width = main_width + END_WIDTH; - if (align == StatusBar.Align.RIGHT) - x -= total_width - 1; - draw_box (x, TOP, x + main_width - 1, HEIGHT - TOP, color); - draw_filled_box (x + main_width, TOP + END_OFFSET, - x + main_width + END_WIDTH - 1, HEIGHT - TOP - END_OFFSET, - color); - draw_text (_text, x + PADDING, TOP + 1 + PADDING, text_options); - return total_width; - } - } -} diff --git a/src/view/BluetoothDeviceMenuItem.vala b/src/view/BluetoothDeviceMenuItem.vala deleted file mode 100644 index 4ef217d..0000000 --- a/src/view/BluetoothDeviceMenuItem.vala +++ /dev/null @@ -1,70 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2014-2015 David Lechner - * - * 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 . - */ - -/* - * BluetoothDeviceMenuItem.vala: Custom MenuItem for showing bluetooth device status. - */ - -using Ev3devKit; -using Ev3devKit.Ui; - -namespace BrickManager { - public class BluetoothDeviceMenuItem : Ui.MenuItem { - const string PERCENT = "%"; - - Label adapter_label; - CheckButton connected_checkbox; - - public string name { - get { return label.text; } - set { label.text = value; } - } - - public string adapter { - owned get { return adapter_label.text[1:adapter_label.text.length - 1]; } - set { adapter_label.text = "(%s)".printf (value); } - } - - public bool show_adapter { - get { return adapter_label.visible; } - set { adapter_label.visible = value; } - } - - public bool connected { - get { return connected_checkbox.checked; } - set { connected_checkbox.checked = value; } - } - - public BluetoothDeviceMenuItem () { - base.with_button (new Button () { margin_top = 1 }, new Label ()); - var hbox = new Box.horizontal (); - button.add (hbox); - hbox.add (label); - adapter_label = new Label ("(???)") { - visible = false - }; - hbox.add (adapter_label); - hbox.add (new Spacer ()); - connected_checkbox = new CheckButton.checkbox () { - can_focus = false - }; - hbox.add (connected_checkbox); - } - } -} diff --git a/src/view/BluetoothDeviceWindow.vala b/src/view/BluetoothDeviceWindow.vala deleted file mode 100644 index c3b9ecd..0000000 --- a/src/view/BluetoothDeviceWindow.vala +++ /dev/null @@ -1,112 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2014-2015 David Lechner - * - * 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 . - */ - -/* - * BluetoothDeviceWindow.vala: - */ - -using Ev3devKit.Ui; - -namespace BrickManager { - public class BluetoothDeviceWindow : BrickManagerWindow { - Label address_label; - Button network_button; - Button connect_button; - Button remove_button; - - public string address { - get { return address_label.text; } - set { address_label.text = value; } - } - - bool _paired; - public bool paired { - get { return _paired; } - set { - _paired = value; - update_buttons (); - } - } - - bool _connected; - public bool connected { - get { return _connected; } - set { - _connected = value; - update_buttons (); - } - } - - bool _has_network; - public bool has_network { - get { return _has_network; } - set { - _has_network = value; - update_buttons (); - } - } - - public signal void network_selected (); - public signal void connect_selected (); - public signal void remove_selected (); - - public BluetoothDeviceWindow () { - address_label = new Label (); - content_vbox.add (address_label); - content_vbox.add (new Spacer ()); - network_button = new Button.with_label ("Network Connection") { - visible = false, - margin_left = 6, - margin_right = 6 - }; - network_button.pressed.connect (() => network_selected ()); - content_vbox.add (network_button); - var button_hbox = new Box.horizontal () { - margin = 6, - margin_top = 1 - }; - content_vbox.add (button_hbox); - connect_button = new Button.with_label ("???"); - connect_button.pressed.connect (() => { - focus_none (); - connect_selected (); - }); - button_hbox.add (connect_button); - remove_button = new Button.with_label ("Remove"); - remove_button.pressed.connect (() => { - focus_none (); - remove_selected (); - }); - button_hbox.add (remove_button); - } - - void update_buttons () { - ((Label)connect_button.child).text = _paired ? - (_connected ? "Disconnect" : "Connect") : "Pair"; - network_button.visible = _paired && _has_network; - } - - void focus_none () { - do_recursive_children ((widget) => { - widget.has_focus = false; - return null; - }); - } - } -} diff --git a/src/view/BluetoothStatusBarItem.vala b/src/view/BluetoothStatusBarItem.vala deleted file mode 100644 index 5a03407..0000000 --- a/src/view/BluetoothStatusBarItem.vala +++ /dev/null @@ -1,61 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2015 David Lechner - * - * 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 . - */ - -/* - * BluetoothStatusBarItem.vala: - * - * Indicates Bluetooth connection status - */ - -using Ev3devKit.Ui; -using Grx; - -namespace BrickManager { - public class BluetoothStatusBarItem : StatusBarItem { - unowned Context connected_icon; - unowned Context idle_icon; - - public bool connected { get; set; } - - public BluetoothStatusBarItem () { - visible = false; - string file; - try { - file = Path.build_filename (Ev3devKit.DATA_DIR, "bluetooth-connected16x16.png"); - connected_icon = Ev3devKit.Ui.Icon.create_context_from_png (file); - file = Path.build_filename (Ev3devKit.DATA_DIR, "bluetooth16x16.png"); - idle_icon = Ev3devKit.Ui.Icon.create_context_from_png (file); - } catch (GLib.Error err) { - critical ("Error loading icon '%s'.", file); - } - notify["connected"].connect (redraw); - } - - public override int draw (int x, StatusBar.Align align) { - unowned Context icon = connected ? connected_icon : idle_icon; - if (icon != null) { - // this icon has 1 pixel width of whitespace on each side - get_current_context ().bit_blt (x - icon.max_x + 2, 1, icon, 1, 0, - icon.max_x - 2, icon.max_y, Color.WHITE.to_image_mode ()); - return icon.max_x - 2; - } - return -2; - } - } -} diff --git a/src/view/BluetoothWindow.vala b/src/view/BluetoothWindow.vala deleted file mode 100644 index 522ad0d..0000000 --- a/src/view/BluetoothWindow.vala +++ /dev/null @@ -1,112 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2014-2015 David Lechner - * - * 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 . - */ - -/* - * BluetoothWindow.vala: Main Bluetooth Menu - */ - -using Ev3devKit; -using Ev3devKit.Ui; - -namespace BrickManager { - public class BluetoothWindow : BrickManagerWindow { - Ui.Menu powered_menu; - Ui.Menu unpowered_menu; - CheckboxMenuItem powered_menu_item; - CheckboxMenuItem visible_menu_item; - Ui.MenuItem scan_menu_item; - - bool _powered; - public bool powered { - get { return _powered; } - set { - if (value == _powered) - return; - _powered = value; - powered_menu_item.checkbox.checked = value; - if (value) { - content_vbox.remove (unpowered_menu); - content_vbox.add (powered_menu); - powered_menu.insert_menu_item (powered_menu_item, visible_menu_item); - } else { - content_vbox.remove (powered_menu); - content_vbox.add (unpowered_menu); - unpowered_menu.add_menu_item (powered_menu_item); - } - } - } - - public bool bt_visible { - get { return visible_menu_item.checkbox.checked; } - set { visible_menu_item.checkbox.checked = value; } - } - - bool _scanning; - public bool scanning { - get { return _scanning; } - set { - _scanning = value; - scan_menu_item.label.text = value ? "Stop Scan" : "Start Scan"; - } - } - - public signal void scan_selected (); - - public BluetoothWindow (string display_name) { - title = display_name; - content_vbox.spacing = 0; - powered_menu_item = new CheckboxMenuItem ("Powered"); - powered_menu_item.button.vertical_align = WidgetAlign.START; - weak Ui.MenuItem weak_powered_menu_item = powered_menu_item; - powered_menu_item.button.pressed.connect (() => { - powered = !powered; - weak_powered_menu_item.button.focus (); - }); - content_vbox.add (powered_menu_item.button); - powered_menu = new Ui.Menu (); - visible_menu_item = new CheckboxMenuItem ("Visible"); - visible_menu_item.checkbox.notify["checked"].connect (() => - notify_property ("bt-visible")); - powered_menu.add_menu_item (visible_menu_item); - scan_menu_item = new Ui.MenuItem ("???"); - scan_menu_item.button.pressed.connect (() => scan_selected ()); - powered_menu.add_menu_item (scan_menu_item); - var devices_label_menu_item = new Ui.MenuItem ("Devices"); - devices_label_menu_item.label.horizontal_align = WidgetAlign.CENTER; - devices_label_menu_item.button.border_bottom = 1; - devices_label_menu_item.button.margin_bottom = 2; - devices_label_menu_item.button.can_focus = false; - powered_menu.add_menu_item (devices_label_menu_item); - unpowered_menu = new Ui.Menu (); - } - - public void add_menu_item (Ui.MenuItem menu_item) { - powered_menu.add_menu_item (menu_item); - } - - public void remove_menu_item (Ui.MenuItem menu_item) { - powered_menu.remove_menu_item (menu_item); - } - - public Ui.MenuItem? find_menu_item (Object represented_object) { - return powered_menu.find_menu_item (represented_object, (mi, o) => - o == mi.represented_object); - } - } -} diff --git a/src/view/BrickManagerWindow.vala b/src/view/BrickManagerWindow.vala deleted file mode 100644 index 32cea0f..0000000 --- a/src/view/BrickManagerWindow.vala +++ /dev/null @@ -1,100 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2014-2015 David Lechner - * - * 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 . - */ - -/* - * BrickManagerWindow.vala: - * - * Common base class for windows in Brick Manager (so they all look kind of the same) - */ - -using Ev3devKit.Ui; - - namespace BrickManager { - public abstract class BrickManagerWindow : Window { - Stack window_stack; - Label title_label; - Label loading_label; - Label not_available_label; - - public string title { - get { return title_label.text; } - set { title_label.text = value; } - } - - bool _loading = false; - public bool loading { - get { return _loading; } - set { - if (value == _loading) { - return; - } - _loading = value; - set_active_child (); - } - } - - bool _available = true; - public bool available { - get { return _available; } - set { - if (value == _available) { - return; - } - _available = value; - set_active_child (); - } - } - - public Box content_vbox { get; private set; } - - protected BrickManagerWindow () { - var window_vbox = new Box.vertical (); - add (window_vbox); - - title_label = new Label () { - vertical_align = WidgetAlign.START, - padding = 3, - border_bottom = 1 - }; - window_vbox.add (title_label); - - window_stack = new Stack (); - window_vbox.add (window_stack); - - content_vbox = new Box.vertical (); - window_stack.add (content_vbox); - - loading_label = new Label ("Loading...") { - margin_bottom = 30 - }; - window_stack.add (loading_label); - - not_available_label = new Label ("Not available") { - margin_bottom = 30 - }; - window_stack.add (not_available_label); - } - - void set_active_child () { - window_stack.active_child = _available - ? (_loading ? (Widget)loading_label : content_vbox) - : not_available_label; - } - } - } \ No newline at end of file diff --git a/src/view/ConnmanAgentInputDialog.vala b/src/view/ConnmanAgentInputDialog.vala deleted file mode 100644 index 7c50418..0000000 --- a/src/view/ConnmanAgentInputDialog.vala +++ /dev/null @@ -1,88 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2014 David Lechner - * - * 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 . - */ - -/* - * ConnmanAgentInputDialog.vala: - * - * Dialog for getting user input (text). - */ - -// TODO: Move this class to Ev3devKit. - -using Ev3devKit.Ui; - -namespace BrickManager { - public class ConnmanAgentInputDialog : Dialog { - Label message_label; - TextEntry value_entry; - Button accept_button; - Button cancel_button; - - public string text_value { get { return value_entry.text; } } - - public signal void responded (bool accepted); - - public ConnmanAgentInputDialog (string message, string initial_value = "") { - var dialog_vbox = new Box.vertical () { - padding = 3, - spacing = 6 - }; - message_label = new Label (message); - dialog_vbox.add (message_label); - value_entry = new TextEntry (initial_value); - dialog_vbox.add (value_entry); - dialog_vbox.add (new Spacer ()); - var button_vbox = new Box.vertical (); - dialog_vbox.add (button_vbox); - var button_hbox = new Box.horizontal () { - horizontal_align = WidgetAlign.CENTER - }; - button_vbox.add (button_hbox); - cancel_button = new Button.with_label ("Cancel"); - cancel_button.pressed.connect (on_cancel_button_pressed); - button_hbox.add (cancel_button); - accept_button = new Button.with_label ("Accept"); - accept_button.pressed.connect (on_accept_button_pressed); - button_hbox.add (accept_button); - add (dialog_vbox); - } - - void on_accept_button_pressed () { - responded (true); - close (); - } - - void on_cancel_button_pressed () { - responded (false); - close (); - } - - /** - * Default handler for the key_pressed signal. - */ - protected override bool key_pressed (uint key_code) { - if (key_code == Grx.Key.BACK_SPACE) { - Signal.stop_emission_by_name (this, "key-pressed"); - on_cancel_button_pressed (); - return true; - } - return base.key_pressed (key_code); - } - } -} diff --git a/src/view/DeviceBrowserWindow.vala b/src/view/DeviceBrowserWindow.vala deleted file mode 100644 index 1b60956..0000000 --- a/src/view/DeviceBrowserWindow.vala +++ /dev/null @@ -1,53 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2015 David Lechner - * - * 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 . - */ - -/* - * DeviceBrowserWindow.vala: Main Device Browser Menu - */ - -using Ev3devKit; -using Ev3devKit.Ui; - -namespace BrickManager { - public class DeviceBrowserWindow : BrickManagerWindow { - internal Ui.Menu menu; - - public signal void ports_menu_item_selected (); - public signal void sensors_menu_item_selected (); - public signal void motors_menu_item_selected (); - - public DeviceBrowserWindow (string display_name) { - title = display_name; - menu = new Ui.Menu (); - content_vbox.add (menu); - var ports_menu_item = new Ui.MenuItem.with_right_arrow ("Ports"); - ports_menu_item.button.pressed.connect (() => - ports_menu_item_selected ()); - menu.add_menu_item (ports_menu_item); - var sensors_menu_item = new Ui.MenuItem.with_right_arrow ("Sensors"); - sensors_menu_item.button.pressed.connect (() => - sensors_menu_item_selected ()); - menu.add_menu_item (sensors_menu_item); - var motors_menu_item = new Ui.MenuItem.with_right_arrow ("Motors"); - motors_menu_item.button.pressed.connect (() => - motors_menu_item_selected ()); - menu.add_menu_item (motors_menu_item); - } - } -} diff --git a/src/view/FileBrowserWindow.vala b/src/view/FileBrowserWindow.vala deleted file mode 100644 index 7b63f23..0000000 --- a/src/view/FileBrowserWindow.vala +++ /dev/null @@ -1,93 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2015 David Lechner - * - * 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 . - */ - -/* - * FileBrowserWindow.vala - Displays contents of a directory - */ - -using Ev3devKit; -using Ev3devKit.Ui; - -namespace BrickManager { - public class FileBrowserWindow : BrickManagerWindow { - Label current_directory_label; - Ui.Menu file_menu; - File? selected_file; - - public unowned CompareDataFunc? sort_files_func; - - public string current_directory { - get { return current_directory_label.text; } - set { current_directory_label.text = value; } - } - - public signal void file_selected (File file); - - public FileBrowserWindow (string display_name) { - title = display_name; - current_directory_label = new Label ("???") { - text_horizontal_align = Grx.TextHAlign.LEFT, - vertical_align = WidgetAlign.START, - padding_bottom = 2, - border_bottom = 1 - }; - content_vbox.add (current_directory_label); - file_menu = new Ui.Menu (); - content_vbox.add (file_menu); - } - - public void add_file (string file_name, File file) { - // make sure we don't end up with duplicates - remove_file (file); - - var menu_item = new Ui.MenuItem (file_name) { - represented_object = file - }; - menu_item.button.pressed.connect (() => { - selected_file = file; - file_selected (file); - }); - file_menu.add_menu_item (menu_item); - // TODO: we would get much better performance if we just inserted - // the item in the correct place instead of sorting the entire list - // each time an item is inserted. - file_menu.sort_menu_items (sort_files_func); - - // if this file was the most recently selected, make sure it retains - // focus. - if (selected_file != null && file.equal (selected_file)) { - menu_item.button.focus (); - } - } - - public void remove_file (File file) { - var menu_item = file_menu.find_menu_item (file, (mi, f1) => { - var f2 = mi.represented_object as File; - return f1.equal (f2); - }); - if (menu_item != null) { - file_menu.remove_menu_item (menu_item); - } - } - - public void clear_files () { - file_menu.remove_all_menu_items (); - } - } -} diff --git a/src/view/HomeWindow.vala b/src/view/HomeWindow.vala deleted file mode 100644 index 398a9aa..0000000 --- a/src/view/HomeWindow.vala +++ /dev/null @@ -1,62 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2014-2015 David Lechner - * - * 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 . - */ - -/* - * HomeWindow.vala: - * - * The home window for brickman. - */ - -using Ev3devKit; -using Ev3devKit.Ui; - -namespace BrickManager { - - class HomeWindow : Window { - internal ShutdownDialog shutdown_dialog; - Ui.Menu menu; - - public HomeWindow () { - shutdown_dialog = new ShutdownDialog (); - menu = new Ui.Menu (); - add (menu); - } - - public void add_controller (IBrickManagerModule controller) { - var menu_item = new Ui.MenuItem.with_right_arrow (controller.display_name) { - represented_object = controller - }; - menu_item.button.pressed.connect (() => - controller.show_main_window ()); - menu.add_menu_item (menu_item); - } - - /** - * Default handler for the key_pressed signal. - */ - protected override bool key_pressed (uint key_code) { - if (key_code == Grx.Key.BACK_SPACE) { - shutdown_dialog.show (); - Signal.stop_emission_by_name (this, "key-pressed"); - return true; - } - return false; - } - } -} diff --git a/src/view/MotorBrowserWindow.vala b/src/view/MotorBrowserWindow.vala deleted file mode 100644 index c8c411c..0000000 --- a/src/view/MotorBrowserWindow.vala +++ /dev/null @@ -1,39 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2015 David Lechner - * - * 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 . - */ - -/* - * MotorBrowserWindow.vala: Main Device Browser Menu - */ - -using Ev3devKit; -using Ev3devKit.Ui; - -namespace BrickManager { - public class MotorBrowserWindow : BrickManagerWindow { - internal Ui.Menu menu; - - public MotorBrowserWindow () { - title ="Motors"; - menu = new Ui.Menu () { - margin_top = -3 - }; - content_vbox.add (menu); - } - } -} diff --git a/src/view/MotorInfoWindow.vala b/src/view/MotorInfoWindow.vala deleted file mode 100644 index 0e0e027..0000000 --- a/src/view/MotorInfoWindow.vala +++ /dev/null @@ -1,116 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2015 David Lechner - * - * 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 . - */ - -/* - * MotorInfoWindow.vala: Main Device Browser Menu - */ - -using Ev3devKit.Ui; - -namespace BrickManager { - public class MotorInfoWindow : BrickManagerWindow { - const int SPACING = 4; - - Label running_value_label; - - bool _running; - public bool running { - get { return _running; } - set { - running_value_label.text = value ? "yes" : "no"; - _running = value; - } - } - - public signal void watch_values_selected (); - - public MotorInfoWindow (string name, string class_name, string device_name, - string address, bool show_watch_button) - { - title = name; - var vscroll = new Scroll.vertical () { - can_focus = false, - margin_top = -3 - }; - content_vbox.add (vscroll); - var vbox = new Box.vertical (); - vscroll.add (vbox); - - var class_name_label = new Label ("Sysfs Class:") { - margin_top = SPACING, - can_focus = true - }; - var class_name_label_has_focus_handler_id = - class_name_label.notify["has-focus"].connect (() => - { - if (class_name_label.has_focus) - vscroll.scroll_to_child (class_name_label); - }); - vbox.add (class_name_label); - var class_name_value_label = new Label (class_name); - vbox.add (class_name_value_label); - - var device_name_label = new Label ("Device name:") { - margin_top = SPACING - }; - vbox.add (device_name_label); - var device_name_value_label = new Label (device_name); - vbox.add (device_name_value_label); - - var address_label = new Label ("Address:") { - margin_top = SPACING - }; - vbox.add (address_label); - var address_value_label = new Label (address); - vbox.add (address_value_label); - - // TODO: driver needs notification support before making this visible - //var running_label = new Label ("Running:") { - // margin_top = SPACING - //}; - //vbox.add (running_label); - running_value_label = new Label ("???"); - //vbox.add (running_value_label); - - var watch_values_button = new Button.with_label ("Watch values") { - margin = SPACING, - margin_bottom = 0 - }; - var watch_values_button_has_focus_handler_id = - watch_values_button.notify["has-focus"].connect (() => - { - if (watch_values_button.has_focus) - vscroll.scroll_to_child (watch_values_button); - }); - watch_values_button.pressed.connect (() => watch_values_selected ()); - if (show_watch_button) { - vbox.add (watch_values_button); - } - - // Workaround vala bug where the lambdas reference "this" and cause - // a reference cycle. - unref (); - weak_ref (() => { - ref (); - class_name_label.disconnect (class_name_label_has_focus_handler_id); - watch_values_button.disconnect (watch_values_button_has_focus_handler_id); - }); - } - } -} diff --git a/src/view/MotorValueDialog.vala b/src/view/MotorValueDialog.vala deleted file mode 100644 index 840a33a..0000000 --- a/src/view/MotorValueDialog.vala +++ /dev/null @@ -1,43 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2015 David Lechner - * - * 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 . - */ - -/* - * MotorValueDialog.vala: Main Device Browser Menu - */ - -using Ev3devKit.Ui; - -namespace BrickManager { - public class MotorValueDialog : Dialog { - Label value_label; - - public string value_text { - get { return value_label.text; } - set { value_label.text = value; } - } - - public MotorValueDialog () { - value_label = new Label ("???") { - margin = 12 - }; - value_label.font = Fonts.get_big (); - add (value_label); - } - } -} diff --git a/src/view/NetworkConnectionDnsWindow.vala b/src/view/NetworkConnectionDnsWindow.vala deleted file mode 100644 index 714651e..0000000 --- a/src/view/NetworkConnectionDnsWindow.vala +++ /dev/null @@ -1,126 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2014-2015 David Lechner - * - * 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 . - */ - -/* - * NetworkConnectionDnsWindow.vala: - * - * Displays DNS properties of a network connection. - */ - -using Ev3devKit.Ui; - -namespace BrickManager { - class NetworkConnectionDnsWindow : BrickManagerWindow { - Box scroll_vbox; - - public string[] addresses { - owned get { - var list = new GenericArray (); - foreach (var child in scroll_vbox.children) { - list.add (((Label)child).text); - } - return list.data; - } - set { - while (scroll_vbox.child != null) { - scroll_vbox.remove (scroll_vbox.child); - } - foreach (var address in value) { - scroll_vbox.add (new Label (address)); - } - } - } - - public signal void change_requested (string[] addresses); - - public NetworkConnectionDnsWindow (string title) { - this.title = title; - - var addresses_label = new Label ("DNS Addresses:") { - vertical_align = WidgetAlign.CENTER - }; - content_vbox.add (addresses_label); - var scroll = new Scroll.vertical () { - can_focus = false, - margin_left = 3, - margin_right = 3 - }; - content_vbox.add (scroll); - - scroll_vbox = new Box.vertical (); - scroll.add (scroll_vbox); - - var button_hbox = new Box.horizontal () { - horizontal_align = WidgetAlign.CENTER, - vertical_align = WidgetAlign.CENTER, - margin_top = 2, - margin_bottom = 3 - }; - content_vbox.add (button_hbox); - - var add_button = new Button.with_label ("Add") { - horizontal_align = WidgetAlign.CENTER, - vertical_align = WidgetAlign.CENTER - }; - add_button.pressed.connect (on_add_button_pressed); - button_hbox.add (add_button); - - var remove_button = new Button.with_label ("Remove All") { - horizontal_align = WidgetAlign.CENTER, - vertical_align = WidgetAlign.CENTER - }; - remove_button.pressed.connect (on_remove_button_pressed); - button_hbox.add (remove_button); - } - - void on_add_button_pressed () { - var dialog = new Dialog (); - weak Dialog weak_dialog = dialog; - var dialog_vbox = new Box.vertical () { - spacing = 6, - margin = 3 - }; - dialog.add (dialog_vbox); - var message_label = new Label ("Enter DNS address."); - dialog_vbox.add (message_label); - var text_entry = new TextEntry (); - dialog_vbox.add (text_entry); - dialog_vbox.add (new Spacer ()); - var add_button = new Button.with_label ("Add") { - horizontal_align = WidgetAlign.CENTER - }; - add_button.pressed.connect (() => { - // TODO: validate values - var new_list = new GenericArray (); - foreach (var addr in addresses) { - new_list.add (addr); - } - new_list.add (text_entry.text); - change_requested (new_list.data); - weak_dialog.close (); - }); - dialog_vbox.add (add_button); - dialog.show (); - } - - void on_remove_button_pressed () { - change_requested ({ }); - } - } -} diff --git a/src/view/NetworkConnectionEnetWindow.vala b/src/view/NetworkConnectionEnetWindow.vala deleted file mode 100644 index c4b9273..0000000 --- a/src/view/NetworkConnectionEnetWindow.vala +++ /dev/null @@ -1,92 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2014-2015 David Lechner - * - * 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 . - */ - -/* - * NetworkConnectionEnetWindow.vala: - * - * Displays ENET properties of a network connection. - */ - -using Ev3devKit.Ui; - -namespace BrickManager { - class NetworkConnectionEnetWindow : BrickManagerWindow { - Label method_label; - Label interface_label; - Label address_label; - Label mtu_label; - - public string method { - get { return method_label.text; } - set { method_label.text = value; } - } - - public string interface { - get { return interface_label.text; } - set { interface_label.text = value; } - } - - public string address { - get { return address_label.text; } - set { address_label.text = value; } - } - - int _mtu; - public int mtu { - get { return _mtu; } - set { - _mtu = value; - mtu_label.text = "%d".printf (value); - } - } - - public NetworkConnectionEnetWindow (string title) { - this.title = title; - - var scroll = new Scroll.vertical (); - content_vbox.add (scroll); - var vbox = new Box.vertical (); - scroll.add (vbox); - - vbox.add (new Label ("Interface:") { - margin_top = 6 - }); - interface_label = new Label (); - vbox.add (interface_label); - - vbox.add (new Label ("MAC address:") { - margin_top = 6 - }); - address_label = new Label (); - vbox.add (address_label); - - vbox.add (new Label ("MTU:") { - margin_top = 6 - }); - mtu_label = new Label (); - vbox.add (mtu_label); - - vbox.add (new Label ("Method:") { - margin_top = 6 - }); - method_label = new Label (); - vbox.add (method_label); - } - } -} diff --git a/src/view/NetworkConnectionIpv4Window.vala b/src/view/NetworkConnectionIpv4Window.vala deleted file mode 100644 index b118f8d..0000000 --- a/src/view/NetworkConnectionIpv4Window.vala +++ /dev/null @@ -1,260 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2014-2015 David Lechner - * - * 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 . - */ - -/* - * NetworkConnectionIpv4Window.vala: - * - * Displays IPv4 properties of a network connection. - */ - -using Ev3devKit; -using Ev3devKit.Ui; - -namespace BrickManager { - class NetworkConnectionIpv4Window : BrickManagerWindow { - Label method_label; - Label address_label; - Label netmask_label; - Label gateway_label; - Button change_button; - - public string method { - get { return method_label.text; } - set { method_label.text = value; } - } - - public string address { - get { return address_label.text; } - set { address_label.text = value; } - } - - public string netmask { - get { return netmask_label.text; } - set { netmask_label.text = value; } - } - - public string gateway { - get { return gateway_label.text; } - set { gateway_label.text = value; } - } - - public string config_address { get; set; } - public string config_netmask { get; set; } - public string config_gateway { get; set; } - - public signal void change_requested (string method, string? address, - string? netmask, string? gateway, string[]? dns_addresses); - - public NetworkConnectionIpv4Window (string title) { - this.title = title; - - //TODO: This doesn't quite fit on the adafruit 1.8" screen - - var grid = new Grid (6, 2); - content_vbox.add (grid); - - grid.add (new Label ("Method:") { - margin_right = 18, - horizontal_align = WidgetAlign.END - }); - method_label = new Label () { - margin_left = -12, - horizontal_align = WidgetAlign.START - }; - grid.add (method_label); - - grid.add (new Label ("IP address:") { - margin_right = 18, - horizontal_align = WidgetAlign.END - }); - address_label = new Label () { - margin_left = -12, - horizontal_align = WidgetAlign.START - }; - grid.add (address_label); - - grid.add (new Label ("Mask:") { - margin_right = 18, - horizontal_align = WidgetAlign.END - }); - netmask_label = new Label () { - margin_left = -12, - horizontal_align = WidgetAlign.START - }; - grid.add (netmask_label); - - grid.add (new Label ("Gateway:") { - margin_right = 18, - horizontal_align = WidgetAlign.END - }); - gateway_label = new Label () { - margin_left = -12, - horizontal_align = WidgetAlign.START - }; - grid.add (gateway_label); - - change_button = new Button.with_label ("Change...") { - horizontal_align = WidgetAlign.CENTER, - vertical_align = WidgetAlign.CENTER - }; - grid.add_at (change_button, 4, 0, 2, 2); - change_button.pressed.connect (on_change_button_pressed); - } - - void on_change_button_pressed () { - var dialog = new Dialog (); - weak Dialog weak_dialog = dialog; - - var menu = new Ui.Menu () { - spacing = 3, - margin = 3 - }; - dialog.add (menu); - - var windows_menu_item = new Ui.MenuItem ("Load Windows defaults"); - windows_menu_item.button.border = 1; - windows_menu_item.button.border_radius = 3; - windows_menu_item.label.text_horizontal_align = Grx.TextHAlign.CENTER; - windows_menu_item.button.pressed.connect (() => { - change_requested ("manual", "192.168.137.3", "255.255.255.0", - "192.168.137.1", { "192.168.137.1" }); - weak_dialog.close (); - }); - menu.add_menu_item (windows_menu_item); - - var mac_menu_item = new Ui.MenuItem ("Load OSX defaults"); - mac_menu_item.button.border = 1; - mac_menu_item.button.border_radius = 3; - mac_menu_item.label.text_horizontal_align = Grx.TextHAlign.CENTER; - mac_menu_item.button.pressed.connect (() => { - change_requested ("manual", "192.168.2.3", "255.255.255.0", - "192.168.2.1", { "192.168.2.1" }); - weak_dialog.close (); - }); - menu.add_menu_item (mac_menu_item); - - var linux_menu_item = new Ui.MenuItem ("Load Linux defaults"); - linux_menu_item.button.border = 1; - linux_menu_item.button.border_radius = 3; - linux_menu_item.label.text_horizontal_align = Grx.TextHAlign.CENTER; - linux_menu_item.button.pressed.connect (() => { - change_requested ("manual", "10.42.0.3", "255.255.255.0", - "10.42.0.1", { "10.42.0.1" }); - weak_dialog.close (); - }); - menu.add_menu_item (linux_menu_item); - - var custom_menu_item = new Ui.MenuItem ("Enter custom values"); - custom_menu_item.button.border = 1; - custom_menu_item.button.border_radius = 3; - custom_menu_item.label.text_horizontal_align = Grx.TextHAlign.CENTER; - custom_menu_item.button.pressed.connect (() => { - weak_dialog.close (); - on_change_custom_button_pressed (); - }); - menu.add_menu_item (custom_menu_item); - - var dchp_menu_item = new Ui.MenuItem ("Use DHCP"); - dchp_menu_item.button.border = 1; - dchp_menu_item.button.border_radius = 3; - dchp_menu_item.label.text_horizontal_align = Grx.TextHAlign.CENTER; - dchp_menu_item.button.pressed.connect (() => { - change_requested ("dhcp", null, null, null, { }); - weak_dialog.close (); - }); - menu.add_menu_item (dchp_menu_item); - - dialog.show (); - } - - void on_change_custom_button_pressed () { - var dialog = new Dialog (); - weak Dialog weak_dialog = dialog; - var dialog_vscroll = new Scroll.vertical () { - can_focus = false, - margin = 3 - }; - dialog.add (dialog_vscroll); - var dialog_vbox = new Box.vertical (); - dialog_vscroll.add (dialog_vbox); - - var address_label = new Label ("IP address"); - dialog_vbox.add (address_label); - var address_entry = new TextEntry (_config_address ?? ""); - var address_entry_notify_has_focus_handler_id = - address_entry.notify["has-focus"].connect (() => { - if (address_entry.has_focus) { - dialog_vscroll.scroll_to_child (address_label); - } - }); - dialog_vbox.add (address_entry); - var netmask_label = new Label ("Network mask"); - dialog_vbox.add (netmask_label); - var netmask_entry = new TextEntry (_config_netmask ?? ""); - dialog_vbox.add (netmask_entry); - var netmask_entry_notify_has_focus_handler_id = - netmask_entry.notify["has-focus"].connect (() => { - if (netmask_entry.has_focus) { - dialog_vscroll.scroll_to_child (netmask_label); - dialog_vscroll.scroll_to_child (netmask_entry); - } - }); - - var gateway_label = new Label ("Gateway"); - dialog_vbox.add (gateway_label); - var gateway_entry = new TextEntry (_config_gateway ?? ""); - dialog_vbox.add (gateway_entry); - var gateway_entry_notify_has_focus_handler_id = - gateway_entry.notify["has-focus"].connect (() => { - if (gateway_entry.has_focus) { - dialog_vscroll.scroll_to_child (gateway_entry); - } - }); - - var accept_button = new Button.with_label ("Apply") { - horizontal_align = WidgetAlign.CENTER, - margin_top = 3 - }; - var accept_button_notify_has_focus_handler_id = - accept_button.notify["has-focus"].connect (() => { - if (accept_button.has_focus) { - dialog_vscroll.scroll_to_child (accept_button); - } - }); - accept_button.pressed.connect (() => { - // TODO: validate entries and make gateway to be null instead of empty string - change_requested ("manual", address_entry.text, - netmask_entry.text, gateway_entry.text, null); - weak_dialog.close (); - }); - dialog_vbox.add (accept_button); - dialog.weak_ref ((obj) => { - SignalHandler.disconnect (address_entry, - address_entry_notify_has_focus_handler_id); - SignalHandler.disconnect (netmask_entry, - netmask_entry_notify_has_focus_handler_id); - SignalHandler.disconnect (gateway_entry, - gateway_entry_notify_has_focus_handler_id); - SignalHandler.disconnect (accept_button, - accept_button_notify_has_focus_handler_id); - }); - dialog.show (); - } - } -} diff --git a/src/view/NetworkConnectionMenuItem.vala b/src/view/NetworkConnectionMenuItem.vala deleted file mode 100644 index e62d99b..0000000 --- a/src/view/NetworkConnectionMenuItem.vala +++ /dev/null @@ -1,77 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2014-2015 David Lechner - * - * 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 . - */ - -/* - * NetworkConnectionMenuItem.vala: Custom MenuItem for showing network connection status. - */ - -using Ev3devKit; -using Ev3devKit.Ui; - -namespace BrickManager { - public class NetworkConnectionMenuItem : Ui.MenuItem { - Label connected_label; - - public bool connected { - get { return connected_label.visible; } - set { connected_label.visible = value; } - } - - public string connection_name { - get { return label.text; } - set { label.text = value; } - } - - public NetworkConnectionMenuItem (string png_file) { - base.with_button (new Button () { - padding_top = 1, - padding_bottom = 2 - }, new Label () { - text_horizontal_align = Grx.TextHAlign.LEFT - }); - button.pressed.connect (on_button_pressed); - var hbox = new Box.horizontal (); - button.add (hbox); - connected_label = new Label ("*") { - horizontal_align = WidgetAlign.START, - visible = false - }; - hbox.add (connected_label); - hbox.add (label); - try { - var icon = new Ev3devKit.Ui.Icon.from_png (png_file) { - horizontal_align = WidgetAlign.END, - vertical_align = WidgetAlign.CENTER - }; - hbox.add (icon); - } catch (Error err) { - critical ("%s", err.message); - } - } - - void on_button_pressed () { - if (menu == null) - return; - var network_connections_window = menu.window as NetworkConnectionsWindow; - if (network_connections_window == null) - return; - network_connections_window.connection_selected (represented_object); - } - } -} diff --git a/src/view/NetworkConnectionWindow.vala b/src/view/NetworkConnectionWindow.vala deleted file mode 100644 index dc01af7..0000000 --- a/src/view/NetworkConnectionWindow.vala +++ /dev/null @@ -1,153 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2014-2015 David Lechner - * - * 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 . - */ - -/* - * NetworkConnectionWindow.vala: - * - * Displays properties of a network connection. - */ - -using Ev3devKit; -using Ev3devKit.Ui; - -namespace BrickManager { - class NetworkConnectionWindow : BrickManagerWindow { - Label state_label; - CheckButton auto_connect_checkbox; - Button connect_button; - - public string state { - get { return state_label.text; } - set { state_label.text = value; } - } - - public bool auto_connect { - get { return auto_connect_checkbox.checked; } - set { auto_connect_checkbox.checked = value; } - } - - bool _is_connected; - public bool is_connected { - get { return _is_connected; } - set { - _is_connected = value; - set_connect_button_text (); - } - } - - bool _is_connect_busy; - public bool is_connect_busy { - get { return _is_connect_busy; } - set { - _is_connect_busy = value; - set_connect_button_text (); - } - } - - /** - * Connect/disconnect requested - * - * User pressed the Connect/Disconnect button on the Connection tab - */ - public signal void connect_requested (bool disconnect); - - public signal void ipv4_button_pressed (); - public signal void dns_button_pressed (); - public signal void enet_button_pressed (); - - public NetworkConnectionWindow (string title) { - this.title = title; - - var state_vbox = new Box.vertical () { - vertical_align = WidgetAlign.START, - padding_bottom = 2, - border_bottom = 1 - }; - content_vbox.add (state_vbox); - var state_hbox = new Box.horizontal () { - horizontal_align = WidgetAlign.CENTER - }; - state_vbox.add (state_hbox); - state_hbox.add (new Label ("State:") { - horizontal_align = WidgetAlign.END, - margin_right = 4 - }); - state_label = new Label () { - horizontal_align = WidgetAlign.START - }; - state_hbox.add (state_label); - - var menu = new Ui.Menu (); - content_vbox.add (menu); - - var connect_menu_item = new Ui.MenuItem ("Connect"); - menu.add_menu_item (connect_menu_item); - connect_button = connect_menu_item.button; - connect_button.pressed.connect (on_connect_button_pressed); - - var auto_connect_menu_item = new CheckboxMenuItem ("Connect automatically"); - menu.add_menu_item (auto_connect_menu_item); - auto_connect_checkbox = auto_connect_menu_item.checkbox; - auto_connect_checkbox.notify["checked"].connect (() => - notify_property ("auto-connect")); - - var ipv4_menu_item = new Ui.MenuItem.with_right_arrow ("IPv4"); - menu.add_menu_item (ipv4_menu_item); - ipv4_menu_item.button.pressed.connect (on_ipv4_button_pressed); - - var dns_menu_item = new Ui.MenuItem.with_right_arrow ("DNS"); - menu.add_menu_item (dns_menu_item); - dns_menu_item.button.pressed.connect (on_dns_button_pressed); - - var enet_menu_item = new Ui.MenuItem.with_right_arrow ("ENET"); - menu.add_menu_item (enet_menu_item); - enet_menu_item.button.pressed.connect (on_enet_button_pressed); - } - - void set_connect_button_text () { - if (_is_connect_busy) { - ((Label)connect_button.child).text = "Cancel"; - } else { - if (_is_connected) { - ((Label)connect_button.child).text = "Disconnect"; - } else { - ((Label)connect_button.child).text = "Connect"; - } - } - } - - void on_connect_button_pressed () { - // this has the effect of disconnecting if we are connected - // or canceling the connect if we are connecting - connect_requested (_is_connected || _is_connect_busy); - } - - void on_ipv4_button_pressed () { - ipv4_button_pressed (); - } - - void on_dns_button_pressed () { - dns_button_pressed (); - } - - void on_enet_button_pressed () { - enet_button_pressed (); - } - } -} diff --git a/src/view/NetworkConnectionsWindow.vala b/src/view/NetworkConnectionsWindow.vala deleted file mode 100644 index 95528b9..0000000 --- a/src/view/NetworkConnectionsWindow.vala +++ /dev/null @@ -1,43 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2014-2015 David Lechner - * - * 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 . - */ - -/* - * NetworkConnectionsWindow.vala: - * - * Displays list of network connections. - */ - -using Ev3devKit; -using Ev3devKit.Ui; - -namespace BrickManager { - class NetworkConnectionsWindow : BrickManagerWindow { - internal Ui.Menu menu; - - public signal void connection_selected (Object user_data); - - public NetworkConnectionsWindow () { - title = "All Network Connections"; - menu = new Ui.Menu () { - spacing = 2 - }; - content_vbox.add (menu); - } - } -} diff --git a/src/view/NetworkStatusBarItem.vala b/src/view/NetworkStatusBarItem.vala deleted file mode 100644 index 967d4f4..0000000 --- a/src/view/NetworkStatusBarItem.vala +++ /dev/null @@ -1,64 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2014 WasabiFan - * - * based on BatteryStatusBarItem.vala - * Copyright (C) 2014 David Lechner - * - * 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 . - */ - -/* - * NetworkStatusBarItem.vala: - * - * Indicates network IP address in status bar - */ - -using Ev3devKit.Ui; -using Grx; - -namespace BrickManager { - public class NetworkStatusBarItem : StatusBarItem { - const ushort TOP = 2; - - string _text = ""; - TextOptions text_options; - - public string text { - get { return _text; } - set { - _text = value; - redraw(); - } - } - - public NetworkStatusBarItem () { - text_options = new TextOptions ( - Fonts.get_default (), - Color.NONE, - Color.NONE - ); - } - - public override int draw (int x, StatusBar.Align align) { - var color = status_bar.screen.fg_color; - text_options.fg_color = color; - var main_width = text_options.font.get_text_width (_text) + 2; - - draw_text (_text, x + 1, TOP, text_options); - return main_width; - } - } -} diff --git a/src/view/NetworkStatusWindow.vala b/src/view/NetworkStatusWindow.vala deleted file mode 100644 index e29cbde..0000000 --- a/src/view/NetworkStatusWindow.vala +++ /dev/null @@ -1,87 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2014-2015 David Lechner - * - * 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 . - */ - -/* - * NetworkStatusWindow.vala: - * - * Monitors network status and performs other network related functions - */ - -using Ev3devKit; -using Ev3devKit.Ui; - -namespace BrickManager { - public class NetworkStatusWindow : BrickManagerWindow { - Box state_hbox; - Label state_label; - Label state_value_label; - Ui.Menu menu; - Ui.MenuItem network_connections_menu_item; - CheckboxMenuItem offline_mode_menu_item; - - public string state { - get { return state_value_label.text; } - set { state_value_label.text = value; } - } - - public bool offline_mode { - get { return offline_mode_menu_item.checkbox.checked; } - set { offline_mode_menu_item.checkbox.checked = value; } - } - - public signal void network_connections_selected (); - public signal void tethering_selected (); - - public NetworkStatusWindow (string display_name) { - title = display_name; - state_hbox = new Box.horizontal () { - horizontal_align = WidgetAlign.CENTER, - vertical_align = WidgetAlign.CENTER - }; - content_vbox.add (state_hbox); - state_label = new Label ("Status:"); - state_hbox.add (state_label); - state_value_label = new Label ("???"); - state_hbox.add (state_value_label); - menu = new Ui.Menu () { - border_top = 1 - }; - content_vbox.add (menu); - network_connections_menu_item = new Ui.MenuItem.with_right_arrow ("All Network Connections"); - network_connections_menu_item.button.pressed.connect (() => network_connections_selected ()); - menu.add_menu_item (network_connections_menu_item); - var tethering_menu_item = new Ui.MenuItem.with_right_arrow ("Tethering"); - tethering_menu_item.button.pressed.connect (() => tethering_selected ()); - menu.add_menu_item (tethering_menu_item); - offline_mode_menu_item = new CheckboxMenuItem ("Offline Mode"); - offline_mode_menu_item.checkbox.notify["checked"].connect ((s, p) => { - notify_property ("offline-mode"); - }); - menu.add_menu_item (offline_mode_menu_item); - } - - public void add_technology_controller (IBrickManagerModule controller) { - var menu_item = new Ui.MenuItem.with_right_arrow (controller.display_name) { - represented_object = controller - }; - menu_item.button.pressed.connect (() => controller.show_main_window ()); - menu.insert_menu_item (menu_item, network_connections_menu_item); - } - } -} diff --git a/src/view/OpenRobertaStatusBarItem.vala b/src/view/OpenRobertaStatusBarItem.vala deleted file mode 100644 index 1774f1d..0000000 --- a/src/view/OpenRobertaStatusBarItem.vala +++ /dev/null @@ -1,58 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright 2015 Stefan Sauer - * - * 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 . - */ - -/* - * OpenRobertaStatusBarItem.vala - Indicates connection status - */ - -using Ev3devKit.Ui; -using Grx; - -namespace BrickManager { - public class OpenRobertaStatusBarItem : StatusBarItem { - unowned Context connected_icon; - unowned Context idle_icon; - - public bool connected { get; set; } - - public OpenRobertaStatusBarItem () { - visible = false; - string file; - try { - file = Path.build_filename (DATA_DIR, "openroberta-connected16x16.png"); - connected_icon = Ev3devKit.Ui.Icon.create_context_from_png (file); - file = Path.build_filename (DATA_DIR, "openroberta-idle16x16.png"); - idle_icon = Ev3devKit.Ui.Icon.create_context_from_png (file); - } catch (GLib.Error err) { - critical ("Error loading icon '%s'.", file); - } - notify["connected"].connect (redraw); - } - - public override int draw (int x, StatusBar.Align align) { - unowned Context icon = connected ? connected_icon : idle_icon; - if (icon != null) { - get_current_context ().bit_blt (x - icon.max_x, 2, icon, 0, 0, - icon.max_x, icon.max_y, Color.WHITE.to_image_mode ()); - return icon.max_x; - } - return -2; - } - } -} diff --git a/src/view/OpenRobertaWindow.vala b/src/view/OpenRobertaWindow.vala deleted file mode 100644 index 0e254a1..0000000 --- a/src/view/OpenRobertaWindow.vala +++ /dev/null @@ -1,221 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright 2015 Stefan Sauer - * Copyright 2015 David Lechner - * - * 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 . - */ - -/* - * OpenRobertaWindow.vala - Edit connection status - */ - -using Ev3devKit; -using Ev3devKit.Ui; - -namespace BrickManager { - public class OpenRobertaWindow : BrickManagerWindow { - const string DEFAULT_SERVER_ADDRESS = "lab.open-roberta.org"; - const string CUSTOM_SERVER_PLACEHOLDER = ""; - - static MessageDialog? pin_dialog; - - Label status_info; - Stack stack; - Scroll connect_scroll; - Box disconnect_vbox; - Label custom_server_label; - weak Button weak_default_server_connect_button; - weak Button weak_custom_server_connect_button; - - public string custom_server_address { - owned get { - var address = custom_server_label.text; - if (address == CUSTOM_SERVER_PLACEHOLDER) { - return ""; - } - return address; - } - set { - if (value == "") { - custom_server_label.text = CUSTOM_SERVER_PLACEHOLDER; - } else { - custom_server_label.text = value; - } - } - } - - public bool connected { get; set; } - public string selected_server { get; set; } - - public signal void connect_selected (string address); - public signal void disconnect_selected (); - - public OpenRobertaWindow (string display_name) { - title = display_name; - - status_info = new Label () { - vertical_align = WidgetAlign.START, - padding_bottom = 4, - border_bottom = 1 - }; - content_vbox.add (status_info); - - stack = new Stack (); - content_vbox.add (stack); - - connect_scroll = new Scroll.vertical () { - can_focus = false - }; - weak Scroll weak_connect_scroll = connect_scroll; - stack.add (connect_scroll); - - var connect_vbox = new Box.vertical (); - connect_scroll.add (connect_vbox); - - var default_server_label = new Label (DEFAULT_SERVER_ADDRESS); - connect_vbox.add (default_server_label); - var default_server_connect_button = new Button.with_label ("Connect") { - horizontal_align = WidgetAlign.CENTER - }; - weak_default_server_connect_button = default_server_connect_button; - default_server_connect_button.notify["has-focus"].connect (() => { - if (weak_default_server_connect_button.has_focus) { - weak_connect_scroll.scroll_to_child (default_server_label); - } - }); - default_server_connect_button.pressed.connect ((button) => { - connect_selected (DEFAULT_SERVER_ADDRESS); - }); - connect_vbox.add (default_server_connect_button); - custom_server_label = new Label (CUSTOM_SERVER_PLACEHOLDER) { - margin_top = 4 - }; - connect_vbox.add (custom_server_label); - var custom_server_button_hbox = new Box.horizontal () { - horizontal_align = WidgetAlign.CENTER - }; - weak Box weak_custom_server_button_hbox = custom_server_button_hbox; - connect_vbox.add (custom_server_button_hbox); - var custom_server_connect_button = new Button.with_label ("Connect") { - horizontal_align = WidgetAlign.CENTER - }; - weak_custom_server_connect_button = custom_server_connect_button; - custom_server_connect_button.notify["has-focus"].connect (() => { - if (weak_custom_server_connect_button.has_focus) { - weak_connect_scroll.scroll_to_child (weak_custom_server_button_hbox); - } - }); - custom_server_connect_button.pressed.connect ((button) => { - connect_selected (custom_server_address); - }); - custom_server_button_hbox.add (custom_server_connect_button); - var custom_server_edit_button = new Button.with_label ("Edit") { - horizontal_align = WidgetAlign.CENTER - }; - weak Button weak_custom_server_edit_button = custom_server_edit_button; - custom_server_edit_button.notify["has-focus"].connect (() => { - if (weak_custom_server_edit_button.has_focus) { - weak_connect_scroll.scroll_to_child (weak_custom_server_button_hbox); - } - }); - custom_server_edit_button.pressed.connect (on_edit_selected); - custom_server_button_hbox.add (custom_server_edit_button); - - disconnect_vbox = new Box.vertical (); - stack.add (disconnect_vbox); - - var disconnect_button = new Button.with_label ("Disconnect") { - horizontal_align = WidgetAlign.CENTER, - vertical_align = WidgetAlign.START - }; - disconnect_button.pressed.connect (() => disconnect_selected ()); - disconnect_vbox.add (disconnect_button); - - shown.connect (() => { - focus_selected_server (); - }); - - notify["connected"].connect (on_connected_changed); - on_connected_changed (); - - notify["selected-server"].connect (update_status_info); - } - - public static void show_no_custom_server_address_dialog () { - var dialog = new MessageDialog ("No Address", - "Use the Edit button to enter the name or address of the server."); - dialog.show (); - } - - public static void show_pairing_code_dialog (string code) { - var label = new Label (code) { - margin_top = 12 - }; - label.font = Fonts.get_big (); - pin_dialog = new MessageDialog.with_content ("Pairing code", label); - ulong pin_dialog_closed_id = 0; - pin_dialog_closed_id = pin_dialog.closed.connect (() => { - pin_dialog.disconnect (pin_dialog_closed_id); - pin_dialog = null; - }); - pin_dialog.show (); - } - - public static void close_pairing_code_dialog () { - if (pin_dialog != null) { - pin_dialog.close (); - } - } - - void on_edit_selected (Button button) { - var dialog = new InputDialog ("Enter server address", custom_server_address); - weak InputDialog weak_dialog = dialog; - dialog.responded.connect ((accepted) => { - if (!accepted) { - return; - } - custom_server_address = weak_dialog.text_value; - }); - dialog.show (); - } - - void on_connected_changed () { - var new_child = connected ? (Container)disconnect_vbox : connect_scroll; - stack.active_child = new_child; - if (connected) { - new_child.focus_first (); - } else { - focus_selected_server (); - } - update_status_info (); - } - - void update_status_info () { - status_info.text = connected - ? "Connected to\n%s".printf (_selected_server) - : "Disconnected"; - focus_selected_server (); - } - - void focus_selected_server () { - if (selected_server == custom_server_address) { - weak_custom_server_connect_button.focus(); - } else { - weak_default_server_connect_button.focus(); - } - } - } -} diff --git a/src/view/PortBrowserWindow.vala b/src/view/PortBrowserWindow.vala deleted file mode 100644 index 185cd74..0000000 --- a/src/view/PortBrowserWindow.vala +++ /dev/null @@ -1,39 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2015 David Lechner - * - * 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 . - */ - -/* - * PortBrowserWindow.vala: Main Device Browser Menu - */ - -using Ev3devKit; -using Ev3devKit.Ui; - -namespace BrickManager { - public class PortBrowserWindow : BrickManagerWindow { - internal Ui.Menu menu; - - public PortBrowserWindow () { - title ="Ports"; - menu = new Ui.Menu () { - margin_top = -3 - }; - content_vbox.add (menu); - } - } -} diff --git a/src/view/PortInfoWindow.vala b/src/view/PortInfoWindow.vala deleted file mode 100644 index 151f8bb..0000000 --- a/src/view/PortInfoWindow.vala +++ /dev/null @@ -1,137 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2015 David Lechner - * - * 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 . - */ - -/* - * PortInfoWindow.vala: Main Device Browser Menu - */ - -using Ev3devKit.Ui; - -namespace BrickManager { - public class PortInfoWindow : BrickManagerWindow { - const int SPACING = 4; - - Scroll vscroll; - Box scroll_vbox; - Label mode_value_label; - Label status_value_label; - Button set_device_button; - Button set_mode_button; - - public string mode { - get { return mode_value_label.text; } - set { mode_value_label.text = value; } - } - - public string status { - get { return status_value_label.text; } - set { status_value_label.text = value; } - } - - bool _can_set_device; - public bool can_set_device { - get { return _can_set_device; } - set { - if (value && set_device_button.parent == null) { - scroll_vbox.insert_before (set_device_button, set_mode_button); - if (set_mode_button.has_focus) { - vscroll.scroll_to_child (set_mode_button); - } - } else if (!value) { - if (set_device_button.has_focus) - set_mode_button.focus (); - scroll_vbox.remove (set_device_button); - } - _can_set_device = value; - } - } - - public signal void set_mode_button_pressed (); - public signal void set_device_button_pressed (); - - public PortInfoWindow (string address, string device_name, string driver_name) { - title = address; - vscroll = new Scroll.vertical () { - margin_top = -3, - can_focus = false - }; - content_vbox.add (vscroll); - scroll_vbox = new Box.vertical (); - vscroll.add (scroll_vbox); - var device_name_label = new Label ("Device name:") { - margin_top = SPACING, - can_focus = true - }; - var device_name_label_has_focus_handler_id = - device_name_label.notify["has-focus"].connect (() => - { - if (device_name_label.has_focus) - vscroll.scroll_to_child (device_name_label); - }); - scroll_vbox.add (device_name_label); - var device_name_value_label = new Label (device_name); - scroll_vbox.add (device_name_value_label); - var driver_name_label = new Label ("Driver name:") { - margin_top = SPACING - }; - scroll_vbox.add (driver_name_label); - var driver_name_value_label = new Label (driver_name); - scroll_vbox.add (driver_name_value_label); - var mode_label = new Label ("Mode:") { - margin_top = SPACING - }; - scroll_vbox.add (mode_label); - mode_value_label = new Label ("???"); - scroll_vbox.add (mode_value_label); - var status_label = new Label ("Status:") { - margin_top = SPACING - }; - scroll_vbox.add (status_label); - status_value_label = new Label ("???"); - scroll_vbox.add (status_value_label); - set_device_button = new Button.with_label ("Set device") { - margin = SPACING, - margin_bottom = 0 - }; - set_device_button.notify["has-focus"].connect (() => { - if (set_device_button.has_focus) - vscroll.scroll_to_child (set_device_button); - }); - set_device_button.pressed.connect (() => set_device_button_pressed ()); - // don't add set_device_button - see can_set_device property - set_mode_button = new Button.with_label ("Set mode") { - margin = SPACING - }; - set_mode_button.notify["has-focus"].connect (() => { - if (set_mode_button.has_focus) - vscroll.scroll_to_child (set_mode_button); - }); - set_mode_button.pressed.connect (() => set_mode_button_pressed ()); - scroll_vbox.add (set_mode_button); - - // Workaround vala bug where the lambdas reference "this" and cause - // a reference cycle. - unref (); - weak_ref (() => { - ref (); - device_name_label.disconnect (device_name_label_has_focus_handler_id); - }); - } - } -} diff --git a/src/view/SelectFromListDialog.vala b/src/view/SelectFromListDialog.vala deleted file mode 100644 index ee5ffa5..0000000 --- a/src/view/SelectFromListDialog.vala +++ /dev/null @@ -1,54 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2015 David Lechner - * - * 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 . - */ - -/* - * SelectFromListDialog.vala: Main Device Browser Menu - */ - -using Ev3devKit; -using Ev3devKit.Ui; - -namespace BrickManager { - public class SelectFromListDialog : Dialog { - public signal void item_selected (string list_item); - - public SelectFromListDialog (string[] list_items) { - var menu = new Ui.Menu () { - margin = 6, - spacing = 2 - }; - add (menu); - foreach (var list_item in list_items) { - var menu_item = new Ui.MenuItem (list_item); - menu_item.button.border = 1; - menu_item.button.border_radius = 3; - var handler_id = menu_item.button.pressed.connect (() => { - item_selected (list_item); - close (); - }); - unref (); - weak_ref (() => { - ref (); - menu_item.button.disconnect (handler_id); - }); - menu.add_menu_item (menu_item); - } - } - } -} diff --git a/src/view/SensorBrowserWindow.vala b/src/view/SensorBrowserWindow.vala deleted file mode 100644 index dc3b2b1..0000000 --- a/src/view/SensorBrowserWindow.vala +++ /dev/null @@ -1,39 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2015 David Lechner - * - * 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 . - */ - -/* - * SensorBrowserWindow.vala: Main Device Browser Menu - */ - -using Ev3devKit; -using Ev3devKit.Ui; - -namespace BrickManager { - public class SensorBrowserWindow : BrickManagerWindow { - internal Ui.Menu menu; - - public SensorBrowserWindow () { - title ="Sensors"; - menu = new Ui.Menu () { - margin_top = -3 - }; - content_vbox.add (menu); - } - } -} diff --git a/src/view/SensorInfoWindow.vala b/src/view/SensorInfoWindow.vala deleted file mode 100644 index 4148d62..0000000 --- a/src/view/SensorInfoWindow.vala +++ /dev/null @@ -1,124 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2015 David Lechner - * - * 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 . - */ - -/* - * SensorInfoWindow.vala: Main Device Browser Menu - */ - -using Ev3devKit.Ui; - -namespace BrickManager { - public class SensorInfoWindow : BrickManagerWindow { - const int SPACING = 4; - - Label mode_value_label; - - public string mode { - get { return mode_value_label.text; } - set { mode_value_label.text = value; } - } - - public signal void watch_values_selected (); - public signal void set_mode_selected (); - public signal void send_command_selected (); - - public SensorInfoWindow (string name, string device_name, string address, bool supports_commands) { - title = name; - var vscroll = new Scroll.vertical () { - can_focus = false, - margin_top = -3 - }; - content_vbox.add (vscroll); - var vbox = new Box.vertical (); - vscroll.add (vbox); - var device_name_label = new Label ("Device name:") { - can_focus = true - }; - var device_name_label_has_focus_handler_id = - device_name_label.notify["has-focus"].connect (() => - { - if (device_name_label.has_focus) - vscroll.scroll_to_child (device_name_label); - }); - vbox.add (device_name_label); - var device_name_value_label = new Label (device_name); - vbox.add (device_name_value_label); - var address_label = new Label ("Address:") { - margin_top = SPACING - }; - vbox.add (address_label); - var address_value_label = new Label (address); - vbox.add (address_value_label); - var mode_label = new Label ("Mode:") { - margin_top = SPACING - }; - vbox.add (mode_label); - mode_value_label = new Label ("???"); - vbox.add (mode_value_label); - var watch_values_button = new Button.with_label ("Watch values") { - margin = SPACING, - margin_bottom = 0 - }; - var watch_values_button_has_focus_handler_id = - watch_values_button.notify["has-focus"].connect (() => - { - if (watch_values_button.has_focus) - vscroll.scroll_to_child (watch_values_button); - }); - watch_values_button.pressed.connect (() => watch_values_selected ()); - vbox.add (watch_values_button); - var set_mode_button = new Button.with_label ("Set mode") { - margin = SPACING, - margin_bottom = 0 - }; - var set_mode_button_has_focus_handler_id = - set_mode_button.notify["has-focus"].connect (() => - { - if (set_mode_button.has_focus) - vscroll.scroll_to_child (set_mode_button); - }); - set_mode_button.pressed.connect (() => set_mode_selected ()); - vbox.add (set_mode_button); - if (supports_commands) { - var send_command_button = new Button.with_label ("Send command") { - margin = SPACING - }; - var send_command_button_has_focus_handler_id = - send_command_button.notify["has-focus"].connect (() => - { - if (send_command_button.has_focus) - vscroll.scroll_to_child (send_command_button); - }); - send_command_button.pressed.connect (() => send_command_selected ()); - vbox.add (send_command_button); - weak_ref (() => send_command_button.disconnect (send_command_button_has_focus_handler_id)); - } - - // Workaround vala bug where the lambdas reference "this" and cause - // a reference cycle. - unref (); - weak_ref (() => { - ref (); - device_name_label.disconnect (device_name_label_has_focus_handler_id); - watch_values_button.disconnect (watch_values_button_has_focus_handler_id); - set_mode_button.disconnect (set_mode_button_has_focus_handler_id); - }); - } - } -} diff --git a/src/view/SensorValueDialog.vala b/src/view/SensorValueDialog.vala deleted file mode 100644 index a6c86cf..0000000 --- a/src/view/SensorValueDialog.vala +++ /dev/null @@ -1,43 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2015 David Lechner - * - * 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 . - */ - -/* - * SensorValueDialog.vala: Main Device Browser Menu - */ - -using Ev3devKit.Ui; - -namespace BrickManager { - public class SensorValueDialog : Dialog { - Label value_label; - - public string value_text { - get { return value_label.text; } - set { value_label.text = value; } - } - - public SensorValueDialog () { - value_label = new Label ("???") { - margin = 12 - }; - value_label.font = Fonts.get_big (); - add (value_label); - } - } -} diff --git a/src/view/ShutdownDialog.vala b/src/view/ShutdownDialog.vala deleted file mode 100644 index 519cc78..0000000 --- a/src/view/ShutdownDialog.vala +++ /dev/null @@ -1,76 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2014 David Lechner - * - * 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 . - */ - -/* - * ShutdownDialog.vala: - * - * Dialog for shutting down/restarting the brick - */ - -using Ev3devKit.Ui; - -namespace BrickManager { - public class ShutdownDialog : Dialog { - Box dialog_vbox; - Label title; - Box button_vbox; - Button power_off_button; - Button reboot_button; - Button cancel_button; - - public signal void power_off_button_pressed (); - public signal void reboot_button_pressed (); - - public ShutdownDialog () { - dialog_vbox = new Box.vertical (); - title = new Label ("Shutdown...") { - padding = 2, - border_bottom = 1 - }; - dialog_vbox.add (title); - button_vbox = new Box.vertical () { - margin = 4, - margin_top = 2 - }; - dialog_vbox.add (button_vbox); - power_off_button = new Button.with_label ("Power Off"); - power_off_button.pressed.connect (on_power_off_button_pressed); - button_vbox.add (power_off_button); - reboot_button = new Button.with_label ("Reboot"); - reboot_button.pressed.connect (on_reboot_button_pressed); - button_vbox.add (reboot_button); - cancel_button = new Button.with_label ("Cancel"); - cancel_button.pressed.connect (on_cancel_button_pressed); - button_vbox.add (cancel_button); - add (dialog_vbox); - } - - void on_power_off_button_pressed () { - power_off_button_pressed (); - } - - void on_reboot_button_pressed () { - reboot_button_pressed (); - } - - void on_cancel_button_pressed () { - close (); - } - } -} diff --git a/src/view/SignalBars.vala b/src/view/SignalBars.vala deleted file mode 100644 index 30207f8..0000000 --- a/src/view/SignalBars.vala +++ /dev/null @@ -1,66 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2015 David Lechner - * - * 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 . - */ - -/* - * SignalBars.vala: Widget for indicating signal strength using bars like a mobile phone. - */ - -using Ev3devKit; -using Ev3devKit.Ui; - -namespace BrickManager { - public class SignalBars : Widget { - const int MAX_BARS = 4; - const int BAR_WIDTH = 2; - const int WIDTH = MAX_BARS * BAR_WIDTH; - const int HEIGHT = MAX_BARS * BAR_WIDTH; - - public int strength { get; set; } - - public int max_strength { get; set; default = 100; } - - construct { - margin = 1; - notify["strength"].connect (redraw); - notify["max_strength"].connect (redraw); - } - - protected override int get_preferred_width () { - return WIDTH + get_margin_border_padding_width (); - } - - protected override int get_preferred_height () { - return HEIGHT + get_margin_border_padding_height (); - } - - protected override void draw_content () { - var one_bar = (max_strength + MAX_BARS - 1) / MAX_BARS; - var bars = (strength + one_bar - 1) / one_bar; - Grx.Color color = window.screen.fg_color; - if (parent.draw_children_as_focused) - color = window.screen.bg_color; - for (int i = 0; i < bars; i++) { - Grx.draw_filled_box (content_bounds.x1 + BAR_WIDTH * i, - content_bounds.y2 - BAR_WIDTH * (i + 1), - content_bounds.x1 + BAR_WIDTH * (i + 1), - content_bounds.y2, color); - } - } - } -} diff --git a/src/view/TetheringInfoWindow.vala b/src/view/TetheringInfoWindow.vala deleted file mode 100644 index 2db0e1d..0000000 --- a/src/view/TetheringInfoWindow.vala +++ /dev/null @@ -1,97 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2015 David Lechner - * - * 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 . - */ - -/* - * TetheringInfoWindow.vala: - * - * Shows network information about tether interface. - */ - -using Ev3devKit; -using Ev3devKit.Ui; - -namespace BrickManager { - public class TetheringInfoWindow : BrickManagerWindow { - Label ipv4_address_value_label; - Label ipv4_netmask_value_label; - Label enet_iface_value_label; - Label enet_mac_value_label; - - public string ipv4_address { - get { return ipv4_address_value_label.text; } - set { ipv4_address_value_label.text = value; } - } - - public string ipv4_netmask { - get { return ipv4_netmask_value_label.text; } - set { ipv4_netmask_value_label.text = value; } - } - - public string enet_iface { - get { return enet_iface_value_label.text; } - set { enet_iface_value_label.text = value; } - } - - public string enet_mac { - get { return enet_mac_value_label.text; } - set { enet_mac_value_label.text = value; } - } - - public TetheringInfoWindow () { - title = "Tethering Network Info"; - var vscroll = new Scroll.vertical () { - margin_top = -3 - }; - content_vbox.add (vscroll); - var scroll_vbox = new Box.vertical (); - vscroll.add (scroll_vbox); - var ipv4_label = new Label ("IPV4") { - border_bottom = 1, - margin = 3 - }; - scroll_vbox.add (ipv4_label); - var ipv4_address_label = new Label ("IP Address:"); - scroll_vbox. add (ipv4_address_label); - ipv4_address_value_label = new Label ("???"); - scroll_vbox. add (ipv4_address_value_label); - var ipv4_netmask_label = new Label ("Mask:") { - margin_top = 3 - }; - scroll_vbox. add (ipv4_netmask_label); - ipv4_netmask_value_label = new Label ("???"); - scroll_vbox. add (ipv4_netmask_value_label); - var enet_label = new Label ("ENET") { - border_bottom = 1, - margin = 3, - margin_top = 6 - }; - scroll_vbox.add (enet_label); - var enet_iface_label = new Label ("Interface:"); - scroll_vbox.add (enet_iface_label); - enet_iface_value_label = new Label ("???"); - scroll_vbox.add (enet_iface_value_label); - var enet_mac_label = new Label ("MAC:") { - margin_top = 3 - }; - scroll_vbox.add (enet_mac_label); - enet_mac_value_label = new Label ("???"); - scroll_vbox.add (enet_mac_value_label); - } - } -} diff --git a/src/view/TetheringWindow.vala b/src/view/TetheringWindow.vala deleted file mode 100644 index b9c1a3d..0000000 --- a/src/view/TetheringWindow.vala +++ /dev/null @@ -1,58 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2015 David Lechner - * - * 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 . - */ - -/* - * TetheringWindow.vala: - * - * Shows list of types of tethering and allows user to enable/disable them. - */ - -using Ev3devKit; -using Ev3devKit.Ui; - -namespace BrickManager { - public class TetheringWindow : BrickManagerWindow { - Ui.Menu menu; - Ui.MenuItem tethering_info_menu_item; - - public signal void tethering_info_selected (); - - public TetheringWindow () { - title = "Tethering"; - menu = new Ui.Menu () { - margin_top = -3 - }; - content_vbox.add (menu); - tethering_info_menu_item = new Ui.MenuItem.with_right_arrow ("Network info"); - tethering_info_menu_item.button.pressed.connect (() => tethering_info_selected ()); - tethering_info_menu_item.label.text_horizontal_align = Grx.TextHAlign.LEFT; - menu.add_menu_item (tethering_info_menu_item); - } - - public CheckboxMenuItem add_menu_item (string name) { - var menu_item = new CheckboxMenuItem (name); - menu.insert_menu_item (menu_item, tethering_info_menu_item); - return menu_item; - } - - public void remove_menu_item (CheckboxMenuItem menu_item) { - menu.remove_menu_item (menu_item); - } - } -} diff --git a/src/view/WifiMenuItem.vala b/src/view/WifiMenuItem.vala deleted file mode 100644 index 4d61c11..0000000 --- a/src/view/WifiMenuItem.vala +++ /dev/null @@ -1,120 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2015 David Lechner - * - * 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 . - */ - -/* - * WifiMenuItem.vala: Custom MenuItem for showing Wi-Fi connections. - */ - -using Ev3devKit; -using Ev3devKit.Ui; - -namespace BrickManager { - public enum WifiSecurity { - OPEN, - SECURED, - WPS - } - - public class WifiMenuItem : Ui.MenuItem { - Box hbox; - Label connected_label; - Ui.Icon secure_icon; - Ui.Icon wps_icon; - SignalBars signal_bars; - - public bool connected { - get { return connected_label.visible; } - set { connected_label.visible = value; } - } - - public string connection_name { - get { return label.text; } - set { label.text = value; } - } - - WifiSecurity _security; - public WifiSecurity security { - get { return _security; } - set { - _security = value; - if (secure_icon != null) { - if (_security == WifiSecurity.SECURED) - hbox.insert_before (secure_icon, signal_bars); - else - hbox.remove (secure_icon); - } - if (wps_icon != null) { - if (_security == WifiSecurity.WPS) - hbox.insert_before (wps_icon, signal_bars); - else - hbox.remove (wps_icon); - } - } - } - - public int signal_strength { - get { return signal_bars.strength; } - set { signal_bars.strength = value; } - } - - public WifiMenuItem () { - base.with_button (new Button () { - padding_top = 1, - padding_bottom = 1 - }, new Label () { - text_horizontal_align = Grx.TextHAlign.LEFT - }); - button.pressed.connect (on_button_pressed); - hbox = new Box.horizontal (); - button.add (hbox); - connected_label = new Label ("*") { - horizontal_align = WidgetAlign.START, - visible = false - }; - hbox.add (connected_label); - hbox.add (label); - try { - secure_icon = new Ui.Icon.from_stock (StockIcon.LOCK_7X9) { - horizontal_align = WidgetAlign.END, - vertical_align = WidgetAlign.CENTER - }; - wps_icon = new Ui.Icon.from_stock (StockIcon.WPS_9X9) { - horizontal_align = WidgetAlign.END, - vertical_align = WidgetAlign.CENTER - }; - } catch (Error err) { - critical ("%s", err.message); - } - signal_bars = new SignalBars () { - horizontal_align = WidgetAlign.END, - vertical_align = WidgetAlign.CENTER - }; - hbox.add (signal_bars); - } - - void on_button_pressed () { - if (menu == null) - return; - var wifi_window = menu.window as WifiWindow; - if (wifi_window == null) - return; - wifi_window.connection_selected (represented_object); - } - } -} diff --git a/src/view/WifiNetworkStatusWindow.vala b/src/view/WifiNetworkStatusWindow.vala deleted file mode 100644 index aa4aef0..0000000 --- a/src/view/WifiNetworkStatusWindow.vala +++ /dev/null @@ -1,115 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2015 David Lechner - * - * 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 . - */ - -/* - * WifiNetworkStatusWindow.vala: View for displaying status of a single Wi-Fi network. - */ - -using Ev3devKit; -using Ev3devKit.Ui; - -namespace BrickManager { - public class WifiNetworkStatusWindow : BrickManagerWindow { - Label status_value_label; - Label signal_value_label; - Label security_value_label; - Label address_value_label; - - public string status { - get { return status_value_label.text; } - set { status_value_label.text = value; } - } - - public string signal_strength { - owned get { return signal_value_label.text[0:-1]; } - set { signal_value_label.text = value + "%"; } - } - - public string security { - get { return security_value_label.text; } - set { security_value_label.text = value; } - } - - public string address { - get { return address_value_label.text; } - set { address_value_label.text = value; } - } - - public WifiNetworkStatusWindow (string name) { - title = name; - - var status_hbox = new Box.horizontal () { - padding_top = -6, - padding_bottom = -3, - border_bottom = 1 - }; - content_vbox.add (status_hbox); - var status_label = new Label ("Status:") { - text_horizontal_align = Grx.TextHAlign.RIGHT - }; - status_hbox.add (status_label); - status_value_label = new Label ("???") { - text_horizontal_align = Grx.TextHAlign.LEFT - }; - status_hbox .add (status_value_label); - - var vscroll = new Scroll.vertical () { - can_focus = false - }; - content_vbox.add (vscroll); - var scroll_vbox = new Box.vertical () { - spacing = 3 - }; - vscroll.add (scroll_vbox); - - var signal_hbox = new Box.horizontal (); - scroll_vbox.add (signal_hbox); - var signal_label = new Label ("Signal:") { - horizontal_align = WidgetAlign.START - }; - signal_hbox.add (signal_label); - signal_value_label = new Label ("???") { - text_horizontal_align = Grx.TextHAlign.RIGHT - }; - signal_hbox .add (signal_value_label); - - var security_hbox = new Box.horizontal (); - scroll_vbox.add (security_hbox); - var security_label = new Label ("Security:") { - horizontal_align = WidgetAlign.START - }; - security_hbox.add (security_label); - security_value_label = new Label ("???") { - text_horizontal_align = Grx.TextHAlign.RIGHT - }; - security_hbox .add (security_value_label); - - var address_hbox = new Box.horizontal (); - scroll_vbox.add (address_hbox); - var address_label = new Label ("IP Address:") { - horizontal_align = WidgetAlign.START - }; - address_hbox.add (address_label); - address_value_label = new Label ("???") { - text_horizontal_align = Grx.TextHAlign.RIGHT - }; - address_hbox .add (address_value_label); - } - } -} diff --git a/src/view/WifiNetworkWindow.vala b/src/view/WifiNetworkWindow.vala deleted file mode 100644 index 7ae28c3..0000000 --- a/src/view/WifiNetworkWindow.vala +++ /dev/null @@ -1,120 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2015 David Lechner - * - * 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 . - */ - -/* - * WifiNetworkWindow.vala: View for a single Wi-Fi network. - */ - -using Ev3devKit; -using Ev3devKit.Ui; - -namespace BrickManager { - public class WifiNetworkWindow : BrickManagerWindow { - Label status_value_label; - Ui.Menu menu; - Ui.MenuItem action_menu_item; - Ui.MenuItem forget_menu_item; - Ui.MenuItem network_connection_menu_item; - - public string status { - get { - return status_value_label.text; - } - set { - status_value_label.text = value; - } - } - - public string action { - get { - return action_menu_item.label.text; - } - set { - action_menu_item.label.text = value; - } - } - - bool _can_forget = true; - public bool can_forget { - get { - return _can_forget; - } - set { - if (value == _can_forget) { - return; - } - if (value) { - menu.insert_menu_item (forget_menu_item, - network_connection_menu_item); - } else { - menu.remove_menu_item (forget_menu_item); - } - _can_forget = value; - } - } - - public signal void status_selected (); - - public signal void action_selected (); - - public signal void forget_selected (); - - public signal void network_connection_selected (); - - public WifiNetworkWindow (string name) { - title = name; - - var status_hbox = new Box.horizontal () { - padding_top = -6, - padding_bottom = -3, - border_bottom = 1 - }; - content_vbox.add (status_hbox); - var status_label = new Label ("Status:") { - text_horizontal_align = Grx.TextHAlign.RIGHT - }; - status_hbox.add (status_label); - status_value_label = new Label ("???") { - text_horizontal_align = Grx.TextHAlign.LEFT - }; - status_hbox .add (status_value_label); - - menu = new Ui.Menu (); - content_vbox.add (menu); - - var status_menu_item = new Ui.MenuItem.with_right_arrow ("Status"); - menu.add_menu_item (status_menu_item); - status_menu_item.button.pressed.connect (() => status_selected ()); - - action_menu_item = new Ui.MenuItem ("???"); - menu.add_menu_item (action_menu_item); - action_menu_item.button.pressed.connect (() => action_selected ()); - - forget_menu_item = new Ui.MenuItem ("Forget"); - menu.add_menu_item (forget_menu_item); - forget_menu_item.button.pressed.connect (() => forget_selected ()); - - network_connection_menu_item = - new Ui.MenuItem.with_right_arrow ("Network Connection"); - menu.add_menu_item (network_connection_menu_item); - network_connection_menu_item.button.pressed.connect (() => - network_connection_selected ()); - } - } -} diff --git a/src/view/WifiStatusBarItem.vala b/src/view/WifiStatusBarItem.vala deleted file mode 100644 index 76ca34f..0000000 --- a/src/view/WifiStatusBarItem.vala +++ /dev/null @@ -1,60 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2015 David Lechner - * - * 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 . - */ - -/* - * WifiStatusBarItem.vala: - * - * Indicates Wi-Fi connection status - */ - -using Ev3devKit.Ui; -using Grx; - -namespace BrickManager { - public class WifiStatusBarItem : StatusBarItem { - unowned Context connected_icon; - unowned Context idle_icon; - - public bool connected { get; set; } - - public WifiStatusBarItem () { - visible = false; - string file; - try { - file = Path.build_filename (Ev3devKit.DATA_DIR, "wifi16x16.png"); - connected_icon = Ev3devKit.Ui.Icon.create_context_from_png (file); - file = Path.build_filename (Ev3devKit.DATA_DIR, "wifi-idle16x16.png"); - idle_icon = Ev3devKit.Ui.Icon.create_context_from_png (file); - } catch (GLib.Error err) { - critical ("Error loading icon '%s'.", file); - } - notify["connected"].connect (redraw); - } - - public override int draw (int x, StatusBar.Align align) { - unowned Context icon = connected ? connected_icon : idle_icon; - if (icon != null) { - get_current_context ().bit_blt (x - icon.max_x, 1, icon, 0, 0, - icon.max_x, icon.max_y, Color.WHITE.to_image_mode ()); - return icon.max_x; - } - return -2; - } - } -} diff --git a/src/view/WifiWindow.vala b/src/view/WifiWindow.vala deleted file mode 100644 index a8283b8..0000000 --- a/src/view/WifiWindow.vala +++ /dev/null @@ -1,115 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2015 David Lechner - * - * 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 . - */ - -/* - * WifiWindow.vala: Wi-Fi Menu - */ - -using Ev3devKit; -using Ev3devKit.Ui; - -namespace BrickManager { - public class WifiWindow : BrickManagerWindow { - Ui.Menu powered_menu; - Ui.Menu unpowered_menu; - CheckboxMenuItem powered_menu_item; - Ui.MenuItem scan_menu_item; - - bool _powered; - public bool powered { - get { return _powered; } - set { - if (value == _powered) - return; - _powered = value; - powered_menu_item.checkbox.checked = value; - if (value) { - content_vbox.remove (unpowered_menu); - content_vbox.add (powered_menu); - powered_menu.insert_menu_item (powered_menu_item, scan_menu_item); - } else { - content_vbox.remove (powered_menu); - content_vbox.add (unpowered_menu); - unpowered_menu.add_menu_item (powered_menu_item); - } - } - } - - bool _scanning; - public bool scanning { - get { return _scanning; } - set { - _scanning = value; - if (_scanning) { - scan_menu_item.label.text = "Scanning..."; - scan_menu_item.button.can_focus = false; - scan_menu_item.button.focus_next (FocusDirection.DOWN); - } else { - scan_menu_item.label.text = "Start Scan"; - scan_menu_item.button.can_focus = true; - } - } - } - - public signal void scan_selected (); - - public signal void connection_selected (Object represented_object); - - public WifiWindow () { - title = "Wi-Fi"; - content_vbox.spacing = 0; - powered_menu_item = new CheckboxMenuItem ("Powered"); - powered_menu_item.button.vertical_align = WidgetAlign.START; - weak Ui.MenuItem weak_powered_menu_item = powered_menu_item; - powered_menu_item.button.pressed.connect (() => { - powered = !powered; - weak_powered_menu_item.button.focus (); - }); - content_vbox.add (powered_menu_item.button); - powered_menu = new Ui.Menu () { - spacing = 1 - }; - scan_menu_item = new Ui.MenuItem ("???"); - scan_menu_item.button.pressed.connect (() => scan_selected ()); - powered_menu.add_menu_item (scan_menu_item); - var networks_label_menu_item = new Ui.MenuItem ("Networks"); - networks_label_menu_item.label.horizontal_align = WidgetAlign.CENTER; - networks_label_menu_item.button.border_bottom = 1; - networks_label_menu_item.button.margin_bottom = 2; - networks_label_menu_item.button.can_focus = false; - powered_menu.add_menu_item (networks_label_menu_item); - unpowered_menu = new Ui.Menu (); - - scanning = false; - } - - public void add_menu_item (Ui.MenuItem menu_item) { - powered_menu.add_menu_item (menu_item); - } - - public void remove_menu_item (Ui.MenuItem menu_item) { - powered_menu.remove_menu_item (menu_item); - } - - public Ui.MenuItem? find_menu_item (Object represented_object) { - return powered_menu.find_menu_item (represented_object, - (mi, o) => o == mi.represented_object); - } - } -} diff --git a/test/ControlPanel.vala b/test/ControlPanel.vala deleted file mode 100644 index 999057b..0000000 --- a/test/ControlPanel.vala +++ /dev/null @@ -1,186 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2014-2015 David Lechner - * - * 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 . - */ - -/* - * ControlPanel.vala: - * - * Control Panel for driving GtkFramebuffer - */ - -using Gtk; - -namespace BrickManager { - public class ControlPanel : Object { - const string CONTROL_PANEL_GLADE_FILE = "ControlPanel.glade"; - - public Gtk.Window window; - public FakeFileBrowserController file_browser_controller; - public FakeDeviceBrowserController device_browser_controller; - public FakeNetworkController network_controller; - public FakeBluetoothController bluetooth_controller; - public FakeBatteryController battery_controller; - public FakeAboutController about_controller; - public FakeOpenRobertaController open_roberta_controller; - - enum Tab { - DEVICE_BROWSER, - NETWORK, - BLUETOOTH, - BATTERY, - OPEN_ROBERTA, - ABOUT - } - - enum NetworkNotebookTab { - MAIN, - CONNECTIONS, - CONNECTION_INFO, - WIFI, - WIFI_INFO, - TETHERING - } - - enum PortsColumn { - PRESENT, - DEVICE_NAME, - ADDRESS, - DRIVER_NAME, - MODE, - MODES, - STATUS, - CAN_SET_DEVICE, - USER_DATA, - COLUMN_COUNT; - } - - enum SensorsColumn { - PRESENT, - DEVICE_NAME, - DRIVER_NAME, - ADDRESS, - FW_VERSION, - POLL_MS, - MODES, - MODE, - NUM_VALUES, - DECIMALS, - UNITS, - COMMANDS, - USER_DATA, - COLUMN_COUNT; - } - - enum TachoMotorsColumn { - PRESENT, - DEVICE_NAME, - ADDRESS, - DRIVER_NAME, - POLARITY, - RUNNING, - USER_DATA, - COLUMN_COUNT; - } - - enum NetworkConnectionsColumn { - PRESENT, - CONNECTED, - NAME, - TYPE, - USER_DATA, - COLUMN_COUNT; - } - - enum NetworkWifiColumn { - PRESENT, - CONNECTED, - NAME, - SECURITY, - STRENGTH, - USER_DATA, - COLUMN_COUNT; - } - - enum NetworkConnectionInfoDnsColumn { - ADDRESS, - COLUMN_COUNT; - } - - enum NetworkTetherColumn { - PRESENT, - NAME, - ENABLED, - USER_DATA, - COLUMN_COUNT; - } - - enum BluetoothDeviceColumn { - PRESENT, - NAME, - ADAPTER, - CONNECTED, - USER_DATA, - COLUMN_COUNT; - } - - public ControlPanel () { - var builder = new Builder (); - try { - builder.add_from_file (CONTROL_PANEL_GLADE_FILE); - window = builder.get_object ("control_panel_window") as Gtk.Window; - - file_browser_controller = new FakeFileBrowserController (builder); - device_browser_controller = new FakeDeviceBrowserController (builder); - network_controller = new FakeNetworkController (builder); - bluetooth_controller = new FakeBluetoothController (builder); - battery_controller = new FakeBatteryController (builder); - about_controller = new FakeAboutController (builder); - open_roberta_controller = new FakeOpenRobertaController (builder); - - builder.connect_signals (this); - window.show_all (); - } catch (Error err) { - critical ("ControlPanel init failed: %s", err.message); - } - } - - [CCode (instance_pos = -1)] - public void on_quit_button_clicked (Gtk.Button button) { - // FIXME: - //Ev3devKitDesktop.GtkApp.quit (); - } - - internal static void update_listview_toggle_item (Gtk.ListStore store, - CellRendererToggle toggle, string path, int column) - { - TreePath tree_path = new TreePath.from_string (path); - TreeIter iter; - store.get_iter (out iter, tree_path); - store.set (iter, column, !toggle.active); - } - - internal static void update_listview_text_item (Gtk.ListStore store, - string path, string new_text, int column) - { - TreePath tree_path = new TreePath.from_string (path); - TreeIter iter; - store.get_iter (out iter, tree_path); - store.set (iter, column, new_text); - } - } -} diff --git a/test/FakeBluez5.vala b/test/FakeBluez5.vala deleted file mode 100644 index 96afd34..0000000 --- a/test/FakeBluez5.vala +++ /dev/null @@ -1,38 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright 2014 David Lechner - * - * 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 2 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -/* FakeBluez5.vala - Fake implementation of BlueZ 5 dbus stuff for testing */ - -namespace Bluez5 { - public class Device { - public ObjectPath path { get; private set; } - public string name { get { return path; } } - public string alias { get { return path; } } - - public Device (ObjectPath path) { - this.path = path; - } - - public static Device get_for_object_path (ObjectPath path) { - return new Device (path); - } - } -} \ No newline at end of file diff --git a/test/FakeConnman.vala b/test/FakeConnman.vala deleted file mode 100644 index 81829db..0000000 --- a/test/FakeConnman.vala +++ /dev/null @@ -1,55 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright 2014 David Lechner - * - * 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 2 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -/* FakeConnman.vala - Fake implementation of ConnMan dbus stuff for testing */ - -namespace Connman { - public class Manager { - public Service get_service (ObjectPath path) { - return new Service (path); - } - } - - public class Service { - public ObjectPath path { get; private set; } - public string name { get { return path; } } - - public Service (ObjectPath path) { - this.path = path; - } - - public static Service from_path_sync (ObjectPath path) throws IOError { - return new Service (path); - } - } - - public class Peer { - ObjectPath path { get; private set; } - - public Peer (ObjectPath path) { - this.path = path; - } - - public static Peer from_path_sync (ObjectPath path) throws IOError { - return new Peer (path); - } - } -} \ No newline at end of file diff --git a/test/controller/FakeAboutController.vala b/test/controller/FakeAboutController.vala deleted file mode 100644 index 09ecb10..0000000 --- a/test/controller/FakeAboutController.vala +++ /dev/null @@ -1,73 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright 2014-2015 David Lechner - * - * 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 2 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -/* FakeAboutController.vala - Fake About controller for testing */ - -using Ev3devKit.Ui; - -namespace BrickManager { - public class FakeAboutController : Object, IBrickManagerModule { - Gtk.Notebook control_panel_notebook; - Gtk.Entry kernel_version_entry; - Gtk.Entry cpuinfo_model_entry; - Gtk.Entry cpuinfo_revision_entry; - Gtk.Entry cpuinfo_serial_number_entry; - - public string display_name { get { return "About"; } } - - public FakeAboutController (Gtk.Builder builder) { - - control_panel_notebook = builder.get_object ("control-panel-notebook") as Gtk.Notebook; - kernel_version_entry = builder.get_object ("about-kernel-version-entry") as Gtk.Entry; - cpuinfo_model_entry = builder.get_object ("about-cpuinfo-model-entry") as Gtk.Entry; - cpuinfo_revision_entry = builder.get_object ("about-cpuinfo-revision-entry") as Gtk.Entry; - cpuinfo_serial_number_entry = builder.get_object ("about-cpuinfo-serial-number-entry") as Gtk.Entry; - var utsname = Posix.UTSName (); - if (Posix.uname (ref utsname) == 0) { - kernel_version_entry.text = utsname.release; - } else { - critical ("Failed to get kernel version."); - } - cpuinfo_model_entry.text = "Gtk Desktop"; - cpuinfo_revision_entry.text = "0000"; - cpuinfo_serial_number_entry.text = "0000000000000000"; - } - - public void show_main_window () { - var about_window = new AboutWindow (display_name); - - about_window.shown.connect (() => - control_panel_notebook.page = (int)ControlPanel.Tab.ABOUT); - - kernel_version_entry.bind_property ("text", about_window, - "kernel-version", BindingFlags.SYNC_CREATE); - cpuinfo_model_entry.bind_property ("text", about_window, - "model-name", BindingFlags.SYNC_CREATE); - cpuinfo_revision_entry.bind_property ("text", about_window, - "revision", BindingFlags.SYNC_CREATE); - cpuinfo_serial_number_entry.bind_property ("text", about_window, - "serial-number", BindingFlags.SYNC_CREATE); - - about_window.weak_ref (() => message ("about_window disposed.")); - about_window.show (); - } - } -} diff --git a/test/controller/FakeBatteryController.vala b/test/controller/FakeBatteryController.vala deleted file mode 100644 index 766a579..0000000 --- a/test/controller/FakeBatteryController.vala +++ /dev/null @@ -1,64 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright 2014-2015 David Lechner - * - * 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 2 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -/* FakeBatteryController.vala - Fake Battery controller for testing */ - -using Ev3devKit.Ui; - -namespace BrickManager { - public class FakeBatteryController : Object, IBrickManagerModule { - BatteryInfoWindow battery_window; - internal BatteryStatusBarItem battery_status_bar_item; - - public string display_name { get { return "Battery"; } } - - public FakeBatteryController (Gtk.Builder builder) { - battery_window = new BatteryInfoWindow (display_name); - var control_panel_notebook = builder.get_object ("control-panel-notebook") as Gtk.Notebook; - battery_window.shown.connect (() => control_panel_notebook.page = (int)ControlPanel.Tab.BATTERY); - - var battery_loading_checkbutton = builder.get_object ("battery-loading-checkbutton") as Gtk.CheckButton; - battery_loading_checkbutton.bind_property ("active", battery_window, "loading", BindingFlags.SYNC_CREATE); - (builder.get_object ("battery-tech-comboboxtext") as Gtk.ComboBoxText) - .bind_property ("active-id", battery_window, "technology", BindingFlags.SYNC_CREATE); - (builder.get_object ("battery-voltage-checkbutton") as Gtk.CheckButton) - .bind_property ("active", battery_window, "has-voltage", BindingFlags.SYNC_CREATE); - (builder.get_object ("battery-voltage-spinbutton") as Gtk.SpinButton) - .bind_property ("value", battery_window, "voltage", BindingFlags.SYNC_CREATE); - (builder.get_object ("battery-current-checkbutton") as Gtk.CheckButton) - .bind_property ("active", battery_window, "has-current", BindingFlags.SYNC_CREATE); - (builder.get_object ("battery-current-spinbutton") as Gtk.SpinButton) - .bind_property ("value", battery_window, "current", BindingFlags.SYNC_CREATE); - (builder.get_object ("battery-power-checkbutton") as Gtk.CheckButton) - .bind_property ("active", battery_window, "has-power", BindingFlags.SYNC_CREATE); - (builder.get_object ("battery-power-spinbutton") as Gtk.SpinButton) - .bind_property ("value", battery_window, "power", BindingFlags.SYNC_CREATE); - - battery_status_bar_item = new BatteryStatusBarItem (); - (builder.get_object ("battery-voltage-spinbutton") as Gtk.SpinButton) - .bind_property ("value", battery_status_bar_item, "voltage", BindingFlags.SYNC_CREATE); - } - - public void show_main_window () { - battery_window.show (); - } - } -} \ No newline at end of file diff --git a/test/controller/FakeBluetoothController.vala b/test/controller/FakeBluetoothController.vala deleted file mode 100644 index 04a7b7a..0000000 --- a/test/controller/FakeBluetoothController.vala +++ /dev/null @@ -1,267 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright 2014-2015 David Lechner - * - * 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 2 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -/* FakeBluetoothController.vala - Fake Bluetooth (BlueZ 5) controller for testing */ - -using Bluez5; -using Ev3devKit.Ui; - -namespace BrickManager { - public class FakeBluetoothController : Object, IBrickManagerModule { - BluetoothWindow bluetooth_window; - public BluetoothStatusBarItem bluetooth_status_bar_item; - - public string display_name { get { return "Bluetooth"; } } - - public signal void show_network_connection_requested (string address); - - public FakeBluetoothController (Gtk.Builder builder) { - var control_panel_notebook = builder.get_object ("control-panel-notebook") as Gtk.Notebook; - var bluetooth_loading_checkbutton = builder.get_object ("bluetooth-loading-checkbutton") as Gtk.CheckButton; - var bluetooth_available_checkbutton = builder.get_object ("bluetooth-available-checkbutton") as Gtk.CheckButton; - - /* Start/Main Window */ - - bluetooth_window = new BluetoothWindow (display_name); - bluetooth_window.shown.connect (() => control_panel_notebook.page = (int)ControlPanel.Tab.BLUETOOTH); - bluetooth_loading_checkbutton.bind_property ("active", bluetooth_window, "loading", BindingFlags.SYNC_CREATE); - bluetooth_available_checkbutton.bind_property ("active", bluetooth_window, "available", BindingFlags.SYNC_CREATE); - (builder.get_object ("bluetooth-powered-checkbutton") as Gtk.CheckButton).bind_property ("active", - bluetooth_window, "powered", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); - (builder.get_object ("bluetooth-visible-checkbutton") as Gtk.CheckButton).bind_property ("active", - bluetooth_window, "bt-visible", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); - (builder.get_object ("bluetooth-scanning-checkbutton") as Gtk.CheckButton).bind_property ("active", - bluetooth_window, "scanning", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); - bluetooth_window.scan_selected.connect (() => bluetooth_window.scanning = !bluetooth_window.scanning); - - var bluetooth_show_adapter_checkbutton = builder.get_object ("bluetooth-show-adapter-checkbutton") as Gtk.CheckButton; - - var bluetooth_devices_liststore = builder.get_object ("bluetooth-devices-liststore") as Gtk.ListStore; - bluetooth_devices_liststore.row_changed.connect ((path, iter) => { - Value present; - bluetooth_devices_liststore.get_value (iter, ControlPanel.BluetoothDeviceColumn.PRESENT, out present); - Value name; - bluetooth_devices_liststore.get_value (iter, ControlPanel.BluetoothDeviceColumn.NAME, out name); - Value adapter; - bluetooth_devices_liststore.get_value (iter, ControlPanel.BluetoothDeviceColumn.ADAPTER, out adapter); - Value connected; - bluetooth_devices_liststore.get_value (iter, ControlPanel.BluetoothDeviceColumn.CONNECTED, out connected); - Value user_data; - bluetooth_devices_liststore.get_value (iter, ControlPanel.BluetoothDeviceColumn.USER_DATA, out user_data); - var menu_item = (BluetoothDeviceMenuItem?)user_data.get_pointer (); - if (!present.get_boolean () && menu_item != null) { - bluetooth_window.remove_menu_item (menu_item); - bluetooth_devices_liststore.set (iter, ControlPanel.BluetoothDeviceColumn.USER_DATA, (void*)null); - } - if (present.get_boolean () && menu_item == null) { - menu_item = new BluetoothDeviceMenuItem () { - name = name.dup_string (), - adapter = adapter.dup_string (), - connected = connected.get_boolean () - }; - weak BluetoothDeviceMenuItem weak_menu_item = menu_item; - bluetooth_show_adapter_checkbutton.bind_property ("active", menu_item, "show-adapter", BindingFlags.SYNC_CREATE); - menu_item.button.pressed.connect (() => { - - /* Device Info Window */ - - var bluetooth_device_info_title_entry = builder.get_object ("bluetooth-device-info-title-entry") as Gtk.Entry; - var bluetooth_device_info_address_entry = builder.get_object ("bluetooth-device-info-address-entry") as Gtk.Entry; - var bluetooth_device_info_paired_checkbutton = builder.get_object ("bluetooth-device-info-paired-checkbutton") as Gtk.CheckButton; - var bluetooth_device_info_connected_checkbutton = builder.get_object ("bluetooth-device-info-connected-checkbutton") as Gtk.CheckButton; - var bluetooth_device_info_has_network_checkbutton = builder.get_object ("bluetooth-device-info-has-network-checkbutton") as Gtk.CheckButton; - - bluetooth_device_info_title_entry.text = weak_menu_item.name + - (bluetooth_show_adapter_checkbutton.active ? " (%s)".printf (weak_menu_item.adapter) : ""); - bluetooth_device_info_connected_checkbutton.active = weak_menu_item.connected; - - var info_window = new BluetoothDeviceWindow (); - bluetooth_device_info_title_entry.bind_property ("text", info_window, "title", BindingFlags.SYNC_CREATE); - bluetooth_device_info_address_entry.bind_property ("text", info_window, "address", BindingFlags.SYNC_CREATE); - bluetooth_device_info_paired_checkbutton.bind_property ("active", info_window, "paired", BindingFlags.SYNC_CREATE); - bluetooth_device_info_connected_checkbutton.bind_property ("active", info_window, "connected", BindingFlags.SYNC_CREATE); - bluetooth_device_info_has_network_checkbutton.bind_property ("active", info_window, "has-network", BindingFlags.SYNC_CREATE); - weak BluetoothDeviceWindow weak_info_window = info_window; - info_window.network_selected.connect (() => show_network_connection_requested (weak_menu_item.name)); - info_window.connect_selected.connect (() => weak_info_window.connected = !weak_info_window.connected); - info_window.show (); - }); - - bluetooth_window.add_menu_item (menu_item); - bluetooth_devices_liststore.set (iter, ControlPanel.BluetoothDeviceColumn.USER_DATA, (void*)menu_item); - } - if (menu_item == null) - return; - if (menu_item.name != name.get_string ()) - menu_item.name = name.dup_string (); - if (menu_item.adapter != adapter.get_string ()) - menu_item.adapter = adapter.dup_string (); - if (menu_item.connected != connected.get_boolean ()) - menu_item.connected = connected.get_boolean (); - }); - bluetooth_devices_liststore.foreach ((model, path, iter) => { - model.row_changed (path, iter); - return false; - }); - (builder.get_object ("bluetooth-devices-present-cellrenderertoggle") as Gtk.CellRendererToggle) - .toggled.connect ((toggle, path) => ControlPanel.update_listview_toggle_item ( - bluetooth_devices_liststore, toggle, path, ControlPanel.BluetoothDeviceColumn.PRESENT)); - (builder.get_object ("bluetooth-devices-name-cellrenderertext") as Gtk.CellRendererText) - .edited.connect ((path, new_text) => ControlPanel.update_listview_text_item ( - bluetooth_devices_liststore, path, new_text, ControlPanel.BluetoothDeviceColumn.NAME)); - (builder.get_object ("bluetooth-devices-adapter-cellrenderertext") as Gtk.CellRendererText) - .edited.connect ((path, new_text) => ControlPanel.update_listview_text_item ( - bluetooth_devices_liststore, path, new_text, ControlPanel.BluetoothDeviceColumn.ADAPTER)); - (builder.get_object ("bluetooth-devices-connected-cellrenderertoggle") as Gtk.CellRendererToggle) - .toggled.connect ((toggle, path) => ControlPanel.update_listview_toggle_item ( - bluetooth_devices_liststore, toggle, path, ControlPanel.BluetoothDeviceColumn.CONNECTED)); - - (builder.get_object ("bluetooth-devices-add-button") as Gtk.Button).clicked.connect (() => { - Gtk.TreeIter iter; - bluetooth_devices_liststore.append (out iter); - bluetooth_devices_liststore.set_value (iter, ControlPanel.BluetoothDeviceColumn.PRESENT, true); - bluetooth_devices_liststore.set_value (iter, ControlPanel.BluetoothDeviceColumn.NAME, "New Device"); - bluetooth_devices_liststore.set_value (iter, ControlPanel.BluetoothDeviceColumn.ADAPTER, "ev3dev"); - bluetooth_devices_liststore.set_value (iter, ControlPanel.BluetoothDeviceColumn.CONNECTED, false); - bluetooth_devices_liststore.row_changed (bluetooth_devices_liststore.get_path (iter), iter); - }); - var bluetooth_devices_remove_button = builder.get_object ("bluetooth-devices-remove-button") as Gtk.Button; - var bluetooth_devices_treeview_selection = (builder.get_object ("bluetooth-devices-treeview") as Gtk.TreeView).get_selection (); - bluetooth_devices_remove_button.clicked.connect (() => { - Gtk.TreeModel model; - Gtk.TreeIter iter; - if (bluetooth_devices_treeview_selection.get_selected (out model, out iter)) { - Value user_data; - model.get_value (iter, ControlPanel.BluetoothDeviceColumn.USER_DATA, out user_data); - var menu_item = (BluetoothDeviceMenuItem?)user_data.get_pointer (); - if (menu_item != null) - bluetooth_window.remove_menu_item (menu_item); - bluetooth_devices_liststore.remove (iter); - } - }); - bluetooth_devices_treeview_selection.changed.connect (() => { - bluetooth_devices_remove_button.sensitive = bluetooth_devices_treeview_selection.count_selected_rows () > 0; - }); - bluetooth_devices_treeview_selection.changed (); - - - /* BluetoothStatusBarItem */ - - bluetooth_status_bar_item = new BluetoothStatusBarItem (); - (builder.get_object ("bluetooth-status-powered-checkbutton") as Gtk.CheckButton) - .bind_property("active", bluetooth_status_bar_item, "visible", BindingFlags.SYNC_CREATE); - (builder.get_object ("bluetooth-status-connected-checkbutton") as Gtk.CheckButton) - .bind_property("active", bluetooth_status_bar_item, "connected", BindingFlags.SYNC_CREATE); - - /* Agent */ - - var bluetooth_agent_name_entry = builder.get_object ("bluetooth-agent-name-entry") as Gtk.Entry; - var bluetooth_agent_passkey_entry = builder.get_object ("bluetooth-agent-passkey-entry") as Gtk.Entry; - var agent = new Bluez5Agent (); - (builder.get_object ("bluetooth-agent-request-pin-code-button") as Gtk.Button) - .clicked.connect (() => { - var path = new ObjectPath (bluetooth_agent_name_entry.text); - agent.request_pin_code.begin (path, (obj, res) => { - try { - var pin_code = agent.request_pin_code.end (res); - show_message ("pin_code: %s".printf (pin_code)); - } catch (BlueZError err) { - message ("%s", err.message); - } - }); - }); - (builder.get_object ("bluetooth-agent-display-pin-code-button") as Gtk.Button) - .clicked.connect (() => { - var path = new ObjectPath ("My Device"); - agent.display_pin_code (path, bluetooth_agent_passkey_entry.text); - }); - (builder.get_object ("bluetooth-agent-request-passkey-button") as Gtk.Button) - .clicked.connect (() => { - var path = new ObjectPath (bluetooth_agent_name_entry.text); - agent.request_passkey.begin (path, (obj, res) => { - try { - var pin_code = agent.request_passkey.end (res); - show_message ("passkey: %u".printf (pin_code)); - } catch (BlueZError err) { - message ("%s", err.message); - } - }); - }); - (builder.get_object ("bluetooth-agent-display-passkey-button") as Gtk.Button) - .clicked.connect (() => { - var path = new ObjectPath (bluetooth_agent_name_entry.text); - var passkey = int.parse (bluetooth_agent_passkey_entry.text); - agent.display_passkey (path, passkey, 0); - }); - (builder.get_object ("bluetooth-agent-request-confirmation-button") as Gtk.Button) - .clicked.connect (() => { - var path = new ObjectPath (bluetooth_agent_name_entry.text); - var passkey = int.parse (bluetooth_agent_passkey_entry.text); - agent.request_confirmation.begin (path, passkey, (obj, res) => { - try { - agent.request_confirmation.end (res); - show_message ("Accepted."); - } catch (BlueZError err) { - show_message (err.message); - } - }); - }); - (builder.get_object ("bluetooth-agent-request-authorization-button") as Gtk.Button) - .clicked.connect (() => { - var path = new ObjectPath (bluetooth_agent_name_entry.text); - agent.request_authorization.begin (path, (obj, res) => { - try { - agent.request_authorization.end (res); - show_message ("Accepted."); - } catch (BlueZError err) { - show_message (err.message); - } - }); - }); - (builder.get_object ("bluetooth-agent-authorize-service-button") as Gtk.Button) - .clicked.connect (() => { - var path = new ObjectPath (bluetooth_agent_name_entry.text); - // TODO: add UI to change Uuid. - agent.authorize_service.begin (path, Uuid.SerialPort, (obj, res) => { - try { - agent.authorize_service.end (res); - show_message ("Accepted."); - } catch (BlueZError err) { - show_message (err.message); - } - }); - }); - (builder.get_object ("bluetooth-agent-cancel-button") as Gtk.Button) - .clicked.connect (() => agent.cancel ()); - } - - public void show_main_window () { - bluetooth_window.show (); - } - - void show_message (string message) { - var dialog = new Gtk.MessageDialog (Gtk.Window.list_toplevels ().nth_data (0), - Gtk.DialogFlags.MODAL, Gtk.MessageType.INFO, Gtk.ButtonsType.OK, message); - dialog.response.connect ((id) => dialog.destroy ()); - dialog.show (); - } - } -} \ No newline at end of file diff --git a/test/controller/FakeDeviceBrowserController.vala b/test/controller/FakeDeviceBrowserController.vala deleted file mode 100644 index fe0881a..0000000 --- a/test/controller/FakeDeviceBrowserController.vala +++ /dev/null @@ -1,386 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright 2015 David Lechner - * - * 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 2 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -/* FakeDeviceBrowserController.vala - Fake Device Browser controller for testing */ - -using Ev3devKit; -using Ev3devKit.Ui; - -namespace BrickManager { - public class FakeDeviceBrowserController : Object, IBrickManagerModule { - DeviceBrowserWindow device_browser_window; - - public string display_name { get { return "Device Browser"; } } - - public FakeDeviceBrowserController (Gtk.Builder builder) { - device_browser_window = new DeviceBrowserWindow (display_name); - var control_panel_notebook = builder.get_object ("control-panel-notebook") as Gtk.Notebook; - device_browser_window.shown.connect (() => - control_panel_notebook.page = (int)ControlPanel.Tab.DEVICE_BROWSER); - - var port_browser_window = new PortBrowserWindow (); - var sensor_browser_window = new SensorBrowserWindow (); - var motor_browser_window = new MotorBrowserWindow (); - - /* device_browser_window setup */ - - device_browser_window.ports_menu_item_selected.connect (() => { - port_browser_window.show (); - }); - device_browser_window.sensors_menu_item_selected.connect (() => { - sensor_browser_window.show (); - }); - device_browser_window.motors_menu_item_selected.connect (() => { - motor_browser_window.show (); - }); - - /* Ports */ - - var ports_liststore = builder.get_object ("ports_liststore") as Gtk.ListStore; - ports_liststore.foreach ((model, path, iter) => { - Value device_name; - ports_liststore.get_value (iter, ControlPanel.PortsColumn.DEVICE_NAME, out device_name); - Value address; - ports_liststore.get_value (iter, ControlPanel.PortsColumn.ADDRESS, out address); - Value driver_name; - ports_liststore.get_value (iter, ControlPanel.PortsColumn.DRIVER_NAME, out driver_name); - var menu_item = new Ui.MenuItem.with_right_arrow (address.dup_string ()); - port_browser_window.menu.add_menu_item (menu_item); - //liststore USER_DATA is gpointer, so it does not take a ref - ports_liststore.set (iter, ControlPanel.PortsColumn.USER_DATA, menu_item.ref ()); - menu_item.button.pressed.connect (() => { - var window = new PortInfoWindow (address.dup_string (), device_name.dup_string (), - driver_name.dup_string ()); - var row_changed_handler_id = ports_liststore.row_changed.connect ((path, iter) => { - Value present; - ports_liststore.get_value (iter, ControlPanel.PortsColumn.PRESENT, out present); - if (!present.get_boolean ()) { - window.close (); - var dialog = new MessageDialog ("Port Removed", - "Port %s is no longer connected.".printf (address.get_string ())); - dialog.show (); - return; - } - Value mode; - ports_liststore.get_value (iter, ControlPanel.PortsColumn.MODE, out mode); - Value status; - ports_liststore.get_value (iter, ControlPanel.PortsColumn.STATUS, out status); - Value can_set_device; - ports_liststore.get_value (iter, ControlPanel.PortsColumn.CAN_SET_DEVICE, out can_set_device); - if (window.mode != mode.get_string ()) - window.mode = mode.dup_string (); - if (window.status != status.get_string ()) - window.status = status.dup_string (); - if (window.can_set_device != can_set_device.get_boolean ()) - window.can_set_device = can_set_device.get_boolean (); - }); - var set_mode_button_pressed_handler_id = window.set_mode_button_pressed.connect (() => { - Value modes; - ports_liststore.get_value (iter, ControlPanel.PortsColumn.MODES, out modes); - var dialog = new SelectFromListDialog (modes.get_string ().split (" ")); - var item_selected_handler_id = dialog.item_selected.connect ((mode) => { - ports_liststore.set (iter, ControlPanel.PortsColumn.MODE, mode); - ports_liststore.set (iter, ControlPanel.PortsColumn.STATUS, mode); - }); - var row_changed_handler_id2 = ports_liststore.row_changed.connect ((path, iter) => { - Value present; - ports_liststore.get_value (iter, ControlPanel.PortsColumn.PRESENT, out present); - if (!present.get_boolean ()) - dialog.close (); - }); - ulong dialog_closed_handler_id = 0; - dialog_closed_handler_id = dialog.closed.connect (() => { - dialog.disconnect (item_selected_handler_id); - ports_liststore.disconnect (row_changed_handler_id2); - dialog.disconnect (dialog_closed_handler_id); - }); - dialog.show (); - }); - var set_device_button_pressed_handler_id = window.set_device_button_pressed.connect (() => { - // TODO: Make this list come from the Gtk UI - string[] devices = { "nxt-analog", "lego-nxt-touch", "lego-nxt-light", "lego-nxt-sound" }; - var dialog = new SelectFromListDialog (devices); - var item_selected_handler_id = dialog.item_selected.connect ((device) => { - message ("Selected device: %s", device); - }); - var row_changed_handler_id2 = ports_liststore.row_changed.connect ((path, iter) => { - Value present; - ports_liststore.get_value (iter, ControlPanel.PortsColumn.PRESENT, out present); - if (!present.get_boolean ()) - dialog.close (); - }); - ulong dialog_closed_handler_id = 0; - dialog_closed_handler_id = dialog.closed.connect (() => { - dialog.disconnect (item_selected_handler_id); - ports_liststore.disconnect (row_changed_handler_id2); - dialog.disconnect (dialog_closed_handler_id); - }); - dialog.show (); - }); - ulong closed_handler_id = 0; - closed_handler_id = window.closed.connect (() => { - ports_liststore.disconnect (row_changed_handler_id); - window.disconnect (set_mode_button_pressed_handler_id); - window.disconnect (set_device_button_pressed_handler_id); - window.disconnect (closed_handler_id); - }); - ports_liststore.row_changed (path, iter); - window.show (); - }); - return false; - }); - ports_liststore.row_changed.connect ((path, iter) => { - Value present; - ports_liststore.get_value (iter, ControlPanel.PortsColumn.PRESENT, out present); - Value user_data; - ports_liststore.get_value (iter, ControlPanel.PortsColumn.USER_DATA, out user_data); - var menu_item = (Ui.MenuItem)user_data.get_pointer (); - if (port_browser_window.menu.has_menu_item (menu_item) && !present.get_boolean ()) - port_browser_window.menu.remove_menu_item (menu_item); - else if (!port_browser_window.menu.has_menu_item (menu_item) && present.get_boolean ()) - port_browser_window.menu.add_menu_item (menu_item); - }); - (builder.get_object ("ports_present_cellrenderertoggle") as Gtk.CellRendererToggle) - .toggled.connect ((toggle, path) => ControlPanel.update_listview_toggle_item ( - ports_liststore, toggle, path, ControlPanel.PortsColumn.PRESENT)); - (builder.get_object ("ports_mode_cellrenderertext") as Gtk.CellRendererText) - .edited.connect ((path, new_text) => ControlPanel.update_listview_text_item ( - ports_liststore, path, new_text, ControlPanel.PortsColumn.MODE)); - (builder.get_object ("ports_modes_cellrenderertext") as Gtk.CellRendererText) - .edited.connect ((path, new_text) => ControlPanel.update_listview_text_item ( - ports_liststore, path, new_text, ControlPanel.PortsColumn.MODES)); - (builder.get_object ("ports_status_cellrenderertext") as Gtk.CellRendererText) - .edited.connect ((path, new_text) => ControlPanel.update_listview_text_item ( - ports_liststore, path, new_text, ControlPanel.PortsColumn.STATUS)); - (builder.get_object ("ports_can_set_device_cellrenderertoggle") as Gtk.CellRendererToggle) - .toggled.connect ((toggle, path) => ControlPanel.update_listview_toggle_item ( - ports_liststore, toggle, path, ControlPanel.PortsColumn.CAN_SET_DEVICE)); - - /* Sensors */ - - var sensors_liststore = builder.get_object ("sensors_liststore") as Gtk.ListStore; - sensors_liststore.foreach ((model, path, iter) => { - Value present; - sensors_liststore.get_value (iter, ControlPanel.SensorsColumn.PRESENT, out present); - Value device_name; - sensors_liststore.get_value (iter, ControlPanel.SensorsColumn.DEVICE_NAME, out device_name); - Value driver_name; - sensors_liststore.get_value (iter, ControlPanel.SensorsColumn.DRIVER_NAME, out driver_name); - Value address; - sensors_liststore.get_value (iter, ControlPanel.SensorsColumn.ADDRESS, out address); - var menu_item = new Ui.MenuItem.with_right_arrow ("%s at %s".printf (driver_name.get_string (), - address.get_string ())); - if (present.get_boolean ()) - sensor_browser_window.menu.add_menu_item (menu_item); - //liststore USER_DATA is gpointer, so it does not take a ref - sensors_liststore.set (iter, ControlPanel.SensorsColumn.USER_DATA, menu_item.ref ()); - menu_item.button.pressed.connect (() => { - Value commands; - sensors_liststore.get_value (iter, ControlPanel.SensorsColumn.COMMANDS, out commands); - var window = new SensorInfoWindow (driver_name.dup_string (), device_name.dup_string (), - address.dup_string (), commands.get_string () != "n/a"); - var row_changed_handler_id = sensors_liststore.row_changed.connect ((path, iter) => { - sensors_liststore.get_value (iter, ControlPanel.SensorsColumn.PRESENT, out present); - if (!present.get_boolean ()) { - window.close (); - var dialog = new MessageDialog ("Sensor Removed", - "Sensor %s at %s is no longer connected.".printf (driver_name.get_string (), - address.get_string ())); - dialog.show (); - return; - } - Value mode; - sensors_liststore.get_value (iter, ControlPanel.SensorsColumn.MODE, out mode); - if (window.mode != mode.get_string ()) - window.mode = mode.dup_string (); - }); - var watch_values_handler_id = window.watch_values_selected.connect (() => { - Value units; - sensors_liststore.get_value (iter, ControlPanel.SensorsColumn.UNITS, out units); - var dialog = new SensorValueDialog (); - // TODO: make this value adjustable in UI instead of using Timeout - var value = 0; - var timeout_id = Timeout.add (500, () => { - dialog.value_text = "%d %s".printf (value++, units.get_string ()); - return Source.CONTINUE; - }); - dialog.closed.connect (() => Source.remove (timeout_id)); - dialog.show (); - }); - var set_mode_handler_id = window.set_mode_selected.connect (() => { - Value modes; - sensors_liststore.get_value (iter, ControlPanel.SensorsColumn.MODES, out modes); - var dialog = new SelectFromListDialog (modes.get_string ().split (" ")); - dialog.item_selected.connect ((mode) => { - sensors_liststore.set (iter, ControlPanel.SensorsColumn.MODE, mode); - }); - dialog.show (); - }); - var send_command_handler_id = window.send_command_selected.connect (() => { - var dialog = new SelectFromListDialog (commands.get_string ().split (" ")); - dialog.item_selected.connect ((command) => { - message ("Sent command: %s", command); - }); - dialog.show (); - }); - ulong closed_handler_id = 0; - closed_handler_id = window.closed.connect (() => { - sensors_liststore.disconnect (row_changed_handler_id); - window.disconnect (watch_values_handler_id); - window.disconnect (set_mode_handler_id); - window.disconnect (send_command_handler_id); - window.disconnect (closed_handler_id); - }); - sensors_liststore.row_changed (path, iter); - window.show (); - }); - return false; - }); - sensors_liststore.row_changed.connect ((path, iter) => { - Value present; - sensors_liststore.get_value (iter, ControlPanel.SensorsColumn.PRESENT, out present); - Value user_data; - sensors_liststore.get_value (iter, ControlPanel.SensorsColumn.USER_DATA, out user_data); - var menu_item = (Ui.MenuItem)user_data.get_pointer (); - if (sensor_browser_window.menu.has_menu_item (menu_item) && !present.get_boolean ()) - sensor_browser_window.menu.remove_menu_item (menu_item); - else if (!sensor_browser_window.menu.has_menu_item (menu_item) && present.get_boolean ()) - sensor_browser_window.menu.add_menu_item (menu_item); - }); - (builder.get_object ("sensors_present_cellrenderertoggle") as Gtk.CellRendererToggle) - .toggled.connect ((toggle, path) => ControlPanel.update_listview_toggle_item ( - sensors_liststore, toggle, path, ControlPanel.SensorsColumn.PRESENT)); - (builder.get_object ("sensors_modes_cellrenderertext") as Gtk.CellRendererText) - .edited.connect ((path, new_text) => ControlPanel.update_listview_text_item ( - sensors_liststore, path, new_text, ControlPanel.SensorsColumn.MODES)); - (builder.get_object ("sensors_mode_cellrenderertext") as Gtk.CellRendererText) - .edited.connect ((path, new_text) => ControlPanel.update_listview_text_item ( - sensors_liststore, path, new_text, ControlPanel.SensorsColumn.MODE)); - (builder.get_object ("sensors_commands_cellrenderertext") as Gtk.CellRendererText) - .edited.connect ((path, new_text) => ControlPanel.update_listview_text_item ( - sensors_liststore, path, new_text, ControlPanel.SensorsColumn.COMMANDS)); - - /* Motors */ - - var tacho_motors_liststore = builder.get_object ("tacho-motors-liststore") as Gtk.ListStore; - tacho_motors_liststore.foreach ((model, path, iter) => { - Value present; - tacho_motors_liststore.get_value (iter, ControlPanel.TachoMotorsColumn.PRESENT, out present); - Value device_name; - tacho_motors_liststore.get_value (iter, ControlPanel.TachoMotorsColumn.DEVICE_NAME, out device_name); - Value driver_name; - tacho_motors_liststore.get_value (iter, ControlPanel.TachoMotorsColumn.DRIVER_NAME, out driver_name); - Value address; - tacho_motors_liststore.get_value (iter, ControlPanel.TachoMotorsColumn.ADDRESS, out address); - var menu_item = new Ui.MenuItem.with_right_arrow ("%s at %s".printf (driver_name.get_string (), - address.get_string ())); - if (present.get_boolean ()) - motor_browser_window.menu.add_menu_item (menu_item); - //liststore USER_DATA is gpointer, so it does not take a ref - tacho_motors_liststore.set (iter, ControlPanel.TachoMotorsColumn.USER_DATA, menu_item.ref ()); - menu_item.button.pressed.connect (() => { - tacho_motors_liststore.get_value (iter, ControlPanel.TachoMotorsColumn.DEVICE_NAME, out device_name); - tacho_motors_liststore.get_value (iter, ControlPanel.TachoMotorsColumn.DRIVER_NAME, out driver_name); - tacho_motors_liststore.get_value (iter, ControlPanel.TachoMotorsColumn.ADDRESS, out address); - Value running; - tacho_motors_liststore.get_value (iter, ControlPanel.TachoMotorsColumn.RUNNING, out running); - var window = new MotorInfoWindow (driver_name.dup_string (), "tacho-motor", - device_name.dup_string (), address.dup_string (), true); - window.running = running.get_boolean (); - var row_changed_handler_id = tacho_motors_liststore.row_changed.connect ((path, iter) => { - tacho_motors_liststore.get_value (iter, ControlPanel.TachoMotorsColumn.PRESENT, out present); - tacho_motors_liststore.get_value (iter, ControlPanel.TachoMotorsColumn.RUNNING, out running); - if (!present.get_boolean ()) { - window.close (); - var dialog = new MessageDialog ("Motor Removed", - "motor %s at %s is no longer connected.".printf (driver_name.get_string (), - address.get_string ())); - dialog.show (); - return; - } - if (window.running != running.get_boolean ()) { - window.running = running.get_boolean (); - } - }); - var watch_values_handler_id = window.watch_values_selected.connect (() => { - var dialog = new MotorValueDialog (); - // TODO: make this value adjustable in UI instead of using Timeout - var value = 0; - var timeout_id = Timeout.add (500, () => { - dialog.value_text = "%d deg".printf (value++); - return Source.CONTINUE; - }); - dialog.closed.connect (() => Source.remove (timeout_id)); - dialog.show (); - }); - ulong closed_handler_id = 0; - closed_handler_id = window.closed.connect (() => { - tacho_motors_liststore.disconnect (row_changed_handler_id); - window.disconnect (watch_values_handler_id); - window.disconnect (closed_handler_id); - }); - tacho_motors_liststore.row_changed (path, iter); - window.show (); - }); - return false; - }); - tacho_motors_liststore.row_changed.connect ((path, iter) => { - Value present; - tacho_motors_liststore.get_value (iter, ControlPanel.TachoMotorsColumn.PRESENT, out present); - Value driver_name; - tacho_motors_liststore.get_value (iter, ControlPanel.TachoMotorsColumn.DRIVER_NAME, out driver_name); - Value address; - tacho_motors_liststore.get_value (iter, ControlPanel.TachoMotorsColumn.ADDRESS, out address); - Value user_data; - tacho_motors_liststore.get_value (iter, ControlPanel.TachoMotorsColumn.USER_DATA, out user_data); - var menu_item = (Ui.MenuItem)user_data.get_pointer (); - if (motor_browser_window.menu.has_menu_item (menu_item) && !present.get_boolean ()) - motor_browser_window.menu.remove_menu_item (menu_item); - else if (!motor_browser_window.menu.has_menu_item (menu_item) && present.get_boolean ()) - motor_browser_window.menu.add_menu_item (menu_item); - menu_item.label.text = "%s at %s".printf (driver_name.get_string (), - address.get_string ()); - }); - (builder.get_object ("tacho-motor-present-cellrenderertoggle") as Gtk.CellRendererToggle) - .toggled.connect ((toggle, path) => ControlPanel.update_listview_toggle_item ( - tacho_motors_liststore, toggle, path, ControlPanel.TachoMotorsColumn.PRESENT)); - (builder.get_object ("tacho-motor-device-name-cellrenderertext") as Gtk.CellRendererText) - .edited.connect ((path, new_text) => ControlPanel.update_listview_text_item ( - tacho_motors_liststore, path, new_text, ControlPanel.TachoMotorsColumn.DEVICE_NAME)); - (builder.get_object ("tacho-motor-address-cellrenderertext") as Gtk.CellRendererText) - .edited.connect ((path, new_text) => ControlPanel.update_listview_text_item ( - tacho_motors_liststore, path, new_text, ControlPanel.TachoMotorsColumn.ADDRESS)); - (builder.get_object ("tacho-motor-driver-name-cellrenderertext") as Gtk.CellRendererText) - .edited.connect ((path, new_text) => ControlPanel.update_listview_text_item ( - tacho_motors_liststore, path, new_text, ControlPanel.TachoMotorsColumn.DRIVER_NAME)); - (builder.get_object ("tacho-motor-polarity-cellrenderertoggle") as Gtk.CellRendererToggle) - .toggled.connect ((toggle, path) => ControlPanel.update_listview_toggle_item ( - tacho_motors_liststore, toggle, path, ControlPanel.TachoMotorsColumn.POLARITY)); - (builder.get_object ("tacho-motor-running-cellrenderertoggle") as Gtk.CellRendererToggle) - .toggled.connect ((toggle, path) => ControlPanel.update_listview_toggle_item ( - tacho_motors_liststore, toggle, path, ControlPanel.TachoMotorsColumn.RUNNING)); - } - - public void show_main_window () { - device_browser_window.show (); - } - } -} diff --git a/test/controller/FakeFileBrowserController.vala b/test/controller/FakeFileBrowserController.vala deleted file mode 100644 index 2d496ec..0000000 --- a/test/controller/FakeFileBrowserController.vala +++ /dev/null @@ -1,169 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright 2015 David Lechner - * - * 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 2 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -/* FakeFileBrowserController.vala - File Browser controller for testing */ - -using Ev3devKit; -using Ev3devKit.Ui; - -namespace BrickManager { - public class FakeFileBrowserController : Object, IBrickManagerModule { - const string PARENT_DIRECTORY_TEXT = "../"; - const string INITAL_DIRECTORY = "/home"; - const string file_attrs = FileAttribute.STANDARD_IS_HIDDEN - + "," + FileAttribute.STANDARD_TYPE - + "," + FileAttribute.OWNER_USER - + "," + FileAttribute.UNIX_MODE; - - FileBrowserWindow file_browser_window; - FileMonitor? monitor; - File initial_directory; - - public string display_name { get { return "File Browser"; } } - - public FakeFileBrowserController (Gtk.Builder builder) { - file_browser_window = new FileBrowserWindow (display_name) { - sort_files_func = sort_files - }; - file_browser_window.file_selected.connect ((file) => { - try { - var file_info = file.query_info (file_attrs, - FileQueryInfoFlags.NOFOLLOW_SYMLINKS); - var mode = file_info.get_attribute_uint32 (FileAttribute.UNIX_MODE); - if (file_info.get_file_type () == FileType.DIRECTORY) { - set_directory.begin (file, (obj, res) => { - try { - set_directory.end (res); - } catch (Error err) { - var dialog = new MessageDialog ("Error", err.message); - dialog.show (); - } - }); - } else if ((mode & Posix.S_IXUSR) == Posix.S_IXUSR) { - try { - string[] args = { file.get_path () }; - string[] env = Environ.get (); - Pid pid; - Process.spawn_async (null, args, env, SpawnFlags.DO_NOT_REAP_CHILD, null, out pid); - ChildWatch.add (pid, (p, s) => { - Process.close_pid (p); - message ("child process done."); - }); - } catch (SpawnError err) { - var dialog = new MessageDialog ("Error", err.message); - dialog.show (); - } - } else { - var dialog = new MessageDialog (file.get_basename (), - "This file is not a directory or an executable."); - dialog.show (); - } - } catch (Error err) { - var dialog = new MessageDialog ("Error", err.message); - dialog.show (); - } - }); - initial_directory = File.new_for_path (INITAL_DIRECTORY); - file_browser_window.file_selected (initial_directory); - } - - public void show_main_window () { - file_browser_window.show (); - } - - async void set_directory (File directory) throws Error { - file_browser_window.loading = true; - file_browser_window.clear_files (); - if (monitor != null) - monitor.cancel (); - monitor = directory.monitor_directory (FileMonitorFlags.NONE); - monitor.changed.connect ((src, dest, event) => { - switch (event) { - case FileMonitorEvent.CREATED: - try { - var file_info = src.query_info (file_attrs, - FileQueryInfoFlags.NOFOLLOW_SYMLINKS); - - // don't show hidden files - if (file_info.get_is_hidden ()) - break; - - var file_name = src.get_basename (); - var mode = file_info.get_attribute_uint32 (FileAttribute.UNIX_MODE); - if (file_info.get_file_type () == FileType.DIRECTORY) { - // add '/' to the end of directories - file_name += "/"; - } else if ((mode & Posix.S_IXUSR) == Posix.S_IXUSR) { - // add '*' to the end of executable files - file_name += "*"; - } - - file_browser_window.add_file (file_name, src); - } catch (Error err) { - critical ("%s", err.message); - } - break; - case FileMonitorEvent.DELETED: - file_browser_window.remove_file (src); - break; - } - }); - file_browser_window.current_directory = directory.get_path (); - // limit the browser to children of the inital directory - if (!directory.equal (initial_directory)) { - var parent = directory.get_parent (); - if (parent != null) - file_browser_window.add_file (PARENT_DIRECTORY_TEXT, parent); - } - var enumerator = yield directory.enumerate_children_async ("", - FileQueryInfoFlags.NOFOLLOW_SYMLINKS); - FileInfo info; - // TODO: use next_files_async () instead? - while ((info = enumerator.next_file ()) != null) { - monitor.changed (enumerator.get_child (info), null, - FileMonitorEvent.CREATED); - } - file_browser_window.loading = false; - } - - static int sort_files (Ui.MenuItem a, Ui.MenuItem b) { - var a_text = a.label.text; - var b_text = b.label.text; - - // parent directory text goes first - if (a_text == PARENT_DIRECTORY_TEXT) - return -1; - if (b_text == PARENT_DIRECTORY_TEXT) - return 1; - - // then directories - var a_last_char = a_text[a_text.length -1]; - var b_last_char = b_text[b_text.length -1]; - if (a_last_char == '/' && b_last_char != '/') - return -1; - if (a_last_char != '/' && b_last_char == '/') - return 1; - - // then everything else - return strcmp (a_text, b_text); - } - } -} \ No newline at end of file diff --git a/test/controller/FakeNetworkController.vala b/test/controller/FakeNetworkController.vala deleted file mode 100644 index 56c6efd..0000000 --- a/test/controller/FakeNetworkController.vala +++ /dev/null @@ -1,702 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright 2014-2016 David Lechner - * - * 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 2 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -/* FakeConnmanController.vala - Fake Network (ConnMan) controller for testing */ - -using Ev3devKit.Ui; - -namespace BrickManager { - public class FakeNetworkController : Object, IBrickManagerModule { - const string CONNMAN_SERVICE_IPV4_DIALOG_GLADE_FILE = "ConnmanServiceIPv4Dialog.glade"; - const string CONNMAN_AGENT_REQUEST_INPUT_DIALOG_GLADE_FILE = "ConnmanAgentRequestInputDialog.glade"; - - NetworkStatusWindow network_status_window; - NetworkConnectionsWindow network_connections_window; - public NetworkStatusBarItem network_status_bar_item; - public WifiStatusBarItem wifi_status_bar_item; - public WifiController wifi_controller; - ConnmanAgent agent; - Gtk.Dialog? agent_request_input_dialog; - Gtk.ListStore network_connections_liststore; - - public class WifiController : Object, IBrickManagerModule { - public WifiWindow wifi_window; - - public string display_name { get { return wifi_window.title; } } - - public void show_main_window () { - wifi_window.show (); - } - } - - public string display_name { get { return "Wireless and Networks"; } } - - public FakeNetworkController (Gtk.Builder builder) throws Error { - - var control_panel_notebook = builder.get_object ("control-panel-notebook") as Gtk.Notebook; - var network_notebook = builder.get_object ("network-notebook") as Gtk.Notebook; - var networking_loading_checkbutton = builder.get_object ("networking-loading-checkbutton") as Gtk.CheckButton; - var networking_available_checkbutton = builder.get_object ("networking-available-checkbutton") as Gtk.CheckButton; - - /* NetworkStatusBarItem */ - - network_status_bar_item = new NetworkStatusBarItem (); - (builder.get_object ("network-status-bar-entry") as Gtk.Entry) - .bind_property ("text", network_status_bar_item, "text", BindingFlags.SYNC_CREATE); - - /* NetworkStatusWindow */ - - network_status_window = new NetworkStatusWindow (display_name); - network_status_window.shown.connect (() => { - control_panel_notebook.page = (int)ControlPanel.Tab.NETWORK; - network_notebook.page = (int)ControlPanel.NetworkNotebookTab.MAIN; - }); - - networking_loading_checkbutton.bind_property ("active", network_status_window, "loading", BindingFlags.SYNC_CREATE); - networking_available_checkbutton.bind_property ("active", network_status_window, "available", BindingFlags.SYNC_CREATE); - (builder.get_object ("connman-offline-mode-checkbutton") as Gtk.CheckButton) - .bind_property ("active", network_status_window, "offline-mode", - BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); - ((builder.get_object ("connman-state-comboboxtext") as Gtk.ComboBoxText).get_child () as Gtk.Entry) - .bind_property ("text", network_status_window, "state", BindingFlags.SYNC_CREATE); - - /* NetworkConnectionsWindow */ - - network_connections_window = new NetworkConnectionsWindow (); - networking_loading_checkbutton.bind_property ("active", network_connections_window, "loading", BindingFlags.SYNC_CREATE); - networking_available_checkbutton.bind_property ("active", network_connections_window, "available", BindingFlags.SYNC_CREATE); - - network_status_window.network_connections_selected.connect (() => - network_connections_window.show ()); - network_connections_window.shown.connect (() => { - control_panel_notebook.page = (int)ControlPanel.Tab.NETWORK; - network_notebook.page = (int)ControlPanel.NetworkNotebookTab.CONNECTIONS; - }); - - network_connections_liststore = builder.get_object ("network-connections-liststore") as Gtk.ListStore; - network_connections_liststore.row_changed.connect ((path, iter) => { - Value present; - network_connections_liststore.get_value (iter, ControlPanel.NetworkConnectionsColumn.PRESENT, out present); - Value connected; - network_connections_liststore.get_value (iter, ControlPanel.NetworkConnectionsColumn.CONNECTED, out connected); - Value name; - network_connections_liststore.get_value (iter, ControlPanel.NetworkConnectionsColumn.NAME, out name); - Value type; - network_connections_liststore.get_value (iter, ControlPanel.NetworkConnectionsColumn.TYPE, out type); - Value user_data; - network_connections_liststore.get_value (iter, ControlPanel.NetworkConnectionsColumn.USER_DATA, out user_data); - var menu_item = (NetworkConnectionMenuItem?)user_data.get_pointer (); - if (present.get_boolean () && menu_item == null) { - var icon_file = (type.get_string () ?? "wifi").replace ("gadget", "usb") + "12x12.png"; - menu_item = new NetworkConnectionMenuItem (icon_file); - menu_item.button.pressed.connect (() => { - - /* NetworkConnectionWindow */ - - var network_connection_info_window = new NetworkConnectionWindow (menu_item.connection_name); - network_connection_info_window.shown.connect (() => { - control_panel_notebook.page = (int)ControlPanel.Tab.NETWORK; - network_notebook.page = (int)ControlPanel.NetworkNotebookTab.CONNECTION_INFO; - }); - ((builder.get_object ("network-connection-info-state-comboboxtext") as Gtk.ComboBoxText).get_child () as Gtk.Entry) - .bind_property ("text", network_connection_info_window, "state", BindingFlags.SYNC_CREATE); - (builder.get_object ("network-connection-info-is-connected-checkbutton") as Gtk.CheckButton) - .bind_property ("active", network_connection_info_window, "is-connected", BindingFlags.SYNC_CREATE); - (builder.get_object ("network-connection-info-is-busy-checkbutton") as Gtk.CheckButton) - .bind_property ("active", network_connection_info_window, "is-connect-busy", BindingFlags.SYNC_CREATE); - (builder.get_object ("network-connection-info-auto-connect-checkbutton") as Gtk.CheckButton) - .bind_property ("active", network_connection_info_window, "auto-connect", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); - - /* NetworkConnectionIpv4Window */ - - network_connection_info_window.ipv4_button_pressed.connect (() => { - var ipv4_window = new NetworkConnectionIpv4Window (menu_item.connection_name); - (builder.get_object ("network-connection-info-method-entry") as Gtk.Entry) - .bind_property ("text", ipv4_window, "method", BindingFlags.SYNC_CREATE); - (builder.get_object ("network-connection-info-address-entry") as Gtk.Entry) - .bind_property ("text", ipv4_window, "address", BindingFlags.SYNC_CREATE); - (builder.get_object ("network-connection-info-netmask-entry") as Gtk.Entry) - .bind_property ("text", ipv4_window, "netmask", BindingFlags.SYNC_CREATE); - (builder.get_object ("network-connection-info-gateway-entry") as Gtk.Entry) - .bind_property ("text", ipv4_window, "gateway", BindingFlags.SYNC_CREATE); - ipv4_window.show (); - }); - - /* NetworkConnectionDnsWindow */ - - network_connection_info_window.dns_button_pressed.connect (() => { - var dns_window = new NetworkConnectionDnsWindow (menu_item.connection_name); - (builder.get_object ("network-connection-info-dns-textbuffer") as Gtk.TextBuffer) - .bind_property ("text", dns_window, "addresses", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL, - transform_string_to_strv, transform_strv_to_string); - dns_window.show (); - }); - - /* NetworkConnectionEnetWindow */ - - network_connection_info_window.enet_button_pressed.connect (() => { - var enet_window = new NetworkConnectionEnetWindow (menu_item.connection_name); - (builder.get_object ("network-connection-info-enet-method-entry") as Gtk.Entry) - .bind_property ("text", enet_window, "method", BindingFlags.SYNC_CREATE); - (builder.get_object ("network-connection-info-enet-iface-entry") as Gtk.Entry) - .bind_property ("text", enet_window, "interface", BindingFlags.SYNC_CREATE); - (builder.get_object ("network-connection-info-enet-mac-entry") as Gtk.Entry) - .bind_property ("text", enet_window, "address", BindingFlags.SYNC_CREATE); - (builder.get_object ("network-connection-info-enet-mtu-spinbutton") as Gtk.SpinButton) - .bind_property ("value", enet_window, "mtu", BindingFlags.SYNC_CREATE); - enet_window.show (); - }); - - network_connection_info_window.show (); - }); - - network_connections_window.menu.add_menu_item (menu_item); - network_connections_liststore.set_value (iter, ControlPanel.NetworkConnectionsColumn.USER_DATA, (void*)menu_item); - } - if (!present.get_boolean () && menu_item != null) { - network_connections_window.menu.remove_menu_item (menu_item); - network_connections_liststore.set_value (iter, ControlPanel.NetworkConnectionsColumn.USER_DATA, (void*)null); - menu_item = null; - } - if (menu_item == null) - return; - if (menu_item.connected != connected.get_boolean ()) - menu_item.connected = connected.get_boolean (); - if (menu_item.connection_name != name.get_string ()) - menu_item.connection_name = name.dup_string (); - }); - network_connections_liststore.foreach ((model, path, iter) => { - model.row_changed (path, iter); - return false; - }); - - (builder.get_object ("network-connections-add-button") as Gtk.Button).clicked.connect (() => { - Gtk.TreeIter iter; - network_connections_liststore.append (out iter); - network_connections_liststore.set_value (iter, ControlPanel.NetworkConnectionsColumn.PRESENT, true); - network_connections_liststore.set_value (iter, ControlPanel.NetworkConnectionsColumn.CONNECTED, false); - network_connections_liststore.set_value (iter, ControlPanel.NetworkConnectionsColumn.NAME, "New Connection"); - network_connections_liststore.set_value (iter, ControlPanel.NetworkConnectionsColumn.TYPE, "wifi"); - network_connections_liststore.row_changed (network_connections_liststore.get_path (iter), iter); - }); - var network_connections_remove_button = builder.get_object ("network-connections-remove-button") as Gtk.Button; - var network_connections_treeview_selection = (builder.get_object ("network-connections-treeview") as Gtk.TreeView).get_selection (); - network_connections_remove_button.clicked.connect (() => { - Gtk.TreeModel model; - Gtk.TreeIter iter; - if (network_connections_treeview_selection.get_selected (out model, out iter)) { - Value user_data; - model.get_value (iter, ControlPanel.NetworkConnectionsColumn.USER_DATA, out user_data); - var menu_item = (NetworkConnectionMenuItem?)user_data.get_pointer (); - if (menu_item != null) - network_connections_window.menu.remove_menu_item (menu_item); - network_connections_liststore.remove (iter); - } - }); - network_connections_treeview_selection.changed.connect (() => { - network_connections_remove_button.sensitive = network_connections_treeview_selection.count_selected_rows () > 0; - }); - network_connections_treeview_selection.changed (); - - (builder.get_object ("network-connections-present-cellrenderertoggle") as Gtk.CellRendererToggle) - .toggled.connect ((toggle, path) => ControlPanel.update_listview_toggle_item ( - network_connections_liststore, toggle, path, ControlPanel.NetworkConnectionsColumn.PRESENT)); - (builder.get_object ("network-connections-connected-cellrenderertoggle") as Gtk.CellRendererToggle) - .toggled.connect ((toggle, path) => ControlPanel.update_listview_toggle_item ( - network_connections_liststore, toggle, path, ControlPanel.NetworkConnectionsColumn.CONNECTED)); - (builder.get_object ("network-connections-name-cellrenderertext") as Gtk.CellRendererText) - .edited.connect ((path, new_text) => ControlPanel.update_listview_text_item ( - network_connections_liststore, path, new_text, ControlPanel.NetworkConnectionsColumn.NAME)); - (builder.get_object ("network-connections-type-cellrenderercombo") as Gtk.CellRendererCombo) - .edited.connect ((path, new_text) => ControlPanel.update_listview_text_item ( - network_connections_liststore, path, new_text, ControlPanel.NetworkConnectionsColumn.TYPE)); - - /* WifiWindow */ - - var wifi_window = new WifiWindow (); - - networking_loading_checkbutton.bind_property ("active", wifi_window, "loading", BindingFlags.SYNC_CREATE); - networking_available_checkbutton.bind_property ("active", wifi_window, "available", BindingFlags.SYNC_CREATE); - - wifi_controller = new WifiController (); - wifi_controller.wifi_window = wifi_window; - - wifi_window.shown.connect (() => { - control_panel_notebook.page = (int)ControlPanel.Tab.NETWORK; - network_notebook.page = (int)ControlPanel.NetworkNotebookTab.WIFI; - }); - - (builder.get_object ("network-wifi-powered-checkbutton") as Gtk.CheckButton) - .bind_property ("active", wifi_window, "powered", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); - (builder.get_object ("network-wifi-scanning-checkbutton") as Gtk.CheckButton) - .bind_property ("active", wifi_window, "scanning", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); - wifi_window.scan_selected.connect (() => wifi_window.scanning = !wifi_window.scanning); - - var wifi_liststore = builder.get_object ("network-wifi-liststore") as Gtk.ListStore; - wifi_liststore.row_changed.connect ((path, iter) => { - Value present; - wifi_liststore.get_value (iter, ControlPanel.NetworkWifiColumn.PRESENT, out present); - Value connected; - wifi_liststore.get_value (iter, ControlPanel.NetworkWifiColumn.CONNECTED, out connected); - Value name; - wifi_liststore.get_value (iter, ControlPanel.NetworkWifiColumn.NAME, out name); - Value security; - wifi_liststore.get_value (iter, ControlPanel.NetworkWifiColumn.SECURITY, out security); - Value strength; - wifi_liststore.get_value (iter, ControlPanel.NetworkWifiColumn.STRENGTH, out strength); - Value user_data; - wifi_liststore.get_value (iter, ControlPanel.NetworkWifiColumn.USER_DATA, out user_data); - var menu_item = (WifiMenuItem?)user_data.get_pointer (); - if (present.get_boolean () && menu_item == null) { - menu_item = new WifiMenuItem (); - menu_item.button.pressed.connect (() => { - - /* WifiNetworkWindow */ - - var wifi_info_window = new WifiNetworkWindow (name.dup_string ()); - wifi_info_window.shown.connect (() => { - control_panel_notebook.page = (int)ControlPanel.Tab.NETWORK; - network_notebook.page = (int)ControlPanel.NetworkNotebookTab.WIFI_INFO; - }); - - ((builder.get_object ("network-wifi-info-status-comboboxtext") as Gtk.ComboBoxText).get_child () as Gtk.Entry) - .bind_property ("text", wifi_info_window, "status", BindingFlags.SYNC_CREATE); - ((builder.get_object ("network-wifi-info-action-comboboxtext") as Gtk.ComboBoxText).get_child () as Gtk.Entry) - .bind_property ("text", wifi_info_window, "action", BindingFlags.SYNC_CREATE); - var can_forget_checkbutton = builder.get_object ("network-wifi-info-can-forget-checkbutton") as Gtk.CheckButton; - can_forget_checkbutton.active = connected.get_boolean (); - can_forget_checkbutton.bind_property ("active", wifi_info_window, "can-forget", BindingFlags.SYNC_CREATE); - - wifi_info_window.status_selected.connect (() => { - - /* WifiNetworkStatusWindow */ - - var wifi_network_status_window = new WifiNetworkStatusWindow (name.dup_string ()); - - ((builder.get_object ("network-wifi-info-status-comboboxtext") as Gtk.ComboBoxText).get_child () as Gtk.Entry) - .bind_property ("text", wifi_network_status_window, "status", BindingFlags.SYNC_CREATE); - ((builder.get_object ("network-wifi-info-security-comboboxtext") as Gtk.ComboBoxText).get_child () as Gtk.Entry) - .bind_property ("text", wifi_network_status_window, "security", BindingFlags.SYNC_CREATE); - var signal_spinbutton = builder.get_object ("network-wifi-info-signal-spinbutton") as Gtk.SpinButton; - signal_spinbutton.text = strength.dup_string (); - signal_spinbutton.bind_property ("text", wifi_network_status_window, "signal-strength", BindingFlags.SYNC_CREATE); - (builder.get_object ("network-wifi-info-address-entry") as Gtk.Entry) - .bind_property ("text", wifi_network_status_window, "address", BindingFlags.SYNC_CREATE); - - wifi_network_status_window.show (); - }); - wifi_info_window.action_selected.connect (() => message ("action selected")); - wifi_info_window.forget_selected.connect (() => can_forget_checkbutton.active = false); - wifi_info_window.network_connection_selected.connect (() => message ("network connection selected")); - - wifi_info_window.show (); - }); - wifi_window.add_menu_item (menu_item); - wifi_liststore.set_value (iter, ControlPanel.NetworkWifiColumn.USER_DATA, (void*)menu_item); - } - if (!present.get_boolean () && menu_item != null) { - wifi_window.remove_menu_item (menu_item); - wifi_liststore.set_value (iter, ControlPanel.NetworkWifiColumn.USER_DATA, (void*)null); - menu_item = null; - } - if (menu_item == null) - return; - if (menu_item.connected != connected.get_boolean ()) - menu_item.connected = connected.get_boolean (); - if (menu_item.connection_name != name.get_string ()) - menu_item.connection_name = name.dup_string (); - if (menu_item.security.to_string () != security.get_string ()) { - var new_security = (WifiSecurity) 0; - if (security.get_string () != null) { - var enum_class = (EnumClass) typeof (WifiSecurity).class_ref (); - var enum_value = enum_class.get_value_by_nick (security.get_string ()); - if (enum_value != null) { - new_security = (WifiSecurity) enum_value.value; - } - } - menu_item.security = new_security; - } - if (menu_item.signal_strength != int.parse (strength.get_string () ?? "0")) - menu_item.signal_strength = int.parse (strength.get_string () ?? "0"); - }); - wifi_liststore.foreach ((model, path, iter) => { - model.row_changed (path, iter); - return false; - }); - - (builder.get_object ("network-wifi-add-button") as Gtk.Button).clicked.connect (() => { - Gtk.TreeIter iter; - wifi_liststore.append (out iter); - wifi_liststore.set_value (iter, ControlPanel.NetworkWifiColumn.PRESENT, true); - wifi_liststore.set_value (iter, ControlPanel.NetworkWifiColumn.NAME, "New Network"); - wifi_liststore.set_value (iter, ControlPanel.NetworkWifiColumn.SECURITY, "secured"); - wifi_liststore.set_value (iter, ControlPanel.NetworkWifiColumn.STRENGTH, "99"); - wifi_liststore.row_changed (wifi_liststore.get_path (iter), iter); - }); - var network_wifi_remove_button = builder.get_object ("network-wifi-remove-button") as Gtk.Button; - var network_wifi_treeview_selection = (builder.get_object ("network-wifi-treeview") as Gtk.TreeView).get_selection (); - network_wifi_remove_button.clicked.connect (() => { - Gtk.TreeModel model; - Gtk.TreeIter iter; - if (network_wifi_treeview_selection.get_selected (out model, out iter)) { - Value user_data; - model.get_value (iter, ControlPanel.NetworkWifiColumn.USER_DATA, out user_data); - var menu_item = (NetworkConnectionMenuItem?)user_data.get_pointer (); - if (menu_item != null) - wifi_window.remove_menu_item (menu_item); - wifi_liststore.remove (iter); - } - }); - network_wifi_treeview_selection.changed.connect (() => { - network_wifi_remove_button.sensitive = network_wifi_treeview_selection.count_selected_rows () > 0; - }); - network_wifi_treeview_selection.changed (); - - (builder.get_object ("network-wifi-present-cellrenderertoggle") as Gtk.CellRendererToggle) - .toggled.connect ((toggle, path) => ControlPanel.update_listview_toggle_item ( - wifi_liststore, toggle, path, ControlPanel.NetworkWifiColumn.PRESENT)); - (builder.get_object ("network-wifi-connected-cellrenderertoggle") as Gtk.CellRendererToggle) - .toggled.connect ((toggle, path) => ControlPanel.update_listview_toggle_item ( - wifi_liststore, toggle, path, ControlPanel.NetworkWifiColumn.CONNECTED)); - (builder.get_object ("network-wifi-name-cellrenderertext") as Gtk.CellRendererText) - .edited.connect ((path, new_text) => ControlPanel.update_listview_text_item ( - wifi_liststore, path, new_text, ControlPanel.NetworkWifiColumn.NAME)); - (builder.get_object ("network-wifi-security-cellrenderercombo") as Gtk.CellRendererCombo) - .edited.connect ((path, new_text) => ControlPanel.update_listview_text_item ( - wifi_liststore, path, new_text, ControlPanel.NetworkWifiColumn.SECURITY)); - (builder.get_object ("network-wifi-strength-cellrendererspin") as Gtk.CellRendererSpin) - .edited.connect ((path, new_text) => ControlPanel.update_listview_text_item ( - wifi_liststore, path, new_text, ControlPanel.NetworkWifiColumn.STRENGTH)); - - /* TetheringWindow */ - - var network_tether_liststore = builder.get_object ("network-tether-liststore") as Gtk.ListStore; - var network_tether_ipv4_address_entry = builder.get_object ("network-tether-ipv4-address-entry") as Gtk.Entry; - var network_tether_ipv4_netmask_entry = builder.get_object ("network-tether-ipv4-netmask-entry") as Gtk.Entry; - var network_tether_enet_iface_entry = builder.get_object ("network-tether-enet-iface-entry") as Gtk.Entry; - var network_tether_enet_mac_entry = builder.get_object ("network-tether-enet-mac-entry") as Gtk.Entry; - network_status_window.tethering_selected.connect (() => { - var tethering_window = new TetheringWindow (); - weak TetheringWindow weak_tethering_window = tethering_window; - networking_loading_checkbutton.bind_property ("active", tethering_window, "loading", BindingFlags.SYNC_CREATE); - networking_available_checkbutton.bind_property ("active", tethering_window, "available", BindingFlags.SYNC_CREATE); - tethering_window.shown.connect (() => { - control_panel_notebook.page = (int)ControlPanel.Tab.NETWORK; - network_notebook.page = (int)ControlPanel.NetworkNotebookTab.TETHERING; - }); - var handler_id = network_tether_liststore.row_changed.connect ((path, iter) => { - Value present; - network_tether_liststore.get_value (iter, ControlPanel.NetworkTetherColumn.PRESENT, out present); - Value name; - network_tether_liststore.get_value (iter, ControlPanel.NetworkTetherColumn.NAME, out name); - Value enabled; - network_tether_liststore.get_value (iter, ControlPanel.NetworkTetherColumn.ENABLED, out enabled); - Value user_data; - network_tether_liststore.get_value (iter, ControlPanel.NetworkTetherColumn.USER_DATA, out user_data); - var menu_item = (CheckboxMenuItem?)user_data.get_pointer (); - if (present.get_boolean () && menu_item == null) { - menu_item = weak_tethering_window.add_menu_item (name.dup_string ()); - weak CheckboxMenuItem weak_menu_item = menu_item; - menu_item.checkbox.notify["checked"].connect (() => - network_tether_liststore.set_value (iter, ControlPanel.NetworkTetherColumn.ENABLED, weak_menu_item.checkbox.checked)); - network_tether_liststore.set_value (iter, ControlPanel.NetworkTetherColumn.USER_DATA, (void*)menu_item); - } - if (!present.get_boolean () && menu_item != null) { - weak_tethering_window.remove_menu_item (menu_item); - network_tether_liststore.set_value (iter, ControlPanel.NetworkTetherColumn.USER_DATA, (void*)null); - menu_item = null; - } - if (menu_item == null) - return; - if (menu_item.checkbox.checked != enabled.get_boolean ()) - menu_item.checkbox.checked = enabled.get_boolean (); - }); - network_tether_liststore.foreach ((model, path, iter) => { - model.row_changed (path, iter); - return false; - }); - tethering_window.weak_ref (() => { - network_tether_liststore.disconnect (handler_id); - network_tether_liststore.foreach ((model, path, iter) => { - network_tether_liststore.set_value (iter, ControlPanel.NetworkTetherColumn.USER_DATA, (void*)null); - return false; - }); - }); - - /* TetheringInfoWindow */ - - tethering_window.tethering_info_selected.connect (() => { - var tethering_info_window = new TetheringInfoWindow (); - networking_loading_checkbutton.bind_property ("active", tethering_info_window, "loading", BindingFlags.SYNC_CREATE); - networking_available_checkbutton.bind_property ("active", tethering_info_window, "available", BindingFlags.SYNC_CREATE); - network_tether_ipv4_address_entry.bind_property ("text", tethering_info_window, "ipv4-address", BindingFlags.SYNC_CREATE); - network_tether_ipv4_netmask_entry.bind_property ("text", tethering_info_window, "ipv4-netmask", BindingFlags.SYNC_CREATE); - network_tether_enet_iface_entry.bind_property ("text", tethering_info_window, "enet-iface", BindingFlags.SYNC_CREATE); - network_tether_enet_mac_entry.bind_property ("text", tethering_info_window, "enet-mac", BindingFlags.SYNC_CREATE); - tethering_info_window.show (); - }); - - tethering_window.show (); - }); - (builder.get_object ("network-tether-present-cellrenderertoggle") as Gtk.CellRendererToggle) - .toggled.connect ((toggle, path) => ControlPanel.update_listview_toggle_item ( - network_tether_liststore, toggle, path, ControlPanel.NetworkTetherColumn.PRESENT)); - (builder.get_object ("network-tether-enabled-cellrenderertoggle") as Gtk.CellRendererToggle) - .toggled.connect ((toggle, path) => ControlPanel.update_listview_toggle_item ( - network_tether_liststore, toggle, path, ControlPanel.NetworkTetherColumn.ENABLED)); - - /* WifiStatusBarItem */ - - wifi_status_bar_item = new WifiStatusBarItem (); - (builder.get_object ("network-status-bar-wifi-powered-checkbutton") as Gtk.CheckButton) - .bind_property("active", wifi_status_bar_item, "visible", BindingFlags.SYNC_CREATE); - (builder.get_object ("network-status-bar-wifi-connected-checkbutton") as Gtk.CheckButton) - .bind_property("active", wifi_status_bar_item, "connected", BindingFlags.SYNC_CREATE); - - /* Agent */ - - agent = new ConnmanAgent (); - agent.manager = new Connman.Manager (); - // (builder.get_object ("connman_agent_release_button") as Gtk.Button) - // .clicked.connect (() => agent.release ()); - (builder.get_object ("connman_agent_report_error_button") as Gtk.Button) - .clicked.connect (() => { - agent.report_error.begin (new ObjectPath ("/service/path"), - "Service error message.", (obj, res) => { - try { - agent.report_error.end (res); - } catch (ConnmanAgentError err) { - show_message (err.message); - } - }); - }); - (builder.get_object ("connman_agent_report_peer_error_button") as Gtk.Button) - .clicked.connect (() => { - agent.report_peer_error.begin (new ObjectPath ("/peer/path"), - "Peer error message.", (obj, res) => { - try { - agent.report_peer_error.end (res); - } catch (ConnmanAgentError err) { - show_message (err.message); - } - }); - }); - (builder.get_object ("connman_agent_request_browser_button") as Gtk.Button) - .clicked.connect (() => { - agent.request_browser.begin (new ObjectPath ("/service/path"), - "http://www.ev3dev.org", (obj, res) => { - try { - agent.request_browser.end (res); - } catch (ConnmanAgentError err) { - show_message (err.message); - } - }); - }); - (builder.get_object ("connman_agent_request_input_button") as Gtk.Button) - .clicked.connect (on_show_agent_request_input_dialog); - (builder.get_object ("connman_agent_request_peer_authorization_button") as Gtk.Button) - .clicked.connect (() => { - agent.request_peer_authorization.begin (new ObjectPath ("/peer/path"), - new HashTable (null, null), (obj, res) => { - try { - var result = agent.request_peer_authorization.end (res); - var strbuilder = new StringBuilder ("Results (%u):".printf (result.size ())); - result.foreach ((k, v) => - strbuilder.append ("\n%s: %s".printf (k, v.print (true)))); - show_message (strbuilder.str); - } catch (ConnmanAgentError err) { - show_message (err.message); - } - }); - }); - (builder.get_object ("connman_agent_cancel_button") as Gtk.Button) - .clicked.connect (() => agent.cancel.begin ()); - } - - public void show_main_window () { - network_status_window.show (); - } - - public void add_controller (IBrickManagerModule controller) { - network_status_window.add_technology_controller (controller); - } - - public void show_connection (string name) { - var match_found = false; - network_connections_liststore.foreach ((model, path, iter) => { - Value net_name; - model.get_value (iter, ControlPanel.NetworkConnectionsColumn.NAME, out net_name); - if (net_name.get_string () == name) { - Value user_data; - model.get_value (iter, ControlPanel.NetworkConnectionsColumn.USER_DATA, out user_data); - var menu_item = (NetworkConnectionMenuItem)user_data.get_pointer (); - menu_item.button.pressed (); - match_found = true; - } - return match_found; - }); - if (!match_found) - message ("Could not find a network connection named '%s'", name); - } - - bool transform_string_to_strv (Binding binding, Value source, ref Value target) { - target = source.get_string ().split ("\n"); - return true; - } - - bool transform_strv_to_string (Binding binding, Value source, ref Value target) { - target = string.join ("\n", (string[])source); - return true; - } - - void on_show_agent_request_input_dialog () { - if (agent_request_input_dialog == null) { - var builder = new Gtk.Builder (); - try { - builder.add_from_file (CONNMAN_AGENT_REQUEST_INPUT_DIALOG_GLADE_FILE); - agent_request_input_dialog = builder.get_object ("dialog") as Gtk.Dialog; - agent_request_input_dialog.set_transient_for (Gtk.Window.list_toplevels ().nth_data (0)); - agent_request_input_dialog.response.connect ((id) => { - agent_request_input_dialog.destroy (); - agent_request_input_dialog = null; - }); - unowned Gtk.Entry service_name_entry = builder.get_object ("service-name-entry") as Gtk.Entry; - (builder.get_object ("done_button") as Gtk.Button) - .clicked.connect (() => agent_request_input_dialog.response (0)); - (builder.get_object ("request_psk_passphrase_button") as Gtk.Button) - .clicked.connect (() => { - var paramaters = new HashTable (null, null); - var passphrase_args = new HashTable (null, null); - passphrase_args["Type"] = "psk"; - passphrase_args["Requirement"] = "mandatory"; - paramaters["Passphrase"] = passphrase_args; - var expected_result = new HashTable (null, null); - expected_result["Passphrase"] = "secret123"; - call_agent_request_input.begin (service_name_entry.text, paramaters, expected_result); - }); - (builder.get_object ("request_psk_passphrase_with_previous_button") as Gtk.Button) - .clicked.connect (() => { - var paramaters = new HashTable (null, null); - var passphrase_args = new HashTable (null, null); - passphrase_args["Type"] = "psk"; - passphrase_args["Requirement"] = "mandatory"; - paramaters["Passphrase"] = passphrase_args; - var prev_passphrase_args = new HashTable (null, null); - prev_passphrase_args["Type"] = "psk"; - prev_passphrase_args["Requirement"] = "informational"; - prev_passphrase_args["Value"] = "secret123"; - paramaters["PreviousPassphrase"] = prev_passphrase_args; - var expected_result = new HashTable (null, null); - expected_result["Passphrase"] = "anything-but-secret123"; - call_agent_request_input.begin (service_name_entry.text, paramaters, expected_result); - }); - (builder.get_object ("request_hiddend_ssid_button") as Gtk.Button) - .clicked.connect (() => { - var paramaters = new HashTable (null, null); - var name_args = new HashTable (null, null); - name_args["Type"] = "string"; - name_args["Requirement"] = "mandatory"; - name_args["Alternates"] = new string[] { "SSID" }; - paramaters["Name"] = name_args; - var ssid_args = new HashTable (null, null); - ssid_args["Type"] = "ssid"; - ssid_args["Requirement"] = "alternate"; - paramaters["SSID"] = ssid_args; - var passphrase_args = new HashTable (null, null); - passphrase_args["Type"] = "psk"; - passphrase_args["Requirement"] = "mandatory"; - paramaters["Passphrase"] = passphrase_args; - var expected_result = new HashTable (null, null); - expected_result["Name"] = "SSID"; - expected_result["Passphrase"] = "secret123"; - call_agent_request_input.begin (service_name_entry.text, paramaters, expected_result); - }); - } catch (Error err) { - critical ("%s", err.message); - } - } - agent_request_input_dialog.show (); - } - - async void call_agent_request_input (string service_name, - HashTable paramaters, - HashTable expected_result) - { - try { - var actual_result = yield agent.request_input (new ObjectPath (service_name), paramaters); - var builder = new StringBuilder (); - builder.append ("Expected result (%u):".printf (expected_result.size ())); - expected_result.foreach ((k, v) => - builder.append ("\n%s: %s".printf (k, v.print (true)))); - builder.append ("\n\n"); - builder.append ("Actual result (%u):".printf (actual_result.size ())); - actual_result.foreach ((k, v) => - builder.append ("\n%s: %s".printf (k, v.print (true)))); - show_message (builder.str); - } catch (ConnmanAgentError err) { - show_message (err.message); - } - } - - void show_message (string message) { - var dialog = new Gtk.MessageDialog (Gtk.Window.list_toplevels ().nth_data (0), - Gtk.DialogFlags.MODAL, Gtk.MessageType.INFO, Gtk.ButtonsType.OK, message); - dialog.response.connect ((id) => dialog.destroy ()); - dialog.show (); - } - - class NetworkService : Object { - public Gtk.TreeIter iter { get; private set; } - - public NetworkService (Gtk.TreeIter iter) { - this.iter = iter; - } - } - - class IPv4Info : Object { - public string method { get; set; } - public string address { get; set; } - public string netmask { get; set; } - public string gateway { get; set; } - - public IPv4Info () { - method = "dhcp"; - address = "192.168.3.33"; - netmask = "255.255.255.0"; - gateway = "192.168.3.1"; - } - } - - class EnetInfo : Object { - public string method { get; set; } - public string interface { get; set; } - public string address { get; set; } - public int mtu { get; set; } - - public EnetInfo () { - method = "auto"; - interface = "eth0"; - address = "00:AA:33:BB:55:CC"; - mtu = 1500; - } - } - } -} diff --git a/test/controller/FakeOpenRobertaController.vala b/test/controller/FakeOpenRobertaController.vala deleted file mode 100644 index 0580636..0000000 --- a/test/controller/FakeOpenRobertaController.vala +++ /dev/null @@ -1,104 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright 2015 Stefan Sauer - * Copyright 2015 David Lechner - * - * 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 2 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -/* FakeOpenRobertaController.vala - Fake OpenRoberta controller for testing */ - -using Ev3devKit.Ui; - -namespace BrickManager { - public class FakeOpenRobertaController : Object, IBrickManagerModule { - OpenRobertaWindow open_roberta_window; - Gtk.RadioButton disconnected_radio_button; - Gtk.RadioButton connected_radio_button; - - public OpenRobertaStatusBarItem status_bar_item; - - public bool available { get; set; default = false; } - - public string display_name { get { return "Open Roberta Lab"; } } - - public void show_main_window () { - open_roberta_window.show (); - } - - public FakeOpenRobertaController (Gtk.Builder builder) throws Error { - // TODO: defer window creation to show_main_window() - open_roberta_window = new OpenRobertaWindow (display_name); - status_bar_item = new OpenRobertaStatusBarItem (); - - bind_property ("available", status_bar_item, "visible", BindingFlags.SYNC_CREATE); - bind_property ("available", open_roberta_window, "available", BindingFlags.SYNC_CREATE); - - open_roberta_window.connect_selected.connect (on_server_connect); - open_roberta_window.disconnect_selected.connect (on_server_disconnect); - - var control_panel_notebook = builder.get_object ("control-panel-notebook") as Gtk.Notebook; - open_roberta_window.shown.connect (() => control_panel_notebook.page = (int)ControlPanel.Tab.OPEN_ROBERTA); - - var open_roberta_loading_checkbutton = builder.get_object ("openroberta-loading-checkbutton") as Gtk.CheckButton; - open_roberta_loading_checkbutton.bind_property ("active", open_roberta_window, "loading", BindingFlags.SYNC_CREATE); - - (builder.get_object ("openroberta-available-checkbutton") as Gtk.CheckButton) - .bind_property ("active", this, "available", BindingFlags.SYNC_CREATE); - - disconnected_radio_button = builder.get_object ("openroberta-status-disconnected-radiobutton") as Gtk.RadioButton; - disconnected_radio_button.clicked.connect (() => { - status_bar_item.connected = false; - open_roberta_window.connected = false; - }); - connected_radio_button = builder.get_object ("openroberta-status-connected-radiobutton") as Gtk.RadioButton; - connected_radio_button.clicked.connect (() => { - status_bar_item.connected = true; - open_roberta_window.connected = true; - }); - - (builder.get_object ("openroberta-custom-server-entry") as Gtk.Entry) - .bind_property ("text", open_roberta_window, "custom-server-address", - BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); - (builder.get_object ("openroberta-active-server-entry") as Gtk.Entry) - .bind_property ("text", open_roberta_window, "selected-server", - BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); - - var pin_code_entry = builder.get_object ("openroberta-pin-code-entry") as Gtk.Entry; - (builder.get_object ("openroberta-show-pin-dialog-button") as Gtk.Button) - .clicked.connect (() => { - var code = pin_code_entry.text; - OpenRobertaWindow.show_pairing_code_dialog (code); - }); - (builder.get_object ("openroberta-close-pin-dialog-button") as Gtk.Button) - .clicked.connect (() => OpenRobertaWindow.close_pairing_code_dialog ()); - } - - void on_server_connect (string address) { - if (address == "") { - OpenRobertaWindow.show_no_custom_server_address_dialog (); - } else { - open_roberta_window.selected_server = address; - connected_radio_button.clicked (); - } - } - - void on_server_disconnect () { - disconnected_radio_button.clicked (); - } - } -} diff --git a/test/glade/ConnmanAgentRequestInputDialog.glade b/test/glade/ConnmanAgentRequestInputDialog.glade deleted file mode 100644 index 3f496a9..0000000 --- a/test/glade/ConnmanAgentRequestInputDialog.glade +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - False - dialog - - - False - vertical - 2 - - - False - end - - - - - - Done - True - True - True - - - True - True - 1 - - - - - False - True - end - 0 - - - - - True - False - 12 - 12 - 12 - 12 - vertical - 12 - - - True - False - 6 - 6 - vertical - 3 - True - start - - - Request WPA2 Passphrase - True - True - True - - - True - True - 0 - - - - - Request WPA2 Passphrase /w Previous - True - True - True - - - True - True - 1 - - - - - Request Name for Hidden Network - True - True - True - - - True - True - 2 - - - - - False - True - 0 - - - - - 12 - True - False - 6 - - - True - False - Service Name: - - - False - True - 0 - - - - - True - True - My Wi-Fi Network - - - True - True - end - 1 - - - - - True - True - 1 - - - - - False - True - 1 - - - - - - diff --git a/test/glade/ConnmanServiceIPv4Dialog.glade b/test/glade/ConnmanServiceIPv4Dialog.glade deleted file mode 100644 index 55a7cb2..0000000 --- a/test/glade/ConnmanServiceIPv4Dialog.glade +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - False - True - dialog - - - False - vertical - 2 - - - False - end - - - gtk-cancel - True - True - True - True - - - True - True - 0 - - - - - gtk-save - True - True - True - True - - - True - True - 1 - - - - - False - True - end - 0 - - - - - True - False - vertical - - - True - False - <name> - - - False - True - 0 - - - - - True - False - 6 - 6 - 6 - 6 - 3 - 6 - - - True - False - end - Method: - right - end - - - 0 - 0 - - - - - True - False - end - IP address: - right - end - - - 0 - 1 - - - - - True - False - end - Network mask: - right - end - - - 0 - 2 - - - - - True - False - end - Gateway: - right - end - - - 0 - 3 - - - - - True - True - - - 1 - 1 - - - - - True - True - - - 1 - 2 - - - - - True - True - - - 1 - 3 - - - - - True - False - 0 - - DHCP - Manual - - - - 1 - 0 - - - - - False - True - 1 - - - - - False - True - 1 - - - - - - diff --git a/test/glade/ControlPanel.glade b/test/glade/ControlPanel.glade deleted file mode 100644 index 36ed074..0000000 --- a/test/glade/ControlPanel.glade +++ /dev/null @@ -1,4365 +0,0 @@ - - - - - - 2000 - 10 - 100 - - - 20 - 0.10000000000000001 - 1 - - - 5 - 12 - 0.25 - 1 - - - - - - - - - - - - - - - - - True - Computer - ev3dev - False - - - - - -100 - 1 - 10 - - - 1000 - 120 - 10 - 100 - - - - - - - - - none - - - wep - - - psk - - - ieee8021x - - - wps - - - - - - - - - - - idle - - - failure - - - association - - - configuration - - - ready - - - disconnect - - - online - - - - - - - - - - - - - - 192.168.138.1 - - - - - 192.168.137.1 - - - - - - - - - bluetooth - - - ethernet - - - gadget - - - wifi - - - - - - - - - - - - - - - - - - - True - True - Wired - gadget - - - True - False - my wlan - wifi - - - True - False - Computer - bluetooth - - - - - 9999 - 1500 - 10 - 100 - - - - - - - - - - - offline - Offline - - - idle - Idle - - - ready - Ready - - - online - Online - - - - - 100 - 1 - 10 - - - - - - - - - - - - - - - True - USB - False - - - True - Bluetooth - False - - - False - Wi-Fi - False - - - - - - - - - - - - - - - - - - - - - True - True - My Network - secured - 97 - - - True - False - Other Network with really long name - wps - 64 - - - True - False - Open Network - open - 32 - - - - - - - - - - - open - - - secured - - - wps - - - - - - - - - - - - - - - - - - - - - - - - - - - True - port0 - in1 - legoev3-input-port - auto - auto nxt-analog nxt-color nxt-i2c ev3-analog ev3-uart other-uart raw - ev3-uart - False - - - True - port1 - in2 - legoev3-input-port - auto - auto nxt-analog nxt-color nxt-i2c ev3-analog ev3-uart other-uart raw - ev3-uart - False - - - True - port2 - in3 - legoev3-input-port - auto - auto nxt-analog nxt-color nxt-i2c ev3-analog ev3-uart other-uart raw - ev3-uart - False - - - True - port3 - in4 - legoev3-input-port - auto - auto nxt-analog nxt-color nxt-i2c ev3-analog ev3-uart other-uart raw - no-sensor - False - - - True - port4 - outA - legoev3-output-port - auto - auto ev3-tacho-motor rcx-motor rcx-led raw - ev3-tacho-motor - False - - - True - port5 - outB - legoev3-output-port - auto - auto ev3-tacho-motor rcx-motor rcx-led raw - ev3-tacho-motor - False - - - True - port6 - outC - legoev3-output-port - auto - auto ev3-tacho-motor rcx-motor rcx-led raw - ev3-tacho-motor - False - - - True - port7 - outD - legoev3-output-port - auto - auto ev3-tacho-motor rcx-motor rcx-led raw - no-motor - False - - - - - - _Quit - Quit application. - gtk-quit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - True - sensor0 - lego-ev3-uart-29 - in1 - n/a - n/a - COL-REFLECT COL-AMBIENT COL-COLOR REF-RAW RGB-RAW COL-CAL - COL-COLOR - 1 - 0 - col - n/a - - - True - sensor1 - lego-ev3-uart-30 - in2 - n/a - n/a - US-DIST-CM US-DIST-IN US-LISTEN US-SI-CM US-SI-IN US-DC-CM US-DC-IN - US-DIST-CM - 1 - 1 - cm - n/a - - - True - sensor2 - lego-nxt-us - in3 - v1.0 - 100 - US-DIST-CM US-DIST-IN US-SI-CM US-SI-IN US-LISTEN - DIST-CM - 1 - 0 - cm - n/a - - - False - sensor3 - n/a - in4 - n/a - n/a - n/a - n/a - 1 - 0 - n/a - n/a - - - - - - - - - - - - - - - - - - - - - - - - True - motor0 - outA - lego-ev3-l-motor - False - False - - - True - motor1 - outB - lego-ev3-m-motor - False - True - - - True - motor2 - outD - lego-ev3-l-motor - False - False - - - - - False - Brick Manager Control Panel - False - True - False - - - - - - True - False - vertical - - - True - True - 6 - 6 - 6 - 6 - - - True - False - 6 - 6 - True - True - - - True - False - vertical - - - True - True - in - - - True - True - ports_liststore - 0 - - - - - - 25 - - - - 0 - - - - - - - Device - - - - 1 - - - - - - - Address - - - - 2 - - - - - - - Driver - - - - 3 - - - - - - - Mode - - - True - - - 4 - - - - - - - Modes - - - True - - - 5 - - - - - - - Status - - - True - - - 6 - - - - - - - Set Dev? - - - - 7 - - - - - - - - - True - True - end - 0 - - - - - True - False - 6 - 6 - Ports - - - False - True - 1 - - - - - 0 - 0 - - - - - True - False - vertical - - - True - True - in - - - True - True - sensors_liststore - 0 - - - - - - 25 - - - - 0 - - - - - - - Device - - - True - - - 1 - - - - - - - Driver - - - True - - - 2 - - - - - - - Address - - - True - - - 3 - - - - - - - Firmware - - - True - - - 4 - - - - - - - Poll - - - True - - - 5 - - - - - - - Modes - - - True - - - 6 - - - - - - - Mode - - - True - - - 7 - - - - - - - #Values - - - True - - - 8 - - - - - - - Dec. - - - True - - - 9 - - - - - - - Units - - - True - - - 10 - - - - - - - Commands - - - True - - - 11 - - - - - - - - - True - True - end - 0 - - - - - True - False - 6 - 6 - Sensors - - - False - True - 1 - - - - - 1 - 0 - - - - - True - False - vertical - - - True - True - in - - - True - True - leds_liststore - 0 - - - - - - Name - - - - 0 - - - - - - - - - True - True - end - 0 - - - - - True - False - 6 - 6 - LEDs - - - False - True - 1 - - - - - 2 - 0 - - - - - True - False - vertical - - - True - True - in - - - True - True - tacho-motors-liststore - 0 - - - - - - - - - 0 - - - - - - - Device - - - True - - - 1 - - - - - - - Address - - - True - - - 2 - - - - - - - Driver - - - True - - - 3 - - - - - - - Inv - - - - 4 - - - - - - - Run - - - - 5 - - - - - - - - - True - True - end - 0 - - - - - True - False - 6 - 6 - Tacho Motors - - - False - True - 1 - - - - - 0 - 1 - - - - - True - False - vertical - - - True - True - in - - - True - True - dc-motors-liststore - 0 - - - - - - Name - - - - 0 - - - - - - - - - True - True - end - 0 - - - - - True - False - 6 - 6 - DC Motors - - - False - True - 1 - - - - - 1 - 1 - - - - - True - False - vertical - - - True - True - in - - - True - True - servo-motors-liststore - 0 - - - - - - Name - - - - 0 - - - - - - - - - True - True - end - 0 - - - - - True - False - 6 - 6 - Servo Motors - - - False - True - 1 - - - - - 2 - 1 - - - - - True - False - vertical - - - True - True - in - - - True - True - power_supplies_liststore - 0 - - - - - - Name - - - - 0 - - - - - - - - - True - True - end - 0 - - - - - True - False - 6 - 6 - Power Supplies - - - False - True - 1 - - - - - 0 - 2 - - - - - - - - - - - - - True - False - Device Browser - - - False - - - - - True - False - 10 - 10 - 10 - 10 - vertical - 10 - - - True - False - 6 - - - True - False - 0 - in - - - True - False - 6 - 6 - 12 - 12 - - - True - False - 6 - - - Loading - True - True - False - 0 - True - - - False - True - 0 - - - - - Available - True - True - False - 0 - True - True - - - False - True - 1 - - - - - - - - - True - False - All Windows - 0 - - - - - True - True - 0 - - - - - True - False - 0 - in - - - True - False - 6 - 6 - 12 - 12 - - - True - False - 6 - - - True - False - Address: - - - False - True - 1 - - - - - True - True - 192.168.137.3 - - - False - True - 2 - - - - - Wi-Fi Powered - True - True - False - 0 - True - True - - - False - True - 3 - - - - - Wi-Fi Connected - True - True - False - 0 - True - - - False - True - 4 - - - - - - - - - True - False - Status Bar - 0 - - - - - True - True - 1 - - - - - False - True - 0 - - - - - True - False - 0 - in - - - True - True - 12 - 12 - 12 - 12 - - - True - False - vertical - - - True - False - 12 - 12 - 12 - 12 - 6 - - - True - False - Status: - - - False - True - 0 - - - - - True - True - on - True - Offline - - Offline - Idle - Ready - Online - - - - True - Online - - - - - False - True - 2 - - - - - Offline Mode - True - True - False - 0 - True - - - False - True - 3 - - - - - False - True - 0 - - - - - - - - - - True - False - Main - - - False - - - - - True - False - 12 - 12 - 12 - 12 - 6 - - - True - True - never - never - in - - - True - True - natural - network-connections-liststore - False - horizontal - - - - - - Present - - - - 0 - - - - - - - Connected - - - - 1 - - - - - - - Name - - - True - - - 2 - - - - - - - Type - - - True - False - network-connection-type-liststore - 0 - - - 3 - - - - - - - - - False - True - 0 - - - - - True - False - vertical - 6 - - - Remove - True - True - True - - - False - True - end - 0 - - - - - Add - True - True - True - - - False - True - end - 1 - - - - - False - True - 1 - - - - - 1 - - - - - True - False - Connections - - - 1 - False - - - - - True - False - 12 - 12 - 12 - 12 - 6 - 6 - - - True - False - 1 - State: - - - 0 - 0 - - - - - True - False - 2 - True - Online - - Disconnected - Connecting - Online - - - - True - - - - - 1 - 0 - - - - - True - False - 1 - Method: - - - 2 - 0 - - - - - True - False - 1 - Address: - - - 2 - 1 - - - - - True - False - 1 - Netmask: - - - 2 - 2 - - - - - True - False - 1 - Gateway: - - - 2 - 3 - - - - - True - True - DHCP - - - 3 - 0 - - - - - True - True - 192.168.137.3 - - - 3 - 1 - - - - - True - True - 255.255.255.0 - - - 3 - 2 - - - - - True - True - 192.168.137.1 - - - 3 - 3 - - - - - True - False - 1 - Method: - - - 5 - 0 - - - - - True - False - 1 - Interface: - - - 5 - 1 - - - - - True - False - 1 - MAC: - - - 5 - 2 - - - - - True - False - 1 - MTU: - - - 5 - 3 - - - - - True - True - Automatic - - - 6 - 0 - - - - - True - True - usb0 - - - 6 - 1 - - - - - True - True - 00:00:00:00:00:00 - - - 6 - 2 - - - - - True - True - 0 - alpha - network-mtu-adjustment - True - - - 6 - 3 - - - - - True - False - DNS: - - - 4 - 0 - - - - - True - True - in - 120 - - - True - True - network-connection-info-dns-textbuffer - - - - - 4 - 1 - 3 - - - - - True - False - 1 - Is connected: - - - 0 - 1 - - - - - True - True - False - 0 - True - - - 1 - 1 - - - - - True - True - alpha - network-strength-adjustment - True - - - 1 - 5 - - - - - True - False - 1 - Strength: - - - 0 - 5 - - - - - True - False - 1 - Security: - - - 0 - 4 - - - - - True - False - 0 - True - N/A - - N/A - None - WEP - WPA - - - - True - WEP - - - - - 1 - 4 - - - - - True - False - 1 - Auto-connect: - - - 0 - 3 - - - - - True - True - False - 0 - True - - - 1 - 3 - - - - - True - False - 1 - Is busy: - - - 0 - 2 - - - - - True - True - False - 0 - True - - - 1 - 2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2 - - - - - True - False - Connection Info - - - 2 - False - - - - - True - False - 12 - 12 - 3 - 10 - - - True - True - never - never - in - - - True - True - natural - network-wifi-liststore - 0 - False - horizontal - - - - - - Present - - - - 0 - - - - - - - Connected - - - - 1 - - - - - - - Name - - - True - - - 2 - - - - - - - Security - - - True - False - network-wifi-security-liststore - 0 - - - 3 - - - - - - - 90 - Strength - - - True - network-strength-adjustment - - - 4 - - - - - - - - - 0 - 0 - 4 - - - - - Powered - True - True - False - 0 - True - True - - - 1 - 0 - - - - - Add - True - True - True - - - 1 - 2 - - - - - Remove - True - True - True - - - 1 - 3 - - - - - True - False - - - Scanning - True - True - False - 0 - True - - - - - 1 - 1 - - - - - 3 - - - - - True - False - Wi-Fi - - - 3 - False - - - - - True - False - 6 - 6 - - - True - False - Status: - - - 0 - 0 - - - - - True - False - Security: - - - 0 - 1 - - - - - True - False - Signal: - - - 0 - 2 - - - - - True - False - IP Address: - - - 0 - 3 - - - - - True - True - 192.168.0.100 - - - 1 - 3 - - - - - True - False - - - 2 - 2 - 2 - 2 - - - - - True - False - 0 - True - - Online - Ready - Connecting - Disconnecting - Failed - - - - True - Online - - - - - 1 - 0 - - - - - True - False - 0 - True - - Open - WPA PSK - WEP - WPS - - - - True - - - - - 1 - 1 - - - - - Can forget - True - True - False - 0 - True - - - 2 - 1 - 2 - - - - - True - False - Action: - - - 2 - 0 - - - - - True - False - 0 - True - - Connect - Disconnect - Cancel - - - - True - Connect - - - - - 3 - 0 - - - - - True - True - % - number - network-strength-adjustment - - - 1 - 2 - - - - - 4 - - - - - True - False - Wi-Fi Info - - - 4 - False - - - - - True - False - 12 - 12 - 12 - 12 - 6 - - - True - False - Iface: - - - 1 - 1 - - - - - True - True - tether - - - 2 - 1 - - - - - True - False - MAC: - - - 3 - 1 - - - - - True - True - 02:16:53:00:00:00 - - - 4 - 1 - - - - - True - False - IP addr: - - - 1 - 0 - - - - - True - True - 192.168.2.1 - - - 2 - 0 - - - - - True - False - Mask: - - - 3 - 0 - - - - - True - True - 255.255.255.0 - - - 4 - 0 - - - - - True - True - network-tether-liststore - - - - - - Present - - - - 0 - - - - - - - Name - - - - 1 - - - - - - - Enabled - - - - 2 - - - - - - - 0 - 0 - 2 - - - - - 5 - - - - - True - False - Tethering - - - 5 - False - - - - - - - True - False - Windows - - - - - False - True - 1 - - - - - True - False - 0 - in - - - True - False - 6 - 6 - 12 - 12 - - - True - False - start - - - Report Error - True - True - True - - - True - True - 0 - - - - - Report Peer Error - True - True - True - - - True - True - 1 - - - - - Request Browser - True - True - True - - - True - True - 2 - - - - - Request Input - True - True - True - - - True - True - 3 - - - - - Request Peer Auth. - True - True - True - - - True - True - 4 - - - - - Cancel - True - True - True - - - True - True - 5 - - - - - - - - - True - False - Agent - - - - - False - True - 2 - - - - - 1 - - - - - True - False - Network - - - 1 - False - - - - - True - False - 10 - 10 - 10 - 10 - vertical - 10 - - - True - False - 0 - in - - - True - False - 6 - 6 - 12 - 12 - - - True - False - 6 - - - Loading - True - True - False - 0 - True - - - False - True - 0 - - - - - Available - True - True - False - 0 - True - True - - - False - True - 1 - - - - - Bluetooth Connected - True - True - False - 0 - True - - - False - True - end - 3 - - - - - Bluetooth Powered - True - True - False - 0 - True - True - - - False - True - end - 4 - - - - - - - - - True - False - Bluetooth Windows - - - - - False - True - 0 - - - - - True - False - 0 - in - - - True - False - 6 - 6 - 12 - 12 - - - True - False - 3 - 6 - - - Powered - True - True - False - 0 - True - True - - - 0 - 0 - - - - - Visible - True - True - False - 0 - True - True - - - 0 - 1 - - - - - Scanning - True - True - False - 0 - True - - - 0 - 2 - - - - - Show Adapter - True - True - False - 0 - True - - - 0 - 3 - - - - - True - True - bluetooth-devices-liststore - 0 - - - - - - Present - - - - 0 - - - - - - - Name - - - True - - - 1 - - - - - - - Adapter - - - True - - - 2 - - - - - - - Connected - - - - 3 - - - - - - - 1 - 1 - 3 - - - - - True - False - 3 - - - True - False - Devices: - - - False - True - 0 - - - - - Remove - True - True - True - - - False - True - end - 1 - - - - - Add - True - True - True - - - False - True - end - 2 - - - - - 1 - 0 - - - - - - - - - True - False - Main Window - - - - - False - True - 1 - - - - - True - False - 0 - in - - - True - False - 6 - 6 - 12 - 12 - - - True - False - 6 - 6 - - - True - False - start - Title: - - - 0 - 0 - - - - - True - False - start - Address: - - - 0 - 1 - - - - - True - True - Computer - - - 1 - 0 - - - - - Paired - True - True - False - 0 - True - True - - - 2 - 0 - - - - - Connected - True - True - False - 0 - True - - - 2 - 1 - - - - - Has network - True - True - False - 0 - True - - - 3 - 0 - - - - - True - True - 00:AA:33:BB:55:CC - - - 1 - 1 - - - - - - - - - - - - True - False - Device Info - - - - - False - True - 2 - - - - - True - False - 0 - in - - - True - False - 6 - 6 - 12 - 12 - - - True - False - 6 - - - True - False - 6 - 6 - - - True - False - start - Name: - - - 0 - 0 - - - - - True - True - Entry - - - 1 - 0 - - - - - True - False - start - Passkey: - - - 0 - 1 - - - - - True - True - 123456 - - - 1 - 1 - - - - - True - True - 0 - - - - - True - False - vertical - 6 - - - True - False - 6 - expand - - - Request PIN Code - True - True - True - - - True - True - 0 - - - - - Display PIN Code - True - True - True - - - True - True - 1 - - - - - Request Passkey - True - True - True - - - True - True - 2 - - - - - Display Passkey - True - True - True - - - True - True - 3 - - - - - False - True - 0 - - - - - True - False - 6 - expand - - - Request Confirmation - True - True - True - - - True - True - 0 - - - - - Request Authorization - True - True - True - - - True - True - 1 - - - - - Authorize Service - True - True - True - - - True - True - 2 - - - - - Cancel - True - True - True - - - True - True - 3 - - - - - False - True - 1 - - - - - False - True - 1 - - - - - - - - - True - False - Agent - - - - - False - True - 3 - - - - - 2 - - - - - True - False - Bluetooth - - - 2 - False - - - - - True - False - 10 - 10 - 10 - 10 - vertical - 10 - - - True - False - 10 - 10 - 10 - 10 - vertical - 10 - - - True - False - 0 - in - - - True - False - 6 - 6 - 12 - 12 - - - Loading - True - True - False - 0 - True - - - - - - - True - False - Battery Screens - - - - - False - True - 0 - - - - - True - False - 0 - in - - - True - False - 6 - 6 - 12 - 12 - - - True - False - 6 - 6 - - - True - False - Technology - - - 0 - 0 - - - - - True - False - 0 - - Rechargable - Regular - - - - 1 - 0 - - - - - True - True - battery-voltage-adjustment - 2 - True - if-valid - 8 - - - 1 - 1 - - - - - True - True - battery-current-adjustment - True - 180 - - - 1 - 2 - - - - - True - True - 180 - battery-power-adjustment - 2 - True - if-valid - 1.4399999999999999 - - - 1 - 3 - - - - - Voltage (V) - True - True - False - 0 - True - True - - - 0 - 1 - - - - - Current (A) - True - True - False - 0 - True - True - - - 0 - 2 - - - - - Power (W) - True - True - False - 0 - True - True - - - 0 - 3 - - - - - - - - - True - False - Battery Info - - - - - False - True - 1 - - - - - - - - False - True - 0 - - - - - 3 - - - - - True - False - Battery - - - 3 - False - - - - - True - False - 10 - 10 - 10 - 10 - vertical - 10 - - - True - False - vertical - 10 - - - True - False - 0 - in - - - True - False - 6 - 6 - 12 - - - True - False - 6 - - - Loading - True - True - False - 0 - True - - - False - True - 0 - - - - - Available - True - True - False - 0 - 0 - True - True - - - False - True - 1 - - - - - - - - - - - - True - False - All Windows - - - - - False - True - 0 - - - - - True - False - 0 - in - - - True - False - 6 - 6 - 12 - - - True - False - vertical - 6 - - - True - False - 6 - - - True - False - Status: - - - False - True - 0 - - - - - Disconnected - True - True - False - 0 - True - True - - - False - True - 1 - - - - - Connected - True - True - False - 0 - True - True - openroberta-status-disconnected-radiobutton - - - False - True - 2 - - - - - - - - False - True - 0 - - - - - True - False - 6 - - - True - False - Custom Server: - - - False - True - 0 - - - - - True - True - - - False - True - 1 - - - - - True - False - Active Server: - - - False - True - 2 - - - - - True - True - - - False - True - 3 - - - - - False - True - 1 - - - - - True - False - 6 - - - True - False - PIN Code: - - - False - True - 0 - - - - - True - True - ABCD1234 - - - False - True - 1 - - - - - True - False - 6 - start - - - Show PIN dialog - True - True - True - - - True - True - 0 - - - - - Close PIN dialog - True - True - True - - - True - True - 1 - - - - - False - True - 2 - - - - - False - True - 2 - - - - - - - - - True - False - Open Roberta Window - - - - - False - True - 1 - - - - - - - - False - True - 0 - - - - - 4 - - - - - True - False - OpenRoberta - right - - - 4 - False - - - - - True - False - 10 - 10 - 10 - 10 - vertical - - - True - False - 0 - in - - - True - False - 12 - 12 - 6 - 6 - - - True - False - 0 - Version: - - - 0 - 0 - - - - - True - True - - - 1 - 0 - - - - - - - True - False - Kernel - - - - - False - True - 0 - - - - - True - False - 0 - in - - - True - False - 12 - 12 - 12 - 12 - 6 - 6 - - - True - False - 0 - Model: - - - 0 - 0 - - - - - True - False - 0 - Revision: - - - 0 - 1 - - - - - True - False - 0 - Serial Number: - - - 0 - 2 - - - - - True - True - - - 1 - 0 - - - - - True - True - - - 1 - 1 - - - - - True - True - - - 1 - 2 - - - - - - - True - False - CPU Info - - - - - False - True - 1 - - - - - - - - 5 - - - - - True - False - About - - - 5 - False - - - - - False - True - 0 - - - - - True - False - 6 - center - - - gtk-quit - True - True - True - True - 0.51999998092651367 - 0.49000000953674316 - - - - False - True - 0 - - - - - False - True - 1 - - - - - - diff --git a/test/main.vala b/test/main.vala deleted file mode 100644 index 0732723..0000000 --- a/test/main.vala +++ /dev/null @@ -1,88 +0,0 @@ -/* - * brickman -- Brick Manager for LEGO MINDSTORMS EV3/ev3dev - * - * Copyright (C) 2014-2015,2017 David Lechner - * - * 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 . - */ - -/* - * main.vala: - * - * Version of Brick Manager that runs in GTK for testing. - */ - -using Ev3devKit.Ui; - -namespace BrickManager { - static int main (string[] args) - { - try { - var app = new Ev3devKit.ConsoleApp (); - - var activate_id = app.activate.connect (() => { - // Ev3devKit.ConsoleApp creates a top level Gtk.Window. - var main_window = Gtk.Window.list_toplevels ().nth_data (0); - var control_panel = new ControlPanel (); - - // position the windows nicely. main_window is centered on screen by default. - int x; - int y; - main_window.get_position (out x, out y); - main_window.move (x, y - Screen.get_active_screen ().height * 2); - control_panel.window.move (x, y + 20); - - var home_window = new HomeWindow (); - home_window.add_controller (control_panel.file_browser_controller); - home_window.add_controller (control_panel.device_browser_controller); - home_window.add_controller (control_panel.network_controller); - control_panel.network_controller.add_controller (control_panel.bluetooth_controller); - control_panel.network_controller.add_controller (control_panel.network_controller.wifi_controller); - control_panel.bluetooth_controller.show_network_connection_requested.connect ((name) => - control_panel.network_controller.show_connection (name)); - home_window.add_controller (control_panel.battery_controller); - home_window.add_controller (control_panel.open_roberta_controller); - home_window.add_controller (control_panel.about_controller); - - Screen.get_active_screen ().status_bar.visible = true; - Screen.get_active_screen ().status_bar.add_left (control_panel.network_controller.network_status_bar_item); - - Screen.get_active_screen ().status_bar.add_right (control_panel.battery_controller.battery_status_bar_item); - Screen.get_active_screen ().status_bar.add_right (control_panel.network_controller.wifi_status_bar_item); - Screen.get_active_screen ().status_bar.add_right (control_panel.bluetooth_controller.bluetooth_status_bar_item); - Screen.get_active_screen ().status_bar.add_right (control_panel.open_roberta_controller.status_bar_item); - - home_window.shutdown_dialog.power_off_button_pressed.connect (() => - app.quit ()); - home_window.shutdown_dialog.reboot_button_pressed.connect (() => { - var dialog = new Dialog () { - padding = 10 - }; - var label = new Label ("Reboot is not implemented."); - dialog.add (label); - dialog.show (); - }); - home_window.show (); - }); - - app.run (); - app.disconnect (activate_id); - - return 0; - } catch (GLib.Error err) { - critical ("%s", err.message); - return 1; - } - } -}