-
Notifications
You must be signed in to change notification settings - Fork 9
Hooks
Fetches data from the local storage data buffer
Parameters:
-
fetch_cb
(function) Callback function that takes an array of telemetry packets as input and maps it to an array of data points to be returned.
Returns: An array of historical telemetry data points as React state variables.
Here is an example callback function for mapping packets to mission times. data
is a JSON object structured the same way as the websocket JSON, except each sub-key contains an array of packets. It is this array of packets that are mapped to new arrays of specific values.
const get_x = (data) => {
return data.altitude.map((packet) => packet.mission_time);
};
// Fetching data
const x_data = useStorage(get_x);
Connects to the backend websocket for ground station data reception. Attempts auto reconnect every 2 seconds, logging connection status to the console. All telemetry data received is written to local storage.
Parameters:
-
websocket_address
(string) The URL address where the websocket is located -
debug
(boolean) Triggers debug mode where all data received from the websocket is logged to the console
Returns: A React reference object containing the latest WebSocket instance, and a state variable containing the status packet received from the backend
Calls a custom callback function when a specific key combination is pressed.
Parameters:
-
key
(string) The JavaScript keycode for the main key used in the combination -
modifier
(string) The name of the modifier key used in the combination (alt, shift, ctrl or null) -
callback
(function) The callback function, taking an event as a parameter, to be executed when the combination is pressed
Returns: Nothing