Home

Awesome

<h1 align="center" style="display: block; font-size: 2.5em; font-weight: bold; margin-block-start: 1em; margin-block-end: 1em;"> <a name="logo" href="https://www.aregtech.com"><img align="center" src="https://raw.githubusercontent.com/aregtech/areg-sdk/master/docs/img/areg-sdk-1280x360px-logo.png" alt="AREG SDK Home" style="width:100%;height:100%"/></a> <br /><br /><strong>AREG SDK</strong> </h1>

Discover AREG - an advanced framework for real-time communication in mist- and fog- network environments.

Latest release GitHub commits Stars Fork Watchers Wiki Pages


<!-- markdownlint-disable -->

Project Status

<table class="no-border"> <tr> <td><a href="https://github.com/aregtech/areg-sdk/actions/workflows/cmake.yml" alt="CMake"><img src="https://github.com/aregtech/areg-sdk/actions/workflows/cmake.yml/badge.svg" alt="CMake build"/></a></td> <td><a href="https://github.com/aregtech/areg-sdk/actions/workflows/msbuild.yml" alt="MS Build"><img src="https://github.com/aregtech/areg-sdk/actions/workflows/msbuild.yml/badge.svg" alt="MS Build"/></a></td> <td><a href="https://github.com/aregtech/areg-sdk/actions/workflows/codeql-analysis.yml" alt="CodeQL"><img src="https://github.com/aregtech/areg-sdk/actions/workflows/codeql-analysis.yml/badge.svg" alt="CodeQL"/></a></td> </tr> <tr> <td><img src="https://img.shields.io/badge/Solution-C++17-blue.svg?style=flat&logo=c%2B%2B&logoColor=b0c0c0&labelColor=363D44" alt="C++ solution"/></td> <td><img src="https://img.shields.io/badge/OS-linux%20%7C%20windows-blue??style=flat&logo=Linux&logoColor=b0c0c0&labelColor=363D44" alt="Operating systems"/></td> <td colspan="2"><img src="https://img.shields.io/badge/CPU-x86%20%7C%20x86__64%20%7C%20arm%20%7C%20aarch64-blue?style=flat&logo=amd&logoColor=b0c0c0&labelColor=363D44" alt="CPU Architect"/></td> </tr> </table>

Introduction

AREG (Automated Real-time Event Grid) is an advanced communication framework designed for seamless data transmission in IoT fog- and mist-network environments. Lightweight and platform-agnostic, AREG enables efficient, automated communication by combining Client-Server and Publish-Subscribe models. By adopting an interface-centric approach, AREG facilitates the creation of service grids, where multiple devices and software nodes function collaboratively as distributed micro-servers and clients, ensuring reliable real-time data exchange across a network of connected nodes.


Table of contents

[!IMPORTANT] For full technical guidance of building and using AREG SDK, see the following documents.


Motivation

Traditionally, devices act as connected clients to stream data to the cloud or fog servers for further processing.

<div align="center"><a href="https://github.com/aregtech/areg-sdk/blob/master/docs/img/mist-network.png"><img src="https://raw.githubusercontent.com/aregtech/areg-sdk/master/docs/img/mist-network.png" alt="Diagram showing IoT-to-Cloud (Nebula) network connections" style="width:70%;height:70%"/></a></div>

As data is generated and collected at the edge of the network (mist network), there is a growing need to redefine the role of connected Things and enable network-accessible Public Services on the edge device, thereby extending the Cloud capabilities to the extreme edge. This approach provides a robust foundation for solutions like:

<div align="right"><kbd><a href="#table-of-contents">↑ Back to top ↑</a></kbd></div>

Interface-centricity

At the core of AREG is ORPC (Object Remote Procedure Call), which targets interfaces on objects. This allows AREG to establish a service mesh or service grid where applications expose reusable services. Clients, without knowledge of the server's network location, can request services seamlessly via method invocation.

