use of com.android.server.hdmi.HdmiControlService.SendMessageCallback in project platform_frameworks_base by android.
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;
}
}
use of com.android.server.hdmi.HdmiControlService.SendMessageCallback in project platform_frameworks_base by android.
the class OneTouchRecordAction method sendRecordOn.
private void sendRecordOn() {
sendCommand(HdmiCecMessageBuilder.buildRecordOn(getSourceAddress(), mRecorderAddress, mRecordSource), new SendMessageCallback() {
@Override
public void onSendCompleted(int error) {
// if failed to send <Record On>, display error message and finish action.
if (error != Constants.SEND_RESULT_SUCCESS) {
tv().announceOneTouchRecordResult(mRecorderAddress, ONE_TOUCH_RECORD_CHECK_RECORDER_CONNECTION);
finish();
return;
}
}
});
mState = STATE_WAITING_FOR_RECORD_STATUS;
addTimer(mState, RECORD_STATUS_TIMEOUT_MS);
}
use of com.android.server.hdmi.HdmiControlService.SendMessageCallback in project platform_frameworks_base by android.
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);
}
use of com.android.server.hdmi.HdmiControlService.SendMessageCallback in project platform_frameworks_base by android.
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);
}
}
});
}
use of com.android.server.hdmi.HdmiControlService.SendMessageCallback in project android_frameworks_base by DirtyUnicorns.
the class DeviceSelectAction method queryDevicePowerStatus.
private void queryDevicePowerStatus() {
sendCommand(mGivePowerStatus, new SendMessageCallback() {
@Override
public void onSendCompleted(int error) {
if (error != Constants.SEND_RESULT_SUCCESS) {
invokeCallback(HdmiControlManager.RESULT_COMMUNICATION_FAILED);
finish();
return;
}
}
});
mState = STATE_WAIT_FOR_REPORT_POWER_STATUS;
addTimer(mState, HdmiConfig.TIMEOUT_MS);
}
Aggregations