Skip to content
13 changes: 13 additions & 0 deletions C/services/dispatcher/dispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ static void signalHandler(int signal)
}
}

// Displays service information in JSON format
static void printServiceInfoAsJSON()
{
static std::string serviceInfoJSON = R"({"name":"Dispatcher Service","description":"Fledge Dispatcher Service To Send Control Messages","package":"fledge-service-dispatcher","type":"dispatcher","process_name":"dispatcher_c","process_script":"[services/dispatcher_c]"})" ;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name: control
description: Service used to manage and send control information.

It is advisable to avoid repeating the name and product name in every instance.


std::cout << serviceInfoJSON << std::endl;
}

/**
* Dispatcher service main entry point
*/
Expand All @@ -75,6 +83,11 @@ int main(int argc, char *argv[])

for (int i = 1; i < argc; i++)
{
if (!strcmp(argv[i], "--info"))
{
printServiceInfoAsJSON();
return 0;
}
if (!strcmp(argv[i], "-d"))
{
daemonMode = false;
Expand Down