Giter VIP home page Giter VIP logo

cling's Introduction

Cling EOL: This project is no longer actively maintained, code may be outdated. If you are interested in maintaining and developing this project, comment here.


Cling - The UPnP stack for Java and Android

Cling is an effort to create a UPnP-compatible software stack in Java. The project's goals are strict specification compliance, complete, clean and extensive APIs, as well as rich SPIs for easy customization.

Cling is Free Software, distributed under the terms of the GNU Lesser General Public License or at your option the Common Development and Distribution License.

We recommend you start with the README.txt.

Then download the Cling distribution or start with a Maven project in your pom.xml:

<repositories>
    <repository>
        <id>4thline-repo</id>
        <url>http://4thline.org/m2</url>
        <snapshots>
            <enabled>false</enabled> <!-- Or true, if you like to use unreleased code -->
        </snapshots>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>org.fourthline.cling</groupId>
        <artifactId>cling-core</artifactId>
        <version>2.1.2</version>
    </dependency>
</dependencies>

Read the first chapter of the manual for a simple Cling usage example. Have a look at the Android application examples.

Please post Cling usage questions on stackoverflow.com with the appropriate tags.

See the forum archive for older discussions.

Cling Modules

Cling Core

An embeddable Java library that implements the UPnP Device Architecture 1.0. Use Cling Core to expose services with a UPnP remoting interface, or to write control point applications that discover UPnP devices and utilize their services. You can also integrate Cling Core as an Android UPnP/DLNA library in your applications (platform level 15/4.0 required).

Cling Support

Optional classes and useful infrastructure for developing and controlling UPnP services with Cling Core; extensions that simplify working with UPnP media servers and renderers, NAT port mapping on routers, etc.

Cling Workbench

A desktop application for browsing UPnP devices and interacting with their services.

Cling MediaRenderer

Standalone UPnP MediaRenderer, based on gstreamer.

Building Cling

  • Install Maven 3.2.3 or newer.

  • Install the Android SDK and set the ANDROID_HOME environment variable to the SDK install directory.

  • Clone the Cling source:

git clone https://github.com/4thline/cling.git
  • Change into the cling/ directory.

  • Install everything into your local ~/.m2 Maven repository (this will take a few minutes if all dependencies have to be downloaded for the first time).

mvn clean install

If your build fails with Android/dex packaging errors, you forgot the clean.

  • Use Cling in your pom.xml with:
<dependencies>
  <dependency>
    <groupId>org.fourthline.cling</groupId>
    <artifactId>cling-core</artifactId>
    <version>2.1.2</version>
  </dependency>
</dependencies>

Building OS X Workbench DMG

hdiutil create -srcfolder \
    workbench/target/cling-workbench-2.1.2/Cling\ Workbench.app \
    workbench/target/cling-workbench-2.1.2/Cling\ Workbench.dmg

Publishing a release

Build release and tag on Github.

Update Maven repository:

mvn clean install
mvn clean deploy -DskipTests

Projects and applications using Cling

If your project or product is using Cling and you'd like to add it to this page, open an issue and we'll add you to the list.

  • BubbleDS - A UPnP control point for Android and LinnDS streamer appliances.

  • BubbleUPnP - A generic UPnP/DLNA media control point and renderer for Android.

  • Jinzora UPnP - The Jinzora music management and streaming server can be accessed through a UPnP MediaServer gateway written with Cling. The Android client also uses Cling to access the MediaServer.

  • MovieBrowser UPnP - A movie manager to use with your favorite player on your Android tablet. Manage your videos anywhere on your network (Samba & UPnP/DLNA) and watch them with your favorite player or using the unique Play-To feature (Android airplay).

  • Private Dancer - A UPnP/DLNA Media Renderer for Android. It is designed to be used on a device attached to speakers and power. Unlike other UPnP Android applications, Private Dancer is designed for always-on (headless) use.

  • MediaHouse - Stream music, videos, movies and pictures from PC, NAS or any other device running UPnP/DLNA compliant media server to your Android phone/handset/tablet.

  • Digital Photo Frame Slideshow - Turn your Android device in a digital photo viewer showing a slideshow of local files, photos from network shares (Samba/SMB) or pictures from a UPnP server.

  • I-Frame Home - Full HD digital photo frame, picture-like design, displays files located in internal memory, LAN or Internet.

  • MediaConnect - Enables you to connect mediaservers with mediaplayers and also remote control these mediaplayers within a WLAN.

  • MediaConnect - MediaConnect enables you to connect mediaservers with mediaplayers and also remote control these mediaplayers within a WLAN.

  • ShuffleBox - Use your smartphone or tablet as a remote control and play music on your laptop, mobile phone or any other DNLA device.

  • DroidUPnP - A FREE SOFTWARE UPnP control point application for Android. DroidUPnP discover your home UPnP device, content provider and renderer. It allows you to browse your UPnP content directory, select the media you want to use and allows you to play it on your connected television or any UPnP renderer compatible device. It also allows you to use your Android device as a UPnP content provider.

  • YAACC -An Android UPnP controller, FREE SOFTWARE as GPL. It allows you to discover, use and control UPnP devices in your network in order to stream media files. Since it's a subset of UPnP it also is capable of communicating with DLNA devices.