<div align="center"><a href="https://github.com/aregtech/areg-sdk/blob/master/docs/img/interface-centric.png"><img src="https://raw.githubusercontent.com/aregtech/areg-sdk/master/docs/img/interface-centric.png" alt="Diagram showing multiprocess communication" style="width:50%;height:50%"/></a></div>

This interface-driven Object RPC model mirrors object-oriented programming principles and is flexible in managing multiple object instances. It imposes no protocol limitations and supports bi-directional communication to ensure seamless messaging between connected software nodes. In this model:

AREG's design integrates Client-Server (Request-Reply) and Publish-Subscribe (PubSub) models, enabling it to support both action- and data-centric communication.

<div align="right"><kbd><a href="#table-of-contents">↑ Back to top ↑</a></kbd></div>

More than Embedded

The architecture of AREG is ideal for embedded applications, but its capabilities extend far beyond. AREG offers distributed and scalable solutions for multithreading, multiprocessing, and internet communications, making it a versatile choice for a wide range of applications. Services in AREG are categorized into three types: Local, Public, and Internet, enabling flexible and efficient remote communication across diverse environments.

<div align="center"><a href="https://github.com/aregtech/areg-sdk/blob/master/docs/img/areg-services.png"><img src="https://raw.githubusercontent.com/aregtech/areg-sdk/master/docs/img/areg-services.png" alt="Diagram showing Services and AREG Framework message handling" style="width:70%;height:70%"/></a></div>

[!NOTE] AREG currently supports Local (multithreading) and Public (multiprocessing) services.

The fault-tolerant design of AREG offers key advantages, such as:

<div align="right"><kbd><a href="#table-of-contents">↑ Back to top ↑</a></kbd></div>

Composition of AREG SDK

The AREG SDK consists of several modules to streamline distributed, real-time applications development:

[!NOTE] The UI tool Lusan is currently under the development. It is supposed to provide multiple features like Service Interface design, log viewing, and runtime testing. We call to join this open source project to develop the tool.

<div align="right"><kbd><a href="#table-of-contents">↑ Back to top ↑</a></kbd></div>

Getting Started: Clone and Build the AREG SDK

Cloning Sources

To obtain the AREG SDK source codes, use the following command:

git clone https://github.com/aregtech/areg-sdk.git

Build Instructions

The AREG SDK is written in C++17, supports multiple platforms, processors and compilers:

CompilerPlatformsToolsAPICPU Architecture
GNULinux, macOSCMakePOSIXx86, x86_64, ARM, AARCH64
ClangLinux, WindowsCMake, MSVSPOSIX, Win32x86, x86_64
MSVCWindowsCMake, MSVSWin32x86, x86_64
Cygwin GNUWindowsCMakePOSIXx86, x86_64

For detailed build instructions, check the Building AREG SDK with CMake or Building the AREG SDK with Microsoft Visual Studio and MSBuild pages.

[!NOTE] Other POSIX-compliant operating systems and compilers have not been tested yet.

Build with CMake

To compile the AREG SDK using CMake, follow these steps:

cmake -B ./build
cmake --build ./build -j 20

[!TIP] For custom builds and cross-compiling see Building AREG SDK with CMake.

Build with Microsoft Visual Studio

Open areg-sdk.sln file in Microsoft Visual Studio and build the solution, or navigate to the root directory of the project and run build with MSBuild:

MSBuild ./areg-sdk.sln

For further details on customizing builds, visit the Building the AREG SDK with Microsoft Visual Studio and MSBuild document.

Additional Build Options

[!NOTE] This chapter focuses on building AREG and examples using Microsoft Visual Studio and Visual Studio Code. The other IDEs are currently not in the focus.

<div align="right"><kbd><a href="#table-of-contents">↑ Back to top ↑</a></kbd></div>

Integration and Development

For a practical example of building real-time, distributed systems using AREG SDK, check out the AREG SDK Demo project, which includes implementations of multitasking applications for embedded, IoT mist- and fog-systems.

