Closed JorisM closed 10 years ago
I would pass the method as a parameter in the JSON POST data and switch them in the api function.
There is something similar in the socket-part of the Arduino-Plugin:
app.get('sockets').on('connection', function(socket) {
// Arduino toggle
socket.on('arduino-rcswitch', function(data) {
that.rcswitch(data);
});
// Arduino toggle
socket.on('arduino-irremote', function(data) {
that.irremote(data);
});
// Arduino toggle
socket.on('arduino-led', function(data) {
that.led(data);
});
});
The labels i currently use are:
Thanks!
I want to extend the android app to support the rc-switch.
Currently, the route for api requests is set as follows:
157 app.all('/api/:plugin/:method?', Routes.isAuthorized, Routes.api, Routes.notFound);
This works for example for the GPIO plugin, because the route would be
api/gpio/get
or similar. Now for Arduino Plugins, I also need to pass the which of the three methods (arduino-rcswitch, arduino-irremote, arduino-led).How would you go about passing that data? Add another route? Or just pass the method as a parameter in the json object?