2019-05-22 18:58:46 +00:00
-- See for data provided by TTN https://www.thethingsnetwork.org/docs/applications/mqtt/api.html
2019-07-10 13:20:46 +00:00
CREATE TABLE IF NOT EXISTS readings (
2019-05-22 17:04:46 +00:00
id INTEGER PRIMARY KEY , -- Random unique integer
2019-07-10 13:32:58 +00:00
latitude FLOAT NOT NULL , -- Latitude component of GPS co-ordinates of reading
longitude FLOAT NOT NULL , -- Longitude component of GPS co-ordinates of reading,
2019-07-11 13:03:27 +00:00
data_rate TEXT , -- The id of the data rate code in the data_rates table that describes the data rate at which the message was transmitted
2019-07-10 13:20:46 +00:00
code_rate TEXT -- The coding rate at which the message was transmitted. FUTURE: This may need to be an INTEGER field - not sure
2019-07-09 16:31:08 +00:00
-- bit_rate INTEGER, -- The bit rate at which the message was transmitted -- We didn't actually recieve this - disparity between API docs & actual message
2019-05-22 17:04:46 +00:00
) ;
2019-07-10 13:20:46 +00:00
CREATE TABLE IF NOT EXISTS rssis (
2019-05-22 17:04:46 +00:00
id INTEGER PRIMARY KEY , -- Random unique int
reading_id INTEGER , -- The id of the object in the readings table that this rssi measurement belongs to
2019-07-10 11:21:38 +00:00
gateway_id TEXT , -- Gateway id that the RSSI was from
2019-05-22 17:04:46 +00:00
rssi FLOAT , -- The RSSI value itself
2019-05-22 18:58:06 +00:00
snr FLOAT , -- The signal-to-noise ratio
2019-05-22 17:04:46 +00:00
channel INTEGER -- The channel that the RSSI was received over. We might be able to use this to detect single-channel gateways
) ;
2019-07-10 13:20:46 +00:00
CREATE TABLE IF NOT EXISTS gateways (
2019-05-22 18:58:06 +00:00
id TEXT PRIMARY KEY , -- The gateway's name
2019-07-10 13:32:58 +00:00
latitude FLOAT , -- Latitude component of the claimed GPS co-ordinates of the gateway
longitude FLOAT , -- Longitude component of the claimed GPS co-ordinates of the gateway
2019-05-22 17:04:46 +00:00
altitude FLOAT -- Claimed alitude of the gateway
) ;
2019-05-22 17:05:40 +00:00
-- UPDATE 1 --
- - - - - - - - - - - - --
-- UPDATE 2 --
- - - - - - - - - - - - --
-- ....