How to add new Status codes ?

asked 2014-04-02 01:51:03 -0700

eguiho gravatar image

I'm currently developing a new "service" based on alljoyn_core and I would like to define my own status codes. Here are my actions for that :

  • I have my own Status.xml file containing my new status codes
  • I added an include of my xml file in the alljoyn_core/src/Status.xml one (as common)
  • I modified the sconscript of alljoyn_core to add the dependency to my xml

It works fine

But it does not suit me.

The way I do requires me to change the sconscript and status.xml of alljoyn_core, so it becomes impossible to build the core sources without my service.

This is not satisfactory.

What is the right way to add new status for my service?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2014-04-02 10:53:57 -0700

Nikhil Dabhade gravatar image

updated 2014-04-02 10:54:16 -0700

Hi eguiho,

If you are trying to add status codes to the core code then Status.xml would be the correct place to add new status code but in your case it is a service and I think the core Status.xml may not be the most appropriate place since you are now transferring service related codes in the core.

You could approach this two ways 1. Add a build variable that will include your status.xml only if you tell scons to build your service so your command could look like scons SERVICES="your service,other services" 2. Not mix the two since it is a service and its status code should be completely independent of the core.

This also depends on how you view your service. If you view it to be something that you could contribute back of make a part of core over time then approach one might be the way to go but if you are viewing it as a pure service with no intentions mentioned above then approach two would be the way to go

Let me know if you have more questions.

Regards, Nikhil

edit flag offensive delete publish link more

answered 2014-04-03 14:29:23 -0700

georgen gravatar image

The best way to expanding the Status codes has been discussed. Since QStatus codes are stored in an enumerated list this becomes a problem since enums are not expandable.

You could add a new QStatus code similar to what was done in the About service.

Here the Status was added using a #define macro.

#define ER_LANGUAGE_NOT_SUPPORTED       ((QStatus)0xb001)


  • it really simple to implement and you can get it working really fast


  • it does not actually tie back into the list of QStatus values
  • there is no way to make sure a status added this way will not conflict with already existing or newly added statuses
  • if the service becomes part of the core services the status will need to be moved into the a Status.xml anyway
  • the function QCC_StatusText does not know anything about a status done this way so it will return the string <unknown>

Even with the disadvantages I would recommend using something similar for the time being.

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

Question Tools

1 follower


Asked: 2014-04-02 01:51:03 -0700

Seen: 90 times

Last updated: Apr 03 '14