Search in sources :

Example 21 with SendMessageCallback

use of com.android.server.hdmi.HdmiControlService.SendMessageCallback in project android_frameworks_base by crdroidandroid.

the class TimerRecordingAction method sendTimerMessage.

private void sendTimerMessage() {
    HdmiCecMessage message = null;
    switch(mSourceType) {
        case TIMER_RECORDING_TYPE_DIGITAL:
            message = HdmiCecMessageBuilder.buildSetDigitalTimer(getSourceAddress(), mRecorderAddress, mRecordSource);
            break;
        case TIMER_RECORDING_TYPE_ANALOGUE:
            message = HdmiCecMessageBuilder.buildSetAnalogueTimer(getSourceAddress(), mRecorderAddress, mRecordSource);
            break;
        case TIMER_RECORDING_TYPE_EXTERNAL:
            message = HdmiCecMessageBuilder.buildSetExternalTimer(getSourceAddress(), mRecorderAddress, mRecordSource);
            break;
        default:
            tv().announceTimerRecordingResult(mRecorderAddress, TIMER_RECORDING_RESULT_EXTRA_FAIL_TO_RECORD_SELECTED_SOURCE);
            finish();
            return;
    }
    sendCommand(message, new SendMessageCallback() {

        @Override
        public void onSendCompleted(int error) {
            if (error != Constants.SEND_RESULT_SUCCESS) {
                tv().announceTimerRecordingResult(mRecorderAddress, TIMER_RECORDING_RESULT_EXTRA_CHECK_RECORDER_CONNECTION);
                finish();
                return;
            }
            mState = STATE_WAITING_FOR_TIMER_STATUS;
            addTimer(mState, TIMER_STATUS_TIMEOUT_MS);
        }
    });
}
Also used : SendMessageCallback(com.android.server.hdmi.HdmiControlService.SendMessageCallback)

Example 22 with SendMessageCallback

use of com.android.server.hdmi.HdmiControlService.SendMessageCallback in project android_frameworks_base by DirtyUnicorns.

the class HdmiCecLocalDeviceTv method sendClearTimerMessage.

private void sendClearTimerMessage(final int recorderAddress, int sourceType, byte[] recordSource) {
    HdmiCecMessage message = null;
    switch(sourceType) {
        case TIMER_RECORDING_TYPE_DIGITAL:
            message = HdmiCecMessageBuilder.buildClearDigitalTimer(mAddress, recorderAddress, recordSource);
            break;
        case TIMER_RECORDING_TYPE_ANALOGUE:
            message = HdmiCecMessageBuilder.buildClearAnalogueTimer(mAddress, recorderAddress, recordSource);
            break;
        case TIMER_RECORDING_TYPE_EXTERNAL:
            message = HdmiCecMessageBuilder.buildClearExternalTimer(mAddress, recorderAddress, recordSource);
            break;
        default:
            Slog.w(TAG, "Invalid source type:" + recorderAddress);
            announceClearTimerRecordingResult(recorderAddress, CLEAR_TIMER_STATUS_FAIL_TO_CLEAR_SELECTED_SOURCE);
            return;
    }
    mService.sendCecCommand(message, new SendMessageCallback() {

        @Override
        public void onSendCompleted(int error) {
            if (error != Constants.SEND_RESULT_SUCCESS) {
                announceClearTimerRecordingResult(recorderAddress, CLEAR_TIMER_STATUS_FAIL_TO_CLEAR_SELECTED_SOURCE);
            }
        }
    });
}
Also used : SendMessageCallback(com.android.server.hdmi.HdmiControlService.SendMessageCallback)

Example 23 with SendMessageCallback

use of com.android.server.hdmi.HdmiControlService.SendMessageCallback in project android_frameworks_base by DirtyUnicorns.

the class RoutingControlAction method handleTimerEvent.

