package com.seewo.libmcuservice;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.RemoteException;
import android.util.Log;
import com.seewo.libmcuservice.aidl.IMcuService;
import com.seewo.libmcuservice.aidl.IRemoteService;
import com.seewo.libmcuservice.aidl.IServiceCallback;
import com.seewo.libmcuservice.constant.IRemoteConstants;

/* JADX INFO: loaded from: classes.dex */
public class RemoteBox extends AbstractMailbox {
    private static final String TAG = "RemoteBox";
    private AbsRemoteCallback mCallback;
    private Context mContext;
    private IRemoteService mService;
    private IServiceCallback mServiceCallback = new IServiceCallback.Stub() { // from class: com.seewo.libmcuservice.RemoteBox.1
        @Override // com.seewo.libmcuservice.aidl.IServiceCallback
        public void onCallback(int i, Bundle bundle) throws RemoteException {
            if (i == 8) {
                RemoteBox.this.mCallback.onTouchInfo(bundle.getString(IRemoteConstants.KEY_TOUCH_CHECKSUM), bundle.getString(IRemoteConstants.KEY_TOUCH_VERSION));
            }
            if (i == 9) {
                RemoteBox.this.mCallback.onTouchPoint(bundle.getString(IRemoteConstants.KEY_TOUCH_POINT));
                return;
            }
            if (i == 12) {
                RemoteBox.this.mCallback.onPCRequestSSIDPassword();
                return;
            }
            if (i == 30) {
                RemoteBox.this.mCallback.onGetRecorderMessage((IRemoteConstants.RecorderStatus) bundle.getSerializable(IRemoteConstants.KEY_SUPPORT_PC_RECORDER));
                return;
            }
            switch (i) {
                case 14:
                    RemoteBox.this.mCallback.onGetNFCResult(bundle.getInt("result"));
                    break;
                case 15:
                    RemoteBox.this.mCallback.onGetPcResult(bundle.getString("result"));
                    break;
                case 16:
                    RemoteBox.this.mCallback.onInfPublish(bundle.getInt(IRemoteConstants.KEY_INF_PUBLISH_MODE), bundle.getInt(IRemoteConstants.KEY_INF_PUBLISH_PARAMS), bundle.getString(IRemoteConstants.KEY_INF_PUBLISH_CONTENT));
                    break;
                case 17:
                    RemoteBox.this.mCallback.onGetUsbLockStatus(bundle.getInt(IRemoteConstants.KEY_LOCK_STATUS));
                    break;
                case 18:
                    RemoteBox.this.mCallback.onGetPPTPerformingState(bundle.getInt(IRemoteConstants.KEY_PPT_PERFORM_STATE));
                    break;
                case 19:
                    RemoteBox.this.mCallback.onGetSupportPcInfo(bundle);
                    break;
                case 20:
                    RemoteBox.this.mCallback.onSendWakeUdp();
                    break;
                case 21:
                    RemoteBox.this.mCallback.onReceiveWakeUdp();
                    break;
                case 22:
                    RemoteBox.this.mCallback.onMessagePublish(bundle.getInt(IRemoteConstants.KEY_BROADCAST_REPEAT_COUNT), bundle.getInt(IRemoteConstants.KEY_BROADCAST_SCROLL_MODE), bundle.getString(IRemoteConstants.KEY_BROADCAST_CONTENT));
                    break;
                case 23:
                    RemoteBox.this.mCallback.onMessagePublishFinish();
                    break;
                default:
                    switch (i) {
                        case 32:
                            RemoteBox.this.mCallback.onGetMachineLockQRCodeResult(bundle.getInt(IRemoteConstants.KEY_QR_CODE_RESULT), bundle.getString(IRemoteConstants.KEY_QR_CODE_CONTENT));
                            break;
                        case 33:
                            RemoteBox.this.mCallback.onGetMachineLockQRCodeData(bundle.getString(IRemoteConstants.KEY_QR_CODE_DATA, ""));
                            break;
                        case 34:
                            RemoteBox.this.mCallback.onUSBUnlockCheckResult(bundle.getInt(IRemoteConstants.KEY_USB_CHECK_RESULT_TYPE), bundle.getString(IRemoteConstants.KEY_USB_CHECK_RESULT_USER));
                            break;
                        case 35:
                            RemoteBox.this.mCallback.onMachinePasswordCheckResult(bundle.getInt(IRemoteConstants.KEY_LOCK_WORD_RESULT));
                            break;
                        case 36:
                            RemoteBox.this.mCallback.onUSBPasswordCheckResult(bundle.getInt(IRemoteConstants.KEY_USB_WORD_RESULT));
                            break;
                    }
                    break;
            }
        }
    };

