Debian Codegraph @

examples/clientstub/d_bus_ada_service_client.adb

raw
1 --
2 -- D_Bus/Ada - An Ada binding to D-Bus
3 --
4 -- Copyright (C) 2011, 2014 Reto Buerki <[email protected]>
5 --
6 -- This program is free software; you can redistribute it and/or
7 -- modify it under the terms of the GNU General Public License
8 -- as published by the Free Software Foundation; either version 2
9 -- of the License, or (at your option) any later version.
10 --
11 -- This program is distributed in the hope that it will be useful,
12 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
13 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 -- GNU General Public License for more details.
15 --
16 -- You should have received a copy of the GNU General Public License
17 -- along with this program; if not, write to the Free Software
18 -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
19 -- USA.
20 --
21 -- As a special exception, if other files instantiate generics from this
22 -- unit, or you link this unit with other files to produce an
23 -- executable this unit does not by itself cause the resulting
24 -- executable to be covered by the GNU General Public License. This
25 -- exception does not however invalidate any other reasons why the
26 -- executable file might be covered by the GNU Public License.
27 --
28
29 with D_Bus.Connection;
30 with D_Bus.Arguments.Basic;
31 with D_Bus.Arguments.Containers;
32
33 pragma Unreferenced (D_Bus.Arguments.Basic);
34 pragma Unreferenced (D_Bus.Arguments.Containers);
35
36 package body D_Bus_Ada_Service_Client is
37
38 use D_Bus;
39 use D_Bus.Arguments;
40
41 -------------------------------------------------------------------------
42
43 function Get_Name return String
44 is
45 Conn : constant Connection.Connection_Type := Connection.Connect;
46 Result : Argument_List_Type;
47 begin
48 Result := Connection.Call_Blocking
49 (Connection => Conn,
50 Destination => Service,
51 Path => Path,
52 Iface => Iface,
53 Method => "GetName");
54
55 return Basic.String_Type (Result.First_Element).To_String;
56 end Get_Name;
57
58 end D_Bus_Ada_Service_Client;