Java Code Examples for org.fourthline.cling.support.model.Channel#valueOf()

The following examples show how to use org.fourthline.cling.support.model.Channel#valueOf() . 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: AbstractAudioRenderingControl.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
protected Channel getChannel(String channelName) throws RenderingControlException {
    try {
        return Channel.valueOf(channelName);
    } catch (IllegalArgumentException ex) {
        throw new RenderingControlException(ErrorCode.ARGUMENT_VALUE_INVALID, "Unsupported audio channel: " + channelName);
    }
}
 
Example 2
Source File: EventedValueChannelMute.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected ChannelMute valueOf(Map.Entry<String, String>[] attributes) throws InvalidValueException {
    Channel channel = null;
    Boolean mute = null;
    for (Map.Entry<String, String> attribute : attributes) {
        if (attribute.getKey().equals("channel"))
            channel = Channel.valueOf(attribute.getValue());
        if (attribute.getKey().equals("val"))
            mute = new BooleanDatatype().valueOf(attribute.getValue());
    }
    return channel != null && mute != null ? new ChannelMute(channel, mute) : null;
}
 
Example 3
Source File: EventedValueChannelVolumeDB.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected ChannelVolumeDB valueOf(Map.Entry<String, String>[] attributes) throws InvalidValueException {
    Channel channel = null;
    Integer volumeDB = null;
    for (Map.Entry<String, String> attribute : attributes) {
        if (attribute.getKey().equals("channel"))
            channel = Channel.valueOf(attribute.getValue());
        if (attribute.getKey().equals("val"))
            volumeDB = (new UnsignedIntegerTwoBytesDatatype()
                    .valueOf(attribute.getValue()))
                    .getValue().intValue(); // Java is fun!
    }
    return channel != null && volumeDB != null ? new ChannelVolumeDB(channel, volumeDB) : null;
}
 
Example 4
Source File: EventedValueChannelVolume.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected ChannelVolume valueOf(Map.Entry<String, String>[] attributes) throws InvalidValueException {
    Channel channel = null;
    Integer volume = null;
    for (Map.Entry<String, String> attribute : attributes) {
        if (attribute.getKey().equals("channel"))
            channel = Channel.valueOf(attribute.getValue());
        if (attribute.getKey().equals("val"))
            volume = (new UnsignedIntegerTwoBytesDatatype()
                    .valueOf(attribute.getValue()))
                    .getValue().intValue(); // Java is fun!
    }
    return channel != null && volume != null ? new ChannelVolume(channel, volume) : null;
}
 
Example 5
Source File: EventedValueChannelLoudness.java    From TVRemoteIME with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected ChannelLoudness valueOf(Map.Entry<String, String>[] attributes) throws InvalidValueException {
    Channel channel = null;
    Boolean loudness = null;
    for (Map.Entry<String, String> attribute : attributes) {
        if (attribute.getKey().equals("channel"))
            channel = Channel.valueOf(attribute.getValue());
        if (attribute.getKey().equals("val"))
            loudness = new BooleanDatatype().valueOf(attribute.getValue());
    }
    return channel != null && loudness != null ? new ChannelLoudness(channel, loudness) : null;
}
 
Example 6
Source File: AbstractAudioRenderingControl.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
protected Channel getChannel(String channelName) throws RenderingControlException {
    try {
        return Channel.valueOf(channelName);
    } catch (IllegalArgumentException ex) {
        throw new RenderingControlException(ErrorCode.ARGUMENT_VALUE_INVALID, "Unsupported audio channel: " + channelName);
    }
}
 
Example 7
Source File: EventedValueChannelMute.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected ChannelMute valueOf(Map.Entry<String, String>[] attributes) throws InvalidValueException {
    Channel channel = null;
    Boolean mute = null;
    for (Map.Entry<String, String> attribute : attributes) {
        if (attribute.getKey().equals("channel"))
            channel = Channel.valueOf(attribute.getValue());
        if (attribute.getKey().equals("val"))
            mute = new BooleanDatatype().valueOf(attribute.getValue());
    }
    return channel != null && mute != null ? new ChannelMute(channel, mute) : null;
}
 
Example 8
Source File: EventedValueChannelVolumeDB.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected ChannelVolumeDB valueOf(Map.Entry<String, String>[] attributes) throws InvalidValueException {
    Channel channel = null;
    Integer volumeDB = null;
    for (Map.Entry<String, String> attribute : attributes) {
        if (attribute.getKey().equals("channel"))
            channel = Channel.valueOf(attribute.getValue());
        if (attribute.getKey().equals("val"))
            volumeDB = (new UnsignedIntegerTwoBytesDatatype()
                    .valueOf(attribute.getValue()))
                    .getValue().intValue(); // Java is fun!
    }
    return channel != null && volumeDB != null ? new ChannelVolumeDB(channel, volumeDB) : null;
}
 
Example 9
Source File: EventedValueChannelVolume.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected ChannelVolume valueOf(Map.Entry<String, String>[] attributes) throws InvalidValueException {
    Channel channel = null;
    Integer volume = null;
    for (Map.Entry<String, String> attribute : attributes) {
        if (attribute.getKey().equals("channel"))
            channel = Channel.valueOf(attribute.getValue());
        if (attribute.getKey().equals("val"))
            volume = (new UnsignedIntegerTwoBytesDatatype()
                    .valueOf(attribute.getValue()))
                    .getValue().intValue(); // Java is fun!
    }
    return channel != null && volume != null ? new ChannelVolume(channel, volume) : null;
}
 
Example 10
Source File: EventedValueChannelLoudness.java    From DroidDLNA with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected ChannelLoudness valueOf(Map.Entry<String, String>[] attributes) throws InvalidValueException {
    Channel channel = null;
    Boolean loudness = null;
    for (Map.Entry<String, String> attribute : attributes) {
        if (attribute.getKey().equals("channel"))
            channel = Channel.valueOf(attribute.getValue());
        if (attribute.getKey().equals("val"))
            loudness = new BooleanDatatype().valueOf(attribute.getValue());
    }
    return channel != null && loudness != null ? new ChannelLoudness(channel, loudness) : null;
}