    public static abstract class AbsRemoteCallback {
        protected void onEasiNoteExit() {
        }

        protected void onEasiNoteStart() {
        }

        protected void onGetMachineLockQRCodeData(String str) {
        }

        protected void onGetMachineLockQRCodeResult(int i, String str) {
        }

        protected void onGetNFCResult(int i) {
        }

        protected void onGetPPTPerformingState(int i) {
        }

        protected void onGetPcResult(String str) {
        }

        protected void onGetRecorderMessage(IRemoteConstants.RecorderStatus recorderStatus) {
        }

        protected void onGetSupportPcInfo(Bundle bundle) {
        }

        protected void onGetUsbLockStatus(int i) {
        }

        protected void onInfPublish(int i, int i2, String str) {
        }

        protected void onMachinePasswordCheckResult(int i) {
        }

        protected void onMessagePublish(int i, int i2, String str) {
        }

        protected void onMessagePublishFinish() {
        }

        protected void onPCRequestSSIDPassword() {
        }

        protected void onReceiveWakeUdp() {
        }

        protected void onSendWakeUdp() {
        }

        protected void onTouchInfo(String str, String str2) {
        }

        protected void onTouchPoint(String str) {
        }

        protected void onUSBPasswordCheckResult(int i) {
        }

        protected void onUSBUnlockCheckResult(int i, String str) {
        }
    }

    RemoteBox(Context context, AbsRemoteCallback absRemoteCallback) {
        this.mContext = context;
        this.mCallback = absRemoteCallback;
    }

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

    @Override // com.seewo.libmcuservice.AbstractMailbox
    protected void initService(IMcuService iMcuService) {
        try {
            IRemoteService remoteService = iMcuService.getRemoteService();
            this.mService = remoteService;
            if (this.mCallback != null) {
                remoteService.registerCallback(this.mServiceCallback);
            }
        } catch (RemoteException e2) {
            Log.e(TAG, LibMcuApplication.REMOTE_EXCEPTION, e2);
        }
    }

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

    public void postAutoTestCommand(String str) {
        if (this.mService != null) {
            Bundle bundle = new Bundle();
            bundle.putString(IRemoteConstants.KEY_COMMAND, str);
            try {
                this.mService.sendMessage(McuMailboxes.getID(), 15, bundle);
            } catch (RemoteException e2) {
                Log.e(TAG, LibMcuApplication.REMOTE_EXCEPTION, e2);
            }
        }
    }

    public void postMessagePublishStatus(int i) {
        if (this.mService != null) {
            Bundle bundle = new Bundle();
            bundle.putInt(IRemoteConstants.KEY_BROADCAST_STATUS, i);
            try {
                this.mService.sendMessage(McuMailboxes.getID(), 22, bundle);
            } catch (RemoteException e2) {
                Log.e(TAG, LibMcuApplication.REMOTE_EXCEPTION, e2);
            }
        }
    }

    public void postNFCUid(byte[] bArr) {
        if (this.mService != null) {
            Bundle bundle = new Bundle();
            bundle.putByteArray(IRemoteConstants.KEY_NFC_UID, bArr);
            try {
                this.mService.sendMessage(McuMailboxes.getID(), 13, bundle);
            } catch (RemoteException e2) {
                Log.e(TAG, LibMcuApplication.REMOTE_EXCEPTION, e2);
            }
        }
    }

    public void postNFCUsernameAndPassword(byte[] bArr) {
        if (this.mService != null) {
            Bundle bundle = new Bundle();
            bundle.putByteArray(IRemoteConstants.KEY_NFC_USERNAME_AND_PASSWD, bArr);
            try {
                this.mService.sendMessage(McuMailboxes.getID(), 14, bundle);
            } catch (RemoteException e2) {
                Log.e(TAG, LibMcuApplication.REMOTE_EXCEPTION, e2);
            }
        }
    }

