CAndruavFacade is a singleton class providing high-level APIs for communication with the Andruav Communication Server.
It serves as the central interface for sending standardized messages and commands from internal modules to remote parties or the server.
Definitionο
21:71:/mnt/8a619ce7-cd3f-4520-af65-7991f16410f7/public_versions/drone_engage/drone_engage_communication_pro/src/comm_server/andruav_facade.hpp
class CAndruavFacade
{
public:
// Implements the Meyers Singleton pattern
static CAndruavFacade& getInstance()
{
static CAndruavFacade instance;
return instance;
}
// Prevent copying and assignment
CAndruavFacade(CAndruavFacade const&) = delete;
void operator=(CAndruavFacade const&) = delete;
private:
CAndruavFacade(); // Private constructor
~CAndruavFacade(){}; // Public destructor
public:
void API_sendID (const std::string& target_party_id) const;
void API_requestID (const std::string& target_party_id) const;
void API_sendCameraList (const bool reply, const std::string& target_party_id) const;
void API_sendErrorMessage (
const std::string& target_party_id,
const int& error_number,
const int& info_type,
const int& notification_type,
const std::string& description
) const;
void API_loadTasksByScope (const ENUM_TASK_SCOPE scope, const int task_type) const;
void API_loadTasksByScopeGlobal (const int task_type) const;
void API_loadTasksByScopeAccount (const int task_type) const;
void API_loadTasksByScopeGroup (const int task_type) const;
void API_loadTasksByScopePartyID (const int task_type) const;
void API_loadTask (
const int larger_than_SID,
const std::string& account_id,
const std::string& party_sid,
const std::string& group_name,
const std::string& sender,
/* ... more params ... */
);
void API_sendPrepherals (const std::string& target_party_id) const;
void API_sendCommunicationLineStatus(const std::string& target_party_id, const bool on_off) const;
void API_sendConfigTemplate(
const std::string& target_party_id,
const std::string& module_key,
const Json_de& json_file_content_json,
const bool reply
);
protected:
void API_sendCMD (
const std::string& target_party_id,
const int command_type,
const Json_de& msg
) const;
const std::string API_sendCMDDummy (
const std::string& target_party_id,
const int command_type,
const Json_de& msg
) const;
};
Type: Singleton class (
CAndruavFacade)Namespace:
de::andruav_serversPurpose: Centralized message dispatching to the Andruav Communication Server
Access Pattern: Thread-safe singleton via
getInstance()Key Methods:
API_sendID: Acknowledge identity to a remote partyAPI_requestID: Request identification from a remote partyAPI_sendErrorMessage: Send error alerts to server or unitAPI_loadTasksByScope*: Load mission or configuration tasks by scope (global, account, group, etc.)API_sendConfigTemplate: Send JSON configuration templates to a moduleAPI_sendCommunicationLineStatus: Notify server about connection status
Side Effects: All methods generate outbound network messages via an underlying communication layer
Thread Safety: Static
getInstance()ensures one instance; thread safety relies onstaticinitialization rules in C++11+
π The class enforces non-copyability and private construction to ensure singleton integrity.
Example Usagesο
In practice, CAndruavFacade is used across multiple subsystems to send standardized messages without directly handling raw protocol details.
For example, when a module fails license verification, an error message is sent using the facade:
518:519:/home/mhefny/TDisk/public_versions/drone_engage/drone_engage_communication_pro/src/de_broker/de_modules_manager.cpp
module_item->licence_status = ENUM_LICENCE::LICENSE_VERIFIED_BAD;
andruav_servers::CAndruavFacade::getInstance().API_sendErrorMessage(
std::string(),
0,
ERROR_TYPE_ERROR_MODULE,
NOTIFICATION_TYPE_ALERT,
std::string("Module " + module_item->module_id + " invalid license")
);
Another example occurs during system initialization upon successful server connection:
384:/home/mhefny/TDisk/public_versions/drone_engage/drone_engage_communication_pro/src/comm_server/andruav_comm_server.cpp
CAndruavFacade::getInstance().API_requestID(std::string());
This triggers a request for the local unitβs identity from the server.
Usage Summaryο
Main Callers:
de_modules_manager.cpp: Handles module lifecycle, sends errors and ID updatesandruav_parser.cpp: Processes incoming messages, responds with camera lists, config templates, or error reportsandruav_comm_server.cpp: Manages server connection state, sends line status and requests ID
Frequency: Heavily used β referenced in at least 9 files, with dozens of calls
Integration Level: Core communication abstraction used by both broker and server modules
Notesο
CAndruavFacadeuses the Meyers Singleton pattern (line 26β30), which is thread-safe in C++11 due to static local variable initialization guarantees.Despite its name suggesting a pure facade, it likely wraps a lower-level messaging system (e.g., WebSocket or TCP client) that isnβt exposed here.
The method
API_sendCMDDummyreturns aconst std::string, suggesting it may simulate or log commands rather than transmit them β useful for testing or dry runs.
See Alsoο
ENUM_TASK_SCOPE: Defines scoping levels (SCOPE_GLOBAL,SCOPE_ACCOUNT, etc.) used in task-loading APIs likeAPI_loadTasksByScope. Determines which set of tasks to retrieve from the server.Json_de: A JSON library wrapper (likely a typedef fornlohmann::json) used to serialize message payloads in methods such asAPI_sendConfigTemplate.CAndruavUnitMe: Represents the local drone unit; often used alongsideCAndruavFacadewhen sending unit-specific status or errors.API_sendCMD: The underlying generic command sender used internally by higher-level APIs to format and dispatch messages.