AREG SDK Integration Methods

There are three ways to integrate the AREG SDK into your project:

1. Integrate by Fetching sources

Add the following script to your CMakeLists.txt to integrate AREG SDK:

find_package(areg CONFIG)
if (NOT areg_FOUND)
    include(FetchContent)
    FetchContent_Declare(
        areg-sdk
        GIT_REPOSITORY https://github.com/aregtech/areg-sdk.git
        GIT_TAG "master"
    )
    FetchContent_MakeAvailable(areg-sdk)
    set(AREG_SDK_ROOT "${areg-sdk_SOURCE_DIR}")
    include_directories("${AREG_SDK_ROOT}/framework")
endif()

include("${AREG_SDK_ROOT}/areg.cmake")

This either finds or fetches the AREG SDK components from master branch. See the Building AREG SDK with CMake page for more details.

2. Integrate as a project submodule

  1. Add areg-sdk as a Git submodule in your project.
  2. Include the *.vcxproj files from <areg-sdk>/framework in your solution.
  3. Link your project with the areg library and set project dependencies.

For full details, see the Building the AREG SDK with Microsoft Visual Studio and MSBuild.

3. Integrate the areg Package (vcpkg)

[!IMPORTANT] Starting with AREG SDK 2.0, you can integrate it using the vcpkg package manager.

Before starting, visit the official vcpkg repository to clone and install the vcpkg package manager tool in your PC.

  1. Install and integrate the areg package: Example of the AREG SDK components, headers and its dependencies installation under Linux:

    ./vcpkg install areg:linux-64
    ./vcpkg integrate install
    
  2. Integrate with CMake: Add the following script to your CMakeLists.txt (replace <example> with real target):

    find_package(areg CONFIG REQUIRED)
    target_link_libraries(<example> PRIVATE areg::areg)
    

    Use vcpkg toolchain file (<vcpkg-root> is the root path of vcpkg) to configure and build the project:

    cmake -B ./build -DCMAKE_TOOLCHAIN_FILE=<vcpkg-root>/scripts/buildsystems/vcpkg.cmake
    cmake --build ./build -j 20
    
  3. Integrate with Microsoft Visual Studio: In Microsoft Visual Studio, there is no need to add AREG SDK projects in the solution file. Develop projects and make sure to link areg library with binaries either in Project Properties or by adding this line of code:

    #pragma comment(lib, "areg")
    

For details of installing and using areg package, see the appropriate integrate areg package document.

Service Creation and Development

Follow the “Hello Service!” tutorial for step-by-step instructions. Generated service interface files integrate with CMake or Visual Studio projects. Service Providers extend xxxStub, and Service Consumers extend xxxClientBase.

Example: Application Model Setup

When developing Service Provider and Service Consumer components, developers can easily determine whether to run components in the same process (multithreading) or in separate processes (multiprocessing) for optimal performance in real-time applications by defining the Application Model. Below is an example of setting up a model where the Service Provider and Service Consumer components run in the same process, but on different threads.

BEGIN_MODEL("ApplicationModel")
    // Provider Thread
    BEGIN_REGISTER_THREAD("ProviderThread", NECommon::WATCHDOG_IGNORE)
        BEGIN_REGISTER_COMPONENT("ServiceProvider", ServiceComponent)
            REGISTER_IMPLEMENT_SERVICE(NEHelloService::ServiceName, NEHelloService::InterfaceVersion)
        END_REGISTER_COMPONENT("ServiceProvider")
    END_REGISTER_THREAD("ProviderThread")
        
    // Consumer Thread
    BEGIN_REGISTER_THREAD("ConsumerThread", NECommon::WATCHDOG_IGNORE)
        BEGIN_REGISTER_COMPONENT("ServiceConsumer", ClientComponent)
            REGISTER_DEPENDENCY("ServiceProvider")
        END_REGISTER_COMPONENT("ServiceConsumer")
    END_REGISTER_THREAD("ConsumerThread")
