package com.seewo.libmcuservice;

import a.b.c.a.a;
import android.content.Context;
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 i2, Bundle bundle) {
            if (i2 == 8) {
                RemoteBox.this.mCallback.onTouchInfo(bundle.getString(IRemoteConstants.KEY_TOUCH_CHECKSUM), bundle.getString(IRemoteConstants.KEY_TOUCH_VERSION));
            }
            if (i2 == 9) {
                RemoteBox.this.mCallback.onTouchPoint(bundle.getString(IRemoteConstants.KEY_TOUCH_POINT));
                return;
            }
            if (i2 == 12) {
                RemoteBox.this.mCallback.onPCRequestSSIDPassword();
                return;
            }
            if (i2 == 30) {
                RemoteBox.this.mCallback.onGetRecorderMessage((IRemoteConstants.RecorderStatus) bundle.getSerializable(IRemoteConstants.KEY_SUPPORT_PC_RECORDER));
                return;
            }
            switch (i2) {
                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("mode"), bundle.getInt(IRemoteConstants.KEY_INF_PUBLISH_PARAMS), bundle.getString(IRemoteConstants.KEY_INF_PUBLISH_CONTENT));
                    break;
                case 17:
                    RemoteBox.this.mCallback.onGetUsbLockStatus(bundle.getInt("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 (i2) {
                        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 {
        public void onEasiNoteExit() {
        }

        public void onEasiNoteStart() {
        }

        public void onGetMachineLockQRCodeData(String str) {
        }

        public void onGetMachineLockQRCodeResult(int i2, String str) {
        }

        public void onGetNFCResult(int i2) {
        }

        public void onGetPPTPerformingState(int i2) {
        }

        public void onGetPcResult(String str) {
        }

        public void onGetRecorderMessage(IRemoteConstants.RecorderStatus recorderStatus) {
        }

        public void onGetSupportPcInfo(Bundle bundle) {
        }

        public void onGetUsbLockStatus(int i2) {
        }

        public void onInfPublish(int i2, int i3, String str) {
        }

        public void onMachinePasswordCheckResult(int i2) {
        }

        public void onMessagePublish(int i2, int i3, String str) {
        }

        public void onMessagePublishFinish() {
        }

        public void onPCRequestSSIDPassword() {
        }

        public void onReceiveWakeUdp() {
        }

        public void onSendWakeUdp() {
        }

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

        public void onTouchPoint(String str) {
        }

        public void onUSBPasswordCheckResult(int i2) {
        }

        public void onUSBUnlockCheckResult(int i2, String str) {
        }
    }

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

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

    @Override // com.seewo.libmcuservice.AbstractMailbox
    public 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
    public void onWorkDone() {
    }

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

    public void postMessagePublishStatus(int i2) {
        if (this.mService != null) {
            Bundle bundle = new Bundle();
            bundle.putInt(IRemoteConstants.KEY_BROADCAST_STATUS, i2);
            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(int i2, 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, i2);
            try {
                this.mService.sendMessage(McuMailboxes.getID(), 14, 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 i2) {
        if (this.mService != null) {
            Bundle bundle = new Bundle();
            bundle.putInt(IRemoteConstants.KEY_SEND_WAKE_UDP_RESULT, i2);
            try {
                this.mService.sendMessage(McuMailboxes.getID(), 20, bundle);
            } catch (RemoteException e2) {
                Log.e(TAG, LibMcuApplication.REMOTE_EXCEPTION, e2);
            }
        }
    }

    public void postReceiveWakeUdp(int i2, String str) {
        if (this.mService != null) {
            Bundle bundle = new Bundle();
            bundle.putInt(IRemoteConstants.KEY_WAKE_UDP_TYPE, i2);
            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 i2) {
        if (this.mService != null) {
            Bundle bundle = new Bundle();
            bundle.putInt(IRemoteConstants.KEY_PREESURE, i2);
            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() {
        String str;
        IRemoteService iRemoteService = this.mService;
        if (iRemoteService != null) {
            try {
                iRemoteService.sendMessage(McuMailboxes.getID(), 7, new Bundle());
            } catch (RemoteException e2) {
                e = e2;
                str = LibMcuApplication.REMOTE_EXCEPTION;
                Log.e(TAG, str, e);
            } catch (NullPointerException e3) {
                e = e3;
                str = "NullPointerException";
                Log.e(TAG, str, e);
            }
        }
    }

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

    public void postZoomPressed() {
        a.i0(IRemoteConstants.ACTION_IN_ZOOM_PRESSED, this.mContext);
    }

    @Override // com.seewo.libmcuservice.AbstractMailbox
    public 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);
        }
    }
}
