org.fourthline.cling.android.AndroidUpnpService Java Examples

The following examples show how to use org.fourthline.cling.android.AndroidUpnpService. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BrowserActivity.java    From DroidDLNA with GNU General Public License v3.0 6 votes vote down vote up
public void onServiceConnected(ComponentName className, IBinder service) {
    upnpService = (AndroidUpnpService) service;

    // Clear the list
    listAdapter.clear();

    // Get ready for future device advertisements
    upnpService.getRegistry().addListener(registryListener);

    // Now add all devices to the list we already know about
    for (Device device : upnpService.getRegistry().getDevices()) {
        registryListener.deviceAdded(device);
    }

    // Search asynchronously for all devices, they will respond soon
    upnpService.getControlPoint().search();
}
 
Example #2
Source File: UpnpControlSet.java    From HPlayer with Apache License 2.0 5 votes vote down vote up
/**
 * @param upnpService             upnp服务
 * @param avTransportService      远程视频传输服务
 * @param renderingControlService 远程渲染器控制服务
 */
public UpnpControlSet(AndroidUpnpService upnpService,
                      Service avTransportService,
                      Service renderingControlService) {
    this.mUpnpService = upnpService;
    this.avTransportService = avTransportService;
    this.renderingControlService = renderingControlService;
    if (mUpnpService == null || avTransportService == null
            || renderingControlService == null) {
        Log.e(TAG, "UpnpControlSet parameters is null");
    }
    mHandler = new Handler();
    initNoParameterActionCallback();
}
 
Example #3
Source File: DlnaSearch.java    From HPlayer with Apache License 2.0 5 votes vote down vote up
public void onServiceConnected(ComponentName className, IBinder service) {
    Log.d(TAG, "DLNA-----DlnaAndRemoteSearch---onServiceConnected");
    mUpnpService = (AndroidUpnpService) service;
    mUpnpService.getControlPoint().getRegistry().removeAllRemoteDevices();// 先清除掉之前的,再搜索
    mUpnpService.getRegistry().addListener(mDefaultRegistryListener);
    mUpnpService.getControlPoint().search();
}
 
Example #4
Source File: DMCControl.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
public DMCControl(Activity paramActivity, int paramInt,
		DeviceItem paramDeviceItem,
		AndroidUpnpService paramAndroidUpnpService, String paramString1,
		String paramString2) {
	this.activity = paramActivity;
	this.controlType = paramInt;
	this.executeDeviceItem = paramDeviceItem;
	this.upnpService = paramAndroidUpnpService;
	this.uriString = paramString1;
	this.metaData = paramString2;
}
 
Example #5
Source File: DlnaSearch.java    From HPlayer with Apache License 2.0 4 votes vote down vote up
/**
 * @return upnpIBinder
 */
public AndroidUpnpService getUpnpService() {
    return mUpnpService;
}
 
Example #6
Source File: DevicesActivity.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
public void onServiceConnected(ComponentName className, IBinder service) {

			mDevList.clear();
			mDmrList.clear();

			upnpService = (AndroidUpnpService) service;
			BaseApplication.upnpService = upnpService;

			Log.v(LOGTAG, "Connected to UPnP Service");

			if (mediaServer == null
					&& SettingActivity.getDmsOn(DevicesActivity.this)) {
				try {
					mediaServer = new MediaServer(DevicesActivity.this);
					upnpService.getRegistry()
							.addDevice(mediaServer.getDevice());
					DeviceItem localDevItem = new DeviceItem(
							mediaServer.getDevice());

					deviceListRegistryListener.deviceAdded(localDevItem);
					new Thread(new Runnable() {

						@Override
						public void run() {
							prepareMediaServer();
						}
					}).start();

				} catch (Exception ex) {
					// TODO: handle exception
					log.log(Level.SEVERE, "Creating demo device failed", ex);
					Toast.makeText(DevicesActivity.this,
							R.string.create_demo_failed, Toast.LENGTH_SHORT)
							.show();
					return;
				}
			}

			if (SettingActivity.getRenderOn(DevicesActivity.this)) {
				ZxtMediaRenderer mediaRenderer = new ZxtMediaRenderer(1,
						DevicesActivity.this);
				upnpService.getRegistry().addDevice(mediaRenderer.getDevice());
				deviceListRegistryListener.dmrAdded(new DeviceItem(
						mediaRenderer.getDevice()));
			}

			// xgf
			for (Device device : upnpService.getRegistry().getDevices()) {
				if (device.getType().getNamespace().equals("schemas-upnp-org")
						&& device.getType().getType().equals("MediaServer")) {
					final DeviceItem display = new DeviceItem(device, device
							.getDetails().getFriendlyName(),
							device.getDisplayString(), "(REMOTE) "
									+ device.getType().getDisplayString());
					deviceListRegistryListener.deviceAdded(display);
				}
			}

			// Getting ready for future device advertisements
			upnpService.getRegistry().addListener(deviceListRegistryListener);
			// Refresh device list
			upnpService.getControlPoint().search();

			// select first device by default
			if (null != mDevList && mDevList.size() > 0
					&& null == BaseApplication.deviceItem) {
				BaseApplication.deviceItem = mDevList.get(0);
			}
			if (null != mDmrList && mDmrList.size() > 0
					&& null == BaseApplication.dmrDeviceItem) {
				BaseApplication.dmrDeviceItem = mDmrList.get(0);
			}
		}