Noteworthy forks of Cling

  • jUPnP - Forked from pre-2.0, this code base still contains the OSGi feature, which has been removed in Cling 2.0.

  • DIAL Support - Based on alpha 2.0 code, this UPnP/DLNA library for Java and Android contains modifications to discover DIAL devices.

FAQ

Which version of the UPnP specification does Cling implement?

Cling Core is compatible with the UPnP Device Architecture 1.0.

Can I use Cling to access a UPnP/DLNA MediaServer in Android?

Yes, you can write a control point application for Android with Cling Core as a UPnP library. You can find additional utilities for browsing and parsing a MediaServer content directory in the Cling Support module.

Can I use Cling in my commercial application or device?

Cling is licensed under the LGPL, so there are no restrictions on the use of the unmodified Cling JAR files/binaries. You can use the unmodified JAR files/binaries in any application or device, for any purpose. The following distribution (for free or for pay) restrictions apply:

  • If you distribute Cling with your application or device, you have to include a notice like "contains LGPL software" and a link to the Cling homepage, so your users also get the benefit of Free Software.

  • You have to allow replacement of the Cling library in your distributed application. This means allowing replacement of the Cling JAR or JVM binary class file(s) in, for example, a WAR or EAR package.

  • For Cling 1.x, the following exception for static linking of an executable (see LGPLv3 clause 4 or LGPLv2 clause 6b) applies to Cling usage within Android applications and the DEX instead of the JVM binary format: Converting Cling's binary JVM class files to the DEX format, and distributing a combined work as an Android APK does not affect the licensing of other resources within that DEX or APK archive. You must however allow re-packaging/conversion of the DEX and APK with tools such as dex2jar. Anyone receiving your APK must be able to replace the Cling binary code with a compatible version. You can not lock your APK with any kind of obfuscation or DRM scheme, or otherwise prevent unpacking and reassembly of the DEX containing Cling binaries. Alternatively, consider dynamic loading of libraries on Android.

  • For Cling 2.x, you may at your option license Cling under CDDL instead of the LGPL. You can convert to DEX and package Cling 2.x within an APK without affect on other files in that APK. You can obfuscate the source in the APK and lock it with digital restrictions. If you modify Cling source code, and you distribute a binary compiled from this modified source code, you have to distribute your changed source code as well under the LGPL or CDDL (upon request). Typically this means you contribute your changes back to the Cling project, to be included in an official Cling release.

Contact us if you have questions about the licensing of Cling and/or require a proprietary license.

What are the dependencies of Cling Core?

Cling Core is distributed as a single JAR file. It only has one other dependency, the seamless-* libraries. All JAR files are typically packaged next to each other in the ZIP distribution. You have to add them to your classpath.

How can I access the services of a device?

First write a control point and a RegistryListener as explained in the manual. Then call device.getServices() when a device has been discovered.

Cling doesn't work if I start my application on Tomcat/JBoss/Glassfish/etc?!

You'll get an error on startup, this error tells you that Cling couldn't use the Java JDK's HTTPURLConnection for HTTP client operations. This is an old and badly designed part of the JDK: Only "one application" in the whole JVM can configure it. You have to switch Cling to an alternative HTTP client, e.g. the other bundled implementation based on Apache HTTP Core. This is explained in more detail in the user manual.

Is IPv6 supported?

