View Javadoc
1   /*
2    * Copyright (C) 2013 4th Line GmbH, Switzerland
3    *
4    * The contents of this file are subject to the terms of either the GNU
5    * Lesser General Public License Version 2 or later ("LGPL") or the
6    * Common Development and Distribution License Version 1 or later
7    * ("CDDL") (collectively, the "License"). You may not use this file
8    * except in compliance with the License. See LICENSE.txt for more
9    * information.
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.
14   */
15  
16  package org.fourthline.cling.android;
17  
18  import org.fourthline.cling.UpnpService;
19  import org.fourthline.cling.UpnpServiceConfiguration;
20  import org.fourthline.cling.controlpoint.ControlPoint;
21  import org.fourthline.cling.registry.Registry;
22  
23  /**
24   * Interface of the Android UPnP application service component.
25   * <p>
26   * Usage example in an Android activity:
27   * </p>
28   * <pre>{@code
29   *AndroidUpnpService upnpService;
30   *
31   *ServiceConnection serviceConnection = new ServiceConnection() {
32   *     public void onServiceConnected(ComponentName className, IBinder service) {
33   *         upnpService = (AndroidUpnpService) service;
34   *     }
35   *     public void onServiceDisconnected(ComponentName className) {
36   *         upnpService = null;
37   *     }
38   *};
39   *
40   *public void onCreate(...) {
41   * ...
42   *     getApplicationContext().bindService(
43   *         new Intent(this, AndroidUpnpServiceImpl.class),
44   *         serviceConnection,
45   *         Context.BIND_AUTO_CREATE
46   *     );
47   *}}</pre>
48   *<p>
49   * The default implementation requires permissions in <code>AndroidManifest.xml</code>:
50   * </p>
51   * <pre>{@code
52   *<uses-permission android:name="android.permission.INTERNET"/>
53   *<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
54   *<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"/>
55   *<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
56   *<uses-permission android:name="android.permission.WAKE_LOCK"/>
57   *}</pre>
58   * <p>
59   * You also have to add the application service component:
60   * </p>
61   * <pre>{@code
62   *<application ...>
63   *  ...
64   *  <service android:name="org.fourthline.cling.android.AndroidUpnpServiceImpl"/>
65   *</application>
66   * }</pre>
67   *
68   * @author Christian Bauer
69   */
70  // DOC:CLASS
71  public interface AndroidUpnpService {
72  
73      /**
74       * @return The actual main instance and interface of the UPnP service.
75       */
76      public UpnpService get();
77  
78      /**
79       * @return The configuration of the UPnP service.
80       */
81      public UpnpServiceConfiguration getConfiguration();
82  
83      /**
84       * @return The registry of the UPnP service.
85       */
86      public Registry getRegistry();
87  
88      /**
89       * @return The client API of the UPnP service.
90       */
91      public ControlPoint getControlPoint();
92  
93  }
94  // DOC:CLASS