/// <summary>
        /// Get all gateways.
        /// Route: '/api/gateways'
        /// </summary>
        /// <returns>Array of gateways</returns>
        public static async Task <List <Gateway> > GetGateways()
        {
            try {
                string gateways = await http.Get("/api/gateways");

                return(Factories.CreateCollection <Gateway>(gateways));
            } catch {
                Console.WriteLine("Couldn't get Gateways");
                throw;
            }
        }
示例#2
0
        /// <summary>
        /// Get Parking Lots.
        /// Route: '/api/parking-lots'
        /// </summary>
        /// <returns>Array of parking lots</returns>
        public static async Task <List <ParkingLot> > GetParkingLots()
        {
            try {
                string parkingLots = await http.Get("/api/parking-lots");

                return(Factories.CreateCollection <ParkingLot>(parkingLots));
            } catch {
                Console.WriteLine("Couldn't get Parking Lots");
                throw;
            }
        }
示例#3
0
        /// <summary>
        /// Get Sensors.
        /// Route: '/api/sensors'
        /// </summary>
        /// <param name="filter">Optional</param>
        /// <returns>Array of sensors</returns>
        public static async Task <List <Sensor> > GetSensors(string filter)
        {
            try {
                string sensors = await http.Post("/api/sensors", filter);

                return(Factories.CreateCollection <Sensor>(sensors));
            } catch {
                Console.WriteLine("Couldn't get Sensors");
                throw;
            }
        }
示例#4
0
        /// <summary>
        /// Get sensor history.
        /// Route: '/api/sensor/history'
        /// </summary>
        /// <param name="filter">JSON string with start/end date and optional fields</param>
        /// <returns>An array of sensor time objects</returns>
        public static async Task <List <SensorHistoryLog> > SensorHistory(string filter)
        {
            try {
                string sensorHistoryLogs = await http.Post("/api/sensor/history", filter);

                return(Factories.CreateCollection <SensorHistoryLog>(sensorHistoryLogs));
            } catch {
                Console.WriteLine("Couldn't fetch sensor history");
                throw;
            }
        }
示例#5
0
        /// <summary>
        /// Routes: '/api/sensor/ping' and '/api/sensor/ping-response/{SensorId}/{LastUpdated}'
        /// </summary>
        /// <param name="sensorId">Id of the sensor to look for a response from</param>
        /// <param name="now">Only return results after this ISO timestamp</param>
        /// <returns></returns>
        public static async Task <List <PingResponse> > PingResponse(string sensorId, string now)
        {
            try {
                string pingResponse = await http.Get("/api/sensor/ping-response/" + sensorId + "/" + now);

                return(Factories.CreateCollection <PingResponse>(pingResponse));
            } catch {
                Console.WriteLine("Couldn't Fetch Ping results");
                throw;
            }
        }