No, the default configuration of the UPnP stack in Cling Core will filter all network interfaces and IP addresses that are not IPv4. Some other parts of the Cling Core library might also assume that addresses are IPv4 and the whole library has not been tested in an IPv6 only environment. You are welcome to test Cling on IPv6 with a custom UpnpServiceConfiguration and NetworkAddressFactory and contribute back any necessary changes.

I don't see debug log messages on Android?

The java.util.logging implementation on Android is broken, it does not allow you to print debug-level messages easily. See this discussion for a simple solution.

Where can I find the source for Cling 1.x and teleal-common?

Here.

Wich version of Android (API) is supported by Cling?

Cling 1.0 supports Android 2.1. With Cling 2.0, we currently require platform level 15 (Android 4.0.3).

I get a lock acquisition timeout exception?

Your service receives a subscription, then this happens:

RuntimeException at org.teleal.cling.protocol.sync.ReceivingSubscribe.responseSent(ReceivingSubscribe.java:177)

Your service was already being used by something else and didn't give up the lock during the 500 millisecond default wait time. Increase the wait time by overriding DefaultServiceManager in LocalService. Or don't block the service action/methods for a long time.

cling's People

Contributors

adetaylor avatar based2 avatar bergstr11 avatar christianbauer avatar ckovorodkin avatar cyberb avatar ened avatar gubatron avatar jomarmar avatar koush avatar md5555 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cling's Issues

TransportStatus Issue

In the class org.fourthline.cling.support.model.TransportStatus the status ERROR_OCCURRED is misspelled as ERROR_OCCURED (notice the missing 'R'). This causes the last change parser to fail when attempting to parse this transport status.

ProtocolInfo.toString() throws an NPE for unknown protocols

I'll try to use XBMC as DMR and apparently XBMC supports a protocol xbmc-get.
Since the enum Protocol doesn't know about this protocol, it is nullified with Protocol.valueOrNullOf(String) and can't be stringified subsequently in ProtocolInfo.toString().

Check all locale/encoding sensitive conversions

All the code of Cling should be inspected to not rely on the default locale or default encoding and explictely use "UTF-8" if appropriate. This include at least (but probably not limited):

  • uses of new String(bytes[]) (should use String(bytes[], "UTF-8") instead)
  • uses of String.getBytes()
  • uses of InputStreamReader(InputStream)
  • uses of OutputStreamReader(InputStream)
  • use of String.format(String, param) not sepcifying a locale as first parameter is the result string is not for display pupose but for a compuation.
  • uses of toLowerCase(), toUpperCase (what you patch do) and other String function where a locale/charset can be specified

Cling to Maven repository

Hi !
Cling seems to be a Maven build. However it can not be found from the central Maven repository.

Would it be too much to ask to upload it there, so it could be found using the "fourthline" and/or "cling" keywords and easily attached to other maven projects without having to download the JAR ? or is there something to prevent this?

Seek Error

Is there known issue with seek? I am getting an error back :

current state of service prevents invoking that action. Action method invocation failed: Invalid int: "REL_COUNT". (HTTP response was 500 Internal Server Error)

All other commands are fine, including setURI, play, stop, pause ... etc.

Cannot control cling renderers volume with WMP12

WMP12 "Play to" will disable volume controls with Cling renderers.

WMP12 doesn't like "retval" tags found in the RenderingControl service XML generated by class UDA10ServiceDescriptorBinderImpl.

It is safe to not include this tag for all services (most other service XML definitions from other UPnP software do not include it):

private void generateActionArgument(ActionArgument actionArgument, Document descriptor, Element actionElement) {

    Element actionArgumentElement = appendNewElement(descriptor, actionElement, ELEMENT.argument);

    appendNewElementIfNotNull(descriptor, actionArgumentElement, ELEMENT.name, actionArgument.getName());
    appendNewElementIfNotNull(descriptor, actionArgumentElement, ELEMENT.direction, actionArgument.getDirection().toString().toLowerCase());
    appendNewElementIfNotNull(descriptor, actionArgumentElement, ELEMENT.relatedStateVariable, actionArgument.getRelatedStateVariableName());

    /*
    // WMP will disable the RenderingControl Service with this tag
    if (actionArgument.isReturnValue()) {
        appendNewElement(descriptor, actionArgumentElement, ELEMENT.retval);
    }
    */
}

