2019-01-14 21:43:45 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace AirQuality\Repositories;
|
|
|
|
|
|
|
|
interface IMeasurementDataRepository {
|
2019-01-19 16:08:47 +00:00
|
|
|
/**
|
|
|
|
* Returns the specified reading type for all devices at the specified date
|
|
|
|
* and time.
|
2019-06-21 21:05:13 +00:00
|
|
|
* @param \DateTime $datetime The date and time to get the readings for.
|
2019-02-18 20:44:37 +00:00
|
|
|
* @param int $reading_type_id The reading type id to fetch.
|
2019-01-19 16:08:47 +00:00
|
|
|
* @return array The requested readings.
|
|
|
|
*/
|
2019-02-18 20:44:37 +00:00
|
|
|
public function get_readings_by_date(\DateTime $datetime, int $reading_type_id);
|
2019-01-19 16:08:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the first and last DateTimes of the readings for a specified device.
|
|
|
|
* @param int $device_id The device id to fetch for.
|
2019-06-21 21:05:13 +00:00
|
|
|
* @return \DateTime[] The first and last DateTimes for which readings are stored.
|
2019-01-19 16:08:47 +00:00
|
|
|
*/
|
|
|
|
public function get_device_reading_bounds(int $device_id);
|
|
|
|
/**
|
|
|
|
* Gets the readings of a specified type for a specific device between the 2 given dates and times.
|
|
|
|
* @param int $device_id The id of the device to fetch data for.
|
2019-06-21 21:05:13 +00:00
|
|
|
* @param int $type_id The reading type to fetch.
|
|
|
|
* @param \DateTime $start The starting DateTime.
|
|
|
|
* @param \DateTime $end The ending DateTime.
|
2019-01-19 21:12:11 +00:00
|
|
|
* @param int $average_seconds The number of seconds to averageg the data over. For example a value of 3600 (1 hour) will return 1 data point per hour, with the value of each point an average of all the readings for that hour.
|
2019-01-19 16:08:47 +00:00
|
|
|
* @return array The requested data.
|
|
|
|
*/
|
2019-02-18 20:44:37 +00:00
|
|
|
public function get_readings_by_device(int $device_id, int $type_id, \DateTime $start, \DateTime $end, int $average_seconds = 1);
|
2019-01-19 16:08:47 +00:00
|
|
|
|
2019-06-13 21:02:04 +00:00
|
|
|
/**
|
|
|
|
* Retrieves a given number of the most recent readings for a specific device.
|
|
|
|
* @param int $device_id The id of the device to get recent readings for.
|
|
|
|
* @param int $type_id The id of the reading type to fetch data for.
|
|
|
|
* @param int $count The number of readings to return.
|
|
|
|
* @return array The requested data.
|
|
|
|
*/
|
|
|
|
public function get_recent_readings(int $device_id, int $type_id, int $count);
|
|
|
|
|
2019-01-14 21:43:45 +00:00
|
|
|
}
|