    public void postNotifyHomeKeyEvent() {
        IRemoteService iRemoteService = this.mService;
        if (iRemoteService == null) {
            return;
        }
        try {
            iRemoteService.sendMessage(McuMailboxes.getID(), 31, new Bundle());
        } catch (RemoteException e2) {
            Log.e(TAG, LibMcuApplication.REMOTE_EXCEPTION, e2);
        }
    }

    public void postOnWakeUdpSent(int i) {
        if (this.mService != null) {
            Bundle bundle = new Bundle();
            bundle.putInt(IRemoteConstants.KEY_SEND_WAKE_UDP_RESULT, i);
            try {
                this.mService.sendMessage(McuMailboxes.getID(), 20, bundle);
            } catch (RemoteException e2) {
                Log.e(TAG, LibMcuApplication.REMOTE_EXCEPTION, e2);
            }
        }
    }

    public void postReceiveWakeUdp(int i, String str) {
        if (this.mService != null) {
            Bundle bundle = new Bundle();
            bundle.putInt(IRemoteConstants.KEY_WAKE_UDP_TYPE, i);
            bundle.putString(IRemoteConstants.KEY_WAKE_UDP_MAC, str);
            try {
                this.mService.sendMessage(McuMailboxes.getID(), 21, bundle);
            } catch (RemoteException e2) {
                Log.e(TAG, LibMcuApplication.REMOTE_EXCEPTION, e2);
            }
        }
    }

    public void postRequestMachineQRCode() {
        IRemoteService iRemoteService = this.mService;
        if (iRemoteService != null) {
            try {
                iRemoteService.sendMessage(McuMailboxes.getID(), 32, new Bundle());
            } catch (RemoteException e2) {
                Log.e(TAG, LibMcuApplication.REMOTE_EXCEPTION, e2);
            }
        }
    }

    public void postSendMachineLockPassword(String str) {
        if (this.mService != null) {
            try {
                Bundle bundle = new Bundle();
                bundle.putString(IRemoteConstants.KEY_MACHINE_LOCK_WORD, str);
                this.mService.sendMessage(McuMailboxes.getID(), 35, bundle);
            } catch (RemoteException e2) {
                Log.e(TAG, LibMcuApplication.REMOTE_EXCEPTION, e2);
            }
        }
    }

    public void postSendSSIDPassword(String str, String str2) {
        if (this.mService != null) {
            Bundle bundle = new Bundle();
            bundle.putString(IRemoteConstants.KEY_SSID, str);
            bundle.putString(IRemoteConstants.KEY_SECURITY, str2);
            try {
                this.mService.sendMessage(McuMailboxes.getID(), 9, bundle);
            } catch (RemoteException e2) {
                Log.e(TAG, LibMcuApplication.REMOTE_EXCEPTION, e2);
            }
        }
    }

    public void postSendUSBDeviceID(String str) {
        if (this.mService != null) {
            try {
                Bundle bundle = new Bundle();
                bundle.putString(IRemoteConstants.KEY_USB_DEVICE_NAME, str);
                this.mService.sendMessage(McuMailboxes.getID(), 38, bundle);
            } catch (RemoteException e2) {
                Log.e(TAG, LibMcuApplication.REMOTE_EXCEPTION, e2);
            }
        }
    }

    public void postSendUSBPassword(String str) {
        if (this.mService != null) {
            try {
                Bundle bundle = new Bundle();
                bundle.putString(IRemoteConstants.KEY_USB_WORD, str);
                this.mService.sendMessage(McuMailboxes.getID(), 36, bundle);
            } catch (RemoteException e2) {
                Log.e(TAG, LibMcuApplication.REMOTE_EXCEPTION, e2);
            }
        }
    }

    public void postSendUSBUnlockFile(String str) {
        if (this.mService != null) {
            try {
                Bundle bundle = new Bundle();
                bundle.putString(IRemoteConstants.KEY_USB_UNLOCK_FILE_PATH, str);
                this.mService.sendMessage(McuMailboxes.getID(), 37, bundle);
            } catch (RemoteException e2) {
                Log.e(TAG, LibMcuApplication.REMOTE_EXCEPTION, e2);
            }
        }
    }

