Controller Plugin Entry
Plugin Entry Module
This module serves as the entry point for the Plugin, similar to the main function of a program. Multiple entry modules and priorities can be defined within the Plugin. The Controller loads them in order of priority when loading. The entry module loading can be divided into several stages.
- Validation Stage: This stage mainly handles whether the Plugin is valid and can be loaded. It checks whether the Plugin package structure is standardized and whether the version meets requirements, etc.
- Authorization Validation: Before Plugin initialization, authorization validation is performed. The Plugin developer decides whether the Plugin needs authorization. Those requiring secondary authorization will only proceed with the Plugin initialization loading process after passing authorization.
- Init Stage: After all Plugins are loaded and constructed, the next stage of initialization begins. At this stage, the entry modules of the Plugins will be sorted by priority, and modules with higher priority will be executed first. After execution is complete, the next module will begin execution. The execution order of modules with the same priority is not fixed.
- Start Stage: After all Plugin entry modules have completed the Init stage, the Start stage begins. The execution logic here is the same as the Init stage, executed in order of priority. Plugin logic can be executed in the Start stage.
- Stop Stage: Before the Controller exits, this stage is called to clean up resources. The execution logic of this stage is still executed in order of module priority.
- Destruction Stage: This stage performs the destruction of each entry module. The destruction order is not fixed. Therefore, for resource recycling with dependencies, it can be executed in the Stop stage based on priority.
Controller Plugin Validation Stage:

Authorization Validation: Whether the Plugin needs authorization to be used. If authorization is required, each machine must be authorized before it can be used. Contact Rokae to obtain an authorization code for each machine. Authorization control is in src/launch/authorize.cpp. Set to true to require authorization validation. Default is no validation.
EXPORT const bool plugin_need_authorize = false;
Controller Plugin Initialization Process

Usage Example:
#include "launch_api.hpp"
//1 Inherit and implement LaunchAPI and implement specific Init, Start, Stop functions
class Launch:public xcore_api::launch::LaunchAPI{
public:
explicit Launch();
virtual void Init() override;
virtual void Start() override;
virtual void Stop() override;
virtual ~Launch();
};
//2 Declare as entry module in cpp
LAUNCH_MODULE_PRIORITY(Launch,0)// With priority
LAUNCH_MODULE(Launch) // Without priority
//3 Implement specific Init, Start, Stop functions
This example has been implemented in the Plugin's src/launch module. Users only need to inject their own implemented functions at specific stages.