4
4
5
5
GMainLoop * gmainLoop ;
6
6
7
- // This is a deprecated symbol present in meta-lg-webos-ndk but missing in
8
- // latest buildroot NDK. It is required for proper public service registration
9
- // before webOS 3.5.
10
- //
11
- // SECURITY_COMPATIBILITY flag present in CMakeList disables deprecation notices, see:
12
- // https://github.com/webosose/luna-service2/blob/b74b1859372597fcd6f0f7d9dc3f300acbf6ed6c/include/public/luna-service2/lunaservice.h#L49-L53
13
- bool LSRegisterPubPriv (const char * name , LSHandle * * sh ,
14
- bool public_bus ,
15
- LSError * lserror ) __attribute__((weak ));
16
-
17
7
int main ()
18
8
{
19
9
service_t service = {0 };
@@ -34,41 +24,21 @@ int main()
34
24
35
25
bool ret = false;
36
26
37
- if (& LSRegisterPubPriv != 0 ) {
38
- ret = LSRegisterPubPriv (SERVICE_NAME , & handle , true, & lserror );
39
- } else {
40
- ret = LSRegister (SERVICE_NAME , & handle , & lserror );
41
- }
42
-
43
- if (!ret ) {
44
- ERR ("Unable to register on Luna bus: %s" , lserror .message );
45
- goto exit ;
46
- }
47
-
48
- if ((ret = service_init (handle , & service , & lserror )) && !ret ) {
27
+ if ((ret = service_init (handle , gmainLoop , & service , & lserror )) && !ret ) {
49
28
ERR ("Unable to init service: %s" , lserror .message );
50
29
goto exit ;
51
30
}
52
31
53
- if ((ret = LSGmainAttach (handle , gmainLoop , & lserror )) && !ret ) {
54
- ERR ("Unable to attach main loop: %s" , lserror .message );
55
- goto exit ;
56
- }
57
-
58
32
DBG ("Going into main loop.." );
59
33
60
34
// run to check continuously for new events from each of the event sources
61
35
g_main_loop_run (gmainLoop );
62
36
63
37
DBG ("Main loop quit..." );
64
38
65
- DBG ("Cleaning up service..." );
66
- daemon_terminate (& service );
67
-
68
39
exit :
69
- if (handle ) {
70
- DBG ("Unregistering service..." );
71
- LSUnregister (handle , & lserror );
40
+ if ((ret = service_destroy (handle , & service , & lserror )) && !ret ) {
41
+ WARN ("Destroying service properly failed: %s" , lserror .message );
72
42
}
73
43
74
44
LSErrorFree (& lserror );
0 commit comments