@Override
public void handleTimerEvent(int timeoutState) {
    if (mState != timeoutState || mState == STATE_NONE) {
        Slog.w("CEC", "Timer in a wrong state. Ignored.");
        return;
    }
    switch(timeoutState) {
        case STATE_WAIT_FOR_ROUTING_INFORMATION:
            HdmiDeviceInfo device = tv().getDeviceInfoByPath(mCurrentRoutingPath);
            if (device != null && mQueryDevicePowerStatus) {
                int deviceLogicalAddress = device.getLogicalAddress();
                queryDevicePowerStatus(deviceLogicalAddress, new SendMessageCallback() {

                    @Override
                    public void onSendCompleted(int error) {
                        handlDevicePowerStatusAckResult(error == HdmiControlManager.RESULT_SUCCESS);
                    }
                });
            } else {
                updateActiveInput();
                finishWithCallback(HdmiControlManager.RESULT_SUCCESS);
            }
            return;
        case STATE_WAIT_FOR_REPORT_POWER_STATUS:
            if (isPowerOnOrTransient(getTvPowerStatus())) {
                updateActiveInput();
                sendSetStreamPath();
            }
            finishWithCallback(HdmiControlManager.RESULT_SUCCESS);
            return;
    }
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) SendMessageCallback(com.android.server.hdmi.HdmiControlService.SendMessageCallback)

Example 24 with SendMessageCallback

use of com.android.server.hdmi.HdmiControlService.SendMessageCallback in project android_frameworks_base by AOSPA.

the class PowerStatusMonitorAction method queryPowerStatus.

private void queryPowerStatus() {
    List<HdmiDeviceInfo> deviceInfos = tv().getDeviceInfoList(false);
    resetPowerStatus(deviceInfos);
    for (HdmiDeviceInfo info : deviceInfos) {
        final int logicalAddress = info.getLogicalAddress();
        sendCommand(HdmiCecMessageBuilder.buildGiveDevicePowerStatus(getSourceAddress(), logicalAddress), new SendMessageCallback() {

            @Override
            public void onSendCompleted(int error) {
                // update power status into UNKNOWN.
                if (error != Constants.SEND_RESULT_SUCCESS) {
                    updatePowerStatus(logicalAddress, POWER_STATUS_UNKNOWN, true);
                }
            }
        });
    }
    mState = STATE_WAIT_FOR_REPORT_POWER_STATUS;
    // Add both timers, monitoring and timeout.
    addTimer(STATE_WAIT_FOR_NEXT_MONITORING, MONITIROING_INTERNAL_MS);
    addTimer(STATE_WAIT_FOR_REPORT_POWER_STATUS, REPORT_POWER_STATUS_TIMEOUT_MS);
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) SendMessageCallback(com.android.server.hdmi.HdmiControlService.SendMessageCallback)

Example 25 with SendMessageCallback

use of com.android.server.hdmi.HdmiControlService.SendMessageCallback in project android_frameworks_base by AOSPA.

the class RoutingControlAction method handleTimerEvent.

@Override
public void handleTimerEvent(int timeoutState) {
    if (mState != timeoutState || mState == STATE_NONE) {
        Slog.w("CEC", "Timer in a wrong state. Ignored.");
        return;
    }
    switch(timeoutState) {
        case STATE_WAIT_FOR_ROUTING_INFORMATION:
            HdmiDeviceInfo device = tv().getDeviceInfoByPath(mCurrentRoutingPath);
            if (device != null && mQueryDevicePowerStatus) {
                int deviceLogicalAddress = device.getLogicalAddress();
                queryDevicePowerStatus(deviceLogicalAddress, new SendMessageCallback() {

                    @Override
                    public void onSendCompleted(int error) {
                        handlDevicePowerStatusAckResult(error == HdmiControlManager.RESULT_SUCCESS);
                    }
                });
            } else {
                updateActiveInput();
                finishWithCallback(HdmiControlManager.RESULT_SUCCESS);
            }
            return;
        case STATE_WAIT_FOR_REPORT_POWER_STATUS:
            if (isPowerOnOrTransient(getTvPowerStatus())) {
                updateActiveInput();
                sendSetStreamPath();
            }
            finishWithCallback(HdmiControlManager.RESULT_SUCCESS);
            return;
    }
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) SendMessageCallback(com.android.server.hdmi.HdmiControlService.SendMessageCallback)

Aggregations

SendMessageCallback (com.android.server.hdmi.HdmiControlService.SendMessageCallback)30 HdmiDeviceInfo (android.hardware.hdmi.HdmiDeviceInfo)10