精华内容
下载资源
问答
  • dbus接口

    2010-03-16 12:59:00
    建立服务的流程:---------------------------------- 建立一个dbus连接之后 -- dbus_bus_get(),为这个dbus连接(DbusConnection)起名 -- dbus_bus_request_name(),这个名字将会成为我们在后续进行远程调用的时候的...

    建立服务的流程:
    ----------------------------------
        建立一个dbus连接之后 -- dbus_bus_get(),为这个dbus连接(DbusConnection)起名 -- dbus_bus_request_name(),这个名字将会成为我们在后续进行远程调用的时候的服务名,然后我们进入监听循环 -- dbus_connection_read_write()。在循环中,我们从总线上取出消息 -- dbus_connection_pop_message(),并通过比对消息中的方法接口名和方法名 -- dbus_message_is_method_call(),如果一致,那么我们跳转到相应的处理中去。在相应的处理中,我们会从消息中取出远程调用的参数。并且建立起回传结果的通路 -- reply_to_method_call()。回传动作本身等同于一次不需要等待结果的远程调用。


    发送信号的流程:
    ----------------------------------
        建立一个dbus连接之后,为这个dbus连接起名,建立一个发送信号的通道,注意,在建立通道的函数中,需要我们填写该信号的接口名和信号名 -- dbus_message_new_signal()。然后我们把信号对应的相关参数压进去 -- dbus_message_iter_init_append(); dbus_message_iter_append_basic()。然后就可以启动发送了 -- dbus_connection_send(); dbus_connection_flush。


    进行一次远程调用的流程:
    ----------------------------------
        建立好dbus连接之后,为这dbus连接命名,申请一个远程调用通道 -- dbus_message_new_method_call(),注意,在申请远程调用通道的时候,需要填写服务器名,本次调用的接口名,和本次调用名(方法名)。压入本次调用的参数 -- dbus_message_iter_init_append(); dbus_message_iter_append_basic(),实际上是申请了一个首地址,我们就是把我们真正要传的参数,往这个首地址里面送(送完之后一般都会判断是否内存越界了)。然后就是启动发送调用并释放发送相关的消息结构 -- dbus_connection_send_with_reply()。这个启动函数中带有一个句柄。我们马上会阻塞等待这个句柄给我们带回总线上回传的消息。当这个句柄回传消息之后,我们从消息结构中分离出参数。用dbus提供的函数提取参数的类型和参数 -- dbus_message_iter_init(); dbus_message_iter_next(); dbus_message_iter_get_arg_type(); dbus_message_iter_get_basic()。也就达成了我们进行本次远程调用的目的了。


    信号接收流程:
    ----------------------------------
        建立一个dbus连接之后,为这个dbus连接起名,为我们将要进行的消息循环添加匹配条件(就是通过信号名和信号接口名来进行匹配控制的) -- dbus_bus_add_match()。我们进入等待循环后,只需要对信号名,信号接口名进行判断就可以分别处理各种信号了。在各个处理分支上。我们可以分离出消息中的参数。对参数类型进行判断和其他的处理。


    dbus_connection_read_write()
    --------------------------------------
        As long as the connection is open, this function will block until it can read or write, then read or write, then return #TRUE.
        If the connection is closed, the function returns #FALSE.


    dbus_connection_pop_message()
    --------------------------------------
        Returns the first-received message from the incoming message queue, removing it from the queue. The caller owns a reference to the returned message. If the queue is empty, returns #NULL.


    dbus_connection_send()
    --------------------------------------
        Adds a message to the outgoing message queue. Does not block to write the message to the network; that happens asynchronously. To force the message to be written, call dbus_connection_flush(). Because this only queues the message, the only reason it can
    fail is lack of memory. Even if the connection is disconnected, no error will be returned.
        @param connection the connection.
        @param message the message to write.
        @param serial return location for message serial, or #NULL if you don't care
        @returns #TRUE on success.


    dbus_connection_send_with_reply()
    --------------------------------------
        Queues a message to send, as with dbus_connection_send(), but also returns a #DBusPendingCall used to receive a reply to the message. If no reply is received in the given timeout_milliseconds, this function expires the pending reply and generates a synthetic error reply (generated in-process, not by the remote application) indicating that a timeout occurred.

        A #DBusPendingCall will see a reply message before any filters or registered object path handlers. See dbus_connection_dispatch() for details on when handlers are run.

        A #DBusPendingCall will always see exactly one reply message, unless it's cancelled with dbus_pending_call_cancel().

        If #NULL is passed for the pending_return, the #DBusPendingCall will still be generated internally, and used to track the message reply timeout. This means a timeout error will occur if no reply arrives, unlike with dbus_connection_send().
       
        If -1 is passed for the timeout, a sane default timeout is used. -1 is typically the best value for the timeout for this reason, unless you want a very short or very long timeout. There is no way to avoid a timeout entirely, other than passing INT_MAX for the
    timeout to mean "very long timeout." libdbus clamps an INT_MAX timeout down to a few hours timeout though.

        @warning if the connection is disconnected, the #DBusPendingCall will be set to #NULL, so be careful with this.
       
        @param connection the connection
        @param message the message to send
        @param pending_return return location for a #DBusPendingCall object, or #NULL if connection is disconnected
        @param timeout_milliseconds timeout in milliseconds or -1 for default
        @returns #FALSE if no memory, #TRUE otherwise.




    dbus_message_is_signal()
    --------------------------------------
        Checks whether the message is a signal with the given interface and member fields. If the message is not #DBUS_MESSAGE_TYPE_SIGNAL, or has a different interface or member field, returns #FALSE.


    dbus_message_iter_init()
    --------------------------------------
        Initializes a #DBusMessageIter for reading the arguments of the message passed in.


    dbus_message_iter_next()
    --------------------------------------
        Moves the iterator to the next field, if any. If there's no next field, returns #FALSE. If the iterator moves forward, returns #TRUE.


    dbus_message_iter_get_arg_type()
    --------------------------------------
        Returns the argument type of the argument that the message iterator points to. If the iterator is at the end of the message, returns #DBUS_TYPE_INVALID.


    dbus_message_iter_get_basic()
    --------------------------------------
        Reads a basic-typed value from the message iterator. Basic types are the non-containers such as integer and string.


    dbus_message_new_signal()
    --------------------------------------
        Constructs a new message representing a signal emission. Returns #NULL if memory can't be allocated for the message. A signal is identified by its originating object path, interface, and the name of the signal.

        Path, interface, and signal name must all be valid (the D-Bus specification defines the syntax of these fields).
       
        @param path the path to the object emitting the signal
        @param interface the interface the signal is emitted from
        @param name name of the signal
        @returns a new DBusMessage, free with dbus_message_unref()


    dbus_message_iter_init_append()
    --------------------------------------
        Initializes a #DBusMessageIter for appending arguments to the end of a message.
        @param message the message
        @param iter pointer to an iterator to initialize


    dbus_message_iter_append_basic()
    --------------------------------------
        Appends a basic-typed value to the message. The basic types are the non-container types such as integer and string.
        @param iter the append iterator
        @param type the type of the value
        @param value the address of the value
        @returns #FALSE if not enough memory


    dbus_message_new_method_call()
    --------------------------------------
        Constructs a new message to invoke a method on a remote object. Returns #NULL if memory can't be allocated for the message. The destination may be #NULL in which case no destination is set; this is appropriate when using D-Bus in a peer-to-peer context (no message bus). The interface may be #NULL, which means that if multiple methods with the given name exist it is undefined which one will be invoked.

        The path and method names may not be #NULL.

        Destination, path, interface, and method name can't contain any invalid characters (see the D-Bus specification).

        @param destination name that the message should be sent to or #NULL
        @param path object path the message should be sent to
        @param interface interface to invoke method on, or #NULL
        @param method method to invoke

        @returns a new DBusMessage, free with dbus_message_unref()


    dbus_bus_get()
    --------------------------------------
        Connects to a bus daemon and registers the client with it. If a connection to the bus already exists, then that connection is returned. The caller of this function owns a reference to the bus.
        @param type bus type
        @param error address where an error can be returned.
        @returns a #DBusConnection with new ref


    dbus_bus_request_name()
    --------------------------------------
        Asks the bus to assign the given name to this connection by invoking the RequestName method on the bus.

        First you should know that for each bus name, the bus stores a queue of connections that would like to own it. Only one owns it at a time - called the primary owner. If the primary owner releases the name or disconnects, then the next owner in the queue atomically takes over.

        So for example if you have an application org.freedesktop.TextEditor and multiple instances of it can be run, you can have all of them sitting in the queue. The first one to start up will receive messages sent to org.freedesktop.TextEditor, but if that one exits another will become the primary owner and receive messages.

        The queue means you don't need to manually watch for the current owner to disappear and then request the name again.
       
        @param connection the connection
        @param name the name to request
        @param flags flags
        @param error location to store the error
        @returns a result code, -1 if error is set

        给DBusConnection起名字(命名) -- 两个相互通信的连接(connection)不能同名
        命名规则: xxx.xxx (zeng.xiaolong)


    dbus_bus_add_match()
    --------------------------------------
        Adds a match rule to match messages going through the message bus. The "rule" argument is the string form of a match rule.
        @param connection connection to the message bus
        @param rule textual form of match rule
        @param error location to store any errors





    dbus_pending_call_block()
    --------------------------------------
        Block until the pending call is completed. The blocking is as with dbus_connection_send_with_reply_and_block(); it does not enter the main loop or process other messages, it simply waits for the reply in question.

        If the pending call is already completed, this function returns immediately.

        @todo when you start blocking, the timeout is reset, but it should really only use time remaining since the pending call was created. This requires storing timestamps instead of intervals in the timeout

        @param pending the pending call


    dbus_pending_call_steal_reply()
    --------------------------------------
        Gets the reply, or returns #NULL if none has been received yet. Ownership of the reply message passes to the caller. This function can only be called once per pending call, since the reply message is tranferred to the caller.

        @param pending the pending call
        @returns the reply message or #NULL.

    展开全文
  • go-bluetooth, 在 bluez DBus接口上,Golang蓝牙客户端 蓝牙基于 bluez DBus接口的Golang蓝牙客户端请参阅这里参考 https://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc 。状态当前的API不稳定,将来可能会...
  • 通过godbus调用dbus接口启用服务失败 ``` conn, err := dbus.SystemBus() if err != nil { panic(err) } var s string file := "test.service" var target []string target = append(target, ...
  • DBus接口文档

    2019-10-08 16:37:22
    gitgit.projects.genivi.org / ipc / common-api-dbus-tools.git / blob? search: re0544e985b6e4a6c83ddf08969f6475099461bd1e[ipc/common-api-dbus-tools.git] / docx / CommonAPIDBusCppUserGuide1 = Common...


    gitgit.projects.genivi.org / ipc / common-api-dbus-tools.git / blob
    ? search: re


    0544e985b6e4a6c83ddf08969f6475099461bd1e
    [ipc/common-api-dbus-tools.git] / docx / CommonAPIDBusCppUserGuide
    1 = CommonAPI D-Bus C++ User Guide
    2
    3 :doctitle: CommonAPI D-Bus C++ User Guide
    4 :website: http://projects.genivi.org/commonapi/
    5 :version:
    6 :date:
    7 :toc:
    8 :revdate:
    9 :imagedir:
    10 :cppstr: c++
    11
    12 == Introduction
    13
    14 === Aim of this document
    15
    16 This document complements the CommonAPI tutorial with D-Bus specific information. Please read the base tutorial first.
    17
    18 == Integration Guide for CommonAPI users
    19
    20 The following descriptions assume that host and target platform are Linux platforms. However CommonAPI D-Bus supports also Windows as host and target platform. All you need to know for Windows concerning CommonAPI you find in the separate Windows paragraph below at the end of this Integration Guide.
    21
    22 === Requirements
    23
    24 CommonAPI was developed for GENIVI and will run on most Linux platforms. Additionally it is possible to run it under Windows for test and development purposes. Please note:
    25
    26 - CommonAPI uses a lot of C++11 features, as variadic templates, std::bind, std::function and so on. Make sure that the compiler of your target platform is able to compile it (e.g. gcc 4.8).
    27 - The build system of CommonAPI is CMake; please make sure that it is installed on your host.
    28 - Do not use earlier versions of Eclipse as Luna; it could work but there is no warranty.
    29 - The build tool chain for the code generators is Maven; make sure that at least Maven 3 is available. If you use eclipse make sure that the maven plug-in is installed.
    30
    31 The CommonAPI D-Bus binding requires the D-Bus (_libdbus_ at compile time for linking and the running D-Bus daemon at runtime). The D-Bus version should be at least 1.6.x.
    32
    33 === Dependencies
    34 .CommonAPI-D-Bus Dependencies
    35 image::{imagedir}/CommonAPI-DBus-Dependencies.png[CommonAPI D-Bus Dependencies image]
    36
    37 === Restrictions
    38
    39 - The signature of D-Bus data must not be longer than 255 characters.
    40
    41 === Compile Runtime
    42
    43 ==== Patching libdbus
    44
    45 CommonAPI-D-Bus needs some API functions of libdbus which are not available in actual libdbus versions. For these additional API functions it is necessary to patch the required libdbus version with all the patches provided in the directory src/dbus-patches.
    46
    47 [NOTE]
    48 Use autotools to build libdbus.
    49
    50 ----
    51 $ wget http://dbus.freedesktop.org/releases/dbus/dbus-<VERSION>.tar.gz
    52 $ tar -xzf dbus-<VERSION>.tar.gz
    53 $ cd dbus-<VERSION>
    54 $ patch -p1 < </path/to/CommonAPI-D-Bus/src/dbus-patches/patch-names>.patch
    55 $ ./configure --prefix=</path to your preferred installation folder for patched libdbus>
    56 $ make -C dbus
    57 $ make -C dbus install
    58 $ make install-pkgconfigDATA
    59 ----
    60
    61 You can change the installation directory by the prefix option or you can let it uninstalled (skip the +make install+ commands).
    62 WARNING: Installing the patched libdbus to /usr/local can prevent your system from booting correctly at the next reboot.
    63
    64 ==== Command-line
    65
    66 In order to build the CommonAPI-D-Bus Runtime library the pkgconfig files of the patched libdbus library must be added to the +PKG_CONFIG_PATH+.
    67
    68 For example, if the patched libdbus library is available in /usr/local, set the +PKG_CONFIG_PATH+ variable as follows:
    69
    70 ----
    71 $ export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
    72 ----
    73
    74 Now use CMake to build the CommonAPI D-Bus runtime library. We assume that your source directory is +common-api-dbus-runtime+:
    75
    76 ----
    77 $ cd common-api-dbus-runtime
    78 $ mkdir build
    79 $ cd build
    80 $ cmake -DUSE_INSTALLED_COMMONAPI=ON -DCMAKE_INSTALL_PREFIX=/usr/local ..
    81 $ make
    82 $ make install
    83 ----
    84
    85 You can change the installation directory by the CMake variable +CMAKE_INSTALL_PREFIX+ or you can let it uninstalled (skip the +make install+ command). If you want to use the uninstalled version of CommonAPI set the CMake variable USE_INSTALLED_COMMONAPI to OFF.
    86
    87 This is the standard procedure and will hopefully create the shared CommonAPI D-Bus runtime library libCommonAPI-DBus.so in the build directory. Note that CMake checks if doxygen and asciidoc are installed. These tools are only necessary if you want to generate the documentation of your own. The unit tests of CommonAPI D-Bus are implemented by using the Google C++ Testing Framework. If you want to build and run the unit tests the environment variable +GTEST_ROOT+ must point to the correct directory (see the contributor's guide below).
    88
    89 [NOTE]
    90 If you prefer to install CommonAPI D-Bus from a tar file you can get the actual tar file from:
    91         http://docs.projects.genivi.org/yamaica-update-site/CommonAPI/runtime/
    92
    93 There are several options for calling CMake and make targets.
    94
    95 If you do not want to use nor the installed dbus library and neither the installed CommonAPI library:
    96 ----
    97 $ cmake -DUSE_INSTALLED_DBUS=OFF -DUSE_INSTALLED_COMMONAPI=OFF ..
    98 ----
    99
    100 Generate makefile for building a static CommonAPI library (default is a shared library). The library will be in _/build/src/CommonAPI/DBus_.
    101 ----
    102 $ cmake -DBUILD_SHARED_LIBS=OFF ..
    103 ----
    104
    105 Generate makefile for building the release version of CommonAPI D-Bus (default is debug).
    106 ----
    107 $ cmake -DCMAKE_BUILD_TYPE=Release ..
    108 ----
    109
    110 Without any further settings +make install+ will copy CommonAPI D-Bus libraries and header files to _/usr/local_. You can change this destination directory by changing the installation prefix (e.g. to test).
    111 ----
    112 $ cmake -DCMAKE_INSTALL_PREFIX=/test  ..
    113 ----
    114
    115 Make targets:
    116
    117 [width="80%",cols="4,10"]
    118 |=========================================================
    119
    120 |+make all+ |
    121 Same as make. Will compile and link CommonAPI.
    122
    123 |+make clean+ |
    124 Deletes binaries, but not the files which has been generated by CMake.
    125
    126 |+make maintainer-clean+ |
    127 Deletes everything in the build directory.
    128
    129 |+make install+ |
    130 Copies libraries to _/user/local/lib/commonapiX.X.X_ and header files to _/user/local/include/commonapiX.X.X/CommonAPI_.
    131
    132 |+make DESTDIR=< install_dir > install+ |
    133 The destination directory for the installation can be influenced by +DESTDIR+.
    134
    135 |=========================================================
    136
    137 Further make targets will be described in the contributor's guide below.
    138
    139 ==== Eclipse
    140
    141 Follow the instructions in the CommonAPI User Guide.
    142
    143 === Compile tools
    144
    145 Like the CommonAPI core code generators you can build the D-Bus generator by calling maven from the command-line. Open a console and change in the directory org.genivi.commonapi.dbus.releng of your CommonAPI-D-Bus-Tools directory. Then call:
    146
    147 ----
    148 mvn clean verify –DCOREPATH=<path to your CommonAPI-Tools dir> -Dtarget.id=org.genivi.commonapi.dbus.target
    149 ----
    150
    151 COREPATH is the directory, that contains the target definition folder: org.genivi.commonapi.core.target.
    152
    153 After the successful build you will find the commond-line generators archived in org.genivi.commonapi.dbus.cli.product/target/products/commonapi_dbus_generator.zip and the update-sites in org.genivi.commonapi.dbus.updatesite/target.
    154
    155 === Build DBus Glue Code
    156
    157 The glue code library contains the binding specific, generated code. It depends on your specific project how exactly this library is built (with or without skeleton code, divided up into several libraries, e.g. for services and clients, and so on). The glue code for the verification tests can be built by means of the binding specific verification project (for D-Bus it is _org.genivi.commonapi.dbus.verification_ in CommonAPI-D-Bus-Tools):
    158
    159 . The cmake call below generates CommonAPI code for all requested fidl files using the CommonAPI- core and DBus code generator. The fidl files for the verification tests can be found in _org.genivi.commonapi.core.verification/fidl_.
    160 . Create a build directory for an out of source build.
    161 . Call cmake as described below with additional parameters (in eclipse create a make target).
    162
    163 CMake parameters:
    164
    165 [width="90%",cols="10,10"]
    166 |=========================================================
    167
    168 |+USE_INSTALLED_COMMONAPI+ |
    169 ON or OFF
    170
    171 |+COMMONAPI_CMAKE_INSTALL_PATH+ |
    172 Path to the build directory of CommonAPI (e.g. CommonAPI/build)
    173
    174 |+COMMONAPI_TOOL_GENERATOR+ |
    175 Core code generator executable with path
    176
    177 |+COMMONAPI_DBUS_TOOL_GENERATOR+ |
    178 DBus Code generator executable with path
    179
    180 |=========================================================
    181
    182  
    183 Example to build DBus glue code for the verification tests:
    184
    185 ----
    186 export PKG_CONFIG_PATH=path/to/patched/libdbus:$PKG_CONFIG_PATH
    187
    188 cd CommonAPI-D-Bus-Tools/org.genivi.commonapi.dbus.verification/
    189 mkdir build
    190 cd build
    191
    192 cmake \
    193 -DCOMMONAPI_TOOL_GENERATOR=myworkpath/CommonAPI-Tools/org.genivi.commonapi.core.cli.product/target/products/org.genivi.commonapi.core.cli.product/linux/gtk/MYARCH/commonapi-generator-linux-MYARCH \
    194 -DCOMMONAPI_DBUS_TOOL_GENERATOR=myworkpath/CommonAPI-D-Bus-Tools/org.genivi.commonapi.dbus.cli.product/target/products/org.genivi.commonapi.dbus.cli.product/linux/gtk/MYARCH/commonapi-dbus-generator-linux-MYARCH \
    195 -DCommonAPI_DIR=myworkpath/CommonAPI/build \
    196 -DCommonAPI-DBus_DIR=myworkpath/CommonAPI-D-Bus/build \
    197 -DCOMMONAPI_TEST_FIDL_PATH=myworkpath/CommonAPI-Tools/org.genivi.commonapi.core.verification/fidl ..
    198
    199 make -j4
    200 ----
    201
    202 === Project Setup
    203
    204 ==== Configuration
    205
    206 CommonAPI-D-Bus can be configured as CommonAPI itself by an ini-file. The name of this configuration file is +commonapi-dbus.ini+. There are three places where CommonAPI D-Bus Runtime tries to find this file (in the following order):
    207
    208 1. in the directory of the current executable. If there is a +commonapi-dbus.ini+ file, it has the highest priority.
    209 2. in the directory which is specified by the environment variable +COMMONAPI_DBUS_CONFIG+.
    210 3. in the global default directory +/etc+.
    211
    212 The configuration file has 2 possible kinds of sections; all sections are optional.
    213
    214 ===== Address Translation Sections
    215
    216 This kind of section determines how CommonAPI addresses are translated into D-Bus addresses (object path, interface name and so on). The name of the section is the CommonAPI address and the parameters are:
    217
    218 - +service+
    219 - +path+
    220 - +interface+
    221
    222 Example:
    223
    224 ----
    225 [local:de.ABC:de.app1]
    226 service=de.ABC_de.app1
    227 path=/de/app1
    228 interface=de.ABC
    229 ----
    230
    231 If there is no address configuration for a certain CommonAPI address available the CommonAPI address will be translated by default as shown in the following picture:
    232
    233 .D-Bus Addresses
    234 image::{imagedir}/DBusAddresses.png[D-Bus Addresses image]
    235
    236 There might be some confusion concerning the terms and definitions:
    237
    238 - Franca IDL and CommonAPI define interfaces; these interfaces can be instantiated once or several times in one or several services. The CommonAPI term _interfaceID_ and the D-Bus term _interface name_ are equivalent.
    239 - The D-Bus _object path_ is a name used to refer to an object instance. The _object names_ are organized into a filesystem-style hierarchy. The _object path_ corresponds to the CommonAPI _instanceIDs_.
    240 - Additionally D-Bus services are "connected" to the bus with an automatically created internal so-called unique bus name (e.g. :1.25). For this bus name one or several well-known names may be defined (here it is called service name). The parameter _service_ in the configuration file defines this well-known name; the default name is _interfaceID___instanceID_.  
    241
    242 ===== Connections
    243
    244 Section for assigning a certain D-Bus bus segment (Session, System, Starter) to the connection name.
    245
    246 ==== Deployment
    247
    248 The D-Bus code generator can generate code completely without any deployment settings. But for the combination of CommonAPI applications and D-Bus applications which are written without CommonAPI there are some deployment parameters necessary.
    249
    250 [source,java]
    251 ----
    252 import "platform:/plugin/org.genivi.commonapi.core/deployment/CommonAPI_deployment_spec.fdepl"
    253
    254 specification org.genivi.commonapi.dbus.deployment extends org.genivi.commonapi.core.deployment {
    255         for interfaces {
    256                 PropertiesType: {CommonAPI, freedesktop} (default: CommonAPI);
    257         }
    258 }
    259 ----
    260
    261 Use the deployment parameter _PropertiesType_ for the support of implementations of the _org.freedesktop.DBus.Properties_ interface.
    262
    263 === Windows
    264
    265 ==== Build D-Bus
    266
    267 To build the Windows version of D-Bus the following steps have to be done:
    268
    269 - Download D-Bus from http://www.freedesktop.org/wiki/Software/dbus/ e.g. dbus-1.8.0.tar.gz and unpack the archive into a directory.
    270 - For building D-Bus, CMake is needed. Download CMake from http://cmake.org/cmake/resources/software.html. The result of the download is e.g. cmake-2.8.12.2-win32-x86.zip. Unpack the archive into a directory.
    271 - Furthermore +expat+ is needed. +Expat+ can be downloaded from http://expat.sourceforge.net. Example: download expat-win32bin-2.1.0.exe from http://sourceforge.net/projects/expat/files/expat_win32/2.1.0 and install it.
    272
    273
    274
    275 - Now the Windows D-Bus patch is needed. Download the patch from http://gnuwin32.sourceforge.net/packages/patch.htm e.g. patch-2.5.9-7-setup.exe and install the patch.
    276
    277 - Apply all the CommonAPI D-Bus patches (located in _CommonAPI-D-Bus/src/dbus-patches_ ) e.g. call
    278
    279 ----
    280 cd dbus-1.8.0
    281 find ../CommonAPI-D-Bus/src/dbus-patches/*.patch | xargs -n1 patch -p1 -F3 -i
    282 ----
    283 (assuming that _CommonAPI-D-Bus_ is on same folder level as _dbus-1.8.0_)
    284
    285 - Build D-Bus via the CMake command line tool:
    286 -- Open the developer command line for VS2013.
    287 -- Change into root directory of the unpacked D-Bus archive e.g. dbus-1.8.0.
    288 -- Create a new directory dbus-build-dir e.g. +mkdir dbus-build-dir+.
    289 -- Change into this new created directory e.g. +cd dbus-build-dir+.
    290 -- Create the Visual Studio files for building the D-Bus:
    291
    292 ----
    293 cmake -DEXPAT_INCLUDE_DIR="<expat-path>\Source\lib"
    294                 -DEXPAT_LIBRARY="<expat-path>\Bin\libexpat.lib" -G "Visual Studio 12" <DBusSourcenPath>\cmake
    295 ----
    296
    297 Example:
    298 ----
    299 C:\Work\cmake-2.8.12.2-win32-x86\bin\cmake.exe
    300         -DEXPAT_INCLUDE_DIR="C:\Program Files (x86)\Expat 2.1.0\Source\lib"
    301         -DEXPAT_LIBRARY="C:\Program Files (x86)\Expat 2.1.0\Bin\libexpat.lib"
    302         -G "Visual Studio 12" C:\Work\dbus-1.8.0\cmake
    303 ----
    304
    305 The Visual Studio files are created in the directory dbus-build-dir. Open the solution dbus.sln and build all projects. Info for dbus-1.8.0: In file printf.c the #include "test-utils.h" must be changed to #include "test/test-utils.h".
    306
    307 ==== Build CommonAPI
    308
    309 To build now the Windows version with Visual Studio 2013, you can use the solution file CommonAPI-DBus.sln. It is configured to build CommonAPI-D-Bus as a static library.
    310
    311 Before opening the solution file CommonAPI-DBus.sln the following environment variables must be set:
    312
    313 - DBUS_DIR: directory containing the patched D-Bus sources e.g. <path_to_folder>\dbus-1.8.0
    314 - DBUS_BUILD_DIR: directory containing the build DBus e.g. <path_to_folder>\dbus-1.8.0\dbus-build-dir
    315 - COMMONAPI_DIR: directory containing the CommonAPI e.g. <path_to_folder>\CommonAPI
    316
    317 To run the tests, you need to add the location of your built dbus-1d.dll or dbus-1.dll (depending on Debug or Release built) to the PATH environment variable.
    318
    319 ==== Restrictions
    320
    321 - Calling disconnect and later connect on the same DBusConnection somehow damages the libdbus connection. On Linux implementation this all works fine.
    322 - The DBusLoadTest revealed that a number of more than about 50 proxies slows down the dbus communication significantly. That's why we run the DBusLoadTest on windows with just 50 instead of 100 proxies.
    323
    324
    325
    326
    327
    328
    Common API for Dbus tools
    RSS Atom

    转载于:https://www.cnblogs.com/oracleloyal/p/5329639.html

    展开全文
  • 信号cli ... 对于此用例,它具有dbus接口,可用于从任何具有dbus绑定的编程语言发送消息。 安装 您可以自己 ,也可以使用,这些应在Linux,macOS和Windows上运行。 对于Arch Linux 还提供了一个并且还提
  • python-systemd-dbus python包装器,用于systemd _系统和会话管理器dbus接口。 .. systemd: : 基本用法 导入并创建一个manager : >>> from systemd_dbus.manager import Manager >>> manager = Manager() 列出...
  • 基于UOS系统下开发程序时,需要程序以权限的方式去获取系统中的一些信息,这时需要验证权限,而该示例只是一个依靠D-Bus通信来实现的调起权限验证框,而验证权限之后的数据获取需要在服务端通过进程通信的方式传递,...
  • dbus 接口文档

    2012-06-09 21:10:27
    地址:http://dbus.freedesktop.org/doc/api/html/group__DBusMessage.html
    地址:http://dbus.freedesktop.org/doc/api/html/group__DBusMessage.html
    展开全文
  • // 创建QDBusInterface QDBusInterface iface("org.onboard.Onboard", "/org/onboard/Onboard/Keyboard", "org.onboard.Onboard.Keyboard"); if (!iface.isValid()) { qInfo()...
            // 创建QDBusInterface
            QDBusInterface iface("org.onboard.Onboard",
                                 "/org/onboard/Onboard/Keyboard",
                                 "org.onboard.Onboard.Keyboard");
            if (!iface.isValid()) {
                qInfo() << qPrintable(QDBusConnection::sessionBus().lastError().message());
            }
            QDBusReply<void> reply = iface.call("Show");
            if (reply.isValid()) {
                qInfo() << "call org.onboard.Onboard.Keyboard success";
                return;
            }
            qInfo() << "call corg.onboard.Onboard.Keyboard failed" << reply.error();
        });
    

    展开全文
  • 1、工具安装 sudo apt install d-feet 2、在应用中查找,然后打开,即可搜索接口名称,如org.freedesktop.upower
  • 在 session bus 上, 服务名: com.deepin.daeomn.ClipboardManager ,对象路径: /com/deepin/daemon/ClipboardManager,接口名: com.deepin.daemon.ClipboardManager。为了提供便捷调试的手段。 方法 ...
  • 通过mpris丰富的不存在感 用户模态 弹出模态 discordrp-mpris根据您正在播放的音乐或通过 D-Bus界面公开的其他媒体,为Discord客户端提供丰富的。 因此,它仅适用于具有D-Bus的系统,而不适用于Windows。...
  • System76电源管理system76-power是用于管理图形和电源配置文件的实用程序。 集成的图形模式集成的图形控件(续)System76 Power Management system76-power是用于管理图形和电源配置文件的实用程序。...
  • 问题:以前使用dbus接口,都是在不同的进程中使用的,比如:connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);多次调用,没有问题。不过,近日,在同一个进程中加载不同的程序,这些程序都各自调用了...
  • Dbus XmL 接口类型描述

    2019-12-31 10:44:50
    Dbus XmL 接口类型描述 #define a ARRAY //数组 #define b BOOLEAN //布尔值 #define d DOUBLE IEEE //754双精度浮点数754双精度浮点数 #define g SIGNATURE //类型签名 #define i INT32 //32位有符号整数 #...
  • dbus基本接口

    2011-10-29 14:35:02
    * Written by Matthew Johnson <dbus@matthew.ath.cx> * * This code has been released into the Public Domain. * You may do whatever you like with it. */ #include <dbus/dbus.h> #include #include #...
  • QtDBus封装

    2012-11-01 16:41:41
    用QtDBus封装dbus接口,并实现远程调用的demo
  • DBUS及常用接口介绍

    2018-07-04 14:07:05
    1. 概述1.1 DBUS概述 DBUS是一种高级的进程间通信机制。DBUS支持进程间一对一和多对多的对等通信,在多对多的通讯时,需要后台进程的角色去分转消息,当一个进程发消息给另外一个进程时,先发消息到后台进程,再...
  • 一.移植 ...dbus-&gt;expat 二.使用方法,步骤 #define Server_NAME "org.sample.server.Test" 1.创建app g_ipc_server_handle = nmp_ipc_create(Server_NAME); 2.挂接在总线上 2....
  • dbus通信与接口介绍

    2018-06-04 21:19:00
    DBUS是一种高级的进程间通信机制。DBUS支持进程间一对一和多对多的对等通信,在多对多的通讯时,需要后台进程的角色去分转消息,当一个进程发消息给另外一个进程时,先发消息到后台进程,再通过后台进程将信息转发到...
  • dbus基本接口(转)

    2010-08-12 10:50:00
    http://www.haohaoxuexi.com/Institute/Details.php?Id=9896<br /> ... 建立一个dbus连接之后 -- dbus_bus_get(),为这个dbus连接(DbusConnection)起名 -- dbus_bus_request_name(),这个名字将会成为我们在
  • 一般情况下不会直接使用 C API 进行 DBus 的编程,而是使用某种 DBus-binding,但我觉得理解 DBus 的 C API 对完整地理解 DBus 是非常重要的。 虽然 DBus 是用 C 写的,而且本文写的是 C API,但是 DBus 设计中充满...
  • DBus 的 C 编程接口

    2017-03-21 09:50:23
    最近在学 Dbus,不过总是不得其门而入。 大部分资料都讲了很多东西却最终没有让我搞清楚怎么用 DBus,不就是一个 IPC 通信的工具么?就没有一点实用些的资料么?看了很多资料之后还是觉得只见树木不见森林。仔细...
  • Dbus

    2019-12-26 14:09:03
    文章目录DBus三层架构:底层接口层总线层应用封装层 DBus (Desktop Bus) 是一种 IPC 机制, 由 freedesktop.org 项目提供, 用于进程间通信或进程与内核的通信 tips: IPC机制还有 fifo管道, share memory, semaphore,...
  • DBUS

    万次阅读 2011-03-22 16:40:00
    dbus基本接口/** Example low-level D-Bus code.* Written by Matthew Johnson ** This code has been released into the Public Domain.* You may do whatever you like with it.*/#include #inclu
  • dbus

    千次阅读 2018-10-10 09:56:08
    DBUS及常用接口介绍: https://blog.csdn.net/mr_wangning/article/details/60324291 和菜鸟一起学linux之DBUS基础学习记录: https://blog.csdn.net/eastmoon502136/article/details/10044993   ...
  • 1、dbus接口相关的定义 ------> 2、初始化 ------> 3、发送dbus信号 ------> 4、接收dbus信号 ------> 5、需要双方协商的dbus配置 一、引言 根据前一篇Linux驱动学习–dbus通讯分析(结合源码分析),本...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 6,706
精华内容 2,682
关键字:

dbus接口