END_MODEL("ApplicationModel")

int main(void)
{
    Application::initApplication();
    Application::loadModel("ApplicationModel");
    Application::waitAppQuit();
    Application::unloadModel("ApplicationModel");
    Application::releaseApplication();
    return 0;
}

In this example:

You can also set up multiprocess applications using same components and changing model. As a practical example, follow projects in the 00_helloservice directory.

[!TIP] Learn how AREG SDK simplifies the creation of Service Providers and Consumers, supporting both multithreading and multiprocessing for real-time, distributed applications. Visit examples to see the list of demonstrated applications and features of the AREG communication engine.

Multicast Router and Log Collector

Both mcrouter and logcollector are essential components for communication and log collection. Configuration templates for the multicast router and log collector services are provided in the areg.init file. Both processes are designed to run as console applications or as Operating System managed services.

For in-depth details of building and using these applications, review the descriptions in Multicast Router Service and Log Collector Service pages. Discover how the AREG SDK's Multicast Router and Log Collector streamline communication and logging in edge computing and real-time data transfer systems.

<div align="right"><kbd><a href="#table-of-contents">↑ Back to top ↑</a></kbd></div>

This version is strong, but a few minor adjustments can improve flow, consistency, and readability. Here's a refined version:


Examples

The AREG SDK offers hands-on examples demonstrating Multithreading and Multiprocessing applications, Client-Server and Publish-Subscribe models, Object Remote Procedure Call (Object RPC) and Inter-Process Communication (IPC), featured Finite-State Machines (FSM) creation, and more. Each project highlights key features that facilitate efficient development of distributed services.

Some Featured Examples:

  1. 00_helloservice: Master service creation across single-threaded, multi-threaded, and multi-process environments, showcasing AREG's intuitive, interface-driven approach.

  2. 04_logging: Configure and manage logging to track application behavior, aiding debugging, performance analysis, and log management.

  3. 16_pubfsm: Build and control a Finite-State Machine (FSM) with AREG's Timers and Events for smooth state transitions.

  4. 19_pubwatchdog: Implement a watchdog to monitor thread activity, restart unresponsive threads, and notify components as needed.

  5. 24_pubsubmulti: Explore the PubSub model, which reduces data traffic by delivering only relevant updates.

For the full list of examples and additional documentation, visit AREG SDK Examples.

Accelerate your multithreading, multiprocessing, embedded, IoT edge, and event-driven development with these examples. For technical inquiries, please contact us.

<div align="right"><kbd><a href="#table-of-contents">↑ Back to top ↑</a></kbd></div>

Pipeline and Roadmap

The AREG SDK is continuously evolving to help developers create complex applications more efficiently on Desktop, Embedded, and IoT edge devices. It aims to reduce development time by 30-50% while ensuring automation, reliability and flexibility.

Upcoming Features:

Tools in Development:

The tools are actively being developed in the AREG SDK Tools repository.

<div align="right"><kbd><a href="#table-of-contents">↑ Back to top ↑</a></kbd></div>

Use Cases and Benefits

The AREG SDK enables efficient multithreading and multiprocessing communication, offering full support for edge computing and fog computing use cases that demand efficient communication between devices and services in real-time. It is ideal for developing:

Explore real-world use cases and examples to learn more about its applications.

<div align="right"><kbd><a href="#table-of-contents">↑ Back to top ↑</a></kbd></div>

License

The AREG SDK is available under the Apache License Version 2.0, a permissive free open-source license. For developers or businesses that need commercial licensing, this option is available and includes:

For more information on commercial licensing, commercial support, trainings, or partnership inquiries, visit the Aregtech website or contact us at info[at]aregtech[dot]com.

<div align="right"><kbd><a href="#table-of-contents">↑ Back to top ↑</a></kbd></div>

Call to action

We encourage the developer community to get involved and contribute to the growth of the AREG SDK. Join AREG SDK community and collaborate with AREG developers. Here's how you can help:

Lastly, help us grow the AREG SDK community by giving a star on GitHub! Whether you're working on embedded applications, multiprocessing and multithreading applications, real-time data transfer, IoT applications, or microservices architecture, your support helps us continue to improve this cutting-edge communication framework.

<div align="right"><kbd><a href="#table-of-contents">↑ Back to top ↑</a></kbd></div>

Thank you all!

Special thanks to all contributors and supporters that starred this repository.

Our amazing contributors:

Contributors for @aregtech/areg-sdk

Our supportive stargazers:

Stargazers of @aregtech/areg-sdk repo

Do you like this project? Join us or give a ⭐.<br/> Do you have an idea or found a bug? Please open an issue or start a discussion.

<div align="right"><kbd><a href="#table-of-contents">↑ Back to top ↑</a></kbd></div>

Follow us at<br /> X (formerly Twitter) Follow Follow us on LinkedIn Join the chat at https://gitter.im/areg-sdk/community


Share the project link with your network on social media.

<a href="https://www.reddit.com/submit?url=https%3A%2F%2Fgithub.com%2Faregtech%2Fareg-sdk&title=Awesome%20communcation%20engine!" target="_blank"><img src="https://img.shields.io/twitter/url?label=Reddit&logo=Reddit&style=social&url=https%3A%2F%2Fgithub.com%2Faregtech%2Fareg-sdk" alt="Share on Reddit"/></a>  <a href="https://www.linkedin.com/shareArticle?mini=true&url=https%3A//github.com/aregtech/areg-sdk" target="_blank"><img src="https://img.shields.io/twitter/url?label=LinkedIn&logo=LinkedIn&style=social&url=https%3A%2F%2Fgithub.com%2Faregtech%2Fareg-sdk" alt="Share on LinkedIn"/></a>  <a href="https://x.com/intent/tweet?text=%23AREG%20%23realtime%20communication%20engine%20for%20%23embedded%20and%20%23IoT%0A%0Ahttps%3A//github.com/aregtech/areg-sdk" target="_blank"><img src="https://img.shields.io/twitter/url?label=Twitter&logo=X&style=social&url=https%3A%2F%2Fgithub.com%2Faregtech%2Fareg-sdk" alt="Shared on X"/></a>  <a href="https://www.facebook.com/sharer/sharer.php?u=https%3A//github.com/aregtech/areg-sdk" target="_blank"><img src="https://img.shields.io/twitter/url?label=Facebook&logo=Facebook&style=social&url=https%3A%2F%2Fgithub.com%2Faregtech%2Fareg-sdk" alt="Share on Facebook"/></a>  <a href="https://t.me/share/url?text=Awesome%20communication%20engine!&url=https%3A%2F%2Fgithub.com%2Faregtech%2Fareg-sdk" target="_blank"><img src="https://img.shields.io/twitter/url?label=Telegram&logo=Telegram&style=social&url=https%3A%2F%2Fgithub.com%2Faregtech%2Fareg-sdk" alt="Share on Telegram"/></a>  <a href="https://wa.me/?text=Awesome%20communication%20engine!%5Cn%20https%3A%2F%2Fgithub.com%2Faregtech%2Fareg-sdk" target="_blank"><img src="https://img.shields.io/twitter/url?label=Whatsapp&logo=Whatsapp&style=social&url=https%3A%2F%2Fgithub.com%2Faregtech%2Fareg-sdk" alt="Share on Whatsapp"/></a>  <a href="mailto:?subject=Awesome%20communication%20engine&body=Checkout%20this%20awesome%20communication%20engine%3A%0Ahttps%3A//github.com/aregtech/areg-sdk%0A" target="_blank"><img src="https://img.shields.io/twitter/url?label=GMail&logo=GMail&style=social&url=https%3A%2F%2Fgithub.com%2Faregtech%2Fareg-sdk"/></a>

<!-- markdownlint-enable -->