    public void postSmartPenButtonCommand(byte b2) {
        if (this.mService != null) {
            Bundle bundle = new Bundle();
            bundle.putByte(IRemoteConstants.KEY_SMART_PEN_SUB_COMMAND, b2);
            try {
                this.mService.sendMessage(McuMailboxes.getID(), 16, bundle);
            } catch (RemoteException e2) {
                Log.e(TAG, LibMcuApplication.REMOTE_EXCEPTION, e2);
            }
        }
    }

    public void postSmartPenPressure(int i) {
        if (this.mService != null) {
            Bundle bundle = new Bundle();
            bundle.putInt(IRemoteConstants.KEY_PREESURE, i);
            try {
                this.mService.sendMessage(McuMailboxes.getID(), 12, bundle);
            } catch (RemoteException e2) {
                Log.e(TAG, LibMcuApplication.REMOTE_EXCEPTION, e2);
            }
        }
    }

    public void postStartRecord() {
        IRemoteService iRemoteService = this.mService;
        if (iRemoteService == null) {
            return;
        }
        try {
            iRemoteService.postStartRecord();
        } catch (RemoteException e2) {
            Log.e(TAG, LibMcuApplication.REMOTE_EXCEPTION, e2);
        }
    }

    public void postStopRecord() {
        IRemoteService iRemoteService = this.mService;
        if (iRemoteService == null) {
            return;
        }
        try {
            iRemoteService.postStopRecord();
        } catch (RemoteException e2) {
            Log.e(TAG, LibMcuApplication.REMOTE_EXCEPTION, e2);
        }
    }

    public void postSupportPcStates() {
        if (this.mService != null) {
            try {
                this.mService.sendMessage(McuMailboxes.getID(), 19, new Bundle());
            } catch (RemoteException e2) {
                Log.e(TAG, LibMcuApplication.REMOTE_EXCEPTION, e2);
            }
        }
    }

    public void postTouchChecksum() {
        IRemoteService iRemoteService = this.mService;
        if (iRemoteService != null) {
            try {
                iRemoteService.sendMessage(McuMailboxes.getID(), 7, new Bundle());
            } catch (RemoteException e2) {
                Log.e(TAG, LibMcuApplication.REMOTE_EXCEPTION, e2);
            } catch (NullPointerException e3) {
                Log.e(TAG, "NullPointerException", e3);
            }
        }
    }

    public void postUsbLockStatus(int i) {
        if (this.mService != null) {
            Bundle bundle = new Bundle();
            bundle.putInt(IRemoteConstants.KEY_LOCK_STATUS, i);
            try {
                this.mService.sendMessage(McuMailboxes.getID(), 17, bundle);
            } catch (RemoteException e2) {
                Log.e(TAG, LibMcuApplication.REMOTE_EXCEPTION, e2);
            }
        }
    }

    public void postZoomPressed() {
        this.mContext.sendBroadcast(new Intent(IRemoteConstants.ACTION_IN_ZOOM_PRESSED));
    }

    @Override // com.seewo.libmcuservice.AbstractMailbox
    protected void release() {
        IRemoteService iRemoteService;
        if (this.mCallback == null || (iRemoteService = this.mService) == null) {
            return;
        }
        try {
            iRemoteService.unregisterCallback(this.mServiceCallback);
        } catch (RemoteException e2) {
            Log.e(TAG, LibMcuApplication.REMOTE_EXCEPTION, e2);
        }
    }

    public void postNFCUsernameAndPassword(int i, byte[] bArr) {
        if (this.mService != null) {
            Bundle bundle = new Bundle();
            bundle.putByteArray(IRemoteConstants.KEY_NFC_USERNAME_AND_PASSWD, bArr);
            bundle.putInt(IRemoteConstants.KEY_NFC_DATA_INDEX, i);
            try {
                this.mService.sendMessage(McuMailboxes.getID(), 14, bundle);
            } catch (RemoteException e2) {
                Log.e(TAG, LibMcuApplication.REMOTE_EXCEPTION, e2);
            }
        }
    }
}
