本文整理汇总了Java中org.fourthline.cling.android.AndroidUpnpService类的典型用法代码示例。如果您正苦于以下问题:Java AndroidUpnpService类的具体用法?Java AndroidUpnpService怎么用?Java AndroidUpnpService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AndroidUpnpService类属于org.fourthline.cling.android包,在下文中一共展示了AndroidUpnpService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onServiceConnected
import org.fourthline.cling.android.AndroidUpnpService; //导入依赖的package包/类
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
Log.d(TAG, "onServiceConnected: " + name.flattenToShortString() + ", " + service.toString());
mUpnpService = (AndroidUpnpService) service;
Device device = mUpnpService.getRegistry().getDevice(new UDN(mDeviceUdn), false);
mContentDirectoryService = device.findService(new UDAServiceType("ContentDirectory"));
if (mContentDirectoryService == null) {
throw new IllegalStateException("Unable to find ContentDirectory service for device "
+ mDeviceUdn);
}
mDeviceName = (device.getDetails() != null && device.getDetails().getFriendlyName() != null)
? device.getDetails().getFriendlyName() : device.getDisplayString();
selectContainer(mCurrentContainer);
}
示例2: onServiceConnected
import org.fourthline.cling.android.AndroidUpnpService; //导入依赖的package包/类
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
Log.d(TAG, "onServiceConnected: " + name.flattenToShortString() + ", " + service.toString());
mUpnpService = (AndroidUpnpService) service;
mServerListAdapter.clear();
mUpnpService.getRegistry().addListener(mRegistryListener);
// Add any already-cached devices.
for (Device device : mUpnpService.getRegistry().getDevices()) {
onDeviceAdded(device);
}
// Kick off a search for all devices on the network.
mUpnpService.getControlPoint().search();
}
示例3: onServiceConnected
import org.fourthline.cling.android.AndroidUpnpService; //导入依赖的package包/类
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
mAndroidUpnpService = (AndroidUpnpService) service;
mHeartRateService = getHeartRateService();
if(mHeartRateService == null) {
LocalDevice heartRateServiceDevice = new DeviceFactory().createWearNotificationServiceDevice(mUDN);
if(heartRateServiceDevice != null) {
mAndroidUpnpService.getRegistry().addDevice(heartRateServiceDevice);
mHeartRateService = getHeartRateService();
}
}
if(mHeartRateService != null) {
mHeartRateService.getManager().getImplementation().registerListener(this);
}
}
示例4: onServiceConnected
import org.fourthline.cling.android.AndroidUpnpService; //导入依赖的package包/类
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
mAndroidUpnpService = (AndroidUpnpService) service;
mHeartRateDataService = getHeartRateDataService();
if(mHeartRateDataService == null) {
LocalDevice heartRateDataServiceDevice = new DeviceFactory().createHeartRateDataServiceDevice(mUDN);
if(heartRateDataServiceDevice != null) {
mAndroidUpnpService.getRegistry().addDevice(heartRateDataServiceDevice);
mHeartRateDataService = getHeartRateDataService();
}
}
if(mHeartRateDataService != null) {
mHeartRateDataService.getManager().getImplementation().registerListener(this);
}
}
示例5: onServiceConnected
import org.fourthline.cling.android.AndroidUpnpService; //导入依赖的package包/类
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
mAndroidUpnpService = (AndroidUpnpService) service;
mStartPollService = getStartPollService();
if(mStartPollService == null) {
LocalDevice heartRateServiceDevice = new DeviceFactory().createStartPollServiceDevice(mUDN);
if(heartRateServiceDevice != null) {
mAndroidUpnpService.getRegistry().addDevice(heartRateServiceDevice);
mStartPollService = getStartPollService();
}
}
if(mStartPollService != null) {
mStartPollService.getManager().getImplementation().registerListener(this);
}
}
示例6: onServiceConnected
import org.fourthline.cling.android.AndroidUpnpService; //导入依赖的package包/类
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();
}
示例7: makeBrowseObservable
import org.fourthline.cling.android.AndroidUpnpService; //导入依赖的package包/类
Observable<Model> makeBrowseObservable(
final String folderIdentity,final AndroidUpnpService service,
final RemoteService remoteService, final boolean listing) {
if (StringUtils.isEmpty(folderIdentity)) {
//first try to get the music only virtual folder, then do the browse
return Observable.create(new GetFeatureListOnSubscribe(service, remoteService)).flatMap(
new Func1<String, Observable<Model>>() {
@Override
public Observable<Model> call(String s) {
return Observable.create(new BrowseOnSubscribe(
mAuthority, service, remoteService, s,
BrowseFlag.DIRECT_CHILDREN));
}
}
);
} else {
//we were given a folder, browse it
return Observable.create(new BrowseOnSubscribe(
mAuthority, service, remoteService, folderIdentity,
listing ? BrowseFlag.DIRECT_CHILDREN : BrowseFlag.METADATA));
}
}
示例8: scheduleServiceShutdown
import org.fourthline.cling.android.AndroidUpnpService; //导入依赖的package包/类
private void scheduleServiceShutdown() {
cancelServiceShutdown();
mShutdownWorker = Schedulers.computation().createWorker();
mShutdownWorker.schedule(new Action0() {
@Override
public void call() {
AndroidUpnpService service = mBinder;
if (!service.getRegistry().isPaused()) {
service.getRegistry().pause();
}
}
}, 10, TimeUnit.MINUTES);
mShutdownWorker.schedule(new Action0() {
@Override
public void call() {
stopSelf();
}
}, 20, TimeUnit.MINUTES);
}
示例9: onServiceConnected
import org.fourthline.cling.android.AndroidUpnpService; //导入依赖的package包/类
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);
}
getNetworkSourceArrayAdapter().notifyDataSetChanged();
// Search asynchronously for all devices, they will respond soon
upnpService.getControlPoint().search();
}
示例10: onServiceConnected
import org.fourthline.cling.android.AndroidUpnpService; //导入依赖的package包/类
@Override
public void onServiceConnected(ComponentName componentName, IBinder binder) {
if(binder instanceof AndroidUpnpService){
androidUpnpService = (AndroidUpnpService)binder;
localDevice = createDevice();
androidUpnpService.getRegistry().addDevice(localDevice);
}
}
示例11: UpnpControlSet
import org.fourthline.cling.android.AndroidUpnpService; //导入依赖的package包/类
/**
* @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();
}
示例12: onServiceConnected
import org.fourthline.cling.android.AndroidUpnpService; //导入依赖的package包/类
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();
}
示例13: Controller
import org.fourthline.cling.android.AndroidUpnpService; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
public Controller(Context context, AndroidUpnpService androidUpnpService,
Device device, Handler handler) {
mContext = context;
mAndroidUpnpService = androidUpnpService;
if (device != null) {
mConnectionService = device.findService(new UDAServiceType(
UpnpUtils.SERVICE_CONNECTION_MANAGER));
mAvTransportService = device.findService(new UDAServiceType(
UpnpUtils.SERVICE_AVTRANSPORT));
mRendererControlService = device.findService(new UDAServiceType(
UpnpUtils.SERVICE_RENDERING_CONTROL));
registerLastChangeListener(handler);
}
}
示例14: onServiceConnected
import org.fourthline.cling.android.AndroidUpnpService; //导入依赖的package包/类
@Override
public void onServiceConnected(ComponentName componentName, IBinder service) {
Log.e(TAG, "UPNP service is connected.");
mUpnpService = (AndroidUpnpService) service;
mMediaServer = new MediaServer(mContext, Utils.getInetAddress(mContext));
ContentGenerator.prepareAudio(mContext,mMediaServer);
if (mMediaServer != null)
mUpnpService.getRegistry().addDevice(mMediaServer.getDevice());
mMediaRenderer = new MediaRenderer(mContext);
if (mMediaRenderer != null)
mUpnpService.getRegistry().addDevice(mMediaRenderer.getDevice());
}
示例15: sup
import org.fourthline.cling.android.AndroidUpnpService; //导入依赖的package包/类
private void sup() {
mRegistryListener = new SimpleBrowseRegistryListener();
mServiceConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) {
mUpnpService = (AndroidUpnpService) service;
// Get ready for future device advertisements
mUpnpService.getRegistry().addListener(mRegistryListener);
// Now add all devices to the list we already know about
for (Device device : mUpnpService.getRegistry().getDevices()) {
mRegistryListener.deviceAdded(device);
}
// Search asynchronously for all devices
mUpnpService.getControlPoint().search();
mUpnpService.getRegistry().getDevice(UDN.valueOf(""), false);
}
public void onServiceDisconnected(ComponentName className) {
mUpnpService = null;
}
};
bindService(
new Intent(this, UpnpService.class),
mServiceConnection,
Context.BIND_AUTO_CREATE
);
}