summaryrefslogtreecommitdiff
path: root/tests/legacy-app-handler/legacy-app-handler-test
blob: 1cf963d3168fb37f419d1951cd88d151b0dab725 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/python
#SPDX license identifier: MPL-2.0
#
#Copyright (C) 2012, GENIVI
#
#This file is part of node-startup-controller.
#
#This Source Code Form is subject to the terms of the
#Mozilla Public License (MPL), v. 2.0.
#If a copy of the MPL was not distributed with this file,
#You can obtain one at http://mozilla.org/MPL/2.0/.
#
#For further information see http://www.genivi.org/.
#
#List of changes:
#2015-04-30, Jonathan Maw, List of changes started

import gobject
import dbus
import dbus.service
import sys

from dbus.mainloop.glib import DBusGMainLoop


class TestService(dbus.service.Object):

    def __init__(self, name):
        bus_name = dbus.service.BusName(
            'org.genivi.NodeStartupController1.LegacyAppHandler.%s' % name,
            bus=dbus.SystemBus())
        path = '/org/genivi/NodeStartupController1/LegacyAppHandler/%s' % name
        dbus.service.Object.__init__(self, bus_name, path)

    @dbus.service.method('org.genivi.NodeStartupController1.'
                         'LegacyAppHandler.Test')
    def hello(self):
        return "Hello World!"


if __name__ == '__main__':
    DBusGMainLoop(set_as_default=True)
    service = TestService(sys.argv[1])
    loop = gobject.MainLoop()
    loop.run()