- Static / harcoded topic
- Single Topic
- JSON format
- Code command
- Model based command
Monitor healthcheck if needed
- Publish healthcheck periodically
- Publish (PUT) payload when requested (GET)
- GUI Topic:
scale_shoot_frontend - Backend:
scale_shoot_backend
NOTE: Topic is harcoded
Payload have this JSON structure
{
"cmd": "x_command",
"type": "req_type",
"data": {
...
}
}| Command | Type | Description |
|---|---|---|
| healthcheck | PUT | Realtime status node |
| capture | PUT, GET | Send / Request capture |
| swap_gate | GET | Change gate A->B and vice versa |
| open_gate | PUT | Open Gate |
| toggle_mode | PUT | Change mode manual / automatic |
| wifi_config | PUT, GET | Wifi configuration |
| calibration | PUT | Proses calibration |
{
"cmd": "healthcheck",
"type": "PUT",
"data": {
"device_id": "77:98:17:AA",
"code": "200",
"timestamp": "1655541152",
"message": "ok",
}
}GET
{
"cmd": "capture",
"type": "GET",
}PUT
{
"cmd": "capture",
"type": "PUT",
"data": {
"rfid": "111898123",
"capture_file": "/paht/to/file.jpg",
"weight": "35",
"timestamp": "1655541152"
}
}{
"cmd": "swap_gate",
"type": "PUT",
"data" {
"in": "gate_a",
"out": "gate_b"
}
}- in / out: Target Gate Id
{
"cmd": "open_gate",
"type": "PUT",
"data" {
"target": "gate_a",
}
}- type:
PUT|GET - target: Gate Target id
{
"cmd": "toggle_mode",
"type": "PUT",
"data" {
"mode": "manual",
}
}- type:
PUT|GET - mode:
manual|auto
GET
{
"cmd": "wifi_config",
"type": "GET",
}PUT
{
"cmd": "wifi_config",
"type": "PUT",
"data": {
"ssid": "My AP",
"psk": "12345abc",
}Pada proses kalibrasi, message di atur oleh node yg melakukan publish. Hal ini memungkinkan publisher (eg: backend) untuk mengirim pesan kalibrasi sesuai dengan hasil kalibrasi.
PUT
{
"cmd": "calibration",
"type": "PUT",
"data": {
"state": "init"
"message": "Init kalibrasi"
}
}- state:
init|start|endinit: init kalibrasi, kirim state init ke backend untuk memulai kalibrasistart: backend meresponse dengan statestartuntuk menandakan kalibrasi sudah dimulaiend: backend stateenduntuk menandakan kalibrasi selesai
- message: pesan kalibrasi