Developing WebGUI

Hi

I created a WebGui for the Adafruit16CServoDriver. Since I'm not good at GUI development, I used copy/paste programming, using the ServoGUI as a template. 

Most of it works ok, but I found a problem that I don't know how to solve.

The problem is that the dropdown list with available services gets populated with the same values in both the ServoGUI and the Adafruit16CServoDriverGUI. The values are different depending in what order I start the services.

First I  start the Servo service, and the list gets populated with all running services that implements the ServoController interface. Good.

Next I start the Adafruit16CServoDrive, and the list gets poplated with all running services that implements the I2CControl interface. Good.

However, both the ServoGUI and the Adafruit16CServoDriver listens to the getServiceNamesFromInterface method from runtime, so the list in ServoGUI gets repopulated with the values that Adafruit16CServoDriverGUI requested. Doh.

Any suggestions on how to solve this problem ? 

/Mats

GroG's picture

Hi Mats, you can make your

Hi Mats,

you can make your service "utilize" the Runtime.getServicenamesFromInterface and populate a list in your Service.

This you should be able to get in the WebGui.

Examine Servo.refreshControllers for reference

 

Mats's picture

Thanks

Hi Grog.

Thanks for the excellent suggestions.

I'm using the same principle for both the swing and webgui. 

/Mats