2024-06-05, version 1.2
Version: 1.0 of 2022/07/20
Version: 1.1 of 2024/01/11 added query_hits
command and
dt
field to detected_arrow
message
Version: 1.2 of 2024/06/05 added arrow_id
field to
detected_arrow
RyngDyng acts as a TCP/IP
server listening on Port
5061
of its <hostname>
<hostname>
can be the network hostname such as
ryngdyng15
, or, a FQDN such as
ryngdyng15.archery-electronics.com
, or an IP address. The
Wlan access point provided by Archery Analytics will be able to route
these hostnames. If another router is used, the IP address should be
used, or the hostname (depending on the capabilities of the router).
Messages from RyngDyng arejson
encoded text messages.
All json
messages will be followed by a newline character
\n
to make parsing easier
RyngDyng is able to serve an arbitrary number of clients connected. RyngDyng acts as the server.
The clients connect via TCP and then wait for the messages sent by RyngDyng.
Messages are shown as json
encoded objects. The sequence
of the key-value items within an object is random, the methods for
decoding these messages can handle this. Note: whitespaces within
encoded objects are ignored (unless they are part of a string). The
follwing specifications use newlines and whitespaces for
readability.
[a|b|c|...]
denotes a choice out of given
alternatives.
If a state change happens, this message is spontaneously sent to all connected clients
{
"status": "ok",
"action": "state_changed",
"state": <str>,
"value": <bool|list>
}
The state
is one of the following keys. The
value
is the new value for that state.
"detection_active", value: <bool>
"detection_paused", value: <bool>
"shutting_down", value: <bool>
"active_letters", value: <list>
In a typical competition with 122 targets, the active letters would
be ['A', 'B']
and ['C', 'D']
alternating, as
set by the RyngDyng App.
If RyngDyng is shutting down, there will be a state_changed message
with state = shutting_down
and
value = true
.
If an arrow has been detected, this message will be sent to all connected clients:
{
"action": <str>, // "detected_arrow"|"corrected_arrow",
"id": <int>,
"dt": <str>, // UTC datetime as string in ISO format
"td": <int>,
"type": <str>,
"target": <str>, // "A"|"B"|"C"|"D"
"spot": <int>, // "0"|"1"|"2"|"3"|"4"
"hour": <int>,
"end": <int>,
"points": <int>,
"X": <bool>,
"cx": <float>,
"cy": <float>,
"arrow_id": <int>,
}
If action is "corrected_arrow"
, then the values for an
arrow are being corrected. The "id"
refers to the arrow
that was reported previously and for which a correction is made.
td
is the target diameter in cm.
type
is the type of target face as a string. Values
include 122
, 48_spot
, 20_spot
and
many more.
target
is the letter of the target face (`“A”, “B”,
…)
spot
is the spot number for multi spot targets. For a
3-spot, the numbers would be "1", "2", "3"
indicating
upper, middle and lower spot.
hour
is the position of the arrow expressed as the hour
on a clock.
end
is the number of the end (set)
X
is the very center.
A miss (M) is reported as points = 0
.
The coordinates of the arrow center are reported as
(cx, cy)
in mm units. (0, 0)
is the center of
the target face. Negative coordinates belong to the left side or bottom
half.
arrow_id
is the ID of the arrow (if provided, else
0).
This command allows to retrieve the hits from the RyngDyng database. The command from client to RyngDyng is
{
"action": "query_hits",
"date": <str>
}
date
is a string of the form
2024-01-15
.
RyngDyng will send a response of this type
{
"action": "query_hits",
"status": "ok",
"hits": <list> // [hit1, hit2, ...]
}
Each hit contained in the response list is a json object of the same
form as the one in message detected_arrow
described above.
Only difference is that the item action
is not present in
the hits delivered as part of a query_hits
response.
The list of hits may be an empty list []
, if no hits
have been recorded on the requested day.
RyngDyng stores hits in its internal database for 1 year.