These are representative examples of all available commands with responses.
{
"command": "setState",
"params": {
"pinName": "GPIO21",
"state": true
}
}{
"messageType": "ack",
"data":{
"command": "setState",
"pinName": "GPIO21"
}
}{
"command": "toggleState",
"params": {
"pinName": "GPIO21"
}
}{
"messageType": "ack",
"data": {
"command": "toggleState",
"pinName": "GPIO21",
"state":false
}
}{
"command": "readState",
"params": {
"pinName": "GPIO21"
}
}{
"messageType": "state",
"data": {
"pinName": "GPIO21",
"state": true
}
}{
"command": "readDirection",
"params": {
"pinName": "GPIO21"
}
}{
"messageType": "direction",
"data": {
"pinName": "GPIO21",
"direction": "out"
}
}{
"command": "registerPin",
"params": {
"pinName": "GPIO22",
"direction": "in",
"edge": "falling"
}
}{
"messageType": "ack",
"data": {
"command": "registerPin",
"pinName":"GPIO22"
}
}{
"command": "getRegisteredPins"
}{
"messageType": "registeredPins",
"data": [
{
"pinName": "GPIO17",
"direction":"in",
"edge":"both",
"state":true
},
{
"pinName": "GPIO21",
"direction": "out",
"state": true
},
{
"pinName": "GPIO22",
"direction": "in",
"edge": "rising",
"state": true
}
]
}If a command is unrecognised or malformed the server will respond with:
{
"messageType": "error",
"data": {
"errorString": "request message was malformed"
}
}If a command attempts to access a pin that has not been registered the server will respond with:
{
"messageType": "error",
"data": {
"errorString": "pin XXX is not registered"
}
}where XXX is the name of the pin requested.