Missing fourthline-skin.jar

When trying to build any of the Cling projects with Maven, this error occurs:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.0-beta-3:site (default-cli) on project cling-core: SiteToolException: ArtifactNotFoundException: The skin does not exist: Failure to find org.fourthline.site:fourthline-skin:jar:1.0 in http://4thline.org/m2 was cached in the local repository, resolution will not be reattempted until the update interval of 4thline-repo has elapsed or updates are forced

android.os.NetworkOnMainThreadException

From ICS onwards doing any network operation in main thread will throw an exception. We need to change the onDestroy() of AndroidUpnpServiceImpl to asynchronously call svc.shutdown.

@OverRide
public void onDestroy() {
new Shutdown().execute(upnpService);
}

/**

  • 1.2.5 Do shutdown in separate thread else android.os.NetworkOnMainThreadException
  • @author Diwakar
    */
    class Shutdown extends AsyncTask<UpnpService, Void, Void>
    {
    @OverRide
    protected Void doInBackground(UpnpService... svcs) {
    UpnpService svc = svcs[0];
    if (null != svc) {
    _log.info("Call shutdown in background...");
    svc.shutdown();
    }
    return null;
    }
    }

Exception in IncomingSubscribeResponseMessage.getSubscriptionDurationSeconds()

Using cling on an android system this exception was reported through Google Play

Exception class java.lang.NullPointerException
Source method IncomingSubscribeResponseMessage.getSubscriptionDurationSeconds()
java.lang.NullPointerException
at org.fourthline.cling.model.message.gena.IncomingSubscribeResponseMessage.getSubscriptionDurationSeconds(IncomingSubscribeResponseMessage.java:47)
at org.fourthline.cling.protocol.sync.SendingRenewal.executeSync(SendingRenewal.java:85)
at org.fourthline.cling.protocol.sync.SendingRenewal.executeSync(SendingRenewal.java:42)
at org.fourthline.cling.protocol.SendingSync.execute(SendingSync.java:55)
at org.fourthline.cling.protocol.SendingAsync.run(SendingAsync.java:44)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
at java.lang.Thread.run(Thread.java:1019)

Could not hydrate device or its services from descriptor: (RemoteDevice)

I'm using a EyeTV's Netstream SAT streamer in the network which descriptor doesn't seem to be digestable for cling 1.0:
WARNING: Could not hydrate device or its services from descriptor: (RemoteDevice) Identity: (RemoteDeviceIdentity) UDN: uuid:4df40997-9cd4-66d2-011b-3c0a00e6ded7, Descriptor: http://10.0.0.169:49152/description.xml, Root: true
Feb 19, 2013 5:23:01 PM org.teleal.cling.protocol.RetrieveRemoteDescriptors describe
Can't parse service type string (namespace/type/version): urn:schemas-microsoft-com:service:pbda:tuner:1

