FileDocCategorySizeDatePackage
RequestArcAction.javaAPI DocAndroid 5.1 API3401Thu Mar 12 22:22:42 GMT 2015com.android.server.hdmi

RequestArcAction

public abstract class RequestArcAction extends HdmiCecFeatureAction
Base feature action class for <Request ARC Initiation>/<Request ARC Termination>.

Fields Summary
private static final String
TAG
protected static final int
STATE_WATING_FOR_REQUEST_ARC_REQUEST_RESPONSE
protected final int
mAvrAddress
Constructors Summary
RequestArcAction(HdmiCecLocalDevice source, int avrAddress)

Constructor
param
source {@link HdmiCecLocalDevice} instance
param
avrAddress address of AV receiver. It should be AUDIO_SYSTEM type
throw
IllegalArugmentException if device type of sourceAddress and avrAddress is invalid


                                                          
        
        super(source);
        HdmiUtils.verifyAddressType(getSourceAddress(), HdmiDeviceInfo.DEVICE_TV);
        HdmiUtils.verifyAddressType(avrAddress, HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM);
        mAvrAddress = avrAddress;
    
Methods Summary
protected final voiddisableArcTransmission()

        // Start Set ARC Transmission State action.
        SetArcTransmissionStateAction action = new SetArcTransmissionStateAction(localDevice(),
                mAvrAddress, false);
        addAndStartAction(action);
    
final voidhandleTimerEvent(int state)

        if (mState != state || state != STATE_WATING_FOR_REQUEST_ARC_REQUEST_RESPONSE) {
            return;
        }
        HdmiLogger.debug("[T]RequestArcAction.");
        disableArcTransmission();
        finish();
    
booleanprocessCommand(HdmiCecMessage cmd)

        if (mState != STATE_WATING_FOR_REQUEST_ARC_REQUEST_RESPONSE
                || !HdmiUtils.checkCommandSource(cmd, mAvrAddress, TAG)) {
            return false;
        }
        int opcode = cmd.getOpcode();
        switch (opcode) {
            // Handles only <Feature Abort> here and, both <Initiate ARC> and <Terminate ARC>
            // are handled in HdmiControlService itself because both can be
            // received without <Request ARC Initiation> or <Request ARC Termination>.
            case Constants.MESSAGE_FEATURE_ABORT:
                int originalOpcode = cmd.getParams()[0] & 0xFF;
                if (originalOpcode == Constants.MESSAGE_REQUEST_ARC_INITIATION
                        || originalOpcode == Constants.MESSAGE_REQUEST_ARC_TERMINATION) {
                    disableArcTransmission();
                    finish();
                    return true;
                } else {
                    return false;
                }
        }
        return false;