Skip to content

HybridOS2/HBDBus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HBDBus

HBDBus is the data bus for device side of HybridOS.

Introduction

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:

  1. HBDBus server, an executable program which runs as a daemon in the system.
  2. HBDBus cmdline, an executable program which provides an interactive command line program for test and debugging.
  3. 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

Dependencies

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.

Current Status

  • May. 2023: Version 2.0.
  • Jan. 2021: Version 1.0.
  • Dec. 2020: First release (version 0.9).
  • Oct. 2020: Skeleton of source code.

Build HBDBus for Standalone Use

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

Usage

After building HBDBus, there will be two executables and one script:

  1. hbdbusd, located in the sbin/ directory in the root of your building tree. This is the daemon program of HBDBus system.
  2. hbdbuscl, located in the bin/ directory in the root of your building tree. This is a simple command line program for interacting with other programs connecting to HBDBus.
  3. hbdtest.hvml, located in the hvml/ 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)

TODO List

  • Version 2.2
    1. Support for WebSocket in libhbdbus.
    2. Support for plugins of builtin endpoints.
    3. Unit tests.

Copying

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/.

Tradmarks

  1. 飛漫

飛漫

  1. FMSoft

FMSoft

  1. 合璧

合璧 合璧 合壁

  1. HybridOS

HybridOS

  1. HybridRun

HybridRun

  1. MiniGUI

MiniGUI

  1. xGUI

xGUI

  1. miniStudio

miniStudio

  1. HVML

HVML

  1. 呼噜猫

呼噜猫

  1. Purring Cat

Purring Cat

  1. PurC

PurC

About

The data bus for HybridOS based on HVML PurC.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages