private void parseDevice(String fileName) { if (mCurPath.equals(mRoot) == false) mCurPath = mRoot; constructCurPath(fileName, true); DLNADevice device = mNameDeviceTable.get(fileName); if ((device.getType() != DLNADeviceType.DigitalMediaServer) && (device.getType() != DLNADeviceType.MobileDigitalMediaServer)) return; DLNATempFile fileins = new DLNATempFile(device); mTraceFile.push(fileins); mListContentName.clear(); // mNameContentTable.clear(); server = (MediaServer) device; server.setActionEventListener(mDLNAManager); if (localLOGV) NetLog.v(TAG, "start 1 browse : " + System.currentTimeMillis()); REQUEST_MATCH_NUM = 0; currentID = MediaServer.OBJECT_ID; mBrowseHandle = server.browse( MediaServer.OBJECT_ID, MediaServer.BrowseFlag.BrowseDirectChildren, REQUEST_MATCH_NUM, BROWSE_REQUEST, MediaServer.FILTER_BASIC_INFO, MediaServer.SORT_ASCENDING_CRITERIA_TITLE); if (localLOGV) NetLog.v(TAG, "end 1 browse : " + System.currentTimeMillis()); return; }
/** * Call back function, implement for com.mediatek.dlna.jar. Application should not use this API. * * @return. */ public void notifyDeviceFound(FoundDeviceEvent event) { if (localLOGV) NetLog.d(TAG, "notifyDeviceFound"); DLNADevice device = event.getDevice(); String name = device.getName(); DLNAFile devicefile = new DLNAFile(device, mRoot, mRoot); if (localLOGV) NetLog.d(TAG, "add device to device list"); mListDLNADeviceName.add(devicefile); mNameDeviceTable.put(name, device); if (listener != null) { listener.onFileFound(new FileEvent(event, mListDLNADeviceName)); } }
/** * Call back function, implement for com.mediatek.dlna.jar. Application should not use this API. * * @return. */ public void notifyDeviceLeft(LeftDeviceEvent event) { if (localLOGV) NetLog.d(TAG, "notifyDeviceLeft"); String name = event.getDevice().getName(); DLNADevice device = event.getDevice(); int number = mListDLNADeviceName.size(); for (int i = 0; i < number; i++) { DLNAFile tempDevice = mListDLNADeviceName.get(i); if (device.equals(tempDevice.getDevice())) { mListDLNADeviceName.remove(tempDevice); break; } } mNameDeviceTable.remove(name); if (listener != null) { listener.onFileLeft(new FileEvent(event, mListDLNADeviceName)); } }