1

struggling with BUS_REPLY_IS_ERROR_MESSAGE (ErrorReplyBusException)

asked 2015-06-04 07:09:03 -0800

mayo gravatar image

updated 2015-07-24 08:50:11 -0800

Hi,

im creating a Java client to communicate with a wifi speaker that is capable of alljoyn (supported by org.allseen.media.control.mediaPlayer interface, see this link ).

So far so good, I implemented BusMethods like Play, Stop, Resume and they work fine. Now I tried to implement the BusMethod GetPlayerInfo(), that doesnt have in parameter, but a complex struct out parameter with signature "(sasi(siv))". Therefore i created my struct class :

public class StructInfo {

  @Position(0)
  @Signature("s")
  public String name;
  @Position(1)
  @Signature("as")
  public String[] info;
  @Position(2)
  @Signature("i")
  public int maxVolume;
  @Position(3)
  @Signature("r")
  public StructSIV structsiv;

  public StructInfo(){}

  public static class StructSIV{
    @Position(0)
    public String string;
    @Position(1)
    public int number;
    @Position(2)
    public Variant variant;
    public StructSIV(){}
  }
}

my Interface:

@BusInterface (name = "net.allplay.MediaPlayer") 
// net.allplay.MediaPlayer == org.allseen.media.control.mediaPlayer
public interface AllplayInterface {
@BusMethod
public void Play(int i, long j, boolean b) throws BusException;
@BusMethod (replySignature = "r")
public StructInfo GetPlayerInfo() throws BusException;
@BusMethod
public void UpdatePlaylist(StructUpdate[] su, int i, String s1, String s2) throws BusException;
@BusSignal
public void PlaylistChanged() throws BusException;
@BusMethod
public void Pause() throws BusException;
@BusMethod
public void Resume() throws BusException;

}

Calling the Method then results in a "BUS_REPLY_IS_ERROR_MESSAGE" which is defined as :

public static final Status BUS_REPLY_IS_ERROR_MESSAGE
//0x9032 Response from a method call was an ERROR message.

Analyzing the traffic between my machine and the wifi speaker via wireshark results in this . Looking into the answer, my wifi speaker response this . So my speaker doesn't actually respond with an error message but with the content I'm asking for - if there wasn't that ugly Exception ...

Any ideas what I'm doing wrong ? Thank You!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-06-07 02:38:34 -0800

julianbros gravatar image

updated 2015-06-12 04:47:23 -0800

In my opinion the interface i correct, even the general structure of your classes is valid. Any invalid definition would result into an error called "BAD_ANNOTATION". I had the same problem and I solved it by initializing the class/object variables with a value. Try to initialize the variables of both classes with a value, either by lazy loading in the constructor or when declaring the variables. I.e.:

public class StructInfo {
  @Position(0)
  @Signature("s")
  public String name = "not initialized";
  ...
}

vs:

public class StructInfo {
  @Position(0)
  @Signature("s")
  public String name;

  @Position(1)
  @Signature("as")
  public String[] info;

  @Position(2)
  @Signature("i")
  public int maxVolume;


  @Position(3)
  @Signature("r")
  public StructSIV structsiv = new StructSIV();



public StructInfo(){

  this.name = "name";
  this.info = new String[1];
  info[0] = new String();
  this.maxVolume = 0; 
}
}


public class StructSIV{
@Position(0)
@Signature("s")
public String string;
@Position(1)
@Signature("i")
public int number;
@Position(2)
public Variant variant;

public StructSIV(){
    this.string = "r";
    this.number = 8;
    this.variant = new Variant(new String(""),"s");
}

}

I edited this answer to provide the source code I've tested.

edit flag offensive delete publish link more

Comments

Unfortunately that didnt help :/ Its kinda frustrating -.-

mayo ( 2015-06-11 09:43:40 -0800 )edit

Ok, for me it is working. Here is what I recommend you: 1. Extract the inner static class "StructSIV" into an extra class, add signatures 2. Like I said before, take care of initializing ALL variables. Consider the info[] array and its elements too. Send me an email: jr@rossbach-systems.eu

julianbros ( 2015-06-11 23:03:45 -0800 )edit

I just found the little sneaky reason for my Exception: alljoyn doesn't accept the (replySignature = "r") though r stands for Struct reply. Changing "r" to "sasi(siv)" solved it. BUS_REPLY_IS_ERROR_MESSAGE is pretty misleading in this case ... Nevertheless thank you. Your advices are good anyway.

mayo ( 2015-06-13 02:24:18 -0800 )edit
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

Asked: 2015-06-04 07:09:03 -0800

Seen: 564 times

Last updated: Jul 24 '15