├── demo ├── 10_locsvc │ ├── locservice │ │ ├── CMakeLists.txt │ │ └── src │ │ │ ├── CMakeLists.txt │ │ │ ├── ServicingComponent.cpp │ │ │ └── ServiceClient.cpp │ ├── generated │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── private │ │ │ └── CMakeLists.txt │ ├── CMakeLists.txt │ ├── res │ │ ├── generate.sh │ │ ├── generate.bat │ │ └── HelloWorld.siml │ ├── ReadMe.md │ ├── 10_locservice.vcxproj.filters │ ├── 10_generated.vcxproj.filters │ ├── 10_locservice.vcxproj │ └── 10_generated.vcxproj ├── 12_pubsvc │ ├── pubclient │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── CMakeLists.txt │ ├── pubservice │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── CMakeLists.txt │ ├── generated │ │ ├── CMakeLists.txt │ │ └── src │ │ │ ├── private │ │ │ └── CMakeLists.txt │ │ │ └── NECommon.hpp │ ├── res │ │ ├── generate.sh │ │ ├── generate.bat │ │ └── HelloWorld.siml │ ├── CMakeLists.txt │ ├── 12_pubclient.vcxproj.filters │ ├── 12_pubservice.vcxproj.filters │ ├── ReadMe.md │ ├── 12_pubclient.vcxproj │ ├── 12_pubservice.vcxproj │ ├── 12_generated.vcxproj.filters │ └── 12_generated.vcxproj ├── 16_pubfsm │ ├── pubclient │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── CMakeLists.txt │ ├── pubservice │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── CMakeLists.txt │ ├── generated │ │ ├── CMakeLists.txt │ │ └── src │ │ │ ├── private │ │ │ ├── CMakeLists.txt │ │ │ ├── IETrafficLightActionHandler.cpp │ │ │ └── NETrafficLightFSM.cpp │ │ │ └── NECommon.hpp │ ├── res │ │ ├── generate.sh │ │ ├── generate.bat │ │ └── PowerManager.siml │ ├── CMakeLists.txt │ ├── 16_pubclient.vcxproj.filters │ ├── 16_pubservice.vcxproj.filters │ ├── 16_pubclient.vcxproj │ ├── 16_pubservice.vcxproj │ └── ReadMe.md ├── 17_winchat │ ├── generated │ │ ├── CMakeLists.txt │ │ └── private │ │ │ └── CMakeLists.txt │ ├── register │ │ ├── services │ │ │ └── CMakeLists.txt │ │ ├── res │ │ │ ├── register.ico │ │ │ ├── register.rc2 │ │ │ ├── CMakeLists.txt │ │ │ ├── stdafx.cpp │ │ │ ├── targetver.h │ │ │ ├── resource.h │ │ │ └── stdafx.h │ │ ├── ui │ │ │ ├── CMakeLists.txt │ │ │ ├── PageBrokerSetup.hpp │ │ │ ├── CentralDialog.hpp │ │ │ └── PageConnections.hpp │ │ ├── CMakeLists.txt │ │ ├── NECentralApp.cpp │ │ ├── NECentralApp.hpp │ │ └── CentralApp.hpp │ ├── chatter │ │ ├── res │ │ │ ├── chatter.ico │ │ │ ├── chatter.rc2 │ │ │ ├── CMakeLists.txt │ │ │ ├── stdafx.cpp │ │ │ ├── targetver.h │ │ │ ├── resource.h │ │ │ └── stdafx.h │ │ ├── CMakeLists.txt │ │ ├── ui │ │ │ ├── CMakeLists.txt │ │ │ ├── PageNetworkSetup.hpp │ │ │ ├── PageConnections.hpp │ │ │ └── PageMessaging.hpp │ │ ├── services │ │ │ ├── CMakeLists.txt │ │ │ ├── DirectConnectionClient.cpp │ │ │ ├── ConnectionService.cpp │ │ │ ├── NetworkSetup.cpp │ │ │ ├── ConnectionService.hpp │ │ │ ├── ChatParticipantService.cpp │ │ │ ├── NetworkSetup.hpp │ │ │ ├── ChatParticipantService.hpp │ │ │ └── ConnectionList.cpp │ │ ├── DistrbutedApp.hpp │ │ ├── NEDistributedApp.hpp │ │ └── NEDistributedApp.cpp │ ├── res │ │ ├── generate.sh │ │ └── generate.bat │ ├── ReadMe.md │ ├── CMakeLists.txt │ └── 17_register.vcxproj.filters ├── 19_pubwatchdog │ ├── pubclient │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── CMakeLists.txt │ ├── pubservice │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── CMakeLists.txt │ ├── generated │ │ ├── CMakeLists.txt │ │ └── src │ │ │ ├── private │ │ │ └── CMakeLists.txt │ │ │ └── NECommon.hpp │ ├── res │ │ ├── generate.sh │ │ └── generate.bat │ ├── CMakeLists.txt │ ├── 19_pubclient.vcxproj.filters │ ├── 19_pubservice.vcxproj.filters │ ├── ReadMe.md │ ├── 19_pubclient.vcxproj │ ├── 19_pubservice.vcxproj │ ├── 19_generated.vcxproj.filters │ └── 19_generated.vcxproj ├── 21_pubunblock │ ├── pubclient │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── CMakeLists.txt │ ├── pubservice │ │ ├── CMakeLists.txt │ │ └── src │ │ │ ├── CMakeLists.txt │ │ │ └── main.cpp │ ├── generated │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── private │ │ │ └── CMakeLists.txt │ ├── res │ │ ├── generate.sh │ │ └── generate.bat │ ├── CMakeLists.txt │ ├── 21_pubclient.vcxproj.filters │ ├── 21_pubservice.vcxproj.filters │ ├── ReadMe.md │ ├── 21_pubclient.vcxproj │ ├── 21_pubservice.vcxproj │ ├── 21_generated.vcxproj.filters │ └── 21_generated.vcxproj ├── 01_hello │ ├── src │ │ ├── CMakeLists.txt │ │ └── main.cpp │ ├── CMakeLists.txt │ ├── ReadMe.md │ ├── 01_hello.vcxproj.filters │ └── 01_hello.vcxproj ├── 04_trace │ ├── src │ │ └── CMakeLists.txt │ ├── CMakeLists.txt │ ├── ReadMe.md │ ├── 04_trace.vcxproj.filters │ └── 04_trace.vcxproj ├── 05_timer │ ├── src │ │ └── CMakeLists.txt │ ├── CMakeLists.txt │ ├── ReadMe.md │ ├── 05_timer.vcxproj.filters │ └── 05_timer.vcxproj ├── CMakeLists.txt └── README.md ├── .gitmodules ├── .gitignore ├── LICENSE ├── CMakeLists.txt ├── README.md └── .github └── workflows └── msbuild.yml /demo/10_locsvc/locservice/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIR("src") 2 | -------------------------------------------------------------------------------- /demo/12_pubsvc/pubclient/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIR("src") 2 | -------------------------------------------------------------------------------- /demo/12_pubsvc/pubservice/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIR("src") 2 | -------------------------------------------------------------------------------- /demo/16_pubfsm/pubclient/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIR("src") 2 | -------------------------------------------------------------------------------- /demo/16_pubfsm/pubservice/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIR("src") 2 | -------------------------------------------------------------------------------- /demo/17_winchat/generated/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIR("private") 2 | -------------------------------------------------------------------------------- /demo/19_pubwatchdog/pubclient/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIR("src") 2 | -------------------------------------------------------------------------------- /demo/19_pubwatchdog/pubservice/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIR("src") 2 | -------------------------------------------------------------------------------- /demo/21_pubunblock/pubclient/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIR("src") 2 | -------------------------------------------------------------------------------- /demo/21_pubunblock/pubservice/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIR("src") 2 | -------------------------------------------------------------------------------- /demo/10_locsvc/generated/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIR("src/private") 2 | -------------------------------------------------------------------------------- /demo/12_pubsvc/generated/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIR("src/private") 2 | -------------------------------------------------------------------------------- /demo/16_pubfsm/generated/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIR("src/private") 2 | -------------------------------------------------------------------------------- /demo/19_pubwatchdog/generated/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIR("src/private") 2 | -------------------------------------------------------------------------------- /demo/21_pubunblock/generated/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIR("src/private") 2 | -------------------------------------------------------------------------------- /demo/01_hello/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | setSources(project_sources 2 | main.cpp 3 | ) 4 | -------------------------------------------------------------------------------- /demo/04_trace/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | setSources(project_sources 2 | main.cpp 3 | ) 4 | -------------------------------------------------------------------------------- /demo/05_timer/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | setSources(project_sources 2 | main.cpp 3 | ) 4 | -------------------------------------------------------------------------------- /demo/17_winchat/register/services/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SOURCES(project_sources 2 | ConnectionManager.cpp 3 | ) 4 | -------------------------------------------------------------------------------- /demo/01_hello/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | DECLARE_PROJECT_EX(01_hello hello "src") 2 | addExecutable(${project_hello} "${hello_src}") 3 | -------------------------------------------------------------------------------- /demo/04_trace/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | DECLARE_PROJECT_EX(04_trace trace "src") 2 | addExecutable(${project_trace} "${trace_src}") 3 | -------------------------------------------------------------------------------- /demo/05_timer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | DECLARE_PROJECT_EX(05_timer timer "src") 2 | addExecutable(${project_timer} "${timer_src}") 3 | -------------------------------------------------------------------------------- /demo/12_pubsvc/pubclient/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SOURCES(project_sources 2 | ServiceClient.cpp 3 | main.cpp 4 | ) 5 | -------------------------------------------------------------------------------- /demo/21_pubunblock/pubclient/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SOURCES(project_sources 2 | ServiceClient.cpp 3 | main.cpp 4 | ) 5 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "thirdparty/areg-sdk"] 2 | path = thirdparty/areg-sdk 3 | url = https://github.com/aregtech/areg-sdk.git 4 | -------------------------------------------------------------------------------- /demo/12_pubsvc/pubservice/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SOURCES(project_sources 2 | ServicingComponent.cpp 3 | main.cpp 4 | ) 5 | -------------------------------------------------------------------------------- /demo/16_pubfsm/pubclient/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SOURCES(project_sources 2 | TrafficLightClient.cpp 3 | main.cpp 4 | ) 5 | -------------------------------------------------------------------------------- /demo/19_pubwatchdog/pubclient/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SOURCES(project_sources 2 | ServiceClient.cpp 3 | main.cpp 4 | ) 5 | -------------------------------------------------------------------------------- /demo/21_pubunblock/pubservice/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SOURCES(project_sources 2 | ServiceComponent.cpp 3 | main.cpp 4 | ) 5 | -------------------------------------------------------------------------------- /demo/19_pubwatchdog/pubservice/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SOURCES(project_sources 2 | ServicingComponent.cpp 3 | main.cpp 4 | ) 5 | -------------------------------------------------------------------------------- /demo/17_winchat/chatter/res/chatter.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aregtech/cpp-action-workflows/HEAD/demo/17_winchat/chatter/res/chatter.ico -------------------------------------------------------------------------------- /demo/17_winchat/chatter/res/chatter.rc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aregtech/cpp-action-workflows/HEAD/demo/17_winchat/chatter/res/chatter.rc2 -------------------------------------------------------------------------------- /demo/17_winchat/register/res/register.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aregtech/cpp-action-workflows/HEAD/demo/17_winchat/register/res/register.ico -------------------------------------------------------------------------------- /demo/17_winchat/register/res/register.rc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aregtech/cpp-action-workflows/HEAD/demo/17_winchat/register/res/register.rc2 -------------------------------------------------------------------------------- /demo/10_locsvc/locservice/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | setSources(project_sources 2 | main.cpp 3 | ServicingComponent.cpp 4 | ServiceClient.cpp 5 | ) 6 | -------------------------------------------------------------------------------- /demo/17_winchat/register/ui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SOURCES(project_sources 2 | CentralDialog.cpp 3 | PageBrokerSetup.cpp 4 | PageConnections.cpp 5 | ) 6 | -------------------------------------------------------------------------------- /demo/16_pubfsm/pubservice/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SOURCES(project_sources 2 | PowerControllerClient.cpp 3 | TrafficLightService.cpp 4 | main.cpp 5 | ) 6 | -------------------------------------------------------------------------------- /demo/17_winchat/register/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SOURCES(project_sources 2 | CentralApp.cpp 3 | NECentralApp.cpp 4 | ) 5 | 6 | INCLUDE_DIR("res") 7 | INCLUDE_DIR("services") 8 | INCLUDE_DIR("ui") 9 | -------------------------------------------------------------------------------- /demo/17_winchat/chatter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SOURCES(project_sources 2 | DistrbutedApp.cpp 3 | NEDistributedApp.cpp 4 | ) 5 | 6 | INCLUDE_DIR("res") 7 | INCLUDE_DIR("services") 8 | INCLUDE_DIR("ui") 9 | -------------------------------------------------------------------------------- /demo/17_winchat/chatter/res/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | setSources(chatter_resources 2 | chatter.rc 3 | ) 4 | 5 | ADD_SOURCES(project_sources 6 | resource.h 7 | stdafx.cpp 8 | targetver.h 9 | ) 10 | -------------------------------------------------------------------------------- /demo/17_winchat/chatter/ui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SOURCES(project_sources 2 | DistributedDialog.cpp 3 | PageChat.cpp 4 | PageConnections.cpp 5 | PageMessaging.cpp 6 | PageNetworkSetup.cpp 7 | ) 8 | -------------------------------------------------------------------------------- /demo/17_winchat/register/res/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | setSources(register_resources 2 | register.rc 3 | ) 4 | 5 | ADD_SOURCES(project_sources 6 | resource.h 7 | stdafx.cpp 8 | targetver.h 9 | ) 10 | 11 | -------------------------------------------------------------------------------- /demo/10_locsvc/generated/src/private/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | setSources(project_sources 2 | HelloWorldClientBase.cpp 3 | HelloWorldEvents.cpp 4 | HelloWorldProxy.cpp 5 | HelloWorldStub.cpp 6 | NEHelloWorld.cpp 7 | ) 8 | -------------------------------------------------------------------------------- /demo/12_pubsvc/generated/src/private/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SOURCES(project_sources 2 | HelloWorldClientBase.cpp 3 | HelloWorldEvents.cpp 4 | HelloWorldProxy.cpp 5 | HelloWorldStub.cpp 6 | NEHelloWorld.cpp 7 | ) 8 | -------------------------------------------------------------------------------- /demo/21_pubunblock/generated/src/private/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SOURCES(project_sources 2 | HelloUnblockClientBase.cpp 3 | HelloUnblockEvents.cpp 4 | HelloUnblockProxy.cpp 5 | HelloUnblockStub.cpp 6 | NEHelloUnblock.cpp 7 | ) 8 | -------------------------------------------------------------------------------- /demo/19_pubwatchdog/generated/src/private/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SOURCES(project_sources 2 | HelloWatchdogClientBase.cpp 3 | HelloWatchdogEvents.cpp 4 | HelloWatchdogProxy.cpp 5 | HelloWatchdogStub.cpp 6 | NEHelloWatchdog.cpp 7 | ) 8 | -------------------------------------------------------------------------------- /demo/10_locsvc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Filling SRCs up 2 | DECLARE_PROJECT(10_generated "generated") 3 | DECLARE_PROJECT(10_locservice "locservice") 4 | 5 | addStaticLib(${project_generated} "${generated_src}") 6 | addExecutableEx(${project_locservice} "${locservice_src}" "${project_generated}") 7 | -------------------------------------------------------------------------------- /demo/01_hello/ReadMe.md: -------------------------------------------------------------------------------- 1 | # 01_hello Project Overview 2 | 3 | The [01_hello](https://github.com/aregtech/areg-sdk/tree/master/examples/01_hello) project provides a simple demonstration of creating a thread to output the "Hello World!" message on the console. It showcases the usage of `Thread` and `IEThreadConsumer` objects. -------------------------------------------------------------------------------- /demo/10_locsvc/res/generate.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ME=$(realpath "$0") 4 | RES_DIR=$(dirname "$ME") 5 | PROJ_DIR=$(dirname "$RES_DIR") 6 | CMD=${PROJ_DIR}/../../tools/generate.sh 7 | 8 | TARGET='generated/src' 9 | $CMD --root "PROJ_DIR" --doc res/HelloWorld.siml --target $TARGET 10 | 11 | find ${PROJ_DIR}/${TARGET} \( -name '*.cpp' -o -name '*.hpp' \) -exec dos2unix {} \; 12 | -------------------------------------------------------------------------------- /demo/12_pubsvc/res/generate.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ME=$(realpath "$0") 4 | RES_DIR=$(dirname "$ME") 5 | PROJ_DIR=$(dirname "$RES_DIR") 6 | CMD=${PROJ_DIR}/../../tools/generate.sh 7 | 8 | TARGET='generated/src' 9 | $CMD --root "PROJ_DIR" --doc res/HelloWorld.siml --target $TARGET 10 | 11 | find ${PROJ_DIR}/${TARGET} \( -name '*.cpp' -o -name '*.hpp' \) -exec dos2unix {} \; 12 | -------------------------------------------------------------------------------- /demo/19_pubwatchdog/res/generate.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ME=$(realpath "$0") 4 | RES_DIR=$(dirname "$ME") 5 | PROJ_DIR=$(dirname "$RES_DIR") 6 | CMD=${PROJ_DIR}/../../tools/generate.sh 7 | 8 | TARGET='generated/src' 9 | $CMD --root "PROJ_DIR" --doc res/HelloWatchdog.siml --target $TARGET 10 | 11 | find ${PROJ_DIR}/${TARGET} \( -name '*.cpp' -o -name '*.hpp' \) -exec dos2unix {} \; 12 | -------------------------------------------------------------------------------- /demo/21_pubunblock/res/generate.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ME=$(realpath "$0") 4 | RES_DIR=$(dirname "$ME") 5 | PROJ_DIR=$(dirname "$RES_DIR") 6 | CMD=${PROJ_DIR}/../../tools/generate.sh 7 | 8 | TARGET='generated/src' 9 | $CMD --root "PROJ_DIR" --doc res/HelloUnlock.siml --target $TARGET 10 | 11 | find ${PROJ_DIR}/${TARGET} \( -name '*.cpp' -o -name '*.hpp' \) -exec dos2unix {} \; 12 | -------------------------------------------------------------------------------- /demo/12_pubsvc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project names 2 | DECLARE_PROJECT(12_generated "generated") 3 | DECLARE_PROJECT(12_pubclient "pubclient") 4 | DECLARE_PROJECT(12_pubservice "pubservice") 5 | 6 | addStaticLib(${project_generated} "${generated_src}") 7 | addExecutableEx(${project_pubclient} "${pubclient_src}" "${project_generated}") 8 | addExecutableEx(${project_pubservice} "${pubservice_src}" "${project_generated}") 9 | -------------------------------------------------------------------------------- /demo/17_winchat/chatter/services/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SOURCES(project_sources 2 | CentralMessaging.cpp 3 | ChatParticipantService.cpp 4 | ChatPrticipantHandler.cpp 5 | ConnectionHandler.cpp 6 | ConnectionList.cpp 7 | ConnectionService.cpp 8 | DirectChatService.cpp 9 | DirectConnectionClient.cpp 10 | DirectConnectionService.cpp 11 | DirectMessagingClient.cpp 12 | NetworkSetup.cpp 13 | ) 14 | -------------------------------------------------------------------------------- /demo/17_winchat/register/NECentralApp.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * \file register/NECentralApp.cpp 3 | * \brief Configurations, settings, etc.. 4 | ************************************************************************/ 5 | 6 | #include "register/NECentralApp.hpp" 7 | #include "generated/NECommon.hpp" 8 | 9 | #include 10 | #include 11 | -------------------------------------------------------------------------------- /demo/16_pubfsm/res/generate.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ME=$(realpath "$0") 4 | RES_DIR=$(dirname "$ME") 5 | PROJ_DIR=$(dirname "$RES_DIR") 6 | CMD=${PROJ_DIR}/../../tools/generate.sh 7 | 8 | TARGET='generated/src' 9 | $CMD --root "PROJ_DIR" --doc res/PowerManager.siml --target $TARGET 10 | $CMD --root "PROJ_DIR" --doc res/TrafficController.siml --target $TARGET 11 | 12 | find ${PROJ_DIR}/${TARGET} \( -name '*.cpp' -o -name '*.hpp' \) -exec dos2unix {} \; 13 | -------------------------------------------------------------------------------- /demo/12_pubsvc/generated/src/NECommon.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /************************************************************************ 4 | * \file generated/src/NECommon.hpp 5 | * \ingroup 12_pubsvc 6 | * \brief Namespace contains common constants. 7 | ************************************************************************/ 8 | 9 | namespace NECommon 10 | { 11 | constexpr char ServiceHelloName[] { "ServiceHello" }; 12 | } 13 | -------------------------------------------------------------------------------- /demo/16_pubfsm/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project names 2 | DECLARE_PROJECT(16_generated "generated") 3 | DECLARE_PROJECT(16_pubclient "pubclient") 4 | DECLARE_PROJECT(16_pubservice "pubservice") 5 | 6 | # Setting up appropriate flags 7 | addStaticLib(${project_generated} "${generated_src}") 8 | addExecutableEx(${project_pubclient} "${pubclient_src}" "${project_generated}") 9 | addExecutableEx(${project_pubservice} "${pubservice_src}" "${project_generated}") 10 | -------------------------------------------------------------------------------- /demo/21_pubunblock/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project names 2 | DECLARE_PROJECT(21_generated "generated") 3 | DECLARE_PROJECT(21_pubclient "pubclient") 4 | DECLARE_PROJECT(21_pubservice "pubservice") 5 | 6 | # Setting up appropriate flags 7 | addStaticLib(${project_generated} "${generated_src}") 8 | addExecutableEx(${project_pubclient} "${pubclient_src}" "${project_generated}") 9 | addExecutableEx(${project_pubservice} "${pubservice_src}" "${project_generated}") 10 | -------------------------------------------------------------------------------- /demo/19_pubwatchdog/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project names 2 | DECLARE_PROJECT(19_generated "generated") 3 | DECLARE_PROJECT(19_pubclient "pubclient") 4 | DECLARE_PROJECT(19_pubservice "pubservice") 5 | 6 | 7 | # Setting up appropriate flags 8 | addStaticLib(${project_generated} "${generated_src}") 9 | addExecutableEx(${project_pubclient} "${pubclient_src}" "${project_generated}") 10 | addExecutableEx(${project_pubservice} "${pubservice_src}" "${project_generated}") 11 | -------------------------------------------------------------------------------- /demo/19_pubwatchdog/generated/src/NECommon.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /************************************************************************ 4 | * \file generated/src/NECommon.hpp 5 | * \ingroup 12_pubsvc 6 | * \brief Namespace contains common constants. 7 | ************************************************************************/ 8 | 9 | namespace NECommon 10 | { 11 | constexpr char ServiceRoleName[] { "ServiceWatchdog" }; 12 | } 13 | -------------------------------------------------------------------------------- /demo/16_pubfsm/generated/src/private/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SOURCES(project_sources 2 | IETrafficLightActionHandler.cpp 3 | NEPowerManager.cpp 4 | NETrafficController.cpp 5 | NETrafficLightFSM.cpp 6 | PowerManagerClientBase.cpp 7 | PowerManagerEvents.cpp 8 | PowerManagerProxy.cpp 9 | PowerManagerStub.cpp 10 | TrafficControllerClientBase.cpp 11 | TrafficControllerEvents.cpp 12 | TrafficControllerProxy.cpp 13 | TrafficControllerStub.cpp 14 | TrafficLightFSM.cpp 15 | ) 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.aps 3 | *.opensdf 4 | *.suo 5 | *.sdf 6 | *.user 7 | *.log 8 | *.stackdump 9 | *.d 10 | *.diff 11 | 12 | .git 13 | .metadata 14 | .vs 15 | .vscode 16 | 17 | build/* 18 | out/* 19 | product/* 20 | 21 | # Compiled Object files 22 | *.slo 23 | *.lo 24 | *.o 25 | *.obj 26 | 27 | # Precompiled Headers 28 | *.gch 29 | *.pch 30 | 31 | # Compiled Dynamic libraries 32 | *.so 33 | *.dylib 34 | *.dll 35 | 36 | # Fortran module files 37 | *.mod 38 | *.smod 39 | 40 | # Compiled Static libraries 41 | *.lai 42 | *.la 43 | *.a 44 | *.lib 45 | 46 | # Executables 47 | *.exe 48 | *.out 49 | *.app 50 | 51 | CMakeSettings.json 52 | -------------------------------------------------------------------------------- /demo/17_winchat/res/generate.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ME=$(realpath "$0") 4 | RES_DIR=$(dirname "$ME") 5 | PROJ_DIR=$(dirname "$RES_DIR") 6 | CMD=${PROJ_DIR}/../../tools/generate.sh 7 | 8 | # NOTE: generated code is a bit different to the current code base in 'generated' 9 | TARGET='generated' 10 | $CMD --root "PROJ_DIR" --doc res/CentralMessager.siml --target $TARGET 11 | $CMD --root "PROJ_DIR" --doc res/ConnectionManager.siml --target $TARGET 12 | $CMD --root "PROJ_DIR" --doc res/DirectConnection.siml --target $TARGET 13 | $CMD --root "PROJ_DIR" --doc res/DirectMessager.siml --target $TARGET 14 | 15 | find ${PROJ_DIR}/${TARGET} \( -name '*.cpp' -o -name '*.hpp' \) -exec dos2unix {} \; 16 | -------------------------------------------------------------------------------- /demo/05_timer/ReadMe.md: -------------------------------------------------------------------------------- 1 | # 05_timer Project Overview 2 | 3 | The [05_timer](https://github.com/aregtech/areg-sdk/tree/master/examples/05_timer) project showcases the usage of timers in applications. It demonstrates the initialization, starting, and stopping of multiple timers, each processed in different threads. To utilize timers, the *Timer Service* (also known as *Timer Manager*) needs to be started. The timers are automatically dispatched in the thread of the timer owner. 4 | 5 | The project utilizes the following types of timers: 6 | - One-time timer: Executes a task only once. 7 | - Periodic timer: Executes a task a certain number of times. 8 | - Continuous timer: Executes a task continuously until it is stopped. 9 | -------------------------------------------------------------------------------- /demo/17_winchat/generated/private/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SOURCES(project_sources 2 | CentralMessagerClientBase.cpp 3 | CentralMessagerEvents.cpp 4 | CentralMessagerProxy.cpp 5 | CentralMessagerStub.cpp 6 | ConnectionManagerClientBase.cpp 7 | ConnectionManagerEvents.cpp 8 | ConnectionManagerProxy.cpp 9 | ConnectionManagerStub.cpp 10 | DirectConnectionClientBase.cpp 11 | DirectConnectionEvents.cpp 12 | DirectConnectionProxy.cpp 13 | DirectConnectionStub.cpp 14 | DirectMessagerClientBase.cpp 15 | DirectMessagerEvents.cpp 16 | DirectMessagerProxy.cpp 17 | DirectMessagerStub.cpp 18 | NECentralMessager.cpp 19 | NEConnectionManager.cpp 20 | NEDirectConnection.cpp 21 | NEDirectMessager.cpp 22 | ) 23 | -------------------------------------------------------------------------------- /demo/04_trace/ReadMe.md: -------------------------------------------------------------------------------- 1 | # 04_trace Project Overview 2 | 3 | The [04_trace](https://github.com/aregtech/areg-sdk/tree/master/examples/04_trace) project showcases the usage of logging (tracing) in applications. To enable logging, the source code needs to be compiled with the `AREG_LOGS` preprocessor define. Additionally, logging should be enabled in the [log.init](https://github.com/aregtech/areg-sdk/blob/master/framework/areg/resources/log.init) configuration file. By default, the `log.init` file should be located in the `./config` sub-directory relative to the executable file. If the configuration file is not present, logging can be forcefully enabled with default settings. 4 | 5 | In the demonstration, logging is forced to be enabled, and it utilizes the default logging settings. 6 | -------------------------------------------------------------------------------- /demo/17_winchat/register/NECentralApp.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /************************************************************************ 4 | * \file register/NECentralApp.hpp 5 | * \brief Configurations, settings, etc.. 6 | ************************************************************************/ 7 | 8 | #include "areg/base/GEGlobal.h" 9 | #include "areg/trace/GETrace.h" 10 | 11 | namespace NECentralApp 12 | { 13 | const char * const THREAD_CENTRAL = "ThreadCentral"; 14 | 15 | enum class eWndCommands : unsigned int 16 | { 17 | CmdFirst 18 | , CmdServiceConnection 19 | , CmdRegistered 20 | , CmdUnregistered 21 | , CmdSendMessage 22 | , CmdTypeMessage 23 | 24 | , CmdLast 25 | } ; 26 | } 27 | -------------------------------------------------------------------------------- /demo/17_winchat/chatter/res/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | // stdafx.cpp : source file that includes just the standard includes 13 | 14 | #include "chatter/res/stdafx.h" 15 | 16 | #pragma comment(lib, "areg.lib") 17 | #pragma comment(lib, "17_generated.lib") 18 | -------------------------------------------------------------------------------- /demo/10_locsvc/res/generate.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | cls 3 | 4 | :: set the AREG_SDK_ROOT directory here 5 | set AREG_SDK_ROOT=E:\Projects\aregtech\areg-sdk 6 | 7 | :: .bat file directory 8 | set BATCH_ROOT=%~dp0 9 | :: In case of examples, one level up. 10 | set PROJECT_ROOT=%BATCH_ROOT%\.. 11 | :: Specify the relative path of output folder 12 | set CODE_GEN=generated\src 13 | :: Include codegen.jar in CLASSPATH 14 | set CLASSPATH=%CLASSPATH%;%AREG_SDK_ROOT%\tools;%AREG_SDK_ROOT%\tools\codegen.jar 15 | 16 | @echo ...................................................... 17 | @echo Generating class of HelloWorld Service Interface in folder %CODE_GEN% ..... 18 | java com.aregtech.CMFMain --root=%PROJECT_ROOT% --doc=res\HelloWorld.siml --target=%CODE_GEN% 19 | 20 | @echo ...................................................... 21 | echo: 22 | echo End of code generating 23 | 24 | pause 25 | -------------------------------------------------------------------------------- /demo/12_pubsvc/res/generate.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | cls 3 | 4 | :: set the AREG_SDK_ROOT directory here 5 | set AREG_SDK_ROOT=E:\Projects\aregtech\areg-sdk 6 | 7 | :: .bat file directory 8 | set BATCH_ROOT=%~dp0 9 | :: In case of examples, one level up. 10 | set PROJECT_ROOT=%BATCH_ROOT%\.. 11 | :: Specify the relative path of output folder 12 | set CODE_GEN=generated\src 13 | :: Include codegen.jar in CLASSPATH 14 | set CLASSPATH=%CLASSPATH%;%AREG_SDK_ROOT%\tools;%AREG_SDK_ROOT%\tools\codegen.jar 15 | 16 | @echo ...................................................... 17 | @echo Generating class of HelloWorld Service Interface in folder %CODE_GEN% ..... 18 | java com.aregtech.CMFMain --root=%PROJECT_ROOT% --doc=res\HelloWorld.siml --target=%CODE_GEN% 19 | 20 | @echo ...................................................... 21 | echo: 22 | echo End of code generating 23 | 24 | pause 25 | -------------------------------------------------------------------------------- /demo/19_pubwatchdog/res/generate.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | cls 3 | 4 | :: set the AREG_SDK_ROOT directory here 5 | set AREG_SDK_ROOT=E:\Projects\aregtech\areg-sdk 6 | 7 | :: .bat file directory 8 | set BATCH_ROOT=%~dp0 9 | :: In case of examples, one level up. 10 | set PROJECT_ROOT=%BATCH_ROOT%\.. 11 | :: Specify the relative path of output folder 12 | set CODE_GEN=generated\src 13 | :: Include codegen.jar in CLASSPATH 14 | set CLASSPATH=%CLASSPATH%;%AREG_SDK_ROOT%\tools;%AREG_SDK_ROOT%\tools\codegen.jar 15 | 16 | @echo ...................................................... 17 | @echo Generating class of HelloWatchdog Service Interface in folder %CODE_GEN% ..... 18 | java com.aregtech.CMFMain --root=%PROJECT_ROOT% --doc=res\HelloWatchdog.siml --target=%CODE_GEN% 19 | 20 | @echo ...................................................... 21 | echo: 22 | echo End of code generating 23 | 24 | pause 25 | -------------------------------------------------------------------------------- /demo/21_pubunblock/res/generate.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | cls 3 | 4 | :: set the AREG_SDK_ROOT directory here 5 | set AREG_SDK_ROOT=E:\Projects\aregtech\areg-sdk\ 6 | 7 | :: .bat file directory 8 | set BATCH_ROOT=%~dp0 9 | :: In case of examples, one level up. 10 | set PROJECT_ROOT=%BATCH_ROOT%\.. 11 | :: Specify the relative path of output folder 12 | set CODE_GEN=generated\src 13 | :: Include codegen.jar in CLASSPATH 14 | set CLASSPATH=%CLASSPATH%;%AREG_SDK_ROOT%\tools;%AREG_SDK_ROOT%\tools\codegen.jar 15 | 16 | @echo ...................................................... 17 | @echo Generating class of HelloUnblock Service Interface in folder %CODE_GEN% ..... 18 | java com.aregtech.CMFMain --root=%PROJECT_ROOT% --doc=res\HelloUnblock.siml --target=%CODE_GEN% 19 | 20 | @echo ...................................................... 21 | echo: 22 | echo End of code generating 23 | 24 | pause 25 | -------------------------------------------------------------------------------- /demo/16_pubfsm/res/generate.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | cls 3 | 4 | set AREG_SDK_ROOT=E:\Projects\aregtech\areg-sdk 5 | 6 | set BATCH_ROOT=%~dp0 7 | set PROJECT_ROOT=%BATCH_ROOT%\.. 8 | set CODE_GEN=generated\src 9 | set CLASSPATH=%CLASSPATH%;%AREG_SDK_ROOT%\tools;%AREG_SDK_ROOT%\tools\codegen.jar 10 | 11 | @echo ...................................................... 12 | @echo Generating class of PowerManager Service Interface in folder %CODE_GEN% ..... 13 | java com.aregtech.CMFMain --root=%PROJECT_ROOT% --doc=res\PowerManager.siml --target=%CODE_GEN% 14 | 15 | @echo ...................................................... 16 | @echo Generating class of TrafficController Service Interface in folder %CODE_GEN% ..... 17 | java com.aregtech.CMFMain --root=%PROJECT_ROOT% --doc=res\TrafficController.siml --target=%CODE_GEN% 18 | 19 | @echo ...................................................... 20 | echo: 21 | echo End of code generating 22 | 23 | pause 24 | -------------------------------------------------------------------------------- /demo/17_winchat/register/res/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | // stdafx.cpp : source file that includes just the standard includes 13 | // centralapp.pch will be the pre-compiled header 14 | // stdafx.obj will contain the pre-compiled type information 15 | 16 | #include "register/res/stdafx.h" 17 | 18 | #pragma comment(lib, "areg.lib") 19 | #pragma comment(lib, "17_generated.lib") 20 | -------------------------------------------------------------------------------- /demo/17_winchat/chatter/res/targetver.h: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | #pragma once 13 | 14 | // Including SDKDDKVer.h defines the highest available Windows platform. 15 | 16 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 17 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 18 | 19 | #include 20 | -------------------------------------------------------------------------------- /demo/17_winchat/register/res/targetver.h: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | #pragma once 13 | 14 | // Including SDKDDKVer.h defines the highest available Windows platform. 15 | 16 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 17 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 18 | 19 | #include 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Aregtech 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /demo/17_winchat/register/res/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by register.rc 4 | // 5 | #define IDM_ABOUTBOX 0x0010 6 | #define IDD_ABOUTBOX 100 7 | #define IDS_ABOUTBOX 101 8 | #define IDS_APPLICATION_TITLE 102 9 | #define IDD_PAGE_SETUP_NETWORK 106 10 | #define IDR_MAINFRAME 128 11 | #define IDD_PAGE_CONNECTIONS 130 12 | #define IDC_BROKER_IPADDRESS 1007 13 | #define IDC_BROKER_PORT 1008 14 | #define IDC_BROKER_CONNECT 1009 15 | #define IDC_BROKER_DISCONNECT 1010 16 | #define IDC_EDIT_BROADCAST 1011 17 | #define IDC_BUTTON_BROADCAST 1012 18 | #define IDC_LIST_CONNECTIONS 1013 19 | 20 | // Next default values for new objects 21 | // 22 | #ifdef APSTUDIO_INVOKED 23 | #ifndef APSTUDIO_READONLY_SYMBOLS 24 | #define _APS_NEXT_RESOUR_VALUE 133 25 | #define _APS_NEXT_COMMAND_VALUE 32771 26 | #define _APS_NEXT_CONTROL_VALUE 1015 27 | #define _APS_NEXT_SYMED_VALUE 101 28 | #endif 29 | #endif 30 | -------------------------------------------------------------------------------- /demo/01_hello/01_hello.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | bat;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /demo/05_timer/05_timer.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | bat;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /demo/10_locsvc/ReadMe.md: -------------------------------------------------------------------------------- 1 | # 10_locsvc Project Overview 2 | 3 | The [10_locsvc](https://github.com/aregtech/areg-sdk/tree/master/examples/10_locsvc) project demonstrates the utilization of a *Local Service*. The interface definition can be found in the [HelloWorld.siml](https://github.com/aregtech/areg-sdk/blob/master/examples/10_locsvc/res/HelloWorld.siml) file, and the corresponding source code is generated using the `codegen.jar` application. 4 | 5 | The project showcases the creation of a provider and a consumer of the *Local Service*, which is only accessible within the process and cannot be accessed externally. 6 | 7 | The project is composed of two sub-projects: 8 | 9 | 1. [`generated`](https://github.com/aregtech/areg-sdk/tree/master/examples/10_locsvc/generated) (10_generated) - This sub-project is a static library that contains the generated code utilized by the application. 10 | 11 | 2. [`locservice`](https://github.com/aregtech/areg-sdk/tree/master/examples/10_locsvc/locservice) (10_locservice) - This sub-project provides the implementation of the service provider and the service consumer. It offers various functionalities such as request handling, response processing, broadcast, and dynamic attribute subscription and unsubscription during runtime. 12 | -------------------------------------------------------------------------------- /demo/04_trace/04_trace.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | bat;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ################################################################## 2 | # This file can be used as an example to integrate areg-sdk into 3 | # the existing project. Use your paths of your project structure 4 | # 5 | # ################################################################## 6 | 7 | cmake_minimum_required(VERSION 3.16.0) 8 | 9 | set(AREG_SDK_DEMO_ROOT "${CMAKE_SOURCE_DIR}") 10 | set(AREG_DEMO_SOURCES "${AREG_SDK_DEMO_ROOT}/demo") 11 | set(AREG_SDK_SOURCES "${AREG_SDK_DEMO_ROOT}/thirdparty/areg-sdk") 12 | 13 | # Configure AREG SDK build 14 | # Set the root path to output compiled binaries. 15 | set(AREG_BUILD_ROOT "${AREG_SDK_DEMO_ROOT}/product") 16 | # Disable building examples, instead, demo applications should be compiled. 17 | option(AREG_BUILD_EXAMPLES "Build AREG SDK examples" OFF) 18 | 19 | # Include areg-sdk files. This will initialize the options and compilers. 20 | # You may include it after your project(s), but make sure that areg-sdk 21 | # is properly configured. 22 | include(${AREG_SDK_SOURCES}/CMakeLists.txt) 23 | 24 | set(PROJECT_NAME "areg-sdk-demo") 25 | set(PROJECT_VERSION "1.0.0") 26 | project(${PROJECT_NAME} VERSION ${PROJECT_VERSION} LANGUAGES C CXX) 27 | 28 | # Start building Demo applications 29 | include("${AREG_DEMO_SOURCES}/CMakeLists.txt") 30 | -------------------------------------------------------------------------------- /demo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Examples with specific design must be included one by one. 3 | include(${AREG_DEMO_SOURCES}/01_hello/CMakeLists.txt) 4 | include(${AREG_DEMO_SOURCES}/04_trace/CMakeLists.txt) 5 | include(${AREG_DEMO_SOURCES}/05_timer/CMakeLists.txt) 6 | include(${AREG_DEMO_SOURCES}/10_locsvc/CMakeLists.txt) 7 | include(${AREG_DEMO_SOURCES}/12_pubsvc/CMakeLists.txt) 8 | include(${AREG_DEMO_SOURCES}/16_pubfsm/CMakeLists.txt) 9 | include(${AREG_DEMO_SOURCES}/19_pubwatchdog/CMakeLists.txt) 10 | include(${AREG_DEMO_SOURCES}/21_pubunblock/CMakeLists.txt) 11 | 12 | if (AREG_DEVELOP_ENV MATCHES "Win32") 13 | # This projects are based either on MFC (Microsoft Foundation Classes) 14 | # or are compiled only under Windows. So that, they are available 15 | # only when compile with Microsoft Visual Studio. 16 | 17 | find_package(MFC) 18 | if (MFC_FOUND) 19 | # MFC specific projects. Can be compiled only if target machine has installed MFC. 20 | # Otherwise, output warning message and exclude from the build. 21 | include(${AREG_DEMO_SOURCES}/17_winchat/CMakeLists.txt) 22 | else(MFC_FOUND) 23 | message(NOTICE " >>> NOTE: due to missing installed MFC library, escaping compile projects:") 24 | message(NOTICE " >>> ${AREG_DEMO_SOURCES}/17_winchat") 25 | endif(MFC_FOUND) 26 | 27 | endif() 28 | -------------------------------------------------------------------------------- /demo/17_winchat/register/CentralApp.hpp: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | // CentralApp.hpp : main header file for the centralapp application 13 | // 14 | #pragma once 15 | 16 | #ifndef __AFXWIN_H__ 17 | #error "include 'stdafx.h' before including this file for PCH" 18 | #endif 19 | 20 | #include "register/res/resource.h" // main symbols 21 | 22 | 23 | // CentralApp: 24 | // See CentralApp.cpp for the implementation of this class 25 | // 26 | 27 | class CentralApp : public CWinApp 28 | { 29 | public: 30 | static CString EmptyString; 31 | 32 | public: 33 | CentralApp(); 34 | 35 | // Overrides 36 | public: 37 | virtual BOOL InitInstance(); 38 | 39 | // Implementation 40 | 41 | DECLARE_MESSAGE_MAP() 42 | virtual int ExitInstance( ); 43 | }; 44 | 45 | extern CentralApp theApp; 46 | -------------------------------------------------------------------------------- /demo/16_pubfsm/generated/src/private/IETrafficLightActionHandler.cpp: -------------------------------------------------------------------------------- 1 | 2 | ////////////////////////////////////////////////////////////////////////// 3 | // Begin generate IETrafficLightActionHandler.cpp file 4 | ////////////////////////////////////////////////////////////////////////// 5 | 6 | /************************************************************************ 7 | * (c) copyright 2021 8 | * Generated by AREGtech code generator tool. 9 | * Generated at 16.08.2021 12:45:39 GMT+02:00 10 | ************************************************************************/ 11 | 12 | /************************************************************************ 13 | * \file generated/src/private/IETrafficLightActionHandler.cpp 14 | * \ingroup TrafficLight State Machine 15 | * \brief This is an automatic generated code of TrafficLight action handler. 16 | ************************************************************************/ 17 | 18 | /************************************************************************ 19 | * Include files 20 | ************************************************************************/ 21 | 22 | #include "generated/src/private/IETrafficLightActionHandler.hpp" 23 | 24 | ////////////////////////////////////////////////////////////////////////// 25 | // End generate IETrafficLightActionHandler.cpp file 26 | ////////////////////////////////////////////////////////////////////////// 27 | -------------------------------------------------------------------------------- /demo/17_winchat/register/ui/PageBrokerSetup.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "register/res/resource.h" 4 | 5 | // PageBrokerSetup dialog 6 | 7 | class PageBrokerSetup : public CPropertyPage 8 | { 9 | DECLARE_DYNAMIC(PageBrokerSetup) 10 | 11 | // Dialog Data 12 | enum { IDD = IDD_PAGE_SETUP_NETWORK }; 13 | 14 | public: 15 | PageBrokerSetup(); 16 | virtual ~PageBrokerSetup() = default; 17 | 18 | public: 19 | void ServiceConnected( bool isConnected ); 20 | 21 | void OnDefaultClicked( void ); 22 | 23 | protected: 24 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 25 | virtual BOOL OnInitDialog( ); 26 | 27 | DECLARE_MESSAGE_MAP() 28 | 29 | public: 30 | afx_msg void OnBnClickedBrokerConnect( ); 31 | afx_msg void OnBnClickedBrokerDisconnect( ); 32 | afx_msg void OnKickIdle( ); 33 | afx_msg void OnBnUpdateBrokerConnect( CCmdUI* pCmdUI); 34 | afx_msg void OnBnUdateBrokerDisconnect( CCmdUI* pCmdUI); 35 | afx_msg void OnUpdateRemoteData( CCmdUI* pCmdUI ); 36 | 37 | private: 38 | // The IP-Address of service broker 39 | CIPAddressCtrl mCtrlAddress; 40 | // Port number of service broker 41 | CEdit mCtrlPort; 42 | // The port number of service broker 43 | USHORT mBrokerPort; 44 | // Flag, indicating whether it is connected 45 | bool mIsConnected; 46 | BOOL mConnectEnable; 47 | BOOL mDisconnectEnabled; 48 | }; 49 | -------------------------------------------------------------------------------- /demo/17_winchat/chatter/DistrbutedApp.hpp: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | // DistrbutedApp.hpp : main header file for the distrbutedapp application 13 | // Copyright : (c) 2021-2023 Aregtech UG.All rights reserved. 14 | // 15 | #pragma once 16 | 17 | #ifndef __AFXWIN_H__ 18 | #error "include 'stdafx.h' before including this file for PCH" 19 | #endif 20 | 21 | #include "chatter/res/resource.h" // main symbols 22 | #include "areg/component/NERegistry.hpp" 23 | 24 | 25 | // DistrbutedApp: 26 | // See DistrbutedApp.cpp for the implementation of this class 27 | // 28 | 29 | class DistrbutedApp : public CWinApp 30 | { 31 | public: 32 | DistrbutedApp(); 33 | 34 | // Overrides 35 | public: 36 | virtual BOOL InitInstance(); 37 | 38 | // Implementation 39 | 40 | DECLARE_MESSAGE_MAP() 41 | virtual int ExitInstance( ); 42 | }; 43 | 44 | extern DistrbutedApp theApp; 45 | -------------------------------------------------------------------------------- /demo/12_pubsvc/12_pubclient.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | bat;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | 26 | 27 | Header Files 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /demo/19_pubwatchdog/19_pubclient.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | bat;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | 26 | 27 | Header Files 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /demo/21_pubunblock/21_pubclient.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {49DFF47F-2CEC-44FC-910E-E9BCA096C1C2} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;asm;asmx 7 | 8 | 9 | {E4A830BF-0EAE-43E7-B939-2C6646E77BCB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {E652F10D-E2AD-43F3-9E4C-33BE66544971} 14 | bat;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | 26 | 27 | Header Files 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /demo/16_pubfsm/16_pubclient.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | bat;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | 26 | 27 | Header Files 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /demo/12_pubsvc/12_pubservice.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | bat;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | 26 | 27 | Header Files 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /demo/21_pubunblock/21_pubservice.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {547E8ECB-FAB8-4C64-BBB1-B91FC69B3D89} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;asm;asmx 7 | 8 | 9 | {69194702-9620-469A-AA46-CAEF872D2345} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {C767002C-7BCC-4701-BCEE-1236D10871B9} 14 | bat;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | 23 | 24 | Source Files 25 | 26 | 27 | Source Files 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /demo/19_pubwatchdog/19_pubservice.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {B35F7AE9-8ACF-4D60-A4A0-1B8D66200AEE} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;asm;asmx 7 | 8 | 9 | {F6408B81-C23A-406C-AC79-9291E0906D2E} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {8271E296-DA9C-4329-B2F0-F3A38CD00F95} 14 | bat;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | 26 | 27 | Header Files 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /demo/16_pubfsm/generated/src/private/NETrafficLightFSM.cpp: -------------------------------------------------------------------------------- 1 | 2 | ////////////////////////////////////////////////////////////////////////// 3 | // Begin generate NETrafficLightFSM.cpp file 4 | ////////////////////////////////////////////////////////////////////////// 5 | 6 | /************************************************************************ 7 | * (c) copyright 2023 8 | * Generated by AREGtech code generator tool. 9 | * Generated at 03.01.2022 12:45:39 GMT+02:00 10 | ************************************************************************/ 11 | 12 | /************************************************************************ 13 | * \file generated/src/private/NETrafficLightFSM.cpp 14 | * \ingroup TrafficLight State Machine 15 | * \brief This is an automatic generated code of TrafficLight namespace. 16 | ************************************************************************/ 17 | 18 | /************************************************************************ 19 | * Include files 20 | ************************************************************************/ 21 | #include "generated/src/private/NETrafficLightFSM.hpp" 22 | 23 | ////////////////////////////////////////////////////////////////////////// 24 | // NETrafficLightFSM Namespace implementation 25 | ////////////////////////////////////////////////////////////////////////// 26 | 27 | namespace NETrafficLightFSM 28 | { 29 | 30 | }; 31 | 32 | ////////////////////////////////////////////////////////////////////////// 33 | // End generate NETrafficLightFSM.cpp file 34 | ////////////////////////////////////////////////////////////////////////// 35 | -------------------------------------------------------------------------------- /demo/17_winchat/res/generate.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | cls 3 | 4 | :: set the AREG_SDK_ROOT directory here 5 | set AREG_SDK_ROOT=E:\Projects\aregtech\areg-sdk 6 | 7 | :: .bat file directory 8 | set BATCH_ROOT=%~dp0 9 | :: In case of examples, one level up. 10 | set PROJECT_ROOT=%BATCH_ROOT%\.. 11 | :: Specify the relative path of output folder 12 | set CODE_GEN=generated 13 | :: Include codegen.jar in CLASSPATH 14 | set CLASSPATH=%CLASSPATH%;%AREG_SDK_ROOT%\tools;%AREG_SDK_ROOT%\tools\codegen.jar 15 | 16 | @echo ...................................................... 17 | @echo Generating class of CentralMessager Service Interface in folder %CODE_GEN% ..... 18 | java com.aregtech.CMFMain --root=%PROJECT_ROOT% --doc=res\CentralMessager.siml --target=%CODE_GEN% 19 | 20 | @echo ...................................................... 21 | @echo Generating class of ConnectionManager Service Interface in folder %CODE_GEN% ..... 22 | java com.aregtech.CMFMain --root=%PROJECT_ROOT% --doc=res\ConnectionManager.siml --target=%CODE_GEN% 23 | 24 | @echo ...................................................... 25 | @echo Generating class of DirectConnection Service Interface in folder %CODE_GEN% ..... 26 | java com.aregtech.CMFMain --root=%PROJECT_ROOT% --doc=res\DirectConnection.siml --target=%CODE_GEN% 27 | 28 | @echo ...................................................... 29 | @echo Generating class of DirectMessager Service Interface in folder %CODE_GEN% ..... 30 | java com.aregtech.CMFMain --root=%PROJECT_ROOT% --doc=res\DirectMessager.siml --target=%CODE_GEN% 31 | 32 | @echo ...................................................... 33 | echo: 34 | echo End of code generating 35 | 36 | pause 37 | -------------------------------------------------------------------------------- /demo/16_pubfsm/16_pubservice.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | bat;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | 26 | 27 | Source Files 28 | 29 | 30 | Source Files 31 | 32 | 33 | Source Files 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /demo/10_locsvc/10_locservice.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | bat;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | 29 | 30 | Header Files 31 | 32 | 33 | Header Files 34 | 35 | 36 | 37 | 38 | Resource Files 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /demo/17_winchat/chatter/NEDistributedApp.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /************************************************************************ 4 | * \file chatter/NEDistributedApp.hpp 5 | * \brief Configurations, settings, etc.. 6 | ************************************************************************/ 7 | 8 | #include "areg/base/GEGlobal.h" 9 | #include "areg/trace/GETrace.h" 10 | 11 | namespace NEDistributedApp 12 | { 13 | const char * const THREAD_DISTRIBUTED = "ThreadMessager"; 14 | 15 | enum class eWndCommands : unsigned int 16 | { 17 | CmdFirst = 0u 18 | 19 | , CmdServiceStartup 20 | , CmdServiceNetwork 21 | , CmdServiceConnection 22 | , CmdClientConnection 23 | , CmdClientRegistration 24 | 25 | , CmdAddConnection 26 | , CmdRemoveConnection 27 | , CmdUpdateConnection 28 | , CmdDisconnectTriggered 29 | 30 | , CmdSendMessage 31 | , CmdTypeMessage 32 | 33 | , CmdSetDirectConnection 34 | , CmdDirectConnectionAdd 35 | , CmdDirectConnectionRemove 36 | , CmdDirectConnectionClose 37 | 38 | , CmdChatJoined 39 | , CmdChatMessage 40 | , CmdChatTyping 41 | , CmdChatClosed 42 | 43 | , CmdLast 44 | }; 45 | 46 | const char * const PREFIX_TRHEAD = "thread_"; 47 | const char * const PREFIX_MODEL = "model_"; 48 | const char * const PREFIX_INITIATOR = "init_"; 49 | const char * const PREFIX_PARTICIPANT = "part_"; 50 | 51 | String getDirectConnectionName( const String & nickName, uint32_t cookie, uint64_t session); 52 | 53 | String getConnectionServiceRole( const String & nickName, uint32_t cookie ); 54 | 55 | String getDirectMessagingRole( const String & nickName, uint32_t cookie, uint64_t session, bool isInitiator ); 56 | } 57 | -------------------------------------------------------------------------------- /demo/17_winchat/chatter/services/DirectConnectionClient.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * \file chatter/services/DirectConnectionClient.cpp 3 | * \brief The direct connection service client object 4 | ************************************************************************/ 5 | 6 | #include "chatter/services/DirectConnectionClient.hpp" 7 | #include "chatter/NEDistributedApp.hpp" 8 | #include "chatter/services/ChatPrticipantHandler.hpp" 9 | 10 | 11 | DirectConnectionClient::DirectConnectionClient( Component & owner, ChatPrticipantHandler & participantsHandler, const NEDirectConnection::sParticipant & target ) 12 | : DirectConnectionClientBase ( NEDistributedApp::getConnectionServiceRole(target.nickName, target.cookie).getString(), owner ) 13 | 14 | , mParticipantsHandler ( participantsHandler ) 15 | { 16 | } 17 | 18 | DirectConnectionClient::~DirectConnectionClient( ) 19 | { 20 | } 21 | 22 | bool DirectConnectionClient::serviceConnected( bool isConnected, ProxyBase & proxy ) 23 | { 24 | bool result = false; 25 | if ( (isConnected == true) && DirectConnectionClientBase::serviceConnected( isConnected, proxy ) ) 26 | { 27 | requestConnectoinSetup( mParticipantsHandler.GetInitiator( ), mParticipantsHandler.GetParticipantList() ); 28 | result = true; 29 | } 30 | else if ( (isConnected == false) && DirectConnectionClientBase::serviceConnected( isConnected, proxy ) ) 31 | { 32 | requestCloseConnection(mParticipantsHandler.GetInitiator()); 33 | result = true; 34 | } 35 | return result; 36 | } 37 | 38 | void DirectConnectionClient::responseConnectoinSetup( bool succeeded, const NEDirectConnection::sParticipant & target, const NEDirectConnection::sInitiator & initiator, const NEDirectConnection::ListParticipants & listParticipants ) 39 | { 40 | ASSERT(mParticipantsHandler.GetInitiator() == initiator); 41 | } 42 | -------------------------------------------------------------------------------- /demo/10_locsvc/res/HelloWorld.siml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Simple Service Interface to demonstrate working features of AREG SDK. 5 | 6 | 7 | 8 | Request to print hello world 9 | 10 | 11 | The role name of client component that requested to print hello world 12 | 13 | 14 | 15 | 16 | The response to hello world request. 17 | 18 | 19 | Sent by client to request to shutdown service and the application. This request has no response. 20 | 21 | 22 | Triggered to notify that reached the maximum number of requests. 23 | 24 | 25 | The maximum number of reqeusts. 26 | 27 | 28 | 29 | 30 | 31 | 32 | 37 33 | The maximum number of messages to output. 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /demo/17_winchat/ReadMe.md: -------------------------------------------------------------------------------- 1 | ## 17_winchat Project Overview 2 | 3 | **NOTE:** The 17_winchat project is designed specifically for Windows operating systems and compiled only with the Microsoft Visual C++ compiler. 4 | 5 | [17_winchat](https://github.com/aregtech/areg-sdk/tree/master/examples/17_winchat) is a Windows GUI application that showcases a fault-tolerant and distributed computing system for embedded devices. It demonstrates the dynamic creation and definition of models and utilizes a dynamic subscription service during runtime. 6 | 7 | The project consists of three sub-projects: 8 | 9 | 1. [generated](https://github.com/aregtech/areg-sdk/tree/master/examples/17_winchat/generated) (17_generated): This static library contains generated codes and common objects. It is generated from multiple Service Interface documents located in the [`res`](https://github.com/aregtech/areg-sdk/tree/master/examples/17_winchat/res) subfolder using the `codegen.jar` tool. 10 | 11 | 2. [register](https://github.com/aregtech/areg-sdk/tree/master/examples/17_winchat/register) (17_register): This sub-project instantiates a Public Service that is utilized by all other applications. Upon starting the application, the user is prompted to manually enter the IP address of the multicast router (`mcrouter`) for establishing a connection. 12 | 13 | 3. [chatter](https://github.com/aregtech/areg-sdk/tree/master/examples/17_winchat/chatter) (17_chatter): The chatter sub-project contains an instance of Public Services and Service Consumers. It dynamically creates and loads models during runtime. Similar to the `register` sub-project, the user needs to manually enter the IP address of the multicast router (`mcrouter`) upon application startup to establish a connection. 14 | 15 | Communication within the system is facilitated by `mcrouter`, a multicast router that operates on any machine within the network. The AREG SDK automates service discovery and ensures a fault-tolerant system, making the order of process startup irrelevant. 16 | -------------------------------------------------------------------------------- /demo/12_pubsvc/ReadMe.md: -------------------------------------------------------------------------------- 1 | # 12_pubsvc Project Overview 2 | 3 | The [12_pubsvc](https://github.com/aregtech/areg-sdk/tree/master/examples/12_pubsvc) project showcases the utilization of a *Public Service* in a multi-processing environment, employing Object RPC (ORPC) for inter-process communication (IPC). The demonstration involves the creation of two applications: one serving as the *Service Provider* and the other as the *Service Consumer*, making remote requests and receiving corresponding responses. 4 | 5 | The project comprises three sub-projects: 6 | 7 | 1. [generated](https://github.com/aregtech/areg-sdk/tree/master/examples/12_pubsvc/generated) (12_generated) - This sub-project contains a static library consisting of generated code derived from the [HelloWorld.siml](https://github.com/aregtech/areg-sdk/blob/master/examples/12_pubsvc/res/HelloWorld.siml) *Service Interface* document. The code generation is facilitated using the `codegen.jar` tool. 8 | 9 | 2. [pubservice](https://github.com/aregtech/areg-sdk/tree/master/examples/12_pubsvc/pubservice) (12_pubservice) - This sub-project represents a console application functioning as a network-discoverable *Public Service* provider. Multiple remote *Service Consumers* can connect to the network and initiate requests to be executed by the `12_pubservice` application. 10 | 11 | 3. [pubclient](https://github.com/aregtech/areg-sdk/tree/master/examples/12_pubsvc/pubclient) (12_pubclient) - This sub-project involves a console application housing a *Public Service* consumer object. It automatically discovers the service provided by the `12_pubservice` application and triggers remote request calls. A timer is employed to facilitate periodic request calls. 12 | 13 | All communication takes place through `mcrouter`, a multicast router that can operate on any machine within the network. The use of the AREG SDK automates service discovery and ensures fault-tolerant system behavior. Consequently, the order in which the processes are started does not impact the functionality. 14 | -------------------------------------------------------------------------------- /demo/17_winchat/register/ui/CentralDialog.hpp: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | // CentralDialog.hpp : interface of the CentralDialog class 13 | // 14 | 15 | #pragma once 16 | 17 | #include "register/res/resource.h" 18 | #include "register/ui/PageBrokerSetup.hpp" 19 | #include "register/ui/PageConnections.hpp" 20 | 21 | 22 | class CentralDialog : public CPropertySheet 23 | { 24 | // Construction 25 | public: 26 | CentralDialog( void ); // standard constructor 27 | 28 | // Dialog Data 29 | enum { TITLE = IDS_APPLICATION_TITLE }; 30 | 31 | public: 32 | static bool StartConnection( const String & ipAddress, unsigned short portNr ); 33 | 34 | protected: 35 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 36 | 37 | protected: 38 | HICON m_hIcon; 39 | 40 | // Generated message map functions 41 | virtual BOOL OnInitDialog(); 42 | afx_msg void OnSysCommand(UINT nID, LPARAM lParam); 43 | afx_msg void OnPaint(); 44 | afx_msg HCURSOR OnQueryDragIcon(); 45 | afx_msg LRESULT OnCmdServiceConnection(WPARAM wParam, LPARAM lParam); 46 | afx_msg void OnRedirectOK( void ); 47 | DECLARE_MESSAGE_MAP() 48 | 49 | private: 50 | inline CentralDialog & self( void ); 51 | 52 | private: 53 | PageBrokerSetup mPageSetupNetwork; 54 | PageConnections mPageConnections; 55 | }; 56 | 57 | inline CentralDialog & CentralDialog::self( void ) 58 | { return (*this); } 59 | -------------------------------------------------------------------------------- /demo/17_winchat/register/ui/PageConnections.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | // PageConnections dialog 5 | 6 | #include "register/res/resource.h" 7 | #include "register/NECentralApp.hpp" 8 | #include "generated/NECommon.hpp" 9 | #include "areg/base/TEArrayList.hpp" 10 | 11 | class PageConnections : public CPropertyPage 12 | { 13 | 14 | static LPCTSTR HEADER_TITILES[]; 15 | 16 | typedef enum E_Header 17 | { 18 | NickName = 0 19 | , Message 20 | , SentAt 21 | , ReceivedAt 22 | } eHeader; 23 | 24 | typedef TEArrayList TypingList; 25 | 26 | DECLARE_DYNAMIC(PageConnections) 27 | 28 | // Dialog Data 29 | enum { IDD = IDD_PAGE_CONNECTIONS }; 30 | 31 | public: 32 | PageConnections(); 33 | virtual ~PageConnections(); 34 | 35 | public: 36 | void ServiceConnected( bool isConnected ); 37 | 38 | void OutputMessage( CString nickName, CString message, CString dateStart, CString dateEnd, LPARAM data ); 39 | 40 | void OnDefaultClicked( void ); 41 | 42 | protected: 43 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 44 | virtual BOOL OnInitDialog( ); 45 | 46 | DECLARE_MESSAGE_MAP() 47 | 48 | public: 49 | afx_msg void OnClickedButtonBroadcast(); 50 | afx_msg void OnKickIdle( void ); 51 | afx_msg void OnBtnBroadcastUpdate( CCmdUI* pCmdUI ); 52 | afx_msg void OnEditBroadcastUpdate( CCmdUI* pCmdUI ); 53 | afx_msg LRESULT OnCmdRegistered( WPARAM wParam, LPARAM lParam ); 54 | afx_msg LRESULT OnCmdUnregistered( WPARAM wParam, LPARAM lParam ); 55 | afx_msg LRESULT OnCmdSendMessage( WPARAM wParam, LPARAM lParam ); 56 | afx_msg LRESULT OnCmdTypeMessage( WPARAM wParam, LPARAM lParam ); 57 | 58 | private: 59 | void setHeaders( void ); 60 | 61 | // int findInTyping( LPCTSTR nickName ); 62 | 63 | int findInTyping( unsigned int cookie ); 64 | 65 | private: 66 | CListCtrl mCtrlList; 67 | INT mLastItem; 68 | TypingList mTypingList; 69 | // The message to broadcast 70 | CString mTextBroadcast; 71 | UINT mRegistered; 72 | BOOL mEditEnabled; 73 | }; 74 | -------------------------------------------------------------------------------- /demo/21_pubunblock/ReadMe.md: -------------------------------------------------------------------------------- 1 | ## 21_pubunblock Project Overview 2 | 3 | [21_pubunblock](https://github.com/aregtech/areg-sdk/tree/master/examples/21_pubunblock) is a project that demonstrates the manual unblocking of requests in a service. When a request is being processed and no response has been sent, it is marked as *busy*. If another client sends the same request, they will receive a *failure* response indicating that the request is busy. However, it is possible to manually unblock the request, allowing the service provider to process more requests. Once the service provider is ready to send the response to a specific consumer, it prepares and sends the response to the intended target. 4 | 5 | The project consists of three sub-projects: 6 | 7 | 1. [generated](https://github.com/aregtech/areg-sdk/tree/master/examples/21_pubunblock/generated) (21_generated): This static library contains the generated codes and common objects. It is generated from the [LargeData.siml](https://github.com/aregtech/areg-sdk/blob/master/examples/20_pubdatarate/res/LargeData.siml) Service Interface document using the `codegen.jar` tool. 8 | 9 | 2. [pubservice](https://github.com/aregtech/areg-sdk/tree/master/examples/21_pubunblock/pubservice) (21_pubservice): This sub-project provides a Public Service that receives requests, unblocks them, and replies with the response after a certain timeout. Each request is replied to the specific consumer with the appropriate response. The service includes generated sequence numbers in the responses to validate the process. 10 | 11 | 3. [pubclient](https://github.com/aregtech/areg-sdk/tree/master/examples/21_pubunblock/pubclient) (21_pubclient): This sub-project contains a Service Client that triggers requests at a higher frequency than the Service Provider can process. As a result, after a very short period of time, the Service Provider accumulates requests that are marked as *pending*. 12 | 13 | Communication within the system is facilitated by `mcrouter`, a multicast router that operates on any machine within the network. The AREG SDK automates service discovery and ensures a fault-tolerant system, making the order of process startup irrelevant. 14 | -------------------------------------------------------------------------------- /demo/16_pubfsm/generated/src/NECommon.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /************************************************************************ 4 | * \file generated/src/NECommon.hpp 5 | * \ingroup Patient monitoring Service 6 | * \brief Common constants and service names for Patient monitoring Service. 7 | ************************************************************************/ 8 | 9 | /************************************************************************ 10 | * Include files 11 | ************************************************************************/ 12 | #include "areg/base/GEGlobal.h" 13 | 14 | #include "generated/src/NETrafficController.hpp" 15 | 16 | namespace NECommon 17 | { 18 | 19 | constexpr char ServiceLightController[] { "LightController" }; 20 | 21 | constexpr char SerivceLightClient[] { "LightUser" }; 22 | 23 | inline const char * getName(NETrafficController::eVehicleTrafficLight value); 24 | 25 | inline const char * getName(NETrafficController::ePedestrianTrafficLight value); 26 | } 27 | 28 | inline const char * NECommon::getName(NETrafficController::eVehicleTrafficLight value) 29 | { 30 | switch (value) 31 | { 32 | case NETrafficController::eVehicleTrafficLight::VehicleLightsInit: 33 | return "Blink YELLOW"; 34 | case NETrafficController::eVehicleTrafficLight::VehicleLightRed: 35 | return "RED"; 36 | case NETrafficController::eVehicleTrafficLight::VehicleLightYellow: 37 | return "YELLOW"; 38 | case NETrafficController::eVehicleTrafficLight::VehicleLightGreen: 39 | return "GREEN"; 40 | 41 | case NETrafficController::eVehicleTrafficLight::VehicleLightOFF: 42 | default: 43 | return "OFF"; 44 | } 45 | } 46 | 47 | inline const char * NECommon::getName(NETrafficController::ePedestrianTrafficLight value) 48 | { 49 | switch (value) 50 | { 51 | case NETrafficController::ePedestrianTrafficLight::PedestrianLightRed: 52 | return "RED"; 53 | case NETrafficController::ePedestrianTrafficLight::PedestrianLightGreen: 54 | return "GREEN"; 55 | case NETrafficController::ePedestrianTrafficLight::PedestrianLightOFF: 56 | default: 57 | return "OFF"; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /demo/17_winchat/chatter/NEDistributedApp.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * \file chatter/NEDistributedApp.cpp 3 | * \brief Configurations, settings, etc.. 4 | ************************************************************************/ 5 | 6 | #include "chatter/NEDistributedApp.hpp" 7 | #include "generated/NECommon.hpp" 8 | #include "generated/NEDirectConnection.hpp" 9 | 10 | #include 11 | #include 12 | 13 | static inline void _createRoleName( const String & nickName, uint32_t cookie, const char * prefix, String & output ) 14 | { 15 | if ( (nickName.isEmpty( ) == false) && (cookie != NEDirectConnection::InvalidCookie) ) 16 | output.format( "%s%s_%u", prefix, nickName.getBuffer( ), cookie ); 17 | } 18 | 19 | static inline void _createRoleName( const String & nickName, uint32_t cookie, uint64_t session, const char * prefix, String & output ) 20 | { 21 | if ( (nickName.isEmpty( ) == false) && (cookie != NEDirectConnection::InvalidCookie) && (session != NEDirectConnection::InvalidSession) ) 22 | output.format( "%s%s_%u%llu", prefix, nickName.getBuffer( ), cookie, session ); 23 | } 24 | 25 | String NEDistributedApp::getConnectionServiceRole( const String & nickName, uint32_t cookie ) 26 | { 27 | String result; 28 | _createRoleName(nickName, cookie, NEDirectConnection::ServicePrefixStub, result); 29 | return result; 30 | } 31 | 32 | String NEDistributedApp::getDirectMessagingRole(const String & nickName, uint32_t cookie, uint64_t session, bool isInitiator) 33 | { 34 | String result; 35 | _createRoleName(nickName, cookie, session, isInitiator ? PREFIX_INITIATOR : PREFIX_PARTICIPANT, result); 36 | return result; 37 | } 38 | 39 | String NEDistributedApp::getDirectConnectionName( const String & nickName, uint32_t cookie, uint64_t session ) 40 | { 41 | String result; 42 | if ( (nickName.isEmpty( ) == false) && (cookie != NEDirectConnection::InvalidCookie) ) 43 | { 44 | if ( session != NEDirectConnection::InvalidSession ) 45 | result.format( "%s_%u%llu", nickName.getString( ), cookie, session ); 46 | else 47 | result.format( "%s_%u", nickName.getString( ), cookie); 48 | } 49 | return result; 50 | } 51 | -------------------------------------------------------------------------------- /demo/17_winchat/chatter/res/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by chatter.rc 4 | // 5 | #define IDM_ABOUTBOX 0x0010 6 | #define IDD_ABOUTBOX 100 7 | #define IDS_ABOUTBOX 101 8 | #define IDS_APPLICATION_TITLE 102 9 | #define IDR_MAINFRAME 128 10 | #define IDD_PAGE_SETUP_NETWORK 131 11 | #define IDD_PAGE_MESSAGES 132 12 | #define IDD_PAGE_CONNECTIONS 133 13 | #define IDD_PAGE_CHAT 134 14 | #define IDC_EDIT_NICKNAME 1000 15 | #define IDC_BROKER_IPADDRESS 1001 16 | #define IDC_BROKER_PORT 1002 17 | #define IDC_BROKER_CONNECT 1003 18 | #define IDC_BROKER_DISCONNECT 1004 19 | #define IDC_CHECK_MESSAGES 1005 20 | #define IDC_CHECK_KEYTYPE 1006 21 | #define IDC_CHECK_BROADCAST 1007 22 | #define IDC_EDIT_MESSAGE_ALL 1008 23 | #define IDC_BUTTON_SEND 1009 24 | #define IDC_BUTTON_INITIATE_CHAT 1010 25 | #define IDC_LIST_CONNECTIONS 1011 26 | #define IDC_LIST_MESSAGES 1012 27 | #define IDC_BUTTON1 1015 28 | #define IDC_BUTTON_REGISTER 1015 29 | #define IDC_BUTTON_CLOSE_CHAT 1015 30 | #define IDC_LIST_CHAT 1016 31 | #define IDC_EDIT_CHAT 1017 32 | #define IDC_CHECK_CHAT_MESSAGES 1018 33 | #define IDC_CHECK_CHAT_TYPING 1019 34 | #define IDC_BUTTON_CHAT_SEND 1020 35 | #define IDC_CHECK_AUTO 1021 36 | #define IDC_CHAT_TIMER 1022 37 | #define IDC_CHAT_TIMER_SPIN 1023 38 | #define IDC_BUTTON2 1026 39 | #define IDC_BUTTON_STOP 1026 40 | #define IDC_BUTTON_CHAT_STOP 1026 41 | #define IDC_BUTTON_STOP_CHAT 1026 42 | 43 | // Next default values for new objects 44 | // 45 | #ifdef APSTUDIO_INVOKED 46 | #ifndef APSTUDIO_READONLY_SYMBOLS 47 | #define _APS_NEXT_RESOUR_VALUE 136 48 | #define _APS_NEXT_COMMAND_VALUE 32771 49 | #define _APS_NEXT_CONTROL_VALUE 1027 50 | #define _APS_NEXT_SYMED_VALUE 101 51 | #endif 52 | #endif 53 | -------------------------------------------------------------------------------- /demo/01_hello/01_hello.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {2BCCB75A-D179-4DB4-9B50-BF6F501B5CAE} 11 | 01_hello 12 | 01_hello 13 | Win32Proj 14 | 15 | 16 | 17 | Application 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 26 | 27 | 28 | Console 29 | 30 | 31 | 32 | 33 | true 34 | true 35 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /demo/05_timer/05_timer.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {09DBC624-4CBA-4345-B8F1-A2786F00A615} 11 | 05_timer 12 | 05_timer 13 | Win32Proj 14 | 15 | 16 | 17 | Application 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 26 | 27 | 28 | Console 29 | 30 | 31 | 32 | 33 | true 34 | true 35 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /demo/04_trace/04_trace.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {18F81610-018F-4FE9-9B33-D2060E0F2CB6} 11 | 04_trace 12 | 04_trace 13 | Win32Proj 14 | 15 | 16 | 17 | Application 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 26 | 27 | 28 | Console 29 | 30 | 31 | 32 | 33 | true 34 | true 35 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /demo/17_winchat/chatter/res/stdafx.h: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | // stdafx.h : include file for standard system include files, 13 | // or project specific include files that are used frequently, 14 | // but are changed infrequently 15 | 16 | #pragma once 17 | 18 | #ifndef VC_EXTRALEAN 19 | #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers 20 | #endif 21 | 22 | #include "targetver.h" 23 | 24 | #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit 25 | 26 | // turns off MFC's hiding of some common and often safely ignored warning messages 27 | #define _AFX_ALL_WARNINGS 28 | 29 | #include // MFC core and standard components 30 | #include // MFC extensions 31 | 32 | 33 | 34 | #ifndef _AFX_NO_OLE_SUPPORT 35 | #include // MFC support for Internet Explorer 4 Common Controls 36 | #endif 37 | #ifndef _AFX_NO_AFXCMN_SUPPORT 38 | #include // MFC support for Windows Common Controls 39 | #endif // _AFX_NO_AFXCMN_SUPPORT 40 | 41 | #include // MFC support for ribbons and control bars 42 | #include 43 | 44 | 45 | 46 | #ifdef _UNICODE 47 | #if defined _M_IX86 48 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") 49 | #elif defined _M_X64 50 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") 51 | #else 52 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") 53 | #endif 54 | #endif 55 | -------------------------------------------------------------------------------- /demo/12_pubsvc/12_pubclient.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {C6AEF053-AA0C-46A8-A2F2-4330021D2DE2} 11 | 12_pubclient 12 | 12_pubclient 13 | Win32Proj 14 | 15 | 16 | 17 | Application 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 26 | 27 | 28 | Console 29 | 30 | 31 | 32 | 33 | true 34 | true 35 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /demo/19_pubwatchdog/ReadMe.md: -------------------------------------------------------------------------------- 1 | ## 19_pubwatchdog Project Overview 2 | 3 | [19_pubwatchdog](https://github.com/aregtech/areg-sdk/tree/master/examples/19_pubwatchdog) demonstrates the utilization of a *Watchdog* in a Public Service. The Watchdog acts as a guard to control threads, allowing developers to set a timeout in milliseconds. Threads that fail to respond within the specified runtime will be terminated and restarted by the system. When a thread is killed, all Service Providers and Service Consumers receive a *connection lost* notification. Upon restarting, they receive a *service available* or *client connection* notification, enabling them to resume communication. The watchdog can be disabled for a specific thread by setting a timeout of *0ms*. 4 | 5 | In this example application, the watchdog is triggered by putting the thread to sleep with a timeout greater than the watchdog's timeout. Once the watchdog timeout is reached, the system kills and restarts the thread. 6 | 7 | The project consists of three sub-projects: 8 | 9 | 1. [generated](https://github.com/aregtech/areg-sdk/tree/master/examples/19_pubwatchdog/generated) (19_generated): This static library contains the generated codes and common objects. It is generated from the [HelloWatchdog.siml](https://github.com/aregtech/areg-sdk/blob/master/examples/18_locwatchdog/res/HelloWatchdog.siml) Service Interface document using the `codegen.jar` tool. 10 | 11 | 2. [pubservice](https://github.com/aregtech/areg-sdk/tree/master/examples/19_pubwatchdog/pubservice) (19_pubservice): This application provides a Public Service. The thread responsible for providing the service is declared with a watchdog timeout greater than 0ms. When a Service Consumer sends a request, the thread goes to sleep. Once the watchdog timeout expires, the system kills and restarts the thread. All other Service Providers and Consumers automatically receive *disconnect* and *connect* notifications. 12 | 13 | 3. [pubclient](https://github.com/aregtech/areg-sdk/tree/master/examples/19_pubwatchdog/pubclient) (19_pubclient): This application instantiates the Service Consumer object. By connecting with the Service Provider, it sends a request to put the thread to sleep, triggering the Watchdog restart action. 14 | 15 | Communication within the system is facilitated by `mcrouter`, a multicast router that operates on any machine within the network. The AREG SDK automates service discovery and ensures a fault-tolerant system, making the order of process startup irrelevant. 16 | -------------------------------------------------------------------------------- /demo/17_winchat/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(project_root "${CMAKE_CURRENT_LIST_DIR}") 2 | 3 | # Set project to compile with MFC dynamic linked library 4 | set(CMAKE_MFC_FLAG PRIVATE 2) 5 | 6 | # #################################### 7 | # generated project 8 | 9 | # 'generated project' 10 | DECLARE_PROJECT(17_generated "generated") 11 | # Setting up appropriate flags 12 | addStaticLib(${project_generated} "${generated_src}") 13 | 14 | # Set MFC DLL and other Windows flags. 15 | list(APPEND MFC_DEFINES _AFXDLL _BIND_TO_CURRENT_CRT_VERSION _BIND_TO_CURRENT_MFC_VERSION) 16 | 17 | # #################################### 18 | # 'chatter' project 19 | 20 | DECLARE_PROJECT(17_chatter "chatter") 21 | # Set resource files to compile with Microsoft RC compiler 22 | set_source_files_properties(${chatter_resources} PROPERTIES LANGUAGE RC) 23 | list(APPEND chatter_src "${chatter_resources}") 24 | 25 | # 'chatter' project, compile for Windows system, set options 26 | add_executable(${project_chatter} WIN32 ${chatter_src}) 27 | setAppOptions(${project_chatter} ${project_generated}) 28 | # Set compile definitions to link MFC DLL 29 | target_compile_definitions(${project_chatter} PRIVATE "${MFC_DEFINES}") 30 | # Ensure Windows Subsystem and switch the entry point from main() method to 'wWinMainCRTStartup' implemented in MFC DLL. 31 | set_property(TARGET ${project_chatter} APPEND_STRING PROPERTY LINK_FLAGS " /SUBSYSTEM:WINDOWS /ENTRY:\"wWinMainCRTStartup\"") 32 | target_include_directories(${project_chatter} BEFORE PRIVATE ${project_root}) 33 | 34 | # #################################### 35 | # 'register' project 36 | 37 | DECLARE_PROJECT(17_register "register") 38 | # Set resource files to compile with Microsoft RC compiler 39 | set_source_files_properties(${register_resources} PROPERTIES LANGUAGE RC) 40 | list(APPEND register_src ${register_resources}) 41 | # 'register' project, compile for Windows system, set options 42 | add_executable(${project_register} WIN32 ${register_src}) 43 | setAppOptions(${project_register} ${project_generated}) 44 | # Set compile definitions to link MFC DLL 45 | target_compile_definitions(${project_register} PRIVATE "${MFC_DEFINES}") 46 | # Ensure Windows Subsystem and switch the entry point from main() method to 'wWinMainCRTStartup' implemented in MFC DLL. 47 | set_property(TARGET ${project_register} APPEND_STRING PROPERTY LINK_FLAGS " /SUBSYSTEM:WINDOWS /ENTRY:\"wWinMainCRTStartup\"") 48 | target_include_directories(${project_register} BEFORE PRIVATE ${project_root}) 49 | -------------------------------------------------------------------------------- /demo/19_pubwatchdog/19_pubclient.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {7ECC4BF9-45A4-4774-869B-239E3B152E05} 11 | 19_pubclient 12 | 19_pubclient 13 | Win32Proj 14 | 15 | 16 | 17 | Application 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 26 | 27 | 28 | Console 29 | 30 | 31 | 32 | 33 | true 34 | true 35 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /demo/21_pubunblock/21_pubclient.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {A09D9D20-FBB8-4C1A-8628-3071AC7903DA} 11 | 21_pubclient 12 | 21_pubclient 13 | Win32Proj 14 | 15 | 16 | 17 | Application 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 26 | 27 | 28 | Console 29 | 30 | 31 | 32 | 33 | true 34 | true 35 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /demo/16_pubfsm/16_pubclient.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {C23BA253-475E-49DD-A92E-616C2A93831A} 11 | 16_pubclient 12 | 16_pubclient 13 | Win32Proj 14 | 15 | 16 | 17 | Application 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 26 | 27 | 28 | Console 29 | 30 | 31 | 32 | 33 | true 34 | true 35 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /demo/12_pubsvc/12_pubservice.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {D20E2DBD-4224-479D-9608-5BC062A48BE4} 11 | 12_pubservice 12 | 12_pubservice 13 | Win32Proj 14 | 15 | 16 | 17 | Application 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 26 | 27 | 28 | Console 29 | 30 | 31 | 32 | 33 | true 34 | true 35 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /demo/21_pubunblock/21_pubservice.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {D89AC0DB-DFF2-4F15-8A26-63D51EDABB57} 11 | 21_pubservice 12 | 21_pubservice 13 | Win32Proj 14 | 15 | 16 | 17 | Application 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 26 | 27 | 28 | Console 29 | 30 | 31 | 32 | 33 | true 34 | true 35 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /demo/19_pubwatchdog/19_pubservice.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {3A13DBD7-D3CA-4908-8B76-9F8AEB5EC81B} 11 | 19_pubservice 12 | 19_pubservice 13 | Win32Proj 14 | 15 | 16 | 17 | Application 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 26 | 27 | 28 | Console 29 | 30 | 31 | 32 | 33 | true 34 | true 35 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /demo/10_locsvc/10_generated.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | bat;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | 35 | 36 | Header Files 37 | 38 | 39 | Header Files 40 | 41 | 42 | Header Files 43 | 44 | 45 | Header Files 46 | 47 | 48 | Header Files 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /demo/17_winchat/register/res/stdafx.h: -------------------------------------------------------------------------------- 1 | // This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface 2 | // (the "Fluent UI") and is provided only as referential material to supplement the 3 | // Microsoft Foundation Classes Reference and related electronic documentation 4 | // included with the MFC C++ library software. 5 | // License terms to copy, use or distribute the Fluent UI are available separately. 6 | // To learn more about our Fluent UI licensing program, please visit 7 | // http://go.microsoft.com/fwlink/?LinkId=238214. 8 | // 9 | // Copyright (C) Microsoft Corporation 10 | // All rights reserved. 11 | 12 | // stdafx.h : include file for standard system include files, 13 | // or project specific include files that are used frequently, 14 | // but are changed infrequently 15 | 16 | #pragma once 17 | 18 | #ifndef VC_EXTRALEAN 19 | #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers 20 | #endif 21 | 22 | #include "register/res/targetver.h" 23 | #include "register/res/resource.h" 24 | 25 | #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit 26 | 27 | // turns off MFC's hiding of some common and often safely ignored warning messages 28 | #define _AFX_ALL_WARNINGS 29 | 30 | #include // MFC core and standard components 31 | #include // MFC extensions 32 | 33 | #ifndef _AFX_NO_OLE_SUPPORT 34 | #include // MFC support for Internet Explorer 4 Common Controls 35 | #endif 36 | #ifndef _AFX_NO_AFXCMN_SUPPORT 37 | #include // MFC support for Windows Common Controls 38 | #endif // _AFX_NO_AFXCMN_SUPPORT 39 | 40 | #include // MFC support for ribbons and control bars 41 | 42 | #include 43 | #include 44 | 45 | 46 | 47 | #ifdef _UNICODE 48 | #if defined _M_IX86 49 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") 50 | #elif defined _M_X64 51 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") 52 | #else 53 | #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") 54 | #endif 55 | #endif 56 | -------------------------------------------------------------------------------- /demo/21_pubunblock/21_generated.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {BE829F0C-723E-4E18-879F-1FCEE86E003C} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;asm;asmx 7 | 8 | 9 | {377E40EF-98EB-4BC7-933F-A175AA1B0344} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {9557DF98-FB79-4BFB-8F08-A586116715DF} 14 | bat;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | 35 | 36 | Header Files 37 | 38 | 39 | Header Files 40 | 41 | 42 | Header Files 43 | 44 | 45 | Header Files 46 | 47 | 48 | Header Files 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /demo/01_hello/src/main.cpp: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Name : main.cpp 3 | // Author : Artak Avetyan 4 | // Version : 5 | // Copyright : (c) 2021-2023 Aregtech UG.All rights reserved. 6 | // Description : This project demonstrates creation of a simple thread to 7 | // output "Hello World!" message on console. 8 | //============================================================================ 9 | 10 | #include "areg/base/GEGlobal.h" 11 | #include "areg/base/Thread.hpp" 12 | #include "areg/base/IEThreadConsumer.hpp" 13 | 14 | #include 15 | 16 | #ifdef _WIN32 17 | // link with areg library, valid only for MSVC 18 | #pragma comment(lib, "areg.lib") 19 | #endif // _WIN32 20 | 21 | //! \brief A thread to run and output message. 22 | class HelloThread : public Thread 23 | , protected IEThreadConsumer 24 | { 25 | public: 26 | HelloThread( void ) 27 | : Thread( self( ), "HelloThread" ) // set consumer and the name 28 | , IEThreadConsumer( ) 29 | { 30 | } 31 | 32 | virtual ~HelloThread( void ) = default; 33 | 34 | protected: 35 | /************************************************************************/ 36 | // IEThreadConsumer interface overrides 37 | /************************************************************************/ 38 | 39 | //! \brief This callback is triggered when thread runs and fully operable. 40 | virtual void onThreadRuns( void ) override 41 | { 42 | std::cout << "The thread " << getName( ) << " runs, outputing message." << std::endl; 43 | std::cout << "!!! Hello World !!!" << std::endl; 44 | } 45 | 46 | private: 47 | //!< The wrapper of 'this' pointer to call in constructor 48 | inline HelloThread & self( void ) 49 | { 50 | return (*this); 51 | }; 52 | }; 53 | 54 | ////////////////////////////////////////////////////////////////////////// 55 | // Demo to create and destroy thread. 56 | ////////////////////////////////////////////////////////////////////////// 57 | int main() 58 | { 59 | std::cout << "Demo to create and destroy thread ..." << std::endl; 60 | 61 | // declare thread object. 62 | HelloThread aThread; 63 | // create and start thread, wait until it is started. 64 | aThread.createThread(NECommon::WAIT_INFINITE); 65 | // stop and destroy thread, clean resources. Wait until thread ends. 66 | aThread.destroyThread(NECommon::WAIT_INFINITE); 67 | 68 | std::cout << "Exit application!" << std::endl; 69 | return 0; 70 | } 71 | -------------------------------------------------------------------------------- /demo/16_pubfsm/16_pubservice.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {57693047-C0E4-4183-91B5-8BCAB76F1B7D} 11 | 16_pubservice 12 | 16_pubservice 13 | Win32Proj 14 | 15 | 16 | 17 | Application 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 26 | 27 | 28 | Console 29 | 30 | 31 | 32 | 33 | true 34 | true 35 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /demo/12_pubsvc/12_generated.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | bat;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | 35 | 36 | Header Files 37 | 38 | 39 | Header Files 40 | 41 | 42 | Header Files 43 | 44 | 45 | Header Files 46 | 47 | 48 | Header Files 49 | 50 | 51 | Header Files 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /demo/17_winchat/chatter/services/ConnectionService.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * \file chatter/services/ConnectionService.hpp 3 | * \brief The connection manager client component implementation 4 | ************************************************************************/ 5 | 6 | #include "chatter/res/stdafx.h" 7 | #include "areg/base/GEGlobal.h" 8 | #include "chatter/services/ConnectionService.hpp" 9 | #include "areg/component/NERegistry.hpp" 10 | #include "areg/component/ComponentLoader.hpp" 11 | #include "areg/component/ComponentThread.hpp" 12 | #include "generated/NECommon.hpp" 13 | #include "chatter/NEDistributedApp.hpp" 14 | #include "chatter/DistrbutedApp.hpp" 15 | #include "chatter/ui/DistributedDialog.hpp" 16 | 17 | BEGIN_MODEL(NECommon::MODEL_NAME_DISTRIBUTED_CLIENT) 18 | 19 | BEGIN_REGISTER_THREAD( NEDistributedApp::THREAD_DISTRIBUTED, NECommon::WATCHDOG_IGNORE) 20 | BEGIN_REGISTER_COMPONENT( NECommon::COMP_NAME_DISTRIBUTED_CLIENT, ConnectionService ) 21 | REGISTER_DEPENDENCY( NECommon::COMP_NAME_CENTRAL_SERVER ) 22 | END_REGISTER_COMPONENT( NECommon::COMP_NAME_DISTRIBUTED_CLIENT ) 23 | END_REGISTER_THREAD( NEDistributedApp::THREAD_DISTRIBUTED ) 24 | 25 | END_MODEL(NECommon::MODEL_NAME_DISTRIBUTED_CLIENT) 26 | 27 | DEF_TRACE_SCOPE( distrbutedapp_ConnectionService_CreateComponent ); 28 | DEF_TRACE_SCOPE( distrbutedapp_ConnectionService_DeleteComponent ); 29 | 30 | Component * ConnectionService::CreateComponent( const NERegistry::ComponentEntry & entry, ComponentThread & owner ) 31 | { 32 | TRACE_SCOPE( distrbutedapp_ConnectionService_CreateComponent ); 33 | return new ConnectionService( entry, owner ); 34 | } 35 | 36 | void ConnectionService::DeleteComponent( Component & compObject, const NERegistry::ComponentEntry & entry ) 37 | { 38 | TRACE_SCOPE( distrbutedapp_ConnectionService_DeleteComponent ); 39 | delete (&compObject); 40 | } 41 | 42 | ConnectionService::ConnectionService( const NERegistry::ComponentEntry & entry, ComponentThread & ownerThread ) 43 | : Component ( entry, ownerThread ) 44 | { 45 | } 46 | 47 | void ConnectionService::startupComponent( ComponentThread & comThread ) 48 | { 49 | Component::startupComponent(comThread); 50 | DistributedDialog::PostServiceMessage( NEDistributedApp::eWndCommands::CmdServiceStartup, 1, reinterpret_cast(this) ); 51 | } 52 | 53 | void ConnectionService::shutdownComponent( ComponentThread & comThread ) 54 | { 55 | DistributedDialog::PostServiceMessage( NEDistributedApp::eWndCommands::CmdServiceStartup, 0, 0 ); 56 | Component::shutdownComponent(comThread); 57 | } 58 | -------------------------------------------------------------------------------- /demo/19_pubwatchdog/19_generated.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {EFFED2DF-0A8A-4807-9E55-81C3F60CE030} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;asm;asmx 7 | 8 | 9 | {84455364-D280-4BB9-B30C-B98AA5EB87A8} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {8A37A740-2D34-439C-B836-0DFEFE4F0EC1} 14 | bat;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | 35 | 36 | Header Files 37 | 38 | 39 | Header Files 40 | 41 | 42 | Header Files 43 | 44 | 45 | Header Files 46 | 47 | 48 | Header Files 49 | 50 | 51 | Header Files 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /demo/10_locsvc/10_locservice.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {8273239C-C5A8-4752-9DFC-E1678222C36E} 11 | 10_locservice 12 | 10_locservice 13 | Win32Proj 14 | 15 | 16 | 17 | Application 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 26 | 27 | 28 | Console 29 | 30 | 31 | 32 | 33 | true 34 | true 35 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 36 | 37 | 38 | Console 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /demo/16_pubfsm/ReadMe.md: -------------------------------------------------------------------------------- 1 | # 16_pubfsm Project Overview 2 | 3 | The [16_pubfsm](https://github.com/aregtech/areg-sdk/tree/master/examples/16_pubfsm) project demonstrates the utilization of AREG Framework features to build a *Finite-State Machine* (**FSM**) with *Triggers*, *Timers*, and *Events*. The FSM sources are generated by a code generator tool, and the project also includes dynamic models to start multiple instances of Service Consumers. 4 | 5 | The project consists of three sub-projects: 6 | 7 | 1. [generated](https://github.com/aregtech/areg-sdk/tree/master/examples/15_generated/generated) (16_generated): This static library contains generated codes and common objects. It is generated from the [PowerManager.siml](https://github.com/aregtech/areg-sdk/blob/master/examples/16_pubfsm/res/PowerManager.siml) and [TrafficController.siml](https://github.com/aregtech/areg-sdk/blob/master/examples/16_pubfsm/res/TrafficController.siml) Service Interface documents using the `codegen.jar` tool. Additionally, the [TrafficLightFSM.cpp](https://github.com/aregtech/areg-sdk/blob/master/examples/16_pubfsm/generated/src/private/TrafficLightFSM.cpp) file contains the implementation of the *Finite-State Machine (FSM)* using AREG Framework features. 8 | 9 | 2. [pubservice](https://github.com/aregtech/areg-sdk/tree/master/examples/16_pubfsm/pubservice) (16_pubservice): This sub-project creates an instance of a *Public Service* that includes the *Finite-State Machine* (**FSM**). A local service interacts with the user to change the states of the FSM and control its execution. Users can interact with the application using the following commands: 10 | - `on` to simulate power ON. 11 | - `start` to start the FSM run (as a traffic light controller). 12 | - `stop` to stop the FSM run (as a traffic light controller). 13 | - `off` to simulate power OFF. 14 | - `quit` or `q` to exit the application, which also closes all clients. 15 | 16 | 3. [pubclient](https://github.com/aregtech/areg-sdk/tree/master/examples/16_pubfsm/pubclient) (16_pubclient): This sub-project contains an instance of a *Service Consumer*, which is defined in the dynamic model during runtime. This approach allows starting and running multiple instances of the same application, with each instance of the Service Provider having a unique name. When the application starts, you can use one of the following commands: 17 | - Type `sn` to subscribe to one set of data updates. 18 | - Type `ew` to subscribe to another set of data updates. 19 | 20 | Communication within the system is facilitated by `mcrouter`, a multicast router that operates on any machine within the network. The AREG SDK automates service discovery and ensures a fault-tolerant system, making the order of process startup irrelevant. 21 | -------------------------------------------------------------------------------- /demo/10_locsvc/locservice/src/ServicingComponent.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * \file locservice/src/ServicingComponent.cpp 3 | * \ingroup AREG Asynchronous Event-Driven Communication Framework examples 4 | * \author Artak Avetyan 5 | * \brief Collection of AREG SDK examples. 6 | * This file contains simple implementation of servicing component 7 | * without requests 8 | ************************************************************************/ 9 | /************************************************************************ 10 | * Include files. 11 | ************************************************************************/ 12 | 13 | #include "locservice/src/ServicingComponent.hpp" 14 | #include "areg/trace/GETrace.h" 15 | #include "areg/component/ComponentThread.hpp" 16 | #include "areg/appbase/Application.hpp" 17 | #include 18 | 19 | 20 | DEF_TRACE_SCOPE(examples_10_locservice_ServicingComponent_requestHelloWorld); 21 | DEF_TRACE_SCOPE(examples_10_locservice_ServicingComponent_requestShutdownService); 22 | 23 | Component * ServicingComponent::CreateComponent(const NERegistry::ComponentEntry & entry, ComponentThread & owner) 24 | { 25 | return DEBUG_NEW ServicingComponent(entry, owner); 26 | } 27 | 28 | void ServicingComponent::DeleteComponent(Component & compObject, const NERegistry::ComponentEntry & entry) 29 | { 30 | delete (&compObject); 31 | } 32 | 33 | ServicingComponent::ServicingComponent(const NERegistry::ComponentEntry & entry, ComponentThread & owner) 34 | : Component ( entry, owner ) 35 | , HelloWorldStub( static_cast(self()) ) 36 | , mRemainRequest( NEHelloWorld::MaxMessages ) 37 | { 38 | } 39 | 40 | void ServicingComponent::requestHelloWorld(const String & roleName) 41 | { 42 | TRACE_SCOPE(examples_10_locservice_ServicingComponent_requestHelloWorld); 43 | 44 | std::cout 45 | << "\"Hello client [ " 46 | << roleName 47 | << " ]!\", remain to process [ " 48 | << --mRemainRequest 49 | << " ]" << std::endl; 50 | 51 | responseHelloWorld( ); 52 | if ( mRemainRequest == 0 ) 53 | { 54 | TRACE_INFO( "Reached maximum to output messages, this should trigger the shutdown procedure." ); 55 | broadcastReachedMaximum( NEHelloWorld::MaxMessages ); 56 | } 57 | else 58 | { 59 | TRACE_WARN("Still wait [ %d ] requests to print Hello World.", mRemainRequest); 60 | } 61 | } 62 | 63 | void ServicingComponent::requestShutdownService( void ) 64 | { 65 | TRACE_SCOPE(examples_10_locservice_ServicingComponent_requestShutdownService); 66 | TRACE_DBG("The local client requests to shut down."); 67 | Application::signalAppQuit( ); 68 | } 69 | -------------------------------------------------------------------------------- /demo/17_winchat/chatter/services/NetworkSetup.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "chatter/res/stdafx.h" 3 | #include "chatter/services/NetworkSetup.hpp" 4 | #include "chatter/services/ConnectionHandler.hpp" 5 | #include "areg/component/Component.hpp" 6 | #include "areg/component/ComponentThread.hpp" 7 | #include "chatter/NEDistributedApp.hpp" 8 | #include "chatter/ui/DistributedDialog.hpp" 9 | 10 | #define MAKE_HWND(wnd) reinterpret_cast(wnd) 11 | 12 | NetworkSetup::NetworkSetup( const char * roleName, Component & owner, ConnectionHandler & handlerConnection ) 13 | : ConnectionManagerClientBase (roleName, owner.getMasterThread() ) 14 | 15 | , mConnectionHandler( handlerConnection ) 16 | { 17 | } 18 | 19 | 20 | NetworkSetup::~NetworkSetup( ) 21 | { 22 | } 23 | 24 | void NetworkSetup::responseConnect( const String & nickName, unsigned int cookie, const DateTime & dateTime, NEConnectionManager::eConnectionResult result ) 25 | { 26 | DateTime timeConnected = DateTime::getNow(); 27 | if (result == NEConnectionManager::eConnectionResult::ConnectionAccepted) 28 | { 29 | mConnectionHandler.SetNickName(nickName); 30 | mConnectionHandler.SetConnectCookie(cookie); 31 | mConnectionHandler.SetTimeConnect(dateTime); 32 | mConnectionHandler.SetTimeConnected(timeConnected); 33 | } 34 | else 35 | { 36 | mConnectionHandler.SetNickName(nickName); 37 | mConnectionHandler.SetCookie(NEConnectionManager::InvalidCookie); 38 | mConnectionHandler.SetConnectCookie(NEConnectionManager::InvalidCookie); 39 | mConnectionHandler.SetTimeConnect(DateTime()); 40 | mConnectionHandler.SetTimeConnected(DateTime()); 41 | } 42 | mConnectionHandler.SetRegistered( false ); 43 | bool isConnected = result == NEConnectionManager::eConnectionResult::ConnectionAccepted; 44 | DispatcherThread *dispThread = getDispatcherThread(); 45 | DistributedDialog::PostServiceMessage( NEDistributedApp::eWndCommands::CmdClientConnection, isConnected ? 1 : 0, reinterpret_cast(dispThread) ); 46 | } 47 | 48 | bool NetworkSetup::serviceConnected( bool isConnected, ProxyBase & proxy ) 49 | { 50 | bool result = false; 51 | if ( ConnectionManagerClientBase::serviceConnected( true, proxy ) ) 52 | { 53 | result = true; 54 | if ( isConnected ) 55 | DistributedDialog::PostServiceMessage( NEDistributedApp::eWndCommands::CmdServiceNetwork, 1, reinterpret_cast(getDispatcherThread()) ); 56 | else 57 | DistributedDialog::PostServiceMessage( NEDistributedApp::eWndCommands::CmdServiceNetwork, 0, 0 ); 58 | } 59 | return result; 60 | } 61 | 62 | void NetworkSetup::DisconnectServicing(void) 63 | { 64 | if (mConnectionHandler.GetRegistered()) 65 | { 66 | mConnectionHandler.SetRegistered(false); 67 | requestDisconnect( mConnectionHandler.GetNickName(), mConnectionHandler.GetCookie(), mConnectionHandler.GetTimeConnect() ); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /demo/10_locsvc/10_generated.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {4056956C-7E12-4432-86F8-D900A52866A4} 11 | 10_generated 12 | 10_generated 13 | Win32Proj 14 | 15 | 16 | 17 | StaticLibrary 18 | 19 | 20 | 21 | 22 | 23 | 24 | $(OutLibDir)\ 25 | 26 | 27 | 28 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 29 | 30 | 31 | Console 32 | 33 | 34 | 35 | 36 | true 37 | true 38 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 39 | 40 | 41 | Console 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /demo/17_winchat/chatter/ui/PageNetworkSetup.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "areg/base/String.hpp" 4 | #include "chatter/res/resource.h" 5 | #include "generated/NEConnectionManager.hpp" 6 | 7 | class Component; 8 | class NetworkSetup; 9 | class DispatcherThread; 10 | class ConnectionHandler; 11 | 12 | // PageNetworkSetup dialog 13 | 14 | class PageNetworkSetup : public CPropertyPage 15 | { 16 | DECLARE_DYNAMIC(PageNetworkSetup) 17 | 18 | public: 19 | PageNetworkSetup( ConnectionHandler & handlerConnection); 20 | virtual ~PageNetworkSetup(); 21 | 22 | // Dialog Data 23 | enum { IDD = IDD_PAGE_SETUP_NETWORK }; 24 | 25 | public: 26 | 27 | void OnServiceStartup( bool isStarted, Component * owner ); 28 | void OnServiceNetwork( bool isConnected, DispatcherThread * ownerThread ); 29 | void OnServiceConnection( bool isConnected, DispatcherThread * ownerThread ); 30 | void OnClientConnection( bool isConnected, DispatcherThread *dispThread ); 31 | void OnClientRegistration( bool isRegistered, DispatcherThread * dispThread ); 32 | void OnAddConnection( NEConnectionManager::sConnection & data ); 33 | void OnRemoveConnection( NEConnectionManager::sConnection & data ); 34 | void OnUpdateConnection( void ); 35 | void OnDisconnectTriggered( void ); 36 | 37 | void OnDefaultClicked( void ); 38 | 39 | protected: 40 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 41 | virtual BOOL OnInitDialog( ); 42 | 43 | DECLARE_MESSAGE_MAP() 44 | public: 45 | afx_msg void OnDestroy( ); 46 | afx_msg void OnClickedBrokerConnect(); 47 | afx_msg void OnClickedBrokerDisconnect(); 48 | afx_msg void OnClickedButtonRegister( ); 49 | afx_msg void OnUpdateEditNickname(); 50 | afx_msg void OnKickIdle( ); 51 | afx_msg void OnBnUpdateBrokerConnect( CCmdUI* pCmdUI); 52 | afx_msg void OnBnUdateBrokerDisconnect( CCmdUI* pCmdUI); 53 | afx_msg void OnUpdateRemoteData( CCmdUI* pCmdUI ); 54 | afx_msg void OnUpdateNickname( CCmdUI* pCmdUI ); 55 | afx_msg void OnUpdateButtonRegister( CCmdUI* pCmdUI ); 56 | 57 | private: 58 | void cleanService( void ); 59 | 60 | bool isServiceConnected( void ) const; 61 | 62 | bool canRegistered( void ) const; 63 | 64 | void setFocusNickname( void ) const; 65 | 66 | private: 67 | // IP Address of service broker 68 | CIPAddressCtrl mCtrlAddress; 69 | // Port number of service broker 70 | CEdit mCtrlPort; 71 | // The nick name of connected client 72 | CString mNickName; 73 | // // The nick-name field control 74 | CEdit mCtrlNickName; 75 | // The port number of service broker 76 | USHORT mBrokerPort; 77 | // Network setup service client 78 | NetworkSetup * mNetworkSetup; 79 | // Flag, indicating whether the network connection is pending or not 80 | ConnectionHandler & mConnectionHandler; 81 | bool mConnectPending; 82 | bool mRegisterPending; 83 | BOOL mConnectEnable; 84 | BOOL mDisconnectEnabled; 85 | BOOL mRegisterEnabled; 86 | }; 87 | -------------------------------------------------------------------------------- /demo/17_winchat/chatter/services/ConnectionService.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /************************************************************************ 3 | * \file chatter/services/ConnectionService.hpp 4 | * \brief The connection manager client component implementation 5 | ************************************************************************/ 6 | 7 | #include "areg/base/GEGlobal.h" 8 | #include "areg/component/Component.hpp" 9 | 10 | class ConnectionService : public Component 11 | { 12 | ////////////////////////////////////////////////////////////////////////// 13 | // Create and delete component 14 | ////////////////////////////////////////////////////////////////////////// 15 | public: 16 | static Component * CreateComponent( const NERegistry::ComponentEntry & entry, ComponentThread & owner ); 17 | 18 | static void DeleteComponent( Component & compObject, const NERegistry::ComponentEntry & entry ); 19 | 20 | public: 21 | 22 | /************************************************************************/ 23 | // Component overrides 24 | /************************************************************************/ 25 | /** 26 | * \brief This function is triggered by component thread when it 27 | * requires component to start up. Set listeners and make 28 | * initialization in this function call. 29 | * \param comThread The component thread, which triggered startup command 30 | **/ 31 | virtual void startupComponent( ComponentThread & comThread ); 32 | 33 | /** 34 | * \brief This function is triggered by component thread when it 35 | * requires component to shut down. Remove listeners and 36 | * make cleanups in this function call. 37 | * \param comThread The component thread, which triggered shutdown command. 38 | **/ 39 | virtual void shutdownComponent( ComponentThread & comThread ); 40 | 41 | ////////////////////////////////////////////////////////////////////////// 42 | // Hidden constructor / destructor 43 | ////////////////////////////////////////////////////////////////////////// 44 | private: 45 | ConnectionService( const NERegistry::ComponentEntry & entry, ComponentThread & ownerThread ); 46 | virtual ~ConnectionService( void ) = default; 47 | 48 | ////////////////////////////////////////////////////////////////////////// 49 | // Hidden methods 50 | ////////////////////////////////////////////////////////////////////////// 51 | private: 52 | inline ConnectionService & self( void ); 53 | 54 | ////////////////////////////////////////////////////////////////////////// 55 | // Forbidden calls 56 | ////////////////////////////////////////////////////////////////////////// 57 | ConnectionService( void ); 58 | ConnectionService( const ConnectionService & /*src*/ ); 59 | const ConnectionService & operator = ( const ConnectionService & /*src*/ ); 60 | }; 61 | 62 | ////////////////////////////////////////////////////////////////////////// 63 | // ConnectionService inline methods 64 | ////////////////////////////////////////////////////////////////////////// 65 | 66 | inline ConnectionService & ConnectionService::self( void ) 67 | { return (*this); } 68 | -------------------------------------------------------------------------------- /demo/21_pubunblock/21_generated.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {EB228067-EA4D-452C-91FC-91DB3B445C31} 11 | 21_generated 12 | 21_generated 13 | Win32Proj 14 | 15 | 16 | 17 | StaticLibrary 18 | 19 | 20 | 21 | 22 | 23 | 24 | $(OutLibDir)\ 25 | 26 | 27 | 28 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 29 | 30 | 31 | Console 32 | 33 | 34 | 35 | 36 | true 37 | true 38 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 39 | 40 | 41 | Console 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AREG SDK Demo Project 2 | 3 | --- 4 | 5 | ## Repository Status 6 | 7 | [![CMake](https://github.com/aregtech/cpp-action-workflows/actions/workflows/cmake.yml/badge.svg?branch=master)](https://github.com/aregtech/cpp-action-workflows/actions/workflows/cmake.yml) 8 | [![MSBuild](https://github.com/aregtech/cpp-action-workflows/actions/workflows/msbuild.yml/badge.svg?branch=master)](https://github.com/aregtech/cpp-action-workflows/actions/workflows/msbuild.yml) 9 | [![Cygwin](https://github.com/aregtech/cpp-action-workflows/actions/workflows/cygwin.yml/badge.svg)](https://github.com/aregtech/cpp-action-workflows/actions/workflows/cygwin.yml) 10 | 11 | --- 12 | 13 | ## Introduction 14 | 15 | While was developing the [AREG SDK](https://github.com/aregtech/areg-sdk/), I spent lot of time to look for various workflow actions to automate build and test run. I've seen many examples and experiments and finally decided to share my with others. These workflows for sure are not the optimal, it is out of the agenda, but I hope it is a good practice. Let's say, this is kind of playground. 16 | 17 | I've used [areg-sdk-demo](https://github.com/aregtech/areg-sdk-demo) template repository, it compiles with CMake, Make (_planned_), Microsoft Visual Studio and compiles with Windows Subsystem for Linux (WSL). In addition, it has [areg-sdk](https://github.com/aregtech/areg-sdk/) as a submodule and has google tests. So, it has enough complication. 18 | 19 | --- 20 | 21 | ## Clone Sources 22 | 23 | To clone the repository, follow these steps in your desired directory (such as the `projects` directory): 24 | 25 | * Run the following command **to clone the repository and its submodules**: 26 | ```bash 27 | git clone --recurse-submodules https://github.com/aregtech/cpp-action-workflows.git 28 | ``` 29 | It is important to clone the AREG SDK *submodule* as well. This command ensures that both the main repository and its submodule are cloned. 30 | 31 | * If you have already cloned the main repository but missed cloning the submodule, you can **update the submodules** separately by running the following command: 32 | ```bash 33 | git submodule update --init --recursive 34 | ``` 35 | This command initializes and updates the submodules within the repository. 36 | 37 | * The AREG SDK also has dependencies on [Google Unit Test](https://github.com/google/googletest), which is automatically cloned with the AREG SDK sources. **To update to the latest submodule sources**, use the following git command: 38 | ```bash 39 | git submodule update --remote --recursive 40 | ``` 41 | This command updates the submodules, including the Google Unit Test submodule, to the latest version. 42 | 43 | --- 44 | 45 | ## Workflows 46 | 47 | The workflows are located in the [.github/workflows](https://github.com/aregtech/cpp-action-workflows/tree/master/.github/workflows) directory. I'll periodically add and/or update them. 48 | 49 | --- 50 | 51 | ## License 52 | 53 | The files and sources in this repository are provided under the [MIT License](https://github.com/aregtech/areg-sdk-demo/blob/main/LICENSE). They are offered without any warranty or restriction, allowing you the freedom to use them in any kind of project. 54 | 55 | --- 56 | -------------------------------------------------------------------------------- /demo/17_winchat/chatter/services/ChatParticipantService.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * \file chatter/services/ChatParticipantService.cpp 3 | * \brief The chat participant service 4 | ************************************************************************/ 5 | #include "chatter/res/stdafx.h" 6 | #include "chatter/services/ChatParticipantService.hpp" 7 | #include "areg/component/ComponentThread.hpp" 8 | #include "chatter/ui/PageChat.hpp" 9 | 10 | Component * ChatParticipantService::CreateComponent( const NERegistry::ComponentEntry & entry, ComponentThread & owner ) 11 | { 12 | PageChat * page = reinterpret_cast(entry.getComponentData( ).alignClsPtr.mElement); 13 | ASSERT( page != nullptr ); 14 | return (page != nullptr ? new ChatParticipantService( entry, owner, static_cast(*page) ) : nullptr); 15 | } 16 | 17 | void ChatParticipantService::DeleteComponent( Component & compObject, const NERegistry::ComponentEntry & entry ) 18 | { 19 | delete (&compObject); 20 | } 21 | 22 | NERegistry::Model ChatParticipantService::GetModel( const NEDirectMessager::sParticipant & initiator, const NEDirectMessager::ListParticipants & listParticipants, NEMemory::uAlign data ) 23 | { 24 | String serviceName = NEDistributedApp::getDirectMessagingRole( initiator.nickName, initiator.cookie, initiator.sessionId, true ); 25 | String roleName = NEDistributedApp::getDirectMessagingRole( initiator.nickName, initiator.cookie, initiator.sessionId, false ); 26 | String threadName = NEDistributedApp::PREFIX_TRHEAD + roleName; 27 | String modelName = NEDistributedApp::PREFIX_MODEL + roleName; 28 | 29 | NERegistry::DependencyEntry dependency(serviceName); 30 | NERegistry::DependencyList listDependencies( dependency); 31 | NERegistry::ComponentEntry componentEntry( threadName, roleName, &ChatParticipantService::CreateComponent, ChatParticipantService::DeleteComponent, NERegistry::ServiceList( ), listDependencies, NERegistry::WorkerThreadList( ) ); 32 | componentEntry.setComponentData( data ); 33 | NERegistry::ComponentList componentList( componentEntry ); 34 | NERegistry::ComponentThreadEntry threadEntry( threadName, componentList ); 35 | NERegistry::ComponentThreadList threadList( threadEntry ); 36 | NERegistry::Model model( modelName, threadList ); 37 | 38 | return model; 39 | } 40 | 41 | ChatParticipantService::ChatParticipantService( const NERegistry::ComponentEntry & entry, ComponentThread & ownerThread, ChatPrticipantHandler & handlerParticipants ) 42 | : Component ( entry, ownerThread ) 43 | 44 | , mChatParticipant ( static_cast(self()), entry.mDependencyServices[0].mRoleName, handlerParticipants ) 45 | { 46 | } 47 | 48 | ChatParticipantService::~ChatParticipantService( void ) 49 | { 50 | } 51 | 52 | void ChatParticipantService::startupComponent( ComponentThread & comThread ) 53 | { 54 | Component::startupComponent(comThread); 55 | } 56 | 57 | void ChatParticipantService::shutdownComponent( ComponentThread & comThread ) 58 | { 59 | Component::shutdownComponent(comThread); 60 | } 61 | -------------------------------------------------------------------------------- /demo/12_pubsvc/12_generated.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {CCBBF424-D22D-480F-A13E-28095E33827C} 11 | 12_generated 12 | 12_generated 13 | Win32Proj 14 | 15 | 16 | 17 | StaticLibrary 18 | 19 | 20 | 21 | 22 | 23 | 24 | $(OutLibDir)\ 25 | 26 | 27 | 28 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 29 | 30 | 31 | Console 32 | 33 | 34 | 35 | 36 | true 37 | true 38 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 39 | 40 | 41 | Console 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /demo/17_winchat/chatter/ui/PageConnections.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "areg/base/GEGlobal.h" 4 | #include "chatter/res/resource.h" 5 | #include "areg/base/String.hpp" 6 | #include "generated/NEDirectConnection.hpp" 7 | #include "generated/NEConnectionManager.hpp" 8 | 9 | class String; 10 | class Component; 11 | class ConnectionList; 12 | class DispatcherThread; 13 | class ConnectionHandler; 14 | 15 | // PageConnections dialog 16 | 17 | class PageConnections : public CPropertyPage 18 | { 19 | static LPCTSTR HEADER_TITILES[]; 20 | DECLARE_DYNAMIC(PageConnections) 21 | 22 | public: 23 | PageConnections(ConnectionHandler & handlerConnection); 24 | virtual ~PageConnections(); 25 | 26 | // Dialog Data 27 | enum { IDD = IDD_PAGE_CONNECTIONS }; 28 | 29 | public: 30 | 31 | void OnServiceStartup( bool isStarted, Component * owner ); 32 | void OnServiceNetwork( bool isConnected, DispatcherThread * ownerThread ); 33 | void OnServiceConnection( bool isConnected, DispatcherThread * ownerThread ); 34 | void OnClientConnection( bool isConnected, DispatcherThread *dispThread ); 35 | void OnClientRegistration( bool isRegistered, DispatcherThread * dispThread ); 36 | void OnAddConnection( NEConnectionManager::sConnection & data ); 37 | void OnRemoveConnection( NEConnectionManager::sConnection & data ); 38 | void OnUpdateConnection( void ); 39 | void OnDisconnectTriggered( void ); 40 | 41 | void OnDefaultClicked( void ); 42 | 43 | public: 44 | 45 | const String & GetRegisteredName( void ) const; 46 | 47 | const uint32_t GetRegisteredCookie( void ) const; 48 | 49 | protected: 50 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 51 | virtual BOOL OnInitDialog( ); 52 | 53 | DECLARE_MESSAGE_MAP() 54 | protected: 55 | afx_msg void OnClickedButtonInitiateChat( ); 56 | afx_msg void OnKickIdle( ); 57 | afx_msg void OnBnUpdateInitiateChat( CCmdUI* pCmdUI ); 58 | afx_msg void OnDestroy( ); 59 | 60 | private: 61 | inline void cleanService( void ); 62 | 63 | inline bool isServiceConnected( void ) const; 64 | 65 | inline void setHeaders( void ); 66 | 67 | inline int getSelectedConnections( NEDirectConnection::sInitiator & outParticipant, NEDirectConnection::ListParticipants & outListParticipants ); 68 | 69 | inline void addConnection( const NEConnectionManager::sConnection & connection ); 70 | 71 | inline int findConnection( const NEConnectionManager::sConnection & connection ) const; 72 | 73 | inline void removeConnection( const NEConnectionManager::sConnection & connection ); 74 | 75 | inline void unloadModel( void ); 76 | 77 | inline bool loadModel( const String & nickName, const uint32_t cookie ); 78 | 79 | private: 80 | // List of connections 81 | CListCtrl mCtrlConnections; 82 | // Connection list service client 83 | ConnectionList * mClientConnections; 84 | // The name of direct connection model, which contains service 85 | String mDirectConnectModel; 86 | // The name of generated direct connection service 87 | String mDirectConnectService; 88 | // The instance of connection handler object 89 | ConnectionHandler & mConnectionHandler; 90 | BOOL mChatEnable; 91 | }; 92 | -------------------------------------------------------------------------------- /demo/19_pubwatchdog/19_generated.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {F6570975-AE13-41EB-8465-066A6766C211} 11 | 19_generated 12 | 19_generated 13 | Win32Proj 14 | 15 | 16 | 17 | StaticLibrary 18 | 19 | 20 | 21 | 22 | 23 | 24 | $(OutLibDir)\ 25 | 26 | 27 | 28 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 29 | 30 | 31 | Console 32 | 33 | 34 | 35 | 36 | true 37 | true 38 | IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions) 39 | 40 | 41 | Console 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /.github/workflows/msbuild.yml: -------------------------------------------------------------------------------- 1 | # This workflow uses actions that are not certified by GitHub. 2 | # They are provided by a third-party and are governed by 3 | # separate terms of service, privacy policy, and support 4 | # documentation. 5 | 6 | name: MSBuild 7 | 8 | on: 9 | push: 10 | branches: [ master ] 11 | pull_request: 12 | branches: [ master ] 13 | 14 | env: 15 | # Path to the solution file relative to the root of the project. 16 | SOLUTION_FILE_PATH: . 17 | 18 | # Configuration type to build. 19 | # You can convert this to a build matrix if you need coverage of multiple configuration types. 20 | # https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix 21 | BUILD_CONFIGURATION: Release 22 | 23 | permissions: 24 | contents: read 25 | 26 | jobs: 27 | build-tests: 28 | name: ${{matrix.config.name}} 29 | runs-on: windows-latest 30 | 31 | strategy: 32 | fail-fast: false 33 | matrix: 34 | config: # Create matrix with combinations 35 | # Compile for 32-bit platform, enabled AREG extensions and logs 36 | - {name: MSBuild-Win32-ext-log, platform: Win32, extend: 1, logs: 1} 37 | # Compile for 32-bit platform, enabled AREG extensions and no logs 38 | - {name: MSBuild-Win32-ext-nolog, platform: Win32, extend: 1, logs: 0} 39 | # Compile for 32-bit platform, disable AREG extensions and logs 40 | - {name: MSBuild-Win32-noext-log, platform: Win32, extend: 0, logs: 1} 41 | # Compile for 32-bit platform, disable AREG extensions and no logs 42 | - {name: MSBuild-Win32-noext-nolog, platform: Win32, extend: 0, logs: 0} 43 | # Compile for 32-bit platform, enabled AREG extensions and logs 44 | - {name: MSBuild-x64-ext-log, platform: x64, extend: 1, logs: 1} 45 | # Compile for 32-bit platform, enabled AREG extensions and no logs 46 | - {name: MSBuild-x64-ext-nolog, platform: x64, extend: 1, logs: 0} 47 | # Compile for 32-bit platform, disable AREG extensions and logs 48 | - {name: MSBuild-x64-noext-log, platform: x64, extend: 0, logs: 1} 49 | # Compile for 32-bit platform, disable AREG extensions and no logs 50 | - {name: MSBuild-x64-noext-nolog, platform: x64, extend: 0, logs: 0} 51 | 52 | steps: 53 | - name: Checkout AREG engine (AREG SDK) source codes and submodules 54 | uses: actions/checkout@v3 55 | with: 56 | submodules: recursive 57 | 58 | - name: Add MSBuild to PATH 59 | uses: microsoft/setup-msbuild@v1.0.2 60 | 61 | - name: Restore NuGet packages 62 | working-directory: ${{env.GITHUB_WORKSPACE}} 63 | run: nuget restore ${{env.SOLUTION_FILE_PATH}} 64 | 65 | - name: Build areg-sdk solution. 66 | working-directory: ${{env.GITHUB_WORKSPACE}} 67 | # Add additional options to the MSBuild command line here (like platform or verbosity level). 68 | # See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference 69 | run: msbuild /m /property:Configuration=${{env.BUILD_CONFIGURATION}} /property:Platform=${{matrix.config.platform}} /property:AregExtended=${{matrix.config.extend}} /property:AregLogs=${{matrix.config.logs}} ${{env.SOLUTION_FILE_PATH}} 70 | -------------------------------------------------------------------------------- /demo/16_pubfsm/res/PowerManager.siml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | This is a power manager of Traffic Light Controller. It powers the lights ON and OFF. 5 | 6 | 7 | 8 | The power state of the traffic lights. 9 | 10 | 11 | 12 | The lights are OFF 13 | 14 | 15 | 16 | The lights are ON. 17 | 18 | 19 | 20 | 21 | 22 | 23 | The power state of the traffic lights. 24 | 25 | 26 | 27 | 28 | Called to power ON the traffic lights. 29 | 30 | 31 | Called to power OFF the traffic lights. 32 | 33 | 34 | Triggered to start the traffic light 35 | 36 | 37 | Sent as a response to start the traffic light. The traffic light can be started when it is powered ON and in initialization state. 38 | 39 | 40 | Flag, indicating whether the operation succeeded or not. 41 | This flag is 'true' if lights are initialization state of if traffic light is already functioning. 42 | This flag is 'false' if lights are OFF. 43 | 44 | 45 | 46 | 47 | Call to stop the traffic lights and put them in initialization state. 48 | 49 | 50 | Response to stop the traffic lights. 51 | 52 | 53 | Flag, indicating whether the request was processed with success or not. 54 | This flag is 'true' if traffic light are functioning or lights are in initialization state. 55 | This flag is 'false' if traffic lights are OFF. 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /demo/README.md: -------------------------------------------------------------------------------- 1 | # Demos 2 | 3 | ``` 4 | This file is part of AREG SDK demo 5 | Copyright (c) 2022-2023, Aregtech 6 | Contact: info[at]aregtech.com 7 | Website: https://www.aregtech.com 8 | ``` 9 | 10 | ## Quick Build 11 | 12 | The AREG SDK provides a collection of demos that showcase the how to integrate AREG Framework in the projects. 13 | 14 | Please note that examples labeled as **IPC** (Inter-Process Communication) require the utilization of [_mcrouter_](https://github.com/aregtech/areg-sdk/tree/master/framework/mcrouter) and involve _Public_ services. To successfully test IPC applications, ensure that `mcrouter` is running. Examples not marked as **IPC** only involve _Local_ services and do not require `mcrouter` usage. 15 | 16 | To compile the examples, you must first build the _areg_ library and _mcrouter_. The examples can be built using `cmake`, `make`, or `msbuild`. To enable or disable the building of examples, utilize the `AREG_BUILD_EXAMPLES` option in `make` or `cmake`. By default, it is enabled. To disable it, set it to `OFF` or `0`. 17 | 18 | Example of quick build using `cmake`: 19 | ```bash 20 | cmake -B ./build 21 | cmake --build ./build -j 8 22 | ``` 23 | 24 | Example of quick build using `msbuild`: 25 | ```bash 26 | msbuild . 27 | ``` 28 | 29 | For more detailed information about the build process and the supported options, refer to the [Software-build](https://github.com/aregtech/areg-sdk/wiki/03.-Software-build) Wiki page of the AREG SDK. 30 | 31 | --- 32 | 33 | # List of Demos 34 | 35 | Here is a list of demos available in the AREG SDK: 36 | 37 | 1. [01_hello](https://github.com/aregtech/areg-sdk-demo/tree/main/demo/01_hello) - A multithreading console application that outputs the "Hello World" message. 38 | 2. [04_trace](https://github.com/aregtech/areg-sdk-demo/tree/main/demo/04_trace) - A multithreading console application for starting and using logging. 39 | 3. [05_timer](https://github.com/aregtech/areg-sdk-demo/tree/main/demo/05_timer) - A multithreading console application for starting the Timer Service and using various timers. 40 | 4. [10_locsvc](https://github.com/aregtech/areg-sdk-demo/tree/main/demo/10_locsvc) - A multithreading console application demonstrating a _Local_ servicing component. 41 | 5. [12_pubsvc](https://github.com/aregtech/areg-sdk-demo/tree/main/demo/12_pubsvc) - A multiprocessing (**IPC**) application demonstrating a _Public_ service and the service client. 42 | 6. [16_pubfsm](https://github.com/aregtech/areg-sdk-demo/tree/main/demo/16_pubfsm) - A multiprocessing (**IPC**) application demonstrating the work of a Finite State-Machine (FSM) using AREG framework features. 43 | 7. [17_winchat](https://github.com/aregtech/areg-sdk-demo/tree/main/demo/17_winchat) - A Windows GUI application (**IPC**) demonstrating dynamic modeling, fault tolerance, and a distributed system. 44 | 8. [19_pubwatchdog](https://github.com/aregtech/areg-sdk-demo/tree/main/demo/19_pubwatchdog) - A multiprocessing (**IPC**) application demonstrating the watchdog feature with a local service. 45 | 9. [21_pubunblock](https://github.com/aregtech/areg-sdk-demo/tree/main/demo/21_pubunblock) - A multiprocessing (**IPC**) application demonstrating manual unblocking of requests to process more pending requests. 46 | 47 | Please note that the list may be updated periodically. We recommend checking the list regularly. 48 | 49 | For more details about each project, refer to t6he _ReadMe.md_ file of each demo project. -------------------------------------------------------------------------------- /demo/10_locsvc/locservice/src/ServiceClient.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * \file locservice/src/ServiceClient.cpp 3 | * \ingroup AREG Asynchronous Event-Driven Communication Framework examples 4 | * \author Artak Avetyan 5 | * \brief Collection of AREG SDK examples. 6 | * This file contains simple implementation of service client to 7 | * request message output 8 | ************************************************************************/ 9 | /************************************************************************ 10 | * Include files. 11 | ************************************************************************/ 12 | #include "locservice/src/ServiceClient.hpp" 13 | #include "areg/trace/GETrace.h" 14 | 15 | DEF_TRACE_SCOPE(examples_10_locservice_ServiceClient_serviceConnected); 16 | DEF_TRACE_SCOPE(examples_10_locservice_ServiceClient_broadcastReachedMaximum); 17 | DEF_TRACE_SCOPE(examples_10_locservice_ServiceClient_responseHelloWorld); 18 | DEF_TRACE_SCOPE(examples_10_locservice_ServiceClient_processTimer); 19 | 20 | Component * ServiceClient::CreateComponent(const NERegistry::ComponentEntry & entry, ComponentThread & owner) 21 | { 22 | return DEBUG_NEW ServiceClient(entry, owner); 23 | } 24 | 25 | void ServiceClient::DeleteComponent(Component & compObject, const NERegistry::ComponentEntry & entry) 26 | { 27 | delete (&compObject); 28 | } 29 | 30 | ServiceClient::ServiceClient(const NERegistry::ComponentEntry & entry, ComponentThread & owner) 31 | : Component ( entry, owner ) 32 | , HelloWorldClientBase ( entry.mDependencyServices[0].mRoleName, static_cast(self()) ) 33 | , IETimerConsumer ( ) 34 | 35 | , mTimer (static_cast(self()), entry.mRoleName) 36 | { 37 | } 38 | 39 | bool ServiceClient::serviceConnected(bool isConnected, ProxyBase & proxy) 40 | { 41 | TRACE_SCOPE(examples_10_locservice_ServiceClient_serviceConnected); 42 | bool result = HelloWorldClientBase::serviceConnected(isConnected, proxy); 43 | 44 | TRACE_DBG("Client [ %s ] of [ %s ] service is [ %s ]" 45 | , proxy.getProxyAddress().getRoleName().getString() 46 | , proxy.getProxyAddress().getServiceName().getString() 47 | , isConnected ? "connected" : "disconnected"); 48 | 49 | // subscribe when service connected and un-subscribe when disconnected. 50 | notifyOnBroadcastReachedMaximum(isConnected); 51 | if (isConnected) 52 | { 53 | mTimer.startTimer(ServiceClient::TIMEOUT_VALUE); 54 | } 55 | else 56 | { 57 | mTimer.stopTimer(); 58 | } 59 | 60 | return result; 61 | } 62 | 63 | void ServiceClient::responseHelloWorld( void ) 64 | { 65 | TRACE_SCOPE(examples_10_locservice_ServiceClient_responseHelloWorld); 66 | TRACE_DBG("Received response on request to print greetings from the client"); 67 | } 68 | 69 | void ServiceClient::broadcastReachedMaximum( int maxNumber ) 70 | { 71 | TRACE_SCOPE(examples_10_locservice_ServiceClient_broadcastReachedMaximum ); 72 | TRACE_WARN("Service notify reached maximum number of requests [ %d ], starting shutdown procedure", maxNumber ); 73 | requestShutdownService( ); 74 | } 75 | 76 | void ServiceClient::processTimer(Timer & timer) 77 | { 78 | TRACE_SCOPE(examples_10_locservice_ServiceClient_processTimer); 79 | ASSERT(&timer == &mTimer); 80 | 81 | TRACE_DBG("Timer [ %s ] expired, send request to output message.", timer.getName().getString()); 82 | requestHelloWorld(getRoleName()); 83 | } 84 | -------------------------------------------------------------------------------- /demo/12_pubsvc/res/HelloWorld.siml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Simple Service Interface to demonstrate working features of AREG SDK. 5 | 6 | 7 | 8 | The dummy structure describing connected client. 9 | 10 | 11 | 0 12 | The ID of client, given by servicing component 13 | 14 | 15 | 16 | The role name of client component. Parameter received by client. 17 | 18 | 19 | 20 | 21 | 22 | 23 | Request to print hello world 24 | 25 | 26 | The role name of client component that requested to print hello world 27 | 28 | 29 | 30 | 31 | The response to hello world request. 32 | 33 | 34 | The client information set by servicing component. If empty or invalid ID, the message output failed. 35 | 36 | 37 | 38 | 39 | Sent by client to request to shutdown service and the application. This request has no response. 40 | 41 | 42 | The ID of client that requests to shutdown. The ID is given by service when first time client requests to output message. 43 | 44 | 45 | Service client component role name 46 | 47 | 48 | 49 | 50 | Triggered to notify that reached the maximum number of requests. 51 | 52 | 53 | The maximum number of reqeusts. 54 | 55 | 56 | 57 | 58 | 59 | 60 | 37 61 | The maximum number of messages to output. 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /demo/17_winchat/chatter/services/NetworkSetup.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "generated/ConnectionManagerClientBase.hpp" 3 | 4 | class Component; 5 | class ConnectionHandler; 6 | 7 | class NetworkSetup : public ConnectionManagerClientBase 8 | { 9 | public: 10 | NetworkSetup( const char * roleName, Component & owner, ConnectionHandler & handlerConnection ); 11 | virtual ~NetworkSetup( ); 12 | 13 | void DisconnectServicing( void ); 14 | 15 | ////////////////////////////////////////////////////////////////////////// 16 | // ConnectionManager Interface Attributes 17 | ////////////////////////////////////////////////////////////////////////// 18 | private: 19 | /************************************************************************ 20 | * Attribute ConnectionList functions 21 | ************************************************************************/ 22 | /** 23 | * \brief Response callback. 24 | * The result of connection request. 25 | * Overwrite, if need to handle Response call of server object. 26 | * This call will be automatically triggered, on every appropriate request call 27 | * \param nickName Client connection data, which contains nick name and connection date-time 28 | * \param cookie Connection assigned cookie for client service 29 | * \param dateTime The client service connection time-stamp in UTC 30 | * \param result The connection operation result 31 | * \see requestConnect 32 | **/ 33 | virtual void responseConnect( const String & nickName, unsigned int cookie, const DateTime & dateTime, NEConnectionManager::eConnectionResult result ); 34 | 35 | /************************************************************************/ 36 | // IEProxyListener Overrides 37 | /************************************************************************/ 38 | /** 39 | * \brief Triggered by Proxy, when gets service connected event. 40 | * Make client initializations in this function. No request 41 | * will be processed until this function is not called for 42 | * client object. Also set listeners here if client is interested 43 | * to receive update notifications. 44 | * \param isConnected The flag, indicating whether service is connected 45 | * or disconnected. Make cleanups and stop sending 46 | * requests or assigning for notification if 47 | * this flag is false. No event to Stub target will 48 | * be sent, until no service connected event is 49 | * received. 50 | * \param proxy The Service Interface Proxy object, which is 51 | * notifying service connection. 52 | * \return Return true if this service connect notification was relevant to client object, 53 | * i.e. if passed Proxy address is equal to the Proxy object that client has. 54 | * If Proxy objects are not equal, it should return false; 55 | **/ 56 | virtual bool serviceConnected( bool isConnected, ProxyBase & proxy ); 57 | 58 | private: 59 | ConnectionHandler & mConnectionHandler; 60 | 61 | ////////////////////////////////////////////////////////////////////////// 62 | // Forbidden calls 63 | ////////////////////////////////////////////////////////////////////////// 64 | private: 65 | NetworkSetup( void ) = delete; 66 | NetworkSetup( const NetworkSetup & /*src*/ ) = delete; 67 | const NetworkSetup & operator = ( const NetworkSetup & /*src*/ ) = delete; 68 | }; 69 | -------------------------------------------------------------------------------- /demo/17_winchat/chatter/services/ChatParticipantService.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /************************************************************************ 3 | * \file chatter/services/ChatParticipantService.hpp 4 | * \brief The chat participant service 5 | ************************************************************************/ 6 | 7 | #include "areg/base/GEGlobal.h" 8 | #include "areg/component/Component.hpp" 9 | #include "areg/component/NERegistry.hpp" 10 | #include "chatter/services/DirectMessagingClient.hpp" 11 | #include "generated/NECommon.hpp" 12 | 13 | class ComponentThread; 14 | 15 | class ChatParticipantService : private Component 16 | { 17 | ////////////////////////////////////////////////////////////////////////// 18 | // Create and delete component 19 | ////////////////////////////////////////////////////////////////////////// 20 | public: 21 | static Component * CreateComponent( const NERegistry::ComponentEntry & entry, ComponentThread & owner ); 22 | 23 | static void DeleteComponent( Component & compObject, const NERegistry::ComponentEntry & entry ); 24 | 25 | static NERegistry::Model GetModel( const NEDirectMessager::sParticipant & initiator, const NEDirectMessager::ListParticipants & listParticipants, NEMemory::uAlign data ); 26 | 27 | protected: 28 | /************************************************************************/ 29 | // Component overrides 30 | /************************************************************************/ 31 | /** 32 | * \brief This function is triggered by component thread when it 33 | * requires component to start up. Set listeners and make 34 | * initialization in this function call. 35 | * \param comThread The component thread, which triggered startup command 36 | **/ 37 | virtual void startupComponent( ComponentThread & comThread ); 38 | 39 | /** 40 | * \brief This function is triggered by component thread when it 41 | * requires component to shut down. Remove listeners and 42 | * make cleanups in this function call. 43 | * \param comThread The component thread, which triggered shutdown command. 44 | **/ 45 | virtual void shutdownComponent( ComponentThread & comThread ); 46 | 47 | private: 48 | ChatParticipantService( const NERegistry::ComponentEntry & entry, ComponentThread & ownerThread, ChatPrticipantHandler & handlerParticipants ); 49 | virtual ~ChatParticipantService( void ); 50 | 51 | ////////////////////////////////////////////////////////////////////////// 52 | // Hidden methods 53 | ////////////////////////////////////////////////////////////////////////// 54 | private: 55 | DirectMessagingClient mChatParticipant; 56 | 57 | ////////////////////////////////////////////////////////////////////////// 58 | // Hidden methods 59 | ////////////////////////////////////////////////////////////////////////// 60 | private: 61 | inline ChatParticipantService & self( void ); 62 | 63 | ////////////////////////////////////////////////////////////////////////// 64 | // Forbidden calls 65 | ////////////////////////////////////////////////////////////////////////// 66 | ChatParticipantService( void ); 67 | ChatParticipantService( const ChatParticipantService & /*src*/ ); 68 | const ChatParticipantService & operator = (const ChatParticipantService & /*src*/); 69 | }; 70 | 71 | ////////////////////////////////////////////////////////////////////////// 72 | // ChatParticipantService inline methods 73 | ////////////////////////////////////////////////////////////////////////// 74 | 75 | inline ChatParticipantService & ChatParticipantService::self( void ) 76 | { 77 | return (*this); 78 | } 79 | -------------------------------------------------------------------------------- /demo/17_winchat/chatter/ui/PageMessaging.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "areg/base/String.hpp" 4 | #include "areg/base/TEArrayList.hpp" 5 | #include "generated/NECommon.hpp" 6 | #include "chatter/res/resource.h" 7 | #include "generated/NEConnectionManager.hpp" 8 | 9 | class Component; 10 | class DispatcherThread; 11 | class CentralMessaging; 12 | class ConnectionHandler; 13 | class ConnectionList; 14 | 15 | // PageMessaging dialog 16 | 17 | class PageMessaging : public CPropertyPage 18 | { 19 | static LPCTSTR HEADER_TITILES[]; 20 | 21 | DECLARE_DYNAMIC(PageMessaging) 22 | 23 | public: 24 | PageMessaging( ConnectionHandler & handlerConnection ); 25 | virtual ~PageMessaging(); 26 | 27 | // Dialog Data 28 | enum { IDD = IDD_PAGE_MESSAGES }; 29 | 30 | public: 31 | 32 | void OnServiceStartup( bool isStarted, Component * owner ); 33 | void OnServiceNetwork( bool isConnected, DispatcherThread * ownerThread ); 34 | void OnServiceConnection( bool isConnected, DispatcherThread * ownerThread ); 35 | void OnClientConnection( bool isConnected, DispatcherThread *dispThread ); 36 | void OnClientRegistration( bool isRegistered, DispatcherThread * dispThread ); 37 | void OnAddConnection( NEConnectionManager::sConnection & data ); 38 | void OnRemoveConnection( NEConnectionManager::sConnection & data ); 39 | void OnUpdateConnection( void ); 40 | void OnDisconnectTriggered( void ); 41 | void OnTypeMessage( uint32_t cookie, NECommon::sMessageData & data ); 42 | void OnSendMessage( uint32_t cookie, NECommon::sMessageData & data ); 43 | 44 | void OnDefaultClicked( void ); 45 | 46 | protected: 47 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 48 | virtual BOOL OnInitDialog( ); 49 | 50 | DECLARE_MESSAGE_MAP() 51 | public: 52 | afx_msg void OnDestroy( ); 53 | afx_msg void OnClickedButtonSend( ); 54 | afx_msg void OnClickedCheckMessages( ); 55 | afx_msg void OnClickedCheckKeytype( ); 56 | afx_msg void OnClickedCheckBroadcast( ); 57 | afx_msg void OnChangeEditMessageAll( ); 58 | afx_msg void OnKickIdle( ); 59 | afx_msg void OnButtonUpdateSend( CCmdUI* pCmdUI ); 60 | afx_msg void OnCheckUpdate( CCmdUI* pCmdUI ); 61 | afx_msg LRESULT OnOutputMessage( WPARAM wParam, LPARAM lParam ); 62 | 63 | private: 64 | 65 | void setHeaders( void ); 66 | 67 | void cleanService( void ); 68 | 69 | bool isServiceConnected( void ) const; 70 | 71 | void outputMessage( CString nickName, CString message, CString dateStart, CString dateEnd, uint32_t cookie ); 72 | void outputMessage( const String & nickname, const String & message, const uint64_t begin, const uint64_t end, uint32_t cookie ); 73 | void outputMessage( const String & nickname, const String & message, const DateTime & begin, const DateTime & end, uint32_t cookie); 74 | void outputTyping( CString nickName, CString message, uint32_t cookie ); 75 | void removeTyping( const CString & nickName, uint32_t cookie ); 76 | 77 | private: 78 | // When selected, receives broadcasting message 79 | BOOL mIsBroadcast; 80 | // When selected, receives messages when typing key 81 | BOOL mIsKeytype; 82 | // When selected, receives messages. 83 | BOOL mIsMessages; 84 | // The list of messages 85 | CListCtrl mCtrlList; 86 | // Central messaging service 87 | CentralMessaging * mCentralMessage; 88 | // Last inserted message 89 | INT mLastItem; 90 | // typed string 91 | CString mTextMsg; 92 | // instance of connection handler object 93 | ConnectionHandler & mConnectionHandler; 94 | BOOL mSendEnabled; 95 | }; 96 | -------------------------------------------------------------------------------- /demo/21_pubunblock/pubservice/src/main.cpp: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Name : main.cpp 3 | // Author : Artak Avetyan 4 | // Version : 5 | // Copyright : (c) 2021-2023 Aregtech UG.All rights reserved. 6 | // Description : The application provides network discoverable Public service, 7 | // which predefined methods are called from remote clients. 8 | //============================================================================ 9 | 10 | #include "areg/base/GEGlobal.h" 11 | #include "areg/appbase/Application.hpp" 12 | #include "areg/component/ComponentLoader.hpp" 13 | #include "areg/trace/GETrace.h" 14 | 15 | #include "pubservice/src/ServiceComponent.hpp" 16 | 17 | #ifdef WIN32 18 | #pragma comment(lib, "areg.lib") 19 | #pragma comment(lib, "21_generated.lib") 20 | #endif // WINDOWS 21 | 22 | ////////////////////////////////////////////////////////////////////////// 23 | // 24 | // The following design will instantiate servicing component. 25 | // 26 | ////////////////////////////////////////////////////////////////////////// 27 | 28 | constexpr char const _modelName[]{ "ServiceModel" }; //!< The name of model 29 | constexpr char const _serviceName[]{ "UnblockRequestService" }; //!< The name of the service 30 | 31 | // Describe mode, set model name 32 | BEGIN_MODEL( _modelName ) 33 | 34 | // define component thread 35 | BEGIN_REGISTER_THREAD( "TestServiceThread", NECommon::WATCHDOG_IGNORE ) 36 | // define component, set role name. This will trigger default 'create' and 'delete' methods of component 37 | BEGIN_REGISTER_COMPONENT( _serviceName, ServiceComponent ) 38 | // register HelloWorld service implementation. 39 | REGISTER_IMPLEMENT_SERVICE( NEHelloUnblock::ServiceName, NEHelloUnblock::InterfaceVersion ) 40 | // end of component description 41 | END_REGISTER_COMPONENT( _serviceName ) 42 | // end of thread description 43 | END_REGISTER_THREAD( "TestServiceThread" ) 44 | 45 | // end of model description 46 | END_MODEL( _modelName ) 47 | 48 | ////////////////////////////////////////////////////////////////////////// 49 | // main method. 50 | ////////////////////////////////////////////////////////////////////////// 51 | DEF_TRACE_SCOPE( example_21_pubunblock_pubservice_main_main ); 52 | /** 53 | * \brief The main method enables logging, service manager and timer. 54 | * it loads and unloads the services, releases application. 55 | **/ 56 | int main( ) 57 | { 58 | printf( "Testing unblock request service ...\n" ); 59 | 60 | // force to start logging with default settings 61 | TRACER_CONFIGURE_AND_START( nullptr ); 62 | // Initialize application, enable logging, servicing, routing, timer and watchdog. 63 | // Use default settings. 64 | Application::initApplication( ); 65 | 66 | do 67 | { 68 | TRACE_SCOPE( example_21_pubunblock_pubservice_main_main ); 69 | TRACE_DBG( "The application has been initialized, loading model [ %s ]", _modelName ); 70 | 71 | // load model to initialize components 72 | Application::loadModel( _modelName ); 73 | 74 | TRACE_DBG( "Servicing model is loaded" ); 75 | 76 | // wait until Application quit signal is set. 77 | Application::waitAppQuit( NECommon::WAIT_INFINITE ); 78 | 79 | // stop and unload components 80 | Application::unloadModel( _modelName ); 81 | 82 | // release and cleanup resources of application. 83 | Application::releaseApplication( ); 84 | 85 | } while ( false ); 86 | 87 | printf( "Completed test unblock service request. Check the logs...\n" ); 88 | 89 | return 0; 90 | } 91 | -------------------------------------------------------------------------------- /demo/17_winchat/chatter/services/ConnectionList.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "chatter/res/stdafx.h" 3 | #include "chatter/services/ConnectionList.hpp" 4 | #include "areg/component/Component.hpp" 5 | #include "areg/component/ComponentThread.hpp" 6 | #include "chatter/NEDistributedApp.hpp" 7 | #include "chatter/services/ConnectionHandler.hpp" 8 | #include "chatter/ui/DistributedDialog.hpp" 9 | 10 | ConnectionList::ConnectionList( const char * roleName, Component & owner, ConnectionHandler & handlerConnection ) 11 | : ConnectionManagerClientBase ( roleName, owner.getMasterThread() ) 12 | , mConnectionHandler ( handlerConnection ) 13 | { 14 | 15 | } 16 | 17 | ConnectionList::ConnectionList( const char * roleName, DispatcherThread & dispThread, ConnectionHandler & handlerConnection ) 18 | : ConnectionManagerClientBase ( roleName, dispThread ) 19 | , mConnectionHandler ( handlerConnection ) 20 | { 21 | 22 | } 23 | 24 | ConnectionList::~ConnectionList( ) 25 | { 26 | } 27 | 28 | bool ConnectionList::serviceConnected( bool isConnected, ProxyBase & proxy ) 29 | { 30 | bool result = false; 31 | if ( ConnectionManagerClientBase::serviceConnected( isConnected, proxy ) ) 32 | { 33 | result = true; 34 | if ( isConnected ) 35 | DistributedDialog::PostServiceMessage( NEDistributedApp::eWndCommands::CmdServiceConnection, 1, reinterpret_cast(getDispatcherThread( )) ); 36 | else 37 | DistributedDialog::PostServiceMessage( NEDistributedApp::eWndCommands::CmdServiceConnection, 0, 0 ); 38 | } 39 | return result; 40 | } 41 | 42 | void ConnectionList::broadcastClientDisconnected( const NEConnectionManager::sConnection & clientData ) 43 | { 44 | if (mConnectionHandler.RemoveConnection(clientData)) 45 | { 46 | NEConnectionManager::sConnection * data = new NEConnectionManager::sConnection( clientData ); 47 | DistributedDialog::PostServiceMessage( NEDistributedApp::eWndCommands::CmdRemoveConnection, 1, reinterpret_cast(data) ); 48 | } 49 | } 50 | 51 | void ConnectionList::broadcastClientConnected( const NEConnectionManager::sConnection & newClient ) 52 | { 53 | if (mConnectionHandler.AddConnection(newClient)) 54 | { 55 | NEConnectionManager::sConnection * data = new NEConnectionManager::sConnection(newClient); 56 | DistributedDialog::PostServiceMessage(NEDistributedApp::eWndCommands::CmdAddConnection, 1, reinterpret_cast(data)); 57 | } 58 | } 59 | 60 | void ConnectionList::responseRegisterConnection( const NEConnectionManager::sConnection & connection, const NEConnectionManager::ListConnection & connectionList, bool success ) 61 | { 62 | if ( success ) 63 | { 64 | mConnectionHandler.SetNickName( connection.nickName ); 65 | mConnectionHandler.SetCookie( connection.cookie ); 66 | mConnectionHandler.SetTimeConnect( connection.connectTime ); 67 | mConnectionHandler.SetTimeConnected( connection.connectedTime ); 68 | mConnectionHandler.AddConnections(connectionList); 69 | mConnectionHandler.SetRegistered( true ); 70 | DistributedDialog::PostServiceMessage(NEDistributedApp::eWndCommands::CmdClientRegistration, 1, reinterpret_cast(getDispatcherThread())); 71 | } 72 | else 73 | { 74 | mConnectionHandler.SetRegistered( false ); 75 | mConnectionHandler.SetCookie( NEConnectionManager::InvalidCookie ); 76 | mConnectionHandler.SetTimeConnect( DateTime( ) ); 77 | mConnectionHandler.SetTimeConnected( DateTime( ) ); 78 | mConnectionHandler.RemoveConnections(); 79 | DistributedDialog::PostServiceMessage(NEDistributedApp::eWndCommands::CmdClientRegistration, 0, 0); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /demo/17_winchat/17_register.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | Header Files 38 | 39 | 40 | Header Files 41 | 42 | 43 | Header Files 44 | 45 | 46 | 47 | 48 | Source Files 49 | 50 | 51 | Source Files 52 | 53 | 54 | Source Files 55 | 56 | 57 | Source Files 58 | 59 | 60 | Source Files 61 | 62 | 63 | Source Files 64 | 65 | 66 | Source Files 67 | 68 | 69 | Source Files 70 | 71 | 72 | 73 | 74 | Resource Files 75 | 76 | 77 | 78 | 79 | Resource Files 80 | 81 | 82 | 83 | 84 | Resource Files 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | --------------------------------------------------------------------------------