0

Bus.ErStatus exception when sending complex data types

asked 2015-02-13 09:01:29 -0700

JavierT gravatar image

updated 2015-02-13 09:02:40 -0700

Hi,

I'm trying to send complex data between a simple client and a service. I managed to make it work with Strings, but when I try with a structure defined by me, I get the following error:

02-13 18:44:05.034  31575-31621/app.training.javi.app E/appClient﹕ appInterface.READY(): org.alljoyn.bus.ErrorReplyBusException: org.alljoyn.Bus.ErStatus
    org.alljoyn.bus.ErrorReplyBusException: org.alljoyn.Bus.ErStatus
            at org.alljoyn.bus.ProxyBusObject.methodCall(Native Method)
            at org.alljoyn.bus.ProxyBusObject.access$300(ProxyBusObject.java:34)
            at org.alljoyn.bus.ProxyBusObject$Handler.invoke(ProxyBusObject.java:240)
            at $Proxy1.getPlayers(Native Method)
            at app.training.javi.app.JoinActivity$ClientBusHandler.handleMessage(JoinActivity.java:330)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.os.HandlerThread.run(HandlerThread.java:60)

I think my problem can be with the signature because I am not sure that I have been doing correctly. This is the structure I'm sending:

public class Player {

public Player() { }

@Position(0)
public String name;

@Position(1)
public String color;

@Position(2)
public int score;

@Position(3)
public boolean ready;

}

And my function returns an array of Players.

@BusMethod(signature="s", replySignature = "b")
boolean newPlayerConnected(String inStr) throws BusException;

@BusMethod(replySignature = "ar")
Player[] getPlayers() throws BusException;

The other method is working, and I'm checking the implementation of the interface and I just return an array that in that moment has one value.

@Override
    public Player[] getPlayers() throws BusException {
        if(mCurrentPlayers == null)
            mCurrentPlayers = new Player[MAX_PLAYERS];
        return mCurrentPlayers;

    }

In my client side,

try {
    if (mDrawingInterface != null) {
       Player[] aux = mDrawingInterface.getPlayers();    //<-- here I get the exception

        mPlayersConnected = new ArrayList<Player>(Arrays.asList(aux));
        mHandler.sendEmptyMessage(MESSAGE_SET_PLAYERS);
    }
} catch (BusException ex) {
     logException("DrawingInterface.READY()", ex);

}

Is my replySignature correct or should be something like a(ssib) (I'm also getting an error with this one).

I read this, but I'm still quite lost. http://dbus.freedesktop.org/doc/dbus-specification.html

Thank you in advance

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2015-02-16 09:50:19 -0700

JavierT gravatar image

I solved it. I was creating the array for 6 players but at the time I was filling only one. And the bus requires that at least they must be filled with some data.

I hope it works for others too.

edit flag offensive delete publish link more
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

Asked: 2015-02-13 09:01:29 -0700

Seen: 251 times

Last updated: Feb 16 '15