Java Question Unexpected event (missing RaiseSynchronousEvents): onemvlistener_onexchangeapdu

Situ LLC

Active Member
Licensed User
Hi. my application generates this error:
Unexpected event (missing RaiseSynchronousEvents): onemvlistener_onexchangeapdu.
Check the unfiltered logs for the full stack trace.



this is the java code :

B4X:
package com.z90.emv;

import com.zcs.sdk.emv.OnEmvListener;

import anywheresoftware.b4a.BA;

@BA.Events(values = { "OnExchangeApdu(Send() As Byte) As Byte()",
                      "OnSelApp(AppNameList() as String) As Int",
                      "OnConfirmCardNo(cardNo As String) As Int",
                      "OnInputPIN(pinType As Byte) As Int",
                      "OnCertVerify(certType As Int, certNo As String) As Int",
                      "OnlineProc() As Int" })
@BA.ShortName("OnEmvListener")
public class OnEmvListenerWrapper implements OnEmvListener {

    private BA ba;
    private String eventName;

    public void Initialize(final  BA ba, final String eventName) {
        BA.Log("Initialize OnEmvListener");
        this.ba = ba;
        this.eventName = eventName.toLowerCase(BA.cul);
    }

    @BA.RaisesSynchronousEvents
    @Override
    public byte[] onExchangeApdu(byte[] send) {
        BA.Log("IN EmvListenerWrapper onExchangeApdu");
        // byte[] result = (byte[]) ba.raiseEvent(OnEmvListenerWrapper.this,eventName+"_onexchangeapdu", new Object[]{send});
        byte[] result =  (byte[]) ba.raiseEvent2(OnEmvListenerWrapper.this,false,eventName+"_onexchangeapdu",false,send);
        if (result == null) {
            BA.Log("onExchangeApdu return null");
            return null;
        }
        return result;
    }

    @BA.RaisesSynchronousEvents
    @Override
    public int onSelApp(String[] appNameList) {
        BA.Log("IN EmvListenerWrapper onSelApp");
        return (int) ba.raiseEvent(OnEmvListenerWrapper.this, eventName+"_onselapp", new Object[]{appNameList});
    }

    @BA.RaisesSynchronousEvents
    @Override
    public int onConfirmCardNo(String cardNo) {
        BA.Log ("IN EmvListenerWrapper onConfirmCardNo");
        return  (int) ba.raiseEvent(OnEmvListenerWrapper.this, eventName+"_onconfirmcardno", cardNo);
    }

    @BA.RaisesSynchronousEvents
    @Override
    public int onInputPIN(byte pinType) {
        BA.Log("IN EmvListenerWrapper onInputPIN");
        return (int) ba.raiseEvent(OnEmvListenerWrapper.this, eventName + "_oninputpin", pinType);
    }

    @BA.RaisesSynchronousEvents
    @Override
    public int onCertVerify(int certType, String certNo) {
        BA.Log("IN EmvListenerWrapper onlCertVerify");
        return  (int) ba.raiseEvent(OnEmvListenerWrapper.this, eventName+"_oncertverify", certType, certNo);
    }

    @BA.RaisesSynchronousEvents
    @Override
    public int onlineProc() {
        BA.Log("IN EmvListenerWrapper onlineProc");
        return  (int) ba.raiseEvent(OnEmvListenerWrapper.this, eventName+"_onlineproc");
    }

}

This is the BA4 Code :

B4X:
Sub onemvlistener_OnExchangeApdu( send() As Byte ) As Byte()
   
    Log("onemvlistener_onExchangeApdu")
   
    If ( realCardType.GetValue == cardTypeEnum.IC_CARD ) Then
        Log("OnExchangeApdu = cardTypeEnum.IC_CARD")
        Dim cardSlot As CardSlotNoEnum
        cardSlot.SetCardSlotNoEnum(cardSlot.SDK_ICC_USERCARD)
        Return mICCard.icExchangeAPDU(cardSlot, send)
    Else if (realCardType.GetValue == cardTypeEnum.RF_CARD) Then
        Log("OnExchangeApdu = cardTypeEnum.RF_CARD")
        Return mRFCard.rfExchangeAPDU(send)
    End If
   
    Return Null
       
End Sub

I could not find the error
 
Last edited:
Top