當前位置: 首頁>>代碼示例>>Java>>正文


Java Response類代碼示例

本文整理匯總了Java中org.hampelratte.svdrp.Response的典型用法代碼示例。如果您正苦於以下問題:Java Response類的具體用法?Java Response怎麽用?Java Response使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Response類屬於org.hampelratte.svdrp包,在下文中一共展示了Response類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getExtendedChannels

import org.hampelratte.svdrp.Response; //導入依賴的package包/類
public Optional<List<ExtendedChannel>> getExtendedChannels(String vdrUuid) {
    VDR vdr = configuration.getVdr(vdrUuid);

    String resultStr = null;

    org.hampelratte.svdrp.Connection svdrpVdr;
    try {
        svdrpVdr = new org.hampelratte.svdrp.Connection(vdr.getIp(), vdr.getSvdrpPort(), 5000);
        Response response = svdrpVdr.send(new LSTC());

        if (response.getCode() == 250) {
            resultStr = response.getMessage();
        } else {
            return Optional.empty();
        }

        svdrpVdr.close();
    } catch (Exception e) {
        return Optional.empty();
    }

    Set<String> alreadyFoundNames = new HashSet<String>();
    
    List<ExtendedChannel> result = new ArrayList<>();
    Arrays.stream(resultStr.split("\n")).forEach(s -> {
        ExtendedChannel ch = new ExtendedChannel(s);
                    
        if(!alreadyFoundNames.contains(ch.getName())) {
            result.add(ch);
            alreadyFoundNames.add(ch.getName());
        }
    });
    
    return Optional.of(result);
}
 
開發者ID:Zabrimus,項目名稱:vdr-jonglisto,代碼行數:36,代碼來源:VdrDataServiceImpl.java

示例2: isRecording

import org.hampelratte.svdrp.Response; //導入依賴的package包/類
/**
 * Check if recording is in process
 * 
 * @return true if recording is in process otherwise false
 */
public Boolean isRecording() {
	// get list of timers
	Response response = send(new LSTT());
	Boolean ret = Boolean.FALSE;
	if (response != null && response.getCode()==250 && response.getMessage() != null) {
		List<VDRTimer> timerList = TimerParser.parse(response.getMessage());
		if (timerList != null && !timerList.isEmpty()) {
			// check each timer until found a time which is active and state is recording
			// do not use vdrTimer.isRecording because we need to add
			// enough time (e.g. 6 Minutes) because of wakeup time
			for (VDRTimer vdrTimer : timerList) {
				// check if timer is active and state is recording
				if (vdrTimer.isActive()
						&& vdrTimer.hasState(VDRTimer.RECORDING)) {
					ret = Boolean.TRUE;
					break;
				} else {
					// check if timer starts before now (+6 minutes for wakeup) and if timer stops after now 
					boolean recording = false;
					Calendar startNow = Calendar.getInstance();
					Calendar endNow = Calendar.getInstance();
					startNow.add(Calendar.MINUTE, 6);
					if (startNow.after(vdrTimer.getStartTime())
							&& endNow.before(vdrTimer.getEndTime())) {
						recording = vdrTimer.hasState(VDRTimer.ACTIVE);
					}
					// if recording is true, check if timer is repeating timer
					// if repeating timer check if DaySet match
					if (recording) {
						if (!vdrTimer.isRepeating()) {
							ret = Boolean.TRUE;
							break;
						} else if (vdrTimer.isDaySet(Calendar.getInstance())) {
							ret = Boolean.TRUE;
							break;
						}
					}
				}
			}
		}
	}
	logger.trace("VDR (" + mIp + ") recording state: " + ret);
	return ret;
}
 
開發者ID:andrey-desman,項目名稱:openhab-hdl,代碼行數:50,代碼來源:VDRConnection.java

示例3: isRecording

import org.hampelratte.svdrp.Response; //導入依賴的package包/類
/**
 * Check if recording is in process
 * 
 * @return true if recording is in process otherwise false
 */
public Boolean isRecording() {
    // get list of timers
    Response response = send(new LSTT());
    Boolean ret = Boolean.FALSE;
    if (response != null && response.getCode() == 250 && response.getMessage() != null) {
        List<VDRTimer> timerList = TimerParser.parse(response.getMessage());
        if (timerList != null && !timerList.isEmpty()) {
            // check each timer until found a time which is active and state is recording
            // do not use vdrTimer.isRecording because we need to add
            // enough time (e.g. 6 Minutes) because of wakeup time
            for (VDRTimer vdrTimer : timerList) {
                // check if timer is active and state is recording
                if (vdrTimer.isActive() && vdrTimer.hasState(VDRTimer.RECORDING)) {
                    ret = Boolean.TRUE;
                    break;
                } else {
                    // check if timer starts before now (+6 minutes for wakeup) and if timer stops after now
                    boolean recording = false;
                    Calendar startNow = Calendar.getInstance();
                    Calendar endNow = Calendar.getInstance();
                    startNow.add(Calendar.MINUTE, 6);
                    if (startNow.after(vdrTimer.getStartTime()) && endNow.before(vdrTimer.getEndTime())) {
                        recording = vdrTimer.hasState(VDRTimer.ACTIVE);
                    }
                    // if recording is true, check if timer is repeating timer
                    // if repeating timer check if DaySet match
                    if (recording) {
                        if (!vdrTimer.isRepeating()) {
                            ret = Boolean.TRUE;
                            break;
                        } else if (vdrTimer.isDaySet(Calendar.getInstance())) {
                            ret = Boolean.TRUE;
                            break;
                        }
                    }
                }
            }
        }
    }
    logger.trace("VDR (" + mIp + ") recording state: " + ret);
    return ret;
}
 
開發者ID:openhab,項目名稱:openhab1-addons,代碼行數:48,代碼來源:VDRConnection.java


注:本文中的org.hampelratte.svdrp.Response類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。