package com.seewo.libmcuservice;

import android.os.Bundle;
import android.os.RemoteException;
import android.util.Log;
import com.seewo.libmcuservice.aidl.IKeyBoardControlService;
import com.seewo.libmcuservice.aidl.IMcuService;
import com.seewo.libmcuservice.constant.IKeyBoardControlConstants;

/* JADX INFO: loaded from: classes.dex */
public class KeyBoardControlBox extends AbstractMailbox {
    private static final String TAG = "com.seewo.libmcuservice.KeyBoardControlBox";
    private IKeyBoardControlService mService;

    @Override // com.seewo.libmcuservice.AbstractMailbox
    protected void clearService() {
        this.mService = null;
    }

    @Override // com.seewo.libmcuservice.AbstractMailbox
    protected void initService(IMcuService iMcuService) {
        try {
            this.mService = iMcuService.getKeyBoardControlService();
        } catch (RemoteException e2) {
            Log.e(TAG, LibMcuApplication.REMOTE_EXCEPTION, e2);
        }
    }

    @Override // com.seewo.libmcuservice.AbstractMailbox
    protected void onWorkDone() {
    }

    public void postKeyClick(byte b2, byte b3) {
        postKeyLongClick(b2, b3, 0L);
    }

    public void postKeyLongClick(byte b2, byte b3, long j) {
        if (this.mService != null) {
            Bundle bundle = new Bundle();
            bundle.putByte(IKeyBoardControlConstants.KEY_CONTROL_KEY, b2);
            bundle.putByte(IKeyBoardControlConstants.KEY_FUNCTION_KEY, b3);
            bundle.putLong(IKeyBoardControlConstants.KEY_INTERVALS_TIME, j);
            try {
                this.mService.sendMessage(McuMailboxes.getID(), 1, bundle);
            } catch (RemoteException e2) {
                Log.e(TAG, LibMcuApplication.REMOTE_EXCEPTION, e2);
            }
        }
    }

    @Override // com.seewo.libmcuservice.AbstractMailbox
    protected void release() {
    }

    public void postKeyClick(byte b2, byte b3, int i) {
        if (this.mService != null) {
            Bundle bundle = new Bundle();
            bundle.putByte(IKeyBoardControlConstants.KEY_CONTROL_KEY, b2);
            bundle.putByte(IKeyBoardControlConstants.KEY_FUNCTION_KEY, b3);
            try {
                this.mService.sendMessage(McuMailboxes.getID(), i, bundle);
            } catch (RemoteException e2) {
                Log.e(TAG, LibMcuApplication.REMOTE_EXCEPTION, e2);
            }
        }
    }
}
