HBDBus is the data bus for device side of HybridOS.
In HybridOS, an important design idea is always implemented: data-driven. Regardless of whether it is a single app scenario or multiple apps scenarios, HBDBus will act as the link between HybridOS app and the underlying functional modules; and even in the future, it will become the link between different device nodes in the LAN.
Some ideas of HBDBus come from OpenWRT's uBus, such as passing data in JSON format. But compared to uBus, HBDBus has the following important improvements:
- Two types of underlying connection channels are provided: local Unix Domain Socket and Web Socket, so that modules developed in different programming languages can be easily connected to HBDBus.
- Providing a basic security mechanism to determine whether an application or a remote node can subscribe to a specific event or call a specific procedure.
- Considering that in the future, HBDBus can provide services to other IoT device nodes in the local area network through Web Socket, we include host name information when subscribing to events and calling remote procedures.
- The redesigned HBDBus protocol can avoid deadlock when the same app plays different roles.
HBDBus includes the following three components:
- HBDBus server, an executable program which runs as a daemon in the system.
- HBDBus cmdline, an executable program which provides an interactive command line program for test and debugging.
- HBDBus library, an library which provides some APIs for clients to use HBDBus easily.
For more information, please refer to:
https://github.com/HybridOS2/Documents/blob/master/designs/hybridos-design-data-bus-zh.md
HBDBus depends on the following libraries:
- PurC provides support for JSON and some general utilities.
- glib provides data structure handling for C language.
- OpenSSL (optional) provides support for secure WebSocket connections.
- May. 2023: Version 2.0.
- Jan. 2021: Version 1.0.
- Dec. 2020: First release (version 0.9).
- Oct. 2020: Skeleton of source code.
To build HBDBus for your own usage on a generic Linux box without
the app management of HybridOS, use the following options for cmake
:
$ cmake <directory_to_source_code> -DPORT=Linux
After building HBDBus, there will be two executables and one script:
hbdbusd
, located in thesbin/
directory in the root of your building tree. This is the daemon program of HBDBus system.hbdbuscl
, located in thebin/
directory in the root of your building tree. This is a simple command line program for interacting with other programs connecting to HBDBus.hbdtest.hvml
, located in thehvml/
directory in the root of your building tree. This is a simple HVML program for demonstrating use of HVML to interacting with other programs connecting to HBDBus.
To start HBDBus, you need to run hbdbusd
first. Type the following command
in the root of your buidling tree:
$ sbin/hbdbusd
After starting hbdbusd
, you can run hbdbuscl
or the HVML script hbdtest.hvml
to play with HBDBus.
For the detailed usage, please run hbdbusd
or hbdbuscl
with -h
option.
For the description of APIs providing by HBDBus, please refer to:
Design of HybridOS Data Bus (Chinese)
- Version 2.2
- Support for WebSocket in
libhbdbus
. - Support for plugins of builtin endpoints.
- Unit tests.
- Support for WebSocket in
Copyright (C) 2020 ~ 2023 FMSoft https://www.fmsoft.cn
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 http://www.gnu.org/licenses/.
- 飛漫
- FMSoft
- 合璧
- HybridOS
- HybridRun
- MiniGUI
- xGUI
- miniStudio
- HVML
- 呼噜猫
- Purring Cat
- PurC