# In ConfigTransport.java , what is the use of signature?

In the ConfigTransport.java, I noticed functions like SetPasscode or getVersion for example uses a signature="XX", what is the use of this? Where is this checked against? Do we need to specify a signature for any new method we write for the device?

edit retag close merge delete

Sort by » oldest newest most voted

the signature="xx" (it should be lower case xx not capital.) In the annotation tells AllJoyn the input type for the method, signal or property. Since I don't know the location of the ConfigTransport.java I don't know what the code there looks like. it most likely looks something similar to this.

@BusMethod(signature="xx")
public void someMethod(long a, long b);


The signature comes from AllJoyns type signatures. For a full list of the signatures see the documentation. Most of the time in Java you don't need to specify the signature unless it critical for communication with a different language. Even then its not typically needed. In the example above AllJoyn would have used interspection to see that the input parameters were both type long with is the same as int64 or 'x'. The code should work just as well with out explicitly listing the signature. This is not always true. Example you are providing an unsigned integer. Java does not provide unsigned data types. While unsigned data types are common in other programming languages.

@BusMethod(signature="uu")
public void someMethod(int a, long b);


In the above example both a and b would be sent across the wire as a unsigned 32-bit integer uint32. The difference is that a uint32 ranges from 0-232 while the range of java int is -231 to 231-1. Since only the positive numbers are used that gives a range of 0 to 231-1. If you need to full range of uint32 you must have a value in java that can hold the entire 0-232 value a long can be used instead of an int.

The only time you will likely need to manually specify a signature is if you are talking to a program written in another language. Where it will be critical that both programming languages agree on what data is sent across the wire.

more