VSM C++ SDK
Vehicle Specific Modules SDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
run_as_service.h
Go to the documentation of this file.
1 // Copyright (c) 2018, Smart Projects Holdings Ltd
2 // All rights reserved.
3 // See LICENSE file for license details.
4 
14 #ifndef _UGCS_VSM_RUN_AS_SERVICE_H_
15 #define _UGCS_VSM_RUN_AS_SERVICE_H_
16 
17 #include <ugcs/vsm/callback.h>
18 
19 namespace ugcs {
20 namespace vsm {
21 
35 
38  Make_program_init_handler,
39  (int, char **),
40  (0, nullptr))
41 
42 
46 typedef Callback_proxy<void> Program_done;
47 
63 typedef enum {
64  SERVICE_RESULT_OK = 0, // must be zero.
65  SERVICE_RESULT_ERROR = 1, // must be greater than zero
66  // More error codes can be added here.
67  SERVICE_RESULT_NORMAL_INVOCATION = -1 // must be less than zero.
69 
151 Run_as_service(const char* service_name, int argc, char *argv[], Program_init prog_init, Program_done prog_done);
152 
153 } /* namespace vsm */
154 } /* namespace ugcs */
155 #endif /* _UGCS_VSM_RUN_AS_SERVICE_H_ */
#define DEFINE_CALLBACK_BUILDER(__name, __types, __values)
Define callback builder function.
Definition: callback.h:42
Generic callback which can be used to define and create an instance of an abstract callable operation...
Helper class for proxying callback invocation.
Definition: callback.h:699
Callback_proxy< int, int, char ** > Program_init
Signature for program initialization routine.
Definition: run_as_service.h:34
Run_as_service_result
Result of Run_as_service function SERVICE_RESULT_OK = 0: Was invoked as service and is about to end...
Definition: run_as_service.h:63
Run_as_service_result Run_as_service(const char *service_name, int argc, char *argv[], Program_init prog_init, Program_done prog_done)
Entry point for running program as a service.