1 0 urn:schemas-microsoft-com:device:tv:pbda:1 EyeTV Netstream Sat #04014550 Elgato Systems GmbH http://www.elgato.com/ EyeTV Netstream Sat EyeTV Netstream Sat 1.00.00 http://www.elgato.com/ 04014550 uuid:7fcb69e7-7fd8-a74f-8ae2-63257ec0cc69 0FD9-0038 urn:schemas-upnp-org:device:MediaServer:1 EyeTV Netstream Sat (Tuner 1) Elgato Systems GmbH http://www.elgato.com/ EyeTV Netstream Sat EyeTV Netstream Sat 1.00.00 http://www.elgato.com/ 21493255 uuid:4df40997-9cd4-66d2-011b-3c0a00e6ded7 0FD9-0038 urn:schemas-upnp-org:service:ConnectionManager:1 urn:upnp-org:serviceId:ConnectionManager /tuner0/Service_ConnectionManager /tuner0/Service_ConnectionManager/control /tuner0/Service_ConnectionManager/event urn:schemas-upnp-org:service:AVTransport:1 urn:upnp-org:serviceId:AVTransport /tuner0/Service_AVTransport /tuner0/Service_AVTransport/control /tuner0/Service_AVTransport/event urn:schemas-microsoft-com:service:pbda:tuner:1 urn:microsoft-com:serviceId:pbda:tuner /tuner0/Service_Tuner /tuner0/Service_Tuner/control urn:schemas-microsoft-com:service:pbda:cas:1 urn:microsoft-com:serviceId:pbda:cas /tuner0/Service_CAS /tuner0/Service_CAS/control /tuner0/Service_CAS/event urn:schemas-microsoft-com:service:pbda:eventing:1 urn:microsoft-com:serviceId:pbda:eventing /tuner0/Service_Eventing /tuner0/Service_Eventing/control /tuner0/Service_Eventing/event urn:schemas-microsoft-com:service:pbda:gpnvs:1 urn:microsoft-com:serviceId:pbda:gpnvs /tuner0/Service_GPNVS /tuner0/Service_GPNVS/control urn:schemas-microsoft-com:service:pbda:mux:1 urn:microsoft-com:serviceId:pbda:mux /tuner0/Service_MUX /tuner0/Service_MUX/control urn:schemas-microsoft-com:service:pbda:useractivity:1 urn:microsoft-com:serviceId:pbda:useractivity /tuner0/Service_UserActivity /tuner0/Service_UserActivity/control urn:schemas-microsoft-com:service:pbda:guidedatadelivery:1 urn:microsoft-com:serviceId:pbda:guidedatadelivery /tuner0/Service_GuideDataDelivery /tuner0/Service_GuideDataDelivery/control urn:schemas-microsoft-com:service:pbda:debug:1 urn:microsoft-com:serviceId:pbda:debug /tuner0/Service_Debug /tuner0/Service_Debug/control urn:schemas-microsoft-com:service:pbda:drm:1 urn:microsoft-com:serviceId:pbda:drm /tuner0/Service_DRM /tuner0/Service_DRM/control urn:schemas-microsoft-com:service:pbda:diseqccommand:1 urn:microsoft-com:serviceId:pbda:diseqccommand /tuner0/Service_DiseqcCommand /tuner0/Service_DiseqcCommand/control http://10.0.0.169/ http://10.0.0.169:49152/

Same Android Devices Couldn't Discovery Because Same UDN Created

-environment:
two or more SAME android devices
Under Android 2.2

-target source:
org.teleal.cling.model.types.UDN.java

public static UDN uniqueSystemIdentifier(String salt) { 

    java.net.InetAddress i = java.net.InetAddress.getLocalHost(); 
    systemSalt.append(i.getHostName()).append(i.getHostAddress()); 
    // Android always returns "localhost" and "127.0.0.1", not "192.168.0.xxx" 

-more details:
http://mailinglists.945824.n3.nabble.com/Same-Android-Devices-Couldn-t-Discovery-Because-Same-UDN-Created-tp3808695p3808695.html

[osgi] Event UNREGISTERING is not fired to ServiceListeners

Previously reported here: http://code.google.com/p/bwgz-org/issues/detail?id=1

What steps will reproduce the problem?

  1. Launch the basedriver
  2. Launch a remote UPnP Device
  3. Register a ServiceListener with the right filter in order to see the device
  4. Stop the UPnP device

The expected behaviour: An event serviceChanged(ServiceEvent.UNREGISTERING) should be thrown to the ServiceListener which is not happening.

Version: 2.0-SNAPSHOT as of nov.9 2011, on felix.

In org.fourthline.cling.osgi.basedriver.discover.ClingRegistryListener:122, there is context.ungetService(data.getServiceReference());
In order to correctly throw events, it has to call ServiceRegistration.unregister().
I slightly modified UPnPDeviceBinding to keep registration instead of reference and it's working.

Old 1.1 sourcecode is available as an attachment of the original issue, but no changes have been made and is applicable to 2.0.

Action user code should be able to check for cancellation

Action implementation code (for example a MediaServer Browse() action) should be able to check if the action has been aborted for example if:

  • the thread was interrupted with Thread.interrupt() (local and remote actions)
  • for remote actions, the socket connection was closed by the client before completion.

The action code should be able to call a function that return true if the action has been cancelled (or a function that throw InterruptedException).

It should work for both local and remote actions.

Use case:

Browse() action on a Media Server can be a long operation taking several seconds.
Currently, a remote client may choose to close the connection, aborting the action, but the Browse() action processing continue to execute for nothing.

See ReceivingAction.throwIfCancelled() for an example implementation using thread local storage:
https://github.com/bubbleguuum/cling/blob/ffc9bdd1e438ed85707694904aca4a376b588861/core/src/main/java/org/fourthline/cling/protocol/sync/ReceivingAction.java

Add method to get address of connected client

While being in Service, (especially in ContentDirectoryService) it's sometimes needed to be aware of address of client that is now connected. Other related information is the interface that the client connected to (machine can have two or more interfaces, and that makes it hard to return appropriate resource address).

IncomingActionRequestMessage should have two methods: getLocalAddress and GetRemoteAddress .

Some state variables missing in AVTransportVariable

Some variables documented in the spec are missing in class org.teleal.cling.support.avtransport.lastchange.AVTransportVariable, e.g. RelativeTimePosition and AbsoluteTimePosition. This makes it difficult to use the LastChangeParser to read these variables.

Cling couldn't get IP address on Android Wi-Fi Direct network

-environment:
two or more android devices connect on Wi-Fi Direct each other
run cling, then IP address always returns zero

-target source:

org.teleal.cling.android.AndroidNetworkAddressFactory.java

public static NetworkInterface getRealWifiNetworkInterface(WifiManager manager) {

    //.... 

    int wifiIP = manager.getConnectionInfo().getIpAddress(); 
    // when device connectd by Wi-Fi Direct, getIpAddress () is always returns "0" 

    //....

-more details:
http://mailinglists.945824.n3.nabble.com/Cling-couldn-t-get-IP-address-on-Android-Wi-Fi-Direct-network-td3740102.html

Cling identifies VirtualBox interface as usable

When VirtualBox is installed on the same computer running Cling, Cling will mistakenly identify the virtual interface created by VirtualBox as usable. Once it does, Cling seems to be unable to successfully discover any upnp sources. Cling already filters out an interface if it is identified as being created by vmware. This is the same situation. Just a different vm software. I corrected the issue by performing a check for the VirtualBox interface and skipping it if it is detected. The code change was in NetworkAddressFactoryImpl.isUsableNetworkInterface().

This is the code that was added to fix it:

if (iface.getName().toLowerCase().startsWith("virtualbox") ||
(iface.getDisplayName() != null && iface.getDisplayName().toLowerCase().contains("virtualbox"))) {
log.finer("Skipping network interface (VirtualBox): " + iface.getDisplayName());
return false;
}

can't search DMS device on network

my app doesn't in a wifi network environment, but local network(ip: 192.168.10.193). and my app can ping wifi gateway success(gateway: 192.168.6.168). my expectation is that searching DLNA devices on 192.168.6.168 network. but it failed. Can cling can resolove this issue? thanks.

Filter Remote Devices

It would be nice to have a way to validate/filter the remote devices that cling discovers.
For example a FilterProvider that the Router or Register could be receive and run for every device before adding it to the register.

NetworOnMainThreadException in AnroidUpnpService#onDestroy

I am occasionally seeing the exception below when my app terminates after bein launched from the IDE (i.e., in strict mode). Interestingly, it does not happen all the time, and I assume it wont happen in a production environment which doesnt impose strict mode. Still, the underlying issue seems to exist.

OS: Android 4.03
Device: ASUS EeePad Transformer

Caused by: android.os.NetworkOnMainThreadException
at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1099)
at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:163)
at libcore.io.IoBridge.recvfrom(IoBridge.java:503)
at java.net.PlainSocketImpl.read(PlainSocketImpl.java:488)
at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46)
at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:240)
at com.bubblesoft.org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:149)
at com.bubblesoft.org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:110)
at com.bubblesoft.org.apache.http.impl.io.SocketInputBuffer.isDataAvailable(SocketInputBuffer.java:121)
at com.bubblesoft.org.apache.http.impl.AbstractHttpClientConnection.isStale(AbstractHttpClientConnection.java:310)
at com.bubblesoft.org.apache.http.impl.conn.AbstractClientConnAdapter.isStale(AbstractClientConnAdapter.java:174)
at com.bubblesoft.org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:406)
at com.bubblesoft.org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:821)
at com.bubblesoft.org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:942)
at com.bubblesoft.org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:920)
at com.bubblesoft.org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:911)
at org.fourthline.cling.transport.impl.apache.StreamClientImpl.sendRequest(StreamClientImpl.java:137)
at org.fourthline.cling.transport.RouterImpl.send(RouterImpl.java:282)
at org.fourthline.cling.transport.SwitchableRouterImpl.send(SwitchableRouterImpl.java:211)
at org.fourthline.cling.protocol.sync.SendingUnsubscribe.executeSync(SendingUnsubscribe.java:55)
at org.fourthline.cling.protocol.SendingSync.execute(SendingSync.java:55)
at org.fourthline.cling.protocol.SendingAsync.run(SendingAsync.java:44)
at org.fourthline.cling.registry.RemoteItems.shutdown(RemoteItems.java:306)
at org.fourthline.cling.registry.RegistryImpl.shutdown(RegistryImpl.java:385)
at org.fourthline.cling.UpnpServiceImpl.shutdown(UpnpServiceImpl.java:131)
at org.fourthline.cling.android.AndroidUpnpServiceImpl.onDestroy(AndroidUpnpServiceImpl.java:101)
at android.app.ActivityThread.handleStopService(ActivityThread.java:2389)
... 10 more

class support.avtransport.impl.state.Playing does not pass type parameter

the class org.fourthline.cling.support.avtransport.impl.state.Playing should pass the type parameter to the superclass. Currently, the class definition reads:

public abstract class Playing<T extends AVTransport> extends AbstractState {

it should however be:

public abstract class Playing<T extends AVTransport> extends AbstractState<T> {

the same goes for class Stopped.

Support for Android Wi-Fi P2P (Wi-Fi Direct)

We have used Cling for a prototype project relying on the Wi-Fi P2P android interface.

It is not supported yet but a quick workaround was to modify in the class org.teleal.cling.android.AndroidNetworkAddressFactory the method:
public static NetworkInterface getRealWifiNetworkInterface(WifiManager manager)

A wifi direct interface always has the term p2p along with its network interface name (this is identified by inspecting different wifi direct enable devices and many users and blogs suggest the same).

So this method code is altered in such a way that it loops through all available network interfaces until it finds one with name p2p.

Once found it will be returned as the network interface. If not any other available interface is returned.

A reliable support of Wi-Fi P2P probably needs more work as other classes may be affected.

Long.Parse - NumberFormatException

Got this stack trace. We need to catch and return 0 for this exception in cling

java.lang.NumberFormatException: 01.000
at java.lang.Long.parse(Long.java:353)
at java.lang.Long.parseLong(Long.java:344)
at java.lang.Long.parseLong(Long.java:311)
at org.teleal.cling.model.ModelUtil.fromTimeString(ModelUtil.java:189)
at org.teleal.cling.support.model.PositionInfo.getTrackElapsedSeconds(PositionInfo.java:143)
at org.teleal.cling.support.model.PositionInfo.getElapsedPercent(PositionInfo.java:151)
at com.android.myapp.avtransport.AVTransportController$4.received(AVTransportController.java:191)
at org.teleal.cling.support.avtransport.callback.GetPositionInfo.success(GetPositionInfo.java:47)
at org.teleal.cling.controlpoint.ActionCallback.run(ActionCallback.java:156)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
at java.lang.Thread.run(Thread.java:1019)

thanks,
-D

DLNA support for DIDL parser

Evaluate existing work, decide on feature set.

DLNA attributes should not be wrapped in DIDLObject.Property but in DIDLObject.Attribute.

Exception in NetworkAddressFactoryImpl.isInSubnet()

There's a bug in NetworkAddressFactoryImpl.isInSubnet() if netmask /8 == ip.length (for example if netmask=32, which I've seen happening).

An ArrayIndexOutOfBoundsException is thrown on the last line.

The fix is to check for this case:

while (prefix >= 8 && i < ip.length) {
...
}
if(i == ip.length) return true; // added line

Application crashes after switching WiFi Off then On and launching the application

Cling versions: 1.05, 1.1, 2.0

Android Devices/OS Versions:

  1. Nexus S / 4.1
  2. Motorola Droid RAZR / 4.0.4

The crash is easy to reproduce by turning WiFi Off and then On really quickly (i have used the default Android widget at the home screen).

09-18 10:42:06.820: E/AndroidRuntime(29918): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.net.conn.CONNECTIVITY_CHANGE flg=0x8000010 (has extras) } in org.teleal.cling.android.AndroidWifiSwitchableRouter$1@425dac90
09-18 10:42:06.820: E/AndroidRuntime(29918): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:765)
09-18 10:42:06.820: E/AndroidRuntime(29918): at android.os.Handler.handleCallback(Handler.java:615)
09-18 10:42:06.820: E/AndroidRuntime(29918): at android.os.Handler.dispatchMessage(Handler.java:92)
09-18 10:42:06.820: E/AndroidRuntime(29918): at android.os.Looper.loop(Looper.java:137)
09-18 10:42:06.820: E/AndroidRuntime(29918): at android.app.ActivityThread.main(ActivityThread.java:4745)
09-18 10:42:06.820: E/AndroidRuntime(29918): at java.lang.reflect.Method.invokeNative(Native Method)
09-18 10:42:06.820: E/AndroidRuntime(29918): at java.lang.reflect.Method.invoke(Method.java:511)
09-18 10:42:06.820: E/AndroidRuntime(29918): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
09-18 10:42:06.820: E/AndroidRuntime(29918): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-18 10:42:06.820: E/AndroidRuntime(29918): at dalvik.system.NativeStart.main(Native Method)
09-18 10:42:06.820: E/AndroidRuntime(29918): Caused by: org.teleal.cling.transport.SwitchableRouterImpl$RouterLockAcquisitionException: Failed to acquire router lock: WriteLock
09-18 10:42:06.820: E/AndroidRuntime(29918): at org.teleal.cling.transport.SwitchableRouterImpl.lock(SwitchableRouterImpl.java:211)
09-18 10:42:06.820: E/AndroidRuntime(29918): at org.teleal.cling.transport.SwitchableRouterImpl.lock(SwitchableRouterImpl.java:219)
09-18 10:42:06.820: E/AndroidRuntime(29918): at org.teleal.cling.android.AndroidWifiSwitchableRouter.enable(AndroidWifiSwitchableRouter.java:97)
09-18 10:42:06.820: E/AndroidRuntime(29918): at org.teleal.cling.android.AndroidWifiSwitchableRouter$1.onReceive(AndroidWifiSwitchableRouter.java:59)
09-18 10:42:06.820: E/AndroidRuntime(29918): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:755)
09-18 10:42:06.820: E/AndroidRuntime(29918): ... 9 more

workbench standalong jar running failed

I cloned git source and built workbench. I got messages below when running standalong jar.

JarClassLoader: Warning: Null manifest from input stream associated with: lib/javax.inject-1.jar
JarClassLoader: Warning: javax/interceptor/InvocationContext.class in lib/ejb-api-3.0.jar is hidden by lib/jboss-interceptors-api_1.1_spec-1.0.0.Beta1.jar (with different bytecode)
Jan 18, 2012 5:05:46 PM org.jboss.weld.bootstrap.WeldBootstrap
INFO: WELD-000900 1.1.1 (Final)
Exception in thread "main" java.lang.ExceptionInInitializerError
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.simontuffs.onejar.Boot.run(Boot.java:340)
at com.simontuffs.onejar.Boot.main(Boot.java:166)
Caused by: java.lang.RuntimeException: Error handling file /workbench/target/cling-workbench-2.0-SNAPSHOT-standalone.jar
at org.jboss.weld.environment.se.discovery.url.FileSystemURLHandler.handleArchiveByFile(FileSystemURLHandler.java:97)
at org.jboss.weld.environment.se.discovery.url.FileSystemURLHandler.handle(FileSystemURLHandler.java:68)
at org.jboss.weld.environment.se.discovery.url.URLScanner.scan(URLScanner.java:117)
at org.jboss.weld.environment.se.discovery.url.WeldSEUrlDeployment.(WeldSEUrlDeployment.java:42)
at org.jboss.weld.environment.se.Weld.createDeployment(Weld.java:128)
at org.jboss.weld.environment.se.Weld.initialize(Weld.java:81)
at org.fourthline.cling.workbench.Workbench.(Workbench.java:38)
... 6 more
Caused by: java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:127)
at java.util.zip.ZipFile.(ZipFile.java:144)
at org.jboss.weld.environment.se.discovery.url.FileSystemURLHandler.handleArchiveByFile(FileSystemURLHandler.java:85